From 2193f6a1301edcb62de6f0cf338acccdbf5ec2f1 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Tue, 7 May 2013 13:51:23 +0200 Subject: Avoid unused local variables --- plugins/acl/acl.php | 1 - plugins/autologon/autologon.php | 4 +--- plugins/debug_logger/runlog/runlog.php | 2 +- plugins/enigma/enigma.php | 6 +++--- plugins/enigma/lib/enigma_engine.php | 16 +++------------- plugins/enigma/lib/enigma_ui.php | 5 ++--- plugins/help/help.php | 2 -- plugins/managesieve/lib/Roundcube/rcube_sieve_script.php | 6 ++---- plugins/managesieve/managesieve.php | 8 ++++---- plugins/new_user_identity/new_user_identity.php | 2 -- plugins/password/drivers/directadmin.php | 1 - plugins/password/drivers/sql.php | 5 +++-- plugins/password/drivers/xmail.php | 4 ++-- plugins/squirrelmail_usercopy/squirrelmail_usercopy.php | 2 +- plugins/vcard_attachments/vcard_attachments.php | 3 +-- plugins/zipdownload/zipdownload.php | 4 ++-- 16 files changed, 25 insertions(+), 46 deletions(-) diff --git a/plugins/acl/acl.php b/plugins/acl/acl.php index 8879a6050..28139e92c 100644 --- a/plugins/acl/acl.php +++ b/plugins/acl/acl.php @@ -384,7 +384,6 @@ class acl extends rcube_plugin $table->add_header(array('class' => 'acl'.$key, 'title' => $label), $label); } - $i = 1; $js_table = array(); foreach ($acl as $user => $rights) { if ($this->rc->storage->conn->user == $user) { diff --git a/plugins/autologon/autologon.php b/plugins/autologon/autologon.php index 63ffb943e..9c7d5b6fc 100644 --- a/plugins/autologon/autologon.php +++ b/plugins/autologon/autologon.php @@ -19,8 +19,6 @@ class autologon extends rcube_plugin function startup($args) { - $rcmail = rcmail::get_instance(); - // change action to login if (empty($_SESSION['user_id']) && !empty($_GET['_autologin']) && $this->is_localhost()) $args['action'] = 'login'; @@ -37,7 +35,7 @@ class autologon extends rcube_plugin $args['cookiecheck'] = false; $args['valid'] = true; } - + return $args; } diff --git a/plugins/debug_logger/runlog/runlog.php b/plugins/debug_logger/runlog/runlog.php index c9f672615..0c766a13c 100644 --- a/plugins/debug_logger/runlog/runlog.php +++ b/plugins/debug_logger/runlog/runlog.php @@ -194,7 +194,7 @@ class runlog { public function print_totals(){ $totals = array(); - foreach ( $this->run_log as $k => $entry ) { + foreach ($this->run_log as $entry) { if ( $entry['type'] == 'start' && $entry['ended'] == true) { $totals[$entry['value']]['duration'] += $entry['duration']; $totals[$entry['value']]['count'] += 1; diff --git a/plugins/enigma/enigma.php b/plugins/enigma/enigma.php index 1194d26c8..25520a27d 100644 --- a/plugins/enigma/enigma.php +++ b/plugins/enigma/enigma.php @@ -149,7 +149,7 @@ class enigma extends rcube_plugin */ function parse_structure($p) { - $struct = $p['structure']; +// $struct = $p['structure']; if ($p['mimetype'] == 'text/plain' || $p['mimetype'] == 'application/pgp') { $this->parse_plain($p); @@ -391,7 +391,7 @@ class enigma extends rcube_plugin function message_load($p) { $this->message = $p['object']; - + // handle attachments vcard attachments foreach ((array)$this->message->attachments as $attachment) { if ($this->is_keys_part($attachment)) { @@ -399,7 +399,7 @@ class enigma extends rcube_plugin } } // the same with message bodies - foreach ((array)$this->message->parts as $idx => $part) { + foreach ((array)$this->message->parts as $part) { if ($this->is_keys_part($part)) { $this->keys_parts[] = $part->mime_id; $this->keys_bodies[] = $part->mime_id; diff --git a/plugins/enigma/lib/enigma_engine.php b/plugins/enigma/lib/enigma_engine.php index a30a517ec..8a64c07ff 100644 --- a/plugins/enigma/lib/enigma_engine.php +++ b/plugins/enigma/lib/enigma_engine.php @@ -497,9 +497,11 @@ class enigma_engine $uid = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_POST); $mbox = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST); $mime_id = rcube_utils::get_input_value('_part', rcube_utils::INPUT_POST); + $storage = $this->rc->get_storage(); if ($uid && $mime_id) { - $part = $this->rc->storage->get_message_part($uid, $mime_id); + $storage->set_folder($mbox); + $part = $storage->get_message_part($uid, $mime_id); } if ($part && is_array($result = $this->import_key($part))) { @@ -528,16 +530,4 @@ class enigma_engine $uid, $part->mime_id, $part); } } - - /** - * Adds CSS style file to the page header. - */ - private function add_css() - { - $skin = $this->rc->config->get('skin'); - if (!file_exists($this->home . "/skins/$skin/enigma.css")) - $skin = 'default'; - - $this->include_stylesheet("skins/$skin/enigma.css"); - } } diff --git a/plugins/enigma/lib/enigma_ui.php b/plugins/enigma/lib/enigma_ui.php index 47366b7e8..adb619d0c 100644 --- a/plugins/enigma/lib/enigma_ui.php +++ b/plugins/enigma/lib/enigma_ui.php @@ -176,8 +176,7 @@ class enigma_ui $search = rcube_utils::get_input_value('_q', rcube_utils::INPUT_GPC); // define list of cols to be displayed - $a_show_cols = array('name'); - $result = array(); +// $a_show_cols = array('name'); // Get the list $list = $this->enigma->engine->list_keys($search); @@ -200,7 +199,7 @@ class enigma_ui $size = count($list); // Add rows - foreach($list as $idx => $key) { + foreach ($list as $key) { $this->rc->output->command('enigma_add_list_row', array('name' => rcube::Q($key->name), 'id' => $key->id)); } diff --git a/plugins/help/help.php b/plugins/help/help.php index 4b11dceb3..69da6828e 100644 --- a/plugins/help/help.php +++ b/plugins/help/help.php @@ -21,8 +21,6 @@ class help extends rcube_plugin function init() { - $rcmail = rcmail::get_instance(); - $this->add_texts('localization/', false); // register task diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve_script.php b/plugins/managesieve/lib/Roundcube/rcube_sieve_script.php index 80f590f4b..0e95b0fba 100644 --- a/plugins/managesieve/lib/Roundcube/rcube_sieve_script.php +++ b/plugins/managesieve/lib/Roundcube/rcube_sieve_script.php @@ -206,7 +206,6 @@ class rcube_sieve_script // rules foreach ($this->content as $rule) { - $extension = ''; $script = ''; $tests = array(); $i = 0; @@ -1015,11 +1014,10 @@ class rcube_sieve_script * @param mixed $num Number of tokens to return, 0 for all * or True for all tokens until separator is found. * Separator will be returned as last token. - * @param int $in_list Enable to call recursively inside a list * * @return mixed Tokens array or string if $num=1 */ - static function tokenize(&$str, $num=0, $in_list=false) + static function tokenize(&$str, $num=0) { $result = array(); @@ -1054,7 +1052,7 @@ class rcube_sieve_script // Parenthesized list case '[': $str = substr($str, 1); - $result[] = self::tokenize($str, 0, true); + $result[] = self::tokenize($str, 0); break; case ']': $str = substr($str, 1); diff --git a/plugins/managesieve/managesieve.php b/plugins/managesieve/managesieve.php index 817fa8650..fc2a79ddb 100644 --- a/plugins/managesieve/managesieve.php +++ b/plugins/managesieve/managesieve.php @@ -1640,7 +1640,7 @@ class managesieve extends rcube_plugin .'value="' . rcube::Q($action['value']) . '" size="35" ' . $this->error_class($id, 'action', 'value', 'action_varvalue') .' />'; $out .= '
' .rcube::Q($this->gettext('setvarmodifiers')) . '
'; - foreach ($set_modifiers as $j => $s_m) { + foreach ($set_modifiers as $s_m) { $s_m_id = 'action_varmods' . $id . $s_m; $out .= sprintf('%s
', $id, $s_m, $s_m_id, @@ -1902,7 +1902,7 @@ class managesieve extends rcube_plugin $user_script = $_SESSION['managesieve_user_script']; // if the script is not active... - if ($user_script && ($key = array_search($name, $this->active)) === false) { + if ($user_script && array_search($name, $this->active) === false) { // ...rewrite USER file adding appropriate include command if ($this->sieve->load($user_script)) { $script = $this->sieve->script->as_array(); @@ -1920,7 +1920,7 @@ class managesieve extends rcube_plugin // get all active scripts for sorting foreach ($script as $rid => $rules) { - foreach ($rules['actions'] as $aid => $action) { + foreach ($rules['actions'] as $action) { if ($action['type'] == 'include' && empty($action['global'])) { $target = $extension ? preg_replace($regexp, '', $action['target']) : $action['target']; $list[] = $target; @@ -1988,7 +1988,7 @@ class managesieve extends rcube_plugin $name = $name.$extension; foreach ($script as $rid => $rules) { - foreach ($rules['actions'] as $aid => $action) { + foreach ($rules['actions'] as $action) { if ($action['type'] == 'include' && empty($action['global']) && $action['target'] == $name ) { diff --git a/plugins/new_user_identity/new_user_identity.php b/plugins/new_user_identity/new_user_identity.php index f98145b6c..d32051e00 100644 --- a/plugins/new_user_identity/new_user_identity.php +++ b/plugins/new_user_identity/new_user_identity.php @@ -33,8 +33,6 @@ class new_user_identity extends rcube_plugin function lookup_user_name($args) { - $rcmail = rcmail::get_instance(); - if ($this->init_ldap($args['host'])) { $results = $this->ldap->search('*', $args['user'], true); if (count($results->records) == 1) { diff --git a/plugins/password/drivers/directadmin.php b/plugins/password/drivers/directadmin.php index 8bf0dc613..44ecea406 100644 --- a/plugins/password/drivers/directadmin.php +++ b/plugins/password/drivers/directadmin.php @@ -297,7 +297,6 @@ class HTTPSocket { $status = socket_get_status($socket); $startTime = time(); $length = 0; - $prevSecond = 0; while ( !feof($socket) && !$status['timed_out'] ) { $chunk = fgets($socket,1024); diff --git a/plugins/password/drivers/sql.php b/plugins/password/drivers/sql.php index de9ea0a3f..7a51dfe44 100644 --- a/plugins/password/drivers/sql.php +++ b/plugins/password/drivers/sql.php @@ -34,8 +34,9 @@ class rcube_sql_password $db = $rcmail->get_dbh(); } - if ($err = $db->is_error()) + if ($db->is_error()) { return PASSWORD_ERROR; + } // crypted password if (strpos($sql, '%c') !== FALSE) { @@ -184,7 +185,7 @@ class rcube_sql_password if (!$db->is_error()) { if (strtolower(substr(trim($sql),0,6)) == 'select') { - if ($result = $db->fetch_array($res)) + if ($db->fetch_array($res)) return PASSWORD_SUCCESS; } else { // This is the good case: 1 row updated diff --git a/plugins/password/drivers/xmail.php b/plugins/password/drivers/xmail.php index 37abc3001..59e467c5b 100644 --- a/plugins/password/drivers/xmail.php +++ b/plugins/password/drivers/xmail.php @@ -67,7 +67,7 @@ class XMail { function send($msg) { socket_write($this->socket,$msg); - if (substr($in = socket_read($this->socket, 512, PHP_BINARY_READ),0,1) != "+") { + if (substr(socket_read($this->socket, 512, PHP_BINARY_READ),0,1) != "+") { return false; } return true; @@ -85,7 +85,7 @@ class XMail { return false; } - if (substr($in = socket_read($this->socket, 512, PHP_BINARY_READ),0,1) != "+") { + if (substr(socket_read($this->socket, 512, PHP_BINARY_READ),0,1) != "+") { socket_close($this->socket); return false; } diff --git a/plugins/squirrelmail_usercopy/squirrelmail_usercopy.php b/plugins/squirrelmail_usercopy/squirrelmail_usercopy.php index d5d0d47ec..e882a2f37 100644 --- a/plugins/squirrelmail_usercopy/squirrelmail_usercopy.php +++ b/plugins/squirrelmail_usercopy/squirrelmail_usercopy.php @@ -63,7 +63,7 @@ class squirrelmail_usercopy extends rcube_plugin if ($this->prefs['___sig'.$i.'___']) $ident_data['signature'] = $this->prefs['___sig'.$i.'___']; // insert identity - $identid = $rcmail->user->insert_identity($ident_data); + $rcmail->user->insert_identity($ident_data); } } diff --git a/plugins/vcard_attachments/vcard_attachments.php b/plugins/vcard_attachments/vcard_attachments.php index 4905b373e..cf7e22d3a 100644 --- a/plugins/vcard_attachments/vcard_attachments.php +++ b/plugins/vcard_attachments/vcard_attachments.php @@ -45,7 +45,7 @@ class vcard_attachments extends rcube_plugin } } // the same with message bodies - foreach ((array)$this->message->parts as $idx => $part) { + foreach ((array)$this->message->parts as $part) { if ($this->is_vcard($part)) { $this->vcard_parts[] = $part->mime_id; $this->vcard_bodies[] = $part->mime_id; @@ -63,7 +63,6 @@ class vcard_attachments extends rcube_plugin function html_output($p) { $attach_script = false; - $icon = 'plugins/vcard_attachments/' .$this->local_skin_path(). '/vcard_add_contact.png'; foreach ($this->vcard_parts as $part) { $vcards = rcube_vcard::import($this->message->get_part_content($part, null, true)); diff --git a/plugins/zipdownload/zipdownload.php b/plugins/zipdownload/zipdownload.php index 7e132bfbb..fbf1d2342 100644 --- a/plugins/zipdownload/zipdownload.php +++ b/plugins/zipdownload/zipdownload.php @@ -169,7 +169,7 @@ class zipdownload extends rcube_plugin for ($i = 0; ($i * $imap->get_pagesize()) <= $count; $i++) { $a_headers = $imap->list_messages($mbox_name, ($i + 1)); - foreach ($a_headers as $n => $header) { + foreach ($a_headers as $header) { if (empty($header)) continue; @@ -199,7 +199,7 @@ class zipdownload extends rcube_plugin $zip = new ZipArchive(); $zip->open($tmpfname, ZIPARCHIVE::OVERWRITE); - foreach ($uids as $key => $uid){ + foreach ($uids as $uid){ $headers = $imap->get_message_headers($uid); $subject = rcube_mime::decode_mime_string((string)$headers->subject); $subject = $this->_convert_filename($subject); -- cgit v1.2.3