From 3ae5fd704af7c9c921db3782bd1b6e836e64d3bb Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Wed, 28 Sep 2016 00:47:19 -0600 Subject: [PATCH] Create dialplan_xml.php Add a new file to be able to edit the new dialplan xml field. --- app/dialplan/dialplan_xml.php | 150 ++++++++++++++++++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 app/dialplan/dialplan_xml.php diff --git a/app/dialplan/dialplan_xml.php b/app/dialplan/dialplan_xml.php new file mode 100644 index 0000000000..7cc842f3cc --- /dev/null +++ b/app/dialplan/dialplan_xml.php @@ -0,0 +1,150 @@ + + Portions created by the Initial Developer are Copyright (C) 2008-2016 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane + Luis Daniel Lucio Quiroz +*/ + +//includes + include "root.php"; + require_once "resources/require.php"; + require_once "resources/check_auth.php"; + +//check permissions + if (permission_exists('dialplan_edit')) { + //access granted + } + else { + echo "access denied"; + exit; + } + +//get the uuids + if (is_uuid($_REQUEST['id'])) { + $dialplan_uuid = $_REQUEST['id']; + } + if (is_uuid($_REQUEST['app_uuid'])) { + $app_uuid = $_REQUEST['app_uuid']; + } + +//set the default app_uuid + if (strlen($app_uuid) == 0) { + $app_uuid = '742714e5-8cdf-32fd-462c-cbe7e3d655db'; + } + +//get the dialplan xml + if (is_uuid($dialplan_uuid)) { + $sql = "select * from v_dialplans "; + $sql .= "where dialplan_uuid = '".$dialplan_uuid."' "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); + foreach ($result as &$row) { + $domain_uuid = $row["domain_uuid"]; + //$app_uuid = $row["app_uuid"]; + $dialplan_name = $row["dialplan_name"]; + $dialplan_number = $row["dialplan_number"]; + $dialplan_order = $row["dialplan_order"]; + $dialplan_continue = $row["dialplan_continue"]; + $dialplan_context = $row["dialplan_context"]; + $dialplan_xml = $row["dialplan_xml"]; + $dialplan_enabled = $row["dialplan_enabled"]; + $dialplan_description = $row["dialplan_description"]; + } + unset ($prep_statement); + } + +//process the HTTP POST + if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { + + //build the dialplan array + $x = 0; + //$array['dialplans'][$x]["domain_uuid"] = $_SESSION['domain_uuid']; + $array['dialplans'][$x]["dialplan_uuid"] = $dialplan_uuid; + $array['dialplans'][$x]["dialplan_xml"] = $_REQUEST['dialplan_xml'];; + + //save to the data + $orm = new orm; + //$orm->name('ring_groups'); + $orm->app_name = 'dialplans'; + $orm->app_uuid = $app_uuid; + //if (strlen($dialplan_uuid) > 0) { + // $orm->uuid($dialplan_uuid); + //} + $orm->save($array); + $message = $orm->message; + + //debug info + //echo "
\n";
+			//print_r($message);
+			//echo "
\n"; + //exit; + + //clear the cache + $cache = new cache; + $cache->delete("dialplan:".$dialplan_context); + + //save the message to a session variable + $_SESSION['message'] = $text['message-update']; + + //redirect the user + header("Location: dialplan_edit.php?id=".$dialplan_uuid."&".((strlen($app_uuid) > 0) ? "?app_uuid=".$app_uuid : null)); + exit; + + } + +//add multi-lingual support + $language = new text; + $text = $language->get(); + +//show the header + require_once "resources/header.php"; + +//show the content + echo "
\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
\n"; + echo" ".$text['title-dialplan_edit']."
\n"; + echo "
\n"; + echo " 0) ? "?app_uuid=".$app_uuid : null)."';\" value='".$text['button-back']."'>\n"; + echo " \n"; + echo "
\n"; + echo " ".$text['description-dialplan-edit']."\n"; + echo "
"; + echo "
\n"; + echo " \n"; + echo "
\n"; + +//show the footer + require_once "resources/footer.php"; + +?>