Update domain_edit.php
This commit is contained in:
parent
f0e02654b2
commit
784aabca7e
|
|
@ -66,10 +66,11 @@
|
||||||
$domain_description = $_POST["domain_description"];
|
$domain_description = $_POST["domain_description"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//process the data
|
||||||
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||||
|
|
||||||
$msg = '';
|
//get the domain_uuid
|
||||||
if ($action == "update") {
|
if ($action == "update" && $_POST["domain_uuid"]) {
|
||||||
$domain_uuid = $_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
|
//check for all required data
|
||||||
|
$msg = '';
|
||||||
if (strlen($domain_name) == 0) { $msg .= $text['message-required'].$text['label-name']."<br>\n"; }
|
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($domain_description) == 0) { $msg .= $text['message-required'].$text['label-description']."<br>\n"; }
|
||||||
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||||
|
|
@ -108,8 +110,10 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||||
unset($sql, $parameters);
|
unset($sql, $parameters);
|
||||||
|
|
||||||
if ($num_rows == 0) {
|
if ($num_rows == 0) {
|
||||||
|
//add the domain name
|
||||||
$domain_enabled = 'true';
|
$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_name'] = $domain_name;
|
||||||
$array['domains'][0]['domain_enabled'] = $domain_enabled;
|
$array['domains'][0]['domain_enabled'] = $domain_enabled;
|
||||||
$array['domains'][0]['domain_description'] = $domain_description;
|
$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_name = 'domains';
|
||||||
$database->app_uuid = '8b91605b-f6d2-42e6-a56d-5d1ded01bb44';
|
$database->app_uuid = '8b91605b-f6d2-42e6-a56d-5d1ded01bb44';
|
||||||
$database->save($array);
|
$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);
|
unset($array);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == "update" && permission_exists('domain_edit')) {
|
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_name = 'domains';
|
||||||
$database->app_uuid = '8b91605b-f6d2-42e6-a56d-5d1ded01bb44';
|
$database->app_uuid = '8b91605b-f6d2-42e6-a56d-5d1ded01bb44';
|
||||||
$database->save($array);
|
$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);
|
unset($array);
|
||||||
|
}
|
||||||
|
|
||||||
if ($original_domain_name != $domain_name) {
|
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
|
//clear the domains session array to update it
|
||||||
unset($_SESSION["domains"]);
|
unset($_SESSION["domains"]);
|
||||||
unset($_SESSION["domain_uuid"]);
|
unset($_SESSION["domain_uuid"]);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue