[pmwiki-users] "Bug" when installing to a secure server?

christian.ridderstrom at gmail.com christian.ridderstrom at gmail.com
Wed Dec 20 07:20:18 CST 2006


While looking at the directory strcuture, I noticed that the link to the 
style sheet by default isn't set correctly. You get

   <link rel='stylesheet'
 	href='http://<DOMAIN>/pmwiki/pub/skins/pmwiki/pmwiki.css'
 	type='text/css' />

even though the URI to pmwiki.php uses 'https' rather than 'http', i.e.

 	https://<DOMAIN>/pmwiki/pmwiki.php

The installation can be fixed by adding to config.php something like

 	$ScriptUrl = 'https://<DOMAIN>/pmwiki/pmwiki.php';
 	$PubDirUrl = 'https://<DOMAIN>/pmwiki/pub';

However, is there a reason why pmwiki can't detect the 'https' and use 
that for $PubDirUrl? I noticed that 'http:' is hardcoded in pmwiki.php:

$ScriptUrl = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];
$PubDirUrl = preg_replace('#/[^/]*$#','/pub',$ScriptUrl,1);

So, is there some way to make pmwiki do this better?


If there isn't maybe we could at least have a function in pmwiki.php that 
could be called from local.php that (re)set the relevant variables with 
'https' rather than http.

The function could be something like this:

function PmWikiSetupDefaults($ProtocolType = 'http') {
   global $ScriptUrl, $PubDirUrl;
   $ScriptUrl =  $ProtocolType.'://'
 		. $_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];
   $PubDirUrl = preg_replace('#/[^/]*$#','/pub',$ScriptUrl,1);

   ... // Other variables that are set with 'http' by default
}

cheers
/Christian

-- 
Christian Ridderström, +46-8-768 39 44               http://www.md.kth.se/~chr


More information about the pmwiki-users mailing list