Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Foellmann <foellmann@foe-services.de>2014-04-05 17:35:38 +0400
committerChristian Foellmann <foellmann@foe-services.de>2014-04-05 17:35:38 +0400
commit9eb27ef6ebc763ddc6f6278462b8ffeed6de0e36 (patch)
treed3b4a1c7ae68cafb05b9d60040c9c22d457cee62 /libraries/cleanup.lib.php
parentd472216554769ba596795f23a70c1809fa8897a3 (diff)
INIT phpmyadmin 4.1.12 multilanguage
Diffstat (limited to 'libraries/cleanup.lib.php')
-rw-r--r--libraries/cleanup.lib.php50
1 files changed, 50 insertions, 0 deletions
diff --git a/libraries/cleanup.lib.php b/libraries/cleanup.lib.php
new file mode 100644
index 0000000000..2874f5a0e2
--- /dev/null
+++ b/libraries/cleanup.lib.php
@@ -0,0 +1,50 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Functions for cleanup of user input.
+ *
+ * @package PhpMyAdmin
+ */
+if (! defined('PHPMYADMIN')) {
+ exit;
+}
+
+/**
+ * Removes all variables from request except whitelisted ones.
+ *
+ * @param string &$whitelist list of variables to allow
+ *
+ * @return void
+ * @access public
+ */
+function PMA_removeRequestVars(&$whitelist)
+{
+ // do not check only $_REQUEST because it could have been overwritten
+ // and use type casting because the variables could have become
+ // strings
+ $keys = array_keys(
+ array_merge((array)$_REQUEST, (array)$_GET, (array)$_POST, (array)$_COOKIE)
+ );
+
+ foreach ($keys as $key) {
+ if (! in_array($key, $whitelist)) {
+ unset($_REQUEST[$key], $_GET[$key], $_POST[$key], $GLOBALS[$key]);
+ } else {
+ // allowed stuff could be compromised so escape it
+ // we require it to be a string
+ if (isset($_REQUEST[$key]) && ! is_string($_REQUEST[$key])) {
+ unset($_REQUEST[$key]);
+ }
+ if (isset($_POST[$key]) && ! is_string($_POST[$key])) {
+ unset($_POST[$key]);
+ }
+ if (isset($_COOKIE[$key]) && ! is_string($_COOKIE[$key])) {
+ unset($_COOKIE[$key]);
+ }
+ if (isset($_GET[$key]) && ! is_string($_GET[$key])) {
+ unset($_GET[$key]);
+ }
+ }
+ }
+}
+?>