QC. Some code cleanup to avoid line overflow on mail list.
[squirrelmail.git] / src / left_main.php
index eb4b537984836e89056f1ab329f0cb8de0e0556d..6090b935abd98a49f32ab8f9c2c32b85bcf8a16b 100644 (file)
@@ -24,30 +24,13 @@ define('SM_BOX_COLLAPSED',   1);
 
 /* --------------------- FUNCTIONS ------------------------- */
 
-function isSpecialMailbox( $box ) {
-
-    global $trash_folder, $sent_folder, $draft_folder,
-           $move_to_trash, $move_to_sent, $save_as_draft;
-
-    $ret = ( (strtolower($box) == 'inbox') ||
-             (($box == $trash_folder) &&
-              ($move_to_trash)) ||
-             ((substr( $sent_folder, 0, strlen( $box ) ) == $box) &&
-              ($move_to_sent)) ||
-             (($box == $draft_folder) &&
-              ($save_as_draft)) );
-
-    return( $ret );
-
-}
-
 function formatMailboxName($imapConnection, $box_array) {
 
-    global $folder_prefix, $trash_folder, $sent_folder;
-    global $color, $move_to_sent, $move_to_trash;
-    global $unseen_notify, $unseen_type, $collapse_folders;
-    global $draft_folder, $save_as_draft;
-    global $use_special_folder_color;
+    global $folder_prefix, $trash_folder, $sent_folder,
+           $color, $move_to_sent, $move_to_trash,
+           $unseen_notify, $unseen_type, $collapse_folders,
+           $draft_folder, $save_as_draft,
+           $use_special_folder_color;
 
     $real_box = $box_array['unformatted'];
     $mailbox = str_replace(' ','',$box_array['formatted']);
@@ -65,11 +48,11 @@ function formatMailboxName($imapConnection, $box_array) {
         $unseen = sqimap_unseen_messages($imapConnection, $real_box);
         if ($unseen_type == 1 && $unseen > 0) {
             $unseen_string = "($unseen)";
-            $unseen_found = true;
+            $unseen_found = TRUE;
         } else if ($unseen_type == 2) {
             $numMessages = sqimap_get_num_messages($imapConnection, $real_box);
             $unseen_string = "<font color=\"$color[11]\">($unseen/$numMessages)</font>";
-            $unseen_found = true;
+            $unseen_found = TRUE;
         }
     }
 
@@ -82,12 +65,16 @@ function formatMailboxName($imapConnection, $box_array) {
     if ($unseen > 0) { $line .= '<B>'; }
 
     /* Crate the link for this folder. */
-    $line .= "<A HREF=\"right_main.php?sort=0&startMessage=1&mailbox=$mailboxURL\" TARGET=\"right\" STYLE=\"text-decoration:none\">";
+    $line .= "<A HREF=\"right_main.php?sort=0&amp;startMessage=1&amp;mailbox=$mailboxURL\" TARGET=\"right\" STYLE=\"text-decoration:none\">";
     if ($special_color) {
         $line .= "<FONT COLOR=\"$color[11]\">";
     }
-    $line .= str_replace(' ','&nbsp;',$mailbox);
-    if ($special_color == true)
+    if ( $mailbox == 'INBOX' ) {
+        $line .= _("INBOX");
+    } else {
+        $line .= str_replace(' ','&nbsp;',$mailbox);
+    }
+    if ($special_color == TRUE)
         $line .= "</FONT>";
     $line .= '</A>';
 
@@ -108,7 +95,7 @@ function formatMailboxName($imapConnection, $box_array) {
             $urlMailbox = urlencode($real_box);
             $line .= "\n<small>\n" .
                     "&nbsp;&nbsp;(<A HREF=\"empty_trash.php\" style=\"text-decoration:none\">"._("empty")."</A>)" .
-                    "\n</small>\n";
+                    "</small>";
         }
     }
 
@@ -176,8 +163,8 @@ function create_collapse_link($boxnum) {
     $mailbox = urlencode($boxes[$boxnum]['unformatted']);
 
     /* Create the link for this collapse link. */
-    $link = '<a target="left" style="text-decoration:none" ';
-    $link .= 'href="left_main.php?';
+    $link = '<a target="left" style="text-decoration:none" ' .
+            'href="left_main.php?';
     if ($boxes[$boxnum]['collapse'] == SM_BOX_COLLAPSED) {
         $link .= "unfold=$mailbox\">+";
     } else {
@@ -238,7 +225,7 @@ if ($auto_create_special && !isset($auto_create_done)) {
     }
 
     /* Let the world know that autocreation is complete! Hurrah! */
-    $auto_create_done = true;
+    $auto_create_done = TRUE;
     session_register('auto_create_done');
 }
 
@@ -277,7 +264,7 @@ if ($date_format != 6) {
         $clk = date($hr, time());
         break;
     default:
-        $clk = date('D, '.$hr, time());
+        $clk = substr( getDayName( date( 'w', time() ) ), 0, 3 ) . date( ', ' . $hr, time() );
     }
     $clk = str_replace(' ','&nbsp;',$clk);
 
@@ -304,11 +291,13 @@ $curbox = 0;
 $boxcount = count($boxes);
 
 /* Compute the collapsedness and visibility of each box. */
+
 while ($curbox < $boxcount) {
     $boxes[$curbox]['visible'] = TRUE;
     compute_folder_children($curbox, $boxcount);
 }
 
+
 for ($i = 0; $i < count($boxes); $i++) {
     if ( $boxes[$i]['visible'] ) {
         $mailbox = $boxes[$i]['formatted'];
@@ -328,6 +317,7 @@ for ($i = 0; $i < count($boxes); $i++) {
         if (! isset($color[15])) {
             $color[15] = $color[6];
         }
+
         if (in_array('noselect', $boxes[$i]['flags'])) {
             if( isSpecialMailbox( $boxes[$i]['unformatted']) ) {
                 $line .= "<FONT COLOR=\"$color[11]\">";
@@ -356,4 +346,4 @@ do_hook('left_main_after');
 
 echo "</BODY></HTML>\n";
 
-?>
\ No newline at end of file
+?>