aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/input.php
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-08-20 11:29:08 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-08-20 11:29:08 +0000
commita679750e03de9abaed8a323533b896d8a1f10d2b (patch)
tree34476c7ce2430de3a1c5ca3c5e84b25ad70db8cd /engine/lib/input.php
parent5dfdf35745318385c0ddcb4018eb65f17da24f47 (diff)
downloadelgg-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.php19
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;
}
/**