Destinations: Remove deprecated code and delete script.

This commit is contained in:
Nate 2020-02-19 18:09:35 -07:00
parent abfd4fd12d
commit e32fae3c31
2 changed files with 1 additions and 114 deletions

View File

@ -1,102 +0,0 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2019
the Initial Developer. All Rights Reserved.
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('destination_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get the id
$destination_uuid = $_GET["id"];
//if valid id
if (is_uuid($destination_uuid)) {
//get the dialplan uuid and context
$sql = "select * from v_destinations ";
$sql .= "where destination_uuid = :destination_uuid ";
$parameters['destination_uuid'] = $destination_uuid;
$database = new database;
$row = $database->select($sql, $parameters, 'row');
if (is_array($row) && @sizeof($row) != 0) {
if (permission_exists('destination_domain')) {
$domain_uuid = $row["domain_uuid"];
}
$dialplan_uuid = $row["dialplan_uuid"];
$destination_context = $row["destination_context"];
}
unset($sql, $parameters, $row);
//add the dialplan permission
$p = new permissions;
$p->add('dialplan_delete', 'temp');
$p->add('dialplan_detail_delete', 'temp');
//delete the destination and related dialplan
if (is_uuid($dialplan_uuid)) {
$array['dialplans'][]['dialplan_uuid'] = $dialplan_uuid;
$array['dialplan_details'][]['dialplan_uuid'] = $dialplan_uuid;
}
$array['destinations'][]['destination_uuid'] = $destination_uuid;
$database = new database;
$database->app_name = 'destinations';
$database->app_uuid = '5ec89622-b19c-3559-64f0-afde802ab139';
$database->delete($array);
$message = $database->message;
//remove the temporary permission
$p->delete('dialplan_delete', 'temp');
$p->delete('dialplan_detail_delete', 'temp');
//synchronize the xml config
save_dialplan_xml();
//clear the cache
$cache = new cache;
$cache->delete("dialplan:".$destination_context);
//set message
message::add($text['message-delete']);
}
//redirect
header("Location: destinations.php");
exit;
?>

View File

@ -990,15 +990,12 @@
echo " ".$text['label-detail_action']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <table width='52%' border='0' cellpadding='2' cellspacing='0'>\n";
$x = 0;
$order = 10;
if (is_array($dialplan_details) && @sizeof($dialplan_details) != 0) {
foreach($dialplan_details as $row) {
if ($row["dialplan_detail_tag"] != "condition") {
if ($row["dialplan_detail_tag"] == "action" && $row["dialplan_detail_type"] == "set" && strpos($row["dialplan_detail_data"], "accountcode") == 0) { continue; } //exclude set:accountcode actions
echo " <tr>\n";
echo " <td style='padding-top: 5px; padding-right: 3px; white-space: nowrap;'>\n";
if (strlen($row['dialplan_detail_uuid']) > 0) {
echo " <input name='dialplan_details[".$x."][dialplan_detail_uuid]' type='hidden' value=\"".escape($row['dialplan_detail_uuid'])."\">\n";
}
@ -1008,21 +1005,13 @@
$label = explode("XML", $data);
$divider = ($row['dialplan_detail_type'] != '') ? ":" : null;
$detail_action = $row['dialplan_detail_type'].$divider.$row['dialplan_detail_data'];
echo $destination->select('dialplan', 'dialplan_details['.$x.'][dialplan_detail_data]', $detail_action);
echo " </td>\n";
echo " <td class='list_control_icons' style='width: 25px;'>";
if (strlen($row['destination_uuid']) > 0) {
echo " <a href='destination_delete.php?id=".escape($row['destination_uuid'])."&destination_uuid=".escape($row['destination_uuid'])."&a=delete' alt='delete' onclick=\"return confirm('".$text['confirm-delete']."')\">".$v_link_label_delete."</a>\n";
}
echo " </td>\n";
echo " </tr>\n";
echo $destination->select('dialplan', 'dialplan_details['.$x.'][dialplan_detail_data]', $detail_action)."<br />\n";
}
$order = $order + 10;
$x++;
}
}
unset($dialplan_details, $row);
echo " </table>\n";
echo "</td>\n";
echo "</tr>\n";
}