diff options
author | Andreas Fischer <bantu@phpbb.com> | 2012-10-18 16:34:59 +0200 |
---|---|---|
committer | Andreas Fischer <bantu@phpbb.com> | 2012-10-18 16:34:59 +0200 |
commit | 4f3f4a40d66857f1db60d216f4a7070d74997918 (patch) | |
tree | 8f8a423511822c7f281b95a1b8c336269700b04c /phpBB/includes/functions.php | |
parent | 0a260f80af6f94047a26d9db16a5d2c6407c3958 (diff) | |
parent | c84268d2f9a758a3bcc570acc60c01e1185eeb14 (diff) | |
download | forums-4f3f4a40d66857f1db60d216f4a7070d74997918.tar forums-4f3f4a40d66857f1db60d216f4a7070d74997918.tar.gz forums-4f3f4a40d66857f1db60d216f4a7070d74997918.tar.bz2 forums-4f3f4a40d66857f1db60d216f4a7070d74997918.tar.xz forums-4f3f4a40d66857f1db60d216f4a7070d74997918.zip |
Merge branch 'develop-olympus' into develop
* develop-olympus:
[ticket/10848] Move include up.
[ticket/10848] Add phpbb_ prefix.
[ticket/10848] Redirect from adm to installer correctly.
Conflicts:
phpBB/includes/functions.php
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r-- | phpBB/includes/functions.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 0c9421c12f..743bfd0c0d 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1018,6 +1018,36 @@ else } } +/** +* Eliminates useless . and .. components from specified path. +* +* @param string $path Path to clean +* @return string Cleaned path +*/ +function phpbb_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; +} + // functions used for building option fields /** |