SQL Statements simplified and some bugfixing

This commit is contained in:
2023-02-15 12:44:29 +01:00
parent ed33c0553d
commit 6df7a3f6a8
38 changed files with 694 additions and 678 deletions

View File

@@ -15,6 +15,14 @@
 
</td>
</tr>
<tr>
<td class="label">
{$lang_about_projectpage}
</td>
<td class="value">
<a href="https://git.piratenpartei-sh.de/thooge/ipreg">https://git.piratenpartei-sh.de/thooge/ipreg</a>
</td>
</tr>
<tr>
<td class="label">
{$lang_about_sfprojectpage}

View File

@@ -24,6 +24,7 @@
<a href="assetclassview.php?assetclass_id={$assetclass.assetclass_id}">{$assetclass.assetclass_name}</a>
</td>
<td class="value">
<img src="image.php?color={$assetclass.assetclassgroup_color}" alt="#{$assetclass.assetclassgroup_color}">
<a href="assetclassgroupview.php?assetclassgroup_id={$assetclass.assetclassgroup_id}">{$assetclass.assetclassgroup_name}</a>
</td>
</tr>

View File

@@ -1,73 +1,74 @@
<table class="title">
<tr>
<td class="header">
{$assetclass_name}
</td>
<td align="right">
<a href="assetadd.php?assetclass_id={$assetclass_id}"><img src="image.php?icon=add" alt="{$lang_asset_add}" {if $suser_tooltips}title="{$lang_asset_add}" {/if}/></a>
<a href="assetclassedit.php?assetclass_id={$assetclass_id}"><img src="image.php?icon=edit" alt="{$lang_assetclass_edit}" {if $suser_tooltips}title="{$lang_asset_edit}" {/if}/></a>
<a href="assetclassdel.php?assetclass_id={$assetclass_id}"><img src="image.php?icon=delete" alt="{$lang_assetclass_add}" {if $suser_tooltips}title="{$lang_asset_delete}" {/if}/></a>
</td>
</tr>
</table>
<table class="info">
<tr>
<td class="header">
{$lang_assetclass}
</td>
<td class="header_right">
&nbsp;
</td>
</tr>
<tr>
<td class="label">
{$lang_assetclass_name}
</td>
<td class="value">
<a href="assetclassview.php?assetclass_id={$assetclass_id}">{$assetclass_name}</a>
</td>
</tr>
</table>
<table class="info">
<tr>
<td class="header">
{$lang_assetclassgroup}
</td>
<td class="header_right">
&nbsp;
</td>
</tr>
<tr>
<td class="label">
{$lang_assetclassgroup_name}
</td>
<td class="value">
<a href="assetclassgroupview.php?assetclassgroup_id={$assetclassgroup_id}">{$assetclassgroup_name}</a><br>
</td>
</tr>
</table>
<table class="info">
<tr>
<td class="header">
{$lang_assets}
</td>
<td class="header_right">
&nbsp;
</td>
</tr>
<tr>
<td class="label">
{$lang_assets} ({$assets|@count})
</td>
<td class="value">
{foreach item=asset from=$assets}
<a href="assetview.php?asset_id={$asset.asset_id}">{$asset.asset_name}</a>
{$asset.asset_info}
<br>
{/foreach}
</td>
</tr>
</table>
<table class="title">
<tr>
<td class="header">
{$assetclass_name}
</td>
<td align="right">
<a href="assetadd.php?assetclass_id={$assetclass_id}"><img src="image.php?icon=add" alt="{$lang_asset_add}" {if $suser_tooltips}title="{$lang_asset_add}" {/if}/></a>
<a href="assetclassedit.php?assetclass_id={$assetclass_id}"><img src="image.php?icon=edit" alt="{$lang_assetclass_edit}" {if $suser_tooltips}title="{$lang_asset_edit}" {/if}/></a>
<a href="assetclassdel.php?assetclass_id={$assetclass_id}"><img src="image.php?icon=delete" alt="{$lang_assetclass_add}" {if $suser_tooltips}title="{$lang_asset_delete}" {/if}/></a>
</td>
</tr>
</table>
<table class="info">
<tr>
<td class="header">
{$lang_assetclass}
</td>
<td class="header_right">
&nbsp;
</td>
</tr>
<tr>
<td class="label">
{$lang_assetclass_name}
</td>
<td class="value">
<a href="assetclassview.php?assetclass_id={$assetclass_id}">{$assetclass_name}</a>
</td>
</tr>
</table>
<table class="info">
<tr>
<td class="header">
{$lang_assetclassgroup}
</td>
<td class="header_right">
&nbsp;
</td>
</tr>
<tr>
<td class="label">
{$lang_assetclassgroup_name}
</td>
<td class="value">
<img src="image.php?color={$assetclassgroup_color}" alt="#{$assetclassgroup_color}">
<a href="assetclassgroupview.php?assetclassgroup_id={$assetclassgroup_id}">{$assetclassgroup_name}</a><br>
</td>
</tr>
</table>
<table class="info">
<tr>
<td class="header">
{$lang_assets}
</td>
<td class="header_right">
&nbsp;
</td>
</tr>
<tr>
<td class="label">
{$lang_assets} ({$assets|@count})
</td>
<td class="value">
{foreach item=asset from=$assets}
<a href="assetview.php?asset_id={$asset.asset_id}">{$asset.asset_name}</a>
{$asset.asset_info}
<br>
{/foreach}
</td>
</tr>
</table>

