Update menu_edit.php
This commit is contained in:
+9
-15
@@ -17,15 +17,19 @@
|
|||||||
|
|
||||||
The Initial Developer of the Original Code is
|
The Initial Developer of the Original Code is
|
||||||
Mark J Crane <markjcrane@fusionpbx.com>
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
Portions created by the Initial Developer are Copyright (C) 2008-2015
|
Portions created by the Initial Developer are Copyright (C) 2008-2019
|
||||||
the Initial Developer. All Rights Reserved.
|
the Initial Developer. All Rights Reserved.
|
||||||
|
|
||||||
Contributor(s):
|
Contributor(s):
|
||||||
Mark J Crane <markjcrane@fusionpbx.com>
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
//includes
|
||||||
require_once "root.php";
|
require_once "root.php";
|
||||||
require_once "resources/require.php";
|
require_once "resources/require.php";
|
||||||
require_once "resources/check_auth.php";
|
require_once "resources/check_auth.php";
|
||||||
|
|
||||||
|
//check permissions
|
||||||
if (permission_exists('menu_add') || permission_exists('menu_edit')) {
|
if (permission_exists('menu_add') || permission_exists('menu_edit')) {
|
||||||
//access granted
|
//access granted
|
||||||
}
|
}
|
||||||
@@ -55,13 +59,9 @@ else {
|
|||||||
$menu_description = $_POST["menu_description"];
|
$menu_description = $_POST["menu_description"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//process the http post
|
||||||
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||||
|
|
||||||
$msg = '';
|
|
||||||
if ($action == "update") {
|
|
||||||
$menu_uuid = $_POST["menu_uuid"];
|
|
||||||
}
|
|
||||||
|
|
||||||
//validate the token
|
//validate the token
|
||||||
$token = new token;
|
$token = new token;
|
||||||
if (!$token->validate($_SERVER['PHP_SELF'])) {
|
if (!$token->validate($_SERVER['PHP_SELF'])) {
|
||||||
@@ -71,6 +71,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//check for all required data
|
//check for all required data
|
||||||
|
$msg = '';
|
||||||
//if (strlen($menu_name) == 0) { $msg .= $text['message-required'].$text['label-name']."<br>\n"; }
|
//if (strlen($menu_name) == 0) { $msg .= $text['message-required'].$text['label-name']."<br>\n"; }
|
||||||
//if (strlen($menu_language) == 0) { $msg .= $text['message-required'].$text['label-language']."<br>\n"; }
|
//if (strlen($menu_language) == 0) { $msg .= $text['message-required'].$text['label-language']."<br>\n"; }
|
||||||
//if (strlen($menu_description) == 0) { $msg .= $text['message-required'].$text['label-description']."<br>\n"; }
|
//if (strlen($menu_description) == 0) { $msg .= $text['message-required'].$text['label-description']."<br>\n"; }
|
||||||
@@ -104,14 +105,6 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
$database->save($array);
|
$database->save($array);
|
||||||
unset($array);
|
unset($array);
|
||||||
|
|
||||||
//add the default items in the menu
|
|
||||||
require_once "resources/classes/menu.php";
|
|
||||||
$menu = new menu;
|
|
||||||
$menu->db = $db;
|
|
||||||
$menu->menu_uuid = $menu_uuid;
|
|
||||||
$menu->menu_language = $menu_language;
|
|
||||||
$menu->restore();
|
|
||||||
|
|
||||||
//redirect the user back to the main menu
|
//redirect the user back to the main menu
|
||||||
message::add($text['message-add']);
|
message::add($text['message-add']);
|
||||||
header("Location: menu.php");
|
header("Location: menu.php");
|
||||||
@@ -139,7 +132,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//pre-populate the form
|
//pre-populate the form
|
||||||
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
|
if (count($_GET) > 0 && is_array($_GET["id"]) && $_POST["persistformvar"] != "true") {
|
||||||
$menu_uuid = $_GET["id"];
|
$menu_uuid = $_GET["id"];
|
||||||
$sql = "select * from v_menus ";
|
$sql = "select * from v_menus ";
|
||||||
$sql .= "where menu_uuid = :menu_uuid ";
|
$sql .= "where menu_uuid = :menu_uuid ";
|
||||||
@@ -251,4 +244,5 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
|
|
||||||
//include the footer
|
//include the footer
|
||||||
require_once "resources/footer.php";
|
require_once "resources/footer.php";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
Reference in New Issue
Block a user