Skip to content
Snippets Groups Projects
Commit 7d20e98a authored by Bart Visscher's avatar Bart Visscher
Browse files

Move getting the path info to OC_Request

parent 95031cb1
No related branches found
No related tags found
No related merge requests found
...@@ -52,6 +52,19 @@ class OC_Request { ...@@ -52,6 +52,19 @@ class OC_Request {
return($proto); 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 * @brief Check if this is a no-cache request
* @returns true for no-cache * @returns true for no-cache
......
...@@ -2,11 +2,7 @@ ...@@ -2,11 +2,7 @@
$RUNTIME_NOSETUPFS = true; $RUNTIME_NOSETUPFS = true;
$RUNTIME_NOAPPS = TRUE; $RUNTIME_NOAPPS = TRUE;
require_once('lib/base.php'); require_once('lib/base.php');
if (array_key_exists('PATH_INFO', $_SERVER)){ $path_info = OC_Request::getPathInfo();
$path_info = $_SERVER['PATH_INFO'];
}else{
$path_info = substr($_SERVER['REQUEST_URI'], strlen($_SERVER['SCRIPT_NAME']));
}
if ($path_info === false) { if ($path_info === false) {
OC_Response::setStatus(OC_Response::STATUS_NOT_FOUND); OC_Response::setStatus(OC_Response::STATUS_NOT_FOUND);
exit; exit;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment