diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/phorkie/SetupCheck.php | 7 | ||||
| -rw-r--r-- | src/phorkie/Tools.php | 12 |
2 files changed, 17 insertions, 2 deletions
diff --git a/src/phorkie/SetupCheck.php b/src/phorkie/SetupCheck.php index 69cffd8..f8edd86 100644 --- a/src/phorkie/SetupCheck.php +++ b/src/phorkie/SetupCheck.php @@ -48,9 +48,12 @@ class SetupCheck { foreach ($GLOBALS['phorkie']['cfgfiles'] as $file => $loaded) { if ($loaded) { - $this->ok('Loaded config file: ' . $file); + $this->ok('Loaded config file: ' . Tools::foldPath($file)); } else { - $this->info('Possible config file: ' . $file . ' (not loaded)'); + $this->info( + 'Possible config file: ' . Tools::foldPath($file) + . ' (not loaded)' + ); } } } diff --git a/src/phorkie/Tools.php b/src/phorkie/Tools.php index 7c9c46e..7819cda 100644 --- a/src/phorkie/Tools.php +++ b/src/phorkie/Tools.php @@ -96,5 +96,17 @@ class Tools return '/'; } + + /** + * Resolves "/../" and "/./" in file paths without validating them. + */ + public static function foldPath($path) + { + $path = str_replace('/./', '/', $path); + $path = str_replace('/./', '/', $path); + $path = preg_replace('#/[^/]+/\.\./#', '/', $path); + $path = preg_replace('#/[^/]+/\.\./#', '/', $path); + return $path; + } } ?> |
