summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorAndreas Gohr <gohr@cosmocode.de>2009-11-03 14:31:16 +0100
committerAndreas Gohr <gohr@cosmocode.de>2009-11-03 14:31:16 +0100
commit463d4a65df88897c9b4c7c06f2b9dc74297c06fb (patch)
tree666d451c005ea084eab762a2767419556f6ba021 /inc
parente03b8b2edc322c2dcdfb3001d9f623fe828b149c (diff)
downloadrpg-463d4a65df88897c9b4c7c06f2b9dc74297c06fb.tar.gz
rpg-463d4a65df88897c9b4c7c06f2b9dc74297c06fb.tar.bz2
load INFO before other scripts
Ignore-this: 340a9d16b2675987e5e8ccb31a6000fe darcs-hash:20091103133116-6e07b-787678d21003090cb3c85ee48a2daf5ee7cb6491.gz
Diffstat (limited to 'inc')
-rw-r--r--inc/template.php16
1 files changed, 9 insertions, 7 deletions
diff --git a/inc/template.php b/inc/template.php
index 11e71124a..d15f25f8b 100644
--- a/inc/template.php
+++ b/inc/template.php
@@ -333,6 +333,15 @@ function tpl_metaheaders($alt=true){
$head['link'][] = array('rel'=>'stylesheet', 'media'=>'print', 'type'=>'text/css',
'href'=>DOKU_BASE.'lib/exe/css.php?s=print&t='.$conf['template']);
+ // make $INFO available to JavaScripts
+ require_once(DOKU_INC.'inc/JSON.php');
+ $json = new JSON();
+ $infocpy = $INFO;
+ $infocpy['userinfo']['login'] = $_SERVER['REMOTE_USER'];
+ $infocpy['userinfo']['pass'] = '';
+ $head['script'][] = array( 'type'=>'text/javascript', 'charset'=>'utf-8', '_data'=> 'var INFO = '.$json->encode($infocpy).';');
+
+
// load javascript
$js_edit = ($ACT=='edit' || $ACT=='preview' || $ACT=='recover' || $ACT=='wordblock' ) ? 1 : 0;
$js_write = ($INFO['writable']) ? 1 : 0;
@@ -352,13 +361,6 @@ function tpl_metaheaders($alt=true){
$head['script'][] = array( 'type'=>'text/javascript', 'charset'=>'utf-8', '_data'=>'',
'src'=>DOKU_BASE.'lib/exe/js.php?edit='.$js_edit.'&write='.$js_write);
- // make $INFO available to JavaScripts
- require_once(DOKU_INC.'inc/JSON.php');
- $json = new JSON();
- $infocpy = $INFO;
- $infocpy['userinfo']['pass'] = '';
- $head['script'][] = array( 'type'=>'text/javascript', 'charset'=>'utf-8', '_data'=> 'var INFO = '.$json->encode($infocpy).';');
-
// trigger event here
trigger_event('TPL_METAHEADER_OUTPUT',$head,'_tpl_metaheaders_action',true);