aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/input.php
diff options
context:
space:
mode:
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;
}
/**