X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=plugins%2Ffortune%2Fsetup.php;h=dbdc7b109853f30650bddcb04eeeae6c1e908f75;hp=a2bedfbbe62cea95ac1791506565f425323208d9;hb=a9e1e670fab4399260e0790e018393c7dcefcecc;hpb=ecaf45ec86273b7c72e10fefd26c3fc98907664f diff --git a/plugins/fortune/setup.php b/plugins/fortune/setup.php index a2bedfbb..dbdc7b10 100644 --- a/plugins/fortune/setup.php +++ b/plugins/fortune/setup.php @@ -3,17 +3,22 @@ /** * plugins/fortune/setup.php * - * Copyright (c) 1999-2002 The SquirrelMail Project Team - * Licensed under the GNU GPL. For full terms see the file COPYING. - * * Original code contributed by paulm@spider.org * * Simple SquirrelMail WebMail Plugin that displays the output of * fortune above the message listing. * - * $Id$ + * @copyright (c) 1999-2004 The SquirrelMail Project Team + * @license http://opensource.org/licenses/gpl-license.php GNU Public License + * @version $Id$ + * @package plugins + * @subpackage fortune */ +/** + * Init plugin + * @access private + */ function squirrelmail_plugin_init_fortune() { global $squirrelmail_plugin_hooks; @@ -23,6 +28,10 @@ function squirrelmail_plugin_init_fortune() { $squirrelmail_plugin_hooks['loading_prefs']['fortune'] = 'fortune_load'; } +/** + * Show fortune + * @access private + */ function fortune() { global $fortune_visible, $color; @@ -32,39 +41,52 @@ function fortune() { $fortune_location = '/usr/games/fortune'; $exist = file_exists($fortune_location); - echo "
"; - echo '
'; + echo "
\n". + "
\n". + "
\n"; + echo '
'; if (!$exist) { - echo "$fortune_location not found."; + echo "$fortune_location" . _(" not found."); } else { - echo "
Today's Fortune
";
-        system($fortune_location);
+        echo "
" . _("Today's Fortune") . "
";
+        htmlspecialchars(system($fortune_location));
     } 
   
-    echo '
'; + echo '
'; } +/** + * Get fortune prefs + * @access private + */ function fortune_load() { global $username, $data_dir, $fortune_visible; $fortune_visible = getPref($data_dir, $username, 'fortune_visible'); } +/** + * Add fortune options + * @access private + */ function fortune_options() { global $fortune_visible; - echo "Fortunes:\n"; + echo "" . html_tag('td',_("Fortunes:"),'right','','nowrap') . "\n"; echo ' Show fortunes at top of mailbox\n"; + echo " /> " . _("Show fortunes at top of mailbox") . "\n"; } +/** + * Save fortune prefs + * @access private + */ function fortune_save() { global $username,$data_dir; - global $fortune_fortune_visible; - if (isset($fortune_fortune_visible)) { + if (sqgetGlobalVar('fortune_fortune_visible',$fortune_fortune_visible,SQ_POST)) { setPref($data_dir, $username, 'fortune_visible', '1'); } else { setPref($data_dir, $username, 'fortune_visible', '');