]> git.quilime.com - plog.git/commitdiff
keep ..'s out of path
authorGabriel Dunne <gdunne@quilime.com>
Sun, 11 Jul 2010 00:54:38 +0000 (17:54 -0700)
committerGabriel Dunne <gdunne@quilime.com>
Sun, 11 Jul 2010 00:54:38 +0000 (17:54 -0700)
lib/output.php

index 6866c6c43365bb2b69daf0275aacbdf369c727ed..a7e88e698c393a57ce8746001e8ef8ddca7221b2 100644 (file)
@@ -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() . '/'));
 }