[pLog-svn] r4691 - plog/branches/lifetype-1.2/class/net/http/session

Oscar Renalias oscar at renalias.net
Mon Feb 5 17:04:40 EST 2007


> On Mon, 5 Feb 2007, oscar at devel.lifetype.net wrote:
>> -			$scriptUrl = HttpVars::getBaseUrl();
>> +			// get the current base url and fetch it dynamically according  
>> to the values
>> +			// returned by Apache/PHP if not set yet in the config settings
>> +			$config =& Config::getConfig();
>> +			$scriptUrl = $config->getValue( "base_url" );
>> +			if( $scriptUrl == "" )
>> +				$scriptUrl = HttpVars::getBaseUrl();
>
>  	I am not entirely sure what this is doing.  The base_url is always
> set, isn't it?  Or if it isn't, what cases isn't it set?  Will
> HttpVars::getBaseUrl() return the complete subdomain if called for a
> subdomain'ed URL?

HttpVars::getBaseUrl() calculates the current base url in a very  
funky way, using $_SERVER["HTTP_VARS"] and $_SERVER["PHP_SELF"]. I  
couldn't find any reference to it anywhere in the code other than the  
SessionManager class, so I can only think that the purpose of this  
class was to figure out a base URL without using our configuration  
settings (the data provided by the Config class) All I know is that  
it wasn't doing the right thing, or at least not doing the thing we  
were expecting it to do.

>> -			$domain = $url->getHost();
>> +			$domain = str_replace( "www.", ".", $url->getHost());
>  	You probably want
> preg_replace("/^www\./", ".", $url->getHost());
> so it only replace www. at the beginning of the string.

Thank you, I'll fix this now.

Oscar




More information about the pLog-svn mailing list