From 0c585bcb07eed05ff065970af29e449e74888555 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Mon, 15 May 2023 23:11:23 -0600 Subject: [PATCH] IVR Menu fix some errors and prevent some warnings --- app/ivr_menus/ivr_menu_edit.php | 58 ++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/app/ivr_menus/ivr_menu_edit.php b/app/ivr_menus/ivr_menu_edit.php index 40a0b55b41..1db45f888e 100644 --- a/app/ivr_menus/ivr_menu_edit.php +++ b/app/ivr_menus/ivr_menu_edit.php @@ -50,10 +50,10 @@ $destination = new destinations; //action add or update - if (is_uuid($_REQUEST["id"]) || is_uuid($_REQUEST["ivr_menu_uuid"])) { + if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"]) || !empty($_REQUEST["ivr_menu_uuid"]) && is_uuid($_REQUEST["ivr_menu_uuid"])) { $action = "update"; $ivr_menu_uuid = $_REQUEST["id"]; - if (is_uuid($_REQUEST["ivr_menu_uuid"])) { + if (!empty($_REQUEST["ivr_menu_uuid"])) { $ivr_menu_uuid = $_REQUEST["ivr_menu_uuid"]; } } @@ -62,7 +62,7 @@ } //get total ivr menu count from the database, check limit, if defined - if (is_numeric($_SESSION['limit']['ivr_menus']['numeric'])) { + if (!empty($_SESSION['limit']['ivr_menus']['numeric'])) { $sql = "select count(*) as num_rows from v_ivr_menus where domain_uuid = :domain_uuid "; $parameters['domain_uuid'] = $domain_uuid; $database = new database; @@ -77,14 +77,14 @@ } //get http post values and set them to php variables - if (count($_POST) > 0) { + if (!empty($_POST)) { //process the http post data by submitted action - if ($_POST['action'] != '' && is_uuid($_POST['ivr_menu_uuid'])) { + if (!empty($_POST['action']) && is_uuid($_POST['ivr_menu_uuid'])) { $array[0]['checked'] = 'true'; $array[0]['uuid'] = $_POST['ivr_menu_uuid']; - switch ($_POST['action']) { + switch (!empty($_POST['action']) && $_POST['action']) { case 'copy': if (permission_exists('ivr_menu_add')) { $obj = new ivr_menu; @@ -154,7 +154,7 @@ } //process the http data - if (count($_POST) > 0 && empty($_POST["persistformvar"])) { + if (!empty($_POST) && empty($_POST["persistformvar"])) { //set the domain_uuid if (permission_exists('ivr_menu_domain')) { @@ -215,7 +215,7 @@ //if (empty($ivr_menu_ringback)) { $msg .= $text['message-required'].$text['label-ring_back']."
\n"; } //if (empty($ivr_menu_description)) { $msg .= $text['message-required'].$text['label-description']."
\n"; } - if (!empty($msg) && empty($_POST["persistformvar"])) { + if (!empty($msg) && !empty($_POST["persistformvar"])) { require_once "resources/header.php"; require_once "resources/persist_form_var.php"; echo "
\n"; @@ -232,7 +232,7 @@ if ($_POST["persistformvar"] != "true") { //used for debugging - if ($_POST["debug"] == "true") { + if (!emtpy($_POST["debug"]) && $_POST["debug"] == "true") { unset($_POST["debug"]); echo "
\n";
 						print_r($_POST);
@@ -296,7 +296,7 @@
 					$array['ivr_menus'][0]["ivr_menu_description"] = $ivr_menu_description;
 					$y = 0;
 					foreach ($ivr_menu_options as $row) {
-						if (!empty($row['ivr_menu_option_digits'])) {
+						if (isset($row['ivr_menu_option_digits'])) {
 							if (is_uuid($row['ivr_menu_option_uuid'])) {
 								$ivr_menu_option_uuid = $row['ivr_menu_option_uuid'];
 							}
@@ -457,7 +457,7 @@
 	}
 
 //pre-populate the form
-	if (!is_uuid($ivr_menu_uuid)) { $ivr_menu_uuid = $_REQUEST["id"]; }
+	if (empty($ivr_menu_uuid)) { $ivr_menu_uuid = $_REQUEST["id"]; }
 	if (is_uuid($ivr_menu_uuid) && $_POST["persistformvar"] != "true") {
 		$ivr = new ivr_menu;
 		$ivr->domain_uuid = $_SESSION["domain_uuid"];
@@ -706,13 +706,15 @@
 	echo "		";
 	echo "