From b068a07db2c519cde6bf1715e725cb70f2bbbc35 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Mon, 26 Jun 2006 14:38:03 -0400
Subject: [PATCH] Typos, Optimizations, Updates

---
 program/localization/de_DE/labels.inc   |    3 -
 program/localization/de_DE/messages.inc |    4 +-
 CHANGELOG                               |   10 +++++
 program/include/main.inc                |    2 
 program/localization/de_CH/messages.inc |    4 +-
 program/include/rcube_smtp.inc          |    2 
 program/localization/de_CH/labels.inc   |    3 -
 UPGRADING                               |   22 ++++++++++-
 program/steps/mail/sendmail.inc         |   48 +++++++++++++-----------
 program/include/rcube_imap.inc          |    2 
 10 files changed, 65 insertions(+), 35 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 74d93a3..a384217 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,10 +1,20 @@
 CHANGELOG RoundCube Webmail
 ---------------------------
 
+2006/06/25
+----------
+- Changed behavior to include host-specific configuration (Bug #1483849)
+- Assume ISO-8859-1 encoding of mail messages by default (Patch #1483839)
+- Fixed spell checker to work with the new URL at google.com
+- Some memory and security optimizations sendmail.inc
+- Updated UGRADING description
+
+
 2006/06/19
 ----------
 - Added Drafts support (Feature #1326839) (richs)
 
+
 2006/06/02
 ----------
 - Updated Estonian localization and moved from ee to et
diff --git a/UPGRADING b/UPGRADING
index 624262d..fecc377 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -71,6 +71,10 @@
   $rcmail_config['log_dir'] = 'logs/';
   $rcmail_config['temp_dir'] = 'temp/';
   $rcmail_config['message_cache_lifetime'] = '10d';
+  $rcmail_config['drafts_mbox'] = 'Drafts';
+  $rcmail_config['product_name'] = 'RoundCube Webmail';
+  $rcmail_config['read_when_deleted'] = TRUE;
+  $rcmail_config['enable_spellcheck'] = TRUE;
 - add these lines to /config/db.inc.php
   $rcmail_config['db_max_length'] = 512000;  
   $rcmail_config['db_sequence_user_ids'] = 'user_ids';
@@ -78,7 +82,7 @@
   $rcmail_config['db_sequence_contact_ids'] = 'contact_ids';
   $rcmail_config['db_sequence_cache_ids'] = 'cache_ids';
   $rcmail_config['db_sequence_message_ids'] = 'message_ids';  
-
+  $rcmail_config['db_persistent'] = TRUE;
 
 from version 0.1-20051021
 ----------------------------------------
@@ -93,6 +97,10 @@
   $rcmail_config['log_dir'] = 'logs/';
   $rcmail_config['temp_dir'] = 'temp/';
   $rcmail_config['message_cache_lifetime'] = '10d';
+  $rcmail_config['drafts_mbox'] = 'Drafts';
+  $rcmail_config['product_name'] = 'RoundCube Webmail';
+  $rcmail_config['read_when_deleted'] = TRUE;
+  $rcmail_config['enable_spellcheck'] = TRUE;
 - add these lines to /config/db.inc.php
   $rcmail_config['db_max_length'] = 512000;
   $rcmail_config['db_sequence_user_ids'] = 'user_ids';
@@ -100,6 +108,7 @@
   $rcmail_config['db_sequence_contact_ids'] = 'contact_ids';
   $rcmail_config['db_sequence_cache_ids'] = 'cache_ids';
   $rcmail_config['db_sequence_message_ids'] = 'message_ids';
+  $rcmail_config['db_persistent'] = TRUE;
   
   
 form version 0.1-beta
@@ -109,5 +118,14 @@
 - replace all files in folder /skins/default/
 - add these lines to /config/db.inc.php
   $rcmail_config['db_persistent'] = TRUE;
-
+- add these lines to /config/main.inc.php
+  $rcmail_config['drafts_mbox'] = 'Drafts';
+  $rcmail_config['product_name'] = 'RoundCube Webmail';
+  $rcmail_config['read_when_deleted'] = TRUE;
+  $rcmail_config['enable_spellcheck'] = TRUE;
+- replace the following line from /config/main.inc.php
+   @include($_SERVER['HTTP_HOST'].'.inc.php');
+  with 
+   $rcmail_config['include_host_config'] = TRUE;
+  
   
diff --git a/program/include/main.inc b/program/include/main.inc
index c5370b1..0a158dc 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -44,7 +44,7 @@
   $CONFIG = is_array($rcmail_config) ? $rcmail_config : array();
   
   // load host-specific configuration
-  rcmail_load_host_config(&$CONFIG);
+  rcmail_load_host_config($CONFIG);
   
   $CONFIG['skin_path'] = $CONFIG['skin_path'] ? preg_replace('/\/$/', '', $CONFIG['skin_path']) : 'skins/default';
 
diff --git a/program/include/rcube_imap.inc b/program/include/rcube_imap.inc
index bf23f71..dccd64f 100644
--- a/program/include/rcube_imap.inc
+++ b/program/include/rcube_imap.inc
@@ -990,7 +990,7 @@
 
 
   // append a mail message (source) to a specific mailbox
-  function save_message($mbox_name, $message)
+  function save_message($mbox_name, &$message)
     {
     $mailbox = $this->_mod_mailbox($mbox_name);
 
diff --git a/program/include/rcube_smtp.inc b/program/include/rcube_smtp.inc
index 63cdc1e..3108675 100644
--- a/program/include/rcube_smtp.inc
+++ b/program/include/rcube_smtp.inc
@@ -49,7 +49,7 @@
  * @return bool  Returns TRUE on success, or FALSE on error
  * @access public
  */
-function smtp_mail($from, $recipients, $headers, &$body)
+function smtp_mail($from, $recipients, &$headers, &$body)
   {
   global $SMTP_CONN, $CONFIG, $SMTP_ERROR;
   $smtp_timeout = null;
diff --git a/program/localization/de_CH/labels.inc b/program/localization/de_CH/labels.inc
index 9fa6c04..9141564 100644
--- a/program/localization/de_CH/labels.inc
+++ b/program/localization/de_CH/labels.inc
@@ -37,7 +37,6 @@
 $labels['drafts'] = 'Entwürfe';
 $labels['sent']   = 'Gesendet';
 $labels['trash']  = 'Gelöscht';
-$labels['drafts'] = 'Vorlagen';
 $labels['junk']   = 'Junk';
 
 // message listing // Nachrichtenliste
@@ -121,7 +120,7 @@
 
 // message compose // Nachrichten erstellen
 $labels['compose']  = 'Neue Nachricht verfassen';
-$labels['savemessage']  = 'Außer diesem Entwurf';
+$labels['savemessage']  = 'Nachricht speichern';
 $labels['sendmessage']  = 'Nachricht jetzt senden';
 $labels['addattachment']  = 'Datei anfügen';
 $labels['charset']  = 'Zeichensatz';
diff --git a/program/localization/de_CH/messages.inc b/program/localization/de_CH/messages.inc
index 767b54f..57c1513 100644
--- a/program/localization/de_CH/messages.inc
+++ b/program/localization/de_CH/messages.inc
@@ -38,9 +38,9 @@
 
 $messages['messagesent'] = 'Nachricht erfolgreich gesendet';
 
-$messages['savingmessage'] = 'Einsparunganzeige...';
+$messages['savingmessage'] = 'Nachricht wird gespeichert...';
 
-$messages['messagesaved'] = 'Anzeige gespeichert zu den Entwürfen';
+$messages['messagesaved'] = 'Nachricht als Entwurf gespeichert';
 
 $messages['successfullysaved'] = 'Erfolgreich gespeichert';
 
diff --git a/program/localization/de_DE/labels.inc b/program/localization/de_DE/labels.inc
index 00052c0..ac74b30 100644
--- a/program/localization/de_DE/labels.inc
+++ b/program/localization/de_DE/labels.inc
@@ -38,7 +38,6 @@
 $labels['drafts'] = 'Entwürfe';
 $labels['sent']   = 'Gesendet';
 $labels['trash']  = 'Gelöscht';
-$labels['drafts'] = 'Entwürfe';
 $labels['junk']   = 'Spam';
 
 // message listing // Nachrichtenliste
@@ -122,7 +121,7 @@
 
 // message compose // Nachrichten erstellen
 $labels['compose']  = 'Neue Nachricht verfassen';
-$labels['savemessage']  = 'Außer diesem Entwurf';
+$labels['savemessage']  = 'Nachricht speichern';
 $labels['sendmessage']  = 'Nachricht jetzt senden';
 $labels['addattachment']  = 'Datei anfügen';
 $labels['charset']  = 'Zeichensatz';
diff --git a/program/localization/de_DE/messages.inc b/program/localization/de_DE/messages.inc
index 7eb90f9..622cd0d 100644
--- a/program/localization/de_DE/messages.inc
+++ b/program/localization/de_DE/messages.inc
@@ -40,9 +40,9 @@
 
 $messages['messagesent'] = 'Nachricht erfolgreich gesendet';
 
-$messages['savingmessage'] = 'Einsparunganzeige...';
+$messages['savingmessage'] = 'Nachricht wird gespeichert...';
 
-$messages['messagesaved'] = 'Anzeige gespeichert zu den Entwürfen';
+$messages['messagesaved'] = 'Nachricht als Entwurf gespeichert';
 
 $messages['successfullysaved'] = 'Erfolgreich gespeichert';
 
diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index 68e9fad..a57f2d4 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -62,15 +62,14 @@
   return FALSE;  
   }
 
-if (strlen($_POST['_draft_saveid']) > 3) {
-  $olddraftmessageid = $_POST['_draft_saveid'];
-}
-if (strlen($_POST['_draft_newsaveid']) > 3) {
-  $newdraftmessageid = $_POST['_draft_newsaveid'];
-}
-if ($_POST['_draft']) {
-  $savedraft = 1;
-}
+if (strlen($_POST['_draft_saveid']) > 3)
+  $olddraftmessageid = get_input_value('_draft_saveid', RCUBE_INPUT_POST);
+
+if (strlen($_POST['_draft_newsaveid']) > 3)
+  $newdraftmessageid = get_input_value('_draft_newsaveid', RCUBE_INPUT_POST);
+
+$savedraft = !empty($_POST['_draft']) ? TRUE : FALSE;
+
  
 /****** check submission and compose message ********/
 
@@ -95,7 +94,7 @@
 
 // decode address strings
 $to_address_arr = $IMAP->decode_address_list($mailto);
-$identity_arr = rcmail_get_identity($_POST['_from']);
+$identity_arr = rcmail_get_identity(get_input_value('_from', RCUBE_INPUT_POST));
 
 
 $from = $identity_arr['mailto'];
@@ -103,17 +102,19 @@
 
 
 // try the message-id submitted by the compose form
-if ($newdraftmessageid) {
+if ($newdraftmessageid)
   $message_id = sprintf('<%s>',$newdraftmessageid);
-} else {
+else
   $message_id = sprintf('<%s@%s>', md5(uniqid('rcmail'.rand(),true)), $_SESSION['imap_host']);
-}
+  
+if (empty($identity_arr['string']))
+  $identity_arr['string'] = $from;
 
 
 // compose headers array
 $headers = array('Date' => date('D, j M Y G:i:s O'),
                  'From' => $identity_arr['string'],
-                 'To'   => rcube_charset_convert($mailto, $input_charset, $message_charset));
+                 'To'   => $mailto);
 
 // additional recipients
 if (!empty($_POST['_cc']))
@@ -218,7 +219,7 @@
                        'text_charset'  => $message_charset);
 
 // compose message body and get headers
-$msg_body = $MAIL_MIME->get($message_param);
+$msg_body = &$MAIL_MIME->get($message_param);
 
 $msg_subject = $headers['Subject'];
 
@@ -295,11 +296,10 @@
   } // End of SMTP Delivery Block
 
 // Determine which folder to save message
-if ($savedraft) {
-	$store_target = 'drafts_mbox';
-} else {
-	$store_target = 'sent_mbox';
-}
+if ($savedraft)
+  $store_target = 'drafts_mbox';
+else
+  $store_target = 'sent_mbox';
 
 if ($CONFIG[$store_target])
   {
@@ -311,10 +311,13 @@
     $store_folder = $IMAP->create_mailbox($CONFIG[$store_target], TRUE);
   else
     $store_folder = TRUE;
+  
+  // add headers to message body
+  $msg_body = $header_str."\r\n".$msg_body;
 
   // append message to sent box
   if ($store_folder)
-    $saved = $IMAP->save_message($CONFIG[$store_target], $header_str."\r\n".$msg_body);
+    $saved = $IMAP->save_message($CONFIG[$store_target], $msg_body);
 
   // raise error if saving failed
   if (!$saved)
@@ -323,7 +326,8 @@
                       'file' => __FILE__,
                       'message' => "Could not save message in $CONFIG[$store_target]"), TRUE, FALSE);
 
-  if ($olddraftmessageid) {
+  if ($olddraftmessageid)
+    {
     // delete previous saved draft
     $a_deleteid = $IMAP->search($CONFIG['drafts_mbox'],'HEADER Message-ID',$olddraftmessageid);
     $deleted = $IMAP->delete_message($IMAP->get_uid($a_deleteid[0],$CONFIG['drafts_mbox']),$CONFIG['drafts_mbox']);

--
Gitblit v1.9.1