diff options
author | Andreas Gohr <andi@splitbrain.org> | 2005-10-29 20:52:22 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2005-10-29 20:52:22 +0200 |
commit | 78a6aeb15ad85c8be4a7e39307b7d9aa0512742c (patch) | |
tree | 85d5613888ef630de5998480fa913b5abfe23fb2 /inc/toolbar.php | |
parent | bad31ae944f074dab12f7a6d1362775d8f2b18dd (diff) | |
download | rpg-78a6aeb15ad85c8be4a7e39307b7d9aa0512742c.tar.gz rpg-78a6aeb15ad85c8be4a7e39307b7d9aa0512742c.tar.bz2 |
More work on Javascript and CSS dispatchers
darcs-hash:20051029185222-7ad00-c184ab3496539f3027407c7d17e8770a1849546a.gz
Diffstat (limited to 'inc/toolbar.php')
-rw-r--r-- | inc/toolbar.php | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/inc/toolbar.php b/inc/toolbar.php index aa52868d0..27e91ee47 100644 --- a/inc/toolbar.php +++ b/inc/toolbar.php @@ -164,17 +164,6 @@ function toolbar_JSdefines($varname){ ), ); - // if logged in add sig button - if($conf['useacl'] && $_SERVER['REMOTE_USER']){ - $menu[] = array( - 'type' => 'insert', - 'title' => $lang['qb_sig'], - 'icon' => 'sig.png', - 'key' => 'y', - 'insert' => toolbar_signature(), - ); - } - // use JSON to build the JavaScript array $json = new JSON(); print "var $varname = ".$json->encode($menu).";\n"; @@ -187,16 +176,36 @@ function toolbar_JSdefines($varname){ */ function toolbar_signature(){ global $conf; - global $INFO; $sig = $conf['signature']; $sig = strftime($sig); $sig = str_replace('@USER@',$_SERVER['REMOTE_USER'],$sig); - $sig = str_replace('@NAME@',$INFO['userinfo']['name'],$sig); - $sig = str_replace('@MAIL@',$INFO['userinfo']['mail'],$sig); + $sig = str_replace('@NAME@',$_SESSION[$conf[title]]['auth']['info']['name'],$sig); + $sig = str_replace('@MAIL@',$_SESSION[$conf[title]]['auth']['info']['mail'],$sig); $sig = str_replace('@DATE@',date($conf['dformat']),$sig); return $sig; } +/** + * Adds the signature button to the already prepared Javascript array + * @param string $varname Name of the JS variable to fill + * @author Andreas Gohr <andi@splitbrain.org> + */ +function toolbar_addsigbutton($varname){ + global $lang; + + $menu = array( + 'type' => 'insert', + 'title' => $lang['qb_sig'], + 'icon' => 'sig.png', + 'key' => 'y', + 'insert' => toolbar_signature(), + ); + // use JSON to build the JavaScript array + $json = new JSON(); + print $varname.'['.$varname.'.length] = '.$json->encode($menu).";\n"; + +} + //Setup VIM: ex: et ts=4 enc=utf-8 : |