Don't use each() deprecated in PHP 7.2

pull/5635/head
Aleksander Machniak 8 years ago
parent f29fd706cf
commit 81f67a4de2

@ -673,8 +673,7 @@ echo $select_param_folding->show(strval($RCI->getprop('mime_param_folding')));
<?php
$plugins = $RCI->list_plugins();
foreach($plugins as $p)
{
foreach ($plugins as $p) {
$p_check = new html_checkbox(array('name' => '_plugins_'.$p['name'], 'id' => 'cfgplugin_'.$p['name'], 'value' => $p['name']));
echo '<dt class="propname"><label>';
echo $p_check->show($p['enabled'] ? $p['name'] : 0);

@ -157,8 +157,8 @@ class enigma_mime_message extends Mail_mime
*/
public function get($params = null, $filename = null, $skip_head = false)
{
if (isset($params)) {
while (list($key, $value) = each($params)) {
if (!empty($params)) {
foreach ($params as $key => $value) {
$this->build_params[$key] = $value;
}
}

@ -537,8 +537,8 @@ class rcmail extends rcube
// we'll only handle unset host (if possible)
if (!$host && !empty($default_host)) {
if (is_array($default_host)) {
list($key, $val) = each($default_host);
$host = is_numeric($key) ? $val : $key;
$key = key($default_host);
$host = is_numeric($key) ? $default_host[$key] : $key;
}
else {
$host = $default_host;
@ -749,8 +749,8 @@ class rcmail extends rcube
// take the first entry if $host is still not set
if (empty($host)) {
list($key, $val) = each($default_host);
$host = is_numeric($key) ? $val : $key;
$key = key($default_host);
$host = is_numeric($key) ? $default_host[$key] : $key;
}
}
else if (empty($default_host)) {

@ -4241,7 +4241,7 @@ class rcube_imap extends rcube_storage
*/
protected function sort_folder_specials($folder, &$list, &$specials, &$out)
{
while (list($key, $name) = each($list)) {
foreach ($list as $key => $name) {
if ($folder === null || strpos($name, $folder.$this->delimiter) === 0) {
$out[] = $name;
unset($list[$key]);

@ -2643,7 +2643,7 @@ class rcube_imap_generic
reset($messages);
while (list($key, $headers) = each($messages)) {
foreach ($messages as $key => $headers) {
$value = null;
switch ($field) {
@ -2685,7 +2685,7 @@ class rcube_imap_generic
}
// form new array based on index
while (list($key, $val) = each($index)) {
foreach ($index as $key => $val) {
$result[$key] = $messages[$key];
}
}
@ -3631,13 +3631,11 @@ class rcube_imap_generic
}
else {
$data['type'] = strtolower($part_a[0]);
// encoding
$data['encoding'] = strtolower($part_a[5]);
// charset
if (is_array($part_a[2])) {
while (list($key, $val) = each($part_a[2])) {
foreach ($part_a[2] as $key => $val) {
if (strcasecmp($val, 'charset') == 0) {
$data['charset'] = $part_a[2][$key+1];
break;

@ -125,7 +125,8 @@ class rcube_message
$this->mime = new rcube_mime($this->headers->charset);
$this->subject = $this->headers->get('subject');
list(, $this->sender) = each($this->mime->decode_address_list($this->headers->from, 1));
$from = $this->mime->decode_address_list($this->headers->from, 1);
$this->sender = current($from);
// notify plugins and let them analyze this structured message object
$this->app->plugins->exec_hook('message_load', array('object' => $this));

@ -101,7 +101,7 @@ class rcube_mime_decode
$return = new stdClass;
$headers = $this->parseHeaders($headers);
while (list($key, $value) = each($headers)) {
foreach ($headers as $value) {
$header_name = strtolower($value['name']);
if (isset($return->headers[$header_name]) && !is_array($return->headers[$header_name])) {
@ -124,10 +124,8 @@ class rcube_mime_decode
$return->ctype_secondary = $regs[2];
}
if (isset($content_type['other'])) {
while (list($p_name, $p_value) = each($content_type['other'])) {
$return->ctype_parameters[$p_name] = $p_value;
}
if (!empty($content_type['other'])) {
$return->ctype_parameters = array_merge((array) $return->ctype_parameters, (array) $content_type['other']);
}
break;
@ -136,10 +134,8 @@ class rcube_mime_decode
$content_disposition = $this->parseHeaderValue($value['value']);
$return->disposition = $content_disposition['value'];
if (isset($content_disposition['other'])) {
while (list($p_name, $p_value) = each($content_disposition['other'])) {
$return->d_parameters[$p_name] = $p_value;
}
if (!empty($content_disposition['other'])) {
$return->d_parameters = array_merge((array) $return->d_parameters, (array) $content_disposition['other']);
}
break;

Loading…
Cancel
Save