mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
extension_settings and domains php 8.1 changes (#6737)
* Update extension_settings.php * Update extension_setting_edit.php * Update extension_edit.php * Update domain_edit.php * Update domain_json.php * Update extension_setting_edit.php
This commit is contained in:
@@ -42,8 +42,15 @@
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//set the defaults
|
||||
$extension_uuid = '';
|
||||
$extension_setting_uuid = '';
|
||||
$extension_setting_name = '';
|
||||
$extension_setting_value = '';
|
||||
$extension_setting_description = '';
|
||||
|
||||
//action add or update
|
||||
if (is_uuid($_REQUEST["id"])) {
|
||||
if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$extension_setting_uuid = $_REQUEST["id"];
|
||||
$id = $_REQUEST["id"];
|
||||
@@ -53,15 +60,15 @@
|
||||
}
|
||||
|
||||
//get the extension id
|
||||
if (is_uuid($_REQUEST["extension_setting_uuid"])) {
|
||||
if (!empty($_REQUEST["extension_setting_uuid"]) && is_uuid($_REQUEST["extension_setting_uuid"])) {
|
||||
$extension_setting_uuid = $_REQUEST["extension_setting_uuid"];
|
||||
}
|
||||
if (is_uuid($_REQUEST["extension_uuid"])) {
|
||||
if (!empty($_REQUEST["extension_uuid"]) && is_uuid($_REQUEST["extension_uuid"])) {
|
||||
$extension_uuid = $_REQUEST["extension_uuid"];
|
||||
}
|
||||
|
||||
//get http post variables and set them to php variables
|
||||
if (count($_POST) > 0) {
|
||||
if (!empty($_POST)) {
|
||||
$domain_uuid = $_POST["domain_uuid"];
|
||||
$extension_setting_type = $_POST["extension_setting_type"];
|
||||
$extension_setting_name = $_POST["extension_setting_name"];
|
||||
@@ -71,7 +78,7 @@
|
||||
}
|
||||
|
||||
//process the user data and save it to the database
|
||||
if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
|
||||
if (!empty($_POST) && empty($_POST["persistformvar"])) {
|
||||
|
||||
//validate the token
|
||||
$token = new token;
|
||||
@@ -82,7 +89,7 @@
|
||||
}
|
||||
|
||||
//process the http post data by submitted action
|
||||
if ($_POST['action'] != '' && !empty($_POST['action'])) {
|
||||
if (!empty($_POST['action'])) {
|
||||
|
||||
//prepare the array(s)
|
||||
//send the array to the database class
|
||||
@@ -136,7 +143,7 @@
|
||||
}
|
||||
|
||||
//add the extension_setting_uuid
|
||||
if (!is_uuid($extension_setting_uuid)) {
|
||||
if (empty($extension_setting_uuid)) {
|
||||
$extension_setting_uuid = uuid();
|
||||
}
|
||||
|
||||
@@ -182,7 +189,7 @@
|
||||
}
|
||||
|
||||
//pre-populate the form
|
||||
if (is_array($_GET) && $_POST["persistformvar"] != "true") {
|
||||
if (!empty($_GET) && empty($_POST["persistformvar"])) {
|
||||
$sql = "select ";
|
||||
//$sql .= "extension_uuid, ";
|
||||
//$sql .= "domain_uuid, ";
|
||||
@@ -196,11 +203,11 @@
|
||||
$sql .= "where extension_setting_uuid = :extension_setting_uuid ";
|
||||
//$sql .= "and domain_uuid = :domain_uuid ";
|
||||
//$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['extension_setting_uuid'] = $extension_setting_uuid;
|
||||
$parameters['extension_setting_uuid'] = $extension_setting_uuid ?? '';
|
||||
$database = new database;
|
||||
$row = $database->select($sql, $parameters, 'row');
|
||||
if (is_array($row) && @sizeof($row) != 0) {
|
||||
if (is_uuid($row["extension_uuid"])) {
|
||||
if (!empty($row)) {
|
||||
if (!empty($row["extension_uuid"]) && is_uuid($row["extension_uuid"])) {
|
||||
$extension_uuid = $row["extension_uuid"];
|
||||
}
|
||||
//$domain_uuid = $row["domain_uuid"];
|
||||
|
||||
@@ -42,20 +42,28 @@
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//set the defaults
|
||||
$search = '';
|
||||
$paging_controls = '';
|
||||
$id = '';
|
||||
|
||||
//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 (is_array($_POST['extension_settings'])) {
|
||||
if (!empty($_POST['extension_settings'])) {
|
||||
$action = $_POST['action'];
|
||||
$search = $_POST['search'];
|
||||
$extension_settings = $_POST['extension_settings'];
|
||||
}
|
||||
|
||||
//action add or update
|
||||
if (is_uuid($_REQUEST["id"])) {
|
||||
if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) {
|
||||
$extension_uuid = $_REQUEST["id"];
|
||||
}
|
||||
|
||||
//process the http post data by action
|
||||
if (!empty($action) && is_array($extension_settings)) {
|
||||
if (!empty($action) && !empty($extension_settings)) {
|
||||
|
||||
//validate the token
|
||||
$token = new token;
|
||||
@@ -150,11 +158,11 @@
|
||||
}
|
||||
|
||||
$sql .= order_by($order_by, $order, 'extension_setting_type', 'asc');
|
||||
$sql .= limit_offset($rows_per_page, $offset);
|
||||
$sql .= limit_offset($rows_per_page ?? null, $offset ?? null);
|
||||
$parameters['extension_uuid'] = $extension_uuid;
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$database = new database;
|
||||
$extension_settings = $database->select($sql, $parameters ?? null, 'all');
|
||||
$extension_settings = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//create token
|
||||
@@ -223,7 +231,7 @@
|
||||
echo "<input type='hidden' name='search' value=\"".escape($search)."\">\n";
|
||||
|
||||
echo "<table class='list'>\n";
|
||||
if (is_array($extension_settings) && @sizeof($extension_settings) != 0) {
|
||||
if (!empty($extension_settings)) {
|
||||
$x = 0;
|
||||
foreach ($extension_settings as $row) {
|
||||
$extension_setting_type = $row['extension_setting_type'];
|
||||
@@ -234,7 +242,7 @@
|
||||
$label_extension_setting_type = str_replace("-", " ", $label_extension_setting_type);
|
||||
$label_extension_setting_type = ucwords($label_extension_setting_type);
|
||||
|
||||
if ($previous_extension_setting_type !== $row['extension_setting_type']) {
|
||||
if (!empty($previous_extension_setting_type) && $previous_extension_setting_type !== $row['extension_setting_type']) {
|
||||
echo " <tr>";
|
||||
echo " <td align='left' colspan='999'> </td>\n";
|
||||
echo " </tr>";
|
||||
@@ -261,7 +269,7 @@
|
||||
echo " <th class='center'>".$text['label-extension_setting_enabled']."</th>\n";
|
||||
|
||||
echo " <th class='hide-sm-dn'>".$text['label-extension_setting_description']."</th>\n";
|
||||
if (permission_exists('extension_setting_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
if (permission_exists('extension_setting_edit') && $list_row_edit_button == 'true') {
|
||||
echo " <td class='action-button'> </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
@@ -294,7 +302,7 @@
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " <td class='description overflow hide-sm-dn'>".escape($row['extension_setting_description'])."</td>\n";
|
||||
if (permission_exists('extension_setting_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
if (permission_exists('extension_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";
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$extension_uuid = $_REQUEST["id"];
|
||||
$page = $_REQUEST['page'];
|
||||
$page = $_REQUEST['page'] ?? '';
|
||||
}
|
||||
else {
|
||||
$action = "add";
|
||||
@@ -2217,4 +2217,4 @@
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -46,6 +46,10 @@
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//set the defaults
|
||||
$domain_name = '';
|
||||
$domain_description = '';
|
||||
|
||||
//action add or update
|
||||
if (!permission_exists('domain_add') || (file_exists($_SERVER["PROJECT_ROOT"]."/app/domains/") && !permission_exists('domain_all'))) {
|
||||
//admin editing own domain/settings
|
||||
@@ -53,7 +57,7 @@
|
||||
$action = "update";
|
||||
}
|
||||
else {
|
||||
if (is_uuid($_REQUEST["id"])) {
|
||||
if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$domain_uuid = $_REQUEST["id"];
|
||||
}
|
||||
@@ -63,14 +67,14 @@
|
||||
}
|
||||
|
||||
//get http post variables and set them to php variables
|
||||
if (count($_POST) > 0) {
|
||||
if (!empty($_POST)) {
|
||||
$domain_name = strtolower($_POST["domain_name"]);
|
||||
$domain_enabled = $_POST["domain_enabled"] ?: 'false';
|
||||
$domain_description = $_POST["domain_description"];
|
||||
}
|
||||
|
||||
//process the data
|
||||
if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
|
||||
if (!empty($_POST) && empty($_POST["persistformvar"])) {
|
||||
|
||||
//get the domain_uuid
|
||||
if ($action == "update" && $_POST["domain_uuid"]) {
|
||||
@@ -118,7 +122,7 @@
|
||||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if (empty($_POST["persistformvar"])) {
|
||||
if ($action == "add" && permission_exists('domain_add')) {
|
||||
$sql = "select count(*) from v_domains ";
|
||||
$sql .= "where lower(domain_name) = :domain_name ";
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
}
|
||||
$sql .= "order by domain_name asc ";
|
||||
$database = new database;
|
||||
$domains = $database->select($sql, $parameters ?? '', 'all');
|
||||
$domains = $database->select($sql, $parameters ?? null, 'all');
|
||||
unset($sql, $parameters);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user