diff --git a/app/destinations/destination_delete.php b/app/destinations/destination_delete.php index 71731436d7..1dd17b38f6 100644 --- a/app/destinations/destination_delete.php +++ b/app/destinations/destination_delete.php @@ -17,22 +17,26 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2015 + Portions created by the Initial Developer are Copyright (C) 2008-2016 the Initial Developer. All Rights Reserved. Contributor(s): Mark J Crane */ -require_once "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; -if (permission_exists('destination_delete')) { - //access granted -} -else { - echo "access denied"; - exit; -} + +//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; @@ -54,11 +58,12 @@ else { $p = new permissions; $p->add($permission, 'temp'); -//get the dialplan_uuid - $orm = new orm; - $orm->name('destinations'); - $orm->uuid($id); - $result = $orm->find()->get(); +//get the dialplan uuid and context + $sql = "select * from v_destinations "; + $sql .= "where destination_uuid = '$id' "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); foreach ($result as &$row) { if (permission_exists('destination_domain')) { $domain_uuid = $row["domain_uuid"]; @@ -111,4 +116,4 @@ else { header("Location: destinations.php"); return; -?> \ No newline at end of file +?>