Update domain_delete.php

Fix the domain delete.
This commit is contained in:
FusionPBX 2017-03-14 14:56:23 -06:00 committed by GitHub
parent e3fa90adec
commit d5fe9ba23b
1 changed files with 72 additions and 66 deletions

View File

@ -23,9 +23,13 @@
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//includes
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
//check permissions
if (permission_exists('domain_delete')) {
//access granted
}
@ -43,6 +47,7 @@ else {
$id = check_str($_GET["id"]);
}
//delete domain data and files
if (strlen($id) > 0) {
//get the domain using the id
$sql = "select * from v_domains ";
@ -96,7 +101,7 @@ if (strlen($id) > 0) {
$db->beginTransaction();
if (isset($apps)) foreach ($apps as &$app) {
if (isset($app['db'])) foreach ($app['db'] as $row) {
$table_name = $row['table'];
$table_name = $row['table']['name'];
if (isset($row['fields'])) foreach ($row['fields'] as $field) {
if ($field['name'] == "domain_uuid") {
$sql = "delete from $table_name where domain_uuid = '$id' ";
@ -107,6 +112,7 @@ if (strlen($id) > 0) {
}
$db->commit();
//delete the directories
if (strlen($domain_name) > 0) {
//set the needle
if (count($_SESSION["domains"]) > 1) {