From 3725cfb245bfae3a77baf857ea5403e8064b84b9 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Tue, 07 May 2013 09:12:22 -0400
Subject: [PATCH] Avoid uninitialized/unused variables

---
 program/lib/Roundcube/rcube_addressbook.php  |    2 
 program/lib/Roundcube/rcube_db_mysql.php     |    2 
 program/lib/Roundcube/rcube_vcard.php        |    2 
 program/steps/settings/folders.inc           |    3 
 program/steps/mail/compose.inc               |   20 +++---
 program/steps/settings/edit_prefs.inc        |    2 
 program/lib/Roundcube/rcube_imap.php         |    5 -
 program/steps/addressbook/func.inc           |    3 -
 program/lib/Roundcube/rcube_message.php      |    2 
 program/lib/Roundcube/rcube_csv2vcard.php    |    3 
 program/steps/mail/show.inc                  |    4 
 program/lib/Roundcube/rcube_enriched.php     |    2 
 program/lib/Roundcube/rcube_utils.php        |    2 
 program/lib/Roundcube/rcube_smtp.php         |    4 
 installer/rcube_install.php                  |    9 +-
 program/include/bc.php                       |    2 
 program/include/rcmail.php                   |   28 +--------
 program/lib/Roundcube/rcube_ldap.php         |    9 +-
 program/steps/mail/func.inc                  |   16 ++---
 program/steps/addressbook/show.inc           |    6 -
 program/lib/Roundcube/rcube_imap_generic.php |    8 +-
 program/lib/Roundcube/rcube_plugin_api.php   |    1 
 program/lib/Roundcube/rcube_imap_cache.php   |    4 
 23 files changed, 51 insertions(+), 88 deletions(-)

diff --git a/installer/rcube_install.php b/installer/rcube_install.php
index 32b6a5d..e7da54c 100644
--- a/installer/rcube_install.php
+++ b/installer/rcube_install.php
@@ -347,7 +347,7 @@
 
     $this->config  = array_merge($this->config, $current);
 
-    foreach ((array)$current['ldap_public'] as $key => $values) {
+    foreach (array_keys((array)$current['ldap_public']) as $key) {
       $this->config['ldap_public'][$key] = $current['ldap_public'][$key];
     }
   }
@@ -356,10 +356,11 @@
    * Compare the local database schema with the reference schema
    * required for this version of Roundcube
    *
-   * @param boolean True if the schema schould be updated
+   * @param rcube_db Database object
+   *
    * @return boolean True if the schema is up-to-date, false if not or an error occured
    */
