[pLog-svn] r990 - in plog/trunk/class/net/http: . session

ork at devel.plogworld.net ork at devel.plogworld.net
Tue Feb 8 11:00:32 GMT 2005


Author: ork
Date: 2005-02-08 11:00:31 +0000 (Tue, 08 Feb 2005)
New Revision: 990

Modified:
   plog/trunk/class/net/http/httpvars.class.php
   plog/trunk/class/net/http/session/sessionmanager.class.php
Log:


Modified: plog/trunk/class/net/http/httpvars.class.php
===================================================================
--- plog/trunk/class/net/http/httpvars.class.php	2005-02-08 08:19:50 UTC (rev 989)
+++ plog/trunk/class/net/http/httpvars.class.php	2005-02-08 11:00:31 UTC (rev 990)
@@ -251,5 +251,26 @@
 
             return $files;
         }
+
+        /**
+         * Returns the base URL of the script
+         *
+         * @return A string containing the base URL of the script
+         * @static
+         */
+
+        function getBaseUrl()
+        {
+            $serverVars = HttpVars::getServer();
+            if ( !isset($serverVars['HTTPS']) || strtolower($serverVars['HTTPS']) != 'on' ) {
+                $protocol = 'http://';
+            } else {
+                $protocol = 'https://';
+            }
+            $host      = $serverVars["HTTP_HOST"];
+            $scriptUrl = $serverVars["PHP_SELF"];
+
+            return $protocol . $host . $scriptUrl;
+        }
     }
 ?>

Modified: plog/trunk/class/net/http/session/sessionmanager.class.php
===================================================================
--- plog/trunk/class/net/http/session/sessionmanager.class.php	2005-02-08 08:19:50 UTC (rev 989)
+++ plog/trunk/class/net/http/session/sessionmanager.class.php	2005-02-08 11:00:31 UTC (rev 990)
@@ -52,8 +52,7 @@
 			// get the right url for the script... somehow $_SERVER["REQUEST_URI"]
 			// is returning things like "http://83.102.183.10.in-addr.arpa/plog/test.php"
 			// in my case which are correct but probably not what we're expecting!
-			$server = HttpVars::getServer();
-			$scriptUrl = "http://".$server["HTTP_HOST"].$server["SCRIPT_URL"];
+			$scriptUrl = HttpVars::getBaseUrl();
 			$url = new Url( $scriptUrl );
 			$path = dirname($url->getPath());
 			if( $path == "" ) 
@@ -82,4 +81,4 @@
 			ini_set( "session.cookie_domain", $domain );
 		}
 	}
-?>
\ No newline at end of file
+?>




More information about the pLog-svn mailing list