Code in domain_settings evolving

This commit is contained in:
FusionPBX
2023-05-13 11:28:12 -06:00
committed by GitHub
parent f6a48235d2
commit 0a37d8c8d5

View File

@@ -1,27 +1,27 @@
<?php
/*
FusionPBX
Version: MPL 1.1
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2020
the Initial Developer. All Rights Reserved.
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008 - 2022
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//set the include path
@@ -46,19 +46,26 @@
$text = $language->get();
//get the domain_uuid
if (is_uuid($_GET['id'])) {
if (!empty($_GET['id']) && is_uuid($_GET['id'])) {
$domain_uuid = $_GET['id'];
}
//set additional variables
//$search = !empty($_GET["search"]) ? $_GET["search"] : '';
$show = !empty($_GET["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 ($_POST['action'] != '') {
$action = $_POST['action'];
$domain_uuid = $_POST['domain_uuid'];
$domain_settings = $_POST['domain_settings'];
$domain_uuid_target = $_POST['domain_uuid_target'];
if (!empty($_POST['action'])) {
$action = $_POST['action'] ?? '';
$domain_uuid = $_POST['domain_uuid'] ?? '';
$domain_settings = $_POST['domain_settings'] ?? '';
$domain_uuid_target = $_POST['domain_uuid_target'] ?? '';
//process the http post data by action
if (is_array($domain_settings) && @sizeof($domain_settings) != 0) {
if (!empty($domain_settings)) {
switch ($action) {
case 'copy':
if (permission_exists('domain_setting_add') && permission_exists('domain_select') && count($_SESSION['domains']) > 1) {
@@ -90,9 +97,9 @@
exit;
}
//get the variables
$order_by = $_GET["order_by"];
$order = $_GET["order"];
//get order and order by and sanitize the values
$order_by = $_GET["order_by"] ?? '';
$order = $_GET["order"] ?? '';
//get the domain_name
$sql = "select domain_name from v_domains ";
@@ -121,7 +128,7 @@
}
$parameters['domain_uuid'] = $domain_uuid;
$database = new database;
$domain_settings = $database->select($sql, $parameters, 'all');
$domain_settings = $database->select($sql, $parameters ?? null, 'all');
unset($sql, $parameters);
//create token
@@ -133,12 +140,7 @@
require_once "resources/header.php";
//copy settings javascript
if (
permission_exists("domain_select") &&
permission_exists("domain_setting_add") &&
is_array($_SESSION['domains']) &&
@sizeof($_SESSION['domains']) > 1
) {
if (permission_exists("domain_select") && permission_exists("domain_setting_add") && !empty($_SESSION['domains'])) {
echo "<script language='javascript' type='text/javascript'>\n";
echo " var fade_speed = 400;\n";
echo " function show_domains() {\n";
@@ -217,7 +219,10 @@
echo "<input type='hidden' name='domain_uuid_target' id='domain_uuid_target' value=''>\n";
echo "<table class='list'>\n";
if (is_array($domain_settings) && @sizeof($domain_settings) != 0) {
if (!empty($domain_settings)) {
//define the variable
$previous_domain_setting_category = '';
$x = 0;
foreach ($domain_settings as $row) {
$domain_setting_category = strtolower($row['domain_setting_category']);
@@ -235,7 +240,7 @@
}
if ($previous_domain_setting_category != $row['domain_setting_category']) {
if ($previous_domain_setting_category != '') {
if (!empty($previous_domain_setting_category)) {
echo "</table>\n";
echo "<br>\n";
@@ -249,7 +254,7 @@
echo " <input type='checkbox' id='checkbox_all_".$domain_setting_category."' name='checkbox_all' onclick=\"list_all_toggle('".$domain_setting_category."');\">\n";
echo " </th>\n";
}
if ($_GET['show'] == 'all' && permission_exists('domain_setting_all')) {
if ($show == 'all' && permission_exists('domain_setting_all')) {
echo th_order_by('domain_name', $text['label-domain'], $order_by, $order);
}
echo th_order_by('domain_setting_subcategory', $text['label-subcategory'], $order_by, $order, null, "class='pct-35'");
@@ -257,7 +262,7 @@
echo th_order_by('domain_setting_value', $text['label-value'], $order_by, $order, null, "class='pct-30'");
echo th_order_by('domain_setting_enabled', $text['label-enabled'], $order_by, $order, null, "class='center'");
echo " <th class='pct-25 hide-sm-dn'>".$text['label-description']."</th>\n";
if (permission_exists('domain_setting_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
if (permission_exists('domain_setting_edit') && $list_row_edit_button == 'true') {
echo " <td class='action-button'>&nbsp;</td>\n";
}
echo "</tr>\n";
@@ -292,7 +297,7 @@
$parameters['menu_uuid'] = $row['domain_setting_value'];
$database = new database;
$sub_result = $database->select($sql, $parameters, 'all');
if (is_array($sub_result) && sizeof($sub_result) != 0) {
if (!empty($sub_result)) {
foreach ($sub_result as &$sub_row) {
echo escape($sub_row["menu_language"])." - ".escape($sub_row["menu_name"])."\n";
}
@@ -376,7 +381,7 @@
}
echo " </td>\n";
echo " <td class='description overflow hide-sm-dn' title=\"".escape($row['domain_setting_description'])."\">".escape($row['domain_setting_description'])."&nbsp;</td>\n";
if (permission_exists('domain_setting_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
if (permission_exists('domain_setting_edit') && $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";