diff options
author | Tristan Darricau <github@nicofuma.fr> | 2014-05-24 17:57:01 +0200 |
---|---|---|
committer | Tristan Darricau <github@nicofuma.fr> | 2014-05-24 17:57:01 +0200 |
commit | f7896f46a5d93ce9119db71e75d77cc1af5bc139 (patch) | |
tree | 48b494337138a240f3fedefdf2ae98c235a9a88d | |
parent | 42bc2612c45a40b2be8940fe3b6b9813e8bed9cb (diff) | |
download | forums-f7896f46a5d93ce9119db71e75d77cc1af5bc139.tar forums-f7896f46a5d93ce9119db71e75d77cc1af5bc139.tar.gz forums-f7896f46a5d93ce9119db71e75d77cc1af5bc139.tar.bz2 forums-f7896f46a5d93ce9119db71e75d77cc1af5bc139.tar.xz forums-f7896f46a5d93ce9119db71e75d77cc1af5bc139.zip |
[ticket/12589] Search directly in $directory if it's an absolute sub-path
PHPBB3-12589
-rw-r--r-- | phpBB/phpbb/extension/finder.php | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/phpBB/phpbb/extension/finder.php b/phpBB/phpbb/extension/finder.php index 6cc6e1808a..09c4f6d3e0 100644 --- a/phpBB/phpbb/extension/finder.php +++ b/phpBB/phpbb/extension/finder.php @@ -463,6 +463,7 @@ class finder } else if ($directory && $directory[0] === '/') { + $path .= substr($directory, 1); $directory_pattern = '^' . preg_quote(str_replace('/', DIRECTORY_SEPARATOR, $directory) . DIRECTORY_SEPARATOR, '#'); } else @@ -494,7 +495,11 @@ class finder if ($is_dir) { $relative_path = $iterator->getInnerIterator()->getSubPath() . DIRECTORY_SEPARATOR . basename($filename) . DIRECTORY_SEPARATOR; - if ($relative_path[0] !== DIRECTORY_SEPARATOR) + if ($directory && $directory[0] === '/') + { + $relative_path = str_replace('/', DIRECTORY_SEPARATOR, $directory) . DIRECTORY_SEPARATOR . $relative_path; + } + else if ($relative_path[0] !== DIRECTORY_SEPARATOR) { $relative_path = DIRECTORY_SEPARATOR . $relative_path; } @@ -502,6 +507,14 @@ class finder else { $relative_path = DIRECTORY_SEPARATOR . $iterator->getInnerIterator()->getSubPathname(); + if ($directory && $directory[0] === '/') + { + $relative_path = str_replace('/', DIRECTORY_SEPARATOR, $directory) . DIRECTORY_SEPARATOR . $relative_path; + } + else + { + $relative_path = DIRECTORY_SEPARATOR . $relative_path; + } } if ((!$suffix || substr($relative_path, -strlen($suffix)) === $suffix) && |