Przeglądaj źródła

web: cosmetic changes

root 1 rok temu
rodzic
commit
d885233ce0
2 zmienionych plików z 56 dodań i 38 usunięć
  1. 32 19
      html/admin/users/edituser.php
  2. 24 19
      html/inc/common.php

+ 32 - 19
html/admin/users/edituser.php

@@ -346,8 +346,8 @@ require_once($_SERVER["DOCUMENT_ROOT"] . "/inc/header.php");
             </tr>
         </table>
 
-        <table class="data">
-            <tr>
+        <table class="data" width=120%>
+            <tr align=center>
                 <td class="data"><input type="checkbox" onClick="checkAll(this.checked);"></td>
                 <td class="data"><?php print $sort_url . "&sort=ip_int&order=$new_order>" . WEB_cell_ip . "</a>"; ?></td>
                 <td class="data"><?php print $sort_url . "&sort=mac&order=$new_order>" . WEB_cell_mac . "</a>"; ?></td>
@@ -358,7 +358,6 @@ require_once($_SERVER["DOCUMENT_ROOT"] . "/inc/header.php");
                 <td class="data"><?php print WEB_cell_filter; ?></td>
                 <td class="data"><?php print WEB_cell_shaper; ?></td>
                 <td class="data"><?php print WEB_cell_perday . "/<br>" . WEB_cell_permonth . ", Mb"; ?></td>
-                <td class="data"><?php print $sort_url . "&sort=last_found&order=$new_order>" . WEB_cell_last_found . "</a>"; ?></td>
                 <td class="data"><?php print WEB_cell_temporary; ?></td>
                 <td class="data"><?php print "<input type=\"submit\" onclick=\"return confirm('" . WEB_msg_apply_selected . "?')\" name=\"removeauth\" value=" . WEB_btn_remove . ">"; ?></td>
             </tr>
@@ -376,29 +375,43 @@ require_once($_SERVER["DOCUMENT_ROOT"] . "/inc/header.php");
                     if ($row["last_found"] == '0000-00-00 00:00:00') {
                         $row["last_found"] = '';
                     }
-                    print "<tr align=center>\n";
-                    print "<td class=\"data\" style='padding:0'><input type=checkbox name=f_auth_id[] value=" . $row["id"] . " ></td>\n";
-                    print "<td class=\"data\" align=left><a href=editauth.php?id=" . $row["id"] . ">" . $row["ip"] . "</a></td>\n";
-                    print "<td class=\"data\" >" . expand_mac($db_link, $row["mac"]) . "</td>\n";
+                    print "<tr align=center>";
+                    print "<td class=\"data\" style='padding:0'><input type=checkbox name=f_auth_id[] value=" . $row["id"] . " ></td>";
+
+                    print "<td class=\"data\" align=left><a href=editauth.php?id=" . $row["id"] . ">" . $row["ip"] . "</a>";
+                    if (!empty($row["arp_found"])) { print "<p class='timestamp'>".FormatDateStr('Y.m.d H:i', $row["arp_found"])."</p>"; }
+                    print "</td>";
+
+                    print "<td class=\"data\" >" . expand_mac($db_link, $row["mac"]);
+                    if (!empty($row["last_found"])) { print "<p class='timestamp'>".FormatDateStr('Y.m.d H:i', $row["last_found"])."</p>"; }
+                    print "</td>";
+
                     if (isset($row["dhcp_hostname"]) and strlen($row["dhcp_hostname"]) > 0) {
-                        print "<td class=\"data\" >" . $row["comments"] . " [" . $row["dhcp_hostname"] . "]</td>\n";
+                        print "<td class=\"data\" >" . $row["comments"] . " [" . $row["dhcp_hostname"] . "]</td>";
                     } else {
-                        print "<td class=\"data\" >" . $row["comments"] . "</td>\n";
+                        print "<td class=\"data\" >" . $row["comments"] . "</td>";
                     }
