diff --git a/app/dialplans/dialplan_copy.php b/app/dialplans/dialplan_copy.php deleted file mode 100644 index f8229896c2..0000000000 --- a/app/dialplans/dialplan_copy.php +++ /dev/null @@ -1,164 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2016 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -//includes - include "root.php"; - require_once "resources/require.php"; - require_once "resources/check_auth.php"; - require_once "resources/paging.php"; - require_once "resources/classes/logging.php"; - -//check permissions - if (permission_exists('dialplan_add') - || permission_exists('inbound_route_add') - || permission_exists('outbound_route_add') - || permission_exists('fifo_add') - || permission_exists('time_condition_add')) { - //access granted - } - else { - echo "access denied"; - exit; - } - -//add multi-lingual support - $language = new text; - $text = $language->get(); - -//logger - $log = new Logging(); - -//set the http get/post variable(s) to a php variable - if (is_uuid($_REQUEST["id"])) { - $id = $_REQUEST["id"]; - $log->log("debug", "isset id."); - $log->log("debug", $id); - } - -//get the dialplan data - if (is_uuid($id)) { - $sql = "select * from v_dialplans "; - $sql .= "where dialplan_uuid = :dialplan_uuid "; - $parameters['dialplan_uuid'] = $id; - $database = new database; - $dialplans = $database->select($sql, $parameters, 'all'); - if (is_array($dialplans) && @sizeof($dialplans) != 0) { - foreach ($dialplans as &$row) { - //create a new primary key for the new row - $dialplan_uuid = uuid(); - $row['dialplan_uuid'] = $dialplan_uuid; - - //get the app_uuid - if (is_uuid($row["app_uuid"])) { - //get the app uuid - $app_uuid = $row["app_uuid"]; - //create a new app_uuid when copying a dialplan except for these exceptions - switch ($app_uuid) { - case "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4": break; //inbound routes - case "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3": break; //outbound routes - case "4b821450-926b-175a-af93-a03c441818b1": break; //time conditions - default: - $app_uuid = uuid(); - } - //set the app uuid - $row['app_uuid'] = $app_uuid; - } - - //add copy to the name and description - //$row['dialplan_name'] = $row['dialplan_name'].'-copy'; - if (strlen($row['dialplan_description']) == 0) { - $dialplan_description = 'copy'; - } - else { - $dialplan_description = $row['dialplan_description'].'-copy'; - } - $row['dialplan_description'] = $dialplan_description; - } - } - unset($sql, $parameters, $row); - } - -//get the the dialplan details - if (is_uuid($id)) { - $sql = "select * from v_dialplan_details "; - $sql .= "where dialplan_uuid = :dialplan_uuid "; - $parameters['dialplan_uuid'] = $id; - $database = new database; - $dialplan_details = $database->select($sql, $parameters, 'all'); - if (is_array($dialplan_details) && @sizeof($dialplan_details) != 0) { - foreach ($dialplan_details as &$row) { - //create a new primary key for the new row - $row['dialplan_detail_uuid'] = uuid(); - //update the foreign relation uuid - $row['dialplan_uuid'] = $dialplan_uuid; - } - } - unset($sql, $parameters); - } - -//build the array - $array['dialplans'] = $dialplans; - if (count($dialplan_details) > 0) { - $array['dialplans'][0]['dialplan_details'] = $dialplan_details; - } - -//add or update the database - $database = new database; - $database->app_name = 'dialplans'; - $database->app_uuid = $app_uuid; - $database->uuid($dialplan_uuid); - $database->save($array); - unset($array); - -//update the dialplan xml - $dialplans = new dialplan; - $dialplans->source = "details"; - $dialplans->destination = "database"; - $dialplans->uuid = $dialplan_uuid; - $dialplans->xml(); - -//clear the cache - $cache = new cache; - $cache->delete("dialplan:".$dialplan_context); - -//synchronize the xml config - save_dialplan_xml(); - -//send a redirect - message::add($text['message-copy']); - switch ($app_uuid) { - case "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4": //inbound routes - case "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3": //outbound routes - case "4b821450-926b-175a-af93-a03c441818b1": //time conditions - $redirect_url = PROJECT_PATH."/app/dialplans/dialplans.php?app_uuid=".$app_uuid; - break; - default: - $redirect_url = PROJECT_PATH."/app/dialplans/dialplans.php"; - } - header("Location: ".$redirect_url); - return; - -?> diff --git a/app/dialplans/dialplan_detail_delete.php b/app/dialplans/dialplan_detail_delete.php deleted file mode 100644 index 133598298c..0000000000 --- a/app/dialplans/dialplan_detail_delete.php +++ /dev/null @@ -1,93 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2014 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -//includes - include "root.php"; - require_once "resources/require.php"; - require_once "resources/check_auth.php"; - -//check permissions - if (permission_exists('dialplan_delete') - || permission_exists('inbound_route_delete') - || permission_exists('outbound_route_delete') - || permission_exists('fifo_delete') - || permission_exists('time_condition_delete')) { - //access granted - } - else { - echo "access denied"; - exit; - } - -//add multi-lingual support - $language = new text; - $text = $language->get(); - -//set the variables - $dialplan_detail_uuid = $_GET["id"]; - $dialplan_uuid = $_REQUEST["dialplan_uuid"]; - $app_uuid = $_REQUEST["app_uuid"]; - -//delete the dialplan detail - if (is_uuid($dialplan_detail_uuid)) { - //delete child data - $array['dialplan_details'][0]['dialplan_detail_uuid'] = $dialplan_detail_uuid; - //$array['dialplan_details'][0]['domain_uuid'] = $_SESSION['domain_uuid']; - - $p = new permissions; - $p->add('dialplan_detail_delete', 'temp'); - - $database = new database; - $database->app_name = 'dialplans'; - $database->app_uuid = '742714e5-8cdf-32fd-462c-cbe7e3d655db'; - $database->delete($array); - unset($array); - - $p->delete('dialplan_detail_delete', 'temp'); - - //synchronize the xml config - save_dialplan_xml(); - - //clear the cache - $cache = new cache; - $cache->delete("dialplan:".$_SESSION["context"]); - - //update the dialplan xml - $dialplans = new dialplan; - $dialplans->source = "details"; - $dialplans->destination = "database"; - $dialplans->uuid = $dialplan_uuid; - $dialplans->xml(); - - //set message - message::add($text['message-delete']); - } - -//redirect the browser - header("Location: dialplan_edit.php?id=".$dialplan_uuid.(($app_uuid != '') ? "&app_uuid=".$app_uuid : null)); - exit; - -?>