From bc2862211da57b6cde66c6b40a678065a61a4c8b Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 8 Aug 2019 20:10:27 -0600 Subject: [PATCH] FIFO: Database class integration. --- app/fifo/fifo_add.php | 64 +++++++++++++------------- app/fifo_list/fifo_interactive_inc.php | 2 +- app/fifo_list/fifo_list_inc.php | 2 +- 3 files changed, 33 insertions(+), 35 deletions(-) diff --git a/app/fifo/fifo_add.php b/app/fifo/fifo_add.php index 77ec59ce28..53c0cfe077 100644 --- a/app/fifo/fifo_add.php +++ b/app/fifo/fifo_add.php @@ -48,16 +48,16 @@ else { if (count($_POST)>0) { $order_by = $_GET["order_by"]; $order = $_GET["order"]; - $extension_name = check_str($_POST["extension_name"]); - $queue_extension_number = check_str($_POST["queue_extension_number"]); - $agent_queue_extension_number = check_str($_POST["agent_queue_extension_number"]); - $agent_login_logout_extension_number = check_str($_POST["agent_login_logout_extension_number"]); - $dialplan_order = check_str($_POST["dialplan_order"]); - $pin_number = check_str($_POST["pin_number"]); - $profile = check_str($_POST["profile"]); - $flags = check_str($_POST["flags"]); - $dialplan_enabled = check_str($_POST["dialplan_enabled"]); - $dialplan_description = check_str($_POST["dialplan_description"]); + $extension_name = $_POST["extension_name"]; + $queue_extension_number = $_POST["queue_extension_number"]; + $agent_queue_extension_number = $_POST["agent_queue_extension_number"]; + $agent_login_logout_extension_number = $_POST["agent_login_logout_extension_number"]; + $dialplan_order = $_POST["dialplan_order"]; + $pin_number = $_POST["pin_number"]; + $profile = $_POST["profile"]; + $flags = $_POST["flags"]; + $dialplan_enabled = $_POST["dialplan_enabled"]; + $dialplan_description = $_POST["dialplan_description"]; if (strlen($dialplan_enabled) == 0) { $dialplan_enabled = "true"; } //set default to enabled } @@ -95,7 +95,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $dialplan_uuid = uuid(); $dialplan_context = $_SESSION['context']; dialplan_add($domain_uuid, $dialplan_uuid, $extension_name, $dialplan_order, $dialplan_context, $dialplan_enabled, $dialplan_description, $app_uuid); - if (strlen($dialplan_uuid) > 0) { + if (is_uuid($dialplan_uuid)) { //set the destination number $dialplan_detail_tag = 'condition'; //condition, action, antiaction $dialplan_detail_type = 'destination_number'; @@ -104,19 +104,18 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $dialplan_detail_group = '1'; if ((strlen($agent_queue_extension_number) > 0) || (strlen($agent_login_logout_extension_number) > 0)) { $dialplan_detail_break = 'on-true'; - } else { + } + else { $dialplan_detail_break = ''; } dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data, $dialplan_detail_break); //set the hold music - //if (strlen($hold_music) > 0) { - $dialplan_detail_tag = 'action'; //condition, action, antiaction - $dialplan_detail_type = 'set'; - $dialplan_detail_data = 'fifo_music=$${hold_music}'; - $dialplan_detail_order = '001'; - $dialplan_detail_group = '1'; - dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data); - //} + $dialplan_detail_tag = 'action'; //condition, action, antiaction + $dialplan_detail_type = 'set'; + $dialplan_detail_data = 'fifo_music=$${hold_music}'; + $dialplan_detail_order = '001'; + $dialplan_detail_group = '1'; + dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data); //action answer $dialplan_detail_tag = 'action'; //condition, action, antiaction $dialplan_detail_type = 'answer'; @@ -136,7 +135,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $dialplan_detail_group = '1'; dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data); } - } //end if queue_extension_number + } // Caller Queue / Agent Queue @@ -152,7 +151,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { // //-------------------------------------------------------- $queue_name = $extension_name."_agent@\${domain_name}"; - if (strlen($dialplan_uuid) > 0) { + if (is_uuid($dialplan_uuid)) { //set the destination number $dialplan_detail_tag = 'condition'; //condition, action, antiaction $dialplan_detail_type = 'destination_number'; @@ -161,19 +160,18 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $dialplan_detail_group = '2'; if (strlen($agent_login_logout_extension_number) > 0) { $dialplan_detail_break = 'on-true'; - } else { + } + else { $dialplan_detail_break = ''; } dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data, $dialplan_detail_break); //set the hold music - //if (strlen($hold_music) > 0) { - $dialplan_detail_tag = 'action'; //condition, action, antiaction - $dialplan_detail_type = 'set'; - $dialplan_detail_data = 'fifo_music=$${hold_music}'; - $dialplan_detail_order = '001'; - $dialplan_detail_group = '2'; - dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data); - //} + $dialplan_detail_tag = 'action'; //condition, action, antiaction + $dialplan_detail_type = 'set'; + $dialplan_detail_data = 'fifo_music=$${hold_music}'; + $dialplan_detail_order = '001'; + $dialplan_detail_group = '2'; + dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data); //action answer $dialplan_detail_tag = 'action'; //condition, action, antiaction $dialplan_detail_type = 'answer'; @@ -208,7 +206,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { // //-------------------------------------------------------- $queue_name = $extension_name."@\${domain_name}"; - if (strlen($dialplan_uuid) > 0) { + if (is_uuid($dialplan_uuid)) { //set the destination number $dialplan_detail_tag = 'condition'; //condition, action, antiaction $dialplan_detail_type = 'destination_number'; @@ -280,7 +278,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { header("Location: ".PROJECT_PATH."/app/dialplans/dialplans.php?app_uuid=16589224-c876-aeb3-f59f-523a1c0801f7"); return; -} //end if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) +} //show the content echo "
\n"; diff --git a/app/fifo_list/fifo_interactive_inc.php b/app/fifo_list/fifo_interactive_inc.php index 2d652c7a46..200ba607bd 100644 --- a/app/fifo_list/fifo_interactive_inc.php +++ b/app/fifo_list/fifo_interactive_inc.php @@ -233,7 +233,7 @@ echo "".escape($fifo_total_inbound_calls)."  \n"; echo "".escape($fifo_duration_formatted)."  \n"; echo "\n"; - if ($c==0) { $c=1; } else { $c=0; } + $c = $c ? 0 : 1; } echo "\n"; } diff --git a/app/fifo_list/fifo_list_inc.php b/app/fifo_list/fifo_list_inc.php index 19306c5286..fb80272074 100644 --- a/app/fifo_list/fifo_list_inc.php +++ b/app/fifo_list/fifo_list_inc.php @@ -127,7 +127,7 @@ } } - if ($c==0) { $c=1; } else { $c=0; } + $c = $c ? 0 : 1; } echo "\n"; }