diff options
-rw-r--r-- | doku.php | 7 | ||||
-rw-r--r-- | inc/template.php | 10 |
2 files changed, 11 insertions, 6 deletions
@@ -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 3193e0013..6caf3d40a 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); |