]> git.agnieray.net Git - galette.git/commitdiff
Replace all each() calls
authorJohan Cwiklinski <johan@x-tnd.be>
Sun, 16 Apr 2017 21:06:52 +0000 (23:06 +0200)
committerJohan Cwiklinski <johan@x-tnd.be>
Sun, 16 Apr 2017 21:06:52 +0000 (23:06 +0200)
galette/ajax_plugins_initdb.php
galette/includes/routes/management.routes.php
galette/lib/Galette/Core/Install.php
galette/lib/Galette/Entity/Contribution.php
galette/lib/Galette/Entity/DynamicFields.php
galette/lib/Galette/Entity/Transaction.php
galette/self_adherent.php

index 73302116d4eef59295c68437cc73bd4d78a35bda..1ccd9a775f9067a6ac901a47ee499b86b7c55ef0 100644 (file)
@@ -275,7 +275,7 @@ case 'u4':
     }
 
     $sql_query = '';
-    while (list($key, $val) = each($update_scripts) ) {
+    foreach ($update_scripts as $key => $val) {
         $sql_query .= @fread(
             @fopen($plugin['root'] . '/scripts/' . $val, 'r'),
             @filesize($plugin['root'] . '/scripts/' . $val)
index eba806ae3d7a177f0ff7fcc766fd74b6793fa592..c0167ab53f8c8110478a7b3f4ae243233d387c8e 100644 (file)
@@ -419,7 +419,7 @@ $app->post(
             }
 
             // missing required fields?
-            while (list($key, $val) = each($required)) {
+            foreach ($required as $key => $val) {
                 if (!isset($pref[$key])) {
                     $this->flash->addMessage(
                         'error_detected',
@@ -464,7 +464,7 @@ $app->post(
 
             if (count($this->flash->getMessage('error_detected')) == 0) {
                 // update preferences
-                while (list($champ,$valeur) = each($insert_values)) {
+                foreach ($insert_values as $champ=>$valeur) {
                     if ($this->login->isSuperAdmin()
                         || (!$this->login->isSuperAdmin()
                         && ($champ != 'pref_admin_pass' && $champ != 'pref_admin_login'))
@@ -887,7 +887,7 @@ $app->map(
                 }
 
                 $sql_query = '';
-                while (list($key, $val) = each($update_scripts)) {
+                foreach ($update_scripts as $key => $val) {
                     $sql_query .= @fread(
                         @fopen($plugin['root'] . '/scripts/' . $val, 'r'),
                         @filesize($plugin['root'] . '/scripts/' . $val)
@@ -2750,7 +2750,7 @@ $app->post(
             }
 
             // Validate form
-            while (list($key, $value) = each($post)) {
+            foreach ($post as $key => $value) {
                 if (substr($key, 0, 11) == 'text_trans_') {
                     $trans_lang = substr($key, 11);
                     $trans_lang = str_replace('_utf8', '.utf8', $trans_lang);
index ff48ef4ae87a41a1b088c1e8a6a554bc0c00ce88..816bc6dfe920efe8d9aaa00cabffd5911e1b114e 100644 (file)
@@ -628,7 +628,7 @@ class Install
         $this->_report = array();
         $scripts_path = GALETTE_ROOT . '/install/scripts/';
 
-        while (list($key, $val) = each($update_scripts)) {
+        foreach ($update_scripts as $key => $value) {
             if (substr($val, -strlen('.sql')) === '.sql') {
                 //just a SQL script, run it
                 $script = fopen($scripts_path . $val, 'r');
index b6bf67c54097ec301f1d6ccc7905424dc597e438..45db353e31453c82630dede6f97689c5d2db04b0 100644 (file)
@@ -421,7 +421,7 @@ class Contribution
         }
 
         // missing required fields?
-        while (list($key, $val) = each($required)) {
+        foreach ($required as $key => $val) {
             if ($val === 1) {
                 $prop = '_' . $this->_fields[$key]['propname'];
                 if (!isset($disabled[$key])
index bcc8ea7e26d80c67a0e156c7ba0cb843e60baae3..23d46f20707f33d051a7e4f8581eff7f58c3cf95 100644 (file)
@@ -446,7 +446,7 @@ class DynamicFields
                 }
             }
 
-            while (list($key, $value) = each($post)) {
+            foreach ($post as $key => $value) {
                 // if the field is enabled, check it
                 if (!isset($disabled[$key])) {
                     if (substr($key, 0, 11) == 'info_field_') {
@@ -473,7 +473,7 @@ class DynamicFields
                 }
             }
 
-            while (list($key, $value) = each($files)) {
+            foreach ($files as $key => $value) {
                 // if the field is disabled, skip it
                 if (isset($disabled[$key])) {
                     continue;
@@ -651,8 +651,8 @@ class DynamicFields
     public function setAllFields($form_name, $item_id, $all_values)
     {
         $ret = true;
-        while (list($field_id, $contents) = each($all_values)) {
-            while (list($val_index, $field_val) = each($contents)) {
+        foreach ($all_values as $field_id => $contents) {
+            foreach ($contents as $val_index => $field_val) {
                 $res = $this->setField(
                     $form_name,
                     $item_id,
index cc669c02bc927e772c6d3850d5a99f82c9bb4df3..28f0967b6fa2f2b1c06ca9b7badb1e1d78385b09 100644 (file)
@@ -313,7 +313,7 @@ class Transaction
         }
 
         // missing required fields?
-        while (list($key, $val) = each($required)) {
+        foreach ($required as $key => $val) {
             if ($val === 1) {
                 $prop = '_' . $this->_fields[$key]['propname'];
                 if (!isset($disabled[$key]) && !isset($this->$prop)) {
index 20c44f7bdab2c4fd1569a3a8be8564f60f893160..3732b4a3621bc5e8aa9d3b09ea0a054af342a258 100644 (file)
@@ -245,7 +245,7 @@ if ( isset($_POST["nom_adh"]) ) {
         }
     }
 } elseif ( isset($_POST["update_lang"]) && $_POST["update_lang"] == 1 ) {
-    while ( list($key, $properties) = each($fields) ) {
+    foreach ($fields as $key => $properties) {
         $key = strtolower($key);
         if ( isset($_POST[$key]) ) {
             $adherent[$key] = trim($_POST[$key]);