From be033e189ba1cd31b34e65c41e3c43926d4544ae Mon Sep 17 00:00:00 2001 From: Davide Franco Date: Wed, 20 Jul 2011 18:43:09 +0200 Subject: [PATCH] bacula-web: Optmized getRequestVars() function in Chhtp class --- gui/bacula-web/includes/utils/chttp.class.php | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/gui/bacula-web/includes/utils/chttp.class.php b/gui/bacula-web/includes/utils/chttp.class.php index 9508b9161c..2d972bd04e 100644 --- a/gui/bacula-web/includes/utils/chttp.class.php +++ b/gui/bacula-web/includes/utils/chttp.class.php @@ -16,29 +16,30 @@ */ class CHttp { - private function getSafeValue( $value ) + // Return a strip taged value + private static function getSafeValue( $value ) { - return $safe_value; + return strip_tags($value); } - // Return an array of $_POST or $_GET values - // If the value doesn't exist, the return value is FALSE - public static function getRequestVars( $type = 'POST', $vars = array() ) - { - $values = array(); - - if( count($vars) > 0 ) - - switch( $type ) + // Return an array of $_POST or $_GET values + // If $_POST or $_GET are empty, the return value is FALSE + public static function getRequestVars( &$value ) { - case 'GET': + $value_list = array(); + + if( is_array( $value ) and count($value) > 0 ) { + foreach( $value as $key => $var ) { + if( isset($value[$key] ) ) + $value_list[$key] = self::getSafeValue( $var ); + else + $value_list[$key] = false; + } + }else { + return false; + } - break; - case 'POST': - - break; - } - return false; + return $value_list; } } // end class -- 2.39.5