fix php5 mistakes and remove disabled code. disabled code might be used to make sure
[squirrelmail.git] / functions / mailbox_display.php
index adf6b5efb25687ebc9aadaad88fb228b3058c049..9f7b277a528a2d2327c69ae8bc435646ac1c114c 100644 (file)
@@ -702,7 +702,7 @@ function setUserPref($username, $pref, $value) {
 */
 function _get_sorted_msgs_list($imapConnection,&$aMailbox) {
     $iSetIndx = (isset($aMailbox['SETINDEX'])) ? $aMailbox['SETINDEX'] : 0;
-    $bDirection = ($aMailbox['SORT'] % 2);
+    $bDirection = !($aMailbox['SORT'] % 2);
     $error = 0;
     if (!$aMailbox['SEARCH'][$iSetIndx]) {
         $aMailbox['SEARCH'][$iSetIndx] = 'ALL';
@@ -899,6 +899,7 @@ function showMessagesForMailbox($imapConnection, &$aMailbox,$aProps, &$iError) {
              $aMailbox['PAGEOFFSET'] + $iLimit - 1 : $aMailbox['EXISTS'];
 
     $iNumberOfMessages = $aMailbox['TOTAL'][$iSetIndx];
+    $iEnd = min ( $iEnd, $iNumberOfMessages );
 
     $php_self = $PHP_SELF;
 
@@ -1054,7 +1055,6 @@ function showMessagesForMailbox($imapConnection, &$aMailbox,$aProps, &$iError) {
     // FIX ME, before we support multiple templates we must review the names of the vars
 
 
-
     $aTemplate['color']     = $color;
     $aTemplate['form_name'] = "FormMsgs" . $safe_name;
     $aTemplate['form_id']   = 'mbx_'.$iFormId;
@@ -1084,6 +1084,7 @@ function showMessagesForMailbox($imapConnection, &$aMailbox,$aProps, &$iError) {
     $aTemplate['alt_index_colors'] = (isset($aProps['config']['alt_index_colors'])) ? $aProps['config']['alt_index_colors'] : false;
     $aTemplate['fancy_index_highlite'] = $fancy_index_highlite;
 
+
     return $aTemplate;
 }