Source for file fortune_functions.php

Documentation is available at fortune_functions.php

  1. <?php
  2. /**
  3.  * plugins/fortune/fortune_functions.php
  4.  *
  5.  * Original code contributed by [email protected]
  6.  *
  7.  * Simple SquirrelMail WebMail Plugin that displays the output of
  8.  * fortune above the message listing.
  9.  *
  10.  * @copyright (c) 1999-2020 The SquirrelMail Project Team
  11.  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  12.  * @version $Id: fortune_functions.php 14840 2020-01-07 07:42:38Z pdontthink $
  13.  * @package plugins
  14.  * @subpackage fortune
  15.  *
  16.  */
  17.  
  18.  
  19. /**
  20.  * Function to show fortune
  21.  * @access private
  22.  */
  23. function fortune_show({
  24.  
  25.     global $color;
  26.     
  27.     $fortune_location '/usr/bin/fortune';
  28.     $exist is_executable($fortune_location);
  29.     
  30.     if (!$exist{
  31.         $sMsg sprintf(_("%s is not found."),$fortune_location);
  32.     else {
  33.         $sMsg sm_encode_html_special_chars(shell_exec($fortune_location ' -s'));
  34.     }
  35.     
  36.     
  37.     echo "<center><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" bgcolor=\"$color[10]\">\n".
  38.         "<tr><td><table width=\"100%\" cellpadding=\"2\" cellspacing=\"1\" border=\"0\" bgcolor=\"$color[5]\">\n".
  39.         "<tr><td align=\"center\">\n";
  40.     echo '<table><tr><td>';
  41.     echo '<center><em>' _("Today's Fortune"'</em></center><br /><pre>' .
  42.         $sMsg .
  43.         '</pre>';
  44.  
  45.     echo '</td></tr></table></td></tr></table></td></tr></table></center>';
  46. }
  47.  
  48.  
  49. /**
  50.  * Add fortune options
  51.  * @access private
  52.  */
  53. function fortune_show_options({
  54.  
  55.     global $optpage_data$username$data_dir$fortune_visible;
  56.     $fortune_visible getPref($data_dir$username'fortune_visible');
  57.     
  58.     $optgrp _("Fortunes");
  59.     $optvals array();
  60.     
  61.     $optvals[array(
  62.                 'name' => 'fortune_visible',
  63.                 'caption' => _("Show fortunes at top of mailbox"),
  64.                 'type' => SMOPT_TYPE_BOOLEAN,
  65.                 'refresh' => SMOPT_REFRESH_NONE                
  66.             );
  67.  
  68.      $optpage_data['grps']['fortune'$optgrp;
  69.      $optpage_data['vals']['fortune'$optvals;
  70. }

Documentation generated on Mon, 13 Jan 2020 04:24:39 +0100 by phpDocumentor 1.4.3