-  function db_schema_check($DB, $update = false)
+  function db_schema_check($DB)
   {
     if (!$this->configured)
       return false;
@@ -583,7 +584,7 @@
       }
       else {  // check if all keys are numeric
         $isnum = true;
-        foreach ($var as $key => $value) {
+        foreach (array_keys($var) as $key) {
           if (!is_numeric($key)) {
             $isnum = false;
             break;
diff --git a/program/include/bc.php b/program/include/bc.php
index df01832..0ddfb32 100644
--- a/program/include/bc.php
+++ b/program/include/bc.php
@@ -62,7 +62,7 @@
 
 function rcmail_temp_gc()
 {
-  $rcmail = rcmail::get_instance()->temp_gc();
+  rcmail::get_instance()->temp_gc();
 }
 
 function rcube_charset_convert($str, $from, $to=NULL)
diff --git a/program/include/rcmail.php b/program/include/rcmail.php
index 6257f49..c16257d 100644
--- a/program/include/rcmail.php
+++ b/program/include/rcmail.php
@@ -596,7 +596,7 @@
       $post_host = rcube_utils::get_input_value('_host', rcube_utils::INPUT_POST);
       $post_user = rcube_utils::get_input_value('_user', rcube_utils::INPUT_POST);
 
-      list($user, $domain) = explode('@', $post_user);
+      list(, $domain) = explode('@', $post_user);
 
       // direct match in default_host array
       if ($default_host[$post_host] || in_array($post_host, array_values($default_host))) {
@@ -696,28 +696,6 @@
     $token = rcube_utils::get_input_value('_token', $mode);
     $sess_id = $_COOKIE[ini_get('session.name')];
     return !empty($sess_id) && $token == $this->get_request_token();
-  }
-
-
-  /**
-   * Create unique authorization hash
-   *
-   * @param string Session ID
-   * @param int Timestamp
-   * @return string The generated auth hash
-   */
-  private function get_auth_hash($sess_id, $ts)
-  {
-    $auth_string = sprintf('rcmail*sess%sR%s*Chk:%s;%s',
-      $sess_id,
-      $ts,
-      $this->config->get('ip_check') ? $_SERVER['REMOTE_ADDR'] : '***.***.***.***',
-      $_SERVER['HTTP_USER_AGENT']);
-
-    if (function_exists('sha1'))
-      return sha1($auth_string);
-    else
-      return md5($auth_string);
   }
 
 
@@ -1532,7 +1510,7 @@
         $collapsed = $this->config->get('collapsed_folders');
 
         $out = '';
-        foreach ($arrFolders as $key => $folder) {
+        foreach ($arrFolders as $folder) {
             $title        = null;
             $folder_class = $this->folder_classname($folder['id']);
             $is_collapsed = strpos($collapsed, '&'.rawurlencode($folder['id']).'&') !== false;
@@ -1618,7 +1596,7 @@
     {
         $out = '';
 
-        foreach ($arrFolders as $key => $folder) {
+        foreach ($arrFolders as $folder) {
             // skip exceptions (and its subfolders)
             if (!empty($opts['exceptions']) && in_array($folder['id'], $opts['exceptions'])) {
                 continue;
diff --git a/program/lib/Roundcube/rcube_addressbook.php b/program/lib/Roundcube/rcube_addressbook.php
index a1b29c3..d23ad36 100644
--- a/program/lib/Roundcube/rcube_addressbook.php
+++ b/program/lib/Roundcube/rcube_addressbook.php
@@ -432,7 +432,7 @@
                     $out = array_merge($out, (array)$values);
                 }
                 else {
-                    list($f, $type) = explode(':', $c);
+                    list(, $type) = explode(':', $c);
                     $out[$type] = array_merge((array)$out[$type], (array)$values);
                 }
             }
diff --git a/program/lib/Roundcube/rcube_csv2vcard.php b/program/lib/Roundcube/rcube_csv2vcard.php
index fa22fa4..fb8d8f1 100644
--- a/program/lib/Roundcube/rcube_csv2vcard.php
+++ b/program/lib/Roundcube/rcube_csv2vcard.php
@@ -304,7 +304,6 @@
     {
         // convert to UTF-8
         $head     = substr($csv, 0, 4096);
-        $fallback = rcube::get_instance()->config->get('default_charset', 'ISO-8859-1'); // fallback to Latin-1?
         $charset  = rcube_charset::detect($head, RCUBE_CHARSET);
         $csv      = rcube_charset::convert($csv, $charset);
         $head     = '';
@@ -312,7 +311,7 @@
         $this->map = array();
 
         // Parse file
-        foreach (preg_split("/[\r\n]+/", $csv) as $i => $line) {
+        foreach (preg_split("/[\r\n]+/", $csv) as $line) {
             $elements = $this->parse_line($line);
             if (empty($elements)) {
                 continue;
diff --git a/program/lib/Roundcube/rcube_db_mysql.php b/program/lib/Roundcube/rcube_db_mysql.php
index de81ede..b2cbab2 100644
--- a/program/lib/Roundcube/rcube_db_mysql.php
+++ b/program/lib/Roundcube/rcube_db_mysql.php
@@ -127,7 +127,7 @@
         $result[PDO::MYSQL_ATTR_FOUND_ROWS] = true;
 
         // Enable AUTOCOMMIT mode (#1488902)
-        $dsn_options[PDO::ATTR_AUTOCOMMIT] = true;
+        $result[PDO::ATTR_AUTOCOMMIT] = true;
 
         return $result;
     }
diff --git a/program/lib/Roundcube/rcube_enriched.php b/program/lib/Roundcube/rcube_enriched.php
index 8c628c9..12deb33 100644
--- a/program/lib/Roundcube/rcube_enriched.php
+++ b/program/lib/Roundcube/rcube_enriched.php
@@ -118,7 +118,7 @@
             $quoted = '';
             $lines  = explode('<br>', $a[2]);
 
-            foreach ($lines as $n => $line)
+            foreach ($lines as $line)
                 $quoted .= '&gt;'.$line.'<br>';
 
             $body = $a[1].'<span class="quotes">'.$quoted.'</span>'.$a[3];
diff --git a/program/lib/Roundcube/rcube_imap.php b/program/lib/Roundcube/rcube_imap.php
index 696f485..43c61fd 100644
--- a/program/lib/Roundcube/rcube_imap.php
+++ b/program/lib/Roundcube/rcube_imap.php
@@ -1423,8 +1423,6 @@
      */
     protected function search_index($folder, $criteria='ALL', $charset=NULL, $sort_field=NULL)
     {
-        $orig_criteria = $criteria;
-
         if (!$this->check_connection()) {
             if ($this->threading) {
                 return new rcube_result_thread();
@@ -2783,7 +2781,6 @@
      */
     private function list_folders_update(&$result, $type = null)
     {
-        $delim     = $this->get_hierarchy_delimiter();
         $namespace = $this->get_namespace();
         $search    = array();
 
@@ -3846,7 +3843,7 @@
         $delimiter = $this->get_hierarchy_delimiter();
 
         // find default folders and skip folders starting with '.'
-        foreach ($a_folders as $i => $folder) {
+        foreach ($a_folders as $folder) {
             if ($folder[0] == '.') {
                 continue;
             }
diff --git a/program/lib/Roundcube/rcube_imap_cache.php b/program/lib/Roundcube/rcube_imap_cache.php
index 748474a..47d9aaf 100644
--- a/program/lib/Roundcube/rcube_imap_cache.php
+++ b/program/lib/Roundcube/rcube_imap_cache.php
@@ -430,7 +430,7 @@
                     ." AND uid = ?",
                 $flags, $msg, $this->userid, $mailbox, (int) $message->uid);
 
-            if ($this->db->affected_rows()) {
+            if ($this->db->affected_rows($res)) {
                 return;
             }
         }
@@ -983,7 +983,7 @@
                 $uids, true, array('FLAGS'), $index['modseq'], $qresync);
 
             if (!empty($result)) {
-                foreach ($result as $id => $msg) {
+                foreach ($result as $msg) {
                     $uid = $msg->uid;
                     // Remove deleted message
                     if ($this->skip_deleted && !empty($msg->flags['DELETED'])) {
diff --git a/program/lib/Roundcube/rcube_imap_generic.php b/program/lib/Roundcube/rcube_imap_generic.php
index fd8b130..f7c1f86 100644
--- a/program/lib/Roundcube/rcube_imap_generic.php
+++ b/program/lib/Roundcube/rcube_imap_generic.php
@@ -1652,7 +1652,6 @@
         }
 
         if (!empty($criteria)) {
-            $modseq = stripos($criteria, 'MODSEQ') !== false;
             $params .= ($params ? ' ' : '') . $criteria;
         }
         else {
@@ -1791,7 +1790,6 @@
                 if ($skip_deleted && preg_match('/FLAGS \(([^)]+)\)/', $line, $matches)) {
                     $flags = explode(' ', strtoupper($matches[1]));
                     if (in_array('\\DELETED', $flags)) {
-                        $deleted[$id] = $id;
                         continue;
                     }
                 }
@@ -2172,7 +2170,7 @@
                 // create array with header field:data
                 if (!empty($headers)) {
                     $headers = explode("\n", trim($headers));
-                    foreach ($headers as $hid => $resln) {
+                    foreach ($headers as $resln) {
                         if (ord($resln[0]) <= 32) {
                             $lines[$ln] .= (empty($lines[$ln]) ? '' : "\n") . trim($resln);
                         } else {
@@ -2180,7 +2178,7 @@
                         }
                     }
 
-                    while (list($lines_key, $str) = each($lines)) {
+                    foreach ($lines as $str) {
                         list($field, $string) = explode(':', $str, 2);
 
                         $field  = strtolower($field);
@@ -3540,7 +3538,7 @@
 
         if (is_array($element)) {
             reset($element);
-            while (list($key, $value) = each($element)) {
+            foreach ($element as $value) {
                 $string .= ' ' . self::r_implode($value);
             }
         }
diff --git a/program/lib/Roundcube/rcube_ldap.php b/program/lib/Roundcube/rcube_ldap.php
index 26f46a0..70163b2 100644
--- a/program/lib/Roundcube/rcube_ldap.php
+++ b/program/lib/Roundcube/rcube_ldap.php
@@ -169,7 +169,7 @@
         // Build sub_fields filter
         if (!empty($this->prop['sub_fields']) && is_array($this->prop['sub_fields'])) {
             $this->sub_filter = '';
-            foreach ($this->prop['sub_fields'] as $attr => $class) {
+            foreach ($this->prop['sub_fields'] as $class) {
                 if (!empty($class)) {
                     $class = is_array($class) ? array_pop($class) : $class;
                     $this->sub_filter .= '(objectClass=' . $class . ')';
@@ -1035,7 +1035,6 @@
                 $mail_field  = $this->fieldmap['email'];
 
                 // try to extract surname and firstname from displayname
-                $reverse_map = array_flip($this->fieldmap);
                 $name_parts  = preg_split('/[\s,.]+/', $save_data['name']);
 
                 if ($sn_field && $missing[$sn_field]) {
@@ -1107,7 +1106,7 @@
         // Remove attributes that need to be added separately (child objects)
         $xfields = array();
         if (!empty($this->prop['sub_fields']) && is_array($this->prop['sub_fields'])) {
-            foreach ($this->prop['sub_fields'] as $xf => $xclass) {
+            foreach (array_keys($this->prop['sub_fields']) as $xf) {
                 if (!empty($newentry[$xf])) {
                     $xfields[$xf] = $newentry[$xf];
                     unset($newentry[$xf]);
@@ -1170,7 +1169,7 @@
             }
         }
 
-        foreach ($this->fieldmap as $col => $fld) {
+        foreach ($this->fieldmap as $fld) {
             if ($fld) {
                 $val = $ldap_data[$fld];
                 $old = $old_data[$fld];
@@ -1783,7 +1782,7 @@
             $vlv_active = $this->_vlv_set_controls($this->prop['groups'], $vlv_page+1, $page_size);
         }
 
-        $function = $this->_scope2func($this->prop['groups']['scope'], $ns_function);
+        $function = $this->_scope2func($this->prop['groups']['scope']);
         $res = @$function($this->conn, $base_dn, $filter, array_unique(array('dn', 'objectClass', $name_attr, $email_attr, $sort_attr)));
         if ($res === false)
         {
diff --git a/program/lib/Roundcube/rcube_message.php b/program/lib/Roundcube/rcube_message.php
index 9db1fa3..a42d3fb 100644
--- a/program/lib/Roundcube/rcube_message.php
+++ b/program/lib/Roundcube/rcube_message.php
@@ -362,7 +362,7 @@
 
             // parse headers from message/rfc822 part
             if (!isset($structure->headers['subject']) && !isset($structure->headers['from'])) {
-                list($headers, $dump) = explode("\r\n\r\n", $this->get_part_content($structure->mime_id, null, true, 32768));
+                list($headers, ) = explode("\r\n\r\n", $this->get_part_content($structure->mime_id, null, true, 32768));
                 $structure->headers = rcube_mime::parse_headers($headers);
             }
         }
diff --git a/program/lib/Roundcube/rcube_plugin_api.php b/program/lib/Roundcube/rcube_plugin_api.php
index 4bb6c66..33f04ea 100644
--- a/program/lib/Roundcube/rcube_plugin_api.php
+++ b/program/lib/Roundcube/rcube_plugin_api.php
@@ -313,7 +313,6 @@
           $doc->loadXML($file);
           $xpath = new DOMXPath($doc);
           $xpath->registerNamespace('rc', "http://pear.php.net/dtd/package-2.0");
-          $data = array();
 
           // XPaths of plugin metadata elements
           $metadata = array(
diff --git a/program/lib/Roundcube/rcube_smtp.php b/program/lib/Roundcube/rcube_smtp.php
index 201e826..0f3ac04 100644
--- a/program/lib/Roundcube/rcube_smtp.php
+++ b/program/lib/Roundcube/rcube_smtp.php
@@ -433,9 +433,9 @@
         $recipients = rcube_utils::explode_quoted_string(',', $recipients);
 
         reset($recipients);
-        while (list($k, $recipient) = each($recipients)) {
+        foreach ($recipients as $recipient) {
             $a = rcube_utils::explode_quoted_string(' ', $recipient);
-            while (list($k2, $word) = each($a)) {
+            foreach ($a as $word) {
                 if (strpos($word, "@") > 0 && $word[strlen($word)-1] != '"') {
                     $word = preg_replace('/^<|>$/', '', trim($word));
                     if (in_array($word, $addresses) === false) {
diff --git a/program/lib/Roundcube/rcube_utils.php b/program/lib/Roundcube/rcube_utils.php
index fabe0f0..8467107 100644
--- a/program/lib/Roundcube/rcube_utils.php
+++ b/program/lib/Roundcube/rcube_utils.php
@@ -404,7 +404,7 @@
         $out = array();
         $src = $mode == self::INPUT_GET ? $_GET : ($mode == self::INPUT_POST ? $_POST : $_REQUEST);
 
-        foreach ($src as $key => $value) {
+        foreach (array_keys($src) as $key) {
             $fname = $key[0] == '_' ? substr($key, 1) : $key;
             if ($ignore && !preg_match('/^(' . $ignore . ')$/', $fname)) {
                 $out[$fname] = self::get_input_value($key, $mode);
diff --git a/program/lib/Roundcube/rcube_vcard.php b/program/lib/Roundcube/rcube_vcard.php
index aded4aa..90acb21 100644
--- a/program/lib/Roundcube/rcube_vcard.php
+++ b/program/lib/Roundcube/rcube_vcard.php
@@ -481,7 +481,7 @@
         $vcard_block    = '';
         $in_vcard_block = false;
 
-        foreach (preg_split("/[\r\n]+/", $data) as $i => $line) {
+        foreach (preg_split("/[\r\n]+/", $data) as $line) {
             if ($in_vcard_block && !empty($line)) {
                 $vcard_block .= $line . "\n";
             }
diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc
index d8a8e25..8faf76f 100644
--- a/program/steps/addressbook/func.inc
+++ b/program/steps/addressbook/func.inc
@@ -183,7 +183,6 @@
         $attrib['id'] = 'rcmdirectorylist';
 
     $out = '';
-    $local_id = '0';
     $jsdata = array();
 
     $line_templ = html::tag('li', array(
@@ -270,7 +269,6 @@
 
     $groups_html = '';
     $groups = $RCMAIL->get_address_book($args['source'])->list_groups();
-    $js_id = $RCMAIL->JQ($args['source']);
 
     if (!empty($groups)) {
         $line_templ = html::tag('li', array(
@@ -283,7 +281,6 @@
         $is_collapsed = strpos($RCMAIL->config->get('collapsed_abooks',''), '&'.rawurlencode($args['source']).'&') !== false;
         $args['out'] .= html::div('treetoggle ' . ($is_collapsed ? 'collapsed' : 'expanded'), '&nbsp;');
 
-        $jsdata = array();
         foreach ($groups as $group) {
             $groups_html .= sprintf($line_templ,
                 rcube_utils::html_identifier('G' . $args['source'] . $group['ID'], true),
diff --git a/program/steps/addressbook/show.inc b/program/steps/addressbook/show.inc
index d583a6d..1a97c65 100644
--- a/program/steps/addressbook/show.inc
+++ b/program/steps/addressbook/show.inc
@@ -101,8 +101,6 @@
         return false;
     }
 
-    $microformats = array('name' => 'fn', 'email' => 'email');
-
     $form = array(
         'head' => array(  // section 'head' is magic!
             'content' => array(
@@ -177,7 +175,7 @@
 }
 
 
-function rcmail_render_email_value($email, $col)
+function rcmail_render_email_value($email)
 {
     return html::a(array(
         'href' => 'mailto:' . $email,
@@ -188,7 +186,7 @@
 }
 
 
-function rcmail_render_url_value($url, $col)
+function rcmail_render_url_value($url)
 {
     $prefix = preg_match('!^(http|ftp)s?://!', $url) ? '' : 'http://';
     return html::a(array(
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index f4a1daf..c3fc715 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -399,7 +399,7 @@
 {
   global $MESSAGE;
 
-  list($form_start, $form_end) = get_form_tags($attrib);
+  list($form_start,) = get_form_tags($attrib);
 
   $out  = '';
   $part = strtolower($attrib['part']);
@@ -463,7 +463,7 @@
 
 function rcmail_compose_header_from($attrib)
 {
-  global $MESSAGE, $OUTPUT, $RCMAIL, $compose_mode;
+  global $MESSAGE, $OUTPUT, $RCMAIL, $COMPOSE, $compose_mode;
 
   // pass the following attributes to the form class
   $field_attrib = array('name' => '_from');
@@ -566,7 +566,7 @@
 
 function rcmail_prepare_message_body()
 {
-  global $RCMAIL, $MESSAGE, $COMPOSE, $compose_mode, $LINE_LENGTH, $HTML_MODE;
+  global $RCMAIL, $MESSAGE, $COMPOSE, $compose_mode, $HTML_MODE;
 
   // use posted message body
   if (!empty($_POST['_message'])) {
@@ -715,7 +715,7 @@
 
 function rcmail_compose_body($attrib)
 {
-  global $RCMAIL, $CONFIG, $OUTPUT, $MESSAGE, $compose_mode, $LINE_LENGTH, $HTML_MODE, $MESSAGE_BODY;
+  global $RCMAIL, $CONFIG, $OUTPUT, $MESSAGE, $compose_mode, $HTML_MODE, $MESSAGE_BODY;
 
   list($form_start, $form_end) = get_form_tags($attrib);
   unset($attrib['form']);
@@ -899,8 +899,7 @@
   if (!isset($COMPOSE['forward_attachments']) && is_array($MESSAGE->mime_parts))
     $cid_map = rcmail_write_compose_attachments($MESSAGE, $bodyIsHtml);
 
-  $date    = format_date($MESSAGE->headers->date, $RCMAIL->config->get('date_long'));
-  $charset = $RCMAIL->output->get_charset();
+  $date = format_date($MESSAGE->headers->date, $RCMAIL->config->get('date_long'));
 
   if (!$bodyIsHtml) {
     $prefix = "\n\n\n-------- " . rcube_label('originalmessage') . " --------\n";
@@ -954,7 +953,7 @@
 
 function rcmail_create_draft_body($body, $bodyIsHtml)
 {
-  global $MESSAGE, $OUTPUT, $COMPOSE;
+  global $MESSAGE, $COMPOSE;
 
   /**
    * add attachments
@@ -1002,7 +1001,7 @@
   global $RCMAIL, $COMPOSE, $compose_mode;
 
   $loaded_attachments = array();
-  foreach ((array)$COMPOSE['attachments'] as $id => $attachment) {
+  foreach ((array)$COMPOSE['attachments'] as $attachment) {
       $loaded_attachments[$attachment['name'] . $attachment['mimetype']] = $attachment;
   }
 
@@ -1089,7 +1088,7 @@
   $names     = array();
 
   $loaded_attachments = array();
-  foreach ((array)$COMPOSE['attachments'] as $id => $attachment) {
+  foreach ((array)$COMPOSE['attachments'] as $attachment) {
       $loaded_attachments[$attachment['name'] . $attachment['mimetype']] = $attachment;
   }
 
@@ -1498,7 +1497,7 @@
   $select->add(Q(rcube_label('plaintoggle')), 'plain');
 
   return $select->show($useHtml ? 'html' : 'plain');
-
+/*
   foreach ($choices as $value => $text) {
     $attrib['id'] = '_' . $value;
     $attrib['value'] = $value;
@@ -1506,6 +1505,7 @@
   }
 
   return $selector;
+*/
 }
 
 
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 37f37d0..17ab6f9 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -224,7 +224,7 @@
   if (!in_array('threads', $a_show_cols))
     array_unshift($a_show_cols, 'threads');
 
-  $skin_path = $_SESSION['skin_path'] = $CONFIG['skin_path'];
+  $_SESSION['skin_path'] = $CONFIG['skin_path'];
 
   // set client env
   $OUTPUT->add_gui_object('messagelist', $attrib['id']);
@@ -289,7 +289,7 @@
   $thead = $head_replace ? rcmail_message_list_head($_SESSION['list_attrib'], $a_show_cols) : NULL;
 
   // get name of smart From/To column in folder context
-  if (($f = array_search('fromto', $a_show_cols)) !== false) {
+  if (array_search('fromto', $a_show_cols) !== false) {
     $smart_col = rcmail_message_list_smart_column_name();
   }
 
@@ -305,7 +305,7 @@
   }
 
   // loop through message headers
-  foreach ($a_headers as $n => $header) {
+  foreach ($a_headers as $header) {
     if (empty($header))
       continue;
 
@@ -379,7 +379,6 @@
   global $RCMAIL;
 
   $skin_path = $_SESSION['skin_path'];
-  $image_tag = html::img(array('src' => "%s%s", 'alt' => "%s"));
 
   // check to see if we have some settings for sorting
   $sort_col   = $_SESSION['sort_col'];
@@ -415,7 +414,7 @@
   $cells = array();
 
   // get name of smart From/To column in folder context
-  if (($f = array_search('fromto', $a_show_cols)) !== false) {
+  if (array_search('fromto', $a_show_cols) !== false) {
     $smart_col = rcmail_message_list_smart_column_name();
   }
 
@@ -895,7 +894,7 @@
  */
 function rcmail_message_headers($attrib, $headers=null)
 {
-  global $OUTPUT, $MESSAGE, $PRINT_MODE, $RCMAIL;
+  global $MESSAGE, $PRINT_MODE, $RCMAIL;
   static $sa_attrib;
 
   // keep header table attrib
@@ -1080,7 +1079,7 @@
       $header_attrib[$regs[1]] = $value;
 
   if (!empty($MESSAGE->parts)) {
-    foreach ($MESSAGE->parts as $i => $part) {
+    foreach ($MESSAGE->parts as $part) {
       if ($part->type == 'headers') {
         $out .= html::div('message-partheaders', rcmail_message_headers(sizeof($header_attrib) ? $header_attrib : null, $part->headers));
       }
@@ -1737,8 +1736,7 @@
 
     $sent = rcmail_deliver_message($compose, $identity['email'], $mailto, $smtp_error, $body_file, $options);
 
-    if ($sent)
-    {
+    if ($sent) {
       $RCMAIL->storage->set_flag($message->uid, 'MDNSENT');
       return true;
     }
diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc
index 1947c0f..2ad1ba9 100644
--- a/program/steps/mail/show.inc
+++ b/program/steps/mail/show.inc
@@ -228,11 +228,11 @@
 
 function rcmail_message_buttons()
 {
-  global $MESSAGE, $RCMAIL, $CONFIG;
+  global $RCMAIL;
 
   $mbox  = $RCMAIL->storage->get_folder();
   $delim = $RCMAIL->storage->get_hierarchy_delimiter();
-  $dbox  = $CONFIG['drafts_mbox'];
+  $dbox  = $RCMAIL->config->get('drafts_mbox');
 
   // the message is not a draft
   if ($mbox != $dbox && strpos($mbox, $dbox.$delim) !== 0) {
diff --git a/program/steps/settings/edit_prefs.inc b/program/steps/settings/edit_prefs.inc
index 971ed60..468e499 100644
--- a/program/steps/settings/edit_prefs.inc
+++ b/program/steps/settings/edit_prefs.inc
@@ -40,7 +40,7 @@
 
   $out = $form_start;
 
-  foreach ($SECTIONS[$CURR_SECTION]['blocks'] as $idx => $block) {
+  foreach ($SECTIONS[$CURR_SECTION]['blocks'] as $block) {
     if (!empty($block['options'])) {
       $table = new html_table(array('cols' => 2));
 
diff --git a/program/steps/settings/folders.inc b/program/steps/settings/folders.inc
index 0c7d906..34a72dd 100644
--- a/program/steps/settings/folders.inc
+++ b/program/steps/settings/folders.inc
@@ -283,7 +283,6 @@
         $noselect   = false;
         $classes    = array($i%2 ? 'even' : 'odd');
 
-        $folder_js      = Q($folder['id']);
         $folder_utf8    = rcube_charset_convert($folder['id'], 'UTF7-IMAP');
         $display_folder = str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $folder['level'])
             . Q($protected ? rcmail_localize_foldername($folder['id']) : $folder['name']);
@@ -394,7 +393,7 @@
         $a_threaded = (array) $RCMAIL->config->get('message_threading', array());
         $oldprefix  = '/^' . preg_quote($oldname . $delimiter, '/') . '/';
 
-        foreach ($a_threaded as $key => $val) {
+        foreach (array_keys($a_threaded) as $key) {
             if ($key == $oldname) {
                 unset($a_threaded[$key]);
                 $a_threaded[$newname] = true;

--
Gitblit v1.9.1