summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2009-11-23 18:55:46 +0100
committerAndreas Gohr <andi@splitbrain.org>2009-11-23 18:55:46 +0100
commit72e0dc37715be44ccf530757864c745c5cb90606 (patch)
tree3565d50c21b8f0ff094379ebcc8a2cceabfb928e
parent07a8e691a67d5a3867cc267b6c281784748c1055 (diff)
downloadrpg-72e0dc37715be44ccf530757864c745c5cb90606.tar.gz
rpg-72e0dc37715be44ccf530757864c745c5cb90606.tar.bz2
Replaced $INFO export with minimal $JSINFO
Ignore-this: 3f1213cb6b403ad09e6999cd972e9f21 Now only the global $JSINFO array is exported to JavaScript. Additional keys can be added here from plugins or preload. darcs-hash:20091123175546-7ad00-346856e8eecc52608edea805f408d4dbd33257fe.gz
-rw-r--r--doku.php7
-rw-r--r--inc/template.php10
2 files changed, 11 insertions, 6 deletions
diff --git a/doku.php b/doku.php
index 519e1b13e..891ac4c17 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 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);