Ejemplo n.º 1
0
 /**
  * Fetches and returns a request array.
  *
  * The default behaviour is fetching variables depending on the
  * current request method: GET and HEAD will result in returning
  * $_GET, POST and PUT will result in returning $_POST.
  *
  * You can force the source by setting the $hash parameter:
  *
  *   post		$_POST
  *   get		$_GET
  *   files		$_FILES
  *   cookie		$_COOKIE
  *   env		$_ENV
  *   server		$_SERVER
  *   method		via current $_SERVER['REQUEST_METHOD']
  *   default	$_REQUEST
  *
  * @static
  * @param	string	$hash	to get (POST, GET, FILES, METHOD)
  * @param	int		$mask	Filter mask for the variable
  * @return	mixed	Request hash
  * @since	1.5
  */
 public static function get($hash = 'default', $mask = 0)
 {
     $hash = strtoupper($hash);
     if ($hash === 'METHOD') {
         $hash = strtoupper($_SERVER['REQUEST_METHOD']);
     }
     switch ($hash) {
         case 'GET':
             $input = $_GET;
             break;
         case 'POST':
             $input = $_POST;
             break;
         case 'FILES':
             $input = $_FILES;
             break;
         case 'COOKIE':
             $input = $_COOKIE;
             break;
         case 'ENV':
             $input =& $_ENV;
             break;
         case 'SERVER':
             $input =& $_SERVER;
             break;
         default:
             $input = $_REQUEST;
             break;
     }
     $result = SomeRequest::_cleanVar($input, $mask);
     // Handle magic quotes compatability
     if (get_magic_quotes_gpc() && $hash != 'FILES') {
         $result = SomeRequest::_stripSlashesRecursive($result);
     }
     return $result;
 }