don't STATUS a mailbox that isn't selectable
[squirrelmail.git] / functions / mailbox_display.php
index 2fc02b834ba8b452516b07aa4df5ad0878f019a9..e91a1c7edcd63e28b05bfa194a343a67ff33a685 100644 (file)
  * $Id$
  */
 
-require_once('../functions/strings.php');
-require_once('../functions/html.php');
-require_once('../class/html.class.php');
-require_once('../functions/imap_mailbox.php');
+require_once(SM_PATH . 'functions/strings.php');
+require_once(SM_PATH . 'functions/html.php');
+require_once(SM_PATH . 'class/html.class.php');
+require_once(SM_PATH . 'functions/imap_mailbox.php');
 
 /* Default value for page_selector_max. */
 define('PG_SEL_MAX', 10);
@@ -349,6 +349,7 @@ function showMessagesForMailbox($imapConnection, $mailbox, $num_msgs,
   if ($auto_expunge == true) {
      $exp_cnt = sqimap_mailbox_expunge($imapConnection, $mailbox, false, '');
      $mbxresponse['EXISTS'] = $mbxresponse['EXISTS'] - $exp_cnt;
+     $num_msgs = $mbxresponse['EXISTS'];
   }
 
   if ($mbxresponse['EXISTS']>0) {
@@ -448,12 +449,14 @@ function showMessagesForMailbox($imapConnection, $mailbox, $num_msgs,
                                   $msg_cnt_str, $paginator_str, $start_msg);
 
   
+  echo '<table bgcolor="' . $color[0] . '" border="0" width="100%" cellpadding="1" cellspacing="0"><tr><td>';
   printHeader($mailbox, $srt, $color, !$thread_sort_messages);
 
   displayMessageArray($imapConnection, $num_msgs, $start_msg, 
                      $msort, $mailbox, $sort, $color, $show_num,0,0);
 
   mail_message_listing_end($num_msgs, $paginator_str, $msg_cnt_str, $color); 
+  echo '</td></tr></table>';
                      
   /**
    * TODO: Switch to using $_SESSION[] whenever we ditch the 4.0.x series.
@@ -721,7 +724,12 @@ function mail_message_listing_beginning ($imapConnection,
   echo getButton('SUBMIT', 'markRead',_("Read"));
   echo getButton('SUBMIT', 'markUnread',_("Unread"));
   echo getButton('SUBMIT', 'delete',_("Delete")) ."&nbsp\n";
-  echo '<INPUT TYPE="HIDDEN" NAME="location" VALUE="'.$PHP_SELF.'">';
+  if (!strpos($PHP_SELF,'mailbox')) {
+     $location = $PHP_SELF.'?mailbox=INBOX&amp;startMessage=1';
+  } else {
+     $location = $PHP_SELF;
+  }
+  echo '<INPUT TYPE="HIDDEN" NAME="location" VALUE="'.$location.'">';
   echo "</TD>\n"
        . "   </TR>\n";
 
@@ -754,12 +762,6 @@ function mail_message_listing_beginning ($imapConnection,
     echo '</td></tr>'
     .  html_tag( 'tr' )
     . html_tag( 'td' ,'' , '', $color[0], '' );
-    if ($GLOBALS['alt_index_colors']){
-        $cellspacing =  '0';
-    } else {
-        $cellspacing = '1';
-    }
-    echo html_tag( 'table' ,'' , '', $color[0], 'border="0" width="100%" cellpadding="2"  cellspacing="'. $cellspacing .'"' );
 
     /* if using server sort we highjack the
     * the $sort var and use $server_sort_order
@@ -796,7 +798,7 @@ function mail_message_listing_end($num_msgs, $paginator_str, $msg_cnt_str, $colo
 
 function printHeader($mailbox, $sort, $color, $showsort=true) {
   global $index_order;
-    echo html_tag( 'table' ,'' , '', $color[9], 'border="0" width="100%" cellpadding="1"  cellspacing="1"' );
+    echo html_tag( 'table' ,'' , '', $color[4], 'border="0" width="100%" cellpadding="1" cellspacing="0"' );
     echo html_tag( 'tr' ,'' , 'center', $color[5] );
     for ($i=1; $i <= count($index_order); $i++) {
         switch ($index_order[$i]) {
@@ -950,6 +952,11 @@ function get_msgcnt_str($start_msg, $end_msg, $num_msgs) {
 function get_paginator_link($box, $start_msg, $use, $text) {
   global $PHP_SELF;
 
+  $result = "<A HREF=\"right_main.php?use_mailbox_cache=$use"
+    . "&amp;startMessage=$start_msg&amp;mailbox=$box\" "
+    . "TARGET=\"right\">$text</A>";
+  return ($result);
+/*
   if (preg_match('/^(.+)\?.+$/',$PHP_SELF,$regs)) {
      $source_url = $regs[1];
   } else {
@@ -960,6 +967,7 @@ function get_paginator_link($box, $start_msg, $use, $text) {
     . "&amp;startMessage=$start_msg&amp;mailbox=$box\" "
     . "TARGET=\"right\">$text</A>";
   return ($result);
+*/  
 }
 
 /*
@@ -1164,6 +1172,7 @@ function get_paginator_str($box, $start_msg, $end_msg, $num_msgs,
 }
 
 function processSubject($subject) {
+    global $languages, $squirrelmail_language;
   /* Shouldn't ever happen -- caught too many times in the IMAP functions */
   if ($subject == '')
     return _("(no subject)");
@@ -1191,6 +1200,11 @@ function processSubject($subject) {
     return $subject;
   }
   
+  if (isset($languages[$squirrelmail_language]['XTRA_CODE']) &&
+      function_exists($languages[$squirrelmail_language]['XTRA_CODE'])) {
+      return $languages[$squirrelmail_language]['XTRA_CODE']('strimwidth', $subject, $trim_val);
+  }
+  
   return substr($subject, 0, $trim_val) . '...';
 }