aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorOleg Pudeyev <oleg@bsdpower.com>2012-10-17 15:03:06 -0400
committerOleg Pudeyev <oleg@bsdpower.com>2012-10-17 15:08:09 -0400
commitc630480ca1a426cb0897be35626baac2694fccf5 (patch)
tree4c10e50d452bbaeacb2fd057b3986edad112872a /phpBB/includes
parentf0544c884f6862e41bf35e6bd89db5849aa74e9f (diff)
downloadforums-c630480ca1a426cb0897be35626baac2694fccf5.tar
forums-c630480ca1a426cb0897be35626baac2694fccf5.tar.gz
forums-c630480ca1a426cb0897be35626baac2694fccf5.tar.bz2
forums-c630480ca1a426cb0897be35626baac2694fccf5.tar.xz
forums-c630480ca1a426cb0897be35626baac2694fccf5.zip
[ticket/10848] Redirect from adm to installer correctly.
PHPBB3-10848
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/functions.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index ca58220619..2391b45038 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -1176,6 +1176,36 @@ else
}
}
+/**
+* Eliminates useless . and .. components from specified path.
+*
+* @param string $path Path to clean
+* @return string Cleaned path
+*/
+function clean_path($path)
+{
+ $exploded = explode('/', $path);
+ $filtered = array();
+ foreach ($exploded as $part)
+ {
+ if ($part === '.' && !empty($filtered))
+ {
+ continue;
+ }
+
+ if ($part === '..' && !empty($filtered) && $filtered[sizeof($filtered) - 1] !== '..')
+ {
+ array_pop($filtered);
+ }
+ else
+ {
+ $filtered[] = $part;
+ }
+ }
+ $path = implode('/', $filtered);
+ return $path;
+}
+
if (!function_exists('htmlspecialchars_decode'))
{
/**