summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2015-02-26 18:04:03 +0100
committerAleksander Machniak <alec@alec.pl>2015-02-26 18:04:03 +0100
commitb59b72cc3028cc0514e951f135d8bfe7efcaaa6f (patch)
treee94a5312c4e73cf7b3e470dd8f2c15f079c3118d /plugins
parent2a31f6dbd7c63232918d175fb2879682217946ea (diff)
Fix "Non-static method PEAR::isError() should not be called statically" errors (#1490281)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/managesieve/lib/Roundcube/rcube_sieve.php93
-rw-r--r--plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php5
-rw-r--r--plugins/password/drivers/ldap.php6
-rw-r--r--plugins/password/drivers/poppassd.php2
-rw-r--r--plugins/password/drivers/vpopmaild.php9
5 files changed, 77 insertions, 38 deletions
diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve.php b/plugins/managesieve/lib/Roundcube/rcube_sieve.php
index 389c85012..59a7bc134 100644
--- a/plugins/managesieve/lib/Roundcube/rcube_sieve.php
+++ b/plugins/managesieve/lib/Roundcube/rcube_sieve.php
@@ -68,7 +68,9 @@ class rcube_sieve
$this->sieve->setDebug(true, array($this, 'debug_handler'));
}
- if (PEAR::isError($this->sieve->connect($host, $port, $options, $usetls))) {
+ $result = $this->sieve->connect($host, $port, $options, $usetls);
+
+ if (is_a($result, 'PEAR_Error')) {
return $this->_set_error(self::ERROR_CONNECTION);
}
@@ -78,9 +80,9 @@ class rcube_sieve
$password = $auth_pw;
}
- if (PEAR::isError($this->sieve->login($username, $password,
- $auth_type ? strtoupper($auth_type) : null, $authz))
- ) {
+ $result = $this->sieve->login($username, $password, $auth_type ? strtoupper($auth_type) : null, $authz);
+
+ if (is_a($result, 'PEAR_Error')) {
return $this->_set_error(self::ERROR_LOGIN);
}
@@ -115,22 +117,28 @@ class rcube_sieve
*/
public function save($name = null)
{
- if (!$this->sieve)
+ if (!$this->sieve) {
return $this->_set_error(self::ERROR_INTERNAL);
+ }
- if (!$this->script)
+ if (!$this->script) {
return $this->_set_error(self::ERROR_INTERNAL);
+ }
- if (!$name)
+ if (!$name) {
$name = $this->current;
+ }
$script = $this->script->as_text();
- if (!$script)
+ if (!$script) {
$script = '/* empty script */';
+ }
- if (PEAR::isError($this->sieve->installScript($name, $script)))
+ $result = $this->sieve->installScript($name, $script);
+ if (is_a($result, 'PEAR_Error')) {
return $this->_set_error(self::ERROR_INSTALL);
+ }
return true;
}
@@ -140,14 +148,19 @@ class rcube_sieve
*/
public function save_script($name, $content = null)
{
- if (!$this->sieve)
+ if (!$this->sieve) {
return $this->_set_error(self::ERROR_INTERNAL);
+ }
- if (!$content)
+ if (!$content) {
$content = '/* empty script */';
+ }
+
+ $result = $this->sieve->installScript($name, $content);
- if (PEAR::isError($this->sieve->installScript($name, $content)))
+ if (is_a($result, 'PEAR_Error')) {
return $this->_set_error(self::ERROR_INSTALL);
+ }
return true;
}
@@ -157,14 +170,19 @@ class rcube_sieve
*/
public function activate($name = null)
{
- if (!$this->sieve)
+ if (!$this->sieve) {
return $this->_set_error(self::ERROR_INTERNAL);
+ }
- if (!$name)
+ if (!$name) {
$name = $this->current;
+ }
- if (PEAR::isError($this->sieve->setActive($name)))
+ $result = $this->sieve->setActive($name);
+
+ if (is_a($result, 'PEAR_Error')) {
return $this->_set_error(self::ERROR_ACTIVATE);
+ }
return true;
}
@@ -174,11 +192,15 @@ class rcube_sieve
*/
public function deactivate()
{
- if (!$this->sieve)
+ if (!$this->sieve) {
return $this->_set_error(self::ERROR_INTERNAL);
+ }
+
+ $result = $this->sieve->setActive('');
- if (PEAR::isError($this->sieve->setActive('')))
+ if (is_a($result, 'PEAR_Error')) {
return $this->_set_error(self::ERROR_DEACTIVATE);
+ }
return true;
}
@@ -188,22 +210,32 @@ class rcube_sieve
*/
public function remove($name = null)
{
- if (!$this->sieve)
+ if (!$this->sieve) {
return $this->_set_error(self::ERROR_INTERNAL);
+ }
- if (!$name)
+ if (!$name) {
$name = $this->current;
+ }
// script must be deactivated first
- if ($name == $this->sieve->getActive())
- if (PEAR::isError($this->sieve->setActive('')))
+ if ($name == $this->sieve->getActive()) {
+ $result = $this->sieve->setActive('');
+
+ if (is_a($result, 'PEAR_Error')) {
return $this->_set_error(self::ERROR_DELETE);
+ }
+ }
+
+ $result = $this->sieve->removeScript($name);
- if (PEAR::isError($this->sieve->removeScript($name)))
+ if (is_a($result, 'PEAR_Error')) {
return $this->_set_error(self::ERROR_DELETE);
+ }
- if ($name == $this->current)
+ if ($name == $this->current) {
$this->current = null;
+ }
return true;
}
@@ -221,7 +253,7 @@ class rcube_sieve
$ext = $this->sieve->getExtensions();
- if (PEAR::isError($ext)) {
+ if (is_a($ext, 'PEAR_Error')) {
return array();
}
@@ -250,8 +282,9 @@ class rcube_sieve
$list = $this->sieve->listScripts();
- if (PEAR::isError($list))
+ if (is_a($list, 'PEAR_Error')) {
return $this->_set_error(self::ERROR_OTHER);
+ }
$this->list = $list;
}
@@ -283,8 +316,9 @@ class rcube_sieve
$script = $this->sieve->getScript($name);
- if (PEAR::isError($script))
+ if (is_a($script, 'PEAR_Error')) {
return $this->_set_error(self::ERROR_OTHER);
+ }
// try to parse from Roundcube format
$this->script = $this->_parse($script);
@@ -349,8 +383,9 @@ class rcube_sieve
$content = $this->sieve->getScript($name);
- if (PEAR::isError($content))
+ if (is_a($content, 'PEAR_Error')) {
return $this->_set_error(self::ERROR_OTHER);
+ }
return $content;
}
@@ -366,10 +401,12 @@ class rcube_sieve
if ($copy) {
$content = $this->sieve->getScript($copy);
- if (PEAR::isError($content))
+ if (is_a($content, 'PEAR_Error')) {
return $this->_set_error(self::ERROR_OTHER);
+ }
}
+
return $this->save_script($name, $content);
}
diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
index 69ae4b8a6..98c4c952c 100644
--- a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
+++ b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
@@ -390,10 +390,11 @@ class rcube_sieve_engine
}
else if ($action == 'setget') {
$script_name = rcube_utils::get_input_value('_set', rcube_utils::INPUT_GPC, true);
- $script = $this->sieve->get_script($script_name);
+ $script = $this->sieve->get_script($script_name);
- if (PEAR::isError($script))
+ if (is_a($script, 'PEAR_Error')) {
exit;
+ }
$browser = new rcube_browser;
diff --git a/plugins/password/drivers/ldap.php b/plugins/password/drivers/ldap.php
index c18ff0f06..a11c38d17 100644
--- a/plugins/password/drivers/ldap.php
+++ b/plugins/password/drivers/ldap.php
@@ -75,7 +75,7 @@ class rcube_ldap_password
$ldap = Net_LDAP2::connect($ldapConfig);
// Checking for connection error
- if (PEAR::isError($ldap)) {
+ if (is_a($ldap, 'PEAR_Error')) {
return PASSWORD_CONNECT_ERROR;
}
@@ -176,7 +176,7 @@ class rcube_ldap_password
$ldap = Net_LDAP2::connect($ldapConfig);
- if (PEAR::isError($ldap)) {
+ if (is_a($ldap, 'PEAR_Error')) {
return '';
}
@@ -189,7 +189,7 @@ class rcube_ldap_password
$result = $ldap->search($base, $filter, $options);
$ldap->done();
- if (PEAR::isError($result) || ($result->count() != 1)) {
+ if (is_a($result, 'PEAR_Error') || ($result->count() != 1)) {
return '';
}
diff --git a/plugins/password/drivers/poppassd.php b/plugins/password/drivers/poppassd.php
index 8ddbef5d3..7a2821083 100644
--- a/plugins/password/drivers/poppassd.php
+++ b/plugins/password/drivers/poppassd.php
@@ -42,7 +42,7 @@ class rcube_poppassd_password
$poppassd = new Net_Socket();
$result = $poppassd->connect($rcmail->config->get('password_pop_host'), $rcmail->config->get('password_pop_port'), null);
- if (PEAR::isError($result)) {
+ if (is_a($result, 'PEAR_Error')) {
return $this->format_error_result(PASSWORD_CONNECT_ERROR, $result->getMessage());
}
else {
diff --git a/plugins/password/drivers/vpopmaild.php b/plugins/password/drivers/vpopmaild.php
index a7644fc21..90fce02c5 100644
--- a/plugins/password/drivers/vpopmaild.php
+++ b/plugins/password/drivers/vpopmaild.php
@@ -28,12 +28,13 @@ class rcube_vpopmaild_password
{
function save($curpass, $passwd)
{
- $rcmail = rcmail::get_instance();
- // include('Net/Socket.php');
+ $rcmail = rcmail::get_instance();
$vpopmaild = new Net_Socket();
+ $host = $rcmail->config->get('password_vpopmaild_host');
+ $port = $rcmail->config->get('password_vpopmaild_port');
- if (PEAR::isError($vpopmaild->connect($rcmail->config->get('password_vpopmaild_host'),
- $rcmail->config->get('password_vpopmaild_port'), null))) {
+ $result = $vpopmaild->connect($hostname, $port, null);
+ if (is_a($result, 'PEAR_Error')) {
return PASSWORD_CONNECT_ERROR;
}