Update access_control_node_edit.php
This commit is contained in:
parent
0c506da93c
commit
3b63159fe7
|
|
@ -1,14 +1,18 @@
|
||||||
<?php
|
<?php
|
||||||
require_once "root.php";
|
|
||||||
require_once "resources/require.php";
|
//includes
|
||||||
require_once "resources/check_auth.php";
|
require_once "root.php";
|
||||||
if (permission_exists('access_control_node_add') || permission_exists('access_control_node_edit')) {
|
require_once "resources/require.php";
|
||||||
//access granted
|
require_once "resources/check_auth.php";
|
||||||
}
|
|
||||||
else {
|
//check permissions
|
||||||
echo "access denied";
|
if (permission_exists('access_control_node_add') || permission_exists('access_control_node_edit')) {
|
||||||
exit;
|
//access granted
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
echo "access denied";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
//add multi-lingual support
|
//add multi-lingual support
|
||||||
$language = new text;
|
$language = new text;
|
||||||
|
|
@ -38,12 +42,13 @@ else {
|
||||||
|
|
||||||
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||||
|
|
||||||
$msg = '';
|
//get the uuid
|
||||||
if ($action == "update") {
|
if ($action == "update") {
|
||||||
$access_control_node_uuid = check_str($_POST["access_control_node_uuid"]);
|
$access_control_node_uuid = check_str($_POST["access_control_node_uuid"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//check for all required data
|
//check for all required data
|
||||||
|
$msg = '';
|
||||||
if (strlen($node_type) == 0) { $msg .= $text['message-required']." ".$text['label-node_type']."<br>\n"; }
|
if (strlen($node_type) == 0) { $msg .= $text['message-required']." ".$text['label-node_type']."<br>\n"; }
|
||||||
//if (strlen($node_cidr) == 0) { $msg .= $text['message-required']." ".$text['label-node_cidr']."<br>\n"; }
|
//if (strlen($node_cidr) == 0) { $msg .= $text['message-required']." ".$text['label-node_cidr']."<br>\n"; }
|
||||||
//if (strlen($node_domain) == 0) { $msg .= $text['message-required']." ".$text['label-node_domain']."<br>\n"; }
|
//if (strlen($node_domain) == 0) { $msg .= $text['message-required']." ".$text['label-node_domain']."<br>\n"; }
|
||||||
|
|
@ -64,6 +69,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||||
//add or update the database
|
//add or update the database
|
||||||
if ($_POST["persistformvar"] != "true") {
|
if ($_POST["persistformvar"] != "true") {
|
||||||
if ($action == "add" && permission_exists('access_control_node_add')) {
|
if ($action == "add" && permission_exists('access_control_node_add')) {
|
||||||
|
//update the database
|
||||||
$sql = "insert into v_access_control_nodes ";
|
$sql = "insert into v_access_control_nodes ";
|
||||||
$sql .= "(";
|
$sql .= "(";
|
||||||
$sql .= "access_control_node_uuid, ";
|
$sql .= "access_control_node_uuid, ";
|
||||||
|
|
@ -85,14 +91,22 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||||
$db->exec(check_sql($sql));
|
$db->exec(check_sql($sql));
|
||||||
unset($sql);
|
unset($sql);
|
||||||
|
|
||||||
remove_config_from_cache('configuration:acl.conf');
|
//clear the cache
|
||||||
|
$cache = new cache;
|
||||||
|
$cache->delete("configuration:acl.conf");
|
||||||
|
|
||||||
|
//add the message
|
||||||
messages::add($text['message-add']);
|
messages::add($text['message-add']);
|
||||||
|
|
||||||
|
//redirect the browser
|
||||||
header('Location: access_control_edit.php?id='.$access_control_uuid);
|
header('Location: access_control_edit.php?id='.$access_control_uuid);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
} //if ($action == "add")
|
} //if ($action == "add")
|
||||||
|
|
||||||
if ($action == "update" && permission_exists('access_control_node_edit')) {
|
if ($action == "update" && permission_exists('access_control_node_edit')) {
|
||||||
|
|
||||||
|
//update the database
|
||||||
$sql = "update v_access_control_nodes set ";
|
$sql = "update v_access_control_nodes set ";
|
||||||
$sql .= "access_control_uuid = '$access_control_uuid', ";
|
$sql .= "access_control_uuid = '$access_control_uuid', ";
|
||||||
$sql .= "node_type = '$node_type', ";
|
$sql .= "node_type = '$node_type', ";
|
||||||
|
|
@ -103,8 +117,14 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||||
$db->exec(check_sql($sql));
|
$db->exec(check_sql($sql));
|
||||||
unset($sql);
|
unset($sql);
|
||||||
|
|
||||||
remove_config_from_cache('configuration:acl.conf');
|
//clear the cache
|
||||||
|
$cache = new cache;
|
||||||
|
$cache->delete("configuration:acl.conf");
|
||||||
|
|
||||||
|
//add the message
|
||||||
messages::add($text['message-update']);
|
messages::add($text['message-update']);
|
||||||
|
|
||||||
|
//redirect the browser
|
||||||
header('Location: access_control_edit.php?id='.$access_control_uuid);
|
header('Location: access_control_edit.php?id='.$access_control_uuid);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -134,7 +154,6 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||||
require_once "resources/header.php";
|
require_once "resources/header.php";
|
||||||
|
|
||||||
//show the content
|
//show the content
|
||||||
|
|
||||||
echo "<form method='post' name='frm' action=''>\n";
|
echo "<form method='post' name='frm' action=''>\n";
|
||||||
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
|
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
|
||||||
echo "<tr>\n";
|
echo "<tr>\n";
|
||||||
|
|
@ -217,4 +236,4 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||||
|
|
||||||
//include the footer
|
//include the footer
|
||||||
require_once "resources/footer.php";
|
require_once "resources/footer.php";
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue