Added _() to some strings missing from translation.
[squirrelmail.git] / src / folders.php
index 8cf5818ccbe2cf1aeb8ff1b97272d74524fa0a09..44b6073c00d87974a5bdf934286dd873073a1b36 100644 (file)
@@ -22,7 +22,7 @@
    echo "   </TD></TR>\n";
    echo "</TABLE>\n";
 
-   $imapConnection = sqimap_login ($username, $key, $imapServerAddress, 0);
+   $imapConnection = sqimap_login ($username, $key, $imapServerAddress, $imapPort, 0);
    $boxes = sqimap_mailbox_list($imapConnection);
 
    /** DELETING FOLDERS **/
       echo "<OPTION>[ None ]\n";
 
    for ($i = 0; $i < count($boxes); $i++) {
-//      for ($j = 0; $j < count($boxes[$i]["flags"]); $j++) {
-//         if ($boxes[$i]["flags"][$j] != "noinferiors") {
-            if (($boxes[$i]["unformatted"] == $special_folders[0]) && ($default_sub_of_inbox == true)) {
-               $box = $boxes[$i]["unformatted"];
-               $box2 = replace_spaces($boxes[$i]["formatted"]);
-               echo "<OPTION SELECTED VALUE=\"$box\">$box2\n";
-            } else {
-               $box = $boxes[$i]["unformatted"];
-               $box2 = replace_spaces($boxes[$i]["formatted"]);
-               echo "<OPTION VALUE=\"$box\">$box2\n";
-            }
-//         }   
-//      }
+      if (count($boxes[$i]["flags"]) > 0) {
+         for ($j = 0; $j < count($boxes[$i]["flags"]); $j++) {
+            if ($boxes[$i]["flags"][$j] != "noinferiors") {
+               if (($boxes[$i]["unformatted"] == $special_folders[0]) && ($default_sub_of_inbox == true)) {
+                  $box = $boxes[$i]["unformatted"];
+                  $box2 = replace_spaces($boxes[$i]["formatted"]);
+                  echo "<OPTION SELECTED VALUE=\"$box\">$box2\n";
+               } else {
+                  $box = $boxes[$i]["unformatted"];
+                  $box2 = replace_spaces($boxes[$i]["formatted"]);
+                  echo "<OPTION VALUE=\"$box\">$box2\n";
+               }
+            }   
+         }    
+      } else {
+         if (($boxes[$i]["unformatted"] == $special_folders[0]) && ($default_sub_of_inbox == true)) {
+            $box = $boxes[$i]["unformatted"];
+            $box2 = replace_spaces($boxes[$i]["formatted"]);
+            echo "<OPTION SELECTED VALUE=\"$box\">$box2\n";
+         } else {
+            $box = $boxes[$i]["unformatted"];
+            $box2 = replace_spaces($boxes[$i]["formatted"]);
+            echo "<OPTION VALUE=\"$box\">$box2\n";
+         }
+      }
    }
    echo "</SELECT></TT><BR>\n";
    if ($show_contain_subfolders_option) {
             }
          }
          if ($use_folder == true) {
-            $box = $boxes[$i]["unformatted"];
+            $box = $boxes[$i]["unformatted-dm"];
             $box2 = replace_spaces($boxes[$i]["formatted"]);
             echo "         <OPTION VALUE=\"$box\">$box2\n";
          }
       echo "<INPUT TYPE=SUBMIT VALUE=\"";
       echo _("Rename");
       echo "\">\n";
+      echo "</FORM></TD></TR>\n";
+   } else {
+      echo _("No mailboxes found") . "<br><br></td></tr>";
+   }
+   $boxes_sub = $boxes;
+   
+   /** UNSUBSCRIBE FOLDERS **/
+   echo "<TR><TD BGCOLOR=\"$color[0]\" ALIGN=CENTER><B>";
+   echo _("Unsubscribe/Subscribe");
+   echo "</B></TD></TR>";
+   echo "<TR><TD BGCOLOR=\"$color[4]\" ALIGN=CENTER>";
+   if ($count_special_folders < count($boxes)) {
+      echo "<FORM ACTION=\"folders_subscribe.php?method=unsub\" METHOD=POST>\n";
+      echo "<TT><SELECT NAME=mailbox>\n";
+      for ($i = 0; $i < count($boxes); $i++) {
+         $use_folder = true;
+         for ($p = 0; $p < count($special_folders); $p++) {
+            if ($boxes[$i]["unformatted"] == $special_folders[$p]) {
+               $use_folder = false;
+            } else if (substr($boxes[$i]["unformatted"], 0, strlen($trash_folder)) == $trash_folder) {
+               $use_folder = false;
+            }
+         }
+         if ($use_folder == true) {
+            $box = $boxes[$i]["unformatted-dm"];
+            $box2 = replace_spaces($boxes[$i]["formatted"]);
+            echo "         <OPTION VALUE=\"$box\">$box2\n";
+         }
+      }
+      echo "</SELECT></TT>\n";
+      echo "<INPUT TYPE=SUBMIT VALUE=\"";
+      echo _("Unsubscribe");
+      echo "\">\n";
+      echo "</FORM></TD></TR>\n";
+   } else {
+      echo _("No mailboxes found") . "<br><br></td></tr>";
+   }
+   $boxes_sub = $boxes;
+   
+   /** SUBSCRIBE TO FOLDERS **/
+
+   echo "<TR><TD BGCOLOR=\"$color[4]\" ALIGN=CENTER>";
+   if ($count_special_folders < count($boxes)) {
+      $imap_stream = sqimap_login ($username, $key, $imapServerAddress, $imapPort, 1);
+      $boxes = sqimap_mailbox_list_all ($imap_stream);
+      
+      echo "<FORM ACTION=\"folders_subscribe.php?method=sub\" METHOD=POST>\n";
+      echo "<tt><input type=text size=32 name=mailbox></tt>";
+      echo "<INPUT TYPE=SUBMIT VALUE=\"";
+      echo _("Subscribe");
+      echo "\">\n";
       echo "</FORM></TD></TR></TABLE><BR>\n";
    } else {
       echo _("No mailboxes found") . "<br><br></td></tr></table>";