[prev in list] [next in list] [prev in thread] [next in thread] 

List:       squirrelmail-cvs
Subject:    [SM-CVS] SF.net SVN: squirrelmail:[14881] trunk/squirrelmail
From:       pdontthink--- via squirrelmail-cvs <squirrelmail-cvs () lists ! sourceforge ! net>
Date:       2021-01-16 9:42:32
Message-ID: 1610790152.291391.21501 () sfp-scm-1 ! v30 ! lw ! sourceforge ! com
[Download RAW message or body]

Revision: 14881
          http://sourceforge.net/p/squirrelmail/code/14881
Author:   pdontthink
Date:     2021-01-16 09:42:31 +0000 (Sat, 16 Jan 2021)
Log Message:
-----------
Remove use of each() as it is deprecated

Modified Paths:
--------------
    trunk/squirrelmail/functions/abook_database.php
    trunk/squirrelmail/functions/addressbook.php
    trunk/squirrelmail/functions/imap_general.php
    trunk/squirrelmail/functions/imap_mailbox.php
    trunk/squirrelmail/functions/mime.php
    trunk/squirrelmail/include/load_prefs.php
    trunk/squirrelmail/include/options/display.php
    trunk/squirrelmail/plugins/calendar/calendar.php
    trunk/squirrelmail/plugins/calendar/day.php
    trunk/squirrelmail/plugins/calendar/functions.php
    trunk/squirrelmail/plugins/squirrelspell/modules/check_me.mod
    trunk/squirrelmail/plugins/squirrelspell/modules/lang_setup.mod
    trunk/squirrelmail/templates/util_addressbook.php

Modified: trunk/squirrelmail/functions/abook_database.php
===================================================================
--- trunk/squirrelmail/functions/abook_database.php	2021-01-16 03:48:14 UTC (rev \
                14880)
+++ trunk/squirrelmail/functions/abook_database.php	2021-01-16 09:42:31 UTC (rev \
14881) @@ -681,7 +681,7 @@
             $sepstr = '';
             $where_clause = '';
             $where_clause_args = array();
