From cd41fc8d96ed2fbc0d7c48f10f918a25bf61587e Mon Sep 17 00:00:00 2001 From: thomppj Date: Fri, 21 Sep 2001 03:36:38 +0000 Subject: [PATCH] Modifications made to give options for how "Reply Citation" is done. This is the topic that we were previously talking about on the list as "Reply Quote Style" or "Attibute Quotes". git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1507 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- src/compose.php | 35 ++++++++++++++--- src/load_prefs.php | 85 ++++++++++++++++++++++++----------------- src/options.php | 25 ++++++++---- src/options_display.php | 51 +++++++++++++++++++------ 4 files changed, 138 insertions(+), 58 deletions(-) diff --git a/src/compose.php b/src/compose.php index 8f6e4693..8a348b70 100644 --- a/src/compose.php +++ b/src/compose.php @@ -106,7 +106,7 @@ $orig_from = trim(substr($orig_from,0,strpos($orig_from,'<'))); $orig_from = str_replace('"','',$orig_from); $orig_from = str_replace("'",'',$orig_from); - $body = $orig_from . ' ' . _('said') . ":\n" . $body; + $body = getReplyCitation($orig_from) . $body; } return; @@ -545,9 +545,6 @@ sqimap_logout($imapConnection); } - - - function ClearAttachments() { global $attachments, $attachment_dir; @@ -559,5 +556,33 @@ $attachments = array(); } - + + function getReplyCitation($orig_from) { + global $reply_citation_style, $reply_citation_start, $reply_citation_end; + + /* First, return an empty string when no citation style selected. */ + if (($reply_citation_style == '') || ($reply_citation_style == 'none')) { + return (''); + } + + /* Otherwise, try to select the desired citation style. */ + switch ($reply_citation_style) { + case 'author_said': + $start = ''; + $end = ' ' . _("said") . ':'; + break; + case 'quote_who': + $start = '<' . _("quote") . ' ' . _("who") . '="'; + $end = '">'; + break; + case 'user-defined': + $start = $reply_citation_start; + $end = $reply_citation_end; + break; + default: return (''); + } + + /* Build and return the citation string. */ + return ($start . $orig_from . $end . "\n"); + } ?> diff --git a/src/load_prefs.php b/src/load_prefs.php index 161c49f4..aed52bd3 100644 --- a/src/load_prefs.php +++ b/src/load_prefs.php @@ -105,69 +105,87 @@ global $folder_prefix; $folder_prefix = getPref($data_dir, $username, "folder_prefix"); - if ($folder_prefix == "") + if ($folder_prefix == "") { $folder_prefix = $default_folder_prefix; + } + /** Load special folders **/ + global $trash_folder, $sent_folder; + $new_trash_folder = getPref($data_dir, $username, "trash_folder"); + if (($new_trash_folder == "") && ($move_to_trash == true)) { + $trash_folder = $folder_prefix . $trash_folder; + } else { + $trash_folder = $new_trash_folder; + } - /** Load special folders **/ - global $trash_folder, $sent_folder; - $new_trash_folder = getPref($data_dir, $username, "trash_folder"); - if (($new_trash_folder == "") && ($move_to_trash == true)) - $trash_folder = $folder_prefix . $trash_folder; - else - $trash_folder = $new_trash_folder; - - /** Load special folders **/ - $new_sent_folder = getPref($data_dir, $username, "sent_folder"); - if (($new_sent_folder == "") && ($move_to_sent == true)) - $sent_folder = $folder_prefix . $sent_folder; - else - $sent_folder = $new_sent_folder; - + /** Load special folders **/ + $new_sent_folder = getPref($data_dir, $username, "sent_folder"); + if (($new_sent_folder == "") && ($move_to_sent == true)) { + $sent_folder = $folder_prefix . $sent_folder; + } else { + $sent_folder = $new_sent_folder; + } global $show_num, $wrap_at, $left_size; $show_num = getPref($data_dir, $username, "show_num"); - if ($show_num == "") + if ($show_num == "") { $show_num = 25; + } $wrap_at = getPref($data_dir, $username, "wrap_at"); - if ($wrap_at == "") + if ($wrap_at == "") { $wrap_at = 86; - if ($wrap_at < 15) + } else if ($wrap_at < 15) { $wrap_at = 15; + } $left_size = getPref($data_dir, $username, "left_size"); if ($left_size == "") { - if (isset($default_left_size)) + if (isset($default_left_size)) { $left_size = $default_left_size; - else + } else { $left_size = 200; - } - + } + } global $editor_size, $use_signature, $prefix_sig; $editor_size = getPref($data_dir, $username, "editor_size"); - if ($editor_size == "") + if ($editor_size == "") { $editor_size = 76; + } + $use_signature = getPref($data_dir, $username, "use_signature"); - if ($use_signature == "") + if ($use_signature == "") { $use_signature = false; + } $prefix_sig = getPref($data_dir, $username, "prefix_sig"); - if ($prefix_sig == "") + if ($prefix_sig == "") { $prefix_sig = true; + } + + /* Load preferences for reply citation style. */ + global $reply_citation_style, $reply_citation_start, $reply_citation_end; + + $reply_citation_style = getPref($data_dir, $username, 'reply_citation_style'); + if ($reply_citation_style == '') { + $reply_citation_style = 'none'; + } + $reply_citation_start = getPref($data_dir, $username, 'reply_citation_start'); + $reply_citation_end = getPref($data_dir, $username, 'reply_citation_end'); global $left_refresh, $sort; $left_refresh = getPref($data_dir, $username, "left_refresh"); - if ($left_refresh == "") + if ($left_refresh == "") { $left_refresh = false; + } $sort = getPref($data_dir, $username, "sort"); - if ($sort == "") + if ($sort == "") { $sort = 6; - + } /** Load up the Signature file **/ global $signature_abs; @@ -211,18 +229,17 @@ } else { $alt_index_colors = true; } - - + global $location_of_bar, $location_of_buttons; $location_of_bar = getPref($data_dir, $username, 'location_of_bar'); if ($location_of_bar == '') $location_of_bar = 'left'; $location_of_buttons = getPref($data_dir, $username, 'location_of_buttons'); - if ($location_of_buttons == '') + if ($location_of_buttons == '') { $location_of_buttons = 'between'; - - + } + global $collapse_folders, $show_html_default; $collapse_folders = getPref($data_dir, $username, 'collapse_folders'); diff --git a/src/options.php b/src/options.php index 4ead9c94..7516d1bb 100644 --- a/src/options.php +++ b/src/options.php @@ -70,27 +70,36 @@ # Save display preferences setPref($data_dir, $username, 'chosen_theme', $chosentheme); + setPref($data_dir, $username, 'language', $language); + setPref($data_dir, $username, 'use_javascript_addr_book', $javascript_abook); 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, 'reply_citation_style', $new_reply_citation_style); + setPref($data_dir, $username, 'reply_citation_start', $new_reply_citation_start); + setPref($data_dir, $username, 'reply_citation_end', $new_reply_citation_end); setPref($data_dir, $username, 'left_refresh', $leftrefresh); - setPref($data_dir, $username, 'language', $language); setPref($data_dir, $username, 'location_of_bar', $folder_new_location); setPref($data_dir, $username, 'location_of_buttons', $button_new_location); setPref($data_dir, $username, 'left_size', $leftsize); - setPref($data_dir, $username, 'use_javascript_addr_book', $javascript_abook); - if (isset($altIndexColors) && $altIndexColors == 1) + + if (isset($altIndexColors) && $altIndexColors == 1) { setPref($data_dir, $username, 'alt_index_colors', 1); - else + } else { setPref($data_dir, $username, 'alt_index_colors', 0); - if (isset($showhtmldefault)) + } + + if (isset($showhtmldefault)) { setPref($data_dir, $username, 'show_html_default', 1); - else + } else { removePref($data_dir, $username, 'show_html_default'); - if (isset($includeselfreplyall)) + } + + if (isset($includeselfreplyall)) { setPref($data_dir, $username, 'include_self_reply_all', 1); - else + } else { removePref($data_dir, $username, 'include_self_reply_all'); + } do_hook('options_display_save'); diff --git a/src/options_display.php b/src/options_display.php index 0882b7ef..5c862157 100644 --- a/src/options_display.php +++ b/src/options_display.php @@ -23,10 +23,10 @@
-
+
- -
+ +

@@ -111,17 +111,34 @@ - - + + + + + + + + +
::
: + <> + +
:
: +
: -- 2.25.1