-                    print "<td class=\"data\" >" . $row["dns_name"] . "</td>\n";
+
+                    print "<td class=\"data\" >" . $row["dns_name"] . "</td>";
                     $ip_status = 1;
                     if ($row["blocked"] or !$row["enabled"]) {
                         $ip_status = 0;
                     }
-                    print "<td class=\"data\" >" . get_qa($ip_status) . "</td>\n";
-                    print "<td class=\"data\" >" . get_qa($row["dhcp"]) . "</td>\n";
-                    print "<td class=\"data\" >" . get_group($db_link, $row["filter_group_id"]) . "</td>\n";
-                    print "<td class=\"data\" >" . get_queue($db_link, $row["queue_id"]) . "</td>\n";
-                    print "<td class=\"data\" >" . $row["day_quota"] . "/" . $row["month_quota"] . "</td>\n";
-                    print "<td class=\"data\" ><div>dhcp:&nbsp$dhcp_str</div><hr><div>arp/mac:&nbsp" . FormatDateStr('Y.m.d H:i', $row["last_found"]) . "</div></td>\n";
-                    print "<td class=\"data\" ><div>".get_qa($row['dynamic'])."</div><hr><div>";
-                    if ($row['dynamic']) { print FormatDateStr('Y.m.d H:i', $row["eof"]); } else { print "&nbsp"; }
-                    print "</div></td>\n";
+
+                    print "<td class=\"data\" >" . get_qa($ip_status) . "</td>";
+
+                    print "<td class=\"data\" >" . get_qa($row["dhcp"]);
+                    if (!empty($dhcp_str)) { print "<p class='timestamp'>".$dhcp_str. "</p>"; }
+                    print "</td>";
+
+                    print "<td class=\"data\" >" . get_group($db_link, $row["filter_group_id"]) . "</td>";
+                    print "<td class=\"data\" >" . get_queue($db_link, $row["queue_id"]) . "</td>";
+                    print "<td class=\"data\" >" . $row["day_quota"] . "/" . $row["month_quota"] . "</td>";
+
+                    print "<td class=\"data\" >".get_qa($row['dynamic']);
+                    if ($row['dynamic'] and !empty($row["eof"])) { print "<p class='timestamp'>".FormatDateStr('Y.m.d H:i', $row["eof"])."</p>"; } else { print "&nbsp"; }
+                    print "</td>";
+
                     print "<td class=\"data\" ></td>";
                     print "</tr>";
                 }

+ 24 - 19
html/inc/common.php

