From: fidian Date: Fri, 27 Jul 2001 23:09:53 +0000 (+0000) Subject: Warnings were removed X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=commitdiff_plain;h=8d6369676a333a6a65a174bfb3b9ec9ea5eb8308 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. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1461 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/functions/imap_mailbox.php b/functions/imap_mailbox.php index 1bb52b8a..ebad86d2 100755 --- a/functions/imap_mailbox.php +++ b/functions/imap_mailbox.php @@ -103,6 +103,19 @@ $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; + } + /****************************************************************************** diff --git a/src/folders_rename_do.php b/src/folders_rename_do.php index da76944a..37fbf311 100644 --- a/src/folders_rename_do.php +++ b/src/folders_rename_do.php @@ -36,7 +36,6 @@ $cmd = "a024 RENAME \"" . quoteIMAP($orig) . "\" \"" . quoteIMAP($newone) . "\"\r\n"; - echo htmlspecialchars($cmd) . "
\n"; fputs ($imapConnection, $cmd); $data = sqimap_read_data($imapConnection, "a024", true, $a, $b); diff --git a/src/left_main.php b/src/left_main.php index 729460eb..ab918351 100644 --- a/src/left_main.php +++ b/src/left_main.php @@ -20,25 +20,23 @@ 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) { diff --git a/src/options.php b/src/options.php index 90525217..3e7ddd05 100644 --- a/src/options.php +++ b/src/options.php @@ -111,8 +111,12 @@ } 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))