summaryrefslogtreecommitdiff
path: root/program/include
diff options
context:
space:
mode:
Diffstat (limited to 'program/include')
-rw-r--r--program/include/rcube_charset.php6
-rw-r--r--program/include/rcube_imap.php4
-rw-r--r--program/include/rcube_imap_generic.php5
-rw-r--r--program/include/rcube_message.php26
-rw-r--r--program/include/rcube_output_html.php31
-rw-r--r--program/include/rcube_shared.inc2
-rw-r--r--program/include/rcube_storage.php2
7 files changed, 63 insertions, 13 deletions
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;
}
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;
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_output_html.php b/program/include/rcube_output_html.php
index a071ee354..2743e7705 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;
}
@@ -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['id']);
+ $this->set_env('blankpage', $attrib['src'] ? $this->abs_url($attrib['src']) : 'program/resources/blank.gif');
+
+ return html::iframe($attrib);
+ }
+
+
/* ************* common functions delivering gui objects ************** */
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_(.+)/',
@@ -431,7 +430,6 @@ function rcube_autoload($classname)
),
array(
'Mail/\\1',
- 'Mail/\\1',
'Net/\\1',
'Auth/\\1',
'html',
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;
}