Fixed some major bugs in getting the folder list. Might fix the problem with the...
authorlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 9 Feb 2000 12:10:43 +0000 (12:10 +0000)
committerlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 9 Feb 2000 12:10:43 +0000 (12:10 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@199 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/imap.php
functions/strings.php
po/squirrelmail.po
src/folders_create.php
src/folders_delete.php
src/left_main.php

index 267bce91a9659f010d9ab9905b000498c241c490..88189760c65eb6d75137f475c8d5bc815e6d7f79 100644 (file)
    /** Parse the incoming mailbox name and return a string that is the FOLDER.MAILBOX **/
    function findMailboxName($mailbox) {
       $mailbox = trim($mailbox);
    /** Parse the incoming mailbox name and return a string that is the FOLDER.MAILBOX **/
    function findMailboxName($mailbox) {
       $mailbox = trim($mailbox);
-      if (substr($mailbox,  strlen($mailbox)-1, strlen($mailbox)) == "\"") {
-         $mailbox = substr($mailbox, 0, strlen($mailbox) - 1);
-         $pos = strrpos($mailbox, "\"") + 1;
-         $box = substr($mailbox, $pos, strlen($mailbox));
-      } else {
+//      if (substr($mailbox,  strlen($mailbox)-1, strlen($mailbox)) == "\"") {
+//         $mailbox = substr($mailbox, 0, strlen($mailbox) - 1);
+//         $pos = strrpos($mailbox, "\"") + 1;
+//         $box = substr($mailbox, $pos, strlen($mailbox));
+//      } else {
          $box = substr($mailbox, strrpos($mailbox, " ")+1, strlen($mailbox));
          $box = substr($mailbox, strrpos($mailbox, " ")+1, strlen($mailbox));
-      }
+//      }
       return $box;
    }
 
       return $box;
    }
 
       return $read;
    }
 
       return $read;
    }
 
