Aleksander Machniak
2013-05-07 2193f6a1301edcb62de6f0cf338acccdbf5ec2f1
Avoid unused local variables
16 files modified
71 ■■■■■ changed files
plugins/acl/acl.php 1 ●●●● patch | view | raw | blame | history
plugins/autologon/autologon.php 4 ●●● patch | view | raw | blame | history
plugins/debug_logger/runlog/runlog.php 2 ●●● patch | view | raw | blame | history
plugins/enigma/enigma.php 6 ●●●● patch | view | raw | blame | history
plugins/enigma/lib/enigma_engine.php 16 ●●●● patch | view | raw | blame | history
plugins/enigma/lib/enigma_ui.php 5 ●●●●● patch | view | raw | blame | history
plugins/help/help.php 2 ●●●●● patch | view | raw | blame | history
plugins/managesieve/lib/Roundcube/rcube_sieve_script.php 6 ●●●●● patch | view | raw | blame | history
plugins/managesieve/managesieve.php 8 ●●●● patch | view | raw | blame | history
plugins/new_user_identity/new_user_identity.php 2 ●●●●● patch | view | raw | blame | history
plugins/password/drivers/directadmin.php 1 ●●●● patch | view | raw | blame | history
plugins/password/drivers/sql.php 5 ●●●●● patch | view | raw | blame | history
plugins/password/drivers/xmail.php 4 ●●●● patch | view | raw | blame | history
plugins/squirrelmail_usercopy/squirrelmail_usercopy.php 2 ●●● patch | view | raw | blame | history
plugins/vcard_attachments/vcard_attachments.php 3 ●●●● patch | view | raw | blame | history
plugins/zipdownload/zipdownload.php 4 ●●●● patch | view | raw | blame | history
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) {
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;
  }
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;
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;
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");
    }
}
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));
                }
plugins/help/help.php
@@ -21,8 +21,6 @@
    function init()
    {
        $rcmail = rcmail::get_instance();
        $this->add_texts('localization/', false);
        // register task
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);
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
                            ) {
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) {
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);
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
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;
        }
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);
                }
            }
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));
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);