diff --git a/app/call_block/call_block_edit.php b/app/call_block/call_block_edit.php
index b52359e3f4..8f4e672f3a 100644
--- a/app/call_block/call_block_edit.php
+++ b/app/call_block/call_block_edit.php
@@ -44,8 +44,14 @@
$language = new text;
$text = $language->get();
+//set the defaults
+ $call_block_name = '';
+ $call_block_country_code = '';
+ $call_block_number = '';
+ $call_block_description = '';
+
//action add or update
- if (is_uuid($_REQUEST["id"])) {
+ if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) {
$action = "update";
$call_block_uuid = $_REQUEST["id"];
}
@@ -53,8 +59,12 @@
$action = "add";
}
+//get order and order by and sanitize the values
+ $order_by = $_GET["order_by"] ?? '';
+ $order = $_GET["order"] ?? '';
+
//get http post variables and set them to php variables
- if (count($_POST) > 0) {
+ if (!empty($_POST)) {
//get the variables from the http post
$call_block_direction = $_POST["call_block_direction"];
$extension_uuid = $_POST["extension_uuid"];
@@ -76,7 +86,7 @@
}
//handle the http post
- if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
+ if (!empty($_POST) && empty($_POST["persistformvar"])) {
//handle action
if (!empty($_POST['action'])) {
@@ -93,7 +103,7 @@
break;
case 'add':
$xml_cdrs = $_POST['xml_cdrs'];
- if (permission_exists('call_block_add') && is_array($xml_cdrs) && @sizeof($xml_cdrs) != 0) {
+ if (!empty($xml_cdrs) && permission_exists('call_block_add')) {
$obj = new call_block;
$obj->call_block_direction = $call_block_direction;
$obj->extension_uuid = $extension_uuid;
@@ -174,7 +184,7 @@
$array['call_block'][0]['call_block_uuid'] = uuid();
$array['call_block'][0]['domain_uuid'] = $_SESSION['domain_uuid'];
$array['call_block'][0]['call_block_direction'] = $call_block_direction;
- if (is_uuid($extension_uuid)) {
+ if (!empty($extension_uuid) && is_uuid($extension_uuid)) {
$array['call_block'][0]['extension_uuid'] = $extension_uuid;
}
$array['call_block'][0]['call_block_name'] = $call_block_name;
@@ -221,7 +231,7 @@
$array['call_block'][0]['call_block_uuid'] = $call_block_uuid;
$array['call_block'][0]['domain_uuid'] = $_SESSION['domain_uuid'];
$array['call_block'][0]['call_block_direction'] = $call_block_direction;
- if (is_uuid($extension_uuid)) {
+ if (!empty($extension_uuid) && is_uuid($extension_uuid)) {
$array['call_block'][0]['extension_uuid'] = $extension_uuid;
}
$array['call_block'][0]['call_block_name'] = $call_block_name;
@@ -248,7 +258,7 @@
}
//pre-populate the form
- if (count($_GET) > 0 && !empty($_POST["persistformvar"])) {
+ if (!empty($_GET) && empty($_POST["persistformvar"])) {
$call_block_uuid = $_GET["id"];
$sql = "select * from v_call_block ";
$sql .= "where domain_uuid = :domain_uuid ";
@@ -404,7 +414,7 @@ if (permission_exists('call_block_all') || permission_exists('call_block_ring_gr
echo " ".$text['label-name']."\n";
echo "\n";
echo "
\n";
- echo " \n";
+ echo " \n";
echo " \n";
echo $text['description-call_block_name']."\n";
echo " | \n";
@@ -415,8 +425,8 @@ if (permission_exists('call_block_all') || permission_exists('call_block_ring_gr
echo " ".$text['label-number']."\n";
echo "\n";
echo "\n";
- echo " \n";
- echo " \n";
+ echo " \n";
+ echo " \n";
echo " \n";
echo $text['description-call_block_number']."\n";
echo " \n";
@@ -529,7 +539,7 @@ if (permission_exists('call_block_all') || permission_exists('call_block_ring_gr
echo " ".$text['label-description']."\n";
echo " | \n";
echo "\n";
- echo " \n";
+ echo " \n";
echo " \n";
echo $text['description-description']."\n";
echo " | \n";
@@ -546,7 +556,7 @@ if (permission_exists('call_block_all') || permission_exists('call_block_ring_gr
echo "";
//get recent calls from the db (if not editing an existing call block record)
- if (!is_uuid($_REQUEST["id"])) {
+ if (empty($_REQUEST["id"])) {
//without block all permission, limit to assigned extension(s)
if (!permission_exists('call_block_all') && !empty($_SESSION['user']['extension'])) {
@@ -571,7 +581,7 @@ if (permission_exists('call_block_all') || permission_exists('call_block_ring_gr
$sql = "select caller_id_name, caller_id_number, caller_destination, start_epoch, direction, hangup_cause, duration, billsec, xml_cdr_uuid ";
$sql .= "from v_xml_cdr where domain_uuid = :domain_uuid ";
$sql .= "and direction <> 'local' ";
- $sql .= $sql_where;
+ $sql .= $sql_where ?? null;
$sql .= "order by start_stamp desc ";
$sql .= limit_offset($_SESSION['call_block']['recent_call_limit']['text']);
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
diff --git a/app/call_broadcast/call_broadcast.php b/app/call_broadcast/call_broadcast.php
index 683b2e7a29..db1eeec77c 100644
--- a/app/call_broadcast/call_broadcast.php
+++ b/app/call_broadcast/call_broadcast.php
@@ -111,9 +111,10 @@
$num_rows = $database->select($sql, $parameters ?? null, 'column');
//prepare the paging
+ $param = '';
$rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50;
if (!empty($search)) {
- $param = "&search=".urlencode($search);
+ $param .= "&search=".urlencode($search);
}
if ($show == "all" && permission_exists('call_broadcast_all')) {
$param .= "&show=all";
diff --git a/app/call_broadcast/call_broadcast_edit.php b/app/call_broadcast/call_broadcast_edit.php
index b9df1d6236..4840890ca2 100644
--- a/app/call_broadcast/call_broadcast_edit.php
+++ b/app/call_broadcast/call_broadcast_edit.php
@@ -295,8 +295,8 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) {
$parameters['domain_uuid'] = $domain_uuid;
$parameters['call_broadcast_uuid'] = $call_broadcast_uuid;
$database = new database;
- $row = $database->select($sql, $parameters ?? null, 'row');
- if (is_array($row) && @sizeof($row) != 0) {
+ $row = $database->select($sql, $parameters, 'row');
+ if (!empty($row)) {
$broadcast_name = $row["broadcast_name"];
$broadcast_start_time = $row["broadcast_start_time"];
$broadcast_timeout = $row["broadcast_timeout"];
@@ -433,7 +433,7 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) {
//$parameters['domain_uuid'] = $domain_uuid;
//$database = new database;
//$rows = $database->select($sql, $parameters, 'all');
- //if (is_array($rows) && @sizeof($rows) != 0) {
+ //if (!empty($rows)) {
// foreach ($rows as $row) {
// if ($recording_uuid == $row['recording_uuid']) {
// echo " \n";
diff --git a/app/call_broadcast/call_broadcast_send.php b/app/call_broadcast/call_broadcast_send.php
index 3ddb5b6301..1be85be155 100644
--- a/app/call_broadcast/call_broadcast_send.php
+++ b/app/call_broadcast/call_broadcast_send.php
@@ -83,7 +83,7 @@
$parameters['call_broadcast_uuid'] = $call_broadcast_uuid;
$database = new database;
$row = $database->select($sql, $parameters, 'row');
- if (is_array($row) && sizeof($row) != 0) {
+ if (!empty($row)) {
$broadcast_name = $row["broadcast_name"];
$broadcast_start_time = $row["broadcast_start_time"];
$broadcast_timeout = $row["broadcast_timeout"];
diff --git a/app/call_centers/call_center_agent_edit.php b/app/call_centers/call_center_agent_edit.php
index 9c057d4c8e..24d941c2f2 100644
--- a/app/call_centers/call_center_agent_edit.php
+++ b/app/call_centers/call_center_agent_edit.php
@@ -46,6 +46,11 @@
$language = new text;
$text = $language->get();
+//set the defaults
+ $agent_id = '';
+ $agent_name = '';
+ $agent_password = '';
+
//check for duplicates
if (!empty($_GET["check"]) == 'duplicate') {
//agent id
@@ -401,7 +406,7 @@
echo " ".$text['label-agent_name']."\n";
echo "\n";
echo "\n";
- echo " \n";
+ echo " \n";
/*
echo " | \n";
echo "\n";
- echo " \n";
+ echo " \n";
echo " \n";
echo " \n";
echo $text['description-agent_id']."\n";
@@ -481,7 +486,7 @@
echo " ".$text['label-agent_password']."\n";
echo " | \n";
echo "\n";
- echo " \n";
+ echo " \n";
echo " \n";
echo $text['description-agent_password']."\n";
echo " | \n";
diff --git a/app/call_centers/call_center_agent_status.php b/app/call_centers/call_center_agent_status.php
index f5e7424638..5fe53c465e 100644
--- a/app/call_centers/call_center_agent_status.php
+++ b/app/call_centers/call_center_agent_status.php
@@ -51,8 +51,8 @@
$sql .= "where domain_uuid = :domain_uuid ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$database = new database;
- $tiers = $database->select($sql, $parameters ?? null, 'all');
- if (is_array($tiers) && count($tiers) == 0) {
+ $tiers = $database->select($sql, $parameters, 'all');
+ if (!empty($tiers)) {
$per_queue_login = true;
}
else {
@@ -69,7 +69,7 @@
$sql .= "order by agent_name asc ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$database = new database;
- $agents = $database->select($sql, $parameters ?? null, 'all');
+ $agents = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
//get the agent list from event socket
@@ -91,7 +91,7 @@
$sql .= "order by queue_name asc ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$database = new database;
- $call_center_queues = $database->select($sql, $parameters ?? null, 'all');
+ $call_center_queues = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
//view_array($call_center_queues, false);
@@ -228,7 +228,7 @@
//get the queue_id
if (isset($row['queue_uuid']) && is_uuid($row['queue_uuid'])) {
- if (is_array($call_center_queues)) {
+ if (!empty($call_center_queues)) {
foreach ($call_center_queues as $queue) {
if ($queue['call_center_queue_uuid'] == $row['queue_uuid']) {
$queue_id = $queue['queue_extension'].'@'.$queue['domain_name'];
@@ -336,7 +336,7 @@
echo " \n";
echo "\n";
- if (!empty($_POST['agents']) && is_array($_POST['agents']) && !$per_queue_login) {
+ if (!empty($_POST['agents']) && !$per_queue_login) {
echo $text['description-call_center_agent_status']."\n";
echo "
\n";
}
@@ -376,14 +376,14 @@
if ($per_queue_login) {
$html .= " ";
- if (is_array($row['queues'])) {
+ if (!empty($row['queues'])) {
$html .= " \n";
$html .= " \n";
$html .= " | ".$text['label-queue']." | \n";
$html .= " ".$text['label-status']." | \n";
$html .= " ".$text['label-options']." | \n";
$html .= " \n";
- if (is_array($row['queues'])) {
+ if (!empty($row['queues'])) {
foreach ($row['queues'] as $queue) {
$x++;
$onclick = "onclick=\"cycle('agents[".$x."][agent_status]');\"";
diff --git a/app/call_centers/call_center_queue_edit.php b/app/call_centers/call_center_queue_edit.php
index c69bf5f588..ef6a05b64f 100644
--- a/app/call_centers/call_center_queue_edit.php
+++ b/app/call_centers/call_center_queue_edit.php
@@ -46,6 +46,15 @@
$language = new text;
$text = $language->get();
+//set the defaults
+ $queue_name = '';
+ $queue_extension = '';
+ $queue_time_base_score_sec = '';
+ $queue_cid_prefix = '';
+ $queue_announce_frequency = '';
+ $queue_cc_exit_keys = '';
+ $queue_description = '';
+
//action add or update
if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) {
$action = "update";
@@ -65,7 +74,7 @@
$sql .= "where domain_uuid = :domain_uuid ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$database = new database;
- $total_call_center_queues = $database->select($sql, $parameters ?? null, 'column');
+ $total_call_center_queues = $database->select($sql, $parameters, 'column');
unset($sql, $parameters);
if ($total_call_center_queues >= $_SESSION['limit']['call_center_queues']['numeric']) {
@@ -133,7 +142,7 @@
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$parameters['call_center_tier_uuid'] = $call_center_tier_uuid;
$database = new database;
- $tiers = $database->select($sql, $parameters ?? null, 'all');
+ $tiers = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
if (!empty($tiers)) {
@@ -418,12 +427,12 @@
$cache->delete("dialplan:".$_SESSION["domain_name"]);
//clear the destinations session array
- if (!empty($_SESSION['destinations']['array'])) {
+ if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//redirect the user
- if (!empty($action)) {
+ if (isset($action)) {
if ($action == "add") {
message::add($text['message-add']);
}
@@ -497,7 +506,7 @@
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$parameters['call_center_queue_uuid'] = $call_center_queue_uuid;
$database = new database;
- $call_center_queues = $database->select($sql, $parameters ?? null, 'all');
+ $call_center_queues = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
if (!empty($call_center_queues)) {
@@ -545,7 +554,7 @@
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$parameters['call_center_queue_uuid'] = $call_center_queue_uuid ?? null;
$database = new database;
- $tiers = $database->select($sql, $parameters ?? null, 'all');
+ $tiers = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
//add an empty row to the tiers array
@@ -573,7 +582,7 @@
$sql .= "order by agent_name asc";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$database = new database;
- $agents = $database->select($sql, $parameters ?? null, 'all');
+ $agents = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
//get the sounds
@@ -605,7 +614,7 @@
$sql .= "order by recording_name asc ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$database = new database;
- $recordings = $database->select($sql, $parameters ?? null, 'all');
+ $recordings = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
//get the phrases
@@ -613,7 +622,7 @@
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
$parameters['domain_uuid'] = $domain_uuid;
$database = new database;
- $phrases = $database->select($sql, $parameters ?? null, 'all');
+ $phrases = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
//show the header
@@ -626,7 +635,7 @@
require_once "resources/header.php";
//only allow a uuid
- if (!empty($call_center_queue_uuid) && !is_uuid($call_center_queue_uuid)) {
+ if (empty($call_center_queue_uuid)) {
$call_center_queue_uuid = null;
}
@@ -698,7 +707,7 @@
echo " ".$text['label-queue_name']."\n";
echo "\n";
echo "\n";
- echo " \n";
+ echo " \n";
echo " \n";
echo $text['description-queue_name']."\n";
echo " | \n";
@@ -709,7 +718,7 @@
echo " ".$text['label-extension']."\n";
echo "\n";
echo "\n";
- echo " \n";
+ echo " \n";
echo " \n";
echo $text['description-extension']."\n";
echo " | \n";
@@ -948,7 +957,7 @@
echo " ".$text['label-time_base_score_sec']."\n";
echo "\n";
echo "\n";
- echo " \n";
+ echo " \n";
echo " \n";
echo $text['description-time_base_score_sec']."\n";
echo " | \n";
@@ -1121,7 +1130,7 @@
echo " ".$text['label-caller_id_name_prefix']."\n";
echo "\n";
echo "\n";
- echo " \n";
+ echo " \n";
echo " \n";
echo $text['description-caller_id_name_prefix']."\n";
echo " | \n";
@@ -1287,7 +1296,7 @@
echo " ".$text['label-caller_announce_frequency']."\n";
echo "\n";
echo "\n";
- echo " \n";
+ echo " \n";
echo " \n";
echo $text['description-caller_announce_frequency']."\n";
echo " | \n";
@@ -1299,7 +1308,7 @@
echo " ".$text['label-exit_keys']."\n";
echo "\n";
echo "\n";
- echo " \n";
+ echo " \n";
echo " \n";
echo $text['description-exit_keys']."\n";
echo " | \n";
@@ -1323,7 +1332,7 @@
echo " ".$text['label-description']."\n";
echo "\n";
echo "\n";
- echo " \n";
+ echo " \n";
echo " \n";
echo $text['description-description']."\n";
echo " | \n";
diff --git a/app/call_centers/call_center_queues.php b/app/call_centers/call_center_queues.php
index c97eaf5008..fefa08e7fe 100644
--- a/app/call_centers/call_center_queues.php
+++ b/app/call_centers/call_center_queues.php
@@ -46,6 +46,9 @@
$language = new text;
$text = $language->get();
+//set additional variables
+ $show = $_GET["show"] ?? '';
+
//set from session variables
$list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false';
@@ -107,7 +110,7 @@
//prepare to page the results
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
$param = "&search=".urlencode($search);
- if (!empty($_GET['show']) == "all" && permission_exists('call_center_all')) {
+ if ($show == "all" && permission_exists('call_center_all')) {
$param .= "&show=all";
}
$page = $_GET['page'] ?? '';
@@ -160,7 +163,7 @@
}
echo " |