Fixed some display bugs and improved icons

This commit is contained in:
2023-03-14 18:58:28 +01:00
parent 34112b8c1c
commit 303c22160d
28 changed files with 52 additions and 30 deletions

20
nat.php
View File

@@ -23,6 +23,16 @@ switch ($submit = form_get_action()) {
case 'edit': $action = ACT_EDIT; break;
case 'del': $action = ACT_DELETE; break;
case 'exec-edit':
if ($_POST['action'] == 'natadd') {
$action = ACT_ADD;
} elseif ($_POST['action'] == 'natdel') {
$action = ACT_DELETE;
} else {
$g_warning->Add('Invalid action: '. $_POST['action']);
}
break;
case 'insert':
$node_id_ext = sanitize($_POST['node_id_ext']);
$node_id_int = sanitize($_POST['node_id_int']);
@@ -39,7 +49,11 @@ switch ($submit = form_get_action()) {
case 'delete':
$node_id_ext = sanitize($_POST['node_id_ext']);
$sth = $dbh->prepare("DELETE FROM nat WHERE nat_id=?");
$sth->execute([$id]);
try {
$sth->execute([$id]);
} catch (PDOException $e) {
$g_warning->Add($e->getMessage());
}
// TODO
// header_location("node.php?f=view&id=" . $node_id_ext);
$action = ACT_DEFAULT;
@@ -76,7 +90,7 @@ $smarty->display("nat.tpl");
elseif ($action == ACT_ADD):
// ========== VARIANT: add record =============================================
$node_id = sanitize($_GET['node_id']);
$node_id = sanitize($_REQUEST['node_id']);
// node_ext
$sql = "SELECT node_ip AS node_ip_ext
@@ -151,7 +165,7 @@ $smarty->display("natedit.tpl");
elseif ($action == ACT_DELETE):
// ========== VARIANT: delete record ==========================================
$node_id = sanitize($_GET['node_id']);
$node_id = sanitize($_REQUEST['node_id']);
// node_ext
$sth = $dbh->prepare("SELECT node_id AS id_ext, node_ip AS ip_ext FROM node WHERE node_id=?");