|
From: Paul L. <pdo...@us...> - 2006-12-31 06:28:23
|
Update of /cvsroot/squirrelmail/squirrelmail/plugins/fortune In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv19667/plugins/fortune Modified Files: functions.php setup.php Log Message: t12n of fortune output Index: functions.php =================================================================== RCS file: /cvsroot/squirrelmail/squirrelmail/plugins/fortune/functions.php,v retrieving revision 1.9 retrieving revision 1.10 diff -u -w -r1.9 -r1.10 --- functions.php 7 Jul 2006 12:53:50 -0000 1.9 +++ functions.php 31 Dec 2006 06:28:19 -0000 1.10 @@ -31,17 +31,12 @@ * @since 1.5.1 */ function fortune_function() { - global $fortune_visible, $color, $fortune_command; + global $oTemplate, $fortune_visible, $color, $fortune_command; if (!$fortune_visible) { return; } - echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" bgcolor=\"$color[10]\" align=\"center\">\n". - "<tr><td><table width=\"100%\" cellpadding=\"2\" cellspacing=\"1\" border=\"0\" bgcolor=\"$color[5]\">\n". - "<tr><td align=\"center\">\n"; - echo '<table><tr><td>'; - /* open handle and get all command output*/ $handle = popen($fortune_command,'r'); $fortune = ''; @@ -53,11 +48,12 @@ // %s shows executed fortune cookie command. $fortune = sprintf(_("Unable to execute \"%s\"."),$fortune_command); } - echo "<div style=\"text-align: center;\"><em>" . _("Today's Fortune") . "</em></div><pre>\n" . - htmlspecialchars($fortune) . - "</pre>\n"; - echo '</td></tr></table></td></tr></table></td></tr></table>'; + $oTemplate->assign('color', $color); + $oTemplate->assign('fortune', htmlspecialchars($fortune)); + $output = $oTemplate->fetch('plugins/fortune/mailbox_index_before.tpl'); + return array('mailbox_index_before' => $output); + } /** Index: setup.php =================================================================== RCS file: /cvsroot/squirrelmail/squirrelmail/plugins/fortune/setup.php,v retrieving revision 1.20 retrieving revision 1.21 diff -u -w -r1.20 -r1.21 --- setup.php 7 Jul 2006 12:53:50 -0000 1.20 +++ setup.php 31 Dec 2006 06:28:19 -0000 1.21 @@ -17,7 +17,7 @@ function squirrelmail_plugin_init_fortune() { global $squirrelmail_plugin_hooks; - $squirrelmail_plugin_hooks['mailbox_index_before']['fortune'] = 'fortune'; + $squirrelmail_plugin_hooks['template_construct_message_list.tpl']['fortune'] = 'fortune'; $squirrelmail_plugin_hooks['loading_prefs']['fortune'] = 'fortune_load'; $squirrelmail_plugin_hooks['optpage_loadhook_display']['fortune'] = 'fortune_options'; } @@ -28,7 +28,7 @@ */ function fortune() { include_once(SM_PATH . 'plugins/fortune/functions.php'); - fortune_function(); + return fortune_function(); } /** |