From ec259e8afd947d14019941a9267c5e1dbcfd8da3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 2 Aug 2017 09:38:17 +0200 Subject: [PATCH] Allow checking parameters in the request MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michal Čihař --- libraries/classes/Util.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/libraries/classes/Util.php b/libraries/classes/Util.php index 786f755aa5..72a033aaa7 100644 --- a/libraries/classes/Util.php +++ b/libraries/classes/Util.php @@ -1965,21 +1965,27 @@ class Util * Called by each script that needs parameters, it displays * an error message and, by default, stops the execution. * - * @param string[] $params The names of the parameters needed by the calling - * script + * @param string[] $params The names of the parameters needed by the calling + * script + * @param boolean $request Check parameters in request * * @return void * * @access public */ - public static function checkParameters($params) + public static function checkParameters($params, $request=false) { $reported_script_name = basename($GLOBALS['PMA_PHP_SELF']); $found_error = false; $error_message = ''; + if ($request) { + $array = $_REQUEST; + } else { + $array = $GLOBALS; + } foreach ($params as $param) { - if (! isset($GLOBALS[$param])) { + if (! isset($array[$param])) { $error_message .= $reported_script_name . ': ' . __('Missing parameter:') . ' ' . $param