|
|
|
@ -2,25 +2,26 @@ |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Provides access to various HTTP request elements: GET, POST, FILE, etc paramaters. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* @license see /license.txt |
|
|
|
|
* @author Laurent Opprecht <laurent@opprecht.info> for the Univesity of Geneva |
|
|
|
|
*/ |
|
|
|
|
class Request |
|
|
|
|
|
|
|
|
|
class Request2 |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
public static function get($key, $default = null) |
|
|
|
|
{ |
|
|
|
|
return isset($_REQUEST[$key]) ? $_REQUEST[$key] : $default; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static function has($key){ |
|
|
|
|
return isset($_REQUEST[$key]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns true if the request is a GET request. False otherwise. |
|
|
|
|
* |
|
|
|
|
* |
|
|
|
|
* @return bool |
|
|
|
|
*/ |
|
|
|
|
public static function is_get() |
|
|
|
@ -29,15 +30,15 @@ class Request |
|
|
|
|
$method = strtoupper($method); |
|
|
|
|
return $method == 'GET'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static function post($key, $default = null) |
|
|
|
|
{ |
|
|
|
|
return isset($_POST[$key]) ? $_POST[$key] : $default; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns true if the request is a POST request. False otherwise. |
|
|
|
|
* |
|
|
|
|
* |
|
|
|
|
* @return bool |
|
|
|
|
*/ |
|
|
|
|
public static function is_post() |
|
|
|
@ -46,7 +47,7 @@ class Request |
|
|
|
|
$method = strtoupper($method); |
|
|
|
|
return $method == 'POST'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* |
|
|
|
|
* @return RequestServer |
|
|
|
@ -66,4 +67,4 @@ class Request |
|
|
|
|
return isset($_ENV[$key]) ? $_ENV[$key] : $default; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|