diff options
author | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-08-20 11:29:08 +0000 |
---|---|---|
committer | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-08-20 11:29:08 +0000 |
commit | a679750e03de9abaed8a323533b896d8a1f10d2b (patch) | |
tree | 34476c7ce2430de3a1c5ca3c5e84b25ad70db8cd /engine/lib/input.php | |
parent | 5dfdf35745318385c0ddcb4018eb65f17da24f47 (diff) | |
download | elgg-a679750e03de9abaed8a323533b896d8a1f10d2b.tar.gz elgg-a679750e03de9abaed8a323533b896d8a1f10d2b.tar.bz2 |
Refs #273: Extra sanity checking on install
git-svn-id: https://code.elgg.org/elgg/trunk@2025 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/input.php')
-rw-r--r-- | engine/lib/input.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/engine/lib/input.php b/engine/lib/input.php index 187242f8e..4b36393d8 100644 --- a/engine/lib/input.php +++ b/engine/lib/input.php @@ -63,6 +63,25 @@ $CONFIG->input = array();
$CONFIG->input[trim($variable)] = trim($value);
+ } + + /** + * Sanitise file paths for input, ensuring that they begin and end with slashes etc. + * + * @param string $path The path + * @return string + */ + function sanitise_filepath($path) + { + // Convert to correct UNIX paths + $path = str_replace('\\', '/', $path); + + // Sort trailing slash + $path = trim($path); + $path = rtrim($path, " /"); + $path = $path . "/"; + + return $path; }
/**
|