Source for file functions.php
Documentation is available at functions.php
* Fortune plugin functions
* @copyright © 2004-2006 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id: functions.php,v 1.9 2006/07/07 12:53:50 tokul Exp $
* Declare configuration global and set default value
$fortune_command =
'/usr/games/fortune -s';
include_once(SM_PATH .
'config/fortune_config.php');
include_once(SM_PATH .
'plugins/fortune/config.php');
function fortune_function() {
echo
"<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" bgcolor=\"$color[10]\" align=\"center\">\n".
"<tr><td><table width=\"100%\" cellpadding=\"2\" cellspacing=\"1\" border=\"0\" bgcolor=\"$color[5]\">\n".
"<tr><td align=\"center\">\n";
/* open handle and get all command output*/
$handle =
popen($fortune_command,'r');
while ($read =
fread($handle,1024)) {
/* if pclose return != 0, popen command failed. Yes, I know that it is broken when --enable-sigchild is used */
// %s shows executed fortune cookie command.
$fortune =
sprintf(_("Unable to execute \"%s\"."),$fortune_command);
echo
"<div style=\"text-align: center;\"><em>" .
_("Today's Fortune") .
"</em></div><pre>\n" .
echo
'</td></tr></table></td></tr></table></td></tr></table>';
function fortune_function_options() {
$optpage_data['grps']['fortune'] =
_("Fortunes:");
$optionValues[] =
array('name' =>
'fortune_visible',
'caption' =>
_("Show fortunes at top of mailbox"),
'initial_value' =>
false );
$optpage_data['vals']['fortune'] =
$optionValues;
function fortune_function_load() {
global $username, $data_dir, $fortune_visible;
$fortune_visible =
getPref($data_dir, $username, 'fortune_visible');
Documentation generated on Sat, 07 Oct 2006 16:11:24 +0300 by phpDocumentor 1.3.0RC6