From 164b8b842c32cccb2fa012a3f59b8bc0aacd1500 Mon Sep 17 00:00:00 2001 From: Anthony <96078404+AntoniusDC@users.noreply.github.com> Date: Fri, 26 May 2023 16:17:53 -0600 Subject: [PATCH] Update voicemail_edit.php (#6723) * Update voicemail_edit.php --- app/voicemails/voicemail_edit.php | 38 ++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/app/voicemails/voicemail_edit.php b/app/voicemails/voicemail_edit.php index b2f0cc1f59..6eacb91889 100644 --- a/app/voicemails/voicemail_edit.php +++ b/app/voicemails/voicemail_edit.php @@ -49,7 +49,7 @@ $destination = new destinations; //action add or update - if (is_uuid($_REQUEST["id"])) { + if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) { $action = "update"; $voicemail_uuid = $_REQUEST["id"]; } @@ -57,9 +57,19 @@ $action = "add"; } +//set the defaults + $voicemail_id = ''; + $voicemail_password = ''; + $voicemail_alternate_greet_id = ''; + $voicemail_description = ''; + $voicemail_destinations_assigned = ''; + $show_option_delete = ''; + $voicemail_option_digits = ''; + $voicemail_option_description = ''; + //get http variables and set them to php variables - $referer_path = $_REQUEST["referer_path"]; - $referer_query = $_REQUEST["referer_query"]; + $referer_path = $_REQUEST["referer_path"] ?? ''; + $referer_query = $_REQUEST["referer_query"] ?? ''; if (count($_POST) > 0) { //process the http post data by submitted action @@ -286,7 +296,7 @@ } //pre-populate the form - if (count($_GET)>0 && is_uuid($_GET["id"]) && $_POST["persistformvar"] != "true") { + if (!empty($_GET)&& is_uuid($_GET["id"]) && empty($_POST["persistformvar"])) { $voicemail_uuid = $_GET["id"]; $sql = "select * from v_voicemails "; $sql .= "where domain_uuid = :domain_uuid "; @@ -295,7 +305,7 @@ $parameters['voicemail_uuid'] = $voicemail_uuid; $database = new database; $row = $database->select($sql, $parameters, 'row'); - if (is_array($row) && @sizeof($row) != 0) { + if (!empty($row)) { $voicemail_id = $row["voicemail_id"]; $voicemail_password = $row["voicemail_password"]; $greeting_id = $row["greeting_id"]; @@ -317,7 +327,9 @@ } //remove the spaces - $voicemail_mail_to = str_replace(" ", "", $voicemail_mail_to); + if (!empty($voicemail_mail_to)) { + $voicemail_mail_to = str_replace(" ", "", $voicemail_mail_to); + } //set the defaults if (empty($voicemail_local_after_email)) { $voicemail_local_after_email = 'true'; } @@ -396,15 +408,15 @@ $sql .= "from v_voicemails as v "; $sql .= "where v.domain_uuid = :domain_uuid and "; $sql .= "v.voicemail_enabled = 'true' "; - if (is_uuid($voicemail_uuid)) { + if (is_uuid($voicemail_uuid ?? '')) { $sql .= "and v.voicemail_uuid <> :voicemail_uuid "; } - if (is_array($voicemail_destinations) && @sizeof($voicemail_destinations) != 0) { + if (!empty($voicemail_destinations)) { $sql .= "and v.voicemail_uuid not in (".implode(',', $voicemail_destinations).") "; } $sql .= "order by v.voicemail_id asc"; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; - if (is_uuid($voicemail_uuid)) { + if (is_uuid($voicemail_uuid ?? '')) { $parameters['voicemail_uuid'] = $voicemail_uuid; } $database = new database; @@ -420,7 +432,7 @@ require_once "resources/header.php"; //password complexity - $password_complexity = $_SESSION['voicemail']['password_complexity']['boolean']; + $password_complexity = $_SESSION['voicemail']['password_complexity']['boolean'] ?? ''; if ($password_complexity == "true") { echo "