aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authormistic100 <mistic@piwigo.org>2013-07-21 12:05:10 +0000
committermistic100 <mistic@piwigo.org>2013-07-21 12:05:10 +0000
commit0b203a8701070f053300aea751273efc1875fc74 (patch)
treee8bd16a1a4d2a3dd976ae37b50f6d8cdd3d94844 /include
parent64ab1c8a2acb999e925c112bc311c597f0d572ef (diff)
add mandatory option for check_input_parameter
git-svn-id: http://piwigo.org/svn/trunk@24009 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include')
-rw-r--r--include/functions.inc.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/include/functions.inc.php b/include/functions.inc.php
index 59136afbd..32417cfd9 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -1546,10 +1546,11 @@ function get_pwg_token()
* @param array param_array
* @param boolean is_array
* @param string pattern
+ * @param boolean mandatory
*
* @return void
*/
-function check_input_parameter($param_name, $param_array, $is_array, $pattern)
+function check_input_parameter($param_name, $param_array, $is_array, $pattern, $mandatory=false)
{
$param_value = null;
if (isset($param_array[$param_name]))
@@ -1560,6 +1561,10 @@ function check_input_parameter($param_name, $param_array, $is_array, $pattern)
// it's ok if the input parameter is null
if (empty($param_value))
{
+ if ($mandatory)
+ {
+ fatal_error('[Hacking attempt] the input parameter "'.$param_name.'" is not valid');
+ }
return true;
}