sure the code only sets those variables that are needed in compose and
are not already set. Thanks James Bercegay from GulfTech for pointing
this out.
+ - Subfolders of system folders are not tagged as special in folder
+ management page in order to allow rename and delete operations with
+ subfolders (#1460011).
+ - Trash subfolders are allowed in courier. INBOX.Trash is not treated
+ as special on Courier, unless some SquirrelMail configuration options
+ mark this folder as special (#1354393). Configtest utility should
+ display warning, if Courier IMAP XMAGICTRASH extension is detected.
Version 1.5.1 (branched on 2006-02-12)
--------------------------------------
/** lets see if we CAN move folders to the trash.. otherwise,
** just delete them **/
-
- /* Courier IMAP doesn't like subfolders of Trash
- * If global options say we can't move it into Trash
- * If it's already a subfolder of trash, we'll have to delete it */
- if (strtolower($imap_server_type) == 'courier' ||
- (isset($delete_folder) && $delete_folder) ||
- eregi('^'.$trash_folder.'.+', $folder_name) )
- {
+ if ($delete_folder || eregi('^'.$trash_folder.'.+', $folder_name) ) {
$can_move_to_trash = FALSE;
- }
+ } else {
/* Otherwise, check if trash folder exits and support sub-folders */
- else {
foreach($boxes as $box) {
if ($box['unformatted'] == $trash_folder) {
$can_move_to_trash = !in_array('noinferiors', $box['flags']);
* Since 1.2.5 function includes special_mailbox hook.<br>
* Since 1.4.3 hook supports more than one plugin.
* @param string $box mailbox name
+ * @param boolean $include_subs (since 1.5.2) if true, subfolders of system
+ * folders are special. if false, subfolders are not special mailboxes
+ * unless they are tagged as special in 'special_mailbox' hook.
* @return boolean
* @since 1.2.3
*/
-function isSpecialMailbox( $box ) {
+function isSpecialMailbox($box,$include_subs=true) {
$ret = ( (strtolower($box) == 'inbox') ||
- isTrashMailbox($box) || isSentMailbox($box) || isDraftMailbox($box) );
+ isTrashMailbox($box,$include_subs) ||
+ isSentMailbox($box,$include_subs) ||
+ isDraftMailbox($box,$include_subs) );
if ( !$ret ) {
$ret = boolean_hook_function('special_mailbox',$box,1);
/**
* Detects if mailbox is a Trash folder or subfolder of Trash
* @param string $box mailbox name
+ * @param boolean $include_subs (since 1.5.2) if true, subfolders of system
+ * folders are special. if false, subfolders are not special mailboxes.
* @return bool whether this is a Trash folder
* @since 1.4.0
*/
-function isTrashMailbox ($box) {
+function isTrashMailbox ($box,$include_subs=true) {
global $trash_folder, $move_to_trash;
return $move_to_trash && $trash_folder &&
- ( $box == $trash_folder || isBoxBelow($box, $trash_folder) );
+ ( $box == $trash_folder ||
+ ($include_subs && isBoxBelow($box, $trash_folder)) );
}
/**
* Detects if mailbox is a Sent folder or subfolder of Sent
* @param string $box mailbox name
+ * @param boolean $include_subs (since 1.5.2) if true, subfolders of system
+ * folders are special. if false, subfolders are not special mailboxes.
* @return bool whether this is a Sent folder
* @since 1.4.0
*/
-function isSentMailbox($box) {
+function isSentMailbox($box,$include_subs=true) {
global $sent_folder, $move_to_sent;
return $move_to_sent && $sent_folder &&
- ( $box == $sent_folder || isBoxBelow($box, $sent_folder) );
+ ( $box == $sent_folder ||
+ ($include_subs && isBoxBelow($box, $sent_folder)) );
}
/**
* Detects if mailbox is a Drafts folder or subfolder of Drafts
* @param string $box mailbox name
+ * @param boolean $include_subs (since 1.5.2) if true, subfolders of system
+ * folders are special. if false, subfolders are not special mailboxes.
* @return bool whether this is a Draft folder
* @since 1.4.0
*/
-function isDraftMailbox($box) {
+function isDraftMailbox($box,$include_subs=true) {
global $draft_folder, $save_as_draft;
return $save_as_draft &&
- ( $box == $draft_folder || isBoxBelow($box, $draft_folder) );
+ ( $box == $draft_folder ||
+ ($include_subs && isBoxBelow($box, $draft_folder)) );
}
/**
'in the SquirrelMail configuration.', FALSE);
}
+if (stristr($capline, 'XMAGICTRASH') !== false) {
+ $magic_trash = 'It looks like IMAP_MOVE_EXPUNGE_TO_TRASH option is turned on '
+ .'in your Courier IMAP configuration. Courier does not provide tools that '
+ .'allow to detect folder used for Trash or commands are not documented. '
+ .'SquirrelMail can\'t detect special trash folder. SquirrelMail manages '
+ .'all message deletion or move operations internally and '
+ .'IMAP_MOVE_EXPUNGE_TO_TRASH option can cause errors in message and '
+ .'folder management operations. Please turn off IMAP_MOVE_EXPUNGE_TO_TRASH '
+ .'option in Courier imapd configuration.';
+ do_err($magic_trash,false);
+}
+
/** OK, close connection */
fputs($stream, "A004 LOGOUT\r\n");
fclose($stream);
// Special handling for courier
if ( $server_type == 'courier' ) {
- /**
- * If we use courier, we should hide system trash folder
- * FIXME: (tokul) Who says that courier does not allow storing folders in
- * INBOX.Trash or inbox.trash? Can't reproduce it 3.0.8. This entry is
- * useless, because in_array() check is case sensitive and INBOX is in
- * upper case.
- */
- array_push($skip_folders, 'inbox.trash');
-
if ( $default_folder_prefix == 'INBOX.' ) {
// We don't need INBOX, since it is top folder
array_push($skip_folders, 'INBOX');
/** count special folders **/
foreach ($boxes as $index => $aBoxData) {
- if (isSpecialMailbox($aBoxData['unformatted']) &&
+ if (isSpecialMailbox($aBoxData['unformatted'],false) &&
! in_array($aBoxData['unformatted'],$skip_folders)) {
$skip_folders[] = $aBoxData['unformatted'];
}