Avoid unused local variables

pull/73/head
Aleksander Machniak 12 years ago
parent ef1d6525c2
commit 2193f6a130

@ -384,7 +384,6 @@ class acl extends rcube_plugin
$table->add_header(array('class' => 'acl'.$key, 'title' => $label), $label); $table->add_header(array('class' => 'acl'.$key, 'title' => $label), $label);
} }
$i = 1;
$js_table = array(); $js_table = array();
foreach ($acl as $user => $rights) { foreach ($acl as $user => $rights) {
if ($this->rc->storage->conn->user == $user) { if ($this->rc->storage->conn->user == $user) {

@ -19,8 +19,6 @@ class autologon extends rcube_plugin
function startup($args) function startup($args)
{ {
$rcmail = rcmail::get_instance();
// change action to login // change action to login
if (empty($_SESSION['user_id']) && !empty($_GET['_autologin']) && $this->is_localhost()) if (empty($_SESSION['user_id']) && !empty($_GET['_autologin']) && $this->is_localhost())
$args['action'] = 'login'; $args['action'] = 'login';
@ -37,7 +35,7 @@ class autologon extends rcube_plugin
$args['cookiecheck'] = false; $args['cookiecheck'] = false;
$args['valid'] = true; $args['valid'] = true;
} }
return $args; return $args;
} }

@ -194,7 +194,7 @@ class runlog {
public function print_totals(){ public function print_totals(){
$totals = array(); $totals = array();
foreach ( $this->run_log as $k => $entry ) { foreach ($this->run_log as $entry) {
if ( $entry['type'] == 'start' && $entry['ended'] == true) { if ( $entry['type'] == 'start' && $entry['ended'] == true) {
$totals[$entry['value']]['duration'] += $entry['duration']; $totals[$entry['value']]['duration'] += $entry['duration'];
$totals[$entry['value']]['count'] += 1; $totals[$entry['value']]['count'] += 1;

@ -149,7 +149,7 @@ class enigma extends rcube_plugin
*/ */
function parse_structure($p) function parse_structure($p)
{ {
$struct = $p['structure']; // $struct = $p['structure'];
if ($p['mimetype'] == 'text/plain' || $p['mimetype'] == 'application/pgp') { if ($p['mimetype'] == 'text/plain' || $p['mimetype'] == 'application/pgp') {
$this->parse_plain($p); $this->parse_plain($p);
@ -391,7 +391,7 @@ class enigma extends rcube_plugin
function message_load($p) function message_load($p)
{ {
$this->message = $p['object']; $this->message = $p['object'];
// handle attachments vcard attachments // handle attachments vcard attachments
foreach ((array)$this->message->attachments as $attachment) { foreach ((array)$this->message->attachments as $attachment) {
if ($this->is_keys_part($attachment)) { if ($this->is_keys_part($attachment)) {
@ -399,7 +399,7 @@ class enigma extends rcube_plugin
} }
} }
// the same with message bodies // 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)) { if ($this->is_keys_part($part)) {
$this->keys_parts[] = $part->mime_id; $this->keys_parts[] = $part->mime_id;
$this->keys_bodies[] = $part->mime_id; $this->keys_bodies[] = $part->mime_id;

@ -497,9 +497,11 @@ class enigma_engine
$uid = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_POST); $uid = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_POST);
$mbox = rcube_utils::get_input_value('_mbox', 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); $mime_id = rcube_utils::get_input_value('_part', rcube_utils::INPUT_POST);
$storage = $this->rc->get_storage();
if ($uid && $mime_id) { 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))) { if ($part && is_array($result = $this->import_key($part))) {
@ -528,16 +530,4 @@ class enigma_engine
$uid, $part->mime_id, $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");
}
} }

@ -176,8 +176,7 @@ class enigma_ui
$search = rcube_utils::get_input_value('_q', rcube_utils::INPUT_GPC); $search = rcube_utils::get_input_value('_q', rcube_utils::INPUT_GPC);
// define list of cols to be displayed // define list of cols to be displayed
$a_show_cols = array('name'); // $a_show_cols = array('name');
$result = array();
// Get the list // Get the list
$list = $this->enigma->engine->list_keys($search); $list = $this->enigma->engine->list_keys($search);
@ -200,7 +199,7 @@ class enigma_ui
$size = count($list); $size = count($list);
// Add rows // Add rows
foreach($list as $idx => $key) { foreach ($list as $key) {
$this->rc->output->command('enigma_add_list_row', $this->rc->output->command('enigma_add_list_row',
array('name' => rcube::Q($key->name), 'id' => $key->id)); array('name' => rcube::Q($key->name), 'id' => $key->id));
} }

@ -21,8 +21,6 @@ class help extends rcube_plugin
function init() function init()
{ {
$rcmail = rcmail::get_instance();
$this->add_texts('localization/', false); $this->add_texts('localization/', false);
// register task // register task

@ -206,7 +206,6 @@ class rcube_sieve_script
// rules // rules
foreach ($this->content as $rule) { foreach ($this->content as $rule) {
$extension = '';
$script = ''; $script = '';
$tests = array(); $tests = array();
$i = 0; $i = 0;
@ -1015,11 +1014,10 @@ class rcube_sieve_script
* @param mixed $num Number of tokens to return, 0 for all * @param mixed $num Number of tokens to return, 0 for all
* or True for all tokens until separator is found. * or True for all tokens until separator is found.
* Separator will be returned as last token. * 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 * @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(); $result = array();
@ -1054,7 +1052,7 @@ class rcube_sieve_script
// Parenthesized list // Parenthesized list
case '[': case '[':
$str = substr($str, 1); $str = substr($str, 1);
$result[] = self::tokenize($str, 0, true); $result[] = self::tokenize($str, 0);
break; break;
case ']': case ']':
$str = substr($str, 1); $str = substr($str, 1);

@ -1640,7 +1640,7 @@ class managesieve extends rcube_plugin
.'value="' . rcube::Q($action['value']) . '" size="35" ' .'value="' . rcube::Q($action['value']) . '" size="35" '
. $this->error_class($id, 'action', 'value', 'action_varvalue') .' />'; . $this->error_class($id, 'action', 'value', 'action_varvalue') .' />';
$out .= '<br /><span class="label">' .rcube::Q($this->gettext('setvarmodifiers')) . '</span><br />'; $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; $s_m_id = 'action_varmods' . $id . $s_m;
$out .= sprintf('<input type="checkbox" name="_action_varmods[%s][]" value="%s" id="%s"%s />%s<br>', $out .= sprintf('<input type="checkbox" name="_action_varmods[%s][]" value="%s" id="%s"%s />%s<br>',
$id, $s_m, $s_m_id, $id, $s_m, $s_m_id,
@ -1902,7 +1902,7 @@ class managesieve extends rcube_plugin
$user_script = $_SESSION['managesieve_user_script']; $user_script = $_SESSION['managesieve_user_script'];
// if the script is not active... // 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 // ...rewrite USER file adding appropriate include command
if ($this->sieve->load($user_script)) { if ($this->sieve->load($user_script)) {
$script = $this->sieve->script->as_array(); $script = $this->sieve->script->as_array();
@ -1920,7 +1920,7 @@ class managesieve extends rcube_plugin
// get all active scripts for sorting // get all active scripts for sorting
foreach ($script as $rid => $rules) { foreach ($script as $rid => $rules) {
foreach ($rules['actions'] as $aid => $action) { foreach ($rules['actions'] as $action) {
if ($action['type'] == 'include' && empty($action['global'])) { if ($action['type'] == 'include' && empty($action['global'])) {
$target = $extension ? preg_replace($regexp, '', $action['target']) : $action['target']; $target = $extension ? preg_replace($regexp, '', $action['target']) : $action['target'];
$list[] = $target; $list[] = $target;
@ -1988,7 +1988,7 @@ class managesieve extends rcube_plugin
$name = $name.$extension; $name = $name.$extension;
foreach ($script as $rid => $rules) { foreach ($script as $rid => $rules) {
foreach ($rules['actions'] as $aid => $action) { foreach ($rules['actions'] as $action) {
if ($action['type'] == 'include' && empty($action['global']) if ($action['type'] == 'include' && empty($action['global'])
&& $action['target'] == $name && $action['target'] == $name
) { ) {

@ -33,8 +33,6 @@ class new_user_identity extends rcube_plugin
function lookup_user_name($args) function lookup_user_name($args)
{ {
$rcmail = rcmail::get_instance();
if ($this->init_ldap($args['host'])) { if ($this->init_ldap($args['host'])) {
$results = $this->ldap->search('*', $args['user'], true); $results = $this->ldap->search('*', $args['user'], true);
if (count($results->records) == 1) { if (count($results->records) == 1) {

@ -297,7 +297,6 @@ class HTTPSocket {
$status = socket_get_status($socket); $status = socket_get_status($socket);
$startTime = time(); $startTime = time();
$length = 0; $length = 0;
$prevSecond = 0;
while ( !feof($socket) && !$status['timed_out'] ) while ( !feof($socket) && !$status['timed_out'] )
{ {
$chunk = fgets($socket,1024); $chunk = fgets($socket,1024);

@ -34,8 +34,9 @@ class rcube_sql_password
$db = $rcmail->get_dbh(); $db = $rcmail->get_dbh();
} }
if ($err = $db->is_error()) if ($db->is_error()) {
return PASSWORD_ERROR; return PASSWORD_ERROR;
}
// crypted password // crypted password
if (strpos($sql, '%c') !== FALSE) { if (strpos($sql, '%c') !== FALSE) {
@ -184,7 +185,7 @@ class rcube_sql_password
if (!$db->is_error()) { if (!$db->is_error()) {
if (strtolower(substr(trim($sql),0,6)) == 'select') { if (strtolower(substr(trim($sql),0,6)) == 'select') {
if ($result = $db->fetch_array($res)) if ($db->fetch_array($res))
return PASSWORD_SUCCESS; return PASSWORD_SUCCESS;
} else { } else {
// This is the good case: 1 row updated // This is the good case: 1 row updated

@ -67,7 +67,7 @@ class XMail {
function send($msg) function send($msg)
{ {
socket_write($this->socket,$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 false;
} }
return true; return true;
@ -85,7 +85,7 @@ class XMail {
return false; 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); socket_close($this->socket);
return false; return false;
} }

@ -63,7 +63,7 @@ class squirrelmail_usercopy extends rcube_plugin
if ($this->prefs['___sig'.$i.'___']) if ($this->prefs['___sig'.$i.'___'])
$ident_data['signature'] = $this->prefs['___sig'.$i.'___']; $ident_data['signature'] = $this->prefs['___sig'.$i.'___'];
// insert identity // insert identity
$identid = $rcmail->user->insert_identity($ident_data); $rcmail->user->insert_identity($ident_data);
} }
} }

@ -45,7 +45,7 @@ class vcard_attachments extends rcube_plugin
} }
} }
// the same with message bodies // 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)) { if ($this->is_vcard($part)) {
$this->vcard_parts[] = $part->mime_id; $this->vcard_parts[] = $part->mime_id;
$this->vcard_bodies[] = $part->mime_id; $this->vcard_bodies[] = $part->mime_id;
@ -63,7 +63,6 @@ class vcard_attachments extends rcube_plugin
function html_output($p) function html_output($p)
{ {
$attach_script = false; $attach_script = false;
$icon = 'plugins/vcard_attachments/' .$this->local_skin_path(). '/vcard_add_contact.png';
foreach ($this->vcard_parts as $part) { foreach ($this->vcard_parts as $part) {
$vcards = rcube_vcard::import($this->message->get_part_content($part, null, true)); $vcards = rcube_vcard::import($this->message->get_part_content($part, null, true));

@ -169,7 +169,7 @@ class zipdownload extends rcube_plugin
for ($i = 0; ($i * $imap->get_pagesize()) <= $count; $i++) { for ($i = 0; ($i * $imap->get_pagesize()) <= $count; $i++) {
$a_headers = $imap->list_messages($mbox_name, ($i + 1)); $a_headers = $imap->list_messages($mbox_name, ($i + 1));
foreach ($a_headers as $n => $header) { foreach ($a_headers as $header) {
if (empty($header)) if (empty($header))
continue; continue;
@ -199,7 +199,7 @@ class zipdownload extends rcube_plugin
$zip = new ZipArchive(); $zip = new ZipArchive();
$zip->open($tmpfname, ZIPARCHIVE::OVERWRITE); $zip->open($tmpfname, ZIPARCHIVE::OVERWRITE);
foreach ($uids as $key => $uid){ foreach ($uids as $uid){
$headers = $imap->get_message_headers($uid); $headers = $imap->get_message_headers($uid);
$subject = rcube_mime::decode_mime_string((string)$headers->subject); $subject = rcube_mime::decode_mime_string((string)$headers->subject);
$subject = $this->_convert_filename($subject); $subject = $this->_convert_filename($subject);

Loading…
Cancel
Save