فهرست منبع

Merge branch 'trunk' into master

Andy 4 سال پیش
والد
کامیت
69acd51ecc

+ 2 - 2
functions/abook_database.php

@@ -681,7 +681,7 @@ class abook_database extends addressbook_backend {
             $sepstr = '';
             $where_clause = '';
             $where_clause_args = array();
-            foreach($alias as $undef=>$nickname) {
+            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 @@ class abook_database extends addressbook_backend {
                              $this->table, $this->owner);
 
             $sepstr = '';
-            foreach($alias as $undef=>$nickname) {
+            foreach ($alias as $nickname) {
                 $query .= sprintf("%s nickname='%s' ", $sepstr,
                                   $this->dbh->quoteString($nickname));
                 $sepstr = 'OR';

+ 3 - 2
functions/addressbook.php

@@ -140,7 +140,8 @@ function addressbook_init($showerr = true, $onlylocal = false) {
 
     /* Load configured LDAP servers (if PHP has LDAP support) */
     if (isset($ldap_server) && is_array($ldap_server)) {
-        foreach($ldap_server as $undef=>$param) {
+        reset($ldap_server);
+        foreach ($ldap_server as $param) {
             if (!is_array($param))
                 continue;
 
@@ -250,7 +251,7 @@ function getWritableBackends () {
     
     $write = array();
     $backends = $abook->get_backend_list();
-    foreach ($backends as $undef=>$v) {
+    foreach ($backends as $v) {
         if ($v->writeable) {
             $write[$v->bnum]=$v->sname;
         }

+ 1 - 1
functions/imap_general.php

@@ -1343,7 +1343,7 @@ function sqimap_get_delimiter ($imap_stream = false) {
             $pn = $data2[1];
             $pna = explode(')(', $pn);
             $delnew = array();
-            foreach ($pna as $k=>$v) {
+            foreach ($pna as $v) {
                 $lst = explode('"', $v);
                 if (isset($lst[3])) {
                     $delnew[$lst[1]] = $lst[3];

+ 1 - 2
functions/imap_mailbox.php

@@ -857,8 +857,7 @@ function sqimap_mailbox_option_list($imap_stream, $show_selected = 0, $folder_sk
         $lowerbox = strtolower(sm_encode_html_special_chars($value));
         $sel = false;
         if ($show_selected != 0) {
-            reset($show_selected);
-            foreach($show_selected as $x=>$val) {
+            foreach ($show_selected as $val) {
                 if (strtolower($value) == strtolower(sm_encode_html_special_chars($val))) {
                     $sel = true;
                     break;

+ 2 - 2
functions/mime.php

@@ -1386,7 +1386,7 @@ function sq_tagprint($tagname, $attary, $tagtype){
         $fulltag = '<' . $tagname;
         if (is_array($attary) && sizeof($attary)){
             $atts = Array();
-            foreach($attary as $attname=>$attvalue){
+            foreach ($attary as $attname => $attvalue){
                 array_push($atts, "$attname=$attvalue");
             }
             $fulltag .= ' ' . join(" ", $atts);
@@ -1821,7 +1821,7 @@ function sq_fixatts($tagname,
                     $mailbox
                     ){
     $me = 'sq_fixatts';
-    foreach($attary as $attname=>$attvalue){
+    foreach ($attary as $attname => $attvalue){
         /**
          * See if this attribute should be removed.
          */

+ 1 - 20
include/load_prefs.php

@@ -511,32 +511,13 @@ $oTemplate = Template::construct_template($sTemplateID);
 // 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)
-        $found_theme = true;
-}
-*/
-
-foreach ($user_themes as $index => $data) {
+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)
-            $found_theme = true;
-    }
-}
-*/
-
-
 if (!$found_theme) {
     $template_themes = $oTemplate->get_alternative_stylesheets(true);
     foreach ($template_themes as $path => $name) {

+ 5 - 4
include/options/display.php

@@ -523,7 +523,7 @@ function icon_theme_save($option) {
     // Don't assume the new value is there, double check
     // and only save if found
     $found = false;
-    foreach($icon_themes as $index=>$data) {
+    foreach ($icon_themes as $data) {
         if ($data['PATH'] == $option->new_value) {
             $found = true;
             break;
@@ -542,7 +542,8 @@ function css_theme_save ($option) {
     // Don't assume the new value is there, double check
     // and only save if found
     $found = false;
-    foreach($user_themes as $index=>$data) {
+    reset($user_themes);
+    foreach ($user_themes as $data) {
         if ($data['PATH'] == $option->new_value) {
             $found = true;
             break;
@@ -551,8 +552,8 @@ function css_theme_save ($option) {
     
     if (!$found) {
         $template_themes = $oTemplate->get_alternative_stylesheets(true);
-        foreach($template_themes as $path=>$name) {
-            if ($path == $option->new_value){
+        foreach ($template_themes as $path => $name) {
+            if ($path == $option->new_value) {
                 $found = true;
                 break;
             }

+ 3 - 3
plugins/calendar/calendar.php

@@ -110,10 +110,10 @@ function drawmonthview() {
             }
             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: "

+ 10 - 10
plugins/calendar/day.php

@@ -80,8 +80,8 @@ function initialize_events() {
     $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,28 +96,28 @@ function display_events() {
 
     ksort($daily_events,SORT_STRING);
     $eo=0;
-    while ($calfoo = each($daily_events)){
+    foreach ($daily_events as $key => $value) {
         if ($eo==0){
             $eo=4;
         } else {
             $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 @@ function display_events() {
                         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" ,

+ 12 - 12
plugins/calendar/functions.php

@@ -71,11 +71,11 @@ function select_option_length($selected) {
         '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 @@ function select_option_minute($selected) {
         '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 @@ function select_option_priority($selected) {
         '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";
         }
     }
 }

+ 2 - 2
plugins/squirrelspell/modules/check_me.mod

@@ -201,7 +201,7 @@ if ($errors){
    */
   $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 @@ if ($errors){
    */
   $extrajs.= "var locations= new Array();\n";
   $i=0;
-  while (list($word, $value) = each($locations)){
+  foreach ($locations as $value){
     $extrajs.= "locations[$i] = \"$value\";\n";
     $i++;
   }

+ 1 - 1
plugins/squirrelspell/modules/lang_setup.mod

@@ -32,7 +32,7 @@ $langs = sqspell_getSettings();
 $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)) {

+ 2 - 2
templates/util_addressbook.php

@@ -39,7 +39,7 @@ function formatAddressList ($addresses) {
         return array();
         
     $contacts = array();
-    foreach ($addresses as $undef => $row) {
+    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 @@ function getBackends () {
     $backends = array();
     $backends['-1'] = _("All address books");
     $ret = $abook->get_backend_list();
-    foreach ($ret as $undef => $v) {
+    foreach ($ret as $v) {
         if ($v->btype == 'local' && !$v->listing) {
             continue;
         }