diff --git a/about.php b/about.php index 6998c67..94b98c9 100644 --- a/about.php +++ b/about.php @@ -13,4 +13,3 @@ include("header.php"); $smarty->display("about.tpl"); $smarty->display("footer.tpl"); -?> \ No newline at end of file diff --git a/asset.php b/asset.php index 3b46635..fe14c7b 100644 --- a/asset.php +++ b/asset.php @@ -55,10 +55,13 @@ switch ($submit = form_get_action()) { assetclass_id=?, asset_intf=?, asset_type=? WHERE asset_id=?"; $sth = $dbh->prepare($sql); - $sth->execute([$asset_name, $asset_info, $asset_hostname, - $assetclass_id, $asset_intf, $asset_type, - $id]); - + try { + $sth->execute([$asset_name, $asset_info, $asset_hostname, + $assetclass_id, $asset_intf, $asset_type, + $id]); + } catch (PDOException $e) { + $g_error->Add($e->getMessage()); + } // Ext. links if ($config_ext['zabbix']['enabled'] and isset($_POST['x_zbx_host'])) { $zbx_host = sanitize($_POST['x_zbx_host']); @@ -83,8 +86,11 @@ switch ($submit = form_get_action()) { $sth = $dbh->prepare("DELETE FROM asset WHERE asset_id=?"); $sth->execute([$id]); $sth = $dbh->prepare("DELETE FROM node WHERE asset_id=?"); - $sth->execute([$id]); - $action = ACT_DEFAULT; + try { + $sth->execute([$id]); + } catch (PDOException $e) { + $g_error->Add($e->getMessage()); + } $action = ACT_DEFAULT; break; default: @@ -246,4 +252,3 @@ endif; // $action == ... // ========== END OF VARIANTS ================================================= $smarty->display('footer.tpl'); -?> diff --git a/assetclass.php b/assetclass.php index bd59bd9..ababa8e 100644 --- a/assetclass.php +++ b/assetclass.php @@ -33,7 +33,11 @@ switch ($submit = form_get_action()) { VALUE (?, ?, ?)"; $sth = $dbh->prepare($sql); - $sth->execute([$name, $description, $group_id]); + try { + $sth->execute([$name, $description, $group_id]); + } catch (PDOException $e) { + $g_error->Add($e->getMessage()); + } $id = $dbh->lastInsertId(); $action = ACT_VIEW; break; @@ -48,13 +52,20 @@ switch ($submit = form_get_action()) { assetclassgroup_id=? WHERE assetclass_id=?"; $sth = $dbh->prepare($sql); - $sth->execute([$name, $description, $group_id, $id]); - $action = ACT_VIEW; + try { + $sth->execute([$name, $description, $group_id, $id]); + } catch (PDOException $e) { + $g_error->Add($e->getMessage()); + } $action = ACT_VIEW; break; case 'delete': $sth = $dbh->prepare("DELETE FROM assetclass WHERE assetclass_id=?"); - $sth->execute([$id]); + try { + $sth->execute([$id]); + } catch (PDOException $e) { + $g_error->Add($e->getMessage()); + } $action = ACT_DEFAULT; break; @@ -154,4 +165,3 @@ endif; // $action == ... // ========== END OF VARIANTS ================================================= $smarty->display('footer.tpl'); -?> diff --git a/assetclassgroup.php b/assetclassgroup.php index 2f86720..cd2602b 100644 --- a/assetclassgroup.php +++ b/assetclassgroup.php @@ -33,8 +33,11 @@ switch ($submit = form_get_action()) { VALUE (?, ?, ?)"; $sth = $dbh->prepare($sql); - $sth->execute([$name, $color, $desc]); - $id = $dbh->lastInsertId(); + try { + $sth->execute([$name, $color, $desc]); + } catch (PDOException $e) { + $g_error->Add($e->getMessage()); + } $id = $dbh->lastInsertId(); $action = ACT_VIEW; break; @@ -47,14 +50,21 @@ switch ($submit = form_get_action()) { assetclassgroup_name=?, assetclassgroup_color=?, assetclassgroup_description=? WHERE assetclassgroup_id=?"; $sth = $dbh->prepare($sql); - $sth->execute([$acg_name, $acg_color, $acg_desc, $id]); + try { + $sth->execute([$acg_name, $acg_color, $acg_desc, $id]); + } catch (PDOException $e) { + $g_error->Add($e->getMessage()); + } $action = ACT_VIEW; break; case 'delete': $sth = $dbh->prepare("DELETE FROM assetclassgroup WHERE assetclassgroup_id=?"); - $sth->execute([$id]); - $action = ACT_DEFAULT; + try { + $sth->execute([$id]); + } catch (PDOException $e) { + $g_error->Add($e->getMessage()); + } $action = ACT_DEFAULT; break; default: @@ -144,4 +154,3 @@ endif; // $action == ... // ========== END OF VARIANTS ================================================= $smarty->display('footer.tpl'); -?> diff --git a/cable.php b/cable.php index bb25d2c..5cb14e5 100644 --- a/cable.php +++ b/cable.php @@ -96,13 +96,21 @@ switch ($submit = form_get_action()) { $sth->bindValue(':type', $type, PDO::PARAM_STR); $sth->bindValue(':links', $links, PDO::PARAM_INT); $sth->bindValue(':info', $info, PDO::PARAM_STR); - $sth->execute(); + try { + $sth->execute(); + } catch (PDOException $e) { + $g_error->Add($e->getMessage()); + } $action = ACT_VIEW; break; case 'delete': $sth = $dbh->prepare("DELETE FROM cable WHERE cable_id=?"); - $sth->execute([$id]); + try { + $sth->execute([$id]); + } catch (PDOException $e) { + $g_error->Add($e->getMessage()); + } $action = ACT_DEFAULT; break; diff --git a/footer.php b/footer.php deleted file mode 100644 index d4de289..0000000 --- a/footer.php +++ /dev/null @@ -1,13 +0,0 @@ -assign("config_version", $config_version); - -$smarty->display("footer.tpl"); -?> \ No newline at end of file diff --git a/index.php b/index.php index 5086928..f5cc966 100644 --- a/index.php +++ b/index.php @@ -56,4 +56,3 @@ $smarty->assign("cable_counter", $sth->fetchColumn()); $smarty->display("index.tpl"); $smarty->display("footer.tpl"); -?> diff --git a/install/index.php b/install/index.php index c34b124..7760aa1 100644 --- a/install/index.php +++ b/install/index.php @@ -92,7 +92,7 @@ if (! $failure) { if ($rec = $sth->fetchColumn()) { // Check default password if ($rec == '$2y$10$HTs0lSaFrfr.q4Gmy5zWfeDg3jhYZkqEGZEnDkMiHZ641nso38mt6') { - echo '

Password for default admin has not been changed: Warnung'."

\n"; + echo '

Password for default admin has not been changed: Warning'."

\n"; } else { echo '

Default admin exists: OK'."

\n"; } diff --git a/lib.php b/lib.php index cd26015..f624e1e 100644 --- a/lib.php +++ b/lib.php @@ -261,5 +261,3 @@ function db_get_options_zone($default = NULL) { } return $options; } - -?> diff --git a/location.php b/location.php index 4da2f16..6ab2f83 100644 --- a/location.php +++ b/location.php @@ -364,4 +364,3 @@ endif; // $action == ... // ========== END OF VARIANTS ================================================= $smarty->display('footer.tpl'); -?> diff --git a/login.php b/login.php index d2231e3..99bd0a2 100644 --- a/login.php +++ b/login.php @@ -11,7 +11,11 @@ session_name('ipreg'); session_start(); if (! include("config.php")) { - echo "IP Reg

IP Reg

No configuration

Error loading configuration. Please check your installation.

\n"; + echo "IP Reg\n"; + echo "

IP Reg

No configuration

\n"; + echo '

Error loading configuration.'; + echo 'Please check your installation.', "

\n"; + echo "\n"; exit(1); } @@ -115,11 +119,15 @@ function user_login ($user_name, $user_pass) { $_SESSION['suser_tooltips'] = $user->user_tooltips; $roles = explode(',', $user->user_role); + if (in_array('admin', $roles)) { + // admin means everything! + $roles = ['add', 'edit', 'delete', 'manage', 'admin']; + $_SESSION['suser_role_admin'] = true; + } $_SESSION['suser_role_add'] = in_array('add', $roles); $_SESSION['suser_role_edit'] = in_array('edit', $roles); $_SESSION['suser_role_delete'] = in_array('delete', $roles); $_SESSION['suser_role_manage'] = in_array('manage', $roles); - $_SESSION['suser_role_admin'] = in_array('admin', $roles); $menu = explode(',', $user->user_menu); $_SESSION['suser_menu_assets'] = in_array('asset', $menu); @@ -159,5 +167,4 @@ $smarty->assign("config_version", $config_version); $smarty->assign($lang); $smarty->display("login.tpl"); -include("footer.php"); -?> +$smarty->display('footer.tpl'); diff --git a/logout.php b/logout.php index 6047e76..27c6e88 100644 --- a/logout.php +++ b/logout.php @@ -14,4 +14,3 @@ $_SESSION = array(); // redirect to start page header("Location: index.php"); -?> \ No newline at end of file diff --git a/nat.php b/nat.php index 61138e1..2a506ce 100644 --- a/nat.php +++ b/nat.php @@ -184,4 +184,3 @@ endif; // $action == ... // ========== END OF VARIANTS ================================================= $smarty->display('footer.tpl'); -?> diff --git a/node.php b/node.php index e5a39f6..6e2b4ab 100644 --- a/node.php +++ b/node.php @@ -309,4 +309,3 @@ endif; // $action == ... // ========== END OF VARIANTS ================================================= $smarty->display('footer.tpl'); -?> diff --git a/options.php b/options.php index 23baf23..9a17647 100644 --- a/options.php +++ b/options.php @@ -230,4 +230,3 @@ endif; // $action == ... // ========== END OF VARIANTS ================================================= $smarty->display('footer.tpl'); -?> diff --git a/search.php b/search.php index bcf3479..e817de5 100644 --- a/search.php +++ b/search.php @@ -16,7 +16,7 @@ if (empty($search)) { // parse nosearch box $smarty->assign("nosearch", TRUE); $smarty->display("search.tpl"); - include("footer.php"); + $smarty->display("footer.tpl"); exit; } @@ -114,5 +114,4 @@ $smarty->assign("resultcounter", $resultcounter); $smarty->display("search.tpl"); -include("footer.php"); -?> +$smarty->display("footer.tpl"); diff --git a/subnet.php b/subnet.php index 320db5a..741d9d6 100644 --- a/subnet.php +++ b/subnet.php @@ -153,21 +153,21 @@ switch ($submit = form_get_action()) { $sth = $dbh->prepare("DELETE FROM node WHERE subnet_id=?"); $sth->execute([$id]); $count = $sth->rowCount(); - $g_message->Add('Deleted $count nodes'); + $g_message->Add("Deleted $count nodes"); $sth = $dbh->prepare("DELETE FROM subnetlocation WHERE subnet_id=?"); $sth->execute([$id]); $count = $sth->rowCount(); - $g_message->Add('Deleted $count location links'); + $g_message->Add("Deleted $count location links"); $sth = $dbh->prepare("DELETE FROM subnetvlan WHERE subnet_id=?"); $sth->execute([$id]); $count = $sth->rowCount(); - $g_message->Add('Deleted $count vlan links'); + $g_message->Add("Deleted $count vlan links"); $sth = $dbh->prepare("DELETE FROM subnet WHERE subnet_id=?"); $sth->execute([$id]); - $g_message->Add('Deleted subnet'); + $g_message->Add("Deleted subnet"); $action = ACT_DEFAULT; break; @@ -743,4 +743,3 @@ endif; // $action == ... // ========== END OF VARIANTS ================================================= $smarty->display('footer.tpl'); -?> diff --git a/tpl/assetclassgroup.tpl b/tpl/assetclassgroup.tpl index 4e9158a..c1e8837 100644 --- a/tpl/assetclassgroup.tpl +++ b/tpl/assetclassgroup.tpl @@ -39,7 +39,7 @@ {foreachelse} - + {$lang_assetclassgroup_none} diff --git a/tpl/cable.tpl b/tpl/cable.tpl index 2164a69..b19aa2c 100644 --- a/tpl/cable.tpl +++ b/tpl/cable.tpl @@ -51,7 +51,7 @@ {foreachelse} - + {$lang_cable_none} diff --git a/tpl/style.css b/tpl/style.css index bd73ac7..7169cdc 100644 --- a/tpl/style.css +++ b/tpl/style.css @@ -50,6 +50,7 @@ textarea { } table.footer { + margin-top: 1ex; border: 0px; border-collapse: collapse; border-spacing: 0px; @@ -209,7 +210,7 @@ div.error, div.warning, div.info, div.note { margin: 1em 0 0 0; border-radius: 12px; width: 750px; - animation: fadeout 5s 2s forwards; + animation: fadeout 10s 2s forwards; } div.error { border: 1px solid #8b0000; diff --git a/user.php b/user.php index 16c187c..415f6f8 100644 --- a/user.php +++ b/user.php @@ -189,4 +189,3 @@ endif; // $action == ... // ========== END OF VARIANTS ================================================= $smarty->display('footer.tpl'); -?> diff --git a/vlan.php b/vlan.php index 0ef99b5..daa5c88 100644 --- a/vlan.php +++ b/vlan.php @@ -232,4 +232,3 @@ endif; // $action == ... // ========== END OF VARIANTS ================================================= $smarty->display('footer.tpl'); -?> diff --git a/zone.php b/zone.php index bf63a13..01e4503 100644 --- a/zone.php +++ b/zone.php @@ -162,4 +162,3 @@ endif; // $action == ... // ========== END OF VARIANTS ================================================= $smarty->display('footer.tpl'); -?>