4 * Fortune plugin functions
6 * @copyright © 2004-2006 The SquirrelMail Project Team
7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
14 * Declare configuration globals
16 global $fortune_location, $fortune_options;
21 include_once(SM_PATH
. 'plugins/fortune/config_default.php');
26 if (file_exists(SM_PATH
. 'config/fortune_config.php')) {
27 include_once(SM_PATH
. 'config/fortune_config.php');
28 } elseif (file_exists(SM_PATH
. 'plugins/fortune/config.php')) {
29 include_once(SM_PATH
. 'plugins/fortune/config.php');
37 function fortune_function() {
38 global $fortune_visible, $color, $fortune_location, $fortune_options;
40 if (!$fortune_visible) {
44 $exist = file_exists($fortune_location);
46 if ($fortune_options!='') {
47 $fortune_command=$fortune_location . ' ' . $fortune_options;
49 $fortune_command=$fortune_location;
52 echo "<div style="text
-align
: center
;"><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" bgcolor=\"$color[10]\">\n".
53 "<tr><td><table width=\"100%\" cellpadding=\"2\" cellspacing=\"1\" border=\"0\" bgcolor=\"$color[5]\">\n".
54 "<tr><td align=\"center\">\n";
55 echo '<table><tr><td>';
57 printf(_("%s is not found."),$fortune_location);
59 echo "<div style="text
-align
: center
;"><em>" . _("Today's Fortune") . "</em></div><pre>\n" .
60 htmlspecialchars(shell_exec($fortune_command)) .
64 echo '</td></tr></table></td></tr></table></td></tr></table></div>';
72 function fortune_function_options() {
75 $optpage_data['grps']['fortune'] = _("Fortunes:");
76 $optionValues = array();
77 $optionValues[] = array('name' => 'fortune_visible',
78 'caption' => _("Show fortunes at top of mailbox"),
79 'type' => SMOPT_TYPE_BOOLEAN
,
80 'initial_value' => false );
81 $optpage_data['vals']['fortune'] = $optionValues;
89 function fortune_function_load() {
90 global $username, $data_dir, $fortune_visible;
92 $fortune_visible = getPref($data_dir, $username, 'fortune_visible');