Source for file display_messages.php

Documentation is available at display_messages.php

  1. <?php
  2.  
  3. /**
  4.  * display_messages.php
  5.  *
  6.  * This contains all messages, including information, error, and just
  7.  * about any other message you can think of.
  8.  *
  9.  * @copyright 1999-2020 The SquirrelMail Project Team
  10.  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  11.  * @version $Id: display_messages.php 14840 2020-01-07 07:42:38Z pdontthink $
  12.  * @package squirrelmail
  13.  */
  14.  
  15. /**
  16.  * including plugin functions
  17.  */
  18. require_once(SM_PATH . 'functions/plugin.php');
  19.  
  20. function error_message($message, $mailbox, $sort, $startMessage, $color) {
  21.  
  22.     global $default_folder_prefix;
  23.  
  24.     $urlMailbox = urlencode($mailbox);
  25.     $string = '<tr><td align="center">' . $message . '</td></tr>'.
  26.               '<tr><td align="center">'.
  27.               '<a href="'.sqm_baseuri()."src/right_main.php?sort=$sort&amp;startMessage=$startMessage&amp;mailbox=$urlMailbox\">";
  28.  
  29.     if (!empty($default_folder_prefix)) {
  30.         if (strpos($mailbox, $default_folder_prefix) === 0)
  31.             $mailbox = substr($mailbox, strlen($default_folder_prefix));
  32.     }
  33.     
  34.     $string .= sprintf (_("Click here to return to %s"),
  35.                   sm_encode_html_special_chars(imap_utf7_decode_local($mailbox))).
  36.               '</a></td></tr>';
  37.     error_box($string, $color);
  38. }
  39.  
  40. function plain_error_message($message, $color) {
  41.     error_box($message, $color);
  42. }
  43.  
  44. function logout_error( $errString, $errTitle = '' ) {
  45.            $hide_sm_attributions, $version, $squirrelmail_language, 
  46.            $color, $theme, $theme_default;
  47.  
  48.     include_once( SM_PATH . 'functions/page_header.php' );
  49.  
  50.     $base_uri = sqm_baseuri();
  51.  
  52.     $logout_link = $base_uri . 'src/login.php';
  53.  
  54.     list($junk, $errString, $errTitle, $logout_link) 
  55.         = do_hook('logout_error', $errString, $errTitle, $logout_link);
  56.  
  57.     /* Display width and height like good little people */
  58.     $width_and_height = '';
  59.     if (isset($org_logo_width) && is_numeric($org_logo_width) && $org_logo_width>0) {
  60.         $width_and_height = " width=\"$org_logo_width\"";
  61.     }
  62.     if (isset($org_logo_height) && is_numeric($org_logo_height) && $org_logo_height>0) {
  63.         $width_and_height .= " height=\"$org_logo_height\"";
  64.     }
  65.  
  66.     if (!isset($frame_top) || $frame_top == '' ) {
  67.         $frame_top = '_top';
  68.     }
  69.  
  70.     // load default theme if possible
  71.     if (!isset($color) && @file_exists($theme[$theme_default]['PATH']))
  72.         @include ($theme[$theme_default]['PATH']);
  73.  
  74.     if ( !isset( $color ) ) {
  75.         $color = array();
  76.         $color[0]  = '#dcdcdc';  /* light gray    TitleBar               */
  77.         $color[1]  = '#800000';  /* red                                  */
  78.         $color[2]  = '#cc0000';  /* light red     Warning/Error Messages */
  79.         $color[4]  = '#ffffff';  /* white         Normal Background      */
  80.         $color[7]  = '#0000cc';  /* blue          Links                  */
  81.         $color[8]  = '#000000';  /* black         Normal text            */
  82.     }
  83.  
  84.     if ( $errTitle == '' ) {
  85.         $errTitle = $errString;
  86.     }
  87.     set_up_language($squirrelmail_language, true);
  88.  
  89.     displayHtmlHeader( $org_name.' - '.$errTitle, '', false );
  90.  
  91.     echo '<body text="'.$color[8].'" bgcolor="'.$color[4].'" link="'.$color[7].'" vlink="'.$color[7].'" alink="'.$color[7]."\">\n\n".
  92.          '<center>';
  93.  
  94.     if (isset($org_logo) && ($org_logo != '')) {
  95.         echo '<img src="'.$org_logo.'" alt="'.sprintf(_("%s Logo"), $org_name).
  96.              "\"$width_and_height /><br />\n";
  97.     }
  98.     echo ( $hide_sm_attributions ? '' :
  99.             '<small>' . sprintf (_("SquirrelMail version %s"), $version) . '<br />'.
  100.             _("By the SquirrelMail Project Team") . "<br /></small>\n" ).
  101.          '<table cellspacing="1" cellpadding="0" bgcolor="'.$color[1].'" width="70%">'.
  102.          '<tr><td>'.
  103.          '<table width="100%" border="0" bgcolor="'.$color[4].'" align="center">'.
  104.          '<tr><td bgcolor="'.$color[0].'" align="center">'.
  105.          '<font color="'.$color[2].'"><b>' . _("ERROR") . '</b></font>'.
  106.          '</td></tr>'.
  107.          '<tr><td align="center">' . $errString . '</td></tr>'.
  108.          '<tr><td bgcolor="'.$color[0].'" align="center">'.
  109.          '<font color="'.$color[2].'"><b>'.
  110.          '<a href="'.$logout_link.'" target="'.$frame_top.'">'.
  111.          _("Go to the login page") . '</a></b></font></td></tr>'.
  112.          '</table></td></tr></table></center>'.
  113.          '<!-- logout_error -->'.
  114.          '</body></html>';
  115. }
  116.  
  117. function error_box($string, $color) {
  118.     global $pageheader_sent, $org_title;
  119.  
  120.     if ( !isset( $color ) ) {
  121.         $color = array();
  122.         $color[0]  = '#dcdcdc';  /* light gray    TitleBar               */
  123.         $color[1]  = '#800000';  /* red                                  */
  124.         $color[2]  = '#cc0000';  /* light red     Warning/Error Messages */
  125.         $color[4]  = '#ffffff';  /* white         Normal Background      */
  126.         $color[7]  = '#0000cc';  /* blue          Links                  */
  127.         $color[8]  = '#000000';  /* black         Normal text            */
  128.         $color[9]  = '#ababab';  /* mid-gray      Darker version of #0   */
  129.     }
  130.     if ( !isset( $org_title ) ) {
  131.         $org_title = "SquirrelMail";
  132.     }
  133.  
  134.     $err = _("ERROR");
  135.  
  136.     $ret = concat_hook_function('error_box', $string);
  137.     if($ret != '') {
  138.         $string = $ret;
  139.     }
  140.  
  141.     /* check if the page header has been sent; if not, send it! */
  142.     if(!isset($pageheader_sent) || !$pageheader_sent) {
  143.         /* include this just to be sure */
  144.         include_once( SM_PATH . 'functions/page_header.php' );
  145.         displayHtmlHeader($org_title.': '.$err);
  146.         $pageheader_sent = TRUE;
  147.         echo "<body text=\"$color[8]\" bgcolor=\"$color[4]\" link=\"$color[7]\" vlink=\"$color[7]\" alink=\"$color[7]\">\n\n";
  148.     }
  149.  
  150.     echo '<table width="100%" cellpadding="1" cellspacing="0" align="center" border="0" bgcolor="'.$color[9].'">'.
  151.          '<tr><td>'.
  152.          '<table width="100%" cellpadding="0" cellspacing="0" align="center" border="0" bgcolor="'.$color[4].'">'.
  153.          '<tr><td align="center" bgcolor="'.$color[0].'">'.
  154.          '<font color="'.$color[2].'"><b>' . $err . ':</b></font>'.
  155.          '</td></tr><tr><td>'.
  156.          '<table cellpadding="1" cellspacing="5" align="center" border="0">'.
  157.          '<tr>' . html_tag( 'td', $string."\n", 'left') . '</tr></table>'.
  158.          '</td></tr></table></td></tr></table>'.
  159.          '<!-- error_box -->';
  160. }
  161.  
  162. /**
  163.  * Adds message that informs about non fatal error that can happen while saving preferences
  164.  * @param string $message error message
  165.  * @since 1.5.1 and 1.4.5
  166.  */
  167. function error_option_save($message) {
  168.     global $optpage_save_error;
  169.  
  170.     if (! is_array($optpage_save_error) )
  171.         $optpage_save_error=array();
  172.  
  173.     $optpage_save_error=array_merge($optpage_save_error,array($message));
  174. }

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