Move getting the path info to OC_Request

This commit is contained in:
Bart Visscher 2012-08-07 20:33:25 +02:00
parent 95031cb139
commit 7d20e98aec
2 changed files with 14 additions and 5 deletions

View file

@ -52,6 +52,19 @@ class OC_Request {
return($proto);
}
/**
* @brief get Path info from request
* @returns string Path info or false when not found
*/
public static function getPathInfo() {
if (array_key_exists('PATH_INFO', $_SERVER)){
$path_info = $_SERVER['PATH_INFO'];
}else{
$path_info = substr($_SERVER['REQUEST_URI'], strlen($_SERVER['SCRIPT_NAME']));
}
return $path_info;
}
/**
* @brief Check if this is a no-cache request
* @returns true for no-cache

View file

@ -2,11 +2,7 @@
$RUNTIME_NOSETUPFS = true;
$RUNTIME_NOAPPS = TRUE;
require_once('lib/base.php');
if (array_key_exists('PATH_INFO', $_SERVER)){
$path_info = $_SERVER['PATH_INFO'];
}else{
$path_info = substr($_SERVER['REQUEST_URI'], strlen($_SERVER['SCRIPT_NAME']));
}
$path_info = OC_Request::getPathInfo();
if ($path_info === false) {
OC_Response::setStatus(OC_Response::STATUS_NOT_FOUND);
exit;