Forráskód Böngészése

Warnings were removed
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.

Tyler Akins 24 éve
szülő
commit
0b1c62e466
4 módosított fájl, 21 hozzáadás és 7 törlés
  1. 13 0
      functions/imap_mailbox.php
  2. 0 1
      src/folders_rename_do.php
  3. 2 4
      src/left_main.php
  4. 6 2
      src/options.php

+ 13 - 0
functions/imap_mailbox.php

@@ -103,6 +103,19 @@
       $read_ary = sqimap_read_data($imap_stream, "a001", true, $response, $message);
       $read_ary = sqimap_read_data($imap_stream, "a001", true, $response, $message);
       sqimap_unsubscribe ($imap_stream, $mailbox);
       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;
+   }
+      
 
 
 
 
    /******************************************************************************
    /******************************************************************************

+ 0 - 1
src/folders_rename_do.php

@@ -36,7 +36,6 @@
 
 
    $cmd = "a024 RENAME \"" . quoteIMAP($orig) . "\" \"" .
    $cmd = "a024 RENAME \"" . quoteIMAP($orig) . "\" \"" .
       quoteIMAP($newone) . "\"\r\n";
       quoteIMAP($newone) . "\"\r\n";
-   echo htmlspecialchars($cmd) . "<br>\n";
    fputs ($imapConnection, $cmd);
    fputs ($imapConnection, $cmd);
    $data = sqimap_read_data($imapConnection, "a024", true, $a, $b);
    $data = sqimap_read_data($imapConnection, "a024", true, $a, $b);
 
 

+ 2 - 4
src/left_main.php

@@ -20,25 +20,23 @@
    
    
    displayHtmlHeader();
    displayHtmlHeader();
 
 
-   $auto_create_done = getPref($data_dir, $username, 'auto_create_done');
    if ($auto_create_special && ! isset($auto_create_done)) {
    if ($auto_create_special && ! isset($auto_create_done)) {
    	  if (isset ($sent_folder) && $sent_folder != "none") {
    	  if (isset ($sent_folder) && $sent_folder != "none") {
 	  	 if (!sqimap_mailbox_exists ($imapConnection, $sent_folder)) {
 	  	 if (!sqimap_mailbox_exists ($imapConnection, $sent_folder)) {
 		 	sqimap_mailbox_create ($imapConnection, $sent_folder, "");
 		 	sqimap_mailbox_create ($imapConnection, $sent_folder, "");
-		 } else {
+		 } else if (! sqimap_mailbox_is_subscribed($imapConnection, $sent_folder)) {
 		    sqimap_subscribe($imapConnection, $sent_folder);
 		    sqimap_subscribe($imapConnection, $sent_folder);
 		 }
 		 }
 	  }
 	  }
    	  if (isset ($trash_folder) && $trash_folder != "none") {
    	  if (isset ($trash_folder) && $trash_folder != "none") {
 	  	 if (!sqimap_mailbox_exists ($imapConnection, $trash_folder)) {
 	  	 if (!sqimap_mailbox_exists ($imapConnection, $trash_folder)) {
 		 	sqimap_mailbox_create ($imapConnection, $trash_folder, "");
 		 	sqimap_mailbox_create ($imapConnection, $trash_folder, "");
-		 } else {
+		 } else if (! sqimap_mailbox_is_subscribed($imapConnection, $trash_folder)) {
 		    sqimap_subscribe($imapConnection, $trash_folder);
 		    sqimap_subscribe($imapConnection, $trash_folder);
 		 }
 		 }
 	  }
 	  }
 	  $auto_create_done = true;
 	  $auto_create_done = true;
 	  session_register('auto_create_done');
 	  session_register('auto_create_done');
-          setPref($data_dir, $username, 'auto_create_done', TRUE);
    }
    }
 
 
    function formatMailboxName($imapConnection, $box_array, $delimeter) {
    function formatMailboxName($imapConnection, $box_array, $delimeter) {

+ 6 - 2
src/options.php

@@ -111,8 +111,12 @@
       } else {
       } else {
          setPref($data_dir, $username, 'move_to_sent', '0');
          setPref($data_dir, $username, 'move_to_sent', '0');
          setPref($data_dir, $username, 'sent_folder', 'none');
          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_notify', $unseennotify);
       setPref($data_dir, $username, 'unseen_type', $unseentype);
       setPref($data_dir, $username, 'unseen_type', $unseentype);
       if (isset($collapsefolders))
       if (isset($collapsefolders))