-   function getMailboxFlags($mailbox) {
+   function getMailboxFlags($imapConnection, $mailbox) {
+      $name = findMailboxName($mailbox);
+      fputs ($imapConnection, "1 LIST \"$name\" *\n");
+      $data = imapReadData($imapConnection, "1", true, $response, $message);
+      $mailbox = $data[0];
       $mailbox = trim($mailbox);
       $mailbox = substr($mailbox, strpos($mailbox, "(")+1, strlen($mailbox));
       $mailbox = substr($mailbox, 0, strpos($mailbox, ")"));
       $mailbox = trim($mailbox);
       $mailbox = substr($mailbox, strpos($mailbox, "(")+1, strlen($mailbox));
       $mailbox = substr($mailbox, 0, strpos($mailbox, ")"));
    }
 
    function removeFolder($imapConnection, $folder) {
    }
 
    function removeFolder($imapConnection, $folder) {
+      fputs ($imapConnection, "1 unsubscribe \"$folder\"\n");
+      $data = imapReadData($imapConnection, "1", true, $response, $message);
+      echo $data[0] . "<BR>";
       fputs($imapConnection, "1 delete \"$folder\"\n");
       $data = imapReadData($imapConnection, "1", false, $response, $message);
       if ($response == "NO") {
       fputs($imapConnection, "1 delete \"$folder\"\n");
       $data = imapReadData($imapConnection, "1", false, $response, $message);
       if ($response == "NO") {
 
             $mailbox = findMailboxName($mailbox);
             $periodCount = countCharInString($mailbox, $dm);
 
             $mailbox = findMailboxName($mailbox);
             $periodCount = countCharInString($mailbox, $dm);
+            if (substr($mailbox, -1) == $dm)
+               $periodCount--;
 
             // indent the correct number of spaces.
             for ($j = 0;$j < $periodCount;$j++)
 
             // indent the correct number of spaces.
             for ($j = 0;$j < $periodCount;$j++)
          if (substr(findMailboxName($mailbox), 0, 1) != ".") {
             $boxes[$g]["RAW"] = $mailbox;
 
          if (substr(findMailboxName($mailbox), 0, 1) != ".") {
             $boxes[$g]["RAW"] = $mailbox;
 
+            // Get the mailbox name and format it.  If there is a $dm at the end of it, remove it.
             $mailbox = findMailboxName($mailbox);
             $periodCount = countCharInString($mailbox, $dm);
             $mailbox = findMailboxName($mailbox);
             $periodCount = countCharInString($mailbox, $dm);
+            if (substr($mailbox, -1) == $dm)
+               $periodCount = $periodCount - 1;
 
             // indent the correct number of spaces.
             for ($j = 0;$j < $periodCount;$j++)
 
             // indent the correct number of spaces.
             for ($j = 0;$j < $periodCount;$j++)
index 5c633d444bec5cac7b5a8d1979034d9a94d7f7a3..11e30f924563c2007b22128f77caeb6fb72f89e2 100644 (file)
@@ -17,6 +17,9 @@
    //    of the $haystack is reached.
    //*************************************************************************
    function readShortMailboxName($haystack, $needle) {
    //    of the $haystack is reached.
    //*************************************************************************
    function readShortMailboxName($haystack, $needle) {
+      if (substr($haystack, -1) == $needle)
+         $haystack = substr($haystack, 0, strlen($haystack) - 1);
+
       if (strpos($haystack, $needle)) {
          $pos = strrpos($haystack, $needle) + 1;
          $data = substr($haystack, $pos, strlen($haystack));
       if (strpos($haystack, $needle)) {
          $pos = strrpos($haystack, $needle) + 1;
          $data = substr($haystack, $pos, strlen($haystack));
index 5f2e74488d7a8a2353a8093ea0e09249a8df9539..8b93c988bff3a148c2bfd785b823c46e963a2b66 100644 (file)
@@ -6,7 +6,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2000-02-08 07:02-0500\n"
+"POT-Creation-Date: 2000-02-09 07:13-0500\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -114,7 +114,28 @@ msgid ""
 msgstr ""
 
 #: squirrelmail/src/folders_create.php:35
 msgstr ""
 
 #: squirrelmail/src/folders_create.php:35
-#: squirrelmail/src/folders_delete.php:77
+msgid "Folder Created!"
+msgstr ""
+
+#: squirrelmail/src/folders_create.php:36
+#: squirrelmail/src/folders_delete.php:80
+msgid "You will be automatically forwarded."
+msgstr ""
+
+#: squirrelmail/src/folders_create.php:36
+#: squirrelmail/src/folders_delete.php:80
+msgid "If not,"
+msgstr ""
+
+#: squirrelmail/src/folders_create.php:36
+#: squirrelmail/src/folders_delete.php:80
+msgid "click here"
+msgstr ""
+
+#: squirrelmail/src/folders_delete.php:79
+msgid "Folder Deleted!"
+msgstr ""
+
 #: squirrelmail/src/folders_rename_do.php:67
 msgid "Return"
 msgstr ""
 #: squirrelmail/src/folders_rename_do.php:67
 msgid "Return"
 msgstr ""
@@ -128,7 +149,7 @@ msgid "New name:"
 msgstr ""
 
 #: squirrelmail/src/folders_rename_getname.php:34
 msgstr ""
 
 #: squirrelmail/src/folders_rename_getname.php:34
-#: squirrelmail/src/options.php:259
+#: squirrelmail/src/options.php:258
 msgid "Submit"
 msgstr ""
 
 msgid "Submit"
 msgstr ""
 
@@ -196,11 +217,11 @@ msgstr ""
 msgid "         Size of editor window (in characters):"
 msgstr ""
 
 msgid "         Size of editor window (in characters):"
 msgstr ""
 
-#: squirrelmail/src/options.php:147
+#: squirrelmail/src/options.php:146
 msgid "         Time between auto refresh of folder list:"
 msgstr ""
 
 msgid "         Time between auto refresh of folder list:"
 msgstr ""
 
-#: squirrelmail/src/options.php:245
+#: squirrelmail/src/options.php:244
 msgid "Use a signature?"
 msgstr ""
 
 msgid "Use a signature?"
 msgstr ""
 
index 14ef7636c6ec2458757fe689c29222f2399d27c7..e668ac2da3c2017a1201349090355d8d9a46b030 100644 (file)
    if (trim($subfolder) == "[ None ]") {
       createFolder($imapConnection, "$folder_name");
    } else {
    if (trim($subfolder) == "[ None ]") {
       createFolder($imapConnection, "$folder_name");
    } else {
-      createFolder($imapConnection, "$subfolder$dm$folder_name");
+      createFolder($imapConnection, "$subfolder$folder_name");
    }
    fputs($imapConnection, "1 logout\n");
 
    }
    fputs($imapConnection, "1 logout\n");
 
-   echo "<BR><BR><A HREF=\"webmail.php?right_frame=folders.php\" TARGET=_top>";
-   echo _("Return");
-   echo "</A>";
+   echo "<FONT FACE=\"Arial,Helvetica\">";
+   echo "<BR><BR><CENTER><B>" . _("Folder Created!") . "</B><BR><BR>";
+   echo _("You will be automatically forwarded.") . "<BR>" . _("If not,") . " <A HREF=\"webmail.php?right_frame=folders.php\" TARGET=_top>" . _("click here") . "</a>.";   
+   echo "</CENTER></FONT>"; 
+         
 ?>
 </BODY></HTML>
 
 ?>
 </BODY></HTML>
 
index caebfcb2c115787c847db545b8e5bcaa1ab97e1d..9b836009f8783fb5ca392e5c064c222c38403bd9 100644 (file)
@@ -9,6 +9,8 @@
    include("../src/load_prefs.php");
 
    echo "<HTML><BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
    include("../src/load_prefs.php");
 
    echo "<HTML><BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
+   displayPageHeader($color, "None");  
+   
    $imapConnection = loginToImapServer($username, $key, $imapServerAddress, 0);
    getFolderList($imapConnection, $boxes);
 
    $imapConnection = loginToImapServer($username, $key, $imapServerAddress, 0);
    getFolderList($imapConnection, $boxes);
 
@@ -19,7 +21,7 @@
          $tmp_trash_folder = $boxes[$i]["RAW"];
    }
 
          $tmp_trash_folder = $boxes[$i]["RAW"];
    }
 
-   $tmpflags = getMailboxFlags($tmp_trash_folder);
+   $tmpflags = getMailboxFlags($imapConnection, $tmp_trash_folder);
    $can_move_to_trash = true;
    for ($i = 0; $i < count($tmpflags); $i++) {
       if (strtolower($tmpflags[$i]) == "noinferiors")
    $can_move_to_trash = true;
    for ($i = 0; $i < count($tmpflags); $i++) {
       if (strtolower($tmpflags[$i]) == "noinferiors")
@@ -33,7 +35,7 @@
          if (($boxes[$i]["UNFORMATTED"] == $mailbox) ||
              (substr($boxes[$i]["UNFORMATTED"], 0, strlen($mailbox . $dm)) == $mailbox . $dm)) {
             $folderWithoutINBOX = getFolderNameMinusINBOX($boxes[$i]["UNFORMATTED"], $dm);
          if (($boxes[$i]["UNFORMATTED"] == $mailbox) ||
              (substr($boxes[$i]["UNFORMATTED"], 0, strlen($mailbox . $dm)) == $mailbox . $dm)) {
             $folderWithoutINBOX = getFolderNameMinusINBOX($boxes[$i]["UNFORMATTED"], $dm);
-            $flags = getMailboxFlags($boxes[$i]["RAW"]);
+            $flags = getMailboxFlags($imapConnection, $boxes[$i]["RAW"]);
             for ($b = 0; $b < count($flags); $b++) {
                $type = $flags[$b];
             }
             for ($b = 0; $b < count($flags); $b++) {
                $type = $flags[$b];
             }
    /** Log out this session **/
    fputs($imapConnection, "1 logout");
 
    /** Log out this session **/
    fputs($imapConnection, "1 logout");
 
-   echo "<BR><BR><A HREF=\"webmail.php?right_frame=folders.php\" TARGET=_top>";
-   echo _("Return");
-   echo "</A>";
+   echo "<FONT FACE=\"Arial,Helvetica\">";
+   echo "<BR><BR><CENTER><B>" . _("Folder Deleted!") . "</B><BR><BR>";
+   echo _("You will be automatically forwarded.") . "<BR>" . _("If not,") . " <A HREF=\"webmail.php?right_frame=folders.php\" TARGET=_top>" . _("click here") . "</A>";
+   echo "</CENTER></FONT>"; 
+   
    echo "</BODY></HTML>";
 ?>
 
    echo "</BODY></HTML>";
 ?>
 
index dfbbb7fc0f01cbdaf7b47786881a508e5ec8bd0c..c9ba3d6a74ae9e486d5bb58c0204d31c3bab1b8e 100644 (file)
    include("../functions/imap.php");
    include("../functions/mailbox.php");
 
    include("../functions/imap.php");
    include("../functions/mailbox.php");
 
-   function formatMailboxName($imapConnection, $mailbox, $delimeter, $color, $move_to_trash) {
+   function formatMailboxName($imapConnection, $mailbox, $real_box, $delimeter, $color, $move_to_trash) {
       require ("../config/config.php");
 
       $mailboxURL = urlencode($mailbox);
       require ("../config/config.php");
 
       $mailboxURL = urlencode($mailbox);
-      selectMailbox($imapConnection, $mailbox, $numNessages);
+      selectMailbox($imapConnection, $real_box, $numNessages);
       $unseen = unseenMessages($imapConnection, $numUnseen);
 
       echo "<NOBR>";
       $unseen = unseenMessages($imapConnection, $numUnseen);
 
       echo "<NOBR>";
    echo "<FONT FACE=\"Arial,Helvetica\">\n";
    $delimeter = findMailboxDelimeter($imapConnection);
    for ($i = 0;$i < count($boxes); $i++) {
    echo "<FONT FACE=\"Arial,Helvetica\">\n";
    $delimeter = findMailboxDelimeter($imapConnection);
    for ($i = 0;$i < count($boxes); $i++) {
-      $mailbox = $boxes[$i]["UNFORMATTED"];
-      $boxFlags = getMailboxFlags($boxes[$i]["RAW"]);
-
-      $boxCount = countCharInString($mailbox, $delimeter);
-
       $line = "";
       $line = "";
-      // indent the correct number of spaces.
-      for ($j = 0;$j < $boxCount;$j++)
-         $line .= "&nbsp;&nbsp;";
+      $mailbox = $boxes[$i]["FORMATTED"];
+      $boxFlags = getMailboxFlags($imapConnection, $boxes[$i]["RAW"]);
 
       if (trim($boxFlags[0]) != "") {
          $noselect = false;
 
       if (trim($boxFlags[0]) != "") {
          $noselect = false;
             if (strtolower($boxFlags[$h]) == "noselect")
                $noselect = true;
          }
             if (strtolower($boxFlags[$h]) == "noselect")
                $noselect = true;
          }
-
          if ($noselect == true) {
             $line .= "<FONT COLOR=\"$color[10]\" FACE=\"Arial,Helvetica\">";
             $line .= readShortMailboxName($mailbox, $delimeter);
             $line .= "</FONT><FONT FACE=\"Arial,Helvetica\">";
          } else {
          if ($noselect == true) {
             $line .= "<FONT COLOR=\"$color[10]\" FACE=\"Arial,Helvetica\">";
             $line .= readShortMailboxName($mailbox, $delimeter);
             $line .= "</FONT><FONT FACE=\"Arial,Helvetica\">";
          } else {
-            $line .= formatMailboxName($imapConnection, $mailbox, $delimeter, $color, $move_to_trash);
+            $line .= formatMailboxName($imapConnection, $mailbox, $boxes[$i]["UNFORMATTED"], $delimeter, $color, $move_to_trash);
          }
       } else {
          }
       } else {
-         $line .= formatMailboxName($imapConnection, $mailbox, $delimeter, $color, $move_to_trash);
+         $line .= formatMailboxName($imapConnection, $mailbox, $boxes[$i]["UNFORMATTED"], $delimeter, $color, $move_to_trash);
       }
       echo "$line<BR>";
    }
       }
       echo "$line<BR>";
    }