From f9dd931caf89cb9df05b68602f7d7d105e2dbc36 Mon Sep 17 00:00:00 2001 From: fusionate Date: Sat, 27 May 2023 03:39:52 +0000 Subject: [PATCH] Email Queue - Edit: Updates for PHP 8.1 --- app/email_queue/email_queue_edit.php | 42 ++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/app/email_queue/email_queue_edit.php b/app/email_queue/email_queue_edit.php index 639c55a3ed..781ea37fff 100644 --- a/app/email_queue/email_queue_edit.php +++ b/app/email_queue/email_queue_edit.php @@ -1,4 +1,28 @@ + Portions created by the Initial Developer are Copyright (C) 2022-2023 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane +*/ //set the include path $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); @@ -32,7 +56,7 @@ } //get http post variables and set them to php variables - if (is_array($_POST)) { + if (!empty($_POST) && is_array($_POST)) { $email_date = $_POST["email_date"]; $email_from = $_POST["email_from"]; $email_to = $_POST["email_to"]; @@ -56,7 +80,7 @@ } //process the http post data by submitted action - if ($_POST['action'] != '' && !empty($_POST['action'])) { + if (!empty($_POST['action']) && !empty($_POST['action'])) { //prepare the array(s) //send the array to the database class @@ -110,7 +134,7 @@ } //parse email addresses to single string csv string - if (substr_count($email_to, "\n") != 0) { + if (isset($email_to) && substr_count($email_to, "\n") != 0) { $email_to_lines = explode("\n", $email_to); if (is_array($email_to_lines) && @sizeof($email_to_lines) != 0) { foreach ($email_to_lines as $email_to_line) { @@ -133,7 +157,7 @@ } } else { - if (substr_count($email_to, ',') != 0) { + if (isset($email_to) && substr_count($email_to, ',') != 0) { $email_to_array = explode(',', $email_to); if (is_array($email_to_array) && @sizeof($email_to_array) != 0) { foreach ($email_to_array as $email_to_address) { @@ -144,7 +168,7 @@ } } } - if (is_array($email_to_addresses) && @sizeof($email_to_addresses) != 0) { + if (!empty($email_to_addresses) && is_array($email_to_addresses) && @sizeof($email_to_addresses) != 0) { $email_to = implode(',', $email_to_addresses); unset($email_to_array, $email_to_addresses); } @@ -188,7 +212,7 @@ } //pre-populate the form - if (is_array($_GET) && $_POST["persistformvar"] != "true") { + if (!empty($_GET) && is_array($_GET) && (empty($_POST["persistformvar"]) || $_POST["persistformvar"] != "true")) { $sql = "select * from v_email_queue "; $sql .= "where email_queue_uuid = :email_queue_uuid "; //$sql .= "and domain_uuid = :domain_uuid "; @@ -281,7 +305,7 @@ echo " ".$text['label-email_to']."\n"; echo "\n"; echo "\n"; - if (substr_count($email_to, ',') != 0) { + if (isset($email_to) && substr_count($email_to, ',') != 0) { echo " \n"; echo "
\n"; - echo $text['description-email_response']."\n"; + echo ($text['description-email_response'] ?? '')."\n"; echo "\n"; echo "\n"; @@ -391,4 +415,4 @@ //include the footer require_once "resources/footer.php"; -?> +?> \ No newline at end of file