From 4e85a37fc4a968e1fd255219069e85df7d08e558 Mon Sep 17 00:00:00 2001 From: simond Date: Mon, 4 Feb 2002 15:09:59 +0000 Subject: [PATCH] Make moving folders into Trash optional git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@2358 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- config/conf.pl | 58 ++++++++++++++++++++++--------- config/config_default.php | 5 +++ plugins/administrator/defines.php | 2 ++ src/folders_delete.php | 7 +++- 4 files changed, 55 insertions(+), 17 deletions(-) diff --git a/config/conf.pl b/config/conf.pl index 86d8662d..c1400b4c 100755 --- a/config/conf.pl +++ b/config/conf.pl @@ -357,22 +357,23 @@ while (($command ne "q") && ($command ne "Q")) { print "R Return to Main Menu\n"; } elsif ($menu == 3) { print $WHT."Folder Defaults\n".$NRM; - print "1. Default Folder Prefix : $WHT$default_folder_prefix$NRM\n"; - print "2. Show Folder Prefix Option : $WHT$show_prefix_option$NRM\n"; - print "3. Trash Folder : $WHT$trash_folder$NRM\n"; - print "4. Sent Folder : $WHT$sent_folder$NRM\n"; - print "5. Drafts Folder : $WHT$draft_folder$NRM\n"; - print "6. By default, move to trash : $WHT$default_move_to_trash$NRM\n"; - print "7. By default, move to sent : $WHT$default_move_to_sent$NRM\n"; - print "8. By default, save as draft : $WHT$default_save_as_draft$NRM\n"; - print "9. List Special Folders First : $WHT$list_special_folders_first$NRM\n"; - print "10. Show Special Folders Color : $WHT$use_special_folder_color$NRM\n"; - print "11. Auto Expunge : $WHT$auto_expunge$NRM\n"; - print "12. Default Sub. of INBOX : $WHT$default_sub_of_inbox$NRM\n"; - print "13. Show 'Contain Sub.' Option : $WHT$show_contain_subfolders_option$NRM\n"; - print "14. Default Unseen Notify : $WHT$default_unseen_notify$NRM\n"; - print "15. Default Unseen Type : $WHT$default_unseen_type$NRM\n"; - print "16. Auto Create Special Folders : $WHT$auto_create_special$NRM\n"; + print "1. Default Folder Prefix : $WHT$default_folder_prefix$NRM\n"; + print "2. Show Folder Prefix Option : $WHT$show_prefix_option$NRM\n"; + print "3. Trash Folder : $WHT$trash_folder$NRM\n"; + print "4. Sent Folder : $WHT$sent_folder$NRM\n"; + print "5. Drafts Folder : $WHT$draft_folder$NRM\n"; + print "6. By default, move to trash : $WHT$default_move_to_trash$NRM\n"; + print "7. By default, move to sent : $WHT$default_move_to_sent$NRM\n"; + print "8. By default, save as draft : $WHT$default_save_as_draft$NRM\n"; + print "9. List Special Folders First : $WHT$list_special_folders_first$NRM\n"; + print "10. Show Special Folders Color : $WHT$use_special_folder_color$NRM\n"; + print "11. Auto Expunge : $WHT$auto_expunge$NRM\n"; + print "12. Default Sub. of INBOX : $WHT$default_sub_of_inbox$NRM\n"; + print "13. Show 'Contain Sub.' Option : $WHT$show_contain_subfolders_option$NRM\n"; + print "14. Default Unseen Notify : $WHT$default_unseen_notify$NRM\n"; + print "15. Default Unseen Type : $WHT$default_unseen_type$NRM\n"; + print "16. Auto Create Special Folders : $WHT$auto_create_special$NRM\n"; + print "17. Don't move folders into Trash : $WHT$delete_folder$NRM\n"; print "\n"; print "R Return to Main Menu\n"; } elsif ($menu == 4) { @@ -545,6 +546,7 @@ while (($command ne "q") && ($command ne "Q")) { elsif ($command == 14) { $default_unseen_notify = command212(); } elsif ($command == 15) { $default_unseen_type = command213(); } elsif ($command == 16) { $auto_create_special = command214(); } + elsif ($command == 17) { $delete_folder = command215(); } } elsif ($menu == 4) { if ($command == 1) { $default_charset = command31 (); } elsif ($command == 2) { $data_dir = command33a (); } @@ -1316,6 +1318,28 @@ sub command214 { return $auto_create_special; } +# Auto create special folders +sub command215 { + print "Would you like to automatically completely delete any deleted\n"; + print "folders? If not then they will be moved to the Trash folder\n"; + print "and can be deleted from there\n"; + print "\n"; + + if ($delete_folder eq "true") { + $default_value = "y"; + } else { + $default_value = "n"; + } + print "Auto delete folders? (y/n) [$WHT$default_value$NRM]: $WHT"; + $new_delete = ; + if (($new_delete =~ /^y\n/i) || (($new_delete =~ /^\n/) && ($default_value eq "y"))) { + $delete_folder = "true"; + } else { + $delete_folder = "false"; + } + return $delete_folder; +} + ############# GENERAL OPTIONS ##################### @@ -1976,6 +2000,7 @@ sub save_data { print CF "global \$show_contain_subfolders_option;\n"; print CF "global \$default_unseen_notify;\n"; print CF "global \$default_unseen_type, \$auto_create_special;\n"; + print CF "global \$delete_folder;\n"; print CF "\$default_folder_prefix = '$default_folder_prefix';\n"; print CF "\$trash_folder = '$trash_folder';\n"; print CF "\$sent_folder = '$sent_folder';\n"; @@ -1992,6 +2017,7 @@ sub save_data { print CF "\$default_unseen_notify = $default_unseen_notify;\n"; print CF "\$default_unseen_type = $default_unseen_type;\n"; print CF "\$auto_create_special = $auto_create_special;\n"; + print CF "\$delete_folder = $delete_folder;\n"; print CF "\n"; print CF "global \$default_charset;\n"; diff --git a/config/config_default.php b/config/config_default.php index e4c761cb..61316827 100644 --- a/config/config_default.php +++ b/config/config_default.php @@ -139,9 +139,13 @@ $show_prefix_option = false; * marked 'Deleted'. * $sent_folder * This is the path to where Sent messages will be stored. + * $delete_folder + * If this is true, when a folder is deleted then it will + * not get moved into the Trash folder. */ global $default_move_to_trash, $default_move_to_sent, $default_save_as_draft; global $trash_folder, $sent_folder, $draft_folder, $auto_expunge; +global $delete_folder; $default_move_to_trash = true; $default_move_to_sent = true; $default_save_as_draft = true; @@ -149,6 +153,7 @@ $trash_folder = 'INBOX.Trash'; $sent_folder = 'INBOX.Sent'; $draft_folder = 'INBOX.Drafts'; $auto_expunge = true; +$delete_folder = false; /** * Should I create the Sent and Trash folders automatically for diff --git a/plugins/administrator/defines.php b/plugins/administrator/defines.php index 241b6de7..e25a0f17 100644 --- a/plugins/administrator/defines.php +++ b/plugins/administrator/defines.php @@ -160,6 +160,8 @@ $defcfg = array( '$config_version' => array( 'name' => _("Config File Version"), 'type' => SMOPT_TYPE_BOOLEAN ), '$default_use_javascript_addr_book' => array( 'name' => _("Default Javascript Adrressbook"), 'type' => SMOPT_TYPE_BOOLEAN ), + '$delete_folder' => array( 'name' => _("Auto delete folders"), + 'type' => SMOPT_TYPE_BOOLEAN ), /* --------------------------------------------------------*/ 'Group4' => array( 'name' => _("General Options"), 'type' => SMOPT_TYPE_TITLE ), diff --git a/src/folders_delete.php b/src/folders_delete.php index 4ae96f80..40c2ca2f 100644 --- a/src/folders_delete.php +++ b/src/folders_delete.php @@ -25,7 +25,7 @@ require_once('../functions/tree.php'); $imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); $boxes = sqimap_mailbox_list ($imap_stream); -global $delimiter; +global $delimiter, $delete_folder; if (substr($mailbox, -1) == $delimiter) $mailbox_no_dm = substr($mailbox, 0, strlen($mailbox) - 1); @@ -40,6 +40,11 @@ if (strtolower($imap_server_type) == "courier") { $can_move_to_trash = false; } +// If global options say we can't move it into Trash +else if(isset($delete_folder) && $delete_folder == true) { + $can_move_to_trash = false; +} + // If it's already a subfolder of trash, we'll have to delete it else if(eregi("^".$trash_folder.".+", $mailbox)) { -- 2.25.1