]> git.sur5r.net Git - bacula/bacula/commitdiff
bacula-web: Optmized getRequestVars() function in Chhtp class
authorDavide Franco <bacula-dev@dflc.ch>
Wed, 20 Jul 2011 16:43:09 +0000 (18:43 +0200)
committerKern Sibbald <kern@sibbald.com>
Sat, 20 Apr 2013 12:49:25 +0000 (14:49 +0200)
gui/bacula-web/includes/utils/chttp.class.php

index 9508b9161cb898bbcdb39e6660e8e6a4e2ffbe63..2d972bd04e7c0d64c481b66e655e7426ff31215a 100644 (file)
 */
        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