Remove footer.php and some small improvements

master
Thomas Hooge 12 months ago
parent bfbdc16036
commit 8c61638485
  1. 1
      about.php
  2. 19
      asset.php
  3. 20
      assetclass.php
  4. 21
      assetclassgroup.php
  5. 12
      cable.php
  6. 13
      footer.php
  7. 1
      index.php
  8. 2
      install/index.php
  9. 2
      lib.php
  10. 1
      location.php
  11. 15
      login.php
  12. 1
      logout.php
  13. 1
      nat.php
  14. 1
      node.php
  15. 1
      options.php
  16. 5
      search.php
  17. 9
      subnet.php
  18. 2
      tpl/assetclassgroup.tpl
  19. 2
      tpl/cable.tpl
  20. 3
      tpl/style.css
  21. 1
      user.php
  22. 1
      vlan.php
  23. 1
      zone.php

@ -13,4 +13,3 @@ include("header.php");
$smarty->display("about.tpl");
$smarty->display("footer.tpl");
?>

@ -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');
?>

@ -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');
?>

@ -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');
?>

@ -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;

@ -1,13 +0,0 @@
<?php
/*****************************************************************************
IP Reg, a PHP/MySQL IPAM tool
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
Copyright (C) 2011-2023 Thomas Hooge
SPDX-License-Identifier: GPL-3.0-or-later
*****************************************************************************/
$smarty->assign("config_version", $config_version);
$smarty->display("footer.tpl");
?>

@ -56,4 +56,3 @@ $smarty->assign("cable_counter", $sth->fetchColumn());
$smarty->display("index.tpl");
$smarty->display("footer.tpl");
?>

@ -92,7 +92,7 @@ if (! $failure) {
if ($rec = $sth->fetchColumn()) {
// Check default password
if ($rec == '$2y$10$HTs0lSaFrfr.q4Gmy5zWfeDg3jhYZkqEGZEnDkMiHZ641nso38mt6') {
echo '<p>Password for default admin has not been changed: <span style="color:yellow">Warnung</span>'."</p>\n";
echo '<p>Password for default admin has not been changed: <span style="color:orange">Warning</span>'."</p>\n";
} else {
echo '<p>Default admin exists: <span style="color:green">OK</span>'."</p>\n";
}

@ -261,5 +261,3 @@ function db_get_options_zone($default = NULL) {
}
return $options;
}
?>

@ -364,4 +364,3 @@ endif; // $action == ...
// ========== END OF VARIANTS =================================================
$smarty->display('footer.tpl');
?>

@ -11,7 +11,11 @@ session_name('ipreg');
session_start();
if (! include("config.php")) {
echo "<!DOCTYPE html><html><head><title>IP Reg</title></head><body><h1>IP Reg</h1><h2>No configuration</h2><p>Error loading configuration. Please check your installation.</p></body></html>\n";
echo "<!DOCTYPE html><html><head><title>IP Reg</title></head><body>\n";
echo "<h1>IP Reg</h1><h2>No configuration</h2>\n";
echo '<p>Error loading configuration.';
echo 'Please <a href="install">check your installation</a>.', "</p>\n";
echo "</body></html>\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');

@ -14,4 +14,3 @@ $_SESSION = array();
// redirect to start page
header("Location: index.php");
?>

@ -184,4 +184,3 @@ endif; // $action == ...
// ========== END OF VARIANTS =================================================
$smarty->display('footer.tpl');
?>

@ -309,4 +309,3 @@ endif; // $action == ...
// ========== END OF VARIANTS =================================================
$smarty->display('footer.tpl');
?>

@ -230,4 +230,3 @@ endif; // $action == ...
// ========== END OF VARIANTS =================================================
$smarty->display('footer.tpl');
?>

@ -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");

@ -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');
?>

@ -39,7 +39,7 @@
</tr>
{foreachelse}
<tr>
<td colspan="2">
<td colspan="3">
{$lang_assetclassgroup_none}
</td>
</tr>

@ -51,7 +51,7 @@
</tr>
{foreachelse}
<tr>
<td colspan="4">
<td colspan="5">
{$lang_cable_none}
</td>
</tr>

@ -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;

@ -189,4 +189,3 @@ endif; // $action == ...
// ========== END OF VARIANTS =================================================
$smarty->display('footer.tpl');
?>

@ -232,4 +232,3 @@ endif; // $action == ...
// ========== END OF VARIANTS =================================================
$smarty->display('footer.tpl');
?>

@ -162,4 +162,3 @@ endif; // $action == ...
// ========== END OF VARIANTS =================================================
$smarty->display('footer.tpl');
?>