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
$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;
+ }
+
/******************************************************************************
$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);
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) {
} 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))