Update for PHP 8.1

This commit is contained in:
FusionPBX
2023-05-08 22:55:00 -06:00
committed by GitHub
parent 9e4e8558e5
commit 06bbdec276
+30 -22
View File
@@ -47,7 +47,7 @@
$text = $language->get(); $text = $language->get();
//get posted data //get posted data
if (is_array($_POST['dialplans'])) { if (!empty($_POST['dialplans'])) {
$action = $_POST['action']; $action = $_POST['action'];
$dialplans = $_POST['dialplans']; $dialplans = $_POST['dialplans'];
$context = $_POST['context']; $context = $_POST['context'];
@@ -57,15 +57,15 @@
} }
//get the app uuid //get the app uuid
if (is_uuid($_REQUEST["app_uuid"])) { if (isset($_REQUEST["app_uuid"]) && is_uuid($_REQUEST["app_uuid"])) {
$app_uuid = $_REQUEST["app_uuid"]; $app_uuid = $_REQUEST["app_uuid"];
} }
//process the http post data by action //process the http post data by action
if ($action != '' && is_array($dialplans) && @sizeof($dialplans) != 0) { if (!empty($action) && is_array($dialplans) && @sizeof($dialplans) != 0) {
//define redirect parameters and url //define redirect parameters and url
if (is_uuid($app_uuid)) { $params[] = "app_uuid=".urlencode($app_uuid); } if (isset($app_uuid) && is_uuid($app_uuid)) { $params[] = "app_uuid=".urlencode($app_uuid); }
if ($context) { $params[] = "context=".urlencode($context); } if ($context) { $params[] = "context=".urlencode($context); }
if ($search) { $params[] = "search=".urlencode($search); } if ($search) { $params[] = "search=".urlencode($search); }
if ($order_by) { $params[] = "order_by=".urlencode($order_by); } if ($order_by) { $params[] = "order_by=".urlencode($order_by); }
@@ -107,11 +107,15 @@
} }
//get order and order by and sanatize the values //get order and order by and sanatize the values
$order_by = $_GET["order_by"]; if (!empty($_GET["order_by"])) {
$order = $_GET["order"]; $order_by = $_GET["order_by"];
}
if (!empty($_GET["order"])) {
$order = $_GET["order"];
}
//make sure all dialplans with context of public have the inbound route app_uuid //make sure all dialplans with context of public have the inbound route app_uuid
if ($app_uuid == 'c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4') { if (isset($app_uuid) && $app_uuid == 'c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4') {
$sql = "update v_dialplans set "; $sql = "update v_dialplans set ";
$sql .= "app_uuid = 'c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4' "; $sql .= "app_uuid = 'c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4' ";
$sql .= "where dialplan_context = 'public' "; $sql .= "where dialplan_context = 'public' ";
@@ -131,14 +135,14 @@
//get the number of rows in the dialplan //get the number of rows in the dialplan
$sql = "select count(*) from v_dialplans "; $sql = "select count(*) from v_dialplans ";
if ($_GET['show'] == "all" && permission_exists('dialplan_all')) { if (!empty($_GET['show']) && $_GET['show'] == "all" && permission_exists('dialplan_all')) {
$sql .= "where true "; $sql .= "where true ";
} }
else { else {
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) "; $sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
$parameters['domain_uuid'] = $domain_uuid; $parameters['domain_uuid'] = $domain_uuid;
} }
if (!is_uuid($app_uuid)) { if (!isset($app_uuid)) {
//hide inbound routes //hide inbound routes
$sql .= "and app_uuid <> 'c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4' "; $sql .= "and app_uuid <> 'c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4' ";
$sql .= "and dialplan_context <> 'public' "; $sql .= "and dialplan_context <> 'public' ";
@@ -146,7 +150,7 @@
//$sql .= "and app_uuid <> '8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3' "; //$sql .= "and app_uuid <> '8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3' ";
} }
else { else {
if ($app_uuid == 'c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4') { if (isset($app_uuid) && $app_uuid == 'c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4') {
$sql .= "and (app_uuid = :app_uuid or dialplan_context = 'public') "; $sql .= "and (app_uuid = :app_uuid or dialplan_context = 'public') ";
} }
else { else {
@@ -154,11 +158,11 @@
} }
$parameters['app_uuid'] = $app_uuid; $parameters['app_uuid'] = $app_uuid;
} }
if ($context) { if (isset($context)) {
$sql .= "and dialplan_context = :dialplan_context "; $sql .= "and dialplan_context = :dialplan_context ";
$parameters['dialplan_context'] = $context; $parameters['dialplan_context'] = $context;
} }
if ($search) { if (isset($search)) {
$sql .= "and ("; $sql .= "and (";
$sql .= " lower(dialplan_context) like :search "; $sql .= " lower(dialplan_context) like :search ";
$sql .= " or lower(dialplan_name) like :search "; $sql .= " or lower(dialplan_name) like :search ";
@@ -178,18 +182,22 @@
//prepare the paging //prepare the paging
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50; $rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
$params[] = "app_uuid=".urlencode($app_uuid); if (isset($app_uuid)) { $params[] = "app_uuid=".urlencode($app_uuid); }
if ($context) { $params[] = "context=".urlencode($context); } if (isset($context)) { $params[] = "context=".urlencode($context); }
if ($search) { $params[] = "search=".urlencode($search); } if (isset($search)) { $params[] = "search=".urlencode($search); }
if ($order_by) { $params[] = "order_by=".urlencode($order_by); } if (isset($order_by)) { $params[] = "order_by=".urlencode($order_by); }
if ($order) { $params[] = "order=".urlencode($order); } if (isset($order)) { $params[] = "order=".urlencode($order); }
if ($_GET['show'] == "all" && permission_exists('dialplan_all')) { if (!empty($_GET['show']) && $_GET['show'] == "all" && permission_exists('dialplan_all')) {
$params[] = "show=all"; $params[] = "show=all";
} }
$param = $params ? implode('&', $params) : null; if (!empty($params)) {
$param = $params ? implode('&', $params) : null;
}
else {
$param = null;
}
unset($params); unset($params);
$page = $_GET['page']; if (empty($_GET['page'])) { $page = 0; } else { $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, $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); list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true);
$offset = $rows_per_page * $page; $offset = $rows_per_page * $page;
@@ -620,4 +628,4 @@
//include the footer //include the footer
require_once "resources/footer.php"; require_once "resources/footer.php";
?> ?>