Skip to content
Snippets Groups Projects
Commit 389c8627 authored by Olav Morken's avatar Olav Morken
Browse files

www/module.php: Set SCRIPT_NAME when executing .php-file.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1776 44740490-163a-0410-bde0-09ae8108e29a
parent c62e1cb2
No related branches found
No related tags found
No related merge requests found
......@@ -86,21 +86,23 @@ try {
throw new SimpleSAML_Error_BadRequest('Requested URL contained \'./\'.');
}
$path = SimpleSAML_Module::getModuleDir($module) . '/www/' . $url;
$moduleDir = SimpleSAML_Module::getModuleDir($module) . '/www/';
$path = $moduleDir . $url;
/* Check for '.php/' in the path, the presence of which indicates that another php-script
* should handle the request.
*/
for ($phpPos = strpos($path, '.php/'); $phpPos !== FALSE; $phpPos = strpos($path, '.php/', $phpPos + 1)) {
for ($phpPos = strpos($url, '.php/'); $phpPos !== FALSE; $phpPos = strpos($url, '.php/', $phpPos + 1)) {
$newPath = substr($path, 0, $phpPos + 4);
$paramPath = substr($path, $phpPos + 4);
$newPath = substr($url, 0, $phpPos + 4);
$paramPath = substr($url, $phpPos + 4);
if (is_file($newPath)) {
if (is_file($moduleDir . $newPath)) {
/* $newPath points to a normal file. Point execution to that file, and
* save the remainder of the path in PATH_INFO.
*/
$path = $newPath;
$path = $moduleDir . $newPath;
$_SERVER['SCRIPT_NAME'] .= '/' . $module . '/' . $newPath;
$_SERVER['PATH_INFO'] = $paramPath;
break;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment