From: Gabriel Dunne Date: Sun, 11 Jul 2010 00:54:38 +0000 (-0700) Subject: keep ..'s out of path X-Git-Url: https://git.quilime.com/?a=commitdiff_plain;h=eaae5042b421f1c19f54fc2eba2a3edccfed5225;p=plog.git keep ..'s out of path --- diff --git a/lib/output.php b/lib/output.php index 6866c6c..a7e88e6 100644 --- a/lib/output.php +++ b/lib/output.php @@ -60,7 +60,7 @@ if( !function_exists('parse_ini_string') ) { /** - * removes double slashes + * removes double slashes in path * @param path */ function clean_slashes($path) @@ -69,6 +69,15 @@ function clean_slashes($path) } +/** + * makes sure path is valid + */ +function validate_path() +{ + +} + + /** * @param int $seconds Number of seconds to convert into a human-readable timestamp * @return tring Human-readable approximate timestamp like "2 hours" @@ -148,8 +157,8 @@ function get_url_parts() function get_url() { -$path_info = pathinfo($_SERVER['SCRIPT_URL']); -$path_info['url'] = $_SERVER['SCRIPT_URL']; + $path_info = pathinfo($_SERVER['SCRIPT_URL']); + $path_info['url'] = preg_match("/\.\.\//", $_SERVER['SCRIPT_URL']) ? '/' : $_SERVER['SCRIPT_URL']; return $path_info; //substr($_SERVER['SCRIPT_URL'], strlen(get_base_dir() . '/')); }