diff --git a/doku.php b/doku.php index 519e1b13e1f44fefbfbc78415469283230b1679f..891ac4c17f1a333950f7871fd47a96d5a3cd48ff 100644 --- a/doku.php +++ b/doku.php @@ -50,6 +50,13 @@ $REV = preg_replace('/[^0-9]/','',$REV); //make infos about the selected page available $INFO = pageinfo(); +//export minimal infos to JS, plugins can add more +$JSINFO = array( + 'id' => $ID, + 'namespace' => (string) $INFO['namespace'] +); + + // handle debugging if($conf['allowdebug'] && $ACT == 'debug'){ html_debug(); diff --git a/inc/template.php b/inc/template.php index 3193e001379ebf6567383f1837589cdeb1264888..6caf3d40a4a7556c86c8ea6497861f3933e6c212 100644 --- a/inc/template.php +++ b/inc/template.php @@ -240,6 +240,7 @@ function tpl_metaheaders($alt=true){ global $ID; global $REV; global $INFO; + global $JSINFO; global $ACT; global $QUERY; global $lang; @@ -336,15 +337,12 @@ function tpl_metaheaders($alt=true){ // make $INFO and other vars available to JavaScripts require_once(DOKU_INC.'inc/JSON.php'); $json = new JSON(); - $infocpy = $INFO; - $infocpy['userinfo']['pass'] = ''; - $script = "NS='".$INFO['namespace']."';"; + $script = "var NS='".$INFO['namespace']."';"; if($conf['useacl'] && $_SERVER['REMOTE_USER']){ require_once(DOKU_INC.'inc/toolbar.php'); - $script .= "SIG='".toolbar_signature()."';"; - $infocpy['userinfo']['login'] = $_SERVER['REMOTE_USER']; + $script .= "var SIG='".toolbar_signature()."';"; } - $script .= 'var INFO = '.$json->encode($infocpy).';'; + $script .= 'var JSINFO = '.$json->encode($JSINFO).';'; $head['script'][] = array( 'type'=>'text/javascript', 'charset'=>'utf-8', '_data'=> $script);