[pLog-svn] r990 - in plog/trunk/class/net/http: . session
Benjamin Krause
ork at orkland.de
Tue Feb 8 11:09:40 GMT 2005
sorry, did not enter a commit message.. something's wrong with my vim .. :)
added a getBaseUrl() method to httpvars .. used PHP_SELF instead of
SCRIPT_URL (wich does not exist in PHP5) and added knowledge about
https. maybe we'll need that method on other locations as well ..
changed sessionmanager accordingly.
ork at devel.plogworld.net wrote:
> 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
> +?>
>
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.plogworld.net
> http://devel.plogworld.net/mailman/listinfo/plog-svn
More information about the pLog-svn
mailing list