upgrade
This commit is contained in:
60
main/inc/lib/system/web/request.class.php
Normal file
60
main/inc/lib/system/web/request.class.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Provides access to various HTTP request elements: GET, POST, FILE, etc paramaters.
|
||||
* @license see /license.txt
|
||||
* @deprecated
|
||||
* @author Laurent Opprecht <laurent@opprecht.info> for the Univesity of Geneva
|
||||
*/
|
||||
class Request
|
||||
{
|
||||
|
||||
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()
|
||||
{
|
||||
$method = self::server()->request_method();
|
||||
$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()
|
||||
{
|
||||
$method = self::server()->request_method();
|
||||
$method = strtoupper($method);
|
||||
return $method == 'POST';
|
||||
}
|
||||
|
||||
static function file($key, $default = null)
|
||||
{
|
||||
return isset($_FILES[$key]) ? $_FILES[$key] : $default;
|
||||
}
|
||||
|
||||
static function environment($key, $default = null)
|
||||
{
|
||||
return isset($_ENV[$key]) ? $_ENV[$key] : $default;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user