Don't trigger checkForm when we show the pageHeader.
[squirrelmail.git] / src / read_body.php
index 094b3266b6df9441957dd092d2416caaa0dbc24d..7998c13cd3d879e1d7ec7d0b3a8ed804e75b84de 100644 (file)
@@ -264,7 +264,7 @@ function SendMDN ( $mailbox, $passed_id, $sender, $message, $imapConnection) {
     }
     if (!$success) {
         $msg  = $deliver->dlv_msg . '<br />' .
-                _("Server replied: ") . $deliver->dlv_ret_nr . ' '.
+                _("Server replied:") . ' ' . $deliver->dlv_ret_nr . ' ' .
                 $deliver->dlv_server_msg;
         require_once(SM_PATH . 'functions/display_messages.php');
         plain_error_message($msg, $color);
@@ -522,12 +522,6 @@ function formatMenubar($aMailbox, $passed_id, $passed_ent_id, $message, $removed
 
     // Prev/Next links for regular messages
     } else if ( true ) { //!(isset($where) && isset($what)) ) {
-        /**
-         * Check if cache is still valid
-         */
-        if (!is_array($aMailbox['UIDSET'][$what])) {
-            fetchMessageHeaders($imapConnection, $aMailbox);
-        }
         $prev = findPreviousMessage($aMailbox['UIDSET'][$what], $passed_id);
         $next = findNextMessage($aMailbox['UIDSET'][$what],$passed_id);
 
@@ -781,6 +775,10 @@ sqgetGlobalVar('sendreceipt',   $sendreceipt,   SQ_GET);
 if (!sqgetGlobalVar('where',         $where,         SQ_GET) ) {
     $where = 'right_main.php';
 }
+/*
+ * Used as entry key to the list of uid's cached in the mailbox cache
+ * we use the cached uid's to get the next and prev  message.
+ */
 if (!sqgetGlobalVar('what',          $what,          SQ_GET) ){
     $what = 0;
 }
@@ -830,17 +828,21 @@ $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0
 $aMailbox = sqm_api_mailbox_select($imapConnection, $iAccount, $mailbox,array('setindex' => $what, 'offset' => $startMessage),array());
 
 /**
- * Check if cache is still valid
- */
-$iSetIndex = $aMailbox['SETINDEX'];
-$aMailbox['CURRENT_MSG'][$iSetIndex] = $passed_id;
-//$aMailbox['OFFSET'] = $startMessage -1;
-
-sqgetGlobalVar('aFetchColumns',$aFetchColumns,SQ_SESSION);
+    * Check if cache is still valid, $what contains the key
+    * which gives us acces to the array with uid's. At this moment
+    * 0 is used for a normal message list and search uses 1 as key. This can be
+    * changed / extended in the future.
+    * If on a select of a mailbox we detect that the cache should be invalidated due to
+    * the delete of messages or due to new messages we empty the list with uid's and
+    * that's what we detect below.
+    */
 if (!is_array($aMailbox['UIDSET'][$what])) {
-    fetchMessageHeaders($imapConnection, $aMailbox, $aFetchColumns);
+    fetchMessageHeaders($imapConnection, $aMailbox);
 }
 
+$iSetIndex = $aMailbox['SETINDEX'];
+$aMailbox['CURRENT_MSG'][$iSetIndex] = $passed_id;
+
 /**
  * Update the seen state
  * and ignore in_array('\\seen',$aMailbox['PERMANENTFLAGS'],true)
@@ -935,7 +937,7 @@ for ($i = 0; $i < $cnt; $i++) {
    }
 }
 
-displayPageHeader($color, $mailbox);
+displayPageHeader($color, $mailbox,'','');
 formatMenuBar($aMailbox, $passed_id, $passed_ent_id, $message,false);
 formatEnvheader($aMailbox, $passed_id, $passed_ent_id, $message, $color, $FirstTimeSee);
 echo '<table width="100%" cellpadding="0" cellspacing="0" align="center" border="0">';
@@ -945,7 +947,7 @@ echo '      <tr><td>';
 echo '        <table width="100%" cellpadding="3" cellspacing="0" align="center" border="0">';
 echo '          <tr bgcolor="'.$color[4].'"><td>';
 // echo '            <table cellpadding="1" cellspacing="5" align="left" border="0">';
-echo html_tag( 'table' ,'' , 'left', '', 'cellpadding="1" cellspacing="5" border="0"' );
+echo html_tag( 'table' ,'' , 'left', '', 'width="100%" cellpadding="1" cellspacing="5" border="0"' );
 echo '              <tr>' . html_tag( 'td', '<br />'. $messagebody."\n", 'left')
                         . '</tr>';
 echo '            </table>';