Skip to content

Commit df2a9a7

Browse files
committed
2.1.0 - PHP 8 support
1 parent e715497 commit df2a9a7

11 files changed

Lines changed: 20 additions & 19 deletions

code/FormGenerator.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ public static function deleteUnfinalizedSubmissions($form_id)
679679
$submission_id = $submission_info["submission_id"];
680680

681681
// delete any files associated with the submission
682-
while (list($col_name, $file_upload_dir) = each($file_field_info)) {
682+
foreach ($file_field_info as $col_name => $file_upload_dir) {
683683
if (!empty($submission_info[$col_name])) {
684684
@unlink("{$file_upload_dir}/{$submission_info[$col_name]}");
685685
}

code/Forms.class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public static function getPublishedForms($form_id)
7777
$configured_forms = $db->fetchAll();
7878

7979
$db->query("
80-
SELECT count(*)
80+
SELECT count(*)
8181
FROM {PREFIX}module_form_builder_forms
8282
");
8383
$db->execute();
@@ -124,7 +124,7 @@ public static function updateConfiguredFormTemplates($published_form_id, $info,
124124
"error_message" => $info["error_message_template_id"]
125125
);
126126

127-
while (list($key, $template_id) = each($template_data)) {
127+
foreach ($template_data as $key => $template_id) {
128128
$db->query("
129129
INSERT INTO {PREFIX}module_form_builder_form_templates (published_form_id, template_type, template_id)
130130
VALUES (:form_id, :template_type, :template_id)
@@ -809,7 +809,7 @@ public static function saveBuilderSettings($info)
809809
"form_offline_page" => $info["form_offline_page_template_id"]
810810
);
811811

812-
while (list($key, $template_id) = each($template_data)) {
812+
foreach ($template_data as $key => $template_id) {
813813
$db->query("
814814
INSERT INTO {PREFIX}module_form_builder_form_templates (published_form_id, template_type, template_id)
815815
VALUES (:published_form_id, :template_type, :template_id)

code/Module.class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ class Module extends CoreModule
1818
protected $author = "Ben Keen";
1919
protected $authorEmail = "ben.keen@gmail.com";
2020
protected $authorLink = "https://formtools.org";
21-
protected $version = "2.0.10";
22-
protected $date = "2018-06-09";
21+
protected $version = "2.1.0";
22+
protected $date = "2023-02-26";
2323
protected $originLanguage = "en_us";
2424

2525
// important! This needs to be updated any time the default template set filename changes
@@ -314,7 +314,7 @@ public function populateDefaultTemplateSets()
314314
TemplateSets::importTemplateSetData($template_set);
315315
}
316316
}
317-
317+
318318

319319
/**
320320
* This adds the "Form Builder" section on the Add Form page.

code/TemplateSets.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,8 @@ public static function getTemplateTypeName($template_type, $L)
263263
$templateTypes = self::getTemplateTypes();
264264

265265
$name = "";
266-
while (list($group_name, $types) = each($templateTypes)) {
267-
while (list($key, $lang_key) = each($types)) {
266+
foreach ($templateTypes as $group_name => $types) {
267+
foreach ($types as $key => $lang_key) {
268268
if ($key == $template_type) {
269269
$name = CoreGeneral::evalSmartyString("{\$" . $lang_key . "}", $L);
270270
}

form_resources/css.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151

5252
$placeholder_id_to_values = $_SESSION["ft"]["form_builder"]["placeholders"];
5353

54-
while (list($placeholder_id, $value) = each($placeholder_id_to_values)) {
54+
foreach ($placeholder_id_to_values as $placeholder_id => $value) {
5555
if (!isset($placeholder_hash[$placeholder_id])) {
5656
continue;
5757
}

form_resources/js.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050

5151
$placeholder_id_to_values = $_SESSION["ft"]["form_builder"]["placeholders"];
5252

53-
while (list($placeholder_id, $value) = each($placeholder_id_to_values)) {
53+
foreach ($placeholder_id_to_values as $placeholder_id => $value) {
5454
if (!isset($placeholder_hash[$placeholder_id])) {
5555
continue;
5656
}

smarty_plugins/function.display_template_set_type.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ function smarty_function_display_template_set_type($params, &$smarty)
1010

1111
$type = $params["type"];
1212

13-
while (list($group_name, $vals) = each($template_types)) {
13+
foreach ($template_types as $group_name => $vals) {
1414
$found = false;
15-
while (list($section_key, $section_name) = each($vals)) {
15+
foreach ($vals as $section_key => $section_name) {
1616
if ($section_key == $type) {
1717
echo "<span class=\"set_type_$section_key\">$section_name</span>";
1818
$found = true;

smarty_plugins/function.display_template_set_usage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function smarty_function_display_template_set_usage($params, &$smarty)
2222
echo "<span class=\"light_grey pad_left_small\">{$L["phrase_not_used"]}</span>";
2323
} else {
2424
echo "<select>";
25-
while (list($form_id, $data) = each($results)) {
25+
foreach ($results as $form_id => $data) {
2626
$form_name = htmlspecialchars($data["form_name"]);
2727
$usage = $data["usage"];
2828

smarty_plugins/function.display_template_type.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ function smarty_function_display_template_type($params, &$smarty)
1212

1313
$type = $params["type"];
1414

15-
while (list($group_name, $vals) = each($template_types)) {
15+
foreach ($template_types as $group_name => $vals) {
1616
$found = false;
17-
while (list($section_key, $section_name) = each($vals)) {
17+
foreach ($vals as $section_key => $section_name) {
1818
if ($section_key == $type) {
1919
$section_name = General::evalSmartyString("{\$" . $section_name . "}", $L);
2020
echo "<span class=\"set_type_$section_key\">$section_name</span>";

smarty_plugins/function.display_template_usage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function smarty_function_display_template_usage($params, &$smarty)
1919
echo "<span class=\"light_grey pad_left_small\">{$L["phrase_not_used"]}</span>";
2020
} else {
2121
echo "<select>";
22-
while (list($form_id, $data) = each($usage)) {
22+
foreach ($usage as $form_id => $data) {
2323
$form_name = htmlspecialchars($data["form_name"]);
2424
$usage = $data["usage"];
2525
echo "<optgroup label=\"$form_name\"></optgroup>";

0 commit comments

Comments
 (0)