View File

@@ -1,55 +1,55 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>{$lang_ipreg}</title>
<meta name="author" content="Thomas Hooge" />
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link rel="shortcut icon" href="images/shield.ico">
<link rel="stylesheet" href="tpl/style.css" type="text/css">
{foreach item=style from=$styles}
<link rel="stylesheet" href="css/{$style[0]}" type="text/css" media="{$style[1]}" />
{/foreach}
{foreach item=script from=$scripts}
<script type="text/javascript" src="lib/{$script}"></script>
{/foreach}
</head>
<body>
<form action="search.php" method="post">
<table class="menu">
<tr>
<td valign="top" rowspan="2">
<a href="index.php"><img src="image.php?icon=logo" alt="{$lang_ipreg}" style="margin-right:1em" /></a>
</td>
<td valign="top" rowspan="2">
{if $menu_assets}<a href="asset.php">{$lang_assets}</a> | {/if}
{if $menu_assetclasses}<a href="assetclass.php">{$lang_assetclasses}</a> | {/if}
{if $menu_assetclassgroups}<a href="assetclassgroup.php">{$lang_assetclassgroups}</a> | {/if}
{if $menu_locations}<a href="location.php">{$lang_locations}</a> | {/if}
{if $menu_nodes}<a href="node.php">{$lang_nodes}</a> | {/if}
{if $menu_subnets}<a href="subnet.php">{$lang_subnets}</a> | {/if}
{if $menu_vlans}<a href="vlan.php">{$lang_vlans}</a> | {/if}
{if $menu_zones}<a href="zone.php">{$lang_zones}</a> {/if}
</td>
<td align="right" width="38%">
{$suser_name}&nbsp;|&nbsp;
<a href="about.php">{$lang_about}</a> |
<a href="options.php">{$lang_options}</a> |
<a href="logout.php">{$lang_logout}</a>
</td>
</tr>
<tr>
<td align="right">
<input type="text" name="search" value="{$search}">&nbsp;<input type="image" class="icon" src="image.php?icon=search" alt="{$lang_search}">
</td>
</tr>
</table>
</form>
<table class="header">
<tr>
<td>
&nbsp;{$lang_ipreg}
</td>
</tr>
</table>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>{$lang_ipreg}</title>
<meta name="author" content="Thomas Hooge" />
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link rel="shortcut icon" href="images/shield.ico">
<link rel="stylesheet" href="tpl/style.css" type="text/css">
{foreach item=style from=$styles}
<link rel="stylesheet" href="css/{$style[0]}" type="text/css" media="{$style[1]}" />
{/foreach}
{foreach item=script from=$scripts}
<script type="text/javascript" src="lib/{$script}"></script>
{/foreach}
</head>
<body>
<form action="search.php" method="post">
<table class="menu">
<tr>
<td valign="top" rowspan="2">
<a href="index.php"><img src="image.php?icon=logo" alt="{$lang_ipreg}" style="margin-right:1em" /></a>
</td>
<td valign="top" rowspan="2">
{if $menu_assets}<a href="asset.php">{$lang_assets}</a> | {/if}
{if $menu_assetclasses}<a href="assetclass.php">{$lang_assetclasses}</a> | {/if}
{if $menu_assetclassgroups}<a href="assetclassgroup.php">{$lang_assetclassgroups}</a> | {/if}
{if $menu_locations}<a href="location.php">{$lang_locations}</a> | {/if}
{if $menu_nodes}<a href="node.php">{$lang_nodes}</a> | {/if}
{if $menu_subnets}<a href="subnet.php">{$lang_subnets}</a> | {/if}
{if $menu_vlans}<a href="vlan.php">{$lang_vlans}</a> | {/if}
{if $menu_zones}<a href="zone.php">{$lang_zones}</a> {/if}
</td>
<td align="right" width="38%">
{$suser_name}&nbsp;|&nbsp;
<a href="about.php">{$lang_about}</a> |
<a href="options.php">{$lang_options}</a> |
<a href="logout.php">{$lang_logout}</a>
</td>
</tr>
<tr>
<td align="right">
<input type="text" name="search" value="{$search}">&nbsp;<input type="image" class="icon" src="image.php?icon=search" alt="{$lang_search}">
</td>
</tr>
</table>
</form>
<table class="header">
<tr>
<td>
&nbsp;{$lang_ipreg}
</td>
</tr>
</table>

