diff --git a/app/dialplan_inbound/dialplan_inbound_add.php b/app/dialplan_inbound/dialplan_inbound_add.php index 63d84b01dc..4b54869887 100644 --- a/app/dialplan_inbound/dialplan_inbound_add.php +++ b/app/dialplan_inbound/dialplan_inbound_add.php @@ -27,9 +27,10 @@ */ //includes - include "root.php"; + require_once "root.php"; require_once "resources/require.php"; require_once "resources/check_auth.php"; + require_once "resources/paging.php"; //check permissions if (permission_exists('inbound_route_add')) { @@ -44,11 +45,6 @@ $language = new text; $text = $language->get(); -//includes and title - require_once "resources/header.php"; - $document['title'] = $text['title-dialplan-inbound-add']; - require_once "resources/paging.php"; - //get the http get values and set them as php variables $order_by = $_GET["order_by"]; $order = $_GET["order"]; @@ -124,6 +120,14 @@ //process the http post data 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: '.PROJECT_PATH.'/app/dialplans/dialplans.php?app_uuid=c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4'); + exit; + } + //check for all required data if (strlen($domain_uuid) == 0) { $msg .= "".$text['label-required-domain_uuid']."
\n"; } if (strlen($dialplan_name) == 0) { $msg .= "".$text['label-required-dialplan_name']."
\n"; } @@ -427,6 +431,14 @@ //initialize the destinations object $destination = new destinations; +//create token + $object = new token; + $token = $object->create($_SERVER['PHP_SELF']); + +//include the header + $document['title'] = $text['title-dialplan-inbound-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['title-dialplan-inbound-add']."\n"; - echo " \n"; - echo " \n"; + echo "
\n"; + + echo "
\n"; + echo "
".$text['title-dialplan-inbound-add']."
\n"; + echo "
\n"; + echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'link'=>PROJECT_PATH.'/app/dialplans/dialplans.php?app_uuid=c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4']); if (permission_exists("inbound_route_advanced")) { if (permission_exists("inbound_route_edit") && $action == "advanced") { - echo " \n"; + echo button::create(['type'=>'button','label'=>$text['button-basic'],'icon'=>'wrench','style'=>'margin-left: 15px;','link'=>'dialplan_inbound_add.php?action=basic']); } else { - echo " \n"; + echo button::create(['type'=>'button','label'=>$text['button-advanced'],'icon'=>'tools','style'=>'margin-left: 15px;','link'=>'dialplan_inbound_add.php?action=advanced']); } } - echo " \n"; - echo "
\n"; - echo "
"; - echo " ".$text['description-dialplan-inbound-add']."\n"; - echo "
\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-inbound-add']."\n"; + echo "

\n"; echo "\n"; echo "\n"; @@ -799,21 +804,17 @@ echo "\n"; echo "\n"; - echo "\n"; - echo "
\n"; + echo "
"; + echo "

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

"; echo ""; //include the footer require_once "resources/footer.php"; -?> +?> \ No newline at end of file diff --git a/app/dialplan_outbound/dialplan_outbound_add.php b/app/dialplan_outbound/dialplan_outbound_add.php index 392040f164..59b41978d0 100644 --- a/app/dialplan_outbound/dialplan_outbound_add.php +++ b/app/dialplan_outbound/dialplan_outbound_add.php @@ -29,9 +29,10 @@ */ //includes - include "root.php"; + require_once "root.php"; require_once "resources/require.php"; require_once "resources/check_auth.php"; + require_once "resources/paging.php"; //check permissions if (permission_exists('outbound_route_add')) { @@ -46,11 +47,6 @@ $language = new text; $text = $language->get(); -//show the header - require_once "resources/header.php"; - $document['title'] = $text['title-dialplan-outbound-add']; - require_once "resources/paging.php"; - //get the http post values and set theme as php variables if (is_array($_POST) > 0) { //set the variables @@ -177,6 +173,15 @@ //process the http form values 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: '.PROJECT_PATH.'/app/dialplans/dialplans.php?app_uuid=8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3'); + exit; + } + //check for all required data if (strlen($gateway) == 0) { $msg .= $text['message-provide'].": ".$text['label-gateway-name']."
\n"; } //if (strlen($gateway_2) == 0) { $msg .= "Please provide: Alternat 1
\n"; } @@ -752,6 +757,14 @@ unset($sql, $parameters); } +//create token + $object = new token; + $token = $object->create($_SERVER['PHP_SELF']); + +//show the header + $document['title'] = $text['title-dialplan-outbound-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['label-outbound-routes']."\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "
\n"; - echo "
"; - echo " ".$text['description-outbound-routes']."\n"; - echo "
"; - echo "
\n"; + echo "
\n"; + + echo "
\n"; + echo "
".$text['label-outbound-routes']."
\n"; + echo "
\n"; + echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'link'=>PROJECT_PATH.'/app/dialplans/dialplans.php?app_uuid=8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3']); + 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-outbound-routes']."\n"; + echo "

\n"; echo "\n"; echo "\n"; - echo "\n"; - echo "
\n"; + echo "\n"; echo " ".$text['label-gateway']."\n"; echo "\n"; + echo "\n"; if (if_group("superadmin")) { echo "