php 8.1 changes (#6721)

* Update call_flows.php

* Update call_flow_edit.php

* Update call_forward.php

* Update call_forward_edit.php

* Update call_recordings.php

* Update conference_centers.php

* Update default_settings.php

* Update default_setting_edit.php

* Update access_controls.php

* Update number_translations.php

* Update number_translation_edit.php

* Update setting_edit.php

* Update bridges.php

* Update bridge_edit.php

* Update call_broadcast_edit.php

* Update call_broadcast.php

* Update call_block.php

* Update call_broadcast_edit.php

* Update call_center_agent_edit.php

* Update call_center_agent_status.php

* Update call_recordings.php
This commit is contained in:
Alex 2023-05-26 11:48:39 -06:00 committed by GitHub
parent b939ac2442
commit 3112c9ae18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 243 additions and 209 deletions

View File

@ -126,7 +126,7 @@
$sql .= ") ";
}
$database = new database;
$num_rows = $database->select($sql, $parameters ?? '', 'column');
$num_rows = $database->select($sql, $parameters ?? null, 'column');
//get the list
$sql = "select ";
@ -144,7 +144,7 @@
}
$sql .= order_by($order_by, $order, 'access_control_name', 'asc');
$database = new database;
$access_controls = $database->select($sql, $parameters ?? '', 'all');
$access_controls = $database->select($sql, $parameters ?? null, 'all');
unset($sql, $parameters);
//create token

View File

