From 441f2d33bad826a0278aafe63e58d0b3c81b6e0c Mon Sep 17 00:00:00 2001 From: fidian Date: Sat, 21 Oct 2000 16:08:31 +0000 Subject: [PATCH] Added html_top and html_bottom hooks to read_body for compression plugin Changed internationalization things a bit, hopefully easier and less errors Many bug fixes and speed enhancements from Martin Jespersen (embeejay) Fixed a few bugs and did some speed changes on my own too! git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@814 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- doc/plugin.txt | 4 +- functions/i18n.php | 50 +++++++++++++++++ functions/imap_general.php | 102 +++++++++------------------------- functions/imap_messages.php | 51 +++++++---------- functions/mailbox_display.php | 9 ++- functions/mime.php | 11 ++-- functions/page_header.php | 16 +----- functions/strings.php | 2 + src/addrbook_popup.php | 7 +++ src/addrbook_search.php | 5 ++ src/addrbook_search_html.php | 25 +++++---- src/compose.php | 62 +++++++++++++-------- src/download.php | 3 + src/left_main.php | 1 + src/load_prefs.php | 4 ++ src/login.php | 26 +-------- src/options.php | 1 + src/options_display.php | 29 +++++++--- src/read_body.php | 6 +- src/right_main.php | 4 ++ src/search.php | 2 + src/signout.php | 23 +------- src/webmail.php | 7 +++ 23 files changed, 234 insertions(+), 216 deletions(-) diff --git a/doc/plugin.txt b/doc/plugin.txt index 60a44f5c..1031e0ca 100644 --- a/doc/plugin.txt +++ b/doc/plugin.txt @@ -116,8 +116,10 @@ List of hooks right_main_bottom src/right_main.php login_top src/login.php login_bottom src/login.php + html_top src/read_body.php read_body_top src/read_body.php read_body_bottom src/read_body.php + html_bottom src/read_body.php search_before_form src/search.php search_after_form src/search.php search_bottom src/search.php @@ -229,4 +231,4 @@ To set up links for actions, you assign them like this: $Args[1]['your_plugin_name']['href'] = 'URL to link to'; $Args[1]['your_plugin_name']['text'] = 'What to display'; - \ No newline at end of file + diff --git a/functions/i18n.php b/functions/i18n.php index 2b7d5f40..32fb38a9 100644 --- a/functions/i18n.php +++ b/functions/i18n.php @@ -690,4 +690,54 @@ } } + + global $use_gettext; + + // Detect whether gettext is installed. + // If it is, set the flag so we can use it. + if (! function_exists("_") || + ! function_exists("bindtextdomain") || + ! function_exists("textdomain")) + $use_gettext = false; + else + $use_gettext = true; + + + // Avoid warnings/errors + if (! function_exists("_")) { + function _($str) { return $str; }; + } + if (! function_exists("bindtextdomain")) { + function bindtextdomain() { return; } + } + if (! function_exists("textdomain")) { + function textdomain() { return; } + } + + + // Set up the language to be output + // if $do_search is true, then scan the browser information + // for a possible language that we know + function set_up_language($sm_language, $do_search = false) + { + static $SetupAlready = 0; + global $HTTP_ACCEPT_LANGUAGE; + + if ($SetupAlready) + return; + $SetupAlready = 1; + + if ($do_search && ! $sm_language && isset($HTTP_ACCEPT_LANGUAGE)) { + $sm_language = substr($HTTP_ACCEPT_LANGUAGE, 0, 2); + } + + if (isset($sm_language) && $use_gettext && + $sm_language != "en" && $squirrelmail_language != "" && + $languages[$sm_language]["CHARSET"]) { + putenv("LC_ALL=".$sm_language); + bindtextdomain("squirrelmail", "../locale/"); + textdomain("squirrelmail"); + header ("Content-Type: text/html; charset=".$languages[$sm_language]["CHARSET"]); + } + } ?> diff --git a/functions/imap_general.php b/functions/imap_general.php index 83ffe7e6..e8ee3deb 100755 --- a/functions/imap_general.php +++ b/functions/imap_general.php @@ -11,7 +11,7 @@ ** the errors will be sent back through $response and $message ******************************************************************************/ function sqimap_read_data ($imap_stream, $pre, $handle_errors, $response, $message) { - global $color; + global $color, $squirrelmail_language; //$imap_general_debug = true; $imap_general_debug = false; @@ -19,42 +19,30 @@ $read = fgets ($imap_stream, 1024); if ($imap_general_debug) echo "$read
"; $counter = 0; - while ((substr($read, 0, strlen("$pre OK")) != "$pre OK") && - (substr($read, 0, strlen("$pre BAD")) != "$pre BAD") && - (substr($read, 0, strlen("$pre NO")) != "$pre NO")) { + while (! ereg("^$pre (OK|BAD|NO)(.*)$", $read, $regs)) { $data[$counter] = $read; $read = fgets ($imap_stream, 1024); if ($imap_general_debug) echo "$read
"; $counter++; } if ($imap_general_debug) echo "--
"; - if (substr($read, 0, strlen("$pre OK")) == "$pre OK") { - $response = "OK"; - $message = trim(substr($read, strlen("$pre OK"), strlen($read))); - } - else if (substr($read, 0, strlen("$pre BAD")) == "$pre BAD") { - $response = "BAD"; - $message = trim(substr($read, strlen("$pre BAD"), strlen($read))); - } - else { - $response = "NO"; - $message = trim(substr($read, strlen("$pre NO"), strlen($read))); - } if ($handle_errors == true) { - if ($response == "NO") { + if ($regs[1] == "NO") { + set_up_language($squirrelmail_language); echo "
\n"; echo _("ERROR : Could not complete request."); echo "
\n"; echo _("Reason Given: "); - echo "$message

