From: Davide Franco Date: Wed, 20 Jul 2011 16:43:09 +0000 (+0200) Subject: bacula-web: Optmized getRequestVars() function in Chhtp class X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=5620cf6170881c06fa83042fba4e990b90fed57f;p=bacula%2Fbacula bacula-web: Optmized getRequestVars() function in Chhtp class --- 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