diff --git a/lib/request.php b/lib/request.php index d013844f08dd6bfc21bdaeff597de2c16dd09c14..9e38e6bbd13d73ce0063b1c7a43e6b1bb9257e0d 100644 --- a/lib/request.php +++ b/lib/request.php @@ -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 diff --git a/remote.php b/remote.php index 8dc4df1bd2317d1b19f25f70ce965d437775f202..483b19555c8b556ffdb5063c87b1212634bb9d83 100644 --- a/remote.php +++ b/remote.php @@ -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;