Sfoglia il codice sorgente

* Cleaned up some code

Tyler Akins 24 anni fa
parent
commit
7f396e7035
3 ha cambiato i file con 8 aggiunte e 44 eliminazioni
  1. 1 22
      src/folders.php
  2. 1 5
      src/folders_delete.php
  3. 6 17
      src/left_main.php

+ 1 - 22
src/folders.php

@@ -165,28 +165,7 @@
    }
    }
 
 
    for ($i = 0; $i < count($boxes); $i++) {
    for ($i = 0; $i < count($boxes); $i++) {
-      if (count($boxes[$i]["flags"]) > 0) {
-         $noinf = false;
-         for ($j = 0; $j < count($boxes[$i]["flags"]); $j++) {
-            if ($boxes[$i]["flags"][$j] == "noinferiors") {
-               $noinf = true;
-               continue;
-            }
-         }    
-         if ($noinf == false) {
-            if ((strtolower($boxes[$i]["unformatted"]) == "inbox") && ($default_sub_of_inbox == true)) {
-               $box = $boxes[$i]["unformatted"];
-               $box2 = replace_spaces($boxes[$i]["unformatted-disp"]);
-               echo "<OPTION SELECTED VALUE=\"$box\">$box2\n";
-            } else {
-               $box = $boxes[$i]["unformatted"];
-               $box2 = replace_spaces($boxes[$i]["unformatted-disp"]);
-               if (strtolower($imap_server_type) != "courier" ||
-                  strtolower($box) != "inbox.trash")
-                echo "<OPTION VALUE=\"$box\">$box2\n";
-            }
-         }
-      } else {
+      if (!in_array('noinferiors', $boxes[$i]['flags'])) {
          if ((strtolower($boxes[$i]["unformatted"]) == "inbox") && ($default_sub_of_inbox == true)) {
          if ((strtolower($boxes[$i]["unformatted"]) == "inbox") && ($default_sub_of_inbox == true)) {
             $box = $boxes[$i]["unformatted"];
             $box = $boxes[$i]["unformatted"];
             $box2 = replace_spaces($boxes[$i]["unformatted-disp"]);
             $box2 = replace_spaces($boxes[$i]["unformatted-disp"]);

+ 1 - 5
src/folders_delete.php

@@ -62,11 +62,7 @@
    else {
    else {
       for ($i = 0; $i < count($boxes); $i++) {
       for ($i = 0; $i < count($boxes); $i++) {
          if ($boxes[$i]["unformatted"] == $trash_folder) {
          if ($boxes[$i]["unformatted"] == $trash_folder) {
-            $can_move_to_trash = true;
-            for ($j = 0; $j < count($boxes[$i]["flags"]); $j++) {
-               if (strtolower($boxes[$i]["flags"][$j]) == "noinferiors")
-		  $can_move_to_trash = false;
-            }
+            $can_move_to_trash = !in_array('noinferiors', $boxes[$i]['flags']);
          }
          }
       }
       }
    }
    }

+ 6 - 17
src/left_main.php

@@ -138,24 +138,13 @@
       $line = "";
       $line = "";
       $mailbox = $boxes[$i]["formatted"];
       $mailbox = $boxes[$i]["formatted"];
       
       
-      if (count($boxes[$i]["flags"])) {
-         $noselect = false;
-         for ($h = 0; $h < count($boxes[$i]["flags"]); $h++) {
-            if (strtolower($boxes[$i]["flags"][$h]) == "noselect")
-               $noselect = true;
-         }
-         if ($noselect == true) {
-            $line .= "<FONT COLOR=\"$color[10]\">";
-            $line .= replace_spaces($mailbox);
-            $line .= "</FONT>";
-         } else {
-	    if (! isset($boxes[$i]["unseen"])) 
-	        $boxes[$i]["unseen"] = 0;
-            $line .= formatMailboxName($imapConnection, $mailbox, $boxes[$i]["unformatted"], $delimeter, $boxes[$i]["unseen"]);
-         }
+      if (in_array('noselect', $boxes[$i]['flags']) {
+         $line .= "<FONT COLOR=\"$color[10]\">";
+         $line .= replace_spaces($mailbox);
+         $line .= '</FONT>';
       } else {
       } else {
-        if (!isset($boxes[$i]["unseen"])) 
-            $boxes[$i]["unseen"] = "";
+	 if (! isset($boxes[$i]['unseen'])) 
+	    $boxes[$i]['unseen'] = '';
          $line .= formatMailboxName($imapConnection, $mailbox, $boxes[$i]["unformatted"], $delimeter, $boxes[$i]["unseen"]);
          $line .= formatMailboxName($imapConnection, $mailbox, $boxes[$i]["unformatted"], $delimeter, $boxes[$i]["unseen"]);
       }
       }
       echo "$line<BR>\n";
       echo "$line<BR>\n";