From 98cb0f179206843ceaa87df6bfb3d1da045ed8ad Mon Sep 17 00:00:00 2001 From: thomascube Date: Sat, 29 Jan 2011 14:55:12 +0000 Subject: Apply bug fixes and localization updated from trunk for release 0.5.1 --- program/include/iniset.php | 2 +- program/include/main.inc | 9 +- program/include/rcmail.php | 4 +- program/include/rcube_html_page.php | 86 +++---- program/include/rcube_imap.php | 95 +++++++- program/include/rcube_plugin_api.php | 3 +- program/include/rcube_template.php | 4 +- program/js/app.js | 33 ++- .../js/tiny_mce/themes/advanced/langs/sv_dlg.js | 4 +- program/lib/Net/IDNA2.php | 252 +++++++++++++++------ program/lib/Net/Socket.php | 209 +++++++++++------ program/localization/az_AZ/labels.inc | 53 ++++- program/localization/az_AZ/messages.inc | 27 +++ program/localization/bg_BG/labels.inc | 44 +++- program/localization/bg_BG/messages.inc | 13 ++ program/localization/da_DK/labels.inc | 54 ++++- program/localization/da_DK/messages.inc | 28 +++ program/localization/de_DE/labels.inc | 34 ++- program/localization/de_DE/messages.inc | 5 +- program/localization/fr_FR/labels.inc | 5 +- program/localization/fr_FR/messages.inc | 12 + program/localization/he_IL/labels.inc | 31 ++- program/localization/he_IL/messages.inc | 1 + program/localization/hu_HU/labels.inc | 2 +- program/localization/it_IT/labels.inc | 36 ++- program/localization/it_IT/messages.inc | 5 +- program/localization/ja_JP/labels.inc | 40 +++- program/localization/ja_JP/messages.inc | 3 +- program/localization/pt_PT/labels.inc | 29 +++ program/localization/pt_PT/messages.inc | 1 + program/localization/ru_RU/labels.inc | 31 ++- program/localization/ru_RU/messages.inc | 1 + program/localization/sk_SK/labels.inc | 22 +- program/localization/sk_SK/messages.inc | 27 +++ program/localization/sv_SE/labels.inc | 34 ++- program/localization/sv_SE/messages.inc | 1 + program/localization/zh_TW/labels.inc | 41 +++- program/localization/zh_TW/messages.inc | 13 ++ program/steps/addressbook/save.inc | 12 + program/steps/mail/func.inc | 36 ++- program/steps/settings/folders.inc | 17 +- program/steps/settings/func.inc | 1 - program/steps/settings/save_prefs.inc | 2 + 43 files changed, 1095 insertions(+), 267 deletions(-) (limited to 'program') diff --git a/program/include/iniset.php b/program/include/iniset.php index aeb4549fc..ac96880c3 100755 --- a/program/include/iniset.php +++ b/program/include/iniset.php @@ -36,7 +36,7 @@ foreach ($crit_opts as $optname => $optval) { } // application constants -define('RCMAIL_VERSION', '0.5'); +define('RCMAIL_VERSION', '0.5.1'); define('RCMAIL_CHARSET', 'UTF-8'); define('JS_OBJECT_NAME', 'rcmail'); define('RCMAIL_START', microtime(true)); diff --git a/program/include/main.inc b/program/include/main.inc index b61f8aea2..b8d27d68c 100644 --- a/program/include/main.inc +++ b/program/include/main.inc @@ -861,8 +861,8 @@ function rcmail_mod_css_styles($source, $container_id) $replacements = new rcube_string_replacer; // ignore the whole block if evil styles are detected - $stripped = preg_replace('/[^a-z\(:]/', '', rcmail_xss_entity_decode($source)); - if (preg_match('/expression|behavior|url\(|import/', $stripped)) + $stripped = preg_replace('/[^a-z\(:;]/', '', rcmail_xss_entity_decode($source)); + if (preg_match('/expression|behavior|url\(|import[^a]/', $stripped)) return '/* evil! */'; // remove css comments (sometimes used for some ugly hacks) @@ -1771,16 +1771,17 @@ function rcube_sess_unset($var_name=null) * Replaces hostname variables * * @param string $name Hostname + * @param string $host Optional IMAP hostname * @return string */ -function rcube_parse_host($name) +function rcube_parse_host($name, $host='') { // %n - host $n = preg_replace('/:\d+$/', '', $_SERVER['SERVER_NAME']); // %d - domain name without first part, e.g. %d=mail.domain.tld, %m=domain.tld $d = preg_replace('/^[^\.]+\./', '', $n); // %h - IMAP host - $h = $_SESSION['imap_host']; + $h = $_SESSION['imap_host'] ? $_SESSION['imap_host'] : $host; // %z - IMAP domain without first part, e.g. %h=imap.domain.tld, %z=domain.tld $z = preg_replace('/^[^\.]+\./', '', $h); diff --git a/program/include/rcmail.php b/program/include/rcmail.php index e4078a72f..e9f5b5fce 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -673,9 +673,9 @@ class rcmail // Check if we need to add domain if (!empty($config['username_domain']) && strpos($username, '@') === false) { if (is_array($config['username_domain']) && isset($config['username_domain'][$host])) - $username .= '@'.rcube_parse_host($config['username_domain'][$host]); + $username .= '@'.rcube_parse_host($config['username_domain'][$host], $host); else if (is_string($config['username_domain'])) - $username .= '@'.rcube_parse_host($config['username_domain']); + $username .= '@'.rcube_parse_host($config['username_domain'], $host); } // Convert username to lowercase. If IMAP backend diff --git a/program/include/rcube_html_page.php b/program/include/rcube_html_page.php index 06cb5cb56..9ac03d01f 100644 --- a/program/include/rcube_html_page.php +++ b/program/include/rcube_html_page.php @@ -28,11 +28,13 @@ class rcube_html_page { protected $scripts_path = ''; protected $script_files = array(); + protected $css_files = array(); protected $scripts = array(); protected $charset = RCMAIL_CHARSET; protected $script_tag_file = "\n"; protected $script_tag = ""; + protected $link_css_file = "\n"; protected $default_template = "\n\n\n"; protected $title = ''; @@ -61,6 +63,9 @@ class rcube_html_page if (in_array($file, $sa_files)) { return; } + + $sa_files[] = $file; + if (!is_array($this->script_files[$position])) { $this->script_files[$position] = array(); } @@ -82,6 +87,16 @@ class rcube_html_page } } + /** + * Link an external css file + * + * @param string File URL + */ + public function include_css($file) + { + $this->css_files[] = $file; + } + /** * Add HTML code to the page header * @@ -163,52 +178,53 @@ class rcube_html_page } // replace specialchars in content - $__page_title = Q($this->title, 'show', FALSE); - $__page_header = $__page_body = $__page_footer = ''; + $page_title = Q($this->title, 'show', FALSE); + $page_header = ''; + $page_footer = ''; // include meta tag with charset if (!empty($this->charset)) { if (!headers_sent()) { header('Content-Type: text/html; charset=' . $this->charset); } - $__page_header = 'charset . '" />'."\n"; + $page_header = 'charset . '" />'."\n"; } // definition of the code to be placed in the document header and footer if (is_array($this->script_files['head'])) { foreach ($this->script_files['head'] as $file) { - $__page_header .= sprintf($this->script_tag_file, $file); + $page_header .= sprintf($this->script_tag_file, $file); } } $head_script = $this->scripts['head_top'] . $this->scripts['head']; if (!empty($head_script)) { - $__page_header .= sprintf($this->script_tag, $head_script); + $page_header .= sprintf($this->script_tag, $head_script); } if (!empty($this->header)) { - $__page_header .= $this->header; + $page_header .= $this->header; } if (is_array($this->script_files['foot'])) { foreach ($this->script_files['foot'] as $file) { - $__page_footer .= sprintf($this->script_tag_file, $file); + $page_footer .= sprintf($this->script_tag_file, $file); } } if (!empty($this->scripts['foot'])) { - $__page_footer .= sprintf($this->script_tag, $this->scripts['foot']); + $page_footer .= sprintf($this->script_tag, $this->scripts['foot']); } if (!empty($this->footer)) { - $__page_footer .= $this->footer; + $page_footer .= $this->footer; } // find page header if ($hpos = stripos($output, '')) { - $__page_header .= "\n"; + $page_header .= "\n"; } else { if (!is_numeric($hpos)) { @@ -220,49 +236,43 @@ class rcube_html_page } $hpos++; } - $__page_header = "\n$__page_title\n$__page_header\n\n"; + $page_header = "\n$page_title\n$page_header\n\n"; } // add page hader if ($hpos) { - $output = substr($output,0,$hpos) . $__page_header . substr($output,$hpos,strlen($output)); + $output = substr($output,0,$hpos) . $page_header . substr($output,$hpos,strlen($output)); } else { - $output = $__page_header . $output; + $output = $page_header . $output; } - // find page body - if ($bpos = stripos($output, '')+7; - } - - // add page body - if ($bpos && $__page_body) { - $output = substr($output,0,$bpos) . "\n$__page_body\n" . substr($output,$bpos,strlen($output)); - } - - // find and add page footer + // add page footer if (($fpos = strripos($output, '')) || ($fpos = strripos($output, ''))) { - $output = substr($output, 0, $fpos) . "$__page_footer\n" . substr($output, $fpos); + $output = substr($output, 0, $fpos) . "$page_footer\n" . substr($output, $fpos); } else { - $output .= "\n".$__page_footer; + $output .= "\n".$page_footer; } - // reset those global vars - $__page_header = $__page_footer = ''; + // add css files in head, before scripts, for speed up with parallel downloads + if (!empty($this->css_files) && + (($pos = stripos($output, '