I've always thought $sn is an abbreviation of "site name", but yesterday I found out for what it really stands for: "script name"
In CMSimple 2 this is defined as:
Code: Select all
if(strpos(sv('SERVER_SOFTWARE'),"IIS"))$sn=preg_replace('/([^\?]*)\?.*/','\1',sv('SCRIPT_NAME'));else $sn=preg_replace('/([^\?]*)\?.*/','\1',sv('REQUEST_URI'));
This looks quite complicated, and I guess, it's is an historical "accident". I assume in the first versions of CMSimple (unfortunately I can't confirm that, as the oldest version that's still available for download is CMSimple 2) it was:
Code: Select all
$sn=preg_replace('/([^\?]*)\?.*/','\1',sv('REQUEST_URI'));
But actually the following had been sufficient as SCRIPT_NAME is part of the CGI specification, and so is available everywhere:
Code: Select all
$sn=sv('SCRIPT_NAME');
So I suggest to change this for CMSimple_XH 1.6 to:
Code: Select all
$sn = preg_replace('/index\.php$/', '', $_SERVER['SCRIPT_NAME']);
Christoph