Source for file functions.php
Documentation is available at functions.php
* Fortune plugin functions
* @copyright 2004-2020 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id: functions.php 14845 2020-01-07 08:09:34Z pdontthink $
* 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() {
/* 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 */
// i18n: %s shows executed fortune cookie command.
$fortune =
sprintf(_("Unable to execute \"%s\"."),$fortune_command);
$oTemplate->assign('color', $color);
$output =
$oTemplate->fetch('plugins/fortune/mailbox_index_before.tpl');
return array('mailbox_index_before' =>
$output);
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 Mon, 13 Jan 2020 04:22:36 +0100 by phpDocumentor 1.4.3