persistformvar [Function]: Updates for PHP 8.1

This commit is contained in:
fusionate 2023-05-17 07:02:02 +00:00
parent d853209c3f
commit 3487b8ae53
No known key found for this signature in database
1 changed files with 5 additions and 5 deletions

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2018 Portions created by the Initial Developer are Copyright (C) 2008-2023
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@ -28,11 +28,11 @@ function persistformvar($form_array) {
// Remember Form Input Values // Remember Form Input Values
$content = ''; $content = '';
if (!empty($form_array)) { if (!empty($form_array)) {
$content .= "<form method='post' action='".escape($_SERVER["HTTP_REFERER"])."' target='_self'>\n"; $content .= "<form method='post' action='".escape($_SERVER["HTTP_REFERER"] ?? '')."' target='_self'>\n";
foreach($form_array as $key => $val) { foreach ($form_array as $key => $val) {
if ($key == "XID" || $key == "ACT" || $key == "RET") continue; if ($key == "XID" || $key == "ACT" || $key == "RET") continue;
if ($key != "persistform") { //clears the persistform value if ($key != "persistform") { //clears the persistform value
$content .= " <input type='hidden' name='".escape($key)."' value='".escape($val)."' />\n"; $content .= " <input type='hidden' name='".escape($key ?? '')."' value='".(!is_array($val) ? escape($val ?? '') : null)."' />\n";
} }
} }
$content .= " <input type='hidden' name='persistformvar' value='true' />\n"; //sets persistform to yes $content .= " <input type='hidden' name='persistformvar' value='true' />\n"; //sets persistform to yes
@ -45,4 +45,4 @@ function persistformvar($form_array) {
//persistformvar($_POST); //persistformvar($_POST);
//persistformvar($_GET); //persistformvar($_GET);
?> ?>