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 $database = new database; $database->app_name = 'dialplans'; $database->app_uuid = $app_uuid; //if (strlen($dialplan_uuid) > 0) { // $database->uuid($dialplan_uuid); //} $database->save($array); $message = $database->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"; ?>