From 2193f6a1301edcb62de6f0cf338acccdbf5ec2f1 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Tue, 07 May 2013 07:51:23 -0400
Subject: [PATCH] Avoid unused local variables
---
plugins/enigma/enigma.php | 6 +-
plugins/password/drivers/sql.php | 5 +-
plugins/debug_logger/runlog/runlog.php | 2
plugins/acl/acl.php | 1
plugins/enigma/lib/enigma_engine.php | 16 +------
plugins/new_user_identity/new_user_identity.php | 2 -
plugins/managesieve/managesieve.php | 8 ++--
plugins/password/drivers/directadmin.php | 1
plugins/vcard_attachments/vcard_attachments.php | 3 -
plugins/enigma/lib/enigma_ui.php | 5 +-
plugins/password/drivers/xmail.php | 4 +-
plugins/help/help.php | 2 -
plugins/zipdownload/zipdownload.php | 4 +-
plugins/squirrelmail_usercopy/squirrelmail_usercopy.php | 2
plugins/managesieve/lib/Roundcube/rcube_sieve_script.php | 6 +--
plugins/autologon/autologon.php | 4 -
16 files changed, 25 insertions(+), 46 deletions(-)
diff --git a/plugins/acl/acl.php b/plugins/acl/acl.php
index 8879a60..28139e9 100644
--- a/plugins/acl/acl.php
+++ b/plugins/acl/acl.php
@@ -384,7 +384,6 @@
$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 63ffb94..9c7d5b6 100644
--- a/plugins/autologon/autologon.php
+++ b/plugins/autologon/autologon.php
@@ -19,8 +19,6 @@
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 @@
$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 c9f6726..0c766a1 100644
--- a/plugins/debug_logger/runlog/runlog.php
+++ b/plugins/debug_logger/runlog/runlog.php
@@ -194,7 +194,7 @@
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 1194d26..25520a2 100644
--- a/plugins/enigma/enigma.php
+++ b/plugins/enigma/enigma.php
@@ -149,7 +149,7 @@
*/
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 @@
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 @@
}
}
// 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 a30a517..8a64c07 100644
--- a/plugins/enigma/lib/enigma_engine.php
+++ b/plugins/enigma/lib/enigma_engine.php
@@ -497,9 +497,11 @@
$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))) {
@@ -527,17 +529,5 @@
$part->body = $this->rc->storage->get_message_part(
$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 47366b7..adb619d 100644
--- a/plugins/enigma/lib/enigma_ui.php
+++ b/plugins/enigma/lib/enigma_ui.php
@@ -176,8 +176,7 @@
$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 @@
$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 4b11dce..69da682 100644
--- a/plugins/help/help.php
+++ b/plugins/help/help.php
@@ -21,8 +21,6 @@
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 80f590f..0e95b0f 100644
--- a/plugins/managesieve/lib/Roundcube/rcube_sieve_script.php
+++ b/plugins/managesieve/lib/Roundcube/rcube_sieve_script.php
@@ -206,7 +206,6 @@
// rules
foreach ($this->content as $rule) {
- $extension = '';
$script = '';
$tests = array();
$i = 0;
@@ -1015,11 +1014,10 @@
* @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 @@
// 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 817fa86..fc2a79d 100644
--- a/plugins/managesieve/managesieve.php
+++ b/plugins/managesieve/managesieve.php
@@ -1640,7 +1640,7 @@
.'value="' . rcube::Q($action['value']) . '" size="35" '
. $this->error_class($id, 'action', 'value', 'action_varvalue') .' />';
$out .= '<br /><span class="label">' .rcube::Q($this->gettext('setvarmodifiers')) . '</span><br />';
- foreach ($set_modifiers as $j => $s_m) {
+ foreach ($set_modifiers as $s_m) {
$s_m_id = 'action_varmods' . $id . $s_m;
$out .= sprintf('<input type="checkbox" name="_action_varmods[%s][]" value="%s" id="%s"%s />%s<br>',
$id, $s_m, $s_m_id,
@@ -1902,7 +1902,7 @@
$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 @@
// 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 @@
$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 f98145b..d32051e 100644
--- a/plugins/new_user_identity/new_user_identity.php
+++ b/plugins/new_user_identity/new_user_identity.php
@@ -33,8 +33,6 @@
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 8bf0dc6..44ecea4 100644
--- a/plugins/password/drivers/directadmin.php
+++ b/plugins/password/drivers/directadmin.php
@@ -297,7 +297,6 @@
$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 de9ea0a..7a51dfe 100644
--- a/plugins/password/drivers/sql.php
+++ b/plugins/password/drivers/sql.php
@@ -34,8 +34,9 @@
$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 @@
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 37abc30..59e467c 100644
--- a/plugins/password/drivers/xmail.php
+++ b/plugins/password/drivers/xmail.php
@@ -67,7 +67,7 @@
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 @@
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 d5d0d47..e882a2f 100644
--- a/plugins/squirrelmail_usercopy/squirrelmail_usercopy.php
+++ b/plugins/squirrelmail_usercopy/squirrelmail_usercopy.php
@@ -63,7 +63,7 @@
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 4905b37..cf7e22d 100644
--- a/plugins/vcard_attachments/vcard_attachments.php
+++ b/plugins/vcard_attachments/vcard_attachments.php
@@ -45,7 +45,7 @@
}
}
// 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 @@
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 7e132bf..fbf1d23 100644
--- a/plugins/zipdownload/zipdownload.php
+++ b/plugins/zipdownload/zipdownload.php
@@ -169,7 +169,7 @@
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 @@
$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);
--
Gitblit v1.9.1