From b1870063b2e576ca9ff3cd41ada9cda1f8812507 Mon Sep 17 00:00:00 2001 From: pdontthink Date: Sun, 31 Dec 2006 06:28:19 +0000 Subject: [PATCH] t12n of fortune output git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@12035 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- plugins/fortune/functions.php | 16 +++---- plugins/fortune/setup.php | 4 +- .../plugins/fortune/mailbox_index_before.tpl | 47 +++++++++++++++++++ 3 files changed, 55 insertions(+), 12 deletions(-) create mode 100644 templates/default/plugins/fortune/mailbox_index_before.tpl diff --git a/plugins/fortune/functions.php b/plugins/fortune/functions.php index dddfdabd..dbf066d8 100644 --- a/plugins/fortune/functions.php +++ b/plugins/fortune/functions.php @@ -31,17 +31,12 @@ if (file_exists(SM_PATH . 'config/fortune_config.php')) { * @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 "\n". - "
\n". - "
\n"; - echo '
'; - /* open handle and get all command output*/ $handle = popen($fortune_command,'r'); $fortune = ''; @@ -53,11 +48,12 @@ function fortune_function() { // %s shows executed fortune cookie command. $fortune = sprintf(_("Unable to execute \"%s\"."),$fortune_command); } - echo "
" . _("Today's Fortune") . "
\n" .
-            htmlspecialchars($fortune) .
-            "
\n"; - echo '
'; + $oTemplate->assign('color', $color); + $oTemplate->assign('fortune', htmlspecialchars($fortune)); + $output = $oTemplate->fetch('plugins/fortune/mailbox_index_before.tpl'); + return array('mailbox_index_before' => $output); + } /** diff --git a/plugins/fortune/setup.php b/plugins/fortune/setup.php index e8581351..94f2551c 100644 --- a/plugins/fortune/setup.php +++ b/plugins/fortune/setup.php @@ -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 squirrelmail_plugin_init_fortune() { */ function fortune() { include_once(SM_PATH . 'plugins/fortune/functions.php'); - fortune_function(); + return fortune_function(); } /** diff --git a/templates/default/plugins/fortune/mailbox_index_before.tpl b/templates/default/plugins/fortune/mailbox_index_before.tpl new file mode 100644 index 00000000..dc76ffdd --- /dev/null +++ b/templates/default/plugins/fortune/mailbox_index_before.tpl @@ -0,0 +1,47 @@ + + + + + +
+ + + + +
+ + + + +
+
+
+$fortune
+
+
+
-- 2.25.1