From 397cf794b975e8128a6d155957229106cd065d0c Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Tue, 28 Aug 2012 12:22:43 +0200 Subject: Don't terminate script execution when parsed template doesn't exist and parse was called with 3rd argument = false. --- program/include/rcube_output_html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'program/include') diff --git a/program/include/rcube_output_html.php b/program/include/rcube_output_html.php index a071ee354..00378d7d2 100644 --- a/program/include/rcube_output_html.php +++ b/program/include/rcube_output_html.php @@ -400,7 +400,7 @@ class rcube_output_html extends rcube_output 'line' => __LINE__, 'file' => __FILE__, 'message' => 'Error loading template for '.$realname - ), true, true); + ), true, $write); return false; } -- cgit v1.2.3 From b7d33e35186d47dcd3609e1ef97cdb011c6f82f6 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Tue, 28 Aug 2012 12:59:29 +0200 Subject: Added template object 'frame' --- CHANGELOG | 1 + program/include/rcube_output_html.php | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) (limited to 'program/include') diff --git a/CHANGELOG b/CHANGELOG index 8e9dcb3c7..028eb196e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ CHANGELOG Roundcube Webmail =========================== +- Added template object 'frame' - Fix identity selection on reply (#1488101) - Add option to enable HTML editor on forwarding (#1488517) - Add option to not include original message on reply, rename option top_posting to reply_mode (#1485149) diff --git a/program/include/rcube_output_html.php b/program/include/rcube_output_html.php index 00378d7d2..960002112 100644 --- a/program/include/rcube_output_html.php +++ b/program/include/rcube_output_html.php @@ -698,6 +698,11 @@ class rcube_output_html extends rcube_output } break; + // frame + case 'frame': + return $this->frame($attrib); + break; + // show a label case 'label': if ($attrib['name'] || $attrib['command']) { @@ -1275,6 +1280,30 @@ class rcube_output_html extends rcube_output } + /** + * Returns iframe object, registers some related env variables + * + * @param array $attrib HTML attributes + * + * @return string IFRAME element + */ + public function frame($attrib) + { + if (!$attrib['id']) { + $attrib['id'] = 'rcmframe'; + } + + if (!$attrib['name']) { + $attrib['name'] = $attrib['id']; + } + + $this->set_env('contentframe', $attrib['name']); + $this->set_env('blankpage', $attrib['src'] ? $this->abs_url($attrib['src']) : 'program/resources/blank.gif'); + + return html::iframe($attrib); + } + + /* ************* common functions delivering gui objects ************** */ -- cgit v1.2.3 From c59a822a65bac2aa53eb41978b1ac2d5192710e6 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 29 Aug 2012 08:04:36 +0200 Subject: Remove reference to MDB2 from autoloader --- program/include/rcube_shared.inc | 2 -- 1 file changed, 2 deletions(-) (limited to 'program/include') diff --git a/program/include/rcube_shared.inc b/program/include/rcube_shared.inc index 276940cb6..c15305c08 100644 --- a/program/include/rcube_shared.inc +++ b/program/include/rcube_shared.inc @@ -422,7 +422,6 @@ function rcube_autoload($classname) { $filename = preg_replace( array( - '/MDB2_(.+)/', '/Mail_(.+)/', '/Net_(.+)/', '/Auth_(.+)/', @@ -430,7 +429,6 @@ function rcube_autoload($classname) '/^utf8$/', ), array( - 'Mail/\\1', 'Mail/\\1', 'Net/\\1', 'Auth/\\1', -- cgit v1.2.3 From 764641d4a38e0a9856cced092ac7c294a2956dcf Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 29 Aug 2012 09:22:07 +0200 Subject: Fix decoding of HTML messages with UTF-16 charset specified (#1488654) --- CHANGELOG | 1 + program/include/rcube_charset.php | 6 ++++++ 2 files changed, 7 insertions(+) (limited to 'program/include') diff --git a/CHANGELOG b/CHANGELOG index cddfc96f8..7654cdef8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ CHANGELOG Roundcube Webmail =========================== +- Fix decoding of HTML messages with UTF-16 charset specified (#1488654) - Fix quota capability detection so it can be overwritten by a plugin (#1488655) - Added template object 'frame' - Fix identity selection on reply (#1488101) diff --git a/program/include/rcube_charset.php b/program/include/rcube_charset.php index 380d14978..1740a6096 100644 --- a/program/include/rcube_charset.php +++ b/program/include/rcube_charset.php @@ -181,6 +181,12 @@ class rcube_charset $to = empty($to) ? strtoupper(RCMAIL_CHARSET) : self::parse_charset($to); $from = self::parse_charset($from); + // It is a common case when UTF-16 charset is used with US-ASCII content (#1488654) + // In that case we can just skip the conversion (use UTF-8) + if ($from == 'UTF-16' && !preg_match('/[^\x00-\x7F]/', $str)) { + $from = 'UTF-8'; + } + if ($from == $to || empty($str) || empty($from)) { return $str; } -- cgit v1.2.3 From 10562d8a7760eae6b6cb22aa336605e09c7a8bce Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 29 Aug 2012 11:05:02 +0200 Subject: Keep current folder context when fetching message parts, to make sure that proper folder is used in case when current folder has been changed in meantime. --- program/include/rcube_message.php | 26 +++++++++++++++++++------- program/include/rcube_storage.php | 2 +- 2 files changed, 20 insertions(+), 8 deletions(-) (limited to 'program/include') diff --git a/program/include/rcube_message.php b/program/include/rcube_message.php index f550b574e..6af1d0133 100644 --- a/program/include/rcube_message.php +++ b/program/include/rcube_message.php @@ -52,7 +52,8 @@ class rcube_message private $opt = array(); private $parse_alternative = false; - public $uid = null; + public $uid; + public $folder; public $headers; public $parts = array(); public $mime_parts = array(); @@ -68,17 +69,22 @@ class rcube_message * * Provide a uid, and parse message structure. * - * @param string $uid The message UID. + * @param string $uid The message UID. + * @param string $folder Folder name * * @see self::$app, self::$storage, self::$opt, self::$parts */ - function __construct($uid) + function __construct($uid, $folder = null) { $this->uid = $uid; $this->app = rcube::get_instance(); $this->storage = $this->app->get_storage(); + $this->folder = strlen($folder) ? $folder : $this->storage->get_folder(); $this->storage->set_options(array('all_headers' => true)); + // Set current folder + $this->storage->set_folder($this->folder); + $this->headers = $this->storage->get_message($uid); if (!$this->headers) @@ -179,10 +185,12 @@ class rcube_message } return $fp ? true : $part->body; } + // get from IMAP + $this->storage->set_folder($this->folder); + return $this->storage->get_message_part($this->uid, $mime_id, $part, NULL, $fp, $skip_charset_conv); - } else - return null; + } } @@ -637,8 +645,10 @@ class rcube_message function tnef_decode(&$part) { // @TODO: attachment may be huge, hadle it via file - if (!isset($part->body)) + if (!isset($part->body)) { + $this->storage->set_folder($this->folder); $part->body = $this->storage->get_message_part($this->uid, $part->mime_id, $part); + } $parts = array(); $tnef = new tnef_decoder; @@ -673,8 +683,10 @@ class rcube_message function uu_decode(&$part) { // @TODO: messages may be huge, hadle body via file - if (!isset($part->body)) + if (!isset($part->body)) { + $this->storage->set_folder($this->folder); $part->body = $this->storage->get_message_part($this->uid, $part->mime_id, $part); + } $parts = array(); // FIXME: line length is max.65? diff --git a/program/include/rcube_storage.php b/program/include/rcube_storage.php index 768a26d73..f83e24041 100644 --- a/program/include/rcube_storage.php +++ b/program/include/rcube_storage.php @@ -195,7 +195,7 @@ abstract class rcube_storage */ public function set_folder($folder) { - if ($this->folder == $folder) { + if ($this->folder === $folder) { return; } -- cgit v1.2.3 From d317a59d3041223c5070ae72d3d7187ef0c089ca Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 29 Aug 2012 12:40:09 +0200 Subject: Fix frame() so frame ID is set as 'contentframe' env variable (not name) --- program/include/rcube_output_html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'program/include') diff --git a/program/include/rcube_output_html.php b/program/include/rcube_output_html.php index 960002112..2743e7705 100644 --- a/program/include/rcube_output_html.php +++ b/program/include/rcube_output_html.php @@ -1297,7 +1297,7 @@ class rcube_output_html extends rcube_output $attrib['name'] = $attrib['id']; } - $this->set_env('contentframe', $attrib['name']); + $this->set_env('contentframe', $attrib['id']); $this->set_env('blankpage', $attrib['src'] ? $this->abs_url($attrib['src']) : 'program/resources/blank.gif'); return html::iframe($attrib); -- cgit v1.2.3 From b5652641be7ebf4f1b7f115333989d2c971275ea Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Fri, 31 Aug 2012 09:55:00 +0200 Subject: Small improvements in APPEND command handling --- program/include/rcube_imap.php | 4 ++++ program/include/rcube_imap_generic.php | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'program/include') diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php index 5dd9c1250..66b5c4bd6 100644 --- a/program/include/rcube_imap.php +++ b/program/include/rcube_imap.php @@ -2222,6 +2222,10 @@ class rcube_imap extends rcube_storage $folder = $this->folder; } + if (!$this->check_connection()) { + return false; + } + // make sure folder exists if ($this->folder_exists($folder)) { if ($is_file) { diff --git a/program/include/rcube_imap_generic.php b/program/include/rcube_imap_generic.php index 915a11aad..c3cfabc3a 100644 --- a/program/include/rcube_imap_generic.php +++ b/program/include/rcube_imap_generic.php @@ -2538,7 +2538,7 @@ class rcube_imap_generic { unset($this->data['APPENDUID']); - if (!$mailbox) { + if ($mailbox === null || $mailbox === '') { return false; } @@ -2603,7 +2603,7 @@ class rcube_imap_generic { unset($this->data['APPENDUID']); - if (!$mailbox) { + if ($mailbox === null || $mailbox === '') { return false; } @@ -2612,6 +2612,7 @@ class rcube_imap_generic if (file_exists(realpath($path))) { $in_fp = fopen($path, 'r'); } + if (!$in_fp) { $this->setError(self::ERROR_UNKNOWN, "Couldn't open $path for reading"); return false; -- cgit v1.2.3