From cb4149cc6cf9d440d07b389591954b4b03a1f82f Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Mon, 10 Aug 2015 14:56:01 -0400
Subject: [PATCH] Merge branch 'master' of github.com:roundcube/roundcubemail
---
CHANGELOG | 1 +
program/lib/Roundcube/rcube_vcard.php | 5 -----
program/lib/Roundcube/rcube_washtml.php | 3 +++
plugins/password/drivers/cpanel.php | 32 ++++++++++++++++++--------------
program/localization/index.inc | 1 +
tests/Framework/Washtml.php | 8 ++++++++
6 files changed, 31 insertions(+), 19 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index ba56486..1526726 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -37,6 +37,7 @@
- Fix error when using back button after sending an email (#1490009)
- Fix removing signature when switching to identity with an empty sig in HTML mode (#1490470)
- Disable links list generation on html-to-text conversion of identities or composed message (#1490437)
+- Fix "washing" of style elements wrapped into many lines
RELEASE 1.1.2
-------------
diff --git a/plugins/password/drivers/cpanel.php b/plugins/password/drivers/cpanel.php
index 663c125..9446fde 100644
--- a/plugins/password/drivers/cpanel.php
+++ b/plugins/password/drivers/cpanel.php
@@ -49,20 +49,16 @@
$this->xmlapi->set_output('json');
$this->xmlapi->set_debug(0);
- if ($this->setPassword($_SESSION['username'], $newpass)) {
- return PASSWORD_SUCCESS;
- }
- else {
- return PASSWORD_ERROR;
- }
+ return $this->setPassword($_SESSION['username'], $newpass);
}
/**
* Change email account password
*
- * Returns true on success or false on failure.
- * @param string $password email account password
- * @return bool
+ * @param string $address Email address/username
+ * @param string $password Email account password
+ *
+ * @return int|array Operation status
*/
function setPassword($address, $password)
{
@@ -75,13 +71,21 @@
$data['password'] = $password;
- $query = $this->xmlapi->api2_query($this->cuser, 'Email', 'passwdpop', $data);
- $query = json_decode($query, true);
+ $query = $this->xmlapi->api2_query($this->cuser, 'Email', 'passwdpop', $data);
+ $query = json_decode($query, true);
+ $result = $query['cpanelresult']['data'][0];
- if ($query['cpanelresult']['data'][0]['result'] == 1) {
- return true;
+ if ($result['result'] == 1) {
+ return PASSWORD_SUCCESS;
}
- return false;
+ if ($result['reason']) {
+ return array(
+ 'code' => PASSWORD_ERROR,
+ 'message' => $result['reason'],
+ );
+ }
+
+ return PASSWORD_ERROR;
}
}
diff --git a/program/lib/Roundcube/rcube_vcard.php b/program/lib/Roundcube/rcube_vcard.php
index 798bbab..91815a6 100644
--- a/program/lib/Roundcube/rcube_vcard.php
+++ b/program/lib/Roundcube/rcube_vcard.php
@@ -124,11 +124,6 @@
$this->raw = self::charset_convert($this->raw, $detected_charset);
}
- // consider FN empty if the same as the primary e-mail address
- if ($this->raw['FN'][0][0] == $this->raw['EMAIL'][0][0]) {
- $this->raw['FN'][0][0] = '';
- }
-
// find well-known address fields
$this->displayname = $this->raw['FN'][0][0];
$this->surname = $this->raw['N'][0][0];
diff --git a/program/lib/Roundcube/rcube_washtml.php b/program/lib/Roundcube/rcube_washtml.php
index 061184e..f3b0720 100644
--- a/program/lib/Roundcube/rcube_washtml.php
+++ b/program/lib/Roundcube/rcube_washtml.php
@@ -174,6 +174,9 @@
{
$result = array();
+ // Remove unwanted white-space characters so regular expressions below work better
+ $style = preg_replace('/[\n\r\s\t]+/', ' ', $style);
+
foreach (explode(';', $style) as $declaration) {
if (preg_match('/^\s*([a-z\-]+)\s*:\s*(.*)\s*$/i', $declaration, $match)) {
$cssid = $match[1];
diff --git a/program/localization/index.inc b/program/localization/index.inc
index 38edb73..b1ea836 100644
--- a/program/localization/index.inc
+++ b/program/localization/index.inc
@@ -149,6 +149,7 @@
'ml' => 'ml_IN',
'ml_ML' => 'ml_IN',
'pl' => 'pl_PL',
+ 'tr' => 'tr_TR',
'tw' => 'zh_TW',
'si' => 'si_LK',
'sl' => 'sl_SI',
diff --git a/tests/Framework/Washtml.php b/tests/Framework/Washtml.php
index e4e3de4..acc611e 100644
--- a/tests/Framework/Washtml.php
+++ b/tests/Framework/Washtml.php
@@ -182,6 +182,14 @@
$this->assertRegExp('|line-height: 1;|', $washed, "Untouched line-height (#1489917)");
$this->assertRegExp('|; height: 10px|', $washed, "Fixed height units");
+
+ $html = "<div style=\"padding: 0px\n 20px;border:1px solid #000;\"></div>";
+ $expected = "<div style=\"padding: 0px 20px; border: 1px solid #000\"></div>";
+
+ $washer = new rcube_washtml;
+ $washed = $washer->wash($html);
+
+ $this->assertTrue(strpos($washed, $expected) !== false, "White-space and new-line characters handling");
}
/**
--
Gitblit v1.9.1