\n"; + echo trim($regs[2]) . "
\n"; exit; - } else if ($response == "BAD") { + } else if ($regs[1] == "BAD") { + set_up_language($squirrelmail_language); echo "
\n"; echo _("ERROR : Bad or malformed request."); echo "
\n"; echo _("Server responded: "); - echo "$message

\n"; + echo trim($regs[2]) . "
\n"; exit; } } @@ -78,17 +66,10 @@ // Decrypt the password $password = OneTimePadDecrypt($password, $onetimepad); - // This function can sometimes be called before the check for - // gettext is done. - if (!function_exists("_")) { - function _($string) { - return $string; - } - } - /** Do some error correction **/ if (!$imap_stream) { if (!$hide) { + set_up_language($squirrelmail_language, true); printf (_("Error connecting to IMAP server: %s.")."
\r\n", $imap_server_address); echo "$error_number : $error_string
\r\n"; } @@ -102,6 +83,7 @@ if (substr($read, 0, 7) != "a001 OK") { if (!$hide) { if (substr($read, 0, 8) == "a001 BAD") { + set_up_language($squirrelmail_language, true); printf (_("Bad request: %s")."
\r\n", $read); exit; } else if (substr($read, 0, 7) == "a001 NO") { @@ -114,20 +96,7 @@ // $squirrelmail_language is set by a cookie when // the user selects language and logs out - // Use HTTP content language negotiation if cookie - // not set - if (!isset($squirrelmail_language) && isset($HTTP_ACCEPT_LANGUAGE)) { - $squirrelmail_language = substr($HTTP_ACCEPT_LANGUAGE, 0, 2); - } - - if (isset($squirrelmail_language) && function_exists("bindtextdomain")) { - if ($squirrelmail_language != "en" && $squirrelmail_language != "") { - putenv("LC_ALL=".$squirrelmail_language); - bindtextdomain("squirrelmail", "../locale/"); - textdomain("squirrelmail"); - header ("Content-Type: text/html; charset=".$languages[$squirrelmail_language]["CHARSET"]); - } - } + set_up_language($squirrelmail_language, true); ?> @@ -160,6 +129,7 @@ session_destroy(); exit; } else { + set_up_language($squirrelmail_language, true); printf (_("Unknown error: %s")."
", $read); exit; } @@ -187,12 +157,10 @@ ** Returns the delimeter between mailboxes: INBOX/Test, or INBOX.Test... ******************************************************************************/ function sqimap_get_delimiter ($imap_stream) { - fputs ($imap_stream, ". LIST \"INBOX\" \"\"\r\n"); - $read = sqimap_read_data($imap_stream, ".", true, $a, $b); - $quote_position = strpos ($read[0], "\""); - $delim = substr ($read[0], $quote_position+1, 1); - - return $delim; + fputs ($imap_stream, "a001 NAMESPACE\r\n"); + $read = sqimap_read_data($imap_stream, "a001", true, $a, $b); + eregi("\"\" \"(.)\"", $read[0], $regs); + return $regs[1]; } @@ -205,12 +173,11 @@ fputs ($imap_stream, "a001 EXAMINE \"$mailbox\"\r\n"); $read_ary = sqimap_read_data ($imap_stream, "a001", true, $result, $message); for ($i = 0; $i < count($read_ary); $i++) { - if (substr(trim($read_ary[$i]), -6) == EXISTS) { - $array = explode (" ", $read_ary[$i]); - $num = $array[1]; + if (ereg("[^ ]+ +([^ ]+) +EXISTS", $read_ary[$i], $regs)) { + return $regs[1]; } } - return $num; + return "BUG! Couldn't get number of messages in $mailbox!"; } @@ -223,9 +190,8 @@ ** lehresma@css.tayloru.edu **/ - if (strpos($string, "<") && strpos($string, ">")) { - $string = substr($string, strpos($string, "<")+1); - $string = substr($string, 0, strpos($string, ">")); + if (ereg("<([^>]+)>", $string, $regs)) { + $string = $regs[1]; } return trim($string); } @@ -239,22 +205,10 @@ ** becomes: lkehresman@yahoo.com ******************************************************************************/ function sqimap_find_displayable_name ($string) { - $string = " ".trim($string); - $orig_string = $string; - if (strpos($string, "<") && strpos($string, ">")) { - if (strpos($string, "<") == 1) { - $string = sqimap_find_email($string); - } else { - $string = trim($string); - $string = substr($string, 0, strpos($string, "<")); - $string = ereg_replace ("\"", "", $string); - } - - if (trim($string) == "") { - $string = sqimap_find_email($orig_string); - } - } - return $string; + ereg("^\"?([^\"<]*)[\" <]*([^>]+)>?$", trim($string), $regs); + if ($regs[1] == '') + return $regs[2]; + return $regs[1]; } @@ -265,10 +219,8 @@ //fputs ($imap_stream, "a001 SEARCH UNSEEN NOT DELETED\r\n"); fputs ($imap_stream, "a001 STATUS \"$mailbox\" (UNSEEN)\r\n"); $read_ary = sqimap_read_data ($imap_stream, "a001", true, $result, $message); - $unseen = false; - - $read_ary[0] = trim($read_ary[0]); - return substr($read_ary[0], strrpos($read_ary[0], " ")+1, (strlen($read_ary[0]) - strrpos($read_ary[0], " ") - 2)); + ereg("UNSEEN ([0-9]+)", $read_ary[0], $regs); + return $regs[1]; } diff --git a/functions/imap_messages.php b/functions/imap_messages.php index f9da824d..1f4d57d4 100755 --- a/functions/imap_messages.php +++ b/functions/imap_messages.php @@ -56,27 +56,26 @@ $g = 0; for ($i = 0; $i < count($read); $i++) { - if (eregi ("^to:", $read[$i])) { + if (eregi ("^to:(.*)$", $read[$i], $regs)) { //$to = sqimap_find_displayable_name(substr($read[$i], 3)); - $to = substr($read[$i], 3); - } else if (eregi ("^from:", $read[$i])) { + $to = $regs[1]; + } else if (eregi ("^from:(.*)$", $read[$i], $regs)) { //$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)); - } else if (eregi ("^message-id:", $read[$i])) { - $messageid = trim(substr($read[$i], 11)); - } else if (eregi ("^cc:", $read[$i])) { - $cc = substr($read[$i], 3); - } else if (eregi ("^date:", $read[$i])) { - $date = substr($read[$i], 5); - } else if (eregi ("^subject:", $read[$i])) { - $subject = htmlspecialchars(eregi_replace ("^subject: ", "", $read[$i])); - if (trim($subject) == "") + $from = $regs[1]; + } else if (eregi ("^x-priority:(.*)$", $read[$i], $regs)) { + $priority = trim($regs[1]); + } else if (eregi ("^message-id:(.*)$", $read[$i], $regs)) { + $messageid = trim($regs[1]); + } else if (eregi ("^cc:(.*)$", $read[$i], $regs)) { + $cc = $regs[1]; + } else if (eregi ("^date:(.*)$", $read[$i], $regs)) { + $date = $regs[1]; + } else if (eregi ("^subject:(.*)$", $read[$i], $regs)) { + $subject = htmlspecialchars(trim($regs[1])); + if ($subject == "") $subject = _("(no subject)"); - } else if (eregi ("^content-type:", $read[$i])) { - $type = substr($read[$i], 14); - $type = strtolower(trim($type)); + } else if (eregi ("^content-type:(.*)$", $read[$i], $regs)) { + $type = strtolower(trim($regs[1])); if ($pos = strpos($type, ";")) $type = substr($type, 0, $pos); $type = explode("/", $type); @@ -106,7 +105,7 @@ $header = new small_header; if ($sent == true) - $header->from = $to; + $header->from = (trim($to) != '')? $to : _('(only Cc/Bcc)'); else $header->from = $from; @@ -129,17 +128,9 @@ function sqimap_get_flags ($imap_stream, $i) { fputs ($imap_stream, "a001 FETCH $i:$i FLAGS\r\n"); $read = sqimap_read_data ($imap_stream, "a001", true, $response, $message); - if (strpos($read[0], "FLAGS")) { - $tmp = ereg_replace("\(", "", $read[0]); - $tmp = ereg_replace("\)", "", $tmp); - $tmp = str_replace("\\", "", $tmp); - $tmp = substr($tmp, strpos($tmp, "FLAGS")+6, strlen($tmp)); - $tmp = trim($tmp); - $flags = explode(" ", $tmp); - } else { - $flags[0] = "None"; - } - return $flags; + if (ereg("FLAGS(.*)", $read[0], $regs)) + return explode(" ", trim(ereg_replace('[\(\)\\]', '', $regs[1]))); + return Array('None'); } /****************************************************************************** diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php index 5a12ca46..95ea1b95 100644 --- a/functions/mailbox_display.php +++ b/functions/mailbox_display.php @@ -147,9 +147,12 @@ $messages[$j]["TYPE0"] = $type[$j]; # fix SUBJECT-SORT to remove Re: - if (substr($messages[$j]["SUBJECT-SORT"], 0, 3) == "re:" || - substr($messages[$j]["SUBJECT-SORT"], 0, 3) == "aw:") - $messages[$j]["SUBJECT-SORT"] = trim(substr($messages[$j]["SUBJECT-SORT"], 3)); + $re_abbr = # Add more here! + "vedr|sv|" . # Danish + "re|aw"; # English + if (eregi("^($re_abbr):[ ]*(.*)$", + $messages[$j]['SUBJECT-SORT'], $regs)) + $messages[$j]['SUBJECT-SORT'] = $regs[2]; $num = 0; while ($num < count($flags[$j])) { diff --git a/functions/mime.php b/functions/mime.php index 2ae23b00..e60bcb62 100644 --- a/functions/mime.php +++ b/functions/mime.php @@ -363,10 +363,13 @@ fputs ($imap_stream, "a001 FETCH $id BODY[$ent_id]\r\n"); $topline = fgets ($imap_stream, 1024); - $size = substr ($topline, strpos($topline, "{")+1); - $size = substr ($size, 0, strpos($size, "}")); - $read = fread ($imap_stream, $size); - return $read; + if (ereg('\{([^\}]*)\}', $topline, $regs)) { + return fread ($imap_stream, $regs[1]); + } + else if (ereg('"([^"]*)"', $topline, $regs)) { + return $regs[1]; + } + return "Body retrival error, please report this bug!\n\nTop line is \"$topline\"\n"; } /* -[ END MIME DECODING ]----------------------------------------------------------- */ diff --git a/functions/page_header.php b/functions/page_header.php index 8b1d1d9e..e03a5fef 100644 --- a/functions/page_header.php +++ b/functions/page_header.php @@ -18,21 +18,7 @@ include ("../functions/plugin.php"); // Check to see if gettext is installed - if (function_exists("_")) { - // Setting the language to use for gettext if it is not English - // (the default language) or empty. - $squirrelmail_language = getPref ($data_dir, $username, "language"); - if ($squirrelmail_language != "en" && $squirrelmail_language != "") { - putenv("LC_ALL=$squirrelmail_language"); - bindtextdomain("squirrelmail", "../locale/"); - textdomain("squirrelmail"); - $default_charset = $languages[$squirrelmail_language]["CHARSET"]; - } - } else { - function _($string) { - return $string; - } - } + set_up_language(getPref($data_dir, $username, "language")); // This is done to ensure that the character set is correct. if ($default_charset != "") diff --git a/functions/strings.php b/functions/strings.php index 10f896f4..ecd423b5 100644 --- a/functions/strings.php +++ b/functions/strings.php @@ -160,6 +160,8 @@ // We need to do it twice to catch times where there // are an odd number of spaces + if (ereg("^ (.*)$", $line, $regs)) + $line = " " . $regs[1]; $line = str_replace(' ', '  ', $line); $line = str_replace(' ', '  ', $line); $line = nl2br($line); diff --git a/src/addrbook_popup.php b/src/addrbook_popup.php index f8248efe..e629cea0 100644 --- a/src/addrbook_popup.php +++ b/src/addrbook_popup.php @@ -11,6 +11,8 @@ session_start(); + if (!isset($i18n_php)) + include("../functions/i18n.php"); if (!isset($config_php)) include("../config/config.php"); if (!isset($page_header_php)) @@ -21,6 +23,11 @@ include("../functions/addressbook.php"); is_logged_in(); + + include("../src/load_prefs.php"); + + set_up_language(getPref($data_dir, $username, "language")); + ?> diff --git a/src/addrbook_search.php b/src/addrbook_search.php index df487f71..3205e4a4 100644 --- a/src/addrbook_search.php +++ b/src/addrbook_search.php @@ -125,12 +125,17 @@ function bcc_address($addr) { /* ================= End of functions ================= */ session_start(); + + if (!isset($i18n_php)) + include("../functions/i18n.php"); if(!isset($logged_in)) { + set_up_language($squirrelmail_language, true); echo _("You must login first."); exit; } if(!isset($username) || !isset($key)) { + set_up_language($squirrelmail_language, true); echo _("You need a valid user and password to access this page!"); exit; } diff --git a/src/addrbook_search_html.php b/src/addrbook_search_html.php index 95b93fcc..495f218e 100644 --- a/src/addrbook_search_html.php +++ b/src/addrbook_search_html.php @@ -40,17 +40,20 @@ // Insert hidden data function addr_insert_hidden() { global $body, $subject, $send_to, $send_to_cc, $send_to_bcc; - printf("\n", - htmlspecialchars($body)); - printf("\n", - htmlspecialchars($subject)); - printf("\n", - htmlspecialchars($send_to)); - printf("\n", - htmlspecialchars($send_to_cc)); - printf("\n", - htmlspecialchars($send_to_bcc)); - printf("\n"); + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; } diff --git a/src/compose.php b/src/compose.php index cf4c4593..39d3d33b 100644 --- a/src/compose.php +++ b/src/compose.php @@ -74,11 +74,14 @@ sqUnWordWrap($body); $body_ary = explode("\n", $body); + while (ereg("^[>\s]*$", $body_ary[count($body_ary) - 1])) { + unset($body_ary[count($body_ary) - 1]); + } $body = ""; for ($i=0; $i < count($body_ary); $i++) { if (! $forward_id) { - if (preg_match('/^[\s>]+/', $body_ary[$i])) + if (ereg('^[\s>]+', $body_ary[$i])) { $body_ary[$i] = '>' . $body_ary[$i]; } @@ -105,6 +108,8 @@ $bodyTop .= "\n"; $body = $bodyTop . $body; } + + $body = ereg_replace('\\\\', '\\\\', $body); sqimap_mailbox_close($imapConnection); return; @@ -147,7 +152,8 @@ global $send_to, $send_to_cc, $reply_subj, $forward_subj, $body, $passed_body, $color, $use_signature, $signature, $editor_size, $attachments, $subject, $newmail, $use_javascript_addr_book, - $send_to_bcc, $reply_id, $mailbox, $from_htmladdr_search; + $send_to_bcc, $reply_id, $mailbox, $from_htmladdr_search, + $location_of_buttons; $subject = sqStripSlashes(decodeHeader($subject)); $reply_subj = decodeHeader($reply_subj); @@ -172,6 +178,9 @@ } printf("\n", htmlspecialchars($mailbox)); echo "\n"; + + if ($location_of_buttons == 'top') showComposeButtonRow(); + echo " \n"; echo " \n\n"; - echo " \n"; - echo " \n\n"; - + if ($location_of_buttons == 'between') showComposeButtonRow(); echo " \n"; echo " \n"; echo " \n"; - echo " \n"; + + if ($location_of_buttons == 'bottom') + showComposeButtonRow(); + else { + echo " \n"; + } // This code is for attachments echo " \n"; @@ -285,6 +282,25 @@ echo ""; do_hook("compose_bottom"); } + + function showComposeButtonRow() { + echo " \n"; + echo " \n\n"; + } function showSentForm () { echo "


