Compare commits

..

No commits in common. '02980bbad5e86f727da65dae71c8155c7f1ec25b' and 'bfbdc160367d633cbca6b79384f2186021cde37b' have entirely different histories.

  1. 1
      about.php
  2. 11
      asset.php
  3. 21
      assetclass.php
  4. 22
      assetclassgroup.php
  5. 8
      cable.php
  6. 13
      footer.php
  7. 1
      index.php
  8. 2
      install/index.php
  9. 2
      lib.php
  10. 8
      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. 2
      tpl/vlanview.tpl
  22. 1
      user.php
  23. 7
      vlan.php
  24. 8
      zone.php

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

@ -55,13 +55,10 @@ switch ($submit = form_get_action()) {
assetclass_id=?, asset_intf=?, asset_type=?
WHERE asset_id=?";
$sth = $dbh->prepare($sql);
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']);
@ -86,11 +83,8 @@ 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=?");
try {
$sth->execute([$id]);
} catch (PDOException $e) {
$g_error->Add($e->getMessage());
} $action = ACT_DEFAULT;
$action = ACT_DEFAULT;
break;
default:
@ -252,3 +246,4 @@ endif; // $action == ...
// ========== END OF VARIANTS =================================================
$smarty->display('footer.tpl');
?>

@ -33,11 +33,7 @@ switch ($submit = form_get_action()) {
VALUE
(?, ?, ?)";
$sth = $dbh->prepare($sql);
try {
$sth->execute([$name, $description, $group_id]);
} catch (PDOException $e) {
$g_error->Add($e->getMessage());
}
$id = $dbh->lastInsertId();
$action = ACT_VIEW;
break;
@ -52,27 +48,13 @@ switch ($submit = form_get_action()) {
assetclassgroup_id=?
WHERE assetclass_id=?";
$sth = $dbh->prepare($sql);
try {
$sth->execute([$name, $description, $group_id, $id]);
} catch (PDOException $e) {
$g_error->Add($e->getMessage());
} $action = ACT_VIEW;
$action = ACT_VIEW;
break;
case 'delete':
$sth = $dbh->prepare("SELECT COUNT(*) FROM asset WHERE assetclass_id=?");
$sth->execute([$id]);
if ($sth->fetchColumn() > 0) {
$g_warning->Add("Objektklasse kann nicht gelöscht werden, da noch zugeordnete Objekte vorhanden sind.");
$action = ACT_VIEW;
break;
}
$sth = $dbh->prepare("DELETE FROM assetclass WHERE assetclass_id=?");
try {
$sth->execute([$id]);
} catch (PDOException $e) {
$g_error->Add($e->getMessage());
}
$action = ACT_DEFAULT;
break;
@ -172,3 +154,4 @@ endif; // $action == ...
// ========== END OF VARIANTS =================================================
$smarty->display('footer.tpl');
?>

@ -33,11 +33,8 @@ switch ($submit = form_get_action()) {
VALUE
(?, ?, ?)";
$sth = $dbh->prepare($sql);
try {
$sth->execute([$name, $color, $desc]);
} catch (PDOException $e) {
$g_error->Add($e->getMessage());
} $id = $dbh->lastInsertId();
$id = $dbh->lastInsertId();
$action = ACT_VIEW;
break;
@ -50,28 +47,14 @@ switch ($submit = form_get_action()) {
assetclassgroup_name=?, assetclassgroup_color=?, assetclassgroup_description=?
WHERE assetclassgroup_id=?";
$sth = $dbh->prepare($sql);
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("SELECT COUNT(*) FROM assetclass WHERE assetclassgroup_id=?");
$sth->execute([$id]);
if ($sth->fetchColumn() > 0) {
$g_warning->Add("Objektklassengruppe kann nicht gelöscht werden, da noch zugeordnete Objektklassen vorhanden sind.");
$action = ACT_VIEW;
break;
}
$sth = $dbh->prepare("DELETE FROM assetclassgroup WHERE assetclassgroup_id=?");
try {
$sth->execute([$id]);
} catch (PDOException $e) {
$g_error->Add($e->getMessage());
} $action = ACT_DEFAULT;
$action = ACT_DEFAULT;
break;
default:
@ -161,3 +144,4 @@ endif; // $action == ...
// ========== END OF VARIANTS =================================================
$smarty->display('footer.tpl');
?>

@ -96,21 +96,13 @@ 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);
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=?");
try {
$sth->execute([$id]);
} catch (PDOException $e) {
$g_error->Add($e->getMessage());
}
$action = ACT_DEFAULT;
break;

@ -0,0 +1,13 @@
<?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,3 +56,4 @@ $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:orange">Warning</span>'."</p>\n";
echo '<p>Password for default admin has not been changed: <span style="color:yellow">Warnung</span>'."</p>\n";
} else {
echo '<p>Default admin exists: <span style="color:green">OK</span>'."</p>\n";
}

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

@ -118,14 +118,7 @@ switch ($submit = form_get_action()) {
break;
case 'delete':
$sth = $dbh->prepare("DELETE FROM subnetlocation WHERE location_id=?");
$sth->execute([$id]);
$n = $sth->rowCount();
if ($n > 0) {
$g_message->Add("$n Subnetzzuordnungen wurden entfernt.");
}
$sth = $dbh->prepare("DELETE FROM location WHERE location_id=?");
$g_message->Add("Standort wurde gelöscht.");
$sth->execute([$id]);
$action = ACT_DEFAULT;
break;
@ -371,3 +364,4 @@ endif; // $action == ...
// ========== END OF VARIANTS =================================================
$smarty->display('footer.tpl');
?>

@ -11,11 +11,7 @@ session_name('ipreg');
session_start();
if (! include("config.php")) {
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";
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";
exit(1);
}
@ -119,15 +115,11 @@ 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);
@ -167,4 +159,5 @@ $smarty->assign("config_version", $config_version);
$smarty->assign($lang);
$smarty->display("login.tpl");
$smarty->display('footer.tpl');
include("footer.php");
?>

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

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

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

@ -230,3 +230,4 @@ 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");
$smarty->display("footer.tpl");
include("footer.php");
exit;
}
@ -114,4 +114,5 @@ $smarty->assign("resultcounter", $resultcounter);
$smarty->display("search.tpl");
$smarty->display("footer.tpl");
include("footer.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,3 +743,4 @@ endif; // $action == ...
// ========== END OF VARIANTS =================================================
$smarty->display('footer.tpl');
?>

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

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

@ -50,7 +50,6 @@ textarea {
}
table.footer {
margin-top: 1ex;
border: 0px;
border-collapse: collapse;
border-spacing: 0px;
@ -210,7 +209,7 @@ div.error, div.warning, div.info, div.note {
margin: 1em 0 0 0;
border-radius: 12px;
width: 750px;
animation: fadeout 2s 10s forwards;
animation: fadeout 5s 2s forwards;
}
div.error {
border: 1px solid #8b0000;

@ -79,7 +79,7 @@
</td>
<td class="value">
{foreach item=subnet from=$subnets}
<a href="subnet.php?f=view&id={$subnet.subnet_id}">{$subnet.subnet_address}/{$subnet.subnet_mask}</a>
<a href="subnet.php?f=wiew&id={$subnet.subnet_id}">{$subnet.subnet_address}/{$subnet.subnet_mask}</a>
{$subnet.subnet_info}
<br>
{/foreach}

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

@ -88,12 +88,6 @@ switch ($submit = form_get_action()) {
break;
case 'delete':
$sth = $dbh->prepare("DELETE FROM subnetvlan WHERE vlan_id=?");
$sth->execute([$id]);
$n = $sth->rowCount();
if ($n > 0) {
$g_message->Add("$n vlan to subnet references were removed.");
}
$sth = $dbh->prepare("DELETE FROM vlan WHERE vlan_id=?");
$sth->execute([$id]);
$g_message->Add(_("VLAN deleted."));
@ -238,3 +232,4 @@ endif; // $action == ...
// ========== END OF VARIANTS =================================================
$smarty->display('footer.tpl');
?>

@ -83,13 +83,6 @@ switch ($submit = form_get_action()) {
break;
case 'delete':
$sth = $dbh->prepare("SELECT COUNT(*) FROM node WHERE zone_id=?");
$sth->execute([$id]);
if ($sth->fetchColumn() > 0) {
$g_warning->Add("Zone can not be removed. There are node-references.");
$action = ACT_VIEW;
break;
}
$sth = $dbh->prepare("DELETE FROM zone WHERE zone_id=?");
$sth->execute([$id]);
$g_message->Add(_("Deleted zone"));
@ -169,3 +162,4 @@ endif; // $action == ...
// ========== END OF VARIANTS =================================================
$smarty->display('footer.tpl');
?>