123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <?php
- /**
- * Fortune plugin functions
- *
- * @copyright (c) 2004 The SquirrelMail Project Team
- * @license http://opensource.org/licenses/gpl-license.php GNU Public License
- * @version $Id$
- * @package plugins
- * @subpackage fortune
- */
- /**
- * Declare configuration globals
- */
- global $fortune_location, $fortune_options;
- /**
- * Load default config
- */
- include_once(SM_PATH . 'plugins/fortune/config_default.php');
- /**
- * Load site config
- */
- if (file_exists(SM_PATH . 'config/fortune_config.php')) {
- include_once(SM_PATH . 'config/fortune_config.php');
- } elseif (file_exists(SM_PATH . 'plugins/fortune/config.php')) {
- include_once(SM_PATH . 'plugins/fortune/config.php');
- }
- /**
- * Show fortune
- * @access private
- * @since 1.5.1
- */
- function fortune_function() {
- global $fortune_visible, $color, $fortune_location, $fortune_options;
- if (!$fortune_visible) {
- return;
- }
- $exist = file_exists($fortune_location);
- if ($fortune_options!='') {
- $fortune_command=$fortune_location . ' ' . $fortune_options;
- } else {
- $fortune_command=$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";
- echo '<table><tr><td>';
- if (!$exist) {
- echo sprintf(_("%s is not found."),$fortune_location);
- } else {
- echo "<center><em>" . _("Today's Fortune") . "</em></center><pre>\n";
- htmlspecialchars(system($fortune_command));
- echo "</pre>\n";
- }
- echo '</td></tr></table></td></tr></table></td></tr></table></center>';
- }
- /**
- * Add fortune options
- * @access private
- * @since 1.5.1
- */
- function fortune_function_options() {
- global $optpage_data;
- $optpage_data['grps']['fortune'] = _("Fortunes:");
- $optionValues = array();
- $optionValues[] = array('name' => 'fortune_visible',
- 'caption' => _("Show fortunes at top of mailbox"),
- 'type' => SMOPT_TYPE_BOOLEAN,
- 'initial_value' => false );
- $optpage_data['vals']['fortune'] = $optionValues;
- }
- /**
- * Get fortune prefs
- * @access private
- * @since 1.5.1
- */
- function fortune_function_load() {
- global $username, $data_dir, $fortune_visible;
- $fortune_visible = getPref($data_dir, $username, 'fortune_visible');
- }
- ?>
|