@@ -6,9 +6,9 @@ if (!defined("CONFIG")) {
 require_once($_SERVER['DOCUMENT_ROOT'] . "/inc/consts.php");
 require_once($_SERVER['DOCUMENT_ROOT'] . "/inc/snmp.php");
 
-#ValidIpAddressRegex = "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$";
-#ValidHostnameRegex = "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$";
-#$ValidMacAddressRegex="^([0-9A-Fa-f]{2}[:-]){5}[0-9A-Fa-f]{2}|([0-9a-fA-F]{4}[\\.-][0-9a-fA-F]{4}[\\.-][0-9a-fA-F]{4})|[0-9A-Fa-f]{12}$";
+//ValidIpAddressRegex = "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$";
+//ValidHostnameRegex = "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$";
+//$ValidMacAddressRegex="^([0-9A-Fa-f]{2}[:-]){5}[0-9A-Fa-f]{2}|([0-9a-fA-F]{4}[\\.-][0-9a-fA-F]{4}[\\.-][0-9a-fA-F]{4})|[0-9A-Fa-f]{12}$";
 
 
 $config["init"] = 0;
@@ -191,7 +191,7 @@ function searchHostname($db, $id, $hostname)
     $domain_zone = get_option($db, 33);
 
     $a_search_filter = 'SELECT * FROM User_auth WHERE deleted=0 and id !="' . $id . '" and (dns_name ="' . mysqli_real_escape_string($db, $hostname) . '" or dns_name ="' . mysqli_real_escape_string($db, $hostname . '.' . $domain_zone) . '")';
-    #    LOG_DEBUG($db, "A search-filter: ".$a_search_filter);
+//        LOG_DEBUG($db, "A search-filter: ".$a_search_filter);
     $a_records = get_records_sql($db, $a_search_filter);
     foreach ($a_records as $a_rec) {
         $result .= 'auth_id:' . $a_rec['id'] . ' ip: ' . $a_rec['ip'] . '; ';
@@ -202,7 +202,7 @@ function searchHostname($db, $id, $hostname)
 
     $result_cname = '';
     $cname_search_filter = 'SELECT * FROM User_auth_alias WHERE auth_id !="' . $id . '" and (alias ="' . mysqli_real_escape_string($db, $hostname) . '" or alias ="' . mysqli_real_escape_string($db, $hostname . '.' . $domain_zone) . '")';
-    #    LOG_DEBUG($db, "CNAME search-filter: ".$cname_search_filter);
+//        LOG_DEBUG($db, "CNAME search-filter: ".$cname_search_filter);
     $a_records = get_records_sql($db, $cname_search_filter);
     foreach ($a_records as $a_rec) {
         $result_cname .= 'auth_id:' . $a_rec['auth_id'] . ';';
@@ -224,7 +224,7 @@ function checkUniqHostname($db, $id, $hostname)
     $domain_zone = get_option($db, 33);
 
     $check_A_filter = 'deleted=0 and id !="' . $id . '" and (dns_name ="' . mysqli_real_escape_string($db, $hostname) . '" or dns_name ="' . mysqli_real_escape_string($db, $hostname . '.' . $domain_zone) . '")';
-    #    LOG_DEBUG($db, "CNAME filter: ".$check_A_filter);
+//        LOG_DEBUG($db, "CNAME filter: ".$check_A_filter);
 
     $count = get_count_records($db, 'User_auth', $check_A_filter);
     if ($count > 0) {
@@ -233,7 +233,7 @@ function checkUniqHostname($db, $id, $hostname)
 
     $check_CNAME_filter = 'auth_id !="' . $id . '" and (alias ="' . mysqli_real_escape_string($db, $hostname) . '" or alias ="' . mysqli_real_escape_string($db, $hostname . '.' . $domain_zone) . '")';
 
-    #    LOG_DEBUG($db, "CNAME filter: ".$check_CNAME_filter);
+//        LOG_DEBUG($db, "CNAME filter: ".$check_CNAME_filter);
 
     $count = get_count_records($db, 'User_auth_alias', $check_CNAME_filter);
     if ($count > 0) {
@@ -453,7 +453,7 @@ function cidrToRange($cidr)
     $range[0] = long2ip($start);
     $range[1] = long2ip($stop);
     $range[2] = $cidr;
-    #dhcp
+    //dhcp
     $dhcp_size = round(($stop - $start) / 2, PHP_ROUND_HALF_UP);
     $dhcp_start = $start + round($dhcp_size / 2, PHP_ROUND_HALF_UP);
     $range[3] = long2ip($dhcp_start);
@@ -2699,7 +2699,12 @@ function expand_mac($db, $msg)
     }
     $mac = mac_dotted($msg);
     $vendor_info = get_vendor($db, $mac);
-    $result = ' <p title="' . $vendor_info . '"><a href=/admin/logs/mac.php?mac=' . $mac . '>' . $mac . '</a></p>';
+    if (!empty($vendor_info)) {
+//        $result = '<p title="' . $vendor_info . '"><a href=/admin/logs/mac.php?mac=' . $mac . '>' . $mac . '</a></p>';
+        $result = '<a href=/admin/logs/mac.php?mac=' . $mac . '><p title="' . $vendor_info . '">'. $mac . '</p></a>';
+        } else {
+        $result = '<a href=/admin/logs/mac.php?mac=' . $mac . '>' . $mac . '</a>';
+        }
     return $result;
 }
 
@@ -2722,8 +2727,8 @@ function expand_log_str($db, $msg)
     if (isset($matches[1])) {
         $mac = $matches[1];
         $mac = mac_dotted($mac);
-        #        $vendor_info = get_vendor($db,$mac);
-        #        $mac_replace = ' <p title="'.$vendor_info.'"><a href=/admin/logs/mac.php?mac='.$mac.'>'.$mac.'</a></p>';
+        //        $vendor_info = get_vendor($db,$mac);
+        //        $mac_replace = ' <p title="'.$vendor_info.'"><a href=/admin/logs/mac.php?mac='.$mac.'>'.$mac.'</a></p>';
         $mac_replace = ' <a href=/admin/logs/mac.php?mac=' . $mac . '>' . $mac . '</a> ';
         $result = preg_replace($mac_pattern, $mac_replace, $result);
     }
@@ -2733,8 +2738,8 @@ function expand_log_str($db, $msg)
     if (isset($matches[1])) {
         $mac = $matches[1];
         $mac = mac_dotted($mac);
-        #        $vendor_info = get_vendor($db,$mac);
-        #        $mac_replace = ' mac: <p title="'.$vendor_info.'"><a href=/admin/logs/mac.php?mac='.$mac.'>'.$mac.'</a></p>';
+        //        $vendor_info = get_vendor($db,$mac);
+        //        $mac_replace = ' mac: <p title="'.$vendor_info.'"><a href=/admin/logs/mac.php?mac='.$mac.'>'.$mac.'</a></p>';
         $mac_replace = ' mac: <a href=/admin/logs/mac.php?mac=' . $mac . '>' . $mac . '</a> ';
         $result = preg_replace($mac_pattern, $mac_replace, $result);
     }
@@ -3526,7 +3531,7 @@ function print_navigation($url, $page, $displayed, $count_records, $total)
     if (preg_match('/\.php\?/', $url)) {
         $v_char = "&";
     }
-    #две назад
+    //две назад
     print "<div align=left class=records >";
     if (($page - 2) > 0) :
         $pagetwoleft = "<a class='first_page_link' href=" . $url . $v_char . "page=" . ($page - 2) . ">" . ($page - 2) . "</a>  ";
@@ -3534,7 +3539,7 @@ function print_navigation($url, $page, $displayed, $count_records, $total)
         $pagetwoleft = null;
     endif;
 
-    #одна назад
+    //одна назад
     if (($page - 1) > 0) :
         $pageoneleft = "<a class='first_page_link' href=" . $url . $v_char . "page=" . ($page - 1) . ">" . ($page - 1) . "</a>  ";
         $pagetemp = ($page - 1);
@@ -3543,14 +3548,14 @@ function print_navigation($url, $page, $displayed, $count_records, $total)
         $pagetemp = null;
     endif;
 
-    #две вперед
+    //две вперед
     if (($page + 2) <= $total) :
         $pagetworight = "  <a class='first_page_link' href=" . $url . $v_char . "page=" . ($page + 2) . ">" . ($page + 2) . "</a>";
     else :
         $pagetworight = null;
     endif;
 
-    #одна вперед
+    //одна вперед
     if (($page + 1) <= $total) :
         $pageoneright = "  <a class='first_page_link' href=" . $url . $v_char . "page=" . ($page + 1) . ">" . ($page + 1) . "</a>";
         $pagetemp2 = ($page + 1);
@@ -3559,14 +3564,14 @@ function print_navigation($url, $page, $displayed, $count_records, $total)
         $pagetemp2 = null;
     endif;
 
-    # в начало
+    // в начало
     if ($page != 1 && $pagetemp != 1 && $pagetemp != 2) :
         $pagerevp = "<a href=" . $url . $v_char . "page=1 class='first_page_link' title='В начало'><<</a> ";
     else :
         $pagerevp = null;
     endif;
 
-    #в конец (последняя)
+    //в конец (последняя)
     if ($page != $total && $pagetemp2 != ($total - 1) && $pagetemp2 != $total) :
         $nextp = " ...  <a href=" . $url . $v_char . "page=" . $total . " class='first_page_link'>$total</a>";
     else :