Warnings were removed
authorfidian <fidian@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 27 Jul 2001 23:09:53 +0000 (23:09 +0000)
committerfidian <fidian@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 27 Jul 2001 23:09:53 +0000 (23:09 +0000)
Removed 'echo' line in folders_rename_do that was causing problems
Removed Ray's preference code from left_main.php (he said he would do it,
but he never did follow through)
Now checks to see if the folder is subscribed before actually subscribing
the folder (the proper fix to the problem Ray tried to fix)

Found a bug -- I can't unsubscribe from a folder.

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1461 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/imap_mailbox.php
src/folders_rename_do.php
src/left_main.php
src/options.php

index 1bb52b8a7ecb931f1e57270291c8e9510e512166..ebad86d21b431bf19af25397d3433630b90f0ee8 100755 (executable)
       $read_ary = sqimap_read_data($imap_stream, "a001", true, $response, $message);
       sqimap_unsubscribe ($imap_stream, $mailbox);
    }
+   
+   /***********************************************************************
+    ** Determines if the user is subscribed to the folder or not
+    **********************************************************************/
+   function sqimap_mailbox_is_subscribed($imap_stream, $folder) {
+       $boxes = sqimap_mailbox_list ($imap_stream);
+       foreach ($boxes as $ref) {
+          if ($ref['unformatted'] == $folder)
+            return true;
+       }
+       return false;
+   }
+      
 
 
    /******************************************************************************
index da76944a50bc8551e0af976208f2afcb028c6d7a..37fbf311bcdebba1127a1c4197174ec62b3fd48b 100644 (file)
@@ -36,7 +36,6 @@
 
    $cmd = "a024 RENAME \"" . quoteIMAP($orig) . "\" \"" .
       quoteIMAP($newone) . "\"\r\n";
-   echo htmlspecialchars($cmd) . "<br>\n";
    fputs ($imapConnection, $cmd);
    $data = sqimap_read_data($imapConnection, "a024", true, $a, $b);
 
index 729460ebde622357beadab1b9cadeb8421d272f4..ab91835170de773fdea044961d1ea269f074f529 100644 (file)
    
    displayHtmlHeader();
 
-   $auto_create_done = getPref($data_dir, $username, 'auto_create_done');
    if ($auto_create_special && ! isset($auto_create_done)) {
          if (isset ($sent_folder) && $sent_folder != "none") {
                 if (!sqimap_mailbox_exists ($imapConnection, $sent_folder)) {
                        sqimap_mailbox_create ($imapConnection, $sent_folder, "");
-                } else {
+                } else if (! sqimap_mailbox_is_subscribed($imapConnection, $sent_folder)) {
                    sqimap_subscribe($imapConnection, $sent_folder);
                 }
          }
          if (isset ($trash_folder) && $trash_folder != "none") {
                 if (!sqimap_mailbox_exists ($imapConnection, $trash_folder)) {
                        sqimap_mailbox_create ($imapConnection, $trash_folder, "");
-                } else {
+                } else if (! sqimap_mailbox_is_subscribed($imapConnection, $trash_folder)) {
                    sqimap_subscribe($imapConnection, $trash_folder);
                 }
          }
          $auto_create_done = true;
          session_register('auto_create_done');
-          setPref($data_dir, $username, 'auto_create_done', TRUE);
    }
 
    function formatMailboxName($imapConnection, $box_array, $delimeter) {
index 905252176209b3c4e3b8eddb4891d2fdff259bdf..3e7ddd05b2a5f8a24a225ee07376828e7e9e378d 100644 (file)
       } else {
          setPref($data_dir, $username, 'move_to_sent', '0');
          setPref($data_dir, $username, 'sent_folder', 'none');
-      } 
-      setPref($data_dir, $username, 'folder_prefix', $folderprefix);
+      }
+      if (isset($folder_prefix)) {
+         setPref($data_dir, $username, 'folder_prefix', $folderprefix);
+      } else {
+         setPref($data_dir, $username, 'folder_prefix', '');
+      }
       setPref($data_dir, $username, 'unseen_notify', $unseennotify);
       setPref($data_dir, $username, 'unseen_type', $unseentype);
       if (isset($collapsefolders))