From 78a6aeb15ad85c8be4a7e39307b7d9aa0512742c Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sat, 29 Oct 2005 20:52:22 +0200 Subject: More work on Javascript and CSS dispatchers darcs-hash:20051029185222-7ad00-c184ab3496539f3027407c7d17e8770a1849546a.gz --- inc/toolbar.php | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) (limited to 'inc/toolbar.php') 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 + */ +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 : -- cgit v1.2.3