summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2012-05-12 16:47:51 +0200
committerThomas Bruederli <bruederli@kolabsys.com>2012-05-12 16:47:51 +0200
commit5c6d1ac5a25550515a20b74c1986045127a87265 (patch)
tree46ccb174e481f842f2f18a5e9b27dd4cb2a435d7 /program
parent568e26c343e73d0d4e983342bf7b29bddb33715b (diff)
parent02cf44e1838aca64e14921d30dc44d25a4d73b1c (diff)
Merge branch 'release-0.8' of github.com:roundcube/roundcubemail into release-0.8
Diffstat (limited to 'program')
-rw-r--r--program/include/rcmail.php2
-rw-r--r--program/include/rcube_plugin.php38
-rw-r--r--program/js/app.js4
-rw-r--r--program/lib/washtml.php22
-rw-r--r--program/steps/addressbook/func.inc7
-rw-r--r--program/steps/mail/func.inc2
6 files changed, 54 insertions, 21 deletions
diff --git a/program/include/rcmail.php b/program/include/rcmail.php
index 65c48fabf..c0defa6d4 100644
--- a/program/include/rcmail.php
+++ b/program/include/rcmail.php
@@ -1167,7 +1167,7 @@ class rcmail
$this->texts = array_merge($this->texts, $messages);
// include user language files
- if ($lang != 'en' && is_dir(INSTALL_PATH . 'program/localization/' . $lang)) {
+ if ($lang != 'en' && $lang != 'en_US' && is_dir(INSTALL_PATH . 'program/localization/' . $lang)) {
include_once(INSTALL_PATH . 'program/localization/' . $lang . '/labels.inc');
include_once(INSTALL_PATH . 'program/localization/' . $lang . '/messages.inc');
diff --git a/program/include/rcube_plugin.php b/program/include/rcube_plugin.php
index aeb05afa1..0b872cf95 100644
--- a/program/include/rcube_plugin.php
+++ b/program/include/rcube_plugin.php
@@ -152,20 +152,48 @@ abstract class rcube_plugin
public function add_texts($dir, $add2client = false)
{
$domain = $this->ID;
-
- $lang = $_SESSION['language'];
+ $lang = $_SESSION['language'];
+ $langs = array_unique(array('en_US', $lang));
$locdir = slashify(realpath(slashify($this->home) . $dir));
- $texts = array();
+ $texts = array();
+
+ // Language aliases used to find localization in similar lang, see below
+ $aliases = array(
+ 'de_CH' => 'de_DE',
+ 'es_AR' => 'es_ES',
+ 'fa_AF' => 'fa_IR',
+ 'nl_BE' => 'nl_NL',
+ 'pt_BR' => 'pt_PT',
+ 'zh_CN' => 'zh_TW',
+ );
// use buffering to handle empty lines/spaces after closing PHP tag
ob_start();
- foreach (array('en_US', $lang) as $lng) {
+ foreach ($langs as $lng) {
$fpath = $locdir . $lng . '.inc';
if (is_file($fpath) && is_readable($fpath)) {
- include($fpath);
+ include $fpath;
$texts = (array)$labels + (array)$messages + (array)$texts;
}
+ else if ($lng != 'en_US') {
+ // Find localization in similar language (#1488401)
+ $alias = null;
+ if (!empty($aliases[$lng])) {
+ $alias = $aliases[$lng];
+ }
+ else if ($key = array_search($lng, $aliases)) {
+ $alias = $key;
+ }
+
+ if (!empty($alias)) {
+ $fpath = $locdir . $alias . '.inc';
+ if (is_file($fpath) && is_readable($fpath)) {
+ include $fpath;
+ $texts = (array)$labels + (array)$messages + (array)$texts;
+ }
+ }
+ }
}
ob_end_clean();
diff --git a/program/js/app.js b/program/js/app.js
index 72a277797..cb2727523 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -766,7 +766,7 @@ function rcube_webmail()
case 'always-load':
if (this.env.uid && this.env.sender) {
- this.add_contact(urlencode(this.env.sender));
+ this.add_contact(this.env.sender);
setTimeout(function(){ ref.command('load-images'); }, 300);
break;
}
@@ -3527,7 +3527,7 @@ function rcube_webmail()
this.add_contact = function(value)
{
if (value)
- this.http_post('addcontact', '_address='+value);
+ this.http_post('addcontact', {_address: value});
return true;
};
diff --git a/program/lib/washtml.php b/program/lib/washtml.php
index 04a65c7a1..4221abdef 100644
--- a/program/lib/washtml.php
+++ b/program/lib/washtml.php
@@ -101,14 +101,14 @@ class washtml
'cellpadding', 'valign', 'bgcolor', 'color', 'border', 'bordercolorlight',
'bordercolordark', 'face', 'marginwidth', 'marginheight', 'axis', 'border',
'abbr', 'char', 'charoff', 'clear', 'compact', 'coords', 'vspace', 'hspace',
- 'cellborder', 'size', 'lang', 'dir',
+ 'cellborder', 'size', 'lang', 'dir', 'usemap',
// attributes of form elements
'type', 'rows', 'cols', 'disabled', 'readonly', 'checked', 'multiple', 'value'
);
/* Block elements which could be empty but cannot be returned in short form (<tag />) */
static $block_elements = array('div', 'p', 'pre', 'blockquote', 'a', 'font', 'center',
- 'table', 'ul', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'ol', 'dl', 'strong', 'i', 'b', 'u');
+ 'table', 'ul', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'ol', 'dl', 'strong', 'i', 'b', 'u', 'span');
/* State for linked objects in HTML */
public $extlinks = false;
@@ -133,7 +133,8 @@ class washtml
/* Constructor */
- public function __construct($p = array()) {
+ public function __construct($p = array())
+ {
$this->_html_elements = array_flip((array)$p['html_elements']) + array_flip(self::$html_elements) ;
$this->_html_attribs = array_flip((array)$p['html_attribs']) + array_flip(self::$html_attribs);
$this->_ignore_elements = array_flip((array)$p['ignore_elements']) + array_flip(self::$ignore_elements);
@@ -149,7 +150,8 @@ class washtml
}
/* Check CSS style */
- private function wash_style($style) {
+ private function wash_style($style)
+ {
$s = '';
foreach (explode(';', $style) as $declaration) {
@@ -191,7 +193,8 @@ class washtml
}
/* Take a node and return allowed attributes and check values */
- private function wash_attribs($node) {
+ private function wash_attribs($node)
+ {
$t = '';
$washed;
@@ -231,7 +234,8 @@ class washtml
/* The main loop that recurse on a node tree.
* It output only allowed tags with allowed attributes
* and allowed inline styles */
- private function dumpHtml($node) {
+ private function dumpHtml($node)
+ {
if(!$node->hasChildNodes())
return '';
@@ -248,9 +252,7 @@ class washtml
else if (isset($this->_html_elements[$tagName])) {
$content = $this->dumpHtml($node);
$dump .= '<' . $tagName . $this->wash_attribs($node) .
- // create closing tag for block elements, but also for elements
- // with content or with some attributes (eg. style, class) (#1486812)
- ($content != '' || $node->hasAttributes() || isset($this->_block_elements[$tagName]) ? ">$content</$tagName>" : ' />');
+ ($content != '' || isset($this->_block_elements[$tagName]) ? ">$content</$tagName>" : ' />');
}
else if (isset($this->_ignore_elements[$tagName])) {
$dump .= '<!-- ' . htmlspecialchars($tagName, ENT_QUOTES) . ' not allowed -->';
@@ -310,5 +312,3 @@ class washtml
}
}
-
-?>
diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc
index a31370b16..bd3819436 100644
--- a/program/steps/addressbook/func.inc
+++ b/program/steps/addressbook/func.inc
@@ -593,7 +593,12 @@ function rcmail_contact_form($form, $record, $attrib = null)
$composite = array(); $j = 0;
$template = $RCMAIL->config->get($col . '_template', '{'.join('} {', array_keys($colprop['childs'])).'}');
foreach ($colprop['childs'] as $childcol => $cp) {
- $childvalue = $val[$childcol] ? $val[$childcol] : $val[$j];
+ if (!empty($val) && is_array($val)) {
+ $childvalue = $val[$childcol] ? $val[$childcol] : $val[$j];
+ }
+ else {
+ $childvalue = '';
+ }
if ($edit_mode) {
if ($colprop['subtypes'] || $colprop['limit'] != 1) $cp['array'] = true;
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index aeb917bd7..854298d8b 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -1330,7 +1330,7 @@ function rcmail_address_string($input, $max=null, $linked=false, $addicon=null,
if ($addicon && $_SESSION['writeable_abook']) {
$address = html::span(null, $address . html::a(array(
'href' => "#add",
- 'onclick' => sprintf("return %s.command('add-contact','%s',this)", JS_OBJECT_NAME, urlencode($string)),
+ 'onclick' => sprintf("return %s.command('add-contact','%s',this)", JS_OBJECT_NAME, $string),
'title' => rcube_label('addtoaddressbook'),
'class' => 'rcmaddcontact',
),