3 * Fortune plugin functions
5 * @copyright (c) 2004-2005 The SquirrelMail Project Team
6 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
13 * Declare configuration globals
15 global $fortune_location, $fortune_options;
20 include_once(SM_PATH
. 'plugins/fortune/config_default.php');
25 if (file_exists(SM_PATH
. 'config/fortune_config.php')) {
26 include_once(SM_PATH
. 'config/fortune_config.php');
27 } elseif (file_exists(SM_PATH
. 'plugins/fortune/config.php')) {
28 include_once(SM_PATH
. 'plugins/fortune/config.php');
36 function fortune_function() {
37 global $fortune_visible, $color, $fortune_location, $fortune_options;
39 if (!$fortune_visible) {
43 $exist = file_exists($fortune_location);
45 if ($fortune_options!='') {
46 $fortune_command=$fortune_location . ' ' . $fortune_options;
48 $fortune_command=$fortune_location;
51 echo "<center><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" bgcolor=\"$color[10]\">\n".
52 "<tr><td><table width=\"100%\" cellpadding=\"2\" cellspacing=\"1\" border=\"0\" bgcolor=\"$color[5]\">\n".
53 "<tr><td align=\"center\">\n";
54 echo '<table><tr><td>';
56 echo sprintf(_("%s is not found."),$fortune_location);
58 echo "<center><em>" . _("Today's Fortune") . "</em></center><pre>\n";
59 htmlspecialchars(system($fortune_command));
63 echo '</td></tr></table></td></tr></table></td></tr></table></center>';
71 function fortune_function_options() {
74 $optpage_data['grps']['fortune'] = _("Fortunes:");
75 $optionValues = array();
76 $optionValues[] = array('name' => 'fortune_visible',
77 'caption' => _("Show fortunes at top of mailbox"),
78 'type' => SMOPT_TYPE_BOOLEAN
,
79 'initial_value' => false );
80 $optpage_data['vals']['fortune'] = $optionValues;
88 function fortune_function_load() {
89 global $username, $data_dir, $fortune_visible;
91 $fortune_visible = getPref($data_dir, $username, 'fortune_visible');