diff --git a/app/tftp/app_defaults.php b/app/tftp/app_defaults.php index 4e2a4324c7..90aac78fd7 100644 --- a/app/tftp/app_defaults.php +++ b/app/tftp/app_defaults.php @@ -60,22 +60,21 @@ unset ($prep_statement, $sql); //find the missing default settings - $x = 0; + $missing = []; foreach ($array as $setting) { $found = false; - $missing[$x] = $setting; foreach ($default_settings as $row) { - if (trim($row['default_setting_subcategory']) == trim($setting['default_setting_subcategory'])) { + if (trim($row['default_setting_subcategory']) == trim($setting['default_setting_subcategory'])) { $found = true; - //remove items from the array that were found - unset($missing[$x]); + break; } } - $x++; + + if (!$found) $missing[] = $setting; } //add the missing default settings - if (count($missing) > 0) foreach ($missing as $row) { + foreach ($missing as $row) { //add the default settings $orm = new orm; $orm->name('default_settings');