From 5479d7092f359d69ca0186daf8cf399ef4d12922 Mon Sep 17 00:00:00 2001 From: lkehresman Date: Tue, 4 Apr 2000 00:59:25 +0000 Subject: [PATCH] made it possible to have a base imap directory for folders git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@384 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- AUTHORS | 8 ++++---- UPDATES | 2 -- config/config_default.php | 14 ++++++++++++++ functions/imap_mailbox.php | 7 +++++-- functions/page_header.php | 2 +- src/folders_create.php | 12 ++++++++++-- src/move_messages.php | 27 ++++++++++++++++++++++----- 7 files changed, 56 insertions(+), 16 deletions(-) delete mode 100644 UPDATES diff --git a/AUTHORS b/AUTHORS index 338d21e8..02e4e3f9 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,10 +1,10 @@ -Luke Ehresman -Nathan Ehresman +Luke Ehresman (lehresma@css.tayloru.edu) +Nathan Ehresman (nathan@usa.om.org) Gustav Foseid -Sergiusz Pawlowicz +Pål Løberg Shane Wilson +Sergiusz Pawlowicz Steve Gare -Pål Løberg Translations: diff --git a/UPDATES b/UPDATES deleted file mode 100644 index 24c80ada..00000000 --- a/UPDATES +++ /dev/null @@ -1,2 +0,0 @@ -Add your name, and the update in this file. -------------------------------------------- diff --git a/config/config_default.php b/config/config_default.php index 60361698..1cfe25d0 100644 --- a/config/config_default.php +++ b/config/config_default.php @@ -35,6 +35,20 @@ // folders will be the same color as the other folders $use_special_folder_color = true; +// Many servers store mail in your home directory. With this, they +// store them in a subdirectory: ~/mail or ~/Mail, etc. If your +// server does this, please set this to what the default mail folder +// should be. This is still a user preference, so they can change +// it if it is different for each user. +// +// Example: +// $folder_prefix = "mail/"; +// -- or -- +// $folder_prefix = "Mail/folders/"; +// +// If you do not use this, please set it to "". + $folder_prefix = ""; + // The following are related to deleting messages. // $move_to_trash // - if this is set to "true", when "delete" is pressed, it diff --git a/functions/imap_mailbox.php b/functions/imap_mailbox.php index 997d6572..18201584 100755 --- a/functions/imap_mailbox.php +++ b/functions/imap_mailbox.php @@ -94,7 +94,7 @@ ** The array returned looks like this: ******************************************************************************/ function sqimap_mailbox_list ($imap_stream) { - global $special_folders, $list_special_folders_first; + global $special_folders, $list_special_folders_first, $folder_prefix; if (!function_exists ("ary_sort")) include ("../functions/array.php"); @@ -140,7 +140,10 @@ if (!$read_ary[$i+1]) { if ($phase == "inbox") { - fputs ($imap_stream, "a001 LSUB \"\" *\r\n"); + if ($folder_prefix && (substr($folder_prefix, -1) != $dm)) + $folder_prefix = $folder_prefix . $dm; + + fputs ($imap_stream, "a001 LSUB \"$folder_prefix\" *\r\n"); $read_ary = sqimap_read_data ($imap_stream, "a001", true, $response, $message); $phase = "lsub"; $i--; diff --git a/functions/page_header.php b/functions/page_header.php index 48509bf1..cc347f2a 100644 --- a/functions/page_header.php +++ b/functions/page_header.php @@ -58,7 +58,7 @@ echo " " . _("Folders") . "  "; echo " " . _("Options") . "  "; echo " "; - echo " SquirrelMail"; + echo " SquirrelMail"; echo " "; echo ""; } diff --git a/src/folders_create.php b/src/folders_create.php index 321d16e7..9cddfc87 100644 --- a/src/folders_create.php +++ b/src/folders_create.php @@ -25,8 +25,16 @@ if ($contain_subs == true) $folder_name = "$folder_name$dm"; - if (trim($subfolder) == "[ None ]") { - sqimap_mailbox_create ($imapConnection, $folder_name, ""); + if ($folder_prefix && (substr($folder_prefix, -1) != $dm)) { + $folder_prefix = $folder_prefix . $dm; + } + if ($folder_prefix && (substr($subfolder, 0, strlen($folder_prefix)) != $folder_prefix)){ + $subfolder_orig = $subfolder; + $subfolder = $folder_prefix . $subfolder; + } + + if (trim($subfolder_orig) == "[ None ]") { + sqimap_mailbox_create ($imapConnection, $folder_prefix.$folder_name, ""); } else { sqimap_mailbox_create ($imapConnection, $subfolder.$dm.$folder_name, ""); } diff --git a/src/move_messages.php b/src/move_messages.php index 56e96e74..e2361745 100644 --- a/src/move_messages.php +++ b/src/move_messages.php @@ -12,7 +12,7 @@ include("../src/load_prefs.php"); - echo "\n"; +// echo "\n"; function putSelectedMessagesIntoString($msg) { $j = 0; @@ -42,7 +42,7 @@ // If the delete button was pressed, the moveButton variable will not be set. if (!$moveButton) { - displayPageHeader($color, $mailbox); + // displayPageHeader($color, $mailbox); if (is_array($msg) == 1) { // Marks the selected messages ad 'Deleted' $j = 0; @@ -59,12 +59,21 @@ } if ($auto_expunge) sqimap_mailbox_expunge($imapConnection, $mailbox); - messages_deleted_message($mailbox, $sort, $startMessage, $color); + + if ($auto_forward) { + header ("Location: right_main.php"); + } else { + echo "\n"; + displayPageHeader($color, $mailbox); + messages_deleted_message($mailbox, $sort, $startMessage, $color); + } } else { + echo "\n"; + displayPageHeader($color, $mailbox); error_message(_("No messages were selected."), $mailbox, $sort, $startMessage, $color); } } else { // Move messages - displayPageHeader($color, $mailbox); +// displayPageHeader($color, $mailbox); // lets check to see if they selected any messages if (is_array($msg) == 1) { $j = 0; @@ -84,8 +93,16 @@ if ($auto_expunge == true) sqimap_mailbox_expunge($imapConnection, $mailbox); - messages_moved_message($mailbox, $sort, $startMessage, $color); + if ($auto_forward) { + header ("Location: right_main.php"); + } else { + echo "\n"; + displayPageHeader($color, $mailbox); + messages_moved_message($mailbox, $sort, $startMessage, $color); + } } else { + echo "\n"; + displayPageHeader($color, $mailbox); error_message(_("No messages were selected."), $mailbox, $sort, $startMessage, $color); } } -- 2.25.1