View File

@@ -1,53 +1,61 @@
<form method="POST" action="submit.php">
<input type="hidden" name="del" value="nat">
<input type="hidden" name="node_id_ext" value="{$node_id_ext}">
<table class="title">
<tr>
<td class="header">
{lang_nat}
</td>
<td align="right">
<a href="#" onClick="history.go(-1)"><img src="image.php?icon=back" alt="{$lang_cancel}"></a>
<input type="image" src="image.php?icon=save" alt="{$lang_submit}">
</td>
</tr>
</table>
<table class="info">
<tr>
<td class="header">
{$lang_node}
</td>
<td class="header_right">
&nbsp;
</td>
</tr>
<tr>
<td class="label">
{$lang_ip}
</td>
<td class="value">
<a href="nodeview.php?node_id={$node_id_ext}">{$node_ip_ext}</a>
</td>
</tr>
</table>
<table class="info">
<tr>
<td class="header">
{$lang_nat_del}
</td>
<td class="header_right">
&nbsp;
</td>
</tr>
<tr>
<td class="label">
{$lang_node}
</td>
<td class="value">
{html_options name=node_id_int options=$node_id_int_options}
</td>
</tr>
</table>
<form method="POST" action="submit.php">
<input type="hidden" name="del" value="nat">
<input type="hidden" name="node_id_ext" value="{$node_id_ext}">
<table class="title">
<tr>
<td class="header">
{$lang_nat}
</td>
<td align="right">
<a href="#" onClick="history.go(-1)"><img src="image.php?icon=back" alt="{$lang_cancel}"></a>
{if $nat_options}
<input type="image" src="image.php?icon=save" alt="{$lang_submit}">
{/if}
</td>
</tr>
</table>
<table class="info">
<tr>
<td class="header">
{$lang_node}
</td>
<td class="header_right">
&nbsp;
</td>
</tr>
<tr>
<td class="label">
{$lang_ip}
</td>
<td class="value">
<a href="nodeview.php?node_id={$node_id_ext}">{$node_ip_ext}</a>
</td>
</tr>
</table>
<table class="info">
<tr>
<td class="header">
{$lang_nat_del}
</td>
<td class="header_right">
&nbsp;
</td>
</tr>
<tr>
{if $nat_options}
<td class="label">
{$lang_node}
</td>
<td class="value">
{html_options name=nat_ext options=$nat_options}
</td>
{else}
<td colspan="2">
No NAT rule to delete
</td>
{/if}
</tr>
</table>

View File

