浏览代码

You cannot delete special folders or their subfolders now

Luke Ehresman 25 年之前
父节点
当前提交
78fd512f6d
共有 2 个文件被更改,包括 13 次插入10 次删除
  1. 7 8
      config/config.php
  2. 6 2
      src/folders.php

+ 7 - 8
config/config.php

@@ -34,15 +34,14 @@ $trash_folder = "INBOX.Trash";
 $auto_expunge = true;
 $auto_expunge = true;
 
 
 /* Special Folders are folders that can't be manipulated like normal user created
 /* Special Folders are folders that can't be manipulated like normal user created
-   folders can.  A couple of examples would be "INBOX", "INBOX.Trash".  We have
+   folders can.  A couple of examples would be "INBOX.Trash", "INBOX.Drafts".  We have
    them set to Netscape's default mailboxes, but this obviously can be changed.
    them set to Netscape's default mailboxes, but this obviously can be changed.
    To add one, just add a new number to the array.
    To add one, just add a new number to the array.
-*/
-$special_folders[0] = "INBOX";
-$special_folders[1] = "INBOX.Trash";
-$special_folders[2] = "INBOX.Sent";
-$special_folders[3] = "INBOX.Drafts";
-$special_folders[4] = "INBOX.Templates";
-
 
 
+   NOTE:   INBOX is handled separately.  Do not put it in this list
+*/
+$special_folders[0] = $trash_folder;
+$special_folders[1] = "INBOX.Sent";
+$special_folders[2] = "INBOX.Drafts";
+$special_folders[3] = "INBOX.Templates";
 ?>
 ?>

+ 6 - 2
src/folders.php

@@ -23,11 +23,15 @@
    for ($i = 0; $i < count($boxesUnformatted); $i++) {
    for ($i = 0; $i < count($boxesUnformatted); $i++) {
       $use_folder = true;
       $use_folder = true;
       for ($p = 0; $p < count($special_folders); $p++) {
       for ($p = 0; $p < count($special_folders); $p++) {
-         if ($special_folders[$p] == $boxesUnformatted[$i])
+         if (substr($boxesUnformatted[$i], 0, strlen($special_folders[$p])) == $special_folders[$p]) {
             $use_folder = false;
             $use_folder = false;
+         }
       }
       }
+      if ($boxesUnformatted[$i] == "INBOX")
+         $use_folder = false;
+
       if ($use_folder == true)
       if ($use_folder == true)
-         echo "   <OPTION>$boxesUnformatted[$i]\n";
+         echo "<OPTION>$boxesUnformatted[$i]\n";
    }
    }
    echo "</SELECT>\n";
    echo "</SELECT>\n";
    echo "<INPUT TYPE=SUBMIT VALUE=Delete>\n";
    echo "<INPUT TYPE=SUBMIT VALUE=Delete>\n";