فهرست منبع

add wikiname for auth

rajven 5 سال پیش
والد
کامیت
76debadbf4

+ 1 - 0
docs/mysql/stat_table_User_auth.sql

@@ -17,6 +17,7 @@ CREATE TABLE `User_auth` (
   `deleted` tinyint(4) NOT NULL DEFAULT 0,
   `comments` text DEFAULT NULL,
   `dns_name` varchar(60) NOT NULL DEFAULT '',
+  `WikiName` VARCHAR(250) DEFAULT NULL;
   `dhcp_acl` text DEFAULT NULL,
   `queue_id` int(11) NOT NULL DEFAULT 0,
   `mac` varchar(20) NOT NULL DEFAULT '',

+ 2 - 0
html/admin/customers/control-options.php

@@ -46,6 +46,8 @@ if (isset($_POST["create"])) {
 
 unset($_POST);
 
+fix_auth_rules($db_link);
+
 require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
 
 print_control_submenu($page_url);

+ 2 - 0
html/admin/customers/control-subnets.php

@@ -115,6 +115,8 @@ if (isset($_POST["s_create"])) {
 
 unset($_POST);
 
+fix_auth_rules($db_link);
+
 require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
 
 print_control_submenu($page_url);

+ 1 - 8
html/admin/users/edit_rules.php

@@ -52,14 +52,7 @@ if (isset($_POST["s_create"])) {
 
 unset($_POST);
 
-global $default_user_id;
-global $hotspot_user_id;
-
-//cleanup hotspot subnet rules
-delete_record($db_link,"auth_rules","user_id=".$default_user_id);
-delete_record($db_link,"auth_rules","user_id=".$hotspot_user_id);
-$t_hotspot = get_records_sql($db_link,"subnets","hotspot=1");
-foreach ($t_hotspot as $row) { delete_record($db_link,"auth_rules","rule='".$row['subnet']."'"); }
+fix_auth_rules($db_link);
 
 require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
 

+ 19 - 13
html/admin/users/editauth.php

@@ -49,6 +49,7 @@ if (isset($_POST["editauth"]) and !$old_auth_info['deleted']) {
             $new['mac'] = mac_dotted($_POST["f_mac"]);
             $new['clientid'] = $_POST["f_clientid"];
             $new['comments'] = $_POST["f_comments"];
+            $new['WikiName'] = $_POST["f_wiki"];
             $f_dnsname=trim($_POST["f_dns_name"]);
             if (!empty($f_dnsname) and checkValidHostname($f_dnsname) and checkUniqHostname($db_link,$id,$f_dnsname)) { $new['dns_name'] = $f_dnsname; }
             if (empty($f_dnsname)) { $new['dns_name'] = ''; }
@@ -172,20 +173,20 @@ print "<b> Адрес доступа пользователя <a href=/admin/use
 <tr>
 <td width=200><?php print $cell_dns_name." &nbsp | &nbsp "; print_url("Альясы","/admin/users/edit_alias.php?id=$id"); ?></td>
 <td width=200><?php print $cell_comment; ?></td>
+<td width=200><?php print $cell_wikiname; ?></td>
 <td width=70><?php print $cell_enabled; ?></td>
 <td width=70><?php print $cell_blocked; ?></td>
 <td width=70><?php print $cell_perday; ?></td>
 <td width=70><?php print $cell_permonth; ?></td>
-<td width=70><?php print $cell_connection; ?></td>
 </tr>
 <tr>
 <td><input type="text" name="f_dns_name" value="<? echo $auth_info['dns_name']; ?>" pattern="^(([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])$"></td>
 <td><input type="text" name="f_comments" value="<? echo $auth_info['comments']; ?>"></td>
+<td><input type="text" name="f_wiki" value="<? echo $auth_info['WikiName']; ?>"></td>
 <td><?php print_qa_select('f_enabled', $auth_info['enabled']); ?></td>
 <td><?php print_qa_select('f_blocked', $auth_info['blocked']); ?></td>
 <td><input type="text" name="f_day_q" value="<? echo $auth_info['day_quota']; ?>" size=5></td>
 <td><input type="text" name="f_month_q"	value="<? echo $auth_info['month_quota']; ?>" size=5></td>
-<td><?php print get_connection($db_link, $id); ?></td>
 </tr>
 <tr>
 <td><?php print $cell_ip; ?></td>
@@ -222,26 +223,30 @@ print "<b> Адрес доступа пользователя <a href=/admin/use
 <td></td>
 </tr>
 <tr>
-<td><?php print "Created: " . $auth_info['timestamp']; ?> </td>
-<td colspan=2><?php print "Dhcp status: " . $dhcp_str; ?></td>
-<td colspan=2><?php print "Dhcp hostname: " . $auth_info['dhcp_hostname']; ?></td>
-<td colspan=2><?php print "Last found: " . $auth_info['last_found']; ?></td>
-<td></td>
-</tr>
-<tr>
 <td colspan=2><input type="submit" name="moveauth" value=<?php print $btn_move; ?>><?php print_login_select($db_link, 'new_parent', $auth_info['user_id']); ?></td>
 <td><a href=/admin/logs/authlog.php?auth_id=<?php print $id; ?>>Лог</a></td>
 <?php
 print "<td>"; print_url("Трафик за день","/admin/reports/authday.php?id=$id"); print "</td>";
 if ($auth_info['deleted']) {
-    print "<td colspan=1>Deleted: " . $auth_info['changed_time']."</td>";
-    print "<td colspan=2 align=right><input type=\"submit\" name=\"recovery\" value=\"Восстановить\"></td>";
+    print "<td colspan=2>Deleted: " . $auth_info['changed_time']."</td>";
+    print "<td colspan=1 align=right><input type=\"submit\" name=\"recovery\" value=\"Восстановить\"></td>";
 } else {
-    print "<td colspan=1></td>";
-    print "<td colspan=2 align=right><input type=\"submit\" name=\"editauth\" value=\"$btn_save\"></td>";
+    print "<td colspan=2></td>";
+    print "<td colspan=1 align=right><input type=\"submit\" name=\"editauth\" value=\"$btn_save\"></td>";
 }
 ?>
 </tr>
+<tr >
+<td  class="data" colspan=7>
+<?php
+print "Created: " . $auth_info['timestamp'];
+print "&nbsp Dhcp: " . $dhcp_str;
+print "&nbsp hostname: " . $auth_info['dhcp_hostname'];
+print "&nbsp Last: " . $auth_info['last_found'];
+print "&nbsp ".get_connection($db_link, $id);
+?>
+</td>
+</tr>
 </table>
 <?
 if ($msg_error) {
@@ -249,6 +254,7 @@ if ($msg_error) {
 }
 ?>
 </form>
+<br>
 <?
 require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php");
 ?>

+ 10 - 0
html/inc/common.php

@@ -1196,6 +1196,16 @@ $set_auth['enabled'] = $user_rec['enabled'];
 update_record($db, "User_auth", "id=$auth_id", $set_auth);
 }
 
+function fix_auth_rules($db) {
+global $default_user_id;
+global $hotspot_user_id;
+//cleanup hotspot subnet rules
+delete_record($db,"auth_rules","user_id=".$default_user_id);
+delete_record($db,"auth_rules","user_id=".$hotspot_user_id);
+$t_hotspot = get_records_sql($db,"subnets","hotspot=1");
+foreach ($t_hotspot as $row) { delete_record($db,"auth_rules","rule='".$row['subnet']."'"); }
+}
+
 function new_auth($db, $ip, $mac, $user_id)
 {
     $ip_aton = ip2long($ip);

+ 1 - 0
html/inc/languages/russian.php

@@ -37,6 +37,7 @@ $cell_ip = "IP";
 $cell_mac = "MAC";
 $cell_clientid = "Client-id";
 $cell_comment = "Комментарий";
+$cell_wikiname = "Wiki Name";
 $cell_filter = "Фильтр";
 $cell_proxy = "Proxy";
 $cell_dhcp = "Dhcp";

+ 1 - 0
updates/20210327/db-patch-mysql-wiki.sql

@@ -0,0 +1 @@
+ALTER TABLE `User_auth` ADD `WikiName` VARCHAR(250) NULL DEFAULT NULL AFTER `dns_name`;