From c36ed9cfc1635cd9a8f80d9cdf8200628777903f Mon Sep 17 00:00:00 2001 From: lkehresman Date: Fri, 7 Jul 2000 08:02:04 +0000 Subject: [PATCH] - added a view header option - folders.php - fixed bug when listing sent/trash folders - fixed some bugs in message highlighting - reorganized the options page, fixed a bunch of bugs in it as well - changed background color of header in read_body.php git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@601 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/imap_messages.php | 18 +- functions/mailbox_display.php | 2 +- functions/mime.php | 2 +- src/folders.php | 6 +- src/load_prefs.php | 4 +- src/options.php | 521 ++++-------------- src/options_display.php | 268 +++++++++ src/options_folder.php | 120 ++++ ...sg_highlight.php => options_highlight.php} | 58 +- src/options_personal.php | 84 +++ src/options_submit.php | 78 --- src/read_body.php | 60 +- src/webmail.php | 3 + 13 files changed, 682 insertions(+), 542 deletions(-) create mode 100644 src/options_display.php create mode 100644 src/options_folder.php rename src/{msg_highlight.php => options_highlight.php} (83%) create mode 100644 src/options_personal.php delete mode 100644 src/options_submit.php diff --git a/functions/imap_messages.php b/functions/imap_messages.php index dda230f5..c82e7a97 100755 --- a/functions/imap_messages.php +++ b/functions/imap_messages.php @@ -56,18 +56,16 @@ $g = 0; for ($i = 0; $i < count($read); $i++) { if (eregi ("^to:", $read[$i])) { - $to = sqimap_find_displayable_name(substr($read[$i], 3)); - } - if (eregi ("^from:", $read[$i])) { - $from = sqimap_find_displayable_name(substr($read[$i], 5)); - } - if (eregi ("^x-priority:", $read[$i])) { + //$to = sqimap_find_displayable_name(substr($read[$i], 3)); + $to = substr($read[$i], 3); + } else if (eregi ("^from:", $read[$i])) { + //$from = sqimap_find_displayable_name(substr($read[$i], 5)); + $from = substr($read[$i], 5); + } else if (eregi ("^x-priority:", $read[$i])) { $priority = trim(substr($read[$i], 11)); - } - if (eregi ("^message-id:", $read[$i])) { + } else if (eregi ("^message-id:", $read[$i])) { $messageid = trim(substr($read[$i], 11)); - } - if (eregi ("^date:", $read[$i])) { + } else if (eregi ("^date:", $read[$i])) { $date = substr($read[$i], 5); } else if (eregi ("^subject:", $read[$i])) { $subject = htmlspecialchars(eregi_replace ("^subject: ", "", $read[$i])); diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php index a6334905..9f82bfec 100644 --- a/functions/mailbox_display.php +++ b/functions/mailbox_display.php @@ -17,7 +17,7 @@ $msg = $msgs[$key]; - $senderName = $msg["FROM"]; + $senderName = sqimap_find_displayable_name($msg["FROM"]); $urlMailbox = urlencode($mailbox); $subject = trim(stripslashes($msg["SUBJECT"])); echo "\n"; diff --git a/functions/mime.php b/functions/mime.php index 7cf724df..4cf74790 100644 --- a/functions/mime.php +++ b/functions/mime.php @@ -440,7 +440,7 @@ $body = translateText($body, $wrap_at, $charset); } - $body .= "
". _("Download this as a file") ."

"; + $body .= "
". _("Download this as a file") ."

"; /** Display the ATTACHMENTS: message if there's more than one part **/ if ($message->entities) { diff --git a/src/folders.php b/src/folders.php index 89a17fa7..ce164ae0 100644 --- a/src/folders.php +++ b/src/folders.php @@ -93,11 +93,11 @@ $num_max++; for ($p = 0; $p < count($boxes) && $count_special_folders < $num_max; $p++) { - if (strtolower($boxes[$i]["unformatted"]) == "inbox") + if (strtolower($boxes[$p]["unformatted"]) == "inbox") $count_special_folders++; - else if ($boxes[$i]["unformatted"] == $trash_folder) + else if ($boxes[$p]["unformatted"] == $trash_folder && $trash_folder) $count_special_folders++; - else if ($boxes[$i]["unformatted"] == $sent_folder) + else if ($boxes[$p]["unformatted"] == $sent_folder && $sent_folder) $count_special_folders++; } diff --git a/src/load_prefs.php b/src/load_prefs.php index b2b2055a..dd84a5ba 100644 --- a/src/load_prefs.php +++ b/src/load_prefs.php @@ -99,8 +99,9 @@ /** Load up the Signature file **/ if ($use_signature == true) { - $signature = getSig($data_dir, $username); + $signature_abs = $signature = getSig($data_dir, $username); } else { + $signature_abs = getSig($data_dir, $username); } /** Load up the Language preference **/ @@ -120,4 +121,5 @@ $message_highlight_list[$i]["value"] = $ary[2]; $message_highlight_list[$i]["match_type"] = $ary[3]; } + ?> diff --git a/src/options.php b/src/options.php index a832181e..bf323166 100644 --- a/src/options.php +++ b/src/options.php @@ -26,420 +26,127 @@ include("../functions/array.php"); if (!isset($i18n_php)) include("../functions/i18n.php"); + if (!isset($auth_php)) + include ("../functions/auth.php"); - include("../src/load_prefs.php"); - - - $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort); - $boxes = sqimap_mailbox_list($imapConnection, $boxes); - fputs($imapConnection, "1 logout\n"); - - displayPageHeader($color, "None"); - - /** load up some of the values from the pref file **/ - $fullname = getPref($data_dir, $username, "full_name"); - $replyto = getPref($data_dir, $username, "reply_to"); - $email_address = getPref($data_dir, $username, "email_address"); - $chosen_language = getPref($data_dir, $username, "language"); - - echo "\n"; - echo " \n"; - echo "
\n"; - echo _("Options"); - echo "
\n"; - - echo "
\n"; - echo "\n"; - // FULL NAME - echo " "; - echo " "; - echo " "; - echo " "; - // FROM-ADDRESS - echo " "; - echo " "; - echo " "; - echo " "; - // REPLY-TO - echo " "; - echo " "; - echo " "; - echo " "; - // DEFAULT FOLDERS - if ($show_prefix_option == true) { - echo " "; - echo " "; - echo " "; - echo " "; + if ($language) { + setcookie("squirrelmail_language", $language, time()+2592000); + $squirrelmail_language = $language; } - // THEME - echo " "; - echo " "; - echo " "; - echo " "; - // LANGUAGE - echo " "; - echo " "; - echo " "; - echo " "; - - - // TRASH FOLDER - echo ""; - - // SENT FOLDER - echo ""; - - - echo "
"; - echo _("Full Name:"); - echo " "; - echo "
"; - echo "
"; - echo _("E-mail address:"); - echo " "; - echo "
"; - echo "
"; - echo _("Reply-to:"); - echo " "; - echo "
"; - echo "
"; - echo _("Folder path:"); - echo " "; - if (isset ($folder_prefix)) - echo "
"; - else - echo "
"; - echo "
"; - echo _("Theme:"); - echo " "; - - echo " "; - echo "
"; - echo _("Language:"); - echo " "; - - echo " "; - - echo "
"; - echo _("Trash Folder:"); - echo ""; - echo "\n"; - echo "
"; - echo _("Sent Folder:"); - echo ""; - echo "\n"; - echo "
"; - - echo "\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "
\n"; - echo " " . _("Use javascript version of address book?") . "\n"; - echo "
\n"; - if ($use_javascript_addr_book == true) { - echo "   " . _("Yes") . "
"; - echo "   " . _("No") . "
"; - } else { - echo "   " . _("Yes") . "
"; - echo "   " . _("No") . "
"; - } - echo "
\n"; - - echo "\n"; - - // SHOW_NUM - echo " "; - echo " "; - echo " "; - echo " "; - - // WRAP_AT - echo " "; - echo " "; - echo " "; - echo " "; - - // EDITOR_SIZE - echo " "; - echo " "; - echo " "; - echo " "; + include("../src/load_prefs.php"); + displayPageHeader($color, "None"); + is_logged_in(); +?> - // LEFT_SIZE - echo " "; - echo " "; - echo " "; - echo " "; - - - // LEFT_REFRESH - echo " "; - echo " "; - echo " "; - echo " "; - echo "
"; - echo _("Number of Messages to Index:"); - echo " "; - if (isset($wrap_at)) - echo "
"; - else - echo "
"; - echo "
"; - echo _("Wrap incoming text at:"); - echo " "; - if (isset($wrap_at)) - echo "
"; - else - echo "
"; - echo "
"; - echo _("Size of editor window (in characters):"); - echo " "; - if ($editor_size >= 5) - echo "
"; - else - echo "
"; - echo "
"; - echo _("Width of left folder list:"); - echo " \n"; - echo " +
+
+
+
+ +300 pixels\n"; - else - echo "
"; - echo _("Time between auto refresh of folder list:"); - echo " "; - echo " "; - echo "
"; - - // SIGNATURE - echo "
"; - if ($use_signature == true) - echo "  Use a signature?
"; - else { - echo "  "; - echo _("Use a signature?"); - echo "
"; - } - - if ($editor_size < 5) - $sig_size = 76; - else - $sig_size = $editor_size; - - echo "
Signature:

"; - echo "
"; - - // MESSAGE HIGHLIGHTING - echo "
\n"; - echo "
" . _("Message Highlighting") . " - [" . _("Edit") . "]

\n"; - if (count($message_highlight_list) >= 1) { - echo "\n"; - for ($i=0; $i < count($message_highlight_list); $i++) { - echo "\n"; - echo " \n"; - echo " \n"; - echo "\n"; + echo "
"._("Successfully saved personal information!")."

"; + } else if ($submit_display) { + # Save display preferences + setPref($data_dir, $username, "chosen_theme", $chosentheme); + setPref($data_dir, $username, "show_num", $shownum); + setPref($data_dir, $username, "wrap_at", $wrapat); + setPref($data_dir, $username, "editor_size", $editorsize); + setPref($data_dir, $username, "left_refresh", $leftrefresh); + setPref($data_dir, $username, "language", $language); + setPref($data_dir, $username, "left_size", $leftsize); + setPref($data_dir, $username, "use_javascript_addr_book", $javascript_abook); + + echo "
"._("Successfully saved display preferences!")."
"; + echo ""._("Refresh Page")."

"; + } else if ($submit_folder) { + # Save folder preferences + if ($trash != "none") { + setPref($data_dir, $username, "move_to_trash", true); + setPref($data_dir, $username, "trash_folder", $trash); + } else { + setPref($data_dir, $username, "move_to_trash", false); + setPref($data_dir, $username, "trash_folder", ""); } - echo "
\n"; - echo " " . $message_highlight_list[$i]["name"]; - echo " \n"; - echo " ".$message_highlight_list[$i]["match_type"]." = " . $message_highlight_list[$i]["value"]; - echo "
\n"; - } else { - echo "
" . _("No highlighting is defined") . "

\n"; + if ($sent != "none") { + setPref($data_dir, $username, "move_to_sent", true); + setPref($data_dir, $username, "sent_folder", $sent); + } else { + setPref($data_dir, $username, "move_to_sent", false); + setPref($data_dir, $username, "sent_folder", ""); + } + setPref($data_dir, $username, "folder_prefix", $folderprefix); + echo "
"._("Successfully saved folder preferences!")."
"; + echo ""._("Refresh Folders")."

"; } - echo "
\n"; +?> - // SUBMIT BUTTON - echo "
\n"; - echo "
"; - echo ""; + + + + + +
+ + + + + + + +
+ +
+ +

+ + + + + + + +
+ +
+ +

+
+ + + + + + + +
+ +
+ +

+ + + + + + + +
+ +
+ +

+
+ + diff --git a/src/options_display.php b/src/options_display.php new file mode 100644 index 00000000..ea49ee61 --- /dev/null +++ b/src/options_display.php @@ -0,0 +1,268 @@ + +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
: + +"; +?> +
: + +"; +?> +
  + + "; + if ($use_javascript_addr_book == true) { + echo " " . _("JavaScript") . "    "; + echo " " . _("HTML"); + } else { + echo " " . _("JavaScript") . "    "; + echo " " . _("HTML"); + } + ?> +
: + +
"; + else + echo "
"; +?> +
: + +
"; + else + echo "
"; +?> +
: + += 10 && $editor_size <= 255) + echo "
"; + else + echo "
"; +?> +
: + +\n"; + if ($left_size == 100) + echo "
: + +"; + if (($left_refresh == "None") || ($left_refresh == "")) + echo "
  + + +
+
+ diff --git a/src/options_folder.php b/src/options_folder.php new file mode 100644 index 00000000..4955f35b --- /dev/null +++ b/src/options_folder.php @@ -0,0 +1,120 @@ + +
+
+
+ +
+ + + + + + +"; + + + // SENT FOLDER + echo ""; +?> + + + +
: + +
"; + else + echo "
"; +?> +
"; + echo _("Trash Folder:"); + echo ""; + echo "\n"; + echo "
"; + echo _("Sent Folder:"); + echo ""; + echo "\n"; + echo "
  + + +
+
+ diff --git a/src/msg_highlight.php b/src/options_highlight.php similarity index 83% rename from src/msg_highlight.php rename to src/options_highlight.php index 6d2824bf..09ce1466 100644 --- a/src/msg_highlight.php +++ b/src/options_highlight.php @@ -1,16 +1,14 @@
" . _("Message Highlighting") . " - [" . _("New") . "]

\n"; +?> +
+
+
+ +
[" . _("New") . "]"; + echo " - ["._("Done")."]

\n"; if (count($message_highlight_list) >= 1) { echo "\n"; for ($i=0; $i < count($message_highlight_list); $i++) { echo "\n"; echo " "; echo "
\n"; - echo "[" . _("Edit") . "] ["._("Delete")."]\n"; + echo "[" . _("Edit") . "] ["._("Delete")."]\n"; echo " \n"; echo " " . $message_highlight_list[$i]["name"]; @@ -67,7 +78,7 @@ } if ($action == "edit" || $action == "add") { if (!isset($id)) $id = count($message_highlight_list); - + $color_list[0] = "4444aa"; $color_list[1] = "44aa44"; $color_list[2] = "aaaa44"; @@ -81,8 +92,7 @@ $color_list[10] = "aaaaaa"; $color_list[11] = "bfbfbf"; $color_list[12] = "dfdfdf"; - $color_list[13] = "ffffff"; - + $color_list[13] = "ffffff"; for ($i=0; $i < 14; $i++) { if ($color_list[$i] == $message_highlight_list[$id]["color"]) { $selected_choose = " checked"; @@ -92,10 +102,10 @@ } if (!$message_highlight_list[$id]["color"]) $selected_choose = " checked"; - else if (!$selected_choose) + else if (!$selected_choose) $selected_input = " checked"; - - echo "
\n"; + + echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -129,7 +139,7 @@ echo "
\n"; echo " \n"; echo "  ("; echo _("Regular Expression"); @@ -155,6 +165,6 @@ echo "
\n"; echo "
\n"; echo "
\n"; - } - echo ""; + } ?> + diff --git a/src/options_personal.php b/src/options_personal.php new file mode 100644 index 00000000..7c52d67c --- /dev/null +++ b/src/options_personal.php @@ -0,0 +1,84 @@ + +
+
+
+ +
+ + + + + + + + + + + + + + + + +
: + + +
: + + +
: + + +

: +
+  " . _("Use a signature") . "?
"; + else { + echo "  "; + echo _("Use a signature?"); + echo "
"; + } + echo "\n
"; +?> +
  + + +
+
+ diff --git a/src/options_submit.php b/src/options_submit.php deleted file mode 100644 index f61ce730..00000000 --- a/src/options_submit.php +++ /dev/null @@ -1,78 +0,0 @@ -

"; - echo _("Options Saved!"); - echo "

"; - echo _("Your options have been saved."); - echo "
"; - echo _("Click here"); - echo " "; - echo _("to continue."); - echo "
"; - echo ""; -?> diff --git a/src/read_body.php b/src/read_body.php index cc06a478..c6137dc2 100644 --- a/src/read_body.php +++ b/src/read_body.php @@ -29,6 +29,37 @@ if (!isset($date_php)) include("../functions/date.php"); + include("../src/load_prefs.php"); + $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); + sqimap_mailbox_select($imapConnection, $mailbox); + displayPageHeader($color, $mailbox); + + if ($view_hdr) { + fputs ($imapConnection, "a003 FETCH $passed_id BODY[HEADER]\r\n"); + $read = sqimap_read_data ($imapConnection, "a003", true, $a, $b); + + echo "
"; + echo "\n"; + echo " \n"; + echo "
" . _("Viewing full header") . " - "; + echo ""; + echo ""._("View message") . "
";
+      for ($i=1; $i < count($read)-1; $i++) {
+         $read[$i] = htmlspecialchars($read[$i]);
+         if (substr($read[$i], 0, 1) != "\t" && 
+             substr($read[$i], 0, 1) != " " && 
+             substr($read[$i], 0, 1) != "&" && 
+             trim($read[$i])) {
+            $pre = substr($read[$i], 0, strpos($read[$i], ":"));
+            $read[$i] = str_replace("$pre", "$pre", $read[$i]);
+         }
+         echo "$read[$i]";
+      }
+      echo "
\n"; + echo ""; + exit; + } + // given an IMAP message id number, this will look it up in the cached and sorted msgs array and // return the index. used for finding the next and previous messages @@ -79,16 +110,10 @@ $msgs[$i]["FLAG_SEEN"] = true; } - include("../src/load_prefs.php"); - $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); - sqimap_mailbox_select($imapConnection, $mailbox); - // $message contains all information about the message // including header and body $message = sqimap_get_message($imapConnection, $passed_id, $mailbox); - displayPageHeader($color, $mailbox); - /** translate the subject and mailbox into url-able text **/ $url_subj = urlencode(trim(stripslashes($message->header->subject))); $urlMailbox = urlencode($mailbox); @@ -159,7 +184,7 @@ echo "
"; echo "\n"; - echo "
"; + echo "
"; echo " "; echo " "; echo "
"; @@ -208,42 +233,43 @@ echo " \n"; echo " \n"; /** subject **/ - echo " \n"; + echo " "; echo " \n"; /** from **/ echo " \n"; - echo " \n"; echo " \n"; /** date **/ echo " \n"; - echo " \n"; echo " \n"; /** to **/ echo " \n"; - echo " \n"; echo " \n"; /** cc **/ if ($message->header->cc) { echo " \n"; - echo " \n"; echo " \n"; diff --git a/src/webmail.php b/src/webmail.php index 2bc1caaf..ee37c639 100644 --- a/src/webmail.php +++ b/src/webmail.php @@ -86,6 +86,9 @@ $urlMailbox = urlencode($mailbox); echo ""; echo ""; + } else if ($right_frame == "options.php") { + echo ""; + echo ""; } else if ($right_frame == "folders.php") { $urlMailbox = urlencode($mailbox); echo ""; -- 2.25.1
\n"; + echo " \n"; echo _("Subject:"); - echo " \n"; + echo " \n"; echo " $subject\n"; echo " " . _("View full header") . "  
\n"; + echo " \n"; echo _("From:"); - echo " \n"; + echo " \n"; echo " $from_name\n"; echo "
\n"; + echo " \n"; echo _("Date:"); - echo " \n"; + echo " \n"; echo " $dateString\n"; echo "
\n"; + echo " \n"; echo _("To:"); - echo " \n"; + echo " \n"; echo " $to_string\n"; echo "
\n"; + echo " \n"; echo " Cc:\n"; - echo " \n"; + echo " \n"; echo " $cc_string\n"; echo "