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 $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 .= " \n"; $html .= " \n"; $html .= " \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"; @@ -709,7 +718,7 @@ echo " ".$text['label-extension']."\n"; echo "\n"; echo "\n"; @@ -948,7 +957,7 @@ echo " ".$text['label-time_base_score_sec']."\n"; echo "\n"; echo "\n"; @@ -1121,7 +1130,7 @@ echo " ".$text['label-caller_id_name_prefix']."\n"; echo "\n"; echo "\n"; @@ -1287,7 +1296,7 @@ echo " ".$text['label-caller_announce_frequency']."\n"; echo "\n"; echo "\n"; @@ -1299,7 +1308,7 @@ echo " ".$text['label-exit_keys']."\n"; echo "\n"; echo "\n"; @@ -1323,7 +1332,7 @@ echo " ".$text['label-description']."\n"; echo "\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 "\n"; if (permission_exists('call_center_all')) { - if (!empty($_GET['show']) == 'all') { + if ($show == 'all') { echo " "; } else { @@ -199,7 +202,7 @@ echo " \n"; echo " \n"; } - if (!empty($_GET['show']) == "all" && permission_exists('call_center_all')) { + if ($show == "all" && permission_exists('call_center_all')) { echo th_order_by('domain_name', $text['label-domain'], $order_by, $order, $param, "class='shrink'"); } echo th_order_by('queue_name', $text['label-queue_name'], $order_by, $order); @@ -236,7 +239,7 @@ echo " \n"; echo " \n"; } - if (!empty($_GET['show']) == "all" && permission_exists('call_center_all')) { + if ($show == "all" && permission_exists('call_center_all')) { if (!empty($_SESSION['domains'][$row['domain_uuid']]['domain_name'])) { $domain = $_SESSION['domains'][$row['domain_uuid']]['domain_name']; } diff --git a/app/call_flows/call_flow_edit.php b/app/call_flows/call_flow_edit.php index 98b0251afb..2e6495c927 100644 --- a/app/call_flows/call_flow_edit.php +++ b/app/call_flows/call_flow_edit.php @@ -46,6 +46,17 @@ $language = new text; $text = $language->get(); +//set the defaults + $call_flow_sound = ''; + $call_flow_alternate_sound = ''; + $call_flow_name = ''; + $call_flow_extension = ''; + $call_flow_feature_code = ''; + $call_flow_pin_number = ''; + $call_flow_label = ''; + $call_flow_alternate_label = ''; + $call_flow_description = ''; + //action add or update if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) { $action = "update"; @@ -140,12 +151,12 @@ } //add the call_flow_uuid - if (!is_uuid($call_flow_uuid)) { + if (empty($call_flow_uuid)) { $call_flow_uuid = uuid(); } //add the dialplan_uuid - if (!is_uuid($dialplan_uuid)) { + if (empty($dialplan_uuid)) { $dialplan_uuid = uuid(); } @@ -310,7 +321,7 @@ $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $parameters['call_flow_uuid'] = $call_flow_uuid; $database = new database; - $result = $database->select($sql, $parameters ?? null, 'all'); + $result = $database->select($sql, $parameters, 'all'); foreach ($result as $row) { //set the php variables $call_flow_uuid = $row["call_flow_uuid"]; @@ -365,7 +376,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($parameters, $sql); if (if_group("superadmin")) { @@ -443,7 +454,7 @@ $sql = "select * from v_phrases where domain_uuid = :domain_uuid "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; - $result = $database->select($sql, $parameters ?? null, 'all'); + $result = $database->select($sql, $parameters, 'all'); unset($parameters, $sql); if (!empty($result)) { echo "\n"; @@ -532,7 +543,7 @@ echo " ".$text['label-call_flow_name']."\n"; echo "\n"; echo "\n"; @@ -543,7 +554,7 @@ echo " ".$text['label-call_flow_extension']."\n"; echo "\n"; echo "\n"; @@ -554,7 +565,7 @@ echo " ".$text['label-call_flow_feature_code']."\n"; echo "\n"; echo "\n"; @@ -610,7 +621,7 @@ echo " ".$text['label-call_flow_pin_number']."\n"; echo "\n"; echo "\n"; @@ -621,7 +632,7 @@ echo " ".$text['label-call_flow_label']."\n"; echo "\n"; echo "\n"; @@ -665,7 +676,7 @@ echo " ".$text['label-call_flow_alternate_label']."\n"; echo "\n"; echo "\n"; @@ -737,7 +748,7 @@ echo " ".$text['label-call_flow_description']."\n"; echo "\n"; echo "\n"; diff --git a/app/call_forward/call_forward.php b/app/call_forward/call_forward.php index 65889c7edd..2ce1cff58d 100644 --- a/app/call_forward/call_forward.php +++ b/app/call_forward/call_forward.php @@ -89,7 +89,7 @@ $search = strtolower($_GET["search"] ?? ''); //set the show variable - $show = $_GET['show'] ?? 'domain'; + $show = $_GET['show'] ?? ''; //define select count query $sql = "select count(*) from v_extensions "; @@ -131,8 +131,6 @@ //prepare the paging $rows_per_page = !empty($_SESSION['domain']['paging']['numeric']) ? $_SESSION['domain']['paging']['numeric'] : 50; - $params[] = "app_uuid=" . call_forward::APP_UUID; - if ($search) { $params[] = "search=" . $search; } @@ -143,7 +141,7 @@ $params[] = "order=" . $order; } if ($show == "all" && permission_exists('call_forward_all')) { - $params[] .= "show=all"; + $params[] = "show=all"; } $param = !empty($params) ? implode('&', $params) : ''; unset($params); diff --git a/app/conference_centers/conference_rooms.php b/app/conference_centers/conference_rooms.php index 2de9b9c905..5b1eb54378 100644 --- a/app/conference_centers/conference_rooms.php +++ b/app/conference_centers/conference_rooms.php @@ -197,7 +197,7 @@ //get the conference rooms $conference_center->rows_per_page = $rows_per_page; - $conference_center->offset = $offset; + $conference_center->offset = $offset ?? ''; $conference_center->order_by = $order_by; $conference_center->order = $order; if (!empty($search)) { @@ -446,7 +446,7 @@ // } // echo " \n"; - if (strlen($conference[$meeting_uuid]["session_uuid"])) { + if (!empty($conference) && !empty($meeting_uuid) && strlen($conference[$meeting_uuid]["session_uuid"])) { echo " \n"; } else { diff --git a/app/conference_centers/resources/classes/conference_centers.php b/app/conference_centers/resources/classes/conference_centers.php index 1499288acf..494c6bd8b1 100644 --- a/app/conference_centers/resources/classes/conference_centers.php +++ b/app/conference_centers/resources/classes/conference_centers.php @@ -167,7 +167,7 @@ if (!class_exists('conference_centers')) { $database = new database; $conference_rooms = $database->select($sql, $parameters, 'all'); - if (is_array($conference_rooms)) { + if (!empty($conference_rooms)) { $x = 0; foreach($conference_rooms as $row) { //increment the array index @@ -200,7 +200,7 @@ if (!class_exists('conference_centers')) { } } unset($sql, $parameters, $conference_rooms); - return $result; + return $result ?? null; } /** @@ -312,7 +312,7 @@ if (!class_exists('conference_centers')) { } //delete multiple records - if (is_array($records) && @sizeof($records) != 0) { + if (!empty($records)) { //build the delete array foreach ($records as $x => $record) { @@ -339,7 +339,7 @@ if (!class_exists('conference_centers')) { } //delete the checked rows - if (is_array($array) && @sizeof($array) != 0) { + if (!empty($array)) { //grant temporary permissions $p = new permissions; @@ -400,7 +400,7 @@ if (!class_exists('conference_centers')) { } //delete multiple records - if (is_array($records) && @sizeof($records) != 0) { + if (!empty($records)) { //build the delete array foreach ($records as $x => $record) { @@ -415,7 +415,7 @@ if (!class_exists('conference_centers')) { } //delete the checked rows - if (is_array($array) && @sizeof($array) != 0) { + if (!empty($array)) { //grant temporary permissions $p = new permissions; @@ -464,7 +464,7 @@ if (!class_exists('conference_centers')) { } //delete multiple records - if (is_array($records) && @sizeof($records) != 0) { + if (!empty($records)) { //build the delete array foreach ($records as $x => $record) { @@ -479,7 +479,7 @@ if (!class_exists('conference_centers')) { } //delete the checked rows - if (is_array($array) && @sizeof($array) != 0) { + if (!empty($array)) { //grant temporary permissions $p = new permissions; @@ -533,7 +533,7 @@ if (!class_exists('conference_centers')) { } //toggle the checked records - if (is_array($records) && @sizeof($records) != 0) { + if (!empty($records)) { //get current toggle state foreach($records as $x => $record) { @@ -541,14 +541,14 @@ if (!class_exists('conference_centers')) { $uuids[] = "'".$record['uuid']."'"; } } - if (is_array($uuids) && @sizeof($uuids) != 0) { + if (!empty($uuids)) { $sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as toggle, dialplan_uuid from v_".$this->table." "; $sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) "; $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $parameters['domain_uuid'] = $_SESSION['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) { $conference_centers[$row['uuid']]['state'] = $row['toggle']; $conference_centers[$row['uuid']]['dialplan_uuid'] = $row['dialplan_uuid']; @@ -568,7 +568,7 @@ if (!class_exists('conference_centers')) { } //save the changes - if (is_array($array) && @sizeof($array) != 0) { + if (!empty($array)) { //grant temporary permissions $p = new permissions; @@ -630,7 +630,7 @@ if (!class_exists('conference_centers')) { } //toggle the checked records - if (is_array($records) && @sizeof($records) != 0) { + if (!empty($records)) { //validate submitted toggle field if (!in_array($this->toggle_field, ['record','wait_mod','announce_name','announce_count','announce_recording','mute','sounds','enabled'])) { @@ -647,14 +647,14 @@ if (!class_exists('conference_centers')) { } } } - if (is_array($uuids) && @sizeof($uuids) != 0) { + if (!empty($uuids)) { $sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as toggle from v_".$this->table." "; $sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) "; $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $parameters['domain_uuid'] = $_SESSION['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) { $states[$row['uuid']] = $row['toggle']; } @@ -692,7 +692,7 @@ if (!class_exists('conference_centers')) { } //save the changes - if (is_array($array) && @sizeof($array) != 0) { + if (!empty($array)) { //save the array $database = new database; @@ -738,7 +738,7 @@ if (!class_exists('conference_centers')) { } //copy the checked records - if (is_array($records) && @sizeof($records) != 0) { + if (!empty($records)) { //get checked records foreach($records as $x => $record) { @@ -748,14 +748,14 @@ if (!class_exists('conference_centers')) { } //create insert array from existing data - if (is_array($uuids) && @sizeof($uuids) != 0) { + if (!empty($uuids)) { $sql = "select * from v_".$this->table." "; $sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) "; $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $rows = $database->select($sql, $parameters, 'all'); - if (is_array($rows) && @sizeof($rows) != 0) { + if (!empty($rows)) { foreach ($rows as $x => $row) { //copy data @@ -771,7 +771,7 @@ if (!class_exists('conference_centers')) { } //save the changes and set the message - if (is_array($array) && @sizeof($array) != 0) { + if (!empty($array)) { //save the array $database = new database; diff --git a/app/conference_controls/conference_control_details.php b/app/conference_controls/conference_control_details.php index ab533dab46..545c347298 100644 --- a/app/conference_controls/conference_control_details.php +++ b/app/conference_controls/conference_control_details.php @@ -159,7 +159,7 @@ echo "\n"; if (permission_exists('conference_control_detail_edit') || permission_exists('conference_control_detail_delete')) { echo " \n"; } echo th_order_by('control_digits', $text['label-control_digits'], $order_by, $order, null, "class='pct-5 center'", $param); diff --git a/app/conference_controls/conference_control_edit.php b/app/conference_controls/conference_control_edit.php index 2cd8fbeafd..de175a6281 100644 --- a/app/conference_controls/conference_control_edit.php +++ b/app/conference_controls/conference_control_edit.php @@ -118,7 +118,7 @@ $sql .= "where conference_control_uuid = :conference_control_uuid "; $parameters['conference_control_uuid'] = $conference_control_uuid; $database = new database; - $row = $database->select($sql, $parameters ?? null, 'row'); + $row = $database->select($sql, $parameters, 'row'); if (!empty($row)) { $control_name = $row["control_name"]; $control_enabled = $row["control_enabled"]; diff --git a/app/conference_profiles/conference_profile_edit.php b/app/conference_profiles/conference_profile_edit.php index 638ed5a0c5..d5ad33c5cd 100644 --- a/app/conference_profiles/conference_profile_edit.php +++ b/app/conference_profiles/conference_profile_edit.php @@ -115,8 +115,8 @@ $parameters['conference_profile_uuid'] = $conference_profile_uuid; //$parameters['domain_uuid'] = $_SESSION['domain_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)) { $profile_name = $row["profile_name"]; $profile_enabled = $row["profile_enabled"]; $profile_description = $row["profile_description"]; diff --git a/app/conference_profiles/conference_profile_param_edit.php b/app/conference_profiles/conference_profile_param_edit.php index 7546189882..5fd69f7cb2 100644 --- a/app/conference_profiles/conference_profile_param_edit.php +++ b/app/conference_profiles/conference_profile_param_edit.php @@ -123,7 +123,7 @@ $sql .= "where conference_profile_param_uuid = :conference_profile_param_uuid "; $parameters['conference_profile_param_uuid'] = $conference_profile_param_uuid; $database = new database; - $row = $database->select($sql, $parameters ?? null, 'row'); + $row = $database->select($sql, $parameters, 'row'); if (!empty($row)) { $profile_param_name = $row["profile_param_name"]; $profile_param_value = $row["profile_param_value"]; diff --git a/app/database_transactions/database_transaction_edit.php b/app/database_transactions/database_transaction_edit.php index d8c71216dd..93afab8264 100644 --- a/app/database_transactions/database_transaction_edit.php +++ b/app/database_transactions/database_transaction_edit.php @@ -49,6 +49,13 @@ $search = ''; $action = ''; $page = 0; + $user_uuid = ''; + $app_name = ''; + $app_uuid = ''; + $domain_name = ''; + $username = ''; + $transaction_code = ''; + $transaction_address = ''; //set the variables if (!empty($_GET["id"]) && is_uuid($_GET["id"])) { @@ -74,7 +81,7 @@ $parameters['database_transaction_uuid'] = $database_transaction_uuid; $database = new database; $row = $database->select($sql, $parameters, 'row'); - if (is_array($row) && @sizeof($row) != 0) { + if (!empty($row)) { $user_uuid = $row["user_uuid"]; $app_name = $row["app_name"]; $app_uuid = $row["app_uuid"]; @@ -110,7 +117,7 @@ //get the type if not provided if (empty($transaction_type)) { - if ($transaction_old == null || $transaction_old == "null") { + if (empty($transaction_old) || $transaction_old == null || $transaction_old == "null") { $transaction_type = 'add'; } else { @@ -237,9 +244,9 @@ //this adds old and new values to the array function array_difference($array1, $array2) { $array = array(); - if (is_array($array1)) { + if (!empty($array1)) { foreach ($array1 as $key => $value) { - if (is_array($array2[$key])) { + if (!empty($array2[$key])) { $array[$key] = array_difference($array1[$key], $array2[$key]); } else { @@ -247,9 +254,9 @@ } } } - if (is_array($array2)) { + if (!empty($array2)) { foreach ($array2 as $key => $value) { - if (is_array($value)) { + if (!empty($value)) { $array[$key] = array_difference($array1[$key], $array2[$key]); } else { @@ -265,7 +272,7 @@ //loop through the array foreach ($array as $key => $value) { - if (is_array($value) && !isset($value['old']) && !isset($value['new'])) { + if (!empty($value) && !isset($value['old']) && !isset($value['new'])) { if (!is_numeric($key)) { //get the table name $_SESSION['name'] = $key; @@ -320,14 +327,14 @@ if ($transaction_type == "add") { //multiple dimensional array into a 2 dimensional array - if (is_array($after)) { + if (!empty($after)) { $x = 0; foreach ($after as $key => $value) { $id = 0; foreach ($value as $row) { $sub_id = 0; foreach ($row as $sub_key => $val) { - if (is_array($val)) { + if (!empty($val)) { foreach ($val as $sub_row) { foreach ($sub_row as $k => $v) { $array[$x]['schema'] = $sub_key; @@ -353,7 +360,7 @@ } echo "
\n"; echo "
".$text['label-queue']."".$text['label-status']."".$text['label-options']."
\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo $text['description-queue_name']."\n"; echo "
\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo $text['description-extension']."\n"; echo "
\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo $text['description-time_base_score_sec']."\n"; echo "
\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo $text['description-caller_id_name_prefix']."\n"; echo "
\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo $text['description-caller_announce_frequency']."\n"; echo "
\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo $text['description-exit_keys']."\n"; echo "
\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo $text['description-description']."\n"; echo "
\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo $text['description-call_flow_name']."\n"; echo "
\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo $text['description-call_flow_extension']."\n"; echo "
\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo $text['description-call_flow_feature_code']."\n"; echo "
\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo $text['description-call_flow_pin_number']."\n"; echo "
\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo !empty($text['description-call_flow_label'])."\n"; echo "
\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo $text['description-call_flow_alternate_label']."\n"; echo "
\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo !empty($text['description-call_flow_description'])."\n"; echo "
".escape($conference[$meeting_uuid]["member_count"])." 
\n"; - echo " \n"; + echo " \n"; echo "
\n"; - if (is_array($array)) { + if (!empty($array)) { foreach ($array as $row) { if ($row['schema'] !== $previous_schema || $row['row'] !== $previous_row) { echo "\n"; @@ -373,7 +380,7 @@ echo "
 
\n"; } /* - if (is_array($after)) { + if (!empty($after)) { //create the table header $array = array_difference(null, $after, 1); $table_header = " \n"; @@ -418,7 +425,7 @@ if ($transaction_type == "delete") { echo "

\n"; echo "\n"; - if (is_array($before)) { + if (!empty($before)) { foreach ($before as $table_name => $rows) { echo " \n"; echo " \n"; diff --git a/app/database_transactions/database_transactions.php b/app/database_transactions/database_transactions.php index 0f4595c782..9b392392c5 100644 --- a/app/database_transactions/database_transactions.php +++ b/app/database_transactions/database_transactions.php @@ -130,7 +130,7 @@ $sql .= order_by($order_by, $order, 't.transaction_date', 'desc'); $sql .= limit_offset($rows_per_page, $offset); $database = new database; - $result = $database->select($sql, $parameters ?? null, 'all'); + $result = $database->select($sql, $parameters, 'all'); unset($sql, $parameters); //get users @@ -140,7 +140,7 @@ $parameters['domain_uuid'] = $_SESSION['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) { $users[$row['user_uuid']] = $row['username']; } @@ -197,7 +197,7 @@ } echo "\n"; - if (is_array($result)) { + if (!empty($result)) { $x = 0; foreach($result as $row) { if (permission_exists('database_transaction_edit')) { diff --git a/app/ivr_menus/ivr_menu_edit.php b/app/ivr_menus/ivr_menu_edit.php index 34f4c45078..a152682b6c 100644 --- a/app/ivr_menus/ivr_menu_edit.php +++ b/app/ivr_menus/ivr_menu_edit.php @@ -46,6 +46,12 @@ $language = new text; $text = $language->get(); +//set the defaults + $ivr_menu_name = ''; + $ivr_menu_extension = ''; + $ivr_menu_cid_prefix = ''; + $ivr_menu_description = ''; + //initialize the destinations object $destination = new destinations; @@ -296,7 +302,7 @@ $array['ivr_menus'][0]["ivr_menu_description"] = $ivr_menu_description; $y = 0; foreach ($ivr_menu_options as $row) { - if (isset($row['ivr_menu_option_digits']) && $row['ivr_menu_option_digits'] != '') { + if (!empty($row['ivr_menu_option_digits'])) { if (!empty($row['ivr_menu_option_uuid']) && is_uuid($row['ivr_menu_option_uuid'])) { $ivr_menu_option_uuid = $row['ivr_menu_option_uuid']; } @@ -458,13 +464,13 @@ } //pre-populate the form - if (empty($ivr_menu_uuid)) { $ivr_menu_uuid = $_REQUEST["id"]; } + if (empty($ivr_menu_uuid)) { $ivr_menu_uuid = $_REQUEST["id"] ?? null; } if (!empty($ivr_menu_uuid) && is_uuid($ivr_menu_uuid) && empty($_POST["persistformvar"])) { $ivr = new ivr_menu; $ivr->domain_uuid = $_SESSION["domain_uuid"]; $ivr->ivr_menu_uuid = $ivr_menu_uuid; $ivr_menus = $ivr->find(); - if (is_array($ivr_menus)) { + if (!empty($ivr_menus)) { foreach ($ivr_menus as &$row) { $dialplan_uuid = $row["dialplan_uuid"]; $ivr_menu_name = $row["ivr_menu_name"]; @@ -992,7 +998,7 @@ } //sounds /* - if (is_array($sound_files)) { + if (!empty($sound_files)) { echo "\n"; foreach ($sound_files as $value) { if (!empty($value)) { @@ -1055,7 +1061,7 @@ echo " \n"; } echo " \n"; - if (is_array($ivr_menu_options)) { + if (!empty($ivr_menu_options)) { $x = 0; foreach($ivr_menu_options as $field) { @@ -1291,7 +1297,7 @@ } //recordings $tmp_selected = false; - if (is_array($recordings) && !empty($_SESSION['switch']['recordings']['dir'])) { + if (!empty($recordings) && !empty($_SESSION['switch']['recordings']['dir'])) { echo "\n"; foreach ($recordings as &$row) { $recording_name = $row["recording_name"]; @@ -1311,7 +1317,7 @@ echo "\n"; } //phrases - if (is_array($phrases)) { + if (!empty($phrases)) { echo "\n"; foreach ($phrases as &$row) { if ($ivr_menu_invalid_sound == "phrase:".$row["phrase_uuid"]) { @@ -1325,7 +1331,7 @@ echo "\n"; } //sounds - if (is_array($sound_files)) { + if (!empty($sound_files)) { echo "\n"; foreach ($sound_files as $value) { if (!empty($value)) { @@ -1380,7 +1386,7 @@ } //recordings $tmp_selected = false; - if (is_array($recordings) && !empty($_SESSION['switch']['recordings']['dir'])) { + if (!empty($recordings) && !empty($_SESSION['switch']['recordings']['dir'])) { echo "\n"; foreach ($recordings as &$row) { $recording_name = $row["recording_name"]; @@ -1400,7 +1406,7 @@ echo "\n"; } //phrases - if (is_array($phrases)) { + if (!empty($phrases)) { echo "\n"; foreach ($phrases as &$row) { if ($ivr_menu_exit_sound == "phrase:".$row["phrase_uuid"]) { @@ -1414,7 +1420,7 @@ echo "\n"; } //sounds - if (is_array($sound_files)) { + if (!empty($sound_files)) { echo "\n"; foreach ($sound_files as $value) { if (!empty($value)) { diff --git a/resources/classes/ringbacks.php b/resources/classes/ringbacks.php index a3db2a1d13..1b251011b9 100644 --- a/resources/classes/ringbacks.php +++ b/resources/classes/ringbacks.php @@ -63,7 +63,7 @@ if (!class_exists('ringbacks')) { $ringtones_list[$ringtone] = $label; } } - $this->ringtones_list = $ringtones_list; + $this->ringtones_list = $ringtones_list ?? ''; unset($sql, $ringtones, $ringtone, $ringtones_list); //get the default_ringback label @@ -146,7 +146,7 @@ if (!class_exists('ringbacks')) { $parameters['domain_uuid'] = $this->domain_uuid; $database = new database; $streams = $database->select($sql, $parameters, 'all'); - if (is_array($streams) && @sizeof($streams) != 0) { + if (!empty($streams)) { $select .= " "; foreach ($streams as $row) { $select .= " \n";
".escape($table_name)."