From: Konrad Rosenbaum Date: Fri, 6 Apr 2012 10:28:01 +0000 (+0200) Subject: add script.basedir variable for web templates X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=92a416cec7c85ce4d340766acab6ce8b17826c83;p=web%2Fkonrad%2Fsmoke.git add script.basedir variable for web templates --- diff --git a/www/inc/classes/basevars.php b/www/inc/classes/basevars.php index ea9f9a2..7a1796a 100644 --- a/www/inc/classes/basevars.php +++ b/www/inc/classes/basevars.php @@ -74,12 +74,13 @@ public static function init(){ /// \internal actually initializes $basevars public static function initPriv(){ - global $basevars,$_SERVER,$BaseUrl; + global $basevars,$_SERVER,$BaseUrl,$BaseUrlDir; self::initBaseUrlPriv(); //basic variables shared by all templates // script URLs $basevars['script']['root']=$BaseUrl; $basevars['script']['this']=$BaseUrl; + $basevars['script']['basedir']=$BaseUrlDir; if(isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']!="") $basevars['script']['this'].="?".$_SERVER['QUERY_STRING']; $basevars['script']['index']=$BaseUrl."?mode=index"; @@ -129,7 +130,7 @@ public static function initPriv(){ } private static function initBaseUrlPriv(){ - global $BaseUrl,$_SERVER; + global $BaseUrl,$_SERVER,$BaseUrlDir; //check whether it is already set if(!isset($BaseUrl))$BaseUrl=""; if($BaseUrl!="")return; @@ -153,6 +154,7 @@ private static function initBaseUrlPriv(){ if($p=="")continue; $path.="/".$p; } + $BaseUrlDir=$BaseUrl.$path; $pl=explode(".",$last); if(count($pl)!=2)$path.="/".$last; else $path.="/index.".$pl[1];