@ -49,6 +49,13 @@
$action = "add";
}
//set the defaults
$bridge_uuid = '';
$bridge_name = '';
$bridge_destination = '';
$bridge_enabled = '';
$bridge_description = '';
//get http post variables and set them to php variables
if (!empty($_POST)) {
$bridge_uuid = $_POST["bridge_uuid"] ?? null;
@ -59,7 +66,7 @@
}
//process the user data and save it to the database
if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
if (!empty($_POST) && empty($_POST["persistformvar"])) {
//delete the bridge
if (permission_exists('bridge_delete')) {
@ -152,8 +159,8 @@
$sql .= "where bridge_uuid = :bridge_uuid ";
$parameters['bridge_uuid'] = $bridge_uuid;
$database = new database;
$row = $database->select($sql, $parameters, 'row');
if (is_array($row) && sizeof($row) != 0) {
$row = $database->select($sql, $parameters ?? null, 'row');
if (!empty($row)) {
$bridge_name = $row["bridge_name"];
$bridge_destination = $row["bridge_destination"];
$bridge_enabled = $row["bridge_enabled"];
@ -199,7 +206,7 @@
echo " ".$text['label-bridge_name']."\n";
echo "</td>\n";
echo "<td width='70%' class='vtable' style='position: relative;' align='left'>\n";
echo " <input class='formfld' type='text' name='bridge_name' maxlength='255' value='".escape($bridge_name ?? '')."'>\n";
echo " <input class='formfld' type='text' name='bridge_name' maxlength='255' value='".escape($bridge_name)."'>\n";
echo "<br />\n";
echo $text['description-bridge_name']."\n";
echo "</td>\n";
@ -210,7 +217,7 @@
echo " ".$text['label-bridge_destination']."\n";
echo "</td>\n";
echo "<td class='vtable' style='position: relative;' align='left'>\n";
echo " <input class='formfld' type='text' name='bridge_destination' maxlength='255' value='".escape($bridge_destination ?? '')."'>\n";
echo " <input class='formfld' type='text' name='bridge_destination' maxlength='255' value='".escape($bridge_destination)."'>\n";
echo "<br />\n";
echo $text['description-bridge_destination']."\n";
echo "</td>\n";
@ -243,7 +250,7 @@
echo " ".$text['label-bridge_description']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='bridge_description' maxlength='255' value=\"".escape($bridge_description ?? '')."\">\n";
echo " <input class='formfld' type='text' name='bridge_description' maxlength='255' value=\"".escape($bridge_description)."\">\n";
echo "<br />\n";
echo $text['description-bridge_description']."\n";
echo "</td>\n";

View File

@ -46,15 +46,22 @@
$language = new text;
$text = $language->get();
//set additional variables
$search = $_GET["search"] ?? '';
$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';
//get the http post data
if (isset($_POST['bridges']) && is_array($_POST['bridges'])) {
if (!empty($_POST['bridges'])) {
$action = $_POST['action'];
$search = $_POST['search'];
$bridges = $_POST['bridges'];
}
//process the http post data by action
if (isset($action) && $action != '' && is_array($bridges) && @sizeof($bridges) != 0) {
if (!empty($action) && !empty($bridges)) {
switch ($action) {
case 'copy':
if (permission_exists('bridge_add')) {
@ -76,7 +83,7 @@
break;
}
header('Location: bridges.php'.($search != '' ? '?search='.urlencode($search) : null));
header('Location: bridges.php'.(!empty($search) ? '?search='.urlencode($search) : null));
exit;
}
@ -85,7 +92,7 @@
$order = $_GET["order"] ?? '';
//add the search string
if (isset($_GET["search"])) {
if (!empty($search)) {
$search = strtolower($_GET["search"]);
$sql_search = " (";
$sql_search .= " lower(bridge_name) like :search ";
@ -98,7 +105,7 @@
//get the count
$sql = "select count(bridge_uuid) from v_bridges ";
if (isset($_GET['show']) && $_GET['show'] == "all" && permission_exists('bridge_all')) {
if (!empty($show) && $show == "all" && permission_exists('bridge_all')) {
if (isset($sql_search)) {
$sql .= "where ".$sql_search;
}
@ -156,14 +163,14 @@
}
echo "<form id='form_search' class='inline' method='get'>\n";
if (permission_exists('bridge_all')) {
if (isset($_GET['show']) && $_GET['show'] == 'all') {
if (isset($show) && $show == 'all') {
echo " <input type='hidden' name='show' value='all'>\n";
}
else {
echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'?show=all']);
}
}
echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search ?? '')."\" placeholder=\"".$text['label-search']."\" onkeydown=''>";
echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown=''>";
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search']);
//echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'bridges.php','style'=>($search == '' ? 'display: none;' : null)]);
if ($paging_controls_mini != '') {
@ -189,7 +196,7 @@
echo "<form id='form_list' method='post'>\n";
echo "<input type='hidden' id='action' name='action' value=''>\n";
echo "<input type='hidden' name='search' value=\"".escape($search ?? '')."\">\n";
echo "<input type='hidden' name='search' value=\"".escape($search)."\">\n";
echo "<table class='list'>\n";
echo "<tr class='list-header'>\n";
@ -198,19 +205,19 @@
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle(); checkbox_on_change(this);' ".(empty($bridges) ? "style='visibility: hidden;'" : null).">\n";
echo " </th>\n";
}
if (isset($_GET['show']) && $_GET['show'] == 'all' && permission_exists('bridge_all')) {
if (!empty($show) && $show == 'all' && permission_exists('bridge_all')) {
echo th_order_by('domain_name', $text['label-domain'], $order_by, $order);
}
echo th_order_by('bridge_name', $text['label-bridge_name'], $order_by, $order);
echo th_order_by('bridge_destination', $text['label-bridge_destination'], $order_by, $order);
echo th_order_by('bridge_enabled', $text['label-bridge_enabled'], $order_by, $order, null, "class='center'");
echo " <th class='hide-sm-dn'>".$text['label-bridge_description']."</th>\n";
if (permission_exists('bridge_edit') && isset($_SESSION['theme']['list_row_edit_button']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
if (permission_exists('bridge_edit') && !empty($list_row_edit_button) && $list_row_edit_button == 'true') {
echo " <td class='action-button'>&nbsp;</td>\n";
}
echo "</tr>\n";
if (is_array($bridges) && @sizeof($bridges) != 0) {
if (!empty($bridges)) {
$x = 0;
foreach ($bridges as $row) {
if (permission_exists('bridge_edit')) {
@ -245,7 +252,7 @@
}
echo " </td>\n";
echo " <td class='description overflow hide-sm-dn'>".escape($row['bridge_description'])."</td>\n";
if (permission_exists('bridge_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
if (permission_exists('bridge_edit') && !empty($list_row_edit_button) && $list_row_edit_button == 'true') {
echo " <td class='action-button'>\n";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " </td>\n";

View File

@ -47,6 +47,7 @@
//set additional variables
$search = $_GET["search"] ?? '';
$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';
@ -97,7 +98,7 @@
//prepare to page the results
$sql = "select count(*) from view_call_block ";
$sql .= "where true ";
if (!empty($_GET['show']) == "all" && permission_exists('call_block_all')) {
if ($show == "all" && permission_exists('call_block_all')) {
//$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
//$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
}
@ -105,7 +106,7 @@
$sql .= "and (domain_uuid = :domain_uuid) ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
}
if (!permission_exists('call_block_all') && is_array($_SESSION['user']['extension']) && count($_SESSION['user']['extension']) > 0) {
if (!permission_exists('call_block_all') && !empty($_SESSION['user']['extension'])) {
$sql .= "and extension_uuid in (";
$x = 0;
foreach ($_SESSION['user']['extension'] as $field) {
@ -128,7 +129,7 @@
$parameters['search'] = '%'.$search.'%';
}
$database = new database;
$num_rows = $database->select($sql, $parameters ?? '', 'column');
$num_rows = $database->select($sql, $parameters ?? null, 'column');
unset($parameters);
//prepare to page the results
@ -179,7 +180,7 @@
$sql .= order_by($order_by, $order, ['call_block_country_code','call_block_number']);
$sql .= limit_offset($rows_per_page, $offset);
$database = new database;
$result = $database->select($sql, $parameters ?? '', 'all');
$result = $database->select($sql, $parameters ?? null, 'all');
unset($sql, $parameters);
//create token
@ -208,7 +209,7 @@
}
echo "<form id='form_search' class='inline' method='get'>\n";
if (permission_exists('call_block_all')) {
if (!empty($_GET['show']) == 'all') {
if ($show == 'all') {
echo " <input type='hidden' name='show' value='all'>";
}
else {
@ -218,7 +219,7 @@
echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown=''>";
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search']);
//echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'call_block.php','style'=>($search == '' ? 'display: none;' : null)]);
if ($paging_controls_mini != '') {
if (!empty($paging_controls_mini)) {
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
}
echo " </form>\n";
@ -250,7 +251,7 @@
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle(); checkbox_on_change(this);' ".(!empty($result) ?: "style='visibility: hidden;'").">\n";
echo " </th>\n";
}
if (!empty($_GET['show']) == 'all' && permission_exists('domain_all')) {
if (!$show == 'all' && permission_exists('domain_all')) {
echo th_order_by('domain_name', $text['label-domain'], $order_by, $order);
}
echo th_order_by('call_block_direction', $text['label-direction'], $order_by, $order, null, "style='width: 1%;' class='center'");
@ -281,7 +282,7 @@
echo " <input type='hidden' name='call_blocks[".$x."][uuid]' value='".escape($row['call_block_uuid'])."' />\n";
echo " </td>\n";
}
if (!empty($_GET['show']) == 'all' && permission_exists('domain_all')) {
if ($show == 'all' && permission_exists('domain_all')) {
echo " <td>".escape($_SESSION['domains'][$row['domain_uuid']]['domain_name'])."</td>\n";
}
echo " <td class='center'>";

View File

@ -46,15 +46,22 @@
$language = new text;
$text = $language->get();
//set additional variables
$search = $_GET["search"] ?? '';
$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';
//get posted data
if (is_array($_POST['call_broadcasts'])) {
if (!empty($_POST['call_broadcasts'])) {
$action = $_POST['action'];
$search = $_POST['search'];
$call_broadcasts = $_POST['call_broadcasts'];
}
//process the http post data by action
if ($action != '' && is_array($call_broadcasts) && @sizeof($call_broadcasts) != 0) {
if (!empty($action) && is_array($call_broadcasts)) {
switch ($action) {
case 'copy':
if (permission_exists('call_broadcast_add')) {
@ -75,22 +82,22 @@
}
//get the http get variables and set them to php variables
$order_by = $_GET["order_by"];
$order = $_GET["order"];
$order_by = $_GET["order_by"] ?? '';
$order = $_GET["order"] ?? '';
//add the search term
if (!empty($_GET["search"])) {
if (!empty($search)) {
$search = strtolower($_GET["search"]);
}
//get the count
$sql = "select count(*) from v_call_broadcasts ";
$sql .= "where true ";
if ($_GET['show'] != "all" || !permission_exists('call_broadcast_all')) {
if ($show != "all" || !permission_exists('call_broadcast_all')) {
$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
}
if (isset($search)) {
if (!empty($search)) {
$sql .= "and (";
$sql .= " lower(broadcast_name) like :search ";
$sql .= " or lower(broadcast_description) like :search ";
@ -101,17 +108,17 @@
$parameters['search'] = '%'.$search.'%';
}
$database = new database;
$num_rows = $database->select($sql, $parameters, 'column');
$num_rows = $database->select($sql, $parameters ?? null, 'column');
//prepare the paging
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
if (isset($search)) {
$rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50;
if (!empty($search)) {
$param = "&search=".urlencode($search);
}
if ($_GET['show'] == "all" && permission_exists('call_broadcast_all')) {
if ($show == "all" && permission_exists('call_broadcast_all')) {
$param .= "&show=all";
}
$page = $_GET['page'];
$page = $_GET['page'] ?? '';
if (empty($page)) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true);
@ -125,11 +132,11 @@
$sql .= "broadcast_avmd, broadcast_destination_data, broadcast_accountcode, broadcast_toll_allow ";
$sql .= "from v_call_broadcasts ";
$sql .= "where true ";
if ($_GET['show'] != "all" || !permission_exists('call_broadcast_all')) {
if ($show != "all" || !permission_exists('call_broadcast_all')) {
$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
}
if (!empty($_GET["search"])) {
if (!empty($search)) {
$sql .= "and (";
$sql .= " lower(broadcast_name) like :search ";
$sql .= " or lower(broadcast_description) like :search ";
@ -142,7 +149,7 @@
$sql .= order_by($order_by, $order, 'broadcast_name', 'asc');
$sql .= limit_offset($rows_per_page, $offset);
$database = new database;
$result = $database->select($sql, $parameters, 'all');
$result = $database->select($sql, $parameters ?? null, 'all');
unset($sql, $parameters);
//create token
@ -207,19 +214,19 @@
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle(); checkbox_on_change(this);' ".($result ?: "style='visibility: hidden;'").">\n";
echo " </th>\n";
}
if ($_GET['show'] == "all" && permission_exists('call_broadcast_all')) {
if ($show == "all" && permission_exists('call_broadcast_all')) {
echo th_order_by('domain_name', $text['label-domain'], $order_by, $order, $param, "class='shrink'");
}
echo th_order_by('broadcast_name', $text['label-name'], $order_by, $order);
echo th_order_by('broadcast_concurrent_limit', $text['label-concurrent-limit'], $order_by, $order);
echo th_order_by('broadcast_start_time', $text['label-start_time'], $order_by, $order);
echo th_order_by('broadcast_description', $text['label-description'], $order_by, $order);
if (permission_exists('call_broadcast_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
if (permission_exists('call_broadcast_edit') && $list_row_edit_button == 'true') {
echo " <td class='action-button'>&nbsp;</td>\n";
}
echo "</tr>\n";
if (is_array($result) && @sizeof($result) != 0) {
if (!empty($result)) {
$x = 0;
foreach($result as $row) {
if (permission_exists('call_broadcast_edit')) {
@ -232,7 +239,7 @@
echo " <input type='hidden' name='call_broadcasts[$x][uuid]' value='".escape($row['call_broadcast_uuid'])."' />\n";
echo " </td>\n";
}
if ($_GET['show'] == "all" && permission_exists('call_broadcast_all')) {
if ($show == "all" && permission_exists('call_broadcast_all')) {
if (!empty($_SESSION['domains'][$row['domain_uuid']]['domain_name'])) {
$domain = $_SESSION['domains'][$row['domain_uuid']]['domain_name'];
}
@ -257,7 +264,7 @@
}
echo " <td>".escape($broadcast_start_time)."</td>\n";
echo " <td class='description overflow hide-xs'>".escape($row['broadcast_description'])."</td>\n";
if (permission_exists('call_broadcast_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
if (permission_exists('call_broadcast_edit') && $list_row_edit_button == 'true') {
echo " <td class='action-button'>";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " </td>\n";

View File

@ -47,7 +47,7 @@
$text = $language->get();
//set the action with add or update
if (is_uuid($_REQUEST["id"])) {
if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) {
$action = "update";
$call_broadcast_uuid = $_REQUEST["id"];
}
@ -94,7 +94,7 @@
}
//get the http post variables and set them to php variables
if (count($_POST)>0) {
if (!empty($_POST)) {
$broadcast_name = $_POST["broadcast_name"];
$broadcast_start_time = $_POST["broadcast_start_time"];
$broadcast_timeout = $_POST["broadcast_timeout"];
@ -128,7 +128,7 @@
}
}
if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
if (!empty($_POST) && empty($_POST["persistformvar"])) {
//delete the call broadcast
if (permission_exists('call_broadcast_delete')) {
@ -184,7 +184,7 @@ if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
}
//add or update the database
if ($_POST["persistformvar"] != "true") {
if (empty($_POST["persistformvar"])) {
//prep insert
if ($action == "add" && permission_exists('call_broadcast_add')) {
@ -212,7 +212,7 @@ if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
}
//execute
if (is_array($array) && @sizeof($array) != 0) {
if (!empty($array)) {
//add file selection and download sample
$file_res = upload_file($sql, $broadcast_phone_numbers);
@ -275,7 +275,7 @@ if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
}
//pre-populate the form
if (count($_GET) > 0 && $_POST["persistformvar"] != "true") {
if (!empty($_GET) && empty($_POST["persistformvar"])) {
$call_broadcast_uuid = $_GET["id"];
$sql = "select * from v_call_broadcasts ";
$sql .= "where domain_uuid = :domain_uuid ";
@ -283,7 +283,7 @@ if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
$parameters['domain_uuid'] = $domain_uuid;
$parameters['call_broadcast_uuid'] = $call_broadcast_uuid;
$database = new database;
$row = $database->select($sql, $parameters, 'row');
$row = $database->select($sql, $parameters ?? null, 'row');
if (is_array($row) && @sizeof($row) != 0) {
$broadcast_name = $row["broadcast_name"];
$broadcast_start_time = $row["broadcast_start_time"];

View File

@ -51,7 +51,7 @@
$sql .= "where domain_uuid = :domain_uuid ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$database = new database;
$tiers = $database->select($sql, $parameters, 'all');
$tiers = $database->select($sql, $parameters ?? null, 'all');
if (is_array($tiers) && count($tiers) == 0) {
$per_queue_login = true;
}
@ -69,7 +69,7 @@
$sql .= "order by agent_name asc ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$database = new database;
$agents = $database->select($sql, $parameters, 'all');
$agents = $database->select($sql, $parameters ?? null, 'all');
unset($sql, $parameters);
//get the agent list from event socket
@ -91,13 +91,13 @@
$sql .= "order by queue_name asc ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$database = new database;
$call_center_queues = $database->select($sql, $parameters, 'all');
$call_center_queues = $database->select($sql, $parameters ?? null, 'all');
unset($sql, $parameters);
//view_array($call_center_queues, false);
//add the status to the call_center_queues array
$x = 0;
if (is_array($call_center_queues)) {
if (!empty($call_center_queues)) {
foreach ($call_center_queues as $queue) {
//set the queue id
$queue_id = $queue['queue_extension'].'@'.$queue['domain_name'];
@ -113,7 +113,7 @@
//get the agent status from mod_callcenter and update the agent status in the agents array
$x = 0;
if (is_array($agents)) {
if (!empty($agents)) {
foreach ($agents as $row) {
//add the domain name
$domain_name = $_SESSION['domains'][$row['domain_uuid']]['domain_name'];
@ -121,14 +121,14 @@
//update the queue status
$i = 0;
if (is_array($call_center_queues)) {
if (!empty($call_center_queues)) {
foreach ($call_center_queues as $queue) {
$agents[$x]['queues'][$i]['agent_name'] = $row['agent_name'];
$agents[$x]['queues'][$i]['queue_name'] = $queue['queue_name'];
$agents[$x]['queues'][$i]['call_center_agent_uuid'] = $row['call_center_agent_uuid'];
$agents[$x]['queues'][$i]['call_center_queue_uuid'] = $queue['call_center_queue_uuid'];
$agents[$x]['queues'][$i]['queue_status'] = 'Logged Out';
if (is_array($queue['queue_list'])) {
if (!empty($queue['queue_list'])) {
foreach ($queue['queue_list'] as $queue_list) {
if ($row['call_center_agent_uuid'] == $queue_list['name']) {
$agents[$x]['queues'][$i]['queue_status'] = 'Available';
@ -140,7 +140,7 @@
}
//update the agent status
if (is_array($agent_list)) {
if (!empty($agent_list)) {
foreach ($agent_list as $r) {
if ($r['name'] == $row['call_center_agent_uuid']) {
$agents[$x]['agent_status'] = $r['status'];
@ -154,7 +154,7 @@
}
//remove rows from the http post array where the status has not changed
if (!empty($_POST['agents']) && is_array($_POST['agents']) && !$per_queue_login) {
if (!empty($_POST['agents']) && !$per_queue_login) {
foreach($_POST['agents'] as $key => $row) {
foreach($agents as $k => $field) {
if ($field['agent_name'] === $row['agent_name'] && $field['agent_status'] === $row['agent_status']) {
@ -165,9 +165,9 @@
}
//use the http post array to change the status
if (!empty($_POST['agents']) && is_array($_POST['agents'])) {
if (!empty($_POST['agents'])) {
foreach($_POST['agents'] as $row) {
if (isset($row['agent_status'])) {
if (!empty($row['agent_status'])) {
//agent set status
if ($fp) {
//set the user_status
@ -355,7 +355,7 @@
}
echo "</tr>\n";
if (is_array($agents) && @sizeof($agents) != 0) {
if (!empty($agents)) {
$x = 0;
foreach ($agents as $row) {
$onclick = "onclick=\"cycle('agents[".$x."][agent_status]');\"";
@ -435,4 +435,4 @@
//show the footer
require_once "resources/footer.php";
?>
?>

View File

@ -47,7 +47,7 @@
$text = $language->get();
//action add or update
if (is_uuid($_REQUEST["id"])) {
if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) {
$action = "update";
$call_flow_uuid = $_REQUEST["id"];
}
@ -59,7 +59,7 @@
$destination = new destinations;
//get http post variables and set them to php variables
if (count($_POST) > 0) {
if (!empty($_POST)) {
//set the variables from the http values
$call_flow_uuid = $_POST["call_flow_uuid"];
@ -91,7 +91,7 @@
}
//process the user data and save it to the database
if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
if (!empty($_POST) && empty($_POST["persistformvar"])) {
//get the uuid from the POST
if ($action == "update") {
@ -302,7 +302,7 @@
} //(is_array($_POST) && empty($_POST["persistformvar"]))
//pre-populate the form
if (is_array($_GET) && $_POST["persistformvar"] != "true") {
if (!empty($_GET) && empty($_POST["persistformvar"])) {
$call_flow_uuid = $_GET["id"];
$sql = "select * from v_call_flows ";
$sql .= "where domain_uuid = :domain_uuid ";
@ -310,7 +310,7 @@
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$parameters['call_flow_uuid'] = $call_flow_uuid;
$database = new database;
$result = $database->select($sql, $parameters, 'all');
$result = $database->select($sql, $parameters ?? null, 'all');
foreach ($result as $row) {
//set the php variables
$call_flow_uuid = $row["call_flow_uuid"];
@ -365,7 +365,7 @@
$sql .= "order by recording_name asc ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$database = new database;
$recordings = $database->select($sql, $parameters, 'all');
$recordings = $database->select($sql, $parameters ?? null, 'all');
unset($parameters, $sql);
if (if_group("superadmin")) {
@ -420,7 +420,7 @@
}
//recordings
$tmp_selected = false;
if (count($recordings) > 0) {
if (!empty($recordings)) {
echo "<optgroup label=".$text['recordings'].">\n";
foreach ($recordings as &$row) {
$recording_name = $row["recording_name"];
@ -443,9 +443,9 @@
$sql = "select * from v_phrases where domain_uuid = :domain_uuid ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$database = new database;
$result = $database->select($sql, $parameters, 'all');
$result = $database->select($sql, $parameters ?? null, 'all');
unset($parameters, $sql);
if (is_array($result)) {
if (!empty($result)) {
echo "<optgroup label='Phrases'>\n";
foreach ($result as &$row) {
if ($var == "phrase:".$row["phrase_uuid"]) {
@ -462,7 +462,7 @@
if ($load_sound) {
$file = new file;
$sound_files = $file->sounds();
if (is_array($sound_files)) {
if (!empty($sound_files)) {
echo "<optgroup label=".$text["sounds"].">\n";
foreach ($sound_files as $value) {
if (!empty($value)) {
@ -532,7 +532,7 @@
echo " ".$text['label-call_flow_name']."\n";
echo "</td>\n";
echo "<td width='70%' class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='call_flow_name' maxlength='255' value=\"".escape($call_flow_name)."\">\n";
echo " <input class='formfld' type='text' name='call_flow_name' maxlength='255' value=\"".escape($call_flow_name ?? '')."\">\n";
echo "<br />\n";
echo $text['description-call_flow_name']."\n";
echo "</td>\n";
@ -543,7 +543,7 @@
echo " ".$text['label-call_flow_extension']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='call_flow_extension' maxlength='255' value=\"".escape($call_flow_extension)."\">\n";
echo " <input class='formfld' type='text' name='call_flow_extension' maxlength='255' value=\"".escape($call_flow_extension ?? '')."\">\n";
echo "<br />\n";
echo $text['description-call_flow_extension']."\n";
echo "</td>\n";
@ -554,7 +554,7 @@
echo " ".$text['label-call_flow_feature_code']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='call_flow_feature_code' maxlength='255' value=\"".escape($call_flow_feature_code)."\">\n";
echo " <input class='formfld' type='text' name='call_flow_feature_code' maxlength='255' value=\"".escape($call_flow_feature_code ?? '')."\">\n";
echo "<br />\n";
echo $text['description-call_flow_feature_code']."\n";
echo "</td>\n";
@ -610,7 +610,7 @@
echo " ".$text['label-call_flow_pin_number']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='call_flow_pin_number' maxlength='255' value=\"".escape($call_flow_pin_number)."\">\n";
echo " <input class='formfld' type='text' name='call_flow_pin_number' maxlength='255' value=\"".escape($call_flow_pin_number ?? '')."\">\n";
echo "<br />\n";
echo $text['description-call_flow_pin_number']."\n";
echo "</td>\n";
@ -621,13 +621,13 @@
echo " ".$text['label-call_flow_label']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='call_flow_label' maxlength='255' value=\"".escape($call_flow_label)."\">\n";
echo " <input class='formfld' type='text' name='call_flow_label' maxlength='255' value=\"".escape($call_flow_label ?? '')."\">\n";
echo "<br />\n";
echo $text['description-call_flow_label']."\n";
echo !empty($text['description-call_flow_label'])."\n";
echo "</td>\n";
echo "</tr>\n";
sound_select_list($call_flow_sound, 'call_flow_sound', 'call_flow_sound', true);
sound_select_list(!empty($call_flow_sound), 'call_flow_sound', 'call_flow_sound', true);
/*
echo "<tr>\n";
@ -647,9 +647,9 @@
echo " ".$text['label-call_flow_destination']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
$select_value = '';
//set the selected value
if (!empty($call_flow_app.$call_flow_data)) {
$select_value = '';
if (!empty($call_flow_app) && !empty($call_flow_data)) {
$select_value = $call_flow_app.':'.$call_flow_data;
}
//show the destination list
@ -665,13 +665,13 @@
echo " ".$text['label-call_flow_alternate_label']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='call_flow_alternate_label' maxlength='255' value=\"".escape($call_flow_alternate_label)."\">\n";
echo " <input class='formfld' type='text' name='call_flow_alternate_label' maxlength='255' value=\"".escape($call_flow_alternate_label ?? '')."\">\n";
echo "<br />\n";
echo $text['description-call_flow_alternate_label']."\n";
echo "</td>\n";
echo "</tr>\n";
sound_select_list($call_flow_alternate_sound, 'call_flow_alternate_sound', 'call_flow_alternate_sound', true);
sound_select_list(!empty($call_flow_alternate_sound), 'call_flow_alternate_sound', 'call_flow_alternate_sound', true);
/*
echo "<tr>\n";
@ -692,7 +692,7 @@
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
$select_value = '';
if (!empty($call_flow_alternate_app.$call_flow_alternate_data)) {
if (!empty($call_flow_alternate_app) && !empty($call_flow_alternate_data)) {
$select_value = $call_flow_alternate_app.':'.$call_flow_alternate_data;
}
echo $destination->select('dialplan', 'call_flow_alternate_destination', $select_value);
@ -737,9 +737,9 @@
echo " ".$text['label-call_flow_description']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='call_flow_description' maxlength='255' value=\"".escape($call_flow_description)."\">\n";
echo " <input class='formfld' type='text' name='call_flow_description' maxlength='255' value=\"".escape($call_flow_description ?? '')."\">\n";
echo "<br />\n";
echo $text['description-call_flow_description']."\n";
echo !empty($text['description-call_flow_description'])."\n";
echo "</td>\n";
echo "</tr>\n";

View File

@ -46,8 +46,11 @@
$language = new text;
$text = $language->get();
//set from session variables
$list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false';
//get posted data
if (is_array($_POST['call_flows'])) {
if (!empty($_POST['call_flows'])) {
$action = $_POST['action'];
$search = $_POST['search'];
$call_flows = $_POST['call_flows'];
@ -55,7 +58,7 @@
}
//process the http post data by action
if ($action != '' && is_array($call_flows) && @sizeof($call_flows) != 0) {
if (!empty($action) && !empty($call_flows)) {
switch ($action) {
case 'copy':
if (permission_exists('call_flow_add')) {
@ -83,11 +86,11 @@
}
//get variables used to control the order
$order_by = $_GET["order_by"];
$order = $_GET["order"];
$order_by = $_GET["order_by"] ?? '';
$order = $_GET["order"] ?? '';
//add the search term
$search = strtolower($_GET["search"]);
$search = strtolower($_GET["search"] ?? '');
if (!empty($search)) {
$sql_search = "and (";
$sql_search .= "lower(call_flow_name) like :search ";
@ -105,21 +108,21 @@
//prepare to page the results
$sql = "select count(*) from v_call_flows ";
$sql .= "where true ";
if ($_GET['show'] != "all" || !permission_exists('call_flow_all')) {
if (!empty($_GET['show']) != "all" || !permission_exists('call_flow_all')) {
$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
}
$sql .= $sql_search;
$sql .= $sql_search ?? '';
$database = new database;
$num_rows = $database->select($sql, $parameters, 'column');
$num_rows = $database->select($sql, $parameters ?? null, 'column');
//prepare to page the results
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
$rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50;
$param = "&search=".urlencode($search);
if ($_GET['show'] == "all" && permission_exists('call_flow_all')) {
if (!empty($_GET['show']) == "all" && permission_exists('call_flow_all')) {
$param .= "&show=all";
}
$page = $_GET['page'];
$page = $_GET['page'] ?? '';
if (empty($page)) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true);
@ -130,7 +133,7 @@
$sql .= order_by($order_by, $order, 'call_flow_name', 'asc');
$sql .= limit_offset($rows_per_page, $offset);
$database = new database;
$call_flows = $database->select($sql, $parameters, 'all');
$call_flows = $database->select($sql, $parameters ?? null, 'all');
unset($sql, $parameters);
//create token
@ -174,7 +177,7 @@
}
echo "<form id='form_search' class='inline' method='get'>\n";
if (permission_exists('call_flow_all')) {
if ($_GET['show'] == 'all') {
if (!empty($_GET['show']) == 'all') {
echo " <input type='hidden' name='show' value='all'>";
}
else {
@ -214,10 +217,10 @@
echo "<tr class='list-header'>\n";
if (permission_exists('call_flow_add') || permission_exists('call_flow_edit') || permission_exists('call_flow_delete')) {
echo " <th class='checkbox'>\n";
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle(); checkbox_on_change(this);' ".($call_flows ?: "style='visibility: hidden;'").">\n";
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle(); checkbox_on_change(this);' ".(!empty($call_flows) ?: "style='visibility: hidden;'").">\n";
echo " </th>\n";
}
if ($_GET['show'] == "all" && permission_exists('call_flow_all')) {
if (!empty($_GET['show']) == "all" && permission_exists('call_flow_all')) {
echo th_order_by('domain_name', $text['label-domain'], $order_by, $order, $param, "class='shrink'");
}
echo th_order_by('call_flow_name', $text['label-call_flow_name'], $order_by, $order);
@ -229,12 +232,12 @@
}
echo th_order_by('call_flow_enabled', $text['label-enabled'], $order_by, $order, null, "class='center'");
echo th_order_by('call_flow_description', $text['label-call_flow_description'], $order_by, $order, null, "class='hide-sm-dn'");
if (permission_exists('call_flow_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
if (permission_exists('call_flow_edit') && $list_row_edit_button == 'true') {
echo " <td class='action-button'>&nbsp;</td>\n";
}
echo "</tr>\n";
if (is_array($call_flows)) {
if (!empty($call_flows)) {
$x = 0;
foreach ($call_flows as $row) {
if (permission_exists('call_flow_edit')) {
@ -247,7 +250,7 @@
echo " <input type='hidden' name='call_flows[$x][uuid]' value='".escape($row['call_flow_uuid'])."' />\n";
echo " </td>\n";
}
if ($_GET['show'] == "all" && permission_exists('call_flow_all')) {
if (!empty($_GET['show']) == "all" && permission_exists('call_flow_all')) {
if (!empty($_SESSION['domains'][$row['domain_uuid']]['domain_name'])) {
$domain = $_SESSION['domains'][$row['domain_uuid']]['domain_name'];
}
@ -281,7 +284,7 @@
echo escape($row['call_flow_enabled']);
}
echo " <td class='description overflow hide-sm-dn'>".escape($row['call_flow_description'])."&nbsp;</td>\n";
if (permission_exists('call_flow_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
if (permission_exists('call_flow_edit') && $list_row_edit_button == 'true') {
echo " <td class='action-button'>";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " </td>\n";

View File

@ -108,7 +108,7 @@
}
$sql .= "and enabled = 'true' ";
if (!permission_exists('extension_edit')) {
if (is_array($_SESSION['user']['extension']) && count($_SESSION['user']['extension']) > 0) {
if (!empty($_SESSION['user']['extension']) && count($_SESSION['user']['extension']) > 0) {
$sql .= "and (";
$x = 0;
foreach ($_SESSION['user']['extension'] as $row) {
@ -125,7 +125,7 @@
}
}
$database = new database;
$num_rows = $database->select($sql, $parameters, 'column');
$num_rows = $database->select($sql, $parameters ?? null, 'column');
unset($parameters);
//prepare the paging
@ -173,7 +173,7 @@
}
$sql .= "and enabled = 'true' ";
if (!permission_exists('extension_edit')) {
if (is_array($_SESSION['user']['extension']) && count($_SESSION['user']['extension']) > 0) {
if (!empty($_SESSION['user']['extension']) && count($_SESSION['user']['extension']) > 0) {
$sql .= "and (";
$x = 0;
foreach ($_SESSION['user']['extension'] as $row) {
@ -192,7 +192,7 @@
$sql .= order_by($order_by, $order, 'extension', 'asc');
$sql .= limit_offset($rows_per_page, $offset);
$database = new database;
$extensions = $database->select($sql, $parameters, 'all');
$extensions = $database->select($sql, $parameters ?? null, 'all');
unset($parameters);
//if there are no extensions then set to empty array
@ -247,7 +247,7 @@
echo "<input type='text' class='txt list-search' name='search' id='search' value=\"" . escape($search) . "\" placeholder=\"" . $text['label-search'] . "\" onkeydown=''>";
echo button::create(['label' => $text['button-search'], 'icon' => $_SESSION['theme']['button_icon_search'], 'type' => 'submit', 'id' => 'btn_search']);
//echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'call_forward.php','style'=>($search == '' ? 'display: none;' : null)]);
if ($paging_controls_mini != '') {
if (!empty($paging_controls_mini)) {
echo "<span style='margin-left: 15px;'>" . $paging_controls_mini . "</span>";
}
echo " </form>\n";
@ -297,7 +297,7 @@
}
echo "</tr>\n";
if (is_array($extensions)) {
if (!empty($extensions)) {
$x = 0;
foreach ($extensions as $row) {
$list_row_url = PROJECT_PATH . "/app/call_forward/call_forward_edit.php?id=" . $row['extension_uuid'] . "&return_url=" . urlencode($_SERVER['REQUEST_URI']);
@ -369,7 +369,7 @@
$parameters['follow_me_uuid'] = $row['follow_me_uuid'];
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$database = new database;
$follow_me_destination_count = $database->select($sql, $parameters, 'column');
$follow_me_destination_count = $database->select($sql, $parameters ?? null, 'column');
unset($sql, $parameters);
}
echo " <td>\n";

View File

@ -85,8 +85,8 @@
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$parameters['extension_uuid'] = $extension_uuid;
$database = new database;
$row = $database->select($sql, $parameters, 'row');
if (is_array($row) && sizeof($row) != 0) {
$row = $database->select($sql, $parameters ?? null, 'row');
if (!empty($row)) {
$extension = $row["extension"];
$number_alias = $row["number_alias"];
$accountcode = $row["accountcode"];
@ -112,10 +112,10 @@
unset($sql, $parameters, $row);
//process post vars
if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
if (!empty($_POST) && empty($_POST["persistformvar"])) {
//get http post variables and set them to php variables
if (count($_POST) > 0) {
if (!empty($_POST)) {
$forward_all_enabled = $_POST["forward_all_enabled"];
$forward_all_destination = $_POST["forward_all_destination"];
$forward_busy_enabled = $_POST["forward_busy_enabled"];
@ -272,7 +272,7 @@
$p->delete("extension_edit", "temp");
//delete empty destination records
if (is_array($follow_me_delete_uuids) && sizeof($follow_me_delete_uuids) > 0) {
if (!empty($follow_me_delete_uuids)) {
foreach ($follow_me_delete_uuids as $follow_me_delete_uuid) {
$array['follow_me_destinations'][]['follow_me_destination_uuid'] = $follow_me_delete_uuid;
}
@ -457,7 +457,7 @@
require_once "resources/header.php";
//pre-populate the form
if (is_uuid($follow_me_uuid)) {
if (!empty($follow_me_uuid) && is_uuid($follow_me_uuid)) {
$sql = "select * from v_follow_me ";
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and follow_me_uuid = :follow_me_uuid ";
@ -467,7 +467,7 @@
$row = $database->select($sql, $parameters, 'row');
unset($sql, $parameters);
if (is_array($row) && sizeof($row) != 0) {
if (!empty($row)) {
$cid_name_prefix = $row["cid_name_prefix"];
$cid_number_prefix = $row["cid_number_prefix"];
$follow_me_enabled = $row["follow_me_enabled"];
@ -479,7 +479,7 @@
$sql .= "order by follow_me_order asc ";
$parameters['follow_me_uuid'] = $follow_me_uuid;
$database = new database;
$result = $database->select($sql, $parameters, 'all');
$result = $database->select($sql, $parameters ?? null, 'all');
unset($destinations);
foreach ($result as $x => &$row) {
@ -499,40 +499,39 @@
$sql .= "order by extension, number_alias asc ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$database = new database;
$extensions = $database->select($sql, $parameters, 'all');
$extensions = $database->select($sql, $parameters ?? null, 'all');
unset($sql, $parameters, $row);
//set the default
if (!isset($dnd_enabled)) {
if (empty($dnd_enabled)) {
//set the value from the database
$dnd_enabled = $do_not_disturb;
}
//prepare the autocomplete
if($_SESSION['follow_me']['follow_me_autocomplete']['boolean'] == 'true') {
echo "<link rel=\"stylesheet\" href=\"".PROJECT_PATH."/resources/jquery/jquery-ui.min.css\" />\n";
echo "<script src=\"".PROJECT_PATH."/resources/jquery/jquery-ui.min.js\"></script>\n";
echo "<script type=\"text/javascript\">\n";
echo "\$(function() {\n";
echo " var extensions = [\n";
foreach ($extensions as &$row) {
if (empty($number_alias)) {
echo " \"".escape($row["extension"])."\",\n";
if(!empty($_SESSION['follow_me']['follow_me_autocomplete']['boolean']) == 'true') {
echo "<link rel=\"stylesheet\" href=\"".PROJECT_PATH."/resources/jquery/jquery-ui.min.css\" />\n";
echo "<script src=\"".PROJECT_PATH."/resources/jquery/jquery-ui.min.js\"></script>\n";
echo "<script type=\"text/javascript\">\n";
echo "\$(function() {\n";
echo " var extensions = [\n";
foreach ($extensions as &$row) {
if (empty($number_alias)) {
echo " \"".escape($row["extension"])."\",\n";
}
else {
echo " \"".escape($row["number_alias"])."\",\n";
}
}
else {
echo " \"".escape($row["number_alias"])."\",\n";
echo " ];\n";
for ($n = 0; $n <= ((($_SESSION['follow_me']['max_destinations']['numeric'] != '') ? $_SESSION['follow_me']['max_destinations']['numeric'] : 5) - 1); $n++) {
echo " \$(\"#destination_".$n."\").autocomplete({\n";
echo " source: extensions\n";
echo " });\n";
}
}
echo " ];\n";
for ($n = 0; $n <= ((($_SESSION['follow_me']['max_destinations']['numeric'] != '') ? $_SESSION['follow_me']['max_destinations']['numeric'] : 5) - 1); $n++) {
echo " \$(\"#destination_".$n."\").autocomplete({\n";
echo " source: extensions\n";
echo " });\n";
}
echo "});\n";
echo "</script>\n";
echo "});\n";
echo "</script>\n";
}
//create token
@ -561,10 +560,10 @@
echo " <strong>".$text['label-call_forward']."</strong>\n";
echo "</td>\n";
echo "<td width='70%' class='vtable' align='left'>\n";
$on_click .= "$('#tr_follow_me_settings').slideUp('fast'); ";
$on_click = "$('#tr_follow_me_settings').slideUp('fast'); ";
$on_click .= "document.getElementById('dnd_disabled').checked=true; ";
$on_click .= "document.getElementById('forward_all_destination').focus(); ";
$on_click2 .= "(document.getElementById('follow_me_enabled').checked) ? $('#tr_follow_me_settings').slideDown('fast') : '' ";
$on_click2 = "(document.getElementById('follow_me_enabled').checked) ? $('#tr_follow_me_settings').slideDown('fast') : '' ";
echo " <label for='forward_all_disabled'><input type='radio' name='forward_all_enabled' id='forward_all_disabled' onclick=\"$on_click2\" value='false' ".(($forward_all_enabled == "false" || $forward_all_enabled == "") ? "checked='checked'" : null)." /> ".$text['label-disabled']."</label> \n";
echo " <label for='forward_all_enabled'><input type='radio' name='forward_all_enabled' id='forward_all_enabled' onclick=\"$on_click\" value='true' ".(($forward_all_enabled == "true") ? "checked='checked'" : null)." /> ".$text['label-enabled']."</label> \n";
unset($on_click);
@ -746,7 +745,7 @@
echo "</table>";
echo "<br /><br />";
if ($action == "update") {
if (!empty($action) == "update") {
echo "<input type='hidden' name='id' value='".escape($extension_uuid)."'>\n";
}
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";

View File

@ -46,15 +46,19 @@
$language = new text;
$text = $language->get();
//set additional variables
$search = $_GET["search"] ?? '';
$show = $_GET["show"] ?? '';
//get the http post data
if (is_array($_POST['call_recordings'])) {
if (!empty($_POST['call_recordings'])) {
$action = $_POST['action'];
$search = $_POST['search'];
$call_recordings = $_POST['call_recordings'];
}
//process the http post data by action
if ($action != '' && is_array($call_recordings) && @sizeof($call_recordings) != 0) {
if (!empty($action) && !empty($call_recordings)) {
switch ($action) {
case 'delete':
if (permission_exists('call_recording_delete')) {
@ -70,16 +74,16 @@
}
//get order and order by
$order_by = $_GET["order_by"];
$order = $_GET["order"];
$order_by = $_GET["order_by"] ?? '';
$order = $_GET["order"] ?? '';
//add the search string
if (isset($_GET["search"])) {
if (!empty($search)) {
$search = strtolower($_GET["search"]);
}
//set the time zone
if (isset($_SESSION['domain']['time_zone']['name'])) {
if (!empty($_SESSION['domain']['time_zone']['name'])) {
$time_zone = $_SESSION['domain']['time_zone']['name'];
}
else {
@ -106,8 +110,8 @@
//$num_rows = $database->select($sql, $parameters, 'column');
//prepare some of the paging values
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
$page = $_GET['page'];
$rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50;
$page = $_GET['page'] ?? '';
if (empty($page)) { $page = 0; $_GET['page'] = 0; }
$offset = $rows_per_page * $page;
@ -120,12 +124,12 @@
$sql .= "from view_call_recordings as r, v_domains as d ";
//$sql .= "from v_call_recordings as r, v_domains as d ";
$sql .= "where true ";
if ($_GET['show'] != "all" || !permission_exists('call_recording_all')) {
if ($show != "all" || !permission_exists('call_recording_all')) {
$sql .= "and (r.domain_uuid = :domain_uuid or r.domain_uuid is null) ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
}
$sql .= "and r.domain_uuid = d.domain_uuid ";
if (isset($search)) {
if (!empty($search)) {
$sql .= "and (";
$sql .= " lower(r.call_direction) like :search ";
$sql .= " or lower(r.caller_id_name) like :search ";
@ -140,11 +144,11 @@
$sql .= order_by($order_by, $order, 'r.call_recording_date', 'desc');
$sql .= limit_offset($rows_per_page, $offset);
$database = new database;
$call_recordings = $database->select($sql, $parameters, 'all');
$call_recordings = $database->select($sql, $parameters ?? null, 'all');
unset($sql, $parameters);
//count the results
$result_count = is_array($call_recordings) ? sizeof($call_recordings) : 0;
$result_count = !empty($call_recordings) ? sizeof($call_recordings) : 0;
//limit the number of results
if ($_SESSION['cdr']['limit']['numeric'] > 0) {
@ -153,7 +157,7 @@
//prepare to page the results
$param = "&search=".urlencode($search);
if ($_GET['show'] == "all" && permission_exists('call_recording_all')) {
if ($show == "all" && permission_exists('call_recording_all')) {
$param .= "&show=all";
}
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true, $result_count); //top
@ -179,17 +183,17 @@
}
echo "<form id='form_search' class='inline' method='get'>\n";
if (permission_exists('call_recording_all')) {
if ($_GET['show'] == 'all') {
if ($show == 'all') {
echo " <input type='hidden' name='show' value='all'>";
}
else {
echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'?type='.urlencode($destination_type).'&show=all'.($search != '' ? "&search=".urlencode($search) : null)]);
echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'?type='.urlencode($destination_type ?? '').'&show=all'.($search ? "&search=".urlencode($search) : null)]);
}
}
echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown=''>";
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','collapse'=>'hide-xs']);
echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'call_recordings.php','style'=>($search == '' ? 'display: none;' : null),'collapse'=>'hide-xs']);
if ($paging_controls_mini != '') {
if (!empty($paging_controls_mini)) {
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>\n";
}
echo " </form>\n";
@ -211,7 +215,7 @@
echo "<table class='list'>\n";
echo "<tr class='list-header'>\n";
$col_count = 7;
if ($_GET['show'] == "all" && permission_exists('call_recording_all')) {
if ($show == "all" && permission_exists('call_recording_all')) {
$col_count++;
}
if (permission_exists('call_recording_delete')) {
@ -220,7 +224,7 @@
echo " </th>\n";
$col_count++;
}
if ($_GET['show'] == "all" && permission_exists('call_recording_all')) {
if ($show == "all" && permission_exists('call_recording_all')) {
echo th_order_by('domain_name', $text['label-domain'], $order_by, $order, $param, "class='shrink'");
}
echo th_order_by('caller_id_name', $text['label-caller_id_name'], $order_by, $order, null, "class='hide-sm-dn shrink'");
@ -240,7 +244,7 @@
}
echo "</tr>\n";
if (is_array($call_recordings) && @sizeof($call_recordings) != 0) {
if (!empty($call_recordings)) {
$x = 0;
foreach ($call_recordings as $row) {
//playback progress bar
@ -258,7 +262,7 @@
echo " <input type='hidden' name='call_recordings[$x][uuid]' value='".escape($row['call_recording_uuid'])."' />\n";
echo " </td>\n";
}
if ($_GET['show'] == "all" && permission_exists('call_recording_all')) {
if (!empty($_GET['show']) == "all" && permission_exists('call_recording_all')) {
echo " <td class='overflow hide-sm-dn shrink'>".escape($row['domain_name'])."</td>\n";
}
echo " <td class='hide-sm-dn shrink'>".escape($row['caller_id_name'])."</td>\n";

View File

@ -46,15 +46,21 @@
$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';
//get posted data
if (is_array($_POST['conference_centers'])) {
if (!empty($_POST['conference_centers'])) {
$action = $_POST['action'];
$search = $_POST['search'];
$conference_centers = $_POST['conference_centers'];
}
//process the http post data by action
if ($action != '' && is_array($conference_centers) && @sizeof($conference_centers) != 0) {
if (!empty($action) && !empty($conference_centers)) {
switch ($action) {
/*
case 'copy':
@ -78,16 +84,16 @@
break;
}
header('Location: conference_centers.php'.($search != '' ? '?search='.urlencode($search) : null));
header('Location: conference_centers.php'.(!empty($search) ? '?search='.urlencode($search) : null));
exit;
}
//get variables used to control the order
$order_by = $_GET["order_by"];
$order = $_GET["order"];
$order_by = $_GET["order_by"] ?? '';
$order = $_GET["order"] ?? '';
//add the search term
$search = strtolower($_GET["search"]);
$search = strtolower($_GET["search"] ?? '');
if (!empty($search)) {
$sql_search = "and ( ";
$sql_search .= "lower(conference_center_name) like :search ";
@ -101,21 +107,21 @@
//prepare to page the results
$sql = "select count(*) from v_conference_centers ";
$sql .= "where true ";
if ($_GET['show'] != "all" || !permission_exists('conference_center_all')) {
if ($show != "all" || !permission_exists('conference_center_all')) {
$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
}
$sql .= $sql_search;
$sql .= $sql_search ?? '';
$database = new database;
$num_rows = $database->select($sql, $parameters, 'column');
$num_rows = $database->select($sql, $parameters ?? null, 'column');
//prepare to page the results
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
$rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50;
$param = "&search=".urlencode($search);
if ($_GET['show'] == "all" && permission_exists('conference_center_all')) {
if ($show == "all" && permission_exists('conference_center_all')) {
$param .= "&show=all";
}
$page = $_GET['page'];
$page = $_GET['page'] ?? '';
if (empty($page)) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true);
@ -126,7 +132,7 @@
$sql .= order_by($order_by, $order);
$sql .= limit_offset($rows_per_page, $offset);
$database = new database;
$conference_centers = $database->select($sql, $parameters, 'all');
$conference_centers = $database->select($sql, $parameters ?? null, 'all');
unset($sql, $parameters);
//create token
@ -156,11 +162,11 @@
}
echo "<form id='form_search' class='inline' method='get'>\n";
if (permission_exists('conference_center_all')) {
if ($_GET['show'] == 'all') {
if ($show == 'all') {
echo " <input type='hidden' name='show' value='all'>";
}
else {
echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'?type=&show=all'.($search != '' ? "&search=".urlencode($search) : null)]);
echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'?type=&show=all'.(!empty($search) ? "&search=".urlencode($search) : null)]);
}
}
echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown=''>";
@ -192,10 +198,10 @@
echo "<tr class='list-header'>\n";
if (permission_exists('conference_center_edit') || permission_exists('conference_center_delete')) {
echo " <th class='checkbox'>\n";
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle(); checkbox_on_change(this);' ".($conference_centers ?: "style='visibility: hidden;'").">\n";
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle(); checkbox_on_change(this);' ".(!empty($conference_centers) ?: "style='visibility: hidden;'").">\n";
echo " </th>\n";
}
if ($_GET['show'] == "all" && permission_exists('conference_center_all')) {
if ($show == "all" && permission_exists('conference_center_all')) {
echo th_order_by('domain_name', $text['label-domain'], $order_by, $order, $param, "class='shrink'");
}
echo th_order_by('conference_center_name', $text['label-conference_center_name'], $order_by, $order);
@ -204,12 +210,12 @@
echo th_order_by('conference_center_pin_length', $text['label-conference_center_pin_length'], $order_by, $order, null, "class='center shrink'");
echo th_order_by('conference_center_enabled', $text['label-conference_center_enabled'], $order_by, $order, null, "class='center'");
echo th_order_by('conference_center_description', $text['label-conference_center_description'], $order_by, $order, null, "class='hide-sm-dn'");
if (permission_exists('conference_center_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
if (permission_exists('conference_center_edit') && $list_row_edit_button == 'true') {
echo " <td class='action-button'>&nbsp;</td>\n";
}
echo "</tr>\n";
if (is_array($conference_centers) && @sizeof($conference_centers) != 0) {
if (!empty($conference_centers)) {
$x = 0;
foreach ($conference_centers as $row) {
if (permission_exists('conference_center_edit')) {
@ -222,7 +228,7 @@
echo " <input type='hidden' name='conference_centers[$x][uuid]' value='".escape($row['conference_center_uuid'])."' />\n";
echo " </td>\n";
}
if ($_GET['show'] == "all" && permission_exists('conference_center_all')) {
if ($show == "all" && permission_exists('conference_center_all')) {
if (!empty($_SESSION['domains'][$row['domain_uuid']]['domain_name'])) {
$domain = $_SESSION['domains'][$row['domain_uuid']]['domain_name'];
}
@ -245,7 +251,7 @@
}
echo " </td>\n";
echo " <td class='description overflow hide-sm-dn'>".escape($row['conference_center_description'])."&nbsp;</td>\n";
if (permission_exists('conference_center_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
if (permission_exists('conference_center_edit') && $list_row_edit_button == 'true') {
echo " <td class='action-button'>";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " </td>\n";

View File

@ -54,7 +54,7 @@
}
//get http post variables and set them to php variables
if (is_array($_POST) && @sizeof($_POST) != 0) {
if (!empty($_POST)) {
$number_translation_name = $_POST["number_translation_name"];
$number_translation_details = $_POST["number_translation_details"];
$number_translation_enabled = $_POST["number_translation_enabled"] ?: 'false';
@ -108,7 +108,7 @@
}
//redirect the user
if (in_array($_POST['action'], array('copy', 'delete', 'toggle'))) {
if (!empty($_POST['action'], array('copy', 'delete', 'toggle'))) {
header('Location: number_translation_edit.php?id='.$number_translation_uuid);
exit;
}
@ -158,7 +158,7 @@
$database->save($array);
//redirect the user
if (isset($action)) {
if (!empty($action)) {
if ($action == "add") {
$_SESSION["message"] = $text['message-add'];
}
@ -193,12 +193,12 @@
$sql .= "order by number_translation_detail_order asc";
$parameters['number_translation_uuid'] = $number_translation_uuid;
$database = new database;
$number_translation_details = $database->select($sql, $parameters, 'all');
$number_translation_details = $database->select($sql, $parameters ?? null, 'all');
unset ($sql, $parameters);
}
//add an empty row
if (is_array($number_translation_details) && @sizeof($number_translation_details) != 0) {
if (!empty($number_translation_details)) {
$x = count($number_translation_details);
}
else {
@ -275,7 +275,7 @@
echo " <th class='vtablereq'>".$text['label-number_translation_detail_regex']."</th>\n";
echo " <th class='vtablereq'>".$text['label-number_translation_detail_replace']."</th>\n";
echo " <th class='vtablereq'>".$text['label-number_translation_detail_order']."</th>\n";
if (is_array($number_translation_details) && @sizeof($number_translation_details) > 1 && permission_exists('number_translation_detail_delete')) {
if (!empty($number_translation_details) && @sizeof($number_translation_details) > 1 && permission_exists('number_translation_detail_delete')) {
echo " <td class='vtable edit_delete_checkbox_all' onmouseover=\"swap_display('delete_label_details', 'delete_toggle_details');\" onmouseout=\"swap_display('delete_label_details', 'delete_toggle_details');\">\n";
echo " <span id='delete_label_details'>".$text['label-action']."</span>\n";
echo " <span id='delete_toggle_details'><input type='checkbox' id='checkbox_all_details' name='checkbox_all' onclick=\"edit_all_toggle('details'); checkbox_on_change(this);\"></span>\n";

View File

@ -127,7 +127,7 @@
$sql .= ") ";
}
$database = new database;
$num_rows = $database->select($sql, $parameters ?? '', 'column');
$num_rows = $database->select($sql, $parameters ?? null, 'column');
//prepare to page the results
$rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50;
@ -153,7 +153,7 @@
$sql .= order_by($order_by, $order, 'number_translation_name', 'asc');
$sql .= limit_offset($rows_per_page, $offset);
$database = new database;
$number_translations = $database->select($sql, $parameters ?? '', 'all');
$number_translations = $database->select($sql, $parameters ?? null, 'all');
unset($sql, $parameters);
//create token

View File

@ -49,13 +49,13 @@
//get the number of rows in v_extensions
$sql = " select count(*) from v_settings ";
$database = new database;
$num_rows = $database->select($sql, $parameters ?? '', 'column');
$num_rows = $database->select($sql, $parameters ?? null, 'column');
//set the action
$action = $num_rows == 0 ? "add" : "update";
//get the http values and set them as php variables
if (count($_POST)>0) {
if (!empty($_POST)) {
//$numbering_plan = $_POST["numbering_plan"];
//$default_gateway = $_POST["default_gateway"];
$setting_uuid = $_POST["setting_uuid"];
@ -73,7 +73,7 @@
$mod_shout_volume = $_POST["mod_shout_volume"];
}
if (count($_POST)>0 && empty($_POST["persistformvar"])) {
if (!empty($_POST) && empty($_POST["persistformvar"])) {
//check for all required data
$msg = '';

View File

@ -86,7 +86,7 @@
//build the query string
$query_string = '';
if ($search != '') {
if (!empty($search)) {
$query_string .= 'search='.urlencode($search);
}
if ($default_setting_category != '') {
@ -95,7 +95,7 @@
}
//process the http post
if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
if (!empty($_POST) && empty($_POST["persistformvar"])) {
//set the default_setting_uuid
if ($action == "update") {

View File

@ -113,7 +113,7 @@
//get the count
$sql = "select count(default_setting_uuid) from v_default_settings ";
if (!empty($search) && !empty($search)) {
if (!empty($search)) {
$sql .= "where (";
$sql .= " lower(default_setting_category) like :search ";
$sql .= " or lower(default_setting_subcategory) like :search ";
@ -135,7 +135,7 @@
$sql = "select default_setting_uuid, default_setting_category, default_setting_subcategory, default_setting_name, ";
$sql .= "default_setting_value, cast(default_setting_enabled as text), default_setting_description ";
$sql .= "from v_default_settings ";
if (!empty($search) && !empty($search)) {
if (!empty($search)) {
$sql .= "where (";
$sql .= " lower(default_setting_category) like :search ";
$sql .= " or lower(default_setting_subcategory) like :search ";