diff options
| author | Christian Weiske <cweiske@cweiske.de> | 2014-07-04 18:25:01 +0200 |
|---|---|---|
| committer | Christian Weiske <cweiske@cweiske.de> | 2014-07-04 18:25:01 +0200 |
| commit | f6e177a89832ba36409ac845eb72522e051bb0f3 (patch) | |
| tree | c1df7e101b30060c3cb406ef19c4c69c985a01a1 /src/phorkie/Tools.php | |
| parent | 00d96cfc38f3d1d1d317ee56b4fdab0e9341e792 (diff) | |
| download | phorkie-f6e177a89832ba36409ac845eb72522e051bb0f3.tar.gz phorkie-f6e177a89832ba36409ac845eb72522e051bb0f3.zip | |
config file setup instructions
Diffstat (limited to 'src/phorkie/Tools.php')
| -rw-r--r-- | src/phorkie/Tools.php | 12 |
1 files changed, 12 insertions, 0 deletions
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; + } } ?> |