@@ -1,138 +1,144 @@
<table class="title">
<tr>
<td class="header">
<img class="icon" src="images/network-ethernet.png" alt="" />
{$node_ip}
</td>
<td align="right">
<a href="nodeedit.php?node_id={$node.node_id}"><img src="image.php?icon=edit" alt="{$lang_node_edit}"></a>
<a href="nodedel.php?node_id={$node.node_id}"><img src="image.php?icon=delete" alt="{$lang_node_del}"></a>
</td>
</tr>
</table>
<table class="info">
<tr>
<td class="header">
{$lang_node}
</td>
<td class="header_right">
&nbsp;
</td>
</tr>
<tr>
<td class="label">
{$lang_ip}
</td>
<td class="value">
<a href="nodeview.php?node_id={$node.node_id}">{$node.node_ip}</a>
</td>
</tr>
<tr>
<td class="label">
{$lang_proto_vers}
</td>
<td class="value">
{$node.node_type}
</td>
</tr>
<tr>
<td class="label">
{$lang_mac}
</td>
<td class="value">
{$node.node_mac}
</td>
</tr>
<tr>
<td class="label">
{$lang_dns1}
</td>
<td class="value">
{$node.node_dns1}
</td>
</tr>
<tr>
<td class="label">
{$lang_dns2}
</td>
<td class="value">
{$node.node_dns2}
</td>
</tr>
<tr>
<td class="label">
{$lang_node_info}
</td>
<td class="value">
{$node.node_info}
</td>
</tr>
<tr>
<td class="label">
{$lang_zone}
</td>
<td class="value">
{$node.zone_origin}
</td>
</tr>
</table>
<table class="info">
<tr>
<td class="header">
{$lang_asset}
</td>
<td class="header_right">
&nbsp;
</td>
</tr>
<tr>
<td class="label">
{$lang_asset_name}
</td>
<td class="value">
<a href="assetview.php?asset_id={$node.asset_id}">{$node.asset_name}</a>
</td>
</tr>
</table>
<table class="info">
<tr>
<td class="header">
{$lang_subnet}
</td>
<td class="header_right">
&nbsp;
</td>
</tr>
<tr>
<td class="label">
{$lang_subnet_subnetaddress}/{$lang_subnet_mask}
</td>
<td class="value">
<a href="subnetview.php?subnet_id={$node.subnet_id}&page={$node.node_ip}">{$node.subnet_address}/{$node.subnet_mask}</a>
</td>
</tr>
</table>
<table class="info">
<tr>
<td class="header">
{$lang_nat}
</td>
<td class="header_right">
<a href="natedit.php?node_id={$node.node_id}"><img src="image.php?icon=edit" alt="{$lang_nat_edit}"></a>
</td>
</tr>
<tr>
<td class="label">
{$lang_nat_rules} ({$natrules|@count})
</td>
<td class="value">
{foreach item=rule from=$natrules}
<a href="nodeview.php?node_id={$rule.nat_node_id}">{$rule.nat_node_ip}</a>/<a href="assetview.php?asset_id={$rule.nat_asset_id}">{$rule.nat_asset_name}</a> ({$rule.nat_type})<br />
{/foreach}
</td>
</tr>
</table>
<table class="title">
<tr>
<td class="header">
<img class="icon" src="images/network-ethernet.png" alt="" />
{$node_ip}
</td>
<td align="right">
<a href="nodeedit.php?node_id={$node.node_id}"><img src="image.php?icon=edit" alt="{$lang_node_edit}"></a>
<a href="nodedel.php?node_id={$node.node_id}"><img src="image.php?icon=delete" alt="{$lang_node_del}"></a>
</td>
</tr>
</table>
<table class="info">
<tr>
<td class="header">
{$lang_node}
</td>
<td class="header_right">
&nbsp;
</td>
</tr>
<tr>
<td class="label">
{$lang_ip}
</td>
<td class="value">
<a href="nodeview.php?node_id={$node.node_id}">{$node.node_ip}</a>
</td>
</tr>
<tr>
<td class="label">
{$lang_proto_vers}
</td>
<td class="value">
{$node.node_type}
</td>
</tr>
<tr>
<td class="label">
{$lang_mac}
</td>
<td class="value">
{$node.node_mac}
</td>
</tr>
<tr>
<td class="label">
{$lang_dns1}
</td>
<td class="value">
{$node.node_dns1}
</td>
</tr>
<tr>
<td class="label">
{$lang_dns2}
</td>
<td class="value">
{$node.node_dns2}
</td>
</tr>
<tr>
<td class="label">
{$lang_node_info}
</td>
<td class="value">
{$node.node_info}
</td>
</tr>
<tr>
<td class="label">
{$lang_zone}
</td>
<td class="value">
{$node.zone_origin}
</td>
</tr>
</table>
<table class="info">
<tr>
<td class="header">
{$lang_asset}
</td>
<td class="header_right">
&nbsp;
</td>
</tr>
<tr>
<td class="label">
{$lang_asset_name}
</td>
<td class="value">
<a href="assetview.php?asset_id={$node.asset_id}">{$node.asset_name}</a>
</td>
</tr>
</table>
<table class="info">
<tr>
<td class="header">
{$lang_subnet}
</td>
<td class="header_right">
&nbsp;
</td>
</tr>
<tr>
<td class="label">
{$lang_subnet_subnetaddress}/{$lang_subnet_mask}
</td>
<td class="value">
<a href="subnetview.php?subnet_id={$node.subnet_id}&page={$node.node_ip}">{$node.subnet_address}/{$node.subnet_mask}</a>
</td>
</tr>
</table>
<table class="info">
<tr>
<td class="header">
{$lang_nat}
</td>
<td class="header_right">
<a href="natedit.php?node_id={$node.node_id}"><img src="image.php?icon=edit" alt="{$lang_nat_edit}"></a>
</td>
</tr>
<tr>
<td class="label">
{$lang_nat_rules} ({$natrules|@count})
</td>
<td class="value">
{foreach item=rule from=$natrules}
{if $rule.node_id_int eq $node.node_id}
<img src="images/arrow_left.png" alt="incoming" title="coming from">
<a href="nodeview.php?node_id={$rule.node_id_ext}">{$rule.node_ip_ext}</a>/<a href="assetview.php?asset_id={$rule.asset_id_ext}">{$rule.asset_name_ext}</a> ({$rule.nat_type})<br />
{else}
<img src="images/arrow_right.png" alt="outgoing" title="forwarding to">
<a href="nodeview.php?node_id={$rule.node_id_int}">{$rule.node_ip_int}</a>/<a href="assetview.php?asset_id={$rule.asset_id_int}">{$rule.asset_name_int}</a> ({$rule.nat_type})<br />
{/if}
{/foreach}
</td>
</tr>
</table>