Message Sent!

"; diff --git a/src/download.php b/src/download.php index 0ae0bc04..a7479639 100644 --- a/src/download.php +++ b/src/download.php @@ -19,6 +19,8 @@ include("../functions/mime.php"); if (!isset($date_php)) include("../functions/date.php"); + if (!isset($i18n_php)) + include("../functions/i18n.php"); include("../src/load_prefs.php"); @@ -108,6 +110,7 @@ $body = decodeBody($body, $header->encoding); header("Content-Disposition: attachment; filename=\"$filename\""); header("Content-type: application/octet-stream; name=\"$filename\""); + set_up_language(getPref($data_dir, $username, "language")); if ($type1 == "plain") { echo _("Subject") . ": " . decodeHeader(sqStripSlashes($top_header->subject)) . "\n"; echo " " . _("From") . ": " . decodeHeader(sqStripSlashes($top_header->from)) . "\n"; diff --git a/src/left_main.php b/src/left_main.php index 2a540b44..c3483035 100644 --- a/src/left_main.php +++ b/src/left_main.php @@ -12,6 +12,7 @@ session_start(); if(!isset($username)) { + set_up_language($squirrelmail_language, true); echo "You need a valid user and password to access this page!"; exit; } diff --git a/src/load_prefs.php b/src/load_prefs.php index dcef5e2e..1c91e573 100644 --- a/src/load_prefs.php +++ b/src/load_prefs.php @@ -165,6 +165,10 @@ $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 == '') + $location_of_buttons = 'between'; do_hook("loading_prefs"); diff --git a/src/login.php b/src/login.php index ad71c775..f2345509 100644 --- a/src/login.php +++ b/src/login.php @@ -19,29 +19,9 @@ if (!isset($plugin_php)) include("../functions/plugin.php"); - // let's check to see if they compiled with gettext support - if (!function_exists("_")) { - function _($string) { - return $string; - } - } else { - // $squirrelmail_language is set by a cookie when the user selects - // language and logs out - - // Use HTTP content language negotiation if cookie not set - if (!isset($squirrelmail_language) && isset($HTTP_ACCEPT_LANGUAGE)) { - $squirrelmail_language = substr($HTTP_ACCEPT_LANGUAGE, 0, 2); - } - - if (isset($squirrelmail_language)) { - if ($squirrelmail_language != "en" && $squirrelmail_language != "") { - putenv("LC_ALL=".$squirrelmail_language); - bindtextdomain("squirrelmail", "../locale/"); - textdomain("squirrelmail"); - header ("Content-Type: text/html; charset=".$languages[$squirrelmail_language]["CHARSET"]); - } - } - } + // $squirrelmail_language is set by a cookie when the user selects + // language and logs out + set_up_language($squirrelmail_language, true); // Need the base URI to set the cookies. (Same code as in webmail.php) ereg ("(^.*/)[^/]+/[^/]+$", $PHP_SELF, $regs); diff --git a/src/options.php b/src/options.php index 14edf1a8..5710f0d0 100644 --- a/src/options.php +++ b/src/options.php @@ -66,6 +66,7 @@ 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); diff --git a/src/options_display.php b/src/options_display.php index 37227bd6..91ec6136 100644 --- a/src/options_display.php +++ b/src/options_display.php @@ -55,25 +55,25 @@
- + + + +
\n"; echo _("To:"); @@ -224,36 +233,24 @@ } echo "
\n \n"; - if ($use_javascript_addr_book) { - echo " \n"; - } else { - echo " "; - } - echo "\n \n"; - - do_hook("compose_button_row"); - - echo "
\n"; echo "   
\n"; echo "
 
 
\n \n"; + if ($use_javascript_addr_book) { + echo " \n"; + } else { + echo " "; + } + echo "\n \n"; + + do_hook("compose_button_row"); + + echo "
: + : "; + if (! $use_gettext) + echo "
This system doesn't support multiple languages"; + ?>
  - - "; + "; if ($use_javascript_addr_book == true) { echo " " . _("JavaScript") . "    "; echo " " . _("HTML"); @@ -129,6 +129,21 @@
: +
: diff --git a/src/read_body.php b/src/read_body.php index a16372b1..3aa9bdb4 100644 --- a/src/read_body.php +++ b/src/read_body.php @@ -27,6 +27,7 @@ include("../src/load_prefs.php"); $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); sqimap_mailbox_select($imapConnection, $mailbox); + do_hook("html_top"); displayPageHeader($color, $mailbox); if ($view_hdr) { @@ -337,12 +338,13 @@ $body = formatBody($imapConnection, $message, $color, $wrap_at); - echo "$body"; - + echo $body; + echo "\n"; echo " "; echo "
 
\n"; do_hook("read_body_bottom"); + do_hook("html_bottom"); sqimap_logout($imapConnection); ?> diff --git a/src/right_main.php b/src/right_main.php index 3efad3d6..16306ce3 100644 --- a/src/right_main.php +++ b/src/right_main.php @@ -10,14 +10,18 @@ ** **/ + if (!isset($i18n_php)) + include("../functions/i18n.php"); session_start(); if(!isset($logged_in)) { + set_up_language($squirrelmail_language, true); echo _("You must login first."); exit; } if(!isset($username) || !isset($key)) { + set_up_language($squirrelmail_language, true); echo _("You need a valid user and password to access this page!"); exit; } diff --git a/src/search.php b/src/search.php index f5b4798d..ed92be5e 100644 --- a/src/search.php +++ b/src/search.php @@ -2,10 +2,12 @@ session_start(); if(!isset($logged_in)) { + set_up_language($squirrelmail_language, true); echo _("You must login first."); exit; } if(!isset($username) || !isset($key)) { + set_up_language($squirrelmail_language, true); echo _("You need a valid user and password to access this page!"); exit; } diff --git a/src/signout.php b/src/signout.php index 84e693d0..ebf2fa6e 100644 --- a/src/signout.php +++ b/src/signout.php @@ -23,28 +23,7 @@ if (!isset($plugin_php)) include ("../functions/plugin.php"); - // Quick Fix for Gettext in LogOut Screen - if (!function_exists("_")) { - function _($string) { - return $string; - } - } - - $squirrelmail_language = getPref ($data_dir, $username, "language"); - if (isset($squirrelmail_language)) { - if ($squirrelmail_language != "en" && $squirrelmail_language != "") { - putenv("LC_ALL=".$squirrelmail_language); - bindtextdomain("squirrelmail", "../locale/"); - textdomain("squirrelmail"); - header ("Content-Type: text/html; charset=".$languages[$squirrelmail_language]["CHARSET"]); - - // Setting cookie to use on the login screen the next time the - // same user logs in. - setcookie("squirrelmail_language", $squirrelmail_language, - time()+2592000); - - } - } + set_up_language(getPref($data_dir, $username, "language")); do_hook("logout"); setcookie("username", "", 0, $base_uri); diff --git a/src/webmail.php b/src/webmail.php index 66eb3af3..89811e01 100644 --- a/src/webmail.php +++ b/src/webmail.php @@ -23,7 +23,11 @@ session_register ("base_uri"); + if (!isset($i18n_php)) + include ("../functions/i18n.php"); + if(!isset($username)) { + set_up_language($squirrelmail_language); echo _("You need a valid user and password to access this page!"); exit; } @@ -68,6 +72,9 @@ include ("../src/load_prefs.php"); + // We'll need this to later have a noframes version + set_up_language(getPref($data_dir, $username, "language")); + echo "\n"; echo ""; echo "$org_title"; -- 2.25.1