Check for missing path_info, also use OC_Response for 404 error

This commit is contained in:
Bart Visscher 2012-06-09 14:32:02 +02:00
parent 76de92477f
commit 014895aeab
1 changed files with 6 additions and 2 deletions

View File

@ -7,13 +7,17 @@ if (array_key_exists('PATH_INFO', $_SERVER)){
}else{ }else{
$path_info = substr($_SERVER['PHP_SELF'], strpos($_SERVER['PHP_SELF'], basename(__FILE__)) + strlen(basename(__FILE__))); $path_info = substr($_SERVER['PHP_SELF'], strpos($_SERVER['PHP_SELF'], basename(__FILE__)) + strlen(basename(__FILE__)));
} }
if ($path_info === false) {
OC_Response::setStatus(OC_Response::STATUS_NOT_FOUND);
exit;
}
if (!$pos = strpos($path_info, '/', 1)) { if (!$pos = strpos($path_info, '/', 1)) {
$pos = strlen($path_info); $pos = strlen($path_info);
} }
$service=substr($path_info, 1, $pos-1); $service=substr($path_info, 1, $pos-1);
$file = OC_AppConfig::getValue('core', 'remote_' . $service); $file = OC_AppConfig::getValue('core', 'remote_' . $service);
if(is_null($file)){ if(is_null($file)){
header('HTTP/1.0 404 Not Found'); OC_Response::setStatus(OC_Response::STATUS_NOT_FOUND);
exit; exit;
} }