diff --git a/app/dialplans/dialplan_add.php b/app/dialplans/dialplan_add.php index 08431a01bd..f5ca554160 100644 --- a/app/dialplans/dialplan_add.php +++ b/app/dialplans/dialplan_add.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2018 + Portions created by the Initial Developer are Copyright (C) 2008-2019 the Initial Developer. All Rights Reserved. Contributor(s): @@ -28,6 +28,7 @@ include "root.php"; require_once "resources/require.php"; require_once "resources/check_auth.php"; + require_once "resources/paging.php"; //check permissions if (permission_exists('dialplan_add')) { @@ -42,11 +43,6 @@ $language = new text; $text = $language->get(); -//additional includes - require_once "resources/header.php"; - $document['title'] = $text['title-dialplan_add']; - require_once "resources/paging.php"; - //set the variables if (count($_POST) > 0) { $dialplan_name = $_POST["dialplan_name"]; @@ -85,6 +81,15 @@ //add or update data from http post if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { + + //validate the token + $token = new token; + if (!$token->validate($_SERVER['PHP_SELF'])) { + message::add($text['message-invalid_token'],'negative'); + header('Location: dialplans.php'); + exit; + } + //check for all required data if (strlen($domain_uuid) == 0) { $msg .= $text['message-required']."domain_uuid
\n"; } if (strlen($dialplan_name) == 0) { $msg .= $text['message-required'].$text['label-name']."
\n"; } @@ -219,37 +224,39 @@ } --> + create($_SERVER['PHP_SELF']); + +//include the header + $document['title'] = $text['title-dialplan_add']; + require_once "resources/header.php"; -\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - - echo " \n"; - echo " \n"; - echo " \n"; - echo "
\n"; - echo " ".$text['header-dialplan-add']."\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "
\n"; - echo "
".$text['description-dialplan_manager-superadmin']."\n"; - echo "
"; - echo "
\n"; - + echo "
\n"; + + echo "
\n"; + echo "
".$text['header-dialplan-add']."
\n"; + echo "
\n"; + echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'link'=>'dialplans.php']); + echo button::create(['type'=>'button','label'=>$text['button-advanced'],'icon'=>'tools','style'=>'margin-left: 15px;','link'=>'dialplan_edit.php']); + echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'style'=>'margin-left: 15px;']); + echo "
\n"; + echo "
\n"; + echo "
\n"; + + echo $text['description-dialplan_manager-superadmin']."\n"; + echo "

\n"; + echo "\n"; echo "\n"; - echo "\n"; - echo "\n"; echo "\n"; - - echo "\n"; - echo " \n"; - echo ""; - + echo "
\n"; + echo "\n"; echo " ".$text['label-name']."\n"; echo "\n"; + echo "\n"; echo " \n"; echo "
\n"; echo "\n"; @@ -541,22 +548,18 @@ echo "
\n"; echo "
\n"; - if ($action == "update") { - echo " \n"; - } - echo "
"; - echo " \n"; - echo "
"; echo "

"; + + if ($action == "update") { + echo "\n"; + } + echo "\n"; + echo "
"; //include the footer require_once "resources/footer.php"; -?> +?> \ No newline at end of file diff --git a/app/dialplans/dialplan_edit.php b/app/dialplans/dialplan_edit.php index 8d74e06f65..74a00e98e4 100644 --- a/app/dialplans/dialplan_edit.php +++ b/app/dialplans/dialplan_edit.php @@ -26,7 +26,7 @@ */ //includes - include "root.php"; + require_once "root.php"; require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; @@ -258,7 +258,6 @@ $dialplan_destination = 'false'; } - //get the dialplan details in an array $sql = "select * from v_dialplan_details "; $sql .= "where dialplan_uuid = :dialplan_uuid "; @@ -360,8 +359,8 @@ $token = $object->create($_SERVER['PHP_SELF']); //show the header - require_once "resources/header.php"; $document['title'] = $text['title-dialplan_edit']; + require_once "resources/header.php"; //javascript to change select to input and back again ?> -\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 " \n"; - if (permission_exists('dialplan_xml')) { - echo " \n"; + echo "
\n"; + echo "
".$text['title-dialplan_edit']."
\n"; + echo "
\n"; + echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'link'=>'dialplans.php'.(is_uuid($app_uuid) ? "?app_uuid=".urlencode($app_uuid) : null)]); + if ($action == 'update') { + echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$_SESSION['theme']['button_icon_copy'],'style'=>'margin-left: 15px;','link'=>'dialplan_copy.php?id='.urlencode($dialplan_uuid),'onclick'=>"if (!confirm('".$text['confirm-copy']."')) { this.blur(); return false; }"]); + if (permission_exists('dialplan_xml')) { + echo button::create(['type'=>'button','label'=>$text['button-xml'],'icon'=>'code','link'=>'dialplan_xml.php?id='.urlencode($dialplan_uuid).(is_uuid($app_uuid) ? "?app_uuid=".urlencode($app_uuid) : null)]); + } } - echo " \n"; - echo " \n"; - echo "
\n"; - echo " ".$text['description-dialplan-edit']."\n"; - echo " \n"; - echo "
"; - echo "
\n"; + echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'style'=>'margin-left: 15px;']); + echo " \n"; + echo "
\n"; + echo "\n"; + + echo $text['description-dialplan-edit']."\n"; + echo "

\n"; echo "\n"; echo "\n"; @@ -885,18 +878,17 @@ } //end if update - echo "
\n"; - echo "
\n"; + echo "

\n"; + + echo "\n"; if ($action == "update") { echo " \n"; } echo " \n"; - echo " \n"; - echo "
\n"; - echo "

\n"; + echo ""; //show the footer require_once "resources/footer.php"; -?> +?> \ No newline at end of file diff --git a/app/dialplans/dialplan_xml.php b/app/dialplans/dialplan_xml.php index 82d0be72fb..e7dac74ba4 100644 --- a/app/dialplans/dialplan_xml.php +++ b/app/dialplans/dialplan_xml.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2016 + Portions created by the Initial Developer are Copyright (C) 2008-2019 the Initial Developer. All Rights Reserved. Contributor(s): @@ -26,7 +26,7 @@ */ //includes - include "root.php"; + require_once "root.php"; require_once "resources/require.php"; require_once "resources/check_auth.php"; @@ -71,6 +71,14 @@ //process the HTTP POST if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { + //validate the token + $token = new token; + if (!$token->validate($_SERVER['PHP_SELF'])) { + message::add($text['message-invalid_token'],'negative'); + header('Location: dialplans.php'); + exit; + } + //build the dialplan array $x = 0; //$array['dialplans'][$x]["domain_uuid"] = $_SESSION['domain_uuid']; @@ -108,9 +116,13 @@ $setting_indenting = $_SESSION["editor"]["indent_guides"]["boolean"] != '' ? $_SESSION["editor"]["indent_guides"]["boolean"] : 'false'; $setting_numbering = $_SESSION["editor"]["line_numbers"]["boolean"] != '' ? $_SESSION["editor"]["line_numbers"]["boolean"] : 'true'; +//create token + $object = new token; + $token = $object->create($_SERVER['PHP_SELF']); + //show the header - require_once "resources/header.php"; $document['title'] = $text['title-dialplan_edit'].' XML'; + require_once "resources/header.php"; //scripts and styles echo "\n"; echo "