-            while (list($undef, $nickname) = each($alias)) {
+            foreach ($alias as $nickname) {
                 $where_clause .= $sepstr . $this->identifier_quote_char . 'nickname' \
. $this->identifier_quote_char . ' = ?';  $where_clause_args[] = $nickname;
                 $sepstr = ' OR ';
@@ -705,7 +705,7 @@
                              $this->table, $this->owner);
 
             $sepstr = '';
-            while (list($undef, $nickname) = each($alias)) {
+            foreach ($alias as $nickname) {
                 $query .= sprintf("%s nickname='%s' ", $sepstr,
                                   $this->dbh->quoteString($nickname));
                 $sepstr = 'OR';

Modified: trunk/squirrelmail/functions/addressbook.php
===================================================================
--- trunk/squirrelmail/functions/addressbook.php	2021-01-16 03:48:14 UTC (rev 14880)
+++ trunk/squirrelmail/functions/addressbook.php	2021-01-16 09:42:31 UTC (rev 14881)
@@ -141,7 +141,7 @@
     /* Load configured LDAP servers (if PHP has LDAP support) */
     if (isset($ldap_server) && is_array($ldap_server)) {
         reset($ldap_server);
-        while (list($undef,$param) = each($ldap_server)) {
+        foreach ($ldap_server as $param) {
             if (!is_array($param))
                 continue;
 
@@ -251,7 +251,7 @@
     
     $write = array();
     $backends = $abook->get_backend_list();
-    while (list($undef,$v) = each($backends)) {
+    foreach ($backends as $v) {
         if ($v->writeable) {
             $write[$v->bnum]=$v->sname;
         }

Modified: trunk/squirrelmail/functions/imap_general.php
===================================================================
--- trunk/squirrelmail/functions/imap_general.php	2021-01-16 03:48:14 UTC (rev 14880)
+++ trunk/squirrelmail/functions/imap_general.php	2021-01-16 09:42:31 UTC (rev 14881)
@@ -1272,7 +1272,7 @@
             $pn = $data2[1];
             $pna = explode(')(', $pn);
             $delnew = array();
-            while (list($k, $v) = each($pna)) {
+            foreach ($pna as $v) {
                 $lst = explode('"', $v);
                 if (isset($lst[3])) {
                     $delnew[$lst[1]] = $lst[3];

Modified: trunk/squirrelmail/functions/imap_mailbox.php
===================================================================
--- trunk/squirrelmail/functions/imap_mailbox.php	2021-01-16 03:48:14 UTC (rev 14880)
+++ trunk/squirrelmail/functions/imap_mailbox.php	2021-01-16 09:42:31 UTC (rev 14881)
@@ -857,10 +857,10 @@
         $lowerbox = strtolower(sm_encode_html_special_chars($value));
         $sel = false;
         if ($show_selected != 0) {
-            reset($show_selected);
-            while (!$sel && (list($x, $val) = each($show_selected))) {
+            foreach ($show_selected as $val)) {
                 if (strtolower($value) == \
strtolower(sm_encode_html_special_chars($val))) {  $sel = true;
+                    break;
                 }
             }
         }

Modified: trunk/squirrelmail/functions/mime.php
===================================================================
--- trunk/squirrelmail/functions/mime.php	2021-01-16 03:48:14 UTC (rev 14880)
+++ trunk/squirrelmail/functions/mime.php	2021-01-16 09:42:31 UTC (rev 14881)
@@ -1382,7 +1382,7 @@
         $fulltag = '<' . $tagname;
         if (is_array($attary) && sizeof($attary)){
             $atts = Array();
-            while (list($attname, $attvalue) = each($attary)){
+            foreach ($attary as $attname => $attvalue){
                 array_push($atts, "$attname=$attvalue");
             }
             $fulltag .= ' ' . join(" ", $atts);
@@ -1816,7 +1816,7 @@
                     $mailbox
                     ){
     $me = 'sq_fixatts';
-    while (list($attname, $attvalue) = each($attary)){
+    foreach ($attary as $attname => $attvalue){
         /**
          * See if this attribute should be removed.
          */

Modified: trunk/squirrelmail/include/load_prefs.php
===================================================================
--- trunk/squirrelmail/include/load_prefs.php	2021-01-16 03:48:14 UTC (rev 14880)
+++ trunk/squirrelmail/include/load_prefs.php	2021-01-16 09:42:31 UTC (rev 14881)
@@ -511,16 +511,20 @@
 // need to adjust $chosen_theme path with SM_PATH 
 $chosen_theme_path = preg_replace("/(\.\.\/){1,}/", SM_PATH, $chosen_theme_path);
 $found_theme = false;
-while (!$found_theme && (list($index, $data) = each($user_themes))) {
-    if ($data['PATH'] == $chosen_theme_path)
+foreach ($user_themes as $data) {
+    if ($data['PATH'] == $chosen_theme_path) {
         $found_theme = true;
+        break;
+    }
 }
 
 if (!$found_theme) {
     $template_themes = $oTemplate->get_alternative_stylesheets(true);
-    while (!$found_theme && (list($path, $name) = each($template_themes))) {
-        if ($path == $chosen_theme_path)
+    foreach ($template_themes as $path => $name) {
+        if ($path == $chosen_theme_path) {
             $found_theme = true;
+            break;
+        }
     }
 }
 

Modified: trunk/squirrelmail/include/options/display.php
===================================================================
--- trunk/squirrelmail/include/options/display.php	2021-01-16 03:48:14 UTC (rev \
                14880)
+++ trunk/squirrelmail/include/options/display.php	2021-01-16 09:42:31 UTC (rev \
14881) @@ -523,9 +523,11 @@
     // Don't assume the new value is there, double check
     // and only save if found
     $found = false;
-    while (!$found && (list($index, $data) = each($icon_themes))) {
-        if ($data['PATH'] == $option->new_value)
+    foreach ($icon_themes as $data) {
+        if ($data['PATH'] == $option->new_value) {
             $found = true;
+            break;
+        }
     }
     
     if (!$found)
@@ -540,17 +542,20 @@
     // Don't assume the new value is there, double check
     // and only save if found
     $found = false;
-    reset($user_themes);
-    while (!$found && (list($index, $data) = each($user_themes))) {
-        if ($data['PATH'] == $option->new_value)
+    foreach ($user_themes as $data) {
+        if ($data['PATH'] == $option->new_value) {
             $found = true;
+            break;
+        }
     }
     
     if (!$found) {
         $template_themes = $oTemplate->get_alternative_stylesheets(true);
-        while (!$found && (list($path, $name) = each($template_themes))) {
-            if ($path == $option->new_value)
+        foreach ($template_themes as $path => $name) {
+            if ($path == $option->new_value) {
                 $found = true;
+                break;
+            }
         }
     }
     

Modified: trunk/squirrelmail/plugins/calendar/calendar.php
===================================================================
--- trunk/squirrelmail/plugins/calendar/calendar.php	2021-01-16 03:48:14 UTC (rev \
                14880)
+++ trunk/squirrelmail/plugins/calendar/calendar.php	2021-01-16 09:42:31 UTC (rev \
14881) @@ -110,10 +110,10 @@
             }
             if (isset($calendardata[$cdate])){
                 $i=0;
-                while ($calfoo = each($calendardata[$cdate])) {
-                    $calbar = $calendardata[$cdate][$calfoo['key']];
+                foreach ($calendardata[$cdate] as $key => $value) {
+                    $calbar = $calendardata[$cdate][$key];
                     // FIXME: how to display multiline task
-                    $title = '['. $calfoo['key']. '] ' .
+                    $title = '['. $key. '] ' .
                         str_replace(array("\r","\n"),array(' ',' \
'),sm_encode_html_special_chars($calbar['message']));  // FIXME: link to nowhere
                     echo "<a href=\"#\" style=\"text-decoration:none; color: "

Modified: trunk/squirrelmail/plugins/calendar/day.php
===================================================================
--- trunk/squirrelmail/plugins/calendar/day.php	2021-01-16 03:48:14 UTC (rev 14880)
+++ trunk/squirrelmail/plugins/calendar/day.php	2021-01-16 09:42:31 UTC (rev 14881)
@@ -80,8 +80,8 @@
     $cdate = $month . $day . $year;
 
     if (isset($calendardata[$cdate])){
-        while ( $calfoo = each($calendardata[$cdate])){
-            $daily_events["$calfoo[key]"] = $calendardata[$cdate][$calfoo['key']];
+        foreach ($calendardata[$cdate] as $key => $value){
+            $daily_events[$key] = $calendardata[$cdate][$key];
         }
     }
 }
@@ -96,7 +96,7 @@
 
     ksort($daily_events,SORT_STRING);
     $eo=0;
-    while ($calfoo = each($daily_events)){
+    foreach ($daily_events as $key => $value) {
         if ($eo==0){
             $eo=4;
         } else {
@@ -103,21 +103,21 @@
             $eo=0;
         }
 
-        $ehour = substr($calfoo['key'],0,2);
-        $eminute = substr($calfoo['key'],2,2);
-        if (!is_array($calfoo['value'])){
+        $ehour = substr($key,0,2);
+        $eminute = substr($key,2,2);
+        if (!is_array($value)){
             echo html_tag( 'tr',
                        html_tag( 'td', $ehour . ':' . $eminute, 'left' ) .
                        html_tag( 'td', '&nbsp;', 'left' ) .
                        html_tag( 'td',
                            "<font size=\"-1\"><a \
                href=\"event_create.php?year=$year&amp;month=$month&amp;day=$day&amp;hour="
                
-                           .substr($calfoo['key'],0,2)."\">".
+                           .substr($key,0,2)."\">".
                            _("ADD") . "</a></font>" ,
                        'center' ) ,
                    '', $color[$eo]);
 
         } else {
-            $calbar=$calfoo['value'];
+            $calbar=$value;
             if ($calbar['length']!=0){
                 $elength = \
'-'.date_intl(_("H:i"),mktime($ehour,$eminute+$calbar['length'],0,1,1,0));  } else {
@@ -133,10 +133,10 @@
                         html_tag( 'td',
                             "<font size=\"-1\"><nobr>\n" .
                             "<a \
                href=\"event_edit.php?year=$year&amp;month=$month&amp;day=$day&amp;hour=".
                
-                            \
substr($calfoo['key'],0,2)."&amp;minute=".substr($calfoo['key'],2,2)."\">". +         \
substr($key,0,2)."&amp;minute=".substr($key,2,2)."\">".  _("EDIT") . \
                "</a>&nbsp;|&nbsp;\n" .
                             "<a \
                href=\"event_delete.php?dyear=$year&amp;dmonth=$month&amp;dday=$day&amp;dhour=".
                
-                            \
substr($calfoo['key'],0,2)."&amp;dminute=".substr($calfoo['key'],2,2). +              \
                substr($key,0,2)."&amp;dminute=".substr($key,2,2).
                             "&amp;year=$year&amp;month=$month&amp;day=$day\">" .
                             _("DEL") . '</a>' .
                             "</nobr></font>\n" ,

Modified: trunk/squirrelmail/plugins/calendar/functions.php
===================================================================
--- trunk/squirrelmail/plugins/calendar/functions.php	2021-01-16 03:48:14 UTC (rev \
                14880)
+++ trunk/squirrelmail/plugins/calendar/functions.php	2021-01-16 09:42:31 UTC (rev \
14881) @@ -71,11 +71,11 @@
         '360' => _("6 hr.")
     );
 
-    while( $bar = each($eventlength)) {
-        if($bar['key']==$selected){
-            echo '        <option value="'.$bar['key'].'" \
selected="selected">'.$bar['value']."</option>\n"; +    foreach($eventlength as $key \
=> $value) { +        if($key==$selected){
+            echo '        <option value="'.$key.'" \
selected="selected">'.$value."</option>\n";  } else {
-            echo '        <option \
value="'.$bar['key'].'">'.$bar['value']."</option>\n"; +            echo '        \
<option value="'.$key.'">'.$value."</option>\n";  }
     }
 }
@@ -103,11 +103,11 @@
         '55'=>'55'
     );
 
-    while ( $bar = each($eventminute)) {
-        if ($bar['key']==$selected){
-            echo '        <option value="'.$bar['key'].'" \
selected="selected">'.$bar['value']."</option>\n"; +    foreach ($eventminute as $key \
=> $value) { +        if ($key==$selected){
+            echo '        <option value="'.$key.'" \
selected="selected">'.$value."</option>\n";  } else {
-            echo '        <option \
value="'.$bar['key'].'">'.$bar['value']."</option>\n"; +            echo '        \
<option value="'.$key.'">'.$value."</option>\n";  }
     }
 }
@@ -141,11 +141,11 @@
         '1' => _("High"),
     );
 
-    while( $bar = each($eventpriority)) {
-        if($bar['key']==$selected){
-            echo '        <option value="'.$bar['key'].'" \
selected="selected">'.$bar['value']."</option>\n"; +    foreach($eventpriority as \
$key => $value) { +        if($key==$selected){
+            echo '        <option value="'.$key.'" \
selected="selected">'.$value."</option>\n";  } else {
-            echo '        <option \
value="'.$bar['key'].'">'.$bar['value']."</option>\n"; +            echo '        \
<option value="'.$key.'">'.$value."</option>\n";  }
     }
 }

Modified: trunk/squirrelmail/plugins/squirrelspell/modules/check_me.mod
===================================================================
--- trunk/squirrelmail/plugins/squirrelspell/modules/check_me.mod	2021-01-16 03:48:14 \
                UTC (rev 14880)
+++ trunk/squirrelmail/plugins/squirrelspell/modules/check_me.mod	2021-01-16 09:42:31 \
UTC (rev 14881) @@ -201,7 +201,7 @@
    */
   $extrajs.= "var suggestions = new Array();\n";
   $i=0;
-  while (list($word, $value) = each($misses)){
+  foreach ($misses as $value){
     if ($value=='_NONE') $value='';
     $extrajs.= "suggestions[$i] = \"$value\";\n";
     $i++;
@@ -213,7 +213,7 @@
    */
   $extrajs.= "var locations= new Array();\n";
   $i=0;
-  while (list($word, $value) = each($locations)){
+  foreach ($locations as $value){
     $extrajs.= "locations[$i] = \"$value\";\n";
     $i++;
   }

Modified: trunk/squirrelmail/plugins/squirrelspell/modules/lang_setup.mod
===================================================================
--- trunk/squirrelmail/plugins/squirrelspell/modules/lang_setup.mod	2021-01-16 \
                03:48:14 UTC (rev 14880)
+++ trunk/squirrelmail/plugins/squirrelspell/modules/lang_setup.mod	2021-01-16 \
09:42:31 UTC (rev 14881) @@ -32,7 +32,7 @@
 $add = '<p><label for="lang_default">'
   . _("Make this dictionary my default selection:")
   . "</label> <select name=\"lang_default\" id=\"lang_default\">\n";
-while (list($avail_lang, $junk) = each($SQSPELL_APP)){
+foreach ($SQSPELL_APP as $avail_lang => $ignore){
   $msg .= "<input type=\"checkbox\" name=\"use_langs[]\" "
     . "value=\"$avail_lang\" id=\"use_langs_$avail_lang\"";
   if (in_array($avail_lang, $langs)) {

Modified: trunk/squirrelmail/templates/util_addressbook.php
===================================================================
--- trunk/squirrelmail/templates/util_addressbook.php	2021-01-16 03:48:14 UTC (rev \
                14880)
+++ trunk/squirrelmail/templates/util_addressbook.php	2021-01-16 09:42:31 UTC (rev \
14881) @@ -39,7 +39,7 @@
         return array();
         
     $contacts = array();
-    while(list($undef,$row) = each($addresses)) {
+    foreach($addresses as $row) {
         $contact = array (
                             'FirstName'      => \
                sm_encode_html_special_chars($row['firstname']),
                             'LastName'       => \
sm_encode_html_special_chars($row['lastname']), @@ -150,7 +150,7 @@
     $backends = array();
     $backends['-1'] = _("All address books");
     $ret = $abook->get_backend_list();
-    while (list($undef,$v) = each($ret)) {
+    foreach ($ret as $v) {
         if ($v->btype == 'local' && !$v->listing) {
             continue;
         }

This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.



-----
squirrelmail-cvs mailing list
List address: squirrelmail-cvs@lists.sourceforge.net
List info (subscribe/unsubscribe/change options): \
                https://lists.sourceforge.net/lists/listinfo/squirrelmail-cvs
Repository: http://squirrelmail.org/svn


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic