Update domain_edit.php

This commit is contained in:
FusionPBX 2019-10-20 18:53:07 -06:00 committed by GitHub
parent f0e02654b2
commit 784aabca7e
1 changed files with 402 additions and 392 deletions

View File

@ -66,10 +66,11 @@
$domain_description = $_POST["domain_description"];
}
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
//process the data
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
if ($action == "update") {
//get the domain_uuid
if ($action == "update" && $_POST["domain_uuid"]) {
$domain_uuid = $_POST["domain_uuid"];
}
@ -82,6 +83,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
}
//check for all required data
$msg = '';
if (strlen($domain_name) == 0) { $msg .= $text['message-required'].$text['label-name']."<br>\n"; }
//if (strlen($domain_description) == 0) { $msg .= $text['message-required'].$text['label-description']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
@ -108,8 +110,10 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
unset($sql, $parameters);
if ($num_rows == 0) {
//add the domain name
$domain_enabled = 'true';
$array['domains'][0]['domain_uuid'] = uuid();
$domain_uuid = uuid();
$array['domains'][0]['domain_uuid'] = $domain_uuid;
$array['domains'][0]['domain_name'] = $domain_name;
$array['domains'][0]['domain_enabled'] = $domain_enabled;
$array['domains'][0]['domain_description'] = $domain_description;
@ -117,9 +121,14 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$database->app_name = 'domains';
$database->app_uuid = '8b91605b-f6d2-42e6-a56d-5d1ded01bb44';
$database->save($array);
//add dialplans to the domain
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/dialplans/app_config.php")) {
$dialplan = new dialplan;
$dialplan->import($array['domains']);
unset($array);
}
}
}
if ($action == "update" && permission_exists('domain_edit')) {
@ -140,7 +149,13 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$database->app_name = 'domains';
$database->app_uuid = '8b91605b-f6d2-42e6-a56d-5d1ded01bb44';
$database->save($array);
// add dialplans to the domain
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/dialplans/app_config.php")) {
$dialplan = new dialplan;
$dialplan->import($array);
unset($array);
}
if ($original_domain_name != $domain_name) {
@ -446,11 +461,6 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
}
}
//upgrade the domains
if (permission_exists('upgrade_apps') || if_group("superadmin")) {
require_once "core/upgrade/upgrade_domains.php";
}
//clear the domains session array to update it
unset($_SESSION["domains"]);
unset($_SESSION["domain_uuid"]);
@ -474,7 +484,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
}
return;
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form (admin won't have domain_add permissions, but domain_uuid will already be set above)
if ((count($_GET) > 0 || (!permission_exists('domain_add') && $domain_uuid != '')) && $_POST["persistformvar"] != "true") {