about summary refs log tree commit diff stats
path: root/include/common.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/common.php')
-rw-r--r--include/common.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/common.php b/include/common.php
index 12753c8..684d9c6 100644
--- a/include/common.php
+++ b/include/common.php
@@ -32,3 +32,16 @@
 
         return "";
     }
+
+    /**
+     * This is used for user http parameters unless HTML code is actually needed.
+     */
+    function clean(mixed $param): mixed {
+        if (is_array($param)) {
+            return array_map("trim", array_map("strip_tags", $param));
+        } else if (is_string($param)) {
+            return trim(strip_tags($param));
+        } else {
+            return $param;
+        }
+    }