diff --git a/app/admin/nat/edit.php b/app/admin/nat/edit.php index 049ed9ded03b99972774a9bbe2a9f3a8e7ccc46d..f17756d3532979cc307e9c9823cf165770caa2b5 100644 --- a/app/admin/nat/edit.php +++ b/app/admin/nat/edit.php @@ -59,9 +59,9 @@ $custom = $Tools->fetch_custom_fields('nat'); <tr> <th><?php print _('Name'); ?></th> <td> - <input type="text" class="form-control input-sm" name="name" value="<?php print $Tools->strip_xss(@$nat->name); ?>" placeholder='<?php print _('Name'); ?>' <?php print $readonly; ?>> + <input type="text" class="form-control input-sm" name="name" value="<?php print $Tools->strip_xss($nat->name); ?>" placeholder='<?php print _('Name'); ?>' <?php print $readonly; ?>> <input type="hidden" name="csrf_cookie" value="<?php print $csrf; ?>"> - <input type="hidden" name="id" value="<?php print @$nat->id; ?>"> + <input type="hidden" name="id" value="<?php print $nat->id; ?>"> <input type="hidden" name="action" value="<?php print escape_input($_POST['action']); ?>"> </td> <td> @@ -79,7 +79,7 @@ $custom = $Tools->fetch_custom_fields('nat'); <select name="type" class="form-control input-sm input-w-auto" <?php print $readonly; ?>> <?php foreach ($nat_types as $t) { - $selected = @$nat->type==$t ? "selected" : ""; + $selected = $nat->type==$t ? "selected" : ""; print "<option value='$t' $selected>$t NAT</option>"; } ?> @@ -103,7 +103,7 @@ $custom = $Tools->fetch_custom_fields('nat'); <?php if($devices !== false) { foreach ($devices as $d) { - $selected = @$nat->device==$d->id ? "selected" : ""; + $selected = $nat->device==$d->id ? "selected" : ""; print "<option value='$d->id' $selected>$d->hostname</option>"; } } @@ -119,7 +119,7 @@ $custom = $Tools->fetch_custom_fields('nat'); <tr> <th><?php print _('Description'); ?></th> <td colspan="2"> - <textarea class="form-control input-sm" name="description" placeholder='<?php print _('Port'); ?>' <?php print $readonly; ?>><?php print @$nat->description; ?></textarea> + <textarea class="form-control input-sm" name="description" placeholder='<?php print _('Port'); ?>' <?php print $readonly; ?>><?php print $nat->description; ?></textarea> </td> </tr> @@ -133,7 +133,7 @@ $custom = $Tools->fetch_custom_fields('nat'); <select name="policy" class="form-control input-sm input-w-auto" <?php print $readonly; ?>> <?php foreach (["No", "Yes"] as $d) { - $selected = @$nat->policy==$d ? "selected" : ""; + $selected = $nat->policy==$d ? "selected" : ""; print "<option value='$d' $selected>$d</option>"; } ?> @@ -144,12 +144,12 @@ $custom = $Tools->fetch_custom_fields('nat'); </tr> <tr class='port'> - <th><?php print @$nat->type=="source" ? _('Destination address') : _('Source address'); ?></th> + <th><?php print $nat->type=="source" ? _('Destination address') : _('Source address'); ?></th> <td> - <input type="text" class="form-control input-sm" name="policy_dst" value="<?php print @$nat->policy_dst; ?>" placeholder='<?php print _('IP'); ?>' <?php print $readonly; ?>> + <input type="text" class="form-control input-sm" name="policy_dst" value="<?php print $nat->policy_dst; ?>" placeholder='<?php print _('IP'); ?>' <?php print $readonly; ?>> </td> <td> - <span class="text-muted"><?php print @$nat->type=="source" ? _('Destination') : _('Source'); print _(" address for policy NAT"); ?></span> + <span class="text-muted"><?php print $nat->type=="source" ? _('Destination') : _('Source'); print _(" address for policy NAT"); ?></span> </td> </tr> @@ -157,11 +157,11 @@ $custom = $Tools->fetch_custom_fields('nat'); <td colspan="3"><hr></td> </tr> <tr> - <th><?php print @$nat->type=="destination" ? _('Destination objects') : _('Source objects'); ?></th> + <th><?php print $nat->type=="destination" ? _('Destination objects') : _('Source objects'); ?></th> <td class='nat-src'> <?php // print sources - $sources = $Tools->translate_nat_objects_for_display (@$nat->src, @$nat->id, $link); + $sources = $Tools->translate_nat_objects_for_display ($nat->src, $nat->id, $link); // sources if($sources!==false) { print implode("<br>", $sources); @@ -180,7 +180,7 @@ $custom = $Tools->fetch_custom_fields('nat'); <th></th> <td> <?php - print "<hr><a class='btn btn-xs btn-success addNatItem' data-id='@$nat->id' data-type='src'><i class='fa fa-plus'></i></a> "._('Add new object'); + print "<hr><a class='btn btn-xs btn-success addNatItem' data-id='$nat->id' data-type='src'><i class='fa fa-plus'></i></a> "._('Add new object'); ?> </td> <td> @@ -198,7 +198,7 @@ $custom = $Tools->fetch_custom_fields('nat'); <td class='nat-dst'> <?php // print sources - $destinations = $Tools->translate_nat_objects_for_display (@$nat->dst, @$nat->id, $link); + $destinations = $Tools->translate_nat_objects_for_display ($nat->dst, $nat->id, $link); // destinations if($destinations!==false) { print implode("<br>", $destinations); @@ -217,7 +217,7 @@ $custom = $Tools->fetch_custom_fields('nat'); <th></th> <td> <?php - print "<hr><a class='btn btn-xs btn-success addNatItem' data-id='@$nat->id' data-type='dst'><i class='fa fa-plus'></i></a> "._('Add new object'); + print "<hr><a class='btn btn-xs btn-success addNatItem' data-id='$nat->id' data-type='dst'><i class='fa fa-plus'></i></a> "._('Add new object'); ?> </td> <td> @@ -233,7 +233,7 @@ $custom = $Tools->fetch_custom_fields('nat'); <tr class='port'> <th><?php print _('Src Port'); ?></th> <td> - <input type="text" class="form-control input-sm" name="src_port" value="<?php print @$nat->src_port; ?>" placeholder='<?php print _('Port'); ?>' <?php print $readonly; ?>> + <input type="text" class="form-control input-sm" name="src_port" value="<?php print $nat->src_port; ?>" placeholder='<?php print _('Port'); ?>' <?php print $readonly; ?>> </td> <td> <span class="text-muted"><?php print _("Source port"); ?></span> @@ -242,7 +242,7 @@ $custom = $Tools->fetch_custom_fields('nat'); <tr class='port'> <th><?php print _('Dst Port'); ?></th> <td> - <input type="text" class="form-control input-sm" name="dst_port" value="<?php print @$nat->dst_port; ?>" placeholder='<?php print _('Port'); ?>' <?php print $readonly; ?>> + <input type="text" class="form-control input-sm" name="dst_port" value="<?php print $nat->dst_port; ?>" placeholder='<?php print _('Port'); ?>' <?php print $readonly; ?>> </td> <td> <span class="text-muted"><?php print _("Destination port"); ?></span> diff --git a/app/admin/nat/item-add-search.php b/app/admin/nat/item-add-search.php index 8d6348f9000ef2cf5d8c67ff9f507ad023b247ee..8efd8e4447fd77c04644b7b71c9e19c36f73d5b8 100644 --- a/app/admin/nat/item-add-search.php +++ b/app/admin/nat/item-add-search.php @@ -58,7 +58,7 @@ elseif($type == "IPv6") { $search_term_edited = $Tools->reformat_IPv6_for_searc # search addresses $result_addresses = $Tools->search_addresses($search_term, $search_term_edited['high'], $search_term_edited['low'], array()); # search subnets -$result_subnets = $Tools->search_subnets($search_term, $search_term_edited['high'], $search_term_edited['low'], $_REQUEST['ip']. array()); +$result_subnets = $Tools->search_subnets($search_term, $search_term_edited['high'], $search_term_edited['low'], $_REQUEST['ip'], array()); # if some found print if(sizeof($result_addresses)>0 || sizeof($result_subnets)>0) { @@ -67,21 +67,31 @@ if(sizeof($result_addresses)>0 || sizeof($result_subnets)>0) { $html1 = []; $html2 = []; + if(sizeof($result_subnets)>0) { $html1[] = "<h4>Subnets</h4>"; foreach ($result_subnets as $s) { - if(!@in_array($s->id, $nat->src['subnets']) && !@in_array($s->id, $nat->dst['subnets'])) + if(is_array($nat->src['subnets']) && is_array($nat->dst['subnets'])) { + if(!in_array($s->id, $nat->src['subnets']) && !in_array($s->id, $nat->dst['subnets'])) { + $html1[] = "<a class='btn btn-xs btn-success addNatObjectFromSearch' data-id='".$_POST['id']."' data-object-id='$s->id' data-object-type='subnets' data-type='".$_POST['type']."'><i class='fa fa-plus'></i></a> ".$Tools->transform_address($s->subnet, "dotted")."/".$s->mask."<br>"; + } + } $html1[] = "<a class='btn btn-xs btn-success addNatObjectFromSearch' data-id='".$_POST['id']."' data-object-id='$s->id' data-object-type='subnets' data-type='".$_POST['type']."'><i class='fa fa-plus'></i></a> ".$Tools->transform_address($s->subnet, "dotted")."/".$s->mask."<br>"; + } - if(sizeof($html1)==1) { $html1 = array(); } + if(sizeof($html1)==1) { $html1 = []; } } if(sizeof($result_addresses)>0) { $html2[] = "<h4>Addresses</h4>"; foreach ($result_addresses as $a) { - if(!@in_array($a->id, $nat->src['ipaddresses']) && !@in_array($a->id, $nat->dst['ipaddresses'])) + if(is_array($nat->src['ipaddresses']) && is_array($nat->dst['ipaddresses'])) { + if(!in_array($a->id, $nat->src['ipaddresses']) && !in_array($a->id, $nat->dst['ipaddresses'])) { + $html2[] = "<a class='btn btn-xs btn-success addNatObjectFromSearch' data-id='".$_POST['id']."' data-object-id='$a->id' data-object-type='ipaddresses' data-type='".$_POST['type']."'><i class='fa fa-plus'></i></a> ".$Tools->transform_address($a->ip_addr, "dotted")."<br>"; + } + } $html2[] = "<a class='btn btn-xs btn-success addNatObjectFromSearch' data-id='".$_POST['id']."' data-object-id='$a->id' data-object-type='ipaddresses' data-type='".$_POST['type']."'><i class='fa fa-plus'></i></a> ".$Tools->transform_address($a->ip_addr, "dotted")."<br>"; } - if(sizeof($html2)==1) { $html2 = array(); } + if(sizeof($html2)==1) { $html2 = []; } } // print print implode("\n", $html1); diff --git a/app/subnets/subnet-details/subnet-nat.php b/app/subnets/subnet-details/subnet-nat.php index 51c4a3cbd89197207c7c70f33d447b032221994d..44eadf0010b9edeb226ca3e17128eacc38adb087 100644 --- a/app/subnets/subnet-details/subnet-nat.php +++ b/app/subnets/subnet-details/subnet-nat.php @@ -21,10 +21,12 @@ print " <ul class='dropdown-menu'>"; $m=0; foreach ($all_nats as $n) { // not own - if(!@in_array( $n->id, $all_nats_per_object['subnets'][$subnet['id']] )) { - if($n->type=="source") { - print "<li><a href='' class='mapNat' data-action='edit' data-id='$n->id' data-object-type='subnets' data-object-id='$subnet[id]'>$n->name ($n->type)</a></li>"; - $m++; + if(is_array(@$all_nats_per_object['subnets'][$subnet['id']])) { + if(!@in_array( $n->id, $all_nats_per_object['subnets'][$subnet['id']] )) { + if($n->type=="source") { + print "<li><a href='' class='mapNat' data-action='edit' data-id='$n->id' data-object-type='subnets' data-object-id='$subnet[id]'>$n->name ($n->type)</a></li>"; + $m++; + } } } } diff --git a/misc/CHANGELOG b/misc/CHANGELOG index 77c0f813a9dfb8047ff4368af3daf74ad5078515..a5137526bebbb2c06e4dff00b9056b932bde6c6b 100755 --- a/misc/CHANGELOG +++ b/misc/CHANGELOG @@ -11,6 +11,7 @@ + Fixed php8 constructor fix for radius class (#3985); + Fixed Force mac address update during status update scan (#3791); + Fixed RADIUS authentication fails on 1.6.0 (#3986); + + Fixed cannot add NAT issue (#3993); Enhancements, changes: ----------------------------