Explorar el Código

The search in the list of all addresses now takes into account the filters set

root hace 8 meses
padre
commit
5ffd7cb91d
Se han modificado 2 ficheros con 20 adiciones y 11 borrados
  1. 2 0
      CHANGELOG.md
  2. 18 11
      html/admin/iplist/index.php

+ 2 - 0
CHANGELOG.md

@@ -1,5 +1,7 @@
 # Changelog 2.8.2 - release
 - html: The default interval is 1 hour for displaying logs and reports.
+- html: The search in the list of all addresses now takes into account the filters set
+- html: The IP address can be written using the russain letter Ю instead of a dot.
 - bugfix: devices with control disabled were configured anyway.
 - bugfix: for router-type devices, the flag for processing user policies and shapers has been removed.
 - api: The get=user function has been added to the api to get user information.

+ 18 - 11
html/admin/iplist/index.php

@@ -45,10 +45,10 @@ if ($dhcp_enabled>0) {
     if ($dhcp_enabled ==2) { $dhcp_filter = ' and User_auth.dhcp=0'; }
     }
 
-if (isset($_POST['ip'])) { $f_ip = normalizeIpAddress(substr(trim($_POST["ip"]), 0, 18)); }
-if (!isset($f_ip) and isset($_SESSION[$page_url]['ip'])) { $f_ip=$_SESSION[$page_url]['ip']; }
-if (!isset($f_ip)) { $f_ip=''; }
-$_SESSION[$page_url]['ip']=$f_ip;
+if (isset($_POST['search_str'])) { $f_search_str = trim($_POST['search_str']); }
+if (!isset($f_search_str) and isset($_SESSION[$page_url]['search_str'])) { $f_search_str=$_SESSION[$page_url]['search_str']; }
+if (!isset($f_search_str)) { $f_search_str=''; }
+$_SESSION[$page_url]['search_str']=$f_search_str;
 
 $ip_list_type_filter='';
 if ($ip_type>0) {
@@ -61,14 +61,21 @@ if ($ip_type>0) {
     }
 
 $ip_where = '';
-if (!empty($f_ip)) {
-    if (checkValidIp($f_ip)) { $ip_where = " and ip_int=inet_aton('" . $f_ip . "') "; }
-    if (empty($ip_where)) { $ip_where =" and (mac like '" . mac_dotted($f_ip) . "%' or login like '".$f_ip."%' or comments like '".$f_ip."%' or dns_name like '".$f_ip."%' or dhcp_hostname like '".$f_ip."%')"; }
-    $ip_list_filter = $ip_where;
-    } else {
-    $ip_list_filter = $ou_filter.$cidr_filter.$enabled_filter.$ip_list_type_filter.$dynamic_filter.$dhcp_filter;
+if (!empty($f_search_str)) {
+    $f_ip = normalizeIpAddress($f_search_str);
+    if (!empty($f_ip)) { 
+        $ip_where = " and ip_int=inet_aton('" . $f_ip . "') ";
+        $f_search_str = $f_ip;
+        } else {
+        if (checkValidMac($f_search_str)) { $ip_where =" and mac='" . mac_dotted($f_search_str) ."'"; }
+            else {
+            $ip_where =" and (mac like '" . mac_dotted($f_search_str) . "%' or login like '".$f_search_str."%' or comments like '".$f_search_str."%' or dns_name like '".$f_search_str."%' or dhcp_hostname like '".$f_search_str."%')"; 
+            }
+        }
     }
 
+$ip_list_filter = $ou_filter.$cidr_filter.$enabled_filter.$ip_list_type_filter.$dynamic_filter.$dhcp_filter.$ip_where;
+
 print_ip_submenu($page_url);
 
 ?>
@@ -107,7 +114,7 @@ print_ip_submenu($page_url);
 </tr>
 <tr>
         <td colspan=2>
-        <?php echo WEB_ips_search_host; ?>:&nbsp<input type="text" name="ip" value="<?php echo $f_ip; ?>"/>
+        <?php echo WEB_ips_search_host; ?>:&nbsp<input type="text" name="search_str" value="<?php echo $f_search_str; ?>"/>
         </td>
         <td>
         <?php print WEB_rows_at_page."&nbsp"; print_row_at_pages('rows',$displayed); ?>