X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=plugins%2Ffortune%2Fsetup.php;h=ce5a284e5c311f89aeccdd5eca82062157b6af14;hp=7e67fc61287d12c0171bc423f45f8ad95261489d;hb=5f75494fd15729f94af3122e10802686656418ed;hpb=82d304a0501324b276cabab1870755d5352bd21c
diff --git a/plugins/fortune/setup.php b/plugins/fortune/setup.php
index 7e67fc61..ce5a284e 100644
--- a/plugins/fortune/setup.php
+++ b/plugins/fortune/setup.php
@@ -3,22 +3,22 @@
/**
* plugins/fortune/setup.php
*
- * Copyright (c) 1999-2004 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;
@@ -28,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;
@@ -37,42 +41,56 @@ 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.");
} 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 "" . html_tag('td',_("Fortunes:"),'right','','nowrap') . "\n";
- echo ' " . _("Show fortunes at top of mailbox") . " |
\n";
+ echo ' checked="checked"';
+ echo " /> " . _("Show fortunes at top of mailbox") . "\n";
}
+/**
+ * Save fortune prefs
+ * @access private
+ */
function fortune_save() {
global $username,$data_dir;
- if (isset($_POST['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', '');
}
}
-?>
+?>
\ No newline at end of file