Revision: 1776
Author: olavmrk
Date: Thu Sep 24 00:36:28 2009
Log: www/module.php: Set SCRIPT_NAME when executing .php-file.
http://code.google.com/p/simplesamlphp/source/detail?r=1776

Modified:
  /trunk/www/module.php

=======================================
--- /trunk/www/module.php       Wed Dec  3 02:16:34 2008
+++ /trunk/www/module.php       Thu Sep 24 00:36:28 2009
@@ -86,21 +86,23 @@
                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)) {
-
-               $newPath = substr($path, 0, $phpPos + 4);
-               $paramPath = substr($path, $phpPos + 4);
-
-               if (is_file($newPath)) {
+       for ($phpPos = strpos($url, '.php/'); $phpPos !== FALSE; $phpPos =  
strpos($url, '.php/', $phpPos + 1)) {
+
+               $newPath = substr($url, 0, $phpPos + 4);
+               $paramPath = substr($url, $phpPos + 4);
+
+               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;
                }

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"simpleSAMLphp commits" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/simplesamlphp-commits?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to