diff options
author | Aleksander Machniak <alec@alec.pl> | 2014-11-16 14:04:53 +0100 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2014-11-16 14:04:53 +0100 |
commit | 9e4246d9571481fe7b80227b1e23dc013771c5af (patch) | |
tree | a051a22d8ecda4a648adcfe11504648f57f60e2a /program | |
parent | 07280e764357fe844c18beb9ada772956735b49e (diff) |
Code improvements and fixes (mostly unused variables and methods)
Diffstat (limited to 'program')
-rw-r--r-- | program/include/rcmail_install.php | 2 | ||||
-rw-r--r-- | program/lib/Roundcube/bootstrap.php | 4 | ||||
-rw-r--r-- | program/lib/Roundcube/rcube_base_replacer.php | 9 | ||||
-rw-r--r-- | program/lib/Roundcube/rcube_charset.php | 1 | ||||
-rw-r--r-- | program/lib/Roundcube/rcube_contacts.php | 4 | ||||
-rw-r--r-- | program/lib/Roundcube/rcube_content_filter.php | 2 | ||||
-rw-r--r-- | program/lib/Roundcube/rcube_db_oracle.php | 4 | ||||
-rw-r--r-- | program/lib/Roundcube/rcube_imap_generic.php | 4 | ||||
-rw-r--r-- | program/lib/Roundcube/rcube_imap_search.php | 2 | ||||
-rw-r--r-- | program/lib/Roundcube/rcube_ldap.php | 18 | ||||
-rw-r--r-- | program/lib/Roundcube/rcube_message.php | 6 | ||||
-rw-r--r-- | program/lib/Roundcube/rcube_spellcheck_atd.php | 2 | ||||
-rw-r--r-- | program/lib/Roundcube/rcube_vcard.php | 3 |
13 files changed, 20 insertions, 41 deletions
diff --git a/program/include/rcmail_install.php b/program/include/rcmail_install.php index 7877b8e33..96e0afbd4 100644 --- a/program/include/rcmail_install.php +++ b/program/include/rcmail_install.php @@ -290,7 +290,7 @@ class rcmail_install $out = $seen = array(); // iterate over the current configuration - foreach ($this->config as $prop => $value) { + foreach (array_keys($this->config) as $prop) { if ($replacement = $this->replaced_config[$prop]) { $out['replaced'][] = array('prop' => $prop, 'replacement' => $replacement); $seen[$replacement] = true; diff --git a/program/lib/Roundcube/bootstrap.php b/program/lib/Roundcube/bootstrap.php index fe9c389fe..af87beb24 100644 --- a/program/lib/Roundcube/bootstrap.php +++ b/program/lib/Roundcube/bootstrap.php @@ -408,7 +408,7 @@ if (!extension_loaded('mbstring')) if (!function_exists('idn_to_utf8')) { - function idn_to_utf8($domain, $flags=null) + function idn_to_utf8($domain) { static $idn, $loaded; @@ -430,7 +430,7 @@ if (!function_exists('idn_to_utf8')) if (!function_exists('idn_to_ascii')) { - function idn_to_ascii($domain, $flags=null) + function idn_to_ascii($domain) { static $idn, $loaded; diff --git a/program/lib/Roundcube/rcube_base_replacer.php b/program/lib/Roundcube/rcube_base_replacer.php index fa6764753..a306086ee 100644 --- a/program/lib/Roundcube/rcube_base_replacer.php +++ b/program/lib/Roundcube/rcube_base_replacer.php @@ -61,9 +61,6 @@ class rcube_base_replacer */ public static function absolute_url($path, $base_url) { - $host_url = $base_url; - $abs_path = $path; - // check if path is an absolute URL if (preg_match('/^[fhtps]+:\/\//', $path)) { return $path; @@ -74,6 +71,9 @@ class rcube_base_replacer return $path; } + $host_url = $base_url; + $abs_path = $path; + // cut base_url to the last directory if (strrpos($base_url, '/') > 7) { $host_url = substr($base_url, 0, strpos($base_url, '/', 7)); @@ -89,7 +89,8 @@ class rcube_base_replacer $path = preg_replace('/^\.\//', '', $path); if (preg_match_all('/\.\.\//', $path, $matches, PREG_SET_ORDER)) { - foreach ($matches as $a_match) { + $cnt = count($matches); + while ($cnt--) { if ($pos = strrpos($base_url, '/')) { $base_url = substr($base_url, 0, $pos); } diff --git a/program/lib/Roundcube/rcube_charset.php b/program/lib/Roundcube/rcube_charset.php index 3e2dac19c..c15c3ad55 100644 --- a/program/lib/Roundcube/rcube_charset.php +++ b/program/lib/Roundcube/rcube_charset.php @@ -175,7 +175,6 @@ class rcube_charset static $iconv_options = null; static $mbstring_list = null; static $mbstring_sch = null; - static $conv = null; $to = empty($to) ? RCUBE_CHARSET : $to; $from = self::parse_charset($from); diff --git a/program/lib/Roundcube/rcube_contacts.php b/program/lib/Roundcube/rcube_contacts.php index bd3a3f82b..6ac9fd5de 100644 --- a/program/lib/Roundcube/rcube_contacts.php +++ b/program/lib/Roundcube/rcube_contacts.php @@ -909,7 +909,7 @@ class rcube_contacts extends rcube_addressbook $name, $gid, $this->user_id ); - return $this->db->affected_rows() ? $name : false; + return $this->db->affected_rows($sql_result) ? $name : false; } @@ -983,7 +983,7 @@ class rcube_contacts extends rcube_addressbook $group_id ); - return $this->db->affected_rows(); + return $this->db->affected_rows($sql_result); } diff --git a/program/lib/Roundcube/rcube_content_filter.php b/program/lib/Roundcube/rcube_content_filter.php index ae6617d1b..7d3d02970 100644 --- a/program/lib/Roundcube/rcube_content_filter.php +++ b/program/lib/Roundcube/rcube_content_filter.php @@ -33,7 +33,7 @@ class rcube_content_filter extends php_user_filter return true; } - function filter($in, $out, &$consumed, $closing) + function filter($in, $out, &$consumed) { while ($bucket = stream_bucket_make_writeable($in)) { $this->buffer .= $bucket->data; diff --git a/program/lib/Roundcube/rcube_db_oracle.php b/program/lib/Roundcube/rcube_db_oracle.php index 362beb075..453746446 100644 --- a/program/lib/Roundcube/rcube_db_oracle.php +++ b/program/lib/Roundcube/rcube_db_oracle.php @@ -171,7 +171,7 @@ class rcube_db_oracle extends rcube_db $mode = $this->in_transaction ? OCI_NO_AUTO_COMMIT : OCI_COMMIT_ON_SUCCESS; if ($result) { - foreach ($args as $param => $arg) { + foreach (array_keys($args) as $param) { oci_bind_by_name($result, $param, $args[$param], -1, SQLT_LNG); } } @@ -587,7 +587,7 @@ class rcube_db_oracle extends rcube_db $this->debug('ROLLBACK TRANSACTION'); - if ($result = @oci_rollback($this->dbh)) { + if (@oci_rollback($this->dbh)) { $this->in_transaction = false; } else { diff --git a/program/lib/Roundcube/rcube_imap_generic.php b/program/lib/Roundcube/rcube_imap_generic.php index d78b526dd..450dcdce2 100644 --- a/program/lib/Roundcube/rcube_imap_generic.php +++ b/program/lib/Roundcube/rcube_imap_generic.php @@ -1108,7 +1108,8 @@ class rcube_imap_generic // folder name with spaces. Let's try to handle this situation if (!is_array($items) && ($pos = strpos($response, '(')) !== false) { $response = substr($response, $pos); - $items = $this->tokenizeResponse($response, 1); + $items = $this->tokenizeResponse($response, 1); + if (!is_array($items)) { return $result; } @@ -1704,7 +1705,6 @@ class rcube_imap_generic $encoding = $encoding ? trim($encoding) : 'US-ASCII'; $algorithm = $algorithm ? trim($algorithm) : 'REFERENCES'; $criteria = $criteria ? 'ALL '.trim($criteria) : 'ALL'; - $data = ''; list($code, $response) = $this->execute($return_uid ? 'UID THREAD' : 'THREAD', array($algorithm, $encoding, $criteria)); diff --git a/program/lib/Roundcube/rcube_imap_search.php b/program/lib/Roundcube/rcube_imap_search.php index 365d78f76..eac64b035 100644 --- a/program/lib/Roundcube/rcube_imap_search.php +++ b/program/lib/Roundcube/rcube_imap_search.php @@ -124,9 +124,7 @@ class rcube_imap_search_job /* extends Stackable */ private $charset; private $sort_field; private $threading; - private $searchset; private $result; - private $pagesize = 100; public function __construct($folder, $str, $charset = null, $sort_field = null, $threading=false) { diff --git a/program/lib/Roundcube/rcube_ldap.php b/program/lib/Roundcube/rcube_ldap.php index 6805c4902..9d7e6b836 100644 --- a/program/lib/Roundcube/rcube_ldap.php +++ b/program/lib/Roundcube/rcube_ldap.php @@ -64,7 +64,6 @@ class rcube_ldap extends rcube_addressbook private $base_dn = ''; private $groups_base_dn = ''; - private $group_url; private $group_data; private $group_search_cache; private $cache; @@ -775,7 +774,7 @@ class rcube_ldap extends rcube_addressbook // get all entries of this page and post-filter those that really match the query $search = mb_strtolower($value); - foreach ($ldap_data as $i => $entry) { + foreach ($ldap_data as $entry) { $rec = $this->_ldap2result($entry); foreach ($fields as $f) { foreach ((array)$rec[$f] as $val) { @@ -1531,7 +1530,6 @@ class rcube_ldap extends rcube_addressbook return $ldap_data; } - /** * Returns unified attribute name (resolving aliases) */ @@ -1563,17 +1561,6 @@ class rcube_ldap extends rcube_addressbook } /** - * Prints debug info to the log - */ - private function _debug($str) - { - if ($this->debug) { - rcube::write_log('ldap', $str); - } - } - - - /** * Activate/deactivate debug mode * * @param boolean $dbg True if LDAP commands should be logged @@ -1587,7 +1574,6 @@ class rcube_ldap extends rcube_addressbook } } - /** * Setter for the current group */ @@ -1990,7 +1976,7 @@ class rcube_ldap extends rcube_addressbook $filter = strtr("(|(member=$contact_dn)(uniqueMember=$contact_dn)$add_filter)", array('\\' => '\\\\')); $ldap_data = $this->ldap->search($base_dn, $filter, 'sub', array('dn', $name_attr)); - if ($res === false) { + if ($ldap_data === false) { return array(); } diff --git a/program/lib/Roundcube/rcube_message.php b/program/lib/Roundcube/rcube_message.php index 169d00ce1..20329a7f1 100644 --- a/program/lib/Roundcube/rcube_message.php +++ b/program/lib/Roundcube/rcube_message.php @@ -550,12 +550,6 @@ class rcube_message else if ($mimetype == 'multipart/alternative' && is_array($structure->parts) && count($structure->parts) > 1 ) { - $plain_part = null; - $html_part = null; - $print_part = null; - $related_part = null; - $attach_part = null; - // get html/plaintext parts, other add to attachments list foreach ($structure->parts as $p => $sub_part) { $sub_mimetype = $sub_part->mimetype; diff --git a/program/lib/Roundcube/rcube_spellcheck_atd.php b/program/lib/Roundcube/rcube_spellcheck_atd.php index 9f073f56f..917ec0899 100644 --- a/program/lib/Roundcube/rcube_spellcheck_atd.php +++ b/program/lib/Roundcube/rcube_spellcheck_atd.php @@ -127,7 +127,7 @@ class rcube_spellcheck_atd extends rcube_spellcheck_engine $result = new SimpleXMLElement($response); } catch (Exception $e) { - $thid->error = "Unexpected response from server: " . $store; + $this->error = "Unexpected response from server: " . $response; return array(); } diff --git a/program/lib/Roundcube/rcube_vcard.php b/program/lib/Roundcube/rcube_vcard.php index 96add110f..7f6b11851 100644 --- a/program/lib/Roundcube/rcube_vcard.php +++ b/program/lib/Roundcube/rcube_vcard.php @@ -414,9 +414,10 @@ class rcube_vcard * Find index with the '$type' attribute * * @param string Field name + * * @return int Field index having $type set */ - private function get_type_index($field, $type = 'pref') + private function get_type_index($field) { $result = 0; if ($this->raw[$field]) { |