Source for file setup.php
Documentation is available at setup.php
* plugins/fortune/setup.php
* Simple SquirrelMail WebMail Plugin that displays the output of
* fortune above the message listing.
* @copyright (c) 1999-2006 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id: setup.php,v 1.5.2.11 2006/07/07 13:16:41 tokul Exp $
* There should be no code in setup.php, just hook registrations. Create functions.php
* and move the code there.
function squirrelmail_plugin_init_fortune() {
global $squirrelmail_plugin_hooks;
$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';
global $fortune_visible, $color;
$fortune_location =
'/usr/games/fortune';
$exist =
is_file($fortune_location);
echo
"<center><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" bgcolor=\"$color[10]\">\n".
"<tr><td><table width=\"100%\" cellpadding=\"2\" cellspacing=\"1\" border=\"0\" bgcolor=\"$color[5]\">\n".
"<tr><td align=\"center\">\n";
printf(_("%s is not found."),$fortune_location);
// display only short fortune cookies
$fortune_command =
$fortune_location .
' -s';
echo
'<center><em>' .
_("Today's Fortune") .
'</em></center><br /><pre>' .
echo
'</td></tr></table></td></tr></table></td></tr></table></center>';
function fortune_load() {
global $username, $data_dir, $fortune_visible;
$fortune_visible =
getPref($data_dir, $username, 'fortune_visible');
function fortune_options() {
echo
"<tr>" .
html_tag('td',_("Fortunes:"),'right','','nowrap') .
"\n";
echo
'<td><input name="fortune_fortune_visible" type="checkbox"';
echo
' checked="checked"';
echo
" /> " .
_("Show fortunes at top of mailbox") .
"</td></tr>\n";
function fortune_save() {
global $username,$data_dir;
setPref($data_dir, $username, 'fortune_visible', '1');
setPref($data_dir, $username, 'fortune_visible', '');
Documentation generated on Sat, 07 Oct 2006 16:33:29 +0300 by phpDocumentor 1.3.0RC6