diff options
author | alecpl <alec@alec.pl> | 2011-08-31 12:49:44 +0000 |
---|---|---|
committer | alecpl <alec@alec.pl> | 2011-08-31 12:49:44 +0000 |
commit | b08caf5813c43e8648cdf5db1e003b3046a37c2c (patch) | |
tree | e87f3c8cd0802c550459f26de1473bbcd4107131 /program/include | |
parent | fd6146b6780c526a04682cda89b133e2d9bbd910 (diff) |
- Applied fixes from trunk up to r5150
Diffstat (limited to 'program/include')
-rw-r--r-- | program/include/main.inc | 26 | ||||
-rw-r--r-- | program/include/rcmail.php | 7 | ||||
-rw-r--r-- | program/include/rcube_config.php | 13 | ||||
-rw-r--r-- | program/include/rcube_html_page.php | 10 | ||||
-rw-r--r-- | program/include/rcube_imap.php | 9 | ||||
-rw-r--r-- | program/include/rcube_message.php | 12 | ||||
-rw-r--r-- | program/include/rcube_plugin_api.php | 2 |
7 files changed, 45 insertions, 34 deletions
diff --git a/program/include/main.inc b/program/include/main.inc index 0401fe2c1..7e85e01fb 100644 --- a/program/include/main.inc +++ b/program/include/main.inc @@ -1021,7 +1021,7 @@ function rcube_strtotime($date) */ function format_date($date, $format=NULL) { - global $CONFIG; + global $RCMAIL, $CONFIG; $ts = NULL; @@ -1032,13 +1032,7 @@ function format_date($date, $format=NULL) return ''; // get user's timezone - if ($CONFIG['timezone'] === 'auto') - $tz = isset($_SESSION['timezone']) ? $_SESSION['timezone'] : date('Z')/3600; - else { - $tz = $CONFIG['timezone']; - if ($CONFIG['dst_active']) - $tz++; - } + $tz = $RCMAIL->config->get_timezone(); // convert time to user's timezone $timestamp = $ts - date('Z', $ts) + ($tz * 3600); @@ -1659,12 +1653,13 @@ function rcmail_replace_emoticons($html) * @param string $from Sender address string * @param array $mailto Array of recipient address strings * @param array $smtp_error SMTP error array (reference) - * @param string $body_file Location of file with saved message body (reference) + * @param string $body_file Location of file with saved message body (reference), + * used when delay_file_io is enabled * @param array $smtp_opts SMTP options (e.g. DSN request) * * @return boolean Send status. */ -function rcmail_deliver_message(&$message, $from, $mailto, &$smtp_error, &$body_file, $smtp_opts=null) +function rcmail_deliver_message(&$message, $from, $mailto, &$smtp_error, &$body_file=null, $smtp_opts=null) { global $CONFIG, $RCMAIL; @@ -1823,17 +1818,10 @@ function rcmail_gen_message_id() // Returns RFC2822 formatted current date in user's timezone function rcmail_user_date() { - global $CONFIG; + global $RCMAIL, $CONFIG; // get user's timezone - if ($CONFIG['timezone'] === 'auto') { - $tz = isset($_SESSION['timezone']) ? $_SESSION['timezone'] : date('Z')/3600; - } - else { - $tz = $CONFIG['timezone']; - if ($CONFIG['dst_active']) - $tz++; - } + $tz = $RCMAIL->config->get_timezone(); $date = time() + $tz * 60 * 60; $date = gmdate('r', $date); diff --git a/program/include/rcmail.php b/program/include/rcmail.php index 1e13624d7..03b536b3e 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -413,7 +413,10 @@ class rcmail $id = '0'; // use existing instance - if (isset($this->address_books[$id]) && is_a($this->address_books[$id], 'rcube_addressbook') && (!$writeable || !$this->address_books[$id]->readonly)) { + if (isset($this->address_books[$id]) && is_object($this->address_books[$id]) + && is_a($this->address_books[$id], 'rcube_addressbook') + && (!$writeable || !$this->address_books[$id]->readonly) + ) { $contacts = $this->address_books[$id]; } else if ($id && $ldap_config[$id]) { @@ -1183,7 +1186,7 @@ class rcmail $this->smtp->disconnect(); foreach ($this->address_books as $book) { - if (is_a($book, 'rcube_addressbook')) + if (is_object($book) && is_a($book, 'rcube_addressbook')) $book->close(); } diff --git a/program/include/rcube_config.php b/program/include/rcube_config.php index 9379e9e7b..31b7ed6b7 100644 --- a/program/include/rcube_config.php +++ b/program/include/rcube_config.php @@ -220,6 +220,19 @@ class rcube_config return $this->prop; } + /** + * Special getter for user's timezone + */ + public function get_timezone() + { + $tz = $this->get('timezone'); + if ($tz == 'auto') + $tz = isset($_SESSION['timezone']) ? $_SESSION['timezone'] : date('Z') / 3600; + else + $tz = intval($tz) + intval($this->get('dst_active')); + + return $tz; + } /** * Return requested DES crypto key. diff --git a/program/include/rcube_html_page.php b/program/include/rcube_html_page.php index 200233c5d..21301e331 100644 --- a/program/include/rcube_html_page.php +++ b/program/include/rcube_html_page.php @@ -212,7 +212,7 @@ class rcube_html_page if (!empty($this->scripts['docready'])) { $this->add_script('$(document).ready(function(){ ' . $this->scripts['docready'] . "\n});", 'foot'); } - + if (is_array($this->script_files['foot'])) { foreach ($this->script_files['foot'] as $file) { $page_footer .= sprintf($this->script_tag_file, $file); @@ -246,7 +246,7 @@ class rcube_html_page // add page hader if ($hpos) { - $output = substr($output,0,$hpos) . $page_header . substr($output,$hpos,strlen($output)); + $output = substr_replace($output, $page_header, $hpos, 0); } else { $output = $page_header . $output; @@ -254,7 +254,7 @@ class rcube_html_page // add page footer if (($fpos = strripos($output, '</body>')) || ($fpos = strripos($output, '</html>'))) { - $output = substr($output, 0, $fpos) . "$page_footer\n" . substr($output, $fpos); + $output = substr_replace($output, $page_footer."\n", $fpos, 0); } else { $output .= "\n".$page_footer; @@ -268,7 +268,7 @@ class rcube_html_page foreach ($this->css_files as $file) { $css .= sprintf($this->link_css_file, $file); } - $output = substr($output, 0, $pos) . $css . substr($output, $pos); + $output = substr_replace($output, $css, $pos, 0); } $this->base_path = $base_path; @@ -289,7 +289,7 @@ class rcube_html_page echo $hook['content']; } } - + /** * Callback function for preg_replace_callback in write() * diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php index 6a35af0a8..1b311127c 100644 --- a/program/include/rcube_imap.php +++ b/program/include/rcube_imap.php @@ -3074,6 +3074,9 @@ class rcube_imap if (isset($data['folders'])) { $a_folders = $data['folders']; } + else if (!$this->conn->connected()) { + return array(); + } else { // Server supports LIST-EXTENDED, we can use selection options $config = rcmail::get_instance()->config; @@ -3834,13 +3837,13 @@ class rcube_imap /** * Enable or disable indexes caching * - * @param boolean $type Cache type (@see rcmail::get_cache) + * @param string $type Cache type (@see rcmail::get_cache) * @access public */ function set_caching($type) { if ($type) { - $this->caching = true; + $this->caching = $type; } else { if ($this->cache) @@ -3857,7 +3860,7 @@ class rcube_imap { if ($this->caching && !$this->cache) { $rcmail = rcmail::get_instance(); - $this->cache = $rcmail->get_cache('IMAP', $type); + $this->cache = $rcmail->get_cache('IMAP', $this->caching); } return $this->cache; diff --git a/program/include/rcube_message.php b/program/include/rcube_message.php index 4f9a2f230..4e2595550 100644 --- a/program/include/rcube_message.php +++ b/program/include/rcube_message.php @@ -286,7 +286,7 @@ class rcube_message if ($message_ctype_primary == 'text' && !$recursive) { $structure->type = 'content'; $this->parts[] = &$structure; - + // Parse simple (plain text) message body if ($message_ctype_secondary == 'plain') foreach ((array)$this->uu_decode($structure) as $uupart) { @@ -306,7 +306,7 @@ class rcube_message foreach ($structure->parts as $p => $sub_part) { $sub_mimetype = $sub_part->mimetype; - + // check if sub part is if ($sub_mimetype == 'text/plain') $plain_part = $p; @@ -323,7 +323,7 @@ class rcube_message $this->parse_alternative = true; $this->parse_structure($structure->parts[$related_part], true); $this->parse_alternative = false; - + // if plain part was found, we should unset it if html is preferred if ($this->opt['prefer_html'] && count($this->parts)) $plain_part = null; @@ -432,7 +432,7 @@ class rcube_message $this->attachments[] = $mail_part; } // part message/* - else if ($primary_type=='message') { + else if ($primary_type == 'message') { $this->parse_structure($mail_part, true); // list as attachment as well (mostly .eml) @@ -496,6 +496,10 @@ class rcube_message $this->attachments[] = $mail_part; } } + // attachment part as message/rfc822 (#1488026) + else if ($mail_part->mimetype == 'message/rfc822') { + $this->parse_structure($mail_part); + } } // if this was a related part try to resolve references diff --git a/program/include/rcube_plugin_api.php b/program/include/rcube_plugin_api.php index cfba7fa78..0e38a3101 100644 --- a/program/include/rcube_plugin_api.php +++ b/program/include/rcube_plugin_api.php @@ -176,7 +176,7 @@ class rcube_plugin_api if (is_subclass_of($plugin, 'rcube_plugin')) { // ... task, request type and framed mode if ((!$plugin->task || preg_match('/^('.$plugin->task.')$/i', $rcmail->task)) - && (!$plugin->noajax || is_a($rcmail->output, 'rcube_template')) + && (!$plugin->noajax || (is_object($rcmail->output) && is_a($rcmail->output, 'rcube_template'))) && (!$plugin->noframe || empty($_REQUEST['_framed'])) ) { $plugin->init(); |