From c027ba7709a86c23038428de15ffed503e67c522 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Mon, 6 May 2013 12:07:05 +0200 Subject: Fix bugs caught by static analysis --- program/lib/Roundcube/rcube_addressbook.php | 3 +-- program/lib/Roundcube/rcube_db_mysql.php | 2 +- program/lib/Roundcube/rcube_imap.php | 4 ++-- program/lib/Roundcube/rcube_imap_generic.php | 8 ++++---- program/lib/Roundcube/rcube_spellchecker.php | 2 +- program/lib/Roundcube/rcube_vcard.php | 2 +- program/lib/utf8.class.php | 4 ++-- 7 files changed, 12 insertions(+), 13 deletions(-) (limited to 'program/lib') diff --git a/program/lib/Roundcube/rcube_addressbook.php b/program/lib/Roundcube/rcube_addressbook.php index 84bd4bfcd..a1b29c3da 100644 --- a/program/lib/Roundcube/rcube_addressbook.php +++ b/program/lib/Roundcube/rcube_addressbook.php @@ -535,7 +535,7 @@ abstract class rcube_addressbook */ public static function compose_contact_key($contact, $sort_col) { - $key = $contact[$sort_col] . ':' . $row['sourceid']; + $key = $contact[$sort_col] . ':' . $contact['sourceid']; // add email to a key to not skip contacts with the same name (#1488375) if (!empty($contact['email'])) { @@ -545,7 +545,6 @@ abstract class rcube_addressbook return $key; } - /** * Compare search value with contact data * diff --git a/program/lib/Roundcube/rcube_db_mysql.php b/program/lib/Roundcube/rcube_db_mysql.php index 8ab6403c8..de81ede98 100644 --- a/program/lib/Roundcube/rcube_db_mysql.php +++ b/program/lib/Roundcube/rcube_db_mysql.php @@ -147,7 +147,7 @@ class rcube_db_mysql extends rcube_db $result = $this->query('SHOW VARIABLES'); - while ($sql_arr = $this->fetch_array($result)) { + while ($row = $this->fetch_array($result)) { $this->variables[$row[0]] = $row[1]; } } diff --git a/program/lib/Roundcube/rcube_imap.php b/program/lib/Roundcube/rcube_imap.php index c67985186..696f485eb 100644 --- a/program/lib/Roundcube/rcube_imap.php +++ b/program/lib/Roundcube/rcube_imap.php @@ -981,7 +981,7 @@ class rcube_imap extends rcube_storage // use memory less expensive (and quick) method for big result set $index = clone $this->index('', $this->sort_field, $this->sort_order); // get messages uids for one page... - $index->slice($start_msg, min($cnt-$from, $this->page_size)); + $index->slice($from, min($cnt-$from, $this->page_size)); if ($slice) { $index->slice(-$slice, $slice); @@ -2727,7 +2727,7 @@ class rcube_imap extends rcube_storage // filter folders list according to rights requirements if ($rights && $this->get_capability('ACL')) { - $a_folders = $this->filter_rights($a_folders, $rights); + $a_mboxes = $this->filter_rights($a_mboxes, $rights); } // filter folders and sort them diff --git a/program/lib/Roundcube/rcube_imap_generic.php b/program/lib/Roundcube/rcube_imap_generic.php index db50ffbab..fd8b130db 100644 --- a/program/lib/Roundcube/rcube_imap_generic.php +++ b/program/lib/Roundcube/rcube_imap_generic.php @@ -1077,7 +1077,7 @@ class rcube_imap_generic } if (!$this->data['READ-WRITE']) { - $this->setError(self::ERROR_READONLY, "Mailbox is read-only", 'EXPUNGE'); + $this->setError(self::ERROR_READONLY, "Mailbox is read-only"); return false; } @@ -1936,7 +1936,7 @@ class rcube_imap_generic } if (!$this->data['READ-WRITE']) { - $this->setError(self::ERROR_READONLY, "Mailbox is read-only", 'STORE'); + $this->setError(self::ERROR_READONLY, "Mailbox is read-only"); return false; } @@ -1997,7 +1997,7 @@ class rcube_imap_generic } if (!$this->data['READ-WRITE']) { - $this->setError(self::ERROR_READONLY, "Mailbox is read-only", 'STORE'); + $this->setError(self::ERROR_READONLY, "Mailbox is read-only"); return false; } @@ -2508,7 +2508,7 @@ class rcube_imap_generic $tokens = $this->tokenizeResponse(preg_replace('/(^\(|\)$)/', '', $line)); for ($i=0; $irc->db->query( + $sql_result = $this->rc->db->query( "SELECT data FROM ".$this->rc->db->table_name('dictionary') ." WHERE user_id ". ($plugin['userid'] ? "= ".$this->rc->db->quote($plugin['userid']) : "IS NULL") ." AND " . $this->rc->db->quoteIdentifier('language') . " = ?", diff --git a/program/lib/Roundcube/rcube_vcard.php b/program/lib/Roundcube/rcube_vcard.php index cc3a35850..aded4aa78 100644 --- a/program/lib/Roundcube/rcube_vcard.php +++ b/program/lib/Roundcube/rcube_vcard.php @@ -90,7 +90,7 @@ class rcube_vcard */ public function __construct($vcard = null, $charset = RCUBE_CHARSET, $detect = false, $fieldmap = array()) { - if (!empty($fielmap)) { + if (!empty($fieldmap)) { $this->extend_fieldmap($fieldmap); } diff --git a/program/lib/utf8.class.php b/program/lib/utf8.class.php index e0dc9e2bd..0446159c7 100644 --- a/program/lib/utf8.class.php +++ b/program/lib/utf8.class.php @@ -60,8 +60,8 @@ Class utf8 { function loadCharset($charset) { $charset = preg_replace(array('/^WINDOWS-*125([0-8])$/', '/^CP-/'), array('CP125\\1', 'CP'), $charset); - if (isset($aliases[$charset])) - $charset = $aliases[$charset]; + if (isset($this->aliases[$charset])) + $charset = $this->aliases[$charset]; $this->charset = $charset; -- cgit v1.2.3