Outputs HTML through the MagicHTML parser
[squirrelmail.git] / functions / mailbox_display.php
index 85f57a99e96043c11269323f54852f48ff129433..cad21478b0d36251a303367a4583e5744b4f59e1 100644 (file)
@@ -27,7 +27,7 @@
           }
           $GLOBALS["row_count"]++;
           if ($GLOBALS["row_count"] % 2) {
-          if (!isset($color[12])) $color[12] = "#EAEAEA";
+          if (!isset($color[12])) $color[12] = '#EAEAEA';
             $color_string = $color[12];
           }
       }
       $msg = $msgs[$key];
 
       $senderName = sqimap_find_displayable_name($msg['FROM']);
+      if( $mailbox == _("None") ) {
+         // $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
+         $boxes = sqimap_mailbox_list($imapConnection);
+         // sqimap_logout($imapConnection);
+         $mailbox = $boxes[0]['unformatted'];
+         unset( $boxes );
+      }      
       $urlMailbox = urlencode($mailbox);
       $subject = processSubject($msg['SUBJECT']);
 
       } else {
          $use = 1;
       }
+      $lMore = '';
+      $rMore = '';
       if (($nextGroup <= $numMessages) && ($prevGroup >= 0)) {
          $lMore = "<A HREF=\"right_main.php?use_mailbox_cache=$use&startMessage=$prevGroup&mailbox=$urlMailbox\" TARGET=\"right\">". _("Previous") . '</A>';
          $rMore = "<A HREF=\"right_main.php?use_mailbox_cache=$use&&startMessage=$nextGroup&mailbox=$urlMailbox\" TARGET=\"right\">". _("Next") ."</A>\n";
          $lMore = "<FONT COLOR=\"$color[9]\">"._("Previous") . '</FONT>';
          $rMore = "<A HREF=\"right_main.php?use_mailbox_cache=$use&startMessage=$nextGroup&mailbox=$urlMailbox\" TARGET=\"right\">". _("Next") ."</A>\n";
       }
-      $lMore .= ' | ';
+      if( $lMore <> '' )
+       $lMore .= ' | ';
 
       // Page selector block. Following code computes page links.
       $mMore = '';
                 $mMore .= '<b>' . ($i+1) . '</b> ';
                 } else {
                 $mMore .= "<a href=\"right_main.php?use_mailbox_cache=$use_mailbox_cache&startMessage=$start" .
-                        "&mailbox=$mailbox\" TARGET=\"right\">" .
+                        "&mailbox=$urlMailbox\" TARGET=\"right\">" .
                         ($i+1) .
                         '</a> ';
                 }