From: Luke E. <lke...@us...> - 2001-02-06 02:01:18
|
Update of /cvsroot/squirrelmail/squirrelmail/plugins/fortune In directory usw-pr-cvs1:/tmp/cvs-serv16828 Modified Files: setup.php Log Message: updated fortune plugin Index: setup.php =================================================================== RCS file: /cvsroot/squirrelmail/squirrelmail/plugins/fortune/setup.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- setup.php 2001/01/31 19:48:58 1.1 +++ setup.php 2001/02/06 02:01:32 1.2 @@ -8,34 +8,64 @@ function squirrelmail_plugin_init_fortune() { global $squirrelmail_plugin_hooks; - $squirrelmail_plugin_hooks["mailbox_index_before"]["fortune"] = "fortune"; + $squirrelmail_plugin_hooks["mailbox_index_before"]['fortune'] = 'fortune'; + $squirrelmail_plugin_hooks["options_display_inside"]['fortune'] = 'fortune_options'; + $squirrelmail_plugin_hooks['options_display_save']['fortune'] = 'fortune_save'; + $squirrelmail_plugin_hooks['loading_prefs']['fortune'] = 'fortune_load'; + } function fortune() { + global $fortune_visible; + if( !$fortune_visible ) { + return; + } $fortune_location = "/usr/games/fortune"; global $color; $exist = file_exists("$fortune_location"); - ?> - <center> - <table cellpadding=0 cellspacing=0 border=0 bgcolor=<?php echo $color[10] ?>><tr><td> - <table width=100% cellpadding=2 cellspacing=1 border=0 bgcolor="<?php echo $color[5] ?>"><tr><td align=center> - <tt> - <?php + echo "<center><table cellpadding=0 cellspacing=0 border=0 bgcolor=$color[10]><tr><td><table width=100% cellpadding=2 cellspacing=1 border=0 bgcolor=\"$color[5]\"><tr><td align=center>"; echo "<TABLE><TR><TD>"; if (! $exist) { echo "$fortune_location not found."; } else { - echo "<CENTER><FONT=3><EM>Today's Fortune</EM><BR></FONT></CENTER>"; + echo "<CENTER><FONT=3><EM>Today's Fortune</EM><BR></FONT></CENTER><pre>"; system("$fortune_location"); } + + echo "</pre></TD></TR></TABLE></td></tr></table></td></tr></table></center>"; +} + +function fortune_load() +{ + global $username, $data_dir; + global $fortune_visible; + + $fortune_visible = getPref($data_dir, $username, 'fortune_visible'); + +} + + +function fortune_options() { + global $fortune_visible; + echo "<tr><td align=right nowrap>Fortunes:</td>\n"; + echo "<td><input name=\"fortune_fortune_visible\" type=CHECKBOX"; + if ($fortune_visible) + echo " CHECKED"; + echo "> Show fortunes at top of mailbox</td></tr>\n"; +} - ?> - </TD></TR></TABLE> - </tt> - </td></tr></table> - </td></tr></table> - <br> - </center> - <? +function fortune_save() +{ + global $username,$data_dir; + global $fortune_fortune_visible; + + if (isset($fortune_fortune_visible)) + { + setPref($data_dir, $username, 'fortune_visible', '1'); + } + else + { + setPref($data_dir, $username, 'fortune_visible', ''); + } } ?> |