From ccd4a725da5269189cdb73a3d7048359a5d2cd4d Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 18 Apr 2013 09:53:02 +0200 Subject: [PATCH] [ticket/11362] Add compatibility function phpbb_clean_path() again The function first depends on the container, but also works without it and without autoload. The reason for this is, it might be used before that stuff is set up, like it has been in our common.php PHPBB3-11362 --- phpBB/includes/functions.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 39a8dbc880..998c52b7c6 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1046,6 +1046,38 @@ else } } +/** +* Eliminates useless . and .. components from specified path. +* +* Deprecated, use filesystem class instead +* +* @param string $path Path to clean +* @return string Cleaned path +* +* @deprecated +*/ +function phpbb_clean_path($path) +{ + global $phpbb_container; + + if ($phpbb_container) + { + $phpbb_filesystem = new phpbb_filesystem(); + } + else + { + // The container is not yet loaded, use a new instance + if (!class_exists('phpbb_filesystem')) + { + global $phpbb_root_path, $phpEx; + require($phpbb_root_path . 'includes/filesystem.' . $phpEx); + } + $phpbb_filesystem = new phpbb_filesystem(); + } + + return $phpbb_filesystem->clean_path($path); +} + // functions used for building option fields /**