Parcourir la source

draft backend

Dmitriev Roman il y a 3 mois
Parent
commit
5ca6913245
86 fichiers modifiés avec 795 ajouts et 747 suppressions
  1. 26 26
      docs/databases/mysql/en/create_db.sql
  2. 73 73
      docs/databases/mysql/en/data.sql
  3. 1 1
      docs/databases/mysql/reset_admin.sql
  4. 26 26
      docs/databases/mysql/ru/create_db.sql
  5. 73 73
      docs/databases/mysql/ru/data.sql
  6. 47 46
      docs/databases/postgres/en/create_db.sql
  7. 16 16
      docs/databases/postgres/en/data.sql
  8. 7 0
      docs/databases/postgres/reset_admin.sql
  9. 46 45
      docs/databases/postgres/ru/create_db.sql
  10. 15 15
      docs/databases/postgres/ru/data.sql
  11. 5 5
      html/admin/customers/building.php
  12. 3 3
      html/admin/customers/control-options.php
  13. 3 3
      html/admin/customers/editcustom.php
  14. 3 3
      html/admin/customers/editsubnet.php
  15. 2 2
      html/admin/customers/index-subnets.php
  16. 2 2
      html/admin/customers/index.php
  17. 1 1
      html/admin/devices/edit_gw_instances.php
  18. 1 1
      html/admin/devices/edit_gw_subnets.php
  19. 4 4
      html/admin/devices/editdevice.php
  20. 3 3
      html/admin/devices/editport.php
  21. 3 3
      html/admin/devices/index-passive.php
  22. 1 1
      html/admin/devices/index.php
  23. 1 1
      html/admin/devices/mactable.php
  24. 2 2
      html/admin/devices/portmactable.php
  25. 2 2
      html/admin/devices/portsbyvlan.php
  26. 1 1
      html/admin/devices/switchport-conn.php
  27. 2 2
      html/admin/devices/switchport.php
  28. 2 2
      html/admin/devices/switchstatus.php
  29. 5 5
      html/admin/filters/editfilter.php
  30. 5 5
      html/admin/filters/editgroup.php
  31. 2 2
      html/admin/filters/groups.php
  32. 5 5
      html/admin/filters/index.php
  33. 4 4
      html/admin/filters/instances.php
  34. 3 3
      html/admin/groups/edit_group.php
  35. 4 4
      html/admin/iplist/auto_rules.php
  36. 14 14
      html/admin/iplist/deleted.php
  37. 5 5
      html/admin/iplist/doubles.php
  38. 4 4
      html/admin/iplist/index.php
  39. 3 3
      html/admin/iplist/nagios.php
  40. 6 6
      html/admin/logs/authlog.php
  41. 4 4
      html/admin/logs/detaillog.php
  42. 2 2
      html/admin/logs/dhcp.php
  43. 6 6
      html/admin/logs/index.php
  44. 2 2
      html/admin/logs/ip.php
  45. 2 2
      html/admin/logs/mac.php
  46. 4 4
      html/admin/logs/syslog.php
  47. 7 7
      html/admin/reports/authday.php
  48. 1 1
      html/admin/reports/index-full.php
  49. 2 2
      html/admin/reports/userday.php
  50. 4 4
      html/admin/reports/userdaydetail.php
  51. 6 6
      html/admin/reports/userdaydetaillog.php
  52. 4 4
      html/admin/reports/wan.php
  53. 3 3
      html/admin/users/edit_alias.php
  54. 3 3
      html/admin/users/edit_rules.php
  55. 14 14
      html/admin/users/editauth.php
  56. 12 12
      html/admin/users/edituser.php
  57. 5 5
      html/api.php
  58. 1 1
      html/inc/auth.utils.php
  59. 56 56
      html/inc/common.php
  60. 5 5
      html/inc/languages/english.php
  61. 3 3
      html/inc/languages/russian.php
  62. 75 45
      html/inc/sql.php
  63. 4 4
      html/public/blocked.php
  64. 2 2
      html/utils/auth_apply.php
  65. 4 4
      html/utils/auth_export.php
  66. 1 1
      scripts/check_dhcp_pool.pl
  67. 1 1
      scripts/eyelib/cmd.pm
  68. 29 29
      scripts/eyelib/common.pm
  69. 17 17
      scripts/eyelib/database.pm
  70. 4 4
      scripts/eyelib/nagios.pm
  71. 8 23
      scripts/fetch_new_arp.pl
  72. 5 5
      scripts/garbage.pl
  73. 3 3
      scripts/gen_nagios_config.pl
  74. 3 3
      scripts/print-dnsmasq.pl
  75. 2 2
      scripts/stat-sync.pl
  76. 12 12
      scripts/sync_mikrotik.pl
  77. 3 3
      scripts/sync_mikrotik_poe_monitor.pl
  78. 12 0
      scripts/updates/3-0-1/migration.msql
  79. 12 0
      scripts/updates/3-0-1/migration.psql
  80. 4 4
      scripts/utils/import/import_auth.pl
  81. 3 3
      scripts/utils/print_cacti_create.pl
  82. 3 3
      scripts/utils/print_cacti_hosts.pl
  83. 1 1
      scripts/utils/reaply_rules.pl
  84. 6 6
      scripts/utils/set_port_descr.pl
  85. 2 2
      scripts/utils/sync_ccd.pl
  86. 2 2
      scripts/utils/win32/sync-dhcpd-netsh.pl

+ 26 - 26
docs/databases/mysql/en/create_db.sql

@@ -12,8 +12,8 @@ USE `stat`;
 CREATE TABLE `acl` (
   `id` int(11) NOT NULL,
   `name` varchar(30) NOT NULL,
-  description_english varchar(250) NOT NULL,
-  description_russian varchar(250) NOT NULL
+  `description_english` varchar(250) NOT NULL,
+  `description_russian` varchar(250) NOT NULL
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
 CREATE TABLE `ad_comp_cache` (
@@ -26,15 +26,15 @@ CREATE TABLE `auth_rules` (
   `id` int(11) NOT NULL,
   `user_id` int(11) DEFAULT NULL,
   `ou_id` int(11) DEFAULT NULL,
-  `type` int(11) NOT NULL,
+  `rule_type` int(11) NOT NULL,
   `rule` varchar(40) DEFAULT NULL,
-  `comment` varchar(250) DEFAULT NULL
+  `description` varchar(250) DEFAULT NULL
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
 CREATE TABLE `building` (
   `id` int(11) NOT NULL,
   `name` varchar(50) NOT NULL,
-  `comment` varchar(250) DEFAULT NULL
+  `description` varchar(250) DEFAULT NULL
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
 CREATE TABLE `config` (
@@ -46,11 +46,11 @@ CREATE TABLE `config` (
 CREATE TABLE `config_options` (
   `id` int(11) NOT NULL,
   `option_name` varchar(50) NOT NULL,
-  description_russian text DEFAULT NULL,
-  description_english text DEFAULT NULL,
+  `description_russian` text DEFAULT NULL,
+  `description_english` text DEFAULT NULL,
   `draft` tinyint(1) NOT NULL DEFAULT 0,
   `uniq` tinyint(1) NOT NULL DEFAULT 1,
-  `type` varchar(100) NOT NULL,
+  `option_type` varchar(100) NOT NULL,
   `default_value` varchar(250) DEFAULT NULL,
   `min_value` int(11) NOT NULL DEFAULT 0,
   `max_value` int(11) NOT NULL DEFAULT 0
@@ -67,7 +67,7 @@ CREATE TABLE `connections` (
 CREATE TABLE `customers` (
   `id` int(11) NOT NULL,
   `Login` varchar(20) DEFAULT 'NULL',
-  `comment` varchar(100) DEFAULT NULL,
+  `description` varchar(100) DEFAULT NULL,
   `password` varchar(255) DEFAULT 'NULL',
   `api_key` varchar(255) DEFAULT NULL,
   `rights` tinyint(1) NOT NULL DEFAULT 3
@@ -89,7 +89,7 @@ CREATE TABLE `devices` (
   `control_port` int(11) NOT NULL DEFAULT 23,
   `port_count` int(11) NOT NULL DEFAULT 0,
   `SN` varchar(80) DEFAULT NULL,
-  `comment` varchar(255) DEFAULT NULL,
+  `description` varchar(255) DEFAULT NULL,
   `snmp_version` tinyint(4) NOT NULL DEFAULT 0,
   `snmp3_auth_proto` varchar(10) NOT NULL DEFAULT 'sha512',
   `snmp3_priv_proto` varchar(10) NOT NULL DEFAULT 'aes128',
@@ -145,7 +145,7 @@ CREATE TABLE `device_ports` (
   `port` int(11) DEFAULT NULL,
   `ifName` varchar(40) DEFAULT NULL,
   `port_name` varchar(40) DEFAULT NULL,
-  `comment` varchar(50) DEFAULT NULL,
+  `description` varchar(50) DEFAULT NULL,
   `target_port_id` int(11) NOT NULL DEFAULT 0,
   `auth_id` bigint(20) UNSIGNED DEFAULT NULL,
   `last_mac_count` int(11) DEFAULT 0,
@@ -173,9 +173,9 @@ CREATE TABLE `dhcp_log` (
   `ts` timestamp NOT NULL DEFAULT current_timestamp(),
   `auth_id` bigint(20) UNSIGNED NOT NULL,
   `dhcp_hostname` varchar(250) DEFAULT NULL,
-  circuit_id varchar(255) DEFAULT NULL,
-  remote_id varchar(255) DEFAULT NULL,
-  client_id varchar(250) DEFAULT NULL
+  `circuit_id` varchar(255) DEFAULT NULL,
+  `remote_id` varchar(255) DEFAULT NULL,
+  `client_id` varchar(250) DEFAULT NULL
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci KEY_BLOCK_SIZE=8 ROW_FORMAT=COMPRESSED;
 
 CREATE TABLE `dhcp_queue` (
@@ -199,25 +199,25 @@ CREATE TABLE `dns_queue` (
   `auth_id` int(11) DEFAULT NULL,
   `name_type` varchar(10) NOT NULL DEFAULT 'A',
   `name` varchar(200) DEFAULT NULL,
-  `type` varchar(10) NOT NULL DEFAULT 'add',
+  `operation_type` varchar(10) NOT NULL DEFAULT 'add',
   `value` varchar(100) DEFAULT NULL
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
 CREATE TABLE `filter_instances` (
   `id` int(11) NOT NULL,
   `name` varchar(50) DEFAULT NULL,
-  `comment` varchar(200) DEFAULT NULL
+  `description` varchar(200) DEFAULT NULL
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
 CREATE TABLE `filter_list` (
   `id` int(11) NOT NULL,
   `name` varchar(50) DEFAULT NULL,
-  `comment` varchar(250) DEFAULT NULL,
+  `description` varchar(250) DEFAULT NULL,
   `proto` varchar(10) DEFAULT NULL,
   `dst` text DEFAULT NULL,
   `dstport` varchar(20) DEFAULT NULL,
   `srcport` varchar(20) DEFAULT NULL,
-  `type` int(10) UNSIGNED NOT NULL DEFAULT 0
+  `filter_type` int(10) UNSIGNED NOT NULL DEFAULT 0
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
 CREATE TABLE `gateway_subnets` (
@@ -238,7 +238,7 @@ CREATE TABLE `group_list` (
   `id` int(11) NOT NULL,
   `instance_id` int(11) NOT NULL DEFAULT 1,
   `group_name` varchar(50) DEFAULT NULL,
-  `comment` varchar(250) DEFAULT NULL
+  `description` varchar(250) DEFAULT NULL
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
 CREATE TABLE `mac_history` (
@@ -262,7 +262,7 @@ CREATE TABLE `mac_vendors` (
 CREATE TABLE `OU` (
   `id` int(11) NOT NULL,
   `ou_name` varchar(40) DEFAULT NULL,
-  `comment` varchar(250) DEFAULT NULL,
+  `description` varchar(250) DEFAULT NULL,
   `default_users` tinyint(1) NOT NULL DEFAULT 0,
   `default_hotspot` tinyint(1) NOT NULL DEFAULT 0,
   `nagios_dir` varchar(255) DEFAULT NULL,
@@ -286,7 +286,7 @@ CREATE TABLE `queue_list` (
 
 CREATE TABLE `remote_syslog` (
   `id` bigint(20) UNSIGNED NOT NULL,
-  `date` timestamp NOT NULL DEFAULT current_timestamp(),
+  `ts` timestamp NOT NULL DEFAULT current_timestamp(),
   `device_id` bigint(20) UNSIGNED NOT NULL,
   `ip` varchar(15) NOT NULL,
   `message` text NOT NULL
@@ -317,7 +317,7 @@ CREATE TABLE `subnets` (
   `dhcp_update_hostname` tinyint(1) NOT NULL DEFAULT 0,
   `discovery` tinyint(1) NOT NULL DEFAULT 1,
   `notify` tinyint(1) NOT NULL DEFAULT 7,
-  `comment` varchar(250) DEFAULT NULL
+  `description` varchar(250) DEFAULT NULL
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
 CREATE TABLE `traffic_detail` (
@@ -353,9 +353,9 @@ CREATE TABLE `user_auth` (
   `dhcp` tinyint(1) NOT NULL DEFAULT 1,
   `filter_group_id` tinyint(1) NOT NULL DEFAULT 0,
   `dynamic` tinyint(1) NOT NULL DEFAULT 0,
-  `eof` datetime DEFAULT NULL,
+  `end_life` datetime DEFAULT NULL,
   `deleted` tinyint(4) NOT NULL DEFAULT 0,
-  `comments` varchar(250) DEFAULT NULL,
+  `description` varchar(250) DEFAULT NULL,
   `dns_name` varchar(253) DEFAULT NULL,
   `dns_ptr_only` tinyint(1) NOT NULL DEFAULT 0,
   `WikiName` varchar(250) DEFAULT NULL,
@@ -368,13 +368,14 @@ CREATE TABLE `user_auth` (
   `dhcp_hostname` varchar(60) DEFAULT NULL,
   `last_found` datetime NOT NULL DEFAULT current_timestamp(),
   `arp_found` datetime DEFAULT NULL,
+  `mac_found` datetime DEFAULT NULL,
   `blocked` tinyint(1) NOT NULL DEFAULT 0,
   `day_quota` int(11) NOT NULL DEFAULT 0,
   `month_quota` int(11) NOT NULL DEFAULT 0,
   `device_model_id` int(11) DEFAULT 87,
   `firmware` varchar(100) DEFAULT NULL,
   `ts` timestamp NOT NULL DEFAULT current_timestamp(),
-  client_id varchar(250) DEFAULT NULL,
+  `client_id` varchar(250) DEFAULT NULL,
   `nagios` tinyint(1) NOT NULL DEFAULT 0,
   `nagios_status` varchar(10) NOT NULL DEFAULT '',
   `nagios_handler` varchar(50) NOT NULL DEFAULT '',
@@ -584,7 +585,6 @@ ALTER TABLE `mac_vendors`
 ALTER TABLE `OU`
   ADD PRIMARY KEY (`id`);
 ALTER TABLE `OU` ADD FULLTEXT KEY `ou_name` (`ou_name`);
-ALTER TABLE `OU` ADD FULLTEXT KEY `ou_name_2` (`ou_name`);
 
 ALTER TABLE `queue_list`
   ADD PRIMARY KEY (`id`),

+ 73 - 73
docs/databases/mysql/en/data.sql

@@ -10,62 +10,62 @@ INSERT INTO `acl` (`id`, `name`, description_english, description_russian) VALUE
 INSERT INTO `acl` (`id`, `name`, description_english, description_russian) VALUES(2, 'Operator', 'Editing parameters that are not related to access rights', 'Редактирование параметров, не связанных с правами доступа');
 INSERT INTO `acl` (`id`, `name`, description_english, description_russian) VALUES(3, 'View only', 'View only', 'Только просмотр');
 
-INSERT INTO `building` (`id`, `name`, `comment`) VALUES(1, 'Earth', 'Somewhere');
+INSERT INTO `building` (`id`, `name`, `description`) VALUES(1, 'Earth', 'Somewhere');
 
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(1, 'KB', 'Еденица измерения трафика - Килобайт (0) или кибибайт (1,default)', 'Traffic measurement unit - Kilobyte (1000b) or kibibyte (1024b,default)', 0, 1, 'bool', '1024', 0, 1);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(3, 'dns server', 'ip-адрес DNS-сервера', 'DNS server ip address', 0, 1, 'text', '127.0.0.1', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(5, 'dhcp server', 'ip-адрес DHCP-сервера', 'ip address of the DHCP server', 0, 1, 'text', '127.0.0.1', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(9, 'default snmp version', 'Версия snmp по умолчанию. В настоящий момент поддерживаются 1 и 2. Поддержка версии 3 в разработке.', 'The default version of snmp. Currently, 1 and 2 are supported. Support for version 3 is in development.', 0, 1, 'int', '2', 1, 3);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(11, 'default snmp community', 'Read snmp community по умолчанию', 'Read snmp community by default', 0, 1, 'text', 'public', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(21, 'admin email', 'E-mail администратора', 'Administrator e-mail', 0, 1, 'text', 'root', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(22, 'add user from netflow', 'Создавать ли новые записи для неизвестных адресов из анализа трафика netflow. Не включать, если netflow снимает данные с маршрутизатора локальной сети', 'Whether to create new records for unknown addresses from netflow traffic analysis. Do not enable if netflow get data from the local network router', 0, 1, 'bool', '0', 0, 1);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(23, 'save traffic detail', 'Сохранять ли детализацию трафика из netflow по ip-адресам пользователей', 'Whether to keep the details of traffic from netflow by ip addresses of users', 0, 1, 'bool', '1', 0, 1);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(26, 'history detail traffic', 'Глубина хранения детализации в сутках. Установка значения больше 3-7 дней приведёт к разрастанию базы данных и увеличит время отображения детализации в интерфейсе администратора', 'Depth of detail storage in days. Setting a value greater than 3-7 days will cause the database to grow and increase the time about to display details in the admin interface', 0, 1, 'int', '3', 1, 7);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(27, 'history dhcp lease', 'Глубина хранения аренды dhcp-сервера', 'Storage depth of the dhcp server lease', 0, 1, 'int', '1', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(28, 'router_login', 'Логин для входа на сетевые устройства по умолчанию', 'Default login for network devices', 0, 1, 'text', 'admin', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(29, 'router_password', 'Пароль по умолчанию на сетевые устройства', 'Default password for network devices', 0, 1, 'text', 'admin', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(30, 'router_ssh_port', 'Порт ssh по умолчанию', 'SSH default port', 0, 1, 'int', '22', 22, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(32, 'org name', 'Название организации', 'Organization name', 0, 1, 'text', 'ORG', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(33, 'office domain', 'Домен организации', 'Organization domain', 0, 1, 'text', 'local', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(34, 'debug', 'Включить отладку', 'Enable debugging', 0, 1, 'bool', '0', 0, 1);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(35, 'connections history, days', 'Время хранения истории мест подключения ip-адресов', 'Storage time of the history of connection locations of ip addresses', 0, 1, 'int', '90', 1, 365);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(37, 'refresh access lists', 'Расположение скрипта управления контролем доступа для роутеров Mikrotik', 'Location of the access control script for Mikrotik routers', 0, 1, 'text', '/opt/Eye/scripts/sync_mikrotik.pl', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(38, 'regenerate dhcp cconfig', 'Расположение скрипта управления конфигурацией dhcp-серверами', 'Location of the dhcp server configuration management script', 0, 1, 'text', '/opt/Eye/scripts/update-dnsmasq', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(39, 'regenerate dns cconfig', 'Расположение скрипта управления dns-сервером', 'Location of the dns server management script', 0, 1, 'text', '/opt/Eye/scripts/update-dns', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(40, 'regenerate nagios cconfig', 'Расположение скрипта конфигурирования Nagios', 'Location of the Nagios configuration script', 0, 1, 'text', '/etc/nagios/restart_nagios', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(41, 'discovery network', 'Расположение скрипта сканирования сети', 'Location of the network scan script', 0, 1, 'text', '/opt/Eye/scripts/fetch_new_arp.pl', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(44, 'Ignore hotspot dhcp log', 'Не писать лог событий dhcp-сервера хотспота. Имеет смысл вклчючать, поскольку время аренды в хот-споте как правило маленькое и в записях хот-спота становятся незаметны логи обычных пользователей', 'Do not write the event log of the hotspot dhcp server. It makes sense to include it, since the rental time in the hotspot is usually small and the logs of ordinary users become invisible in the hotspot records', 0, 1, 'bool', '1', 0, 1);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(45, 'ignore update dhcp event', 'Не писать события обновления ip-адреса dhcp-сервера. ', 'Do not write events for updating the IP address of the dhcp server. ', 0, 1, 'bool', '0', 0, 1);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(46, 'update hostname from dhcp', 'Обновлять имя хоста в DNS при получении адреса по DHCP', 'Update the hostname in DNS when receiving the address via DHCP', 0, 1, 'bool', '0', 0, 1);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(47, 'history worklog', 'Глубина хранения VERBOSE логов работы в интерфейсе администратора', 'Depth of work VERBOSE logs storage in the admin interface', 0, 1, 'int', '90', 0, 1095);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(48, 'history syslog', 'Глубина хранения логов работы syslog-сервера', 'Syslog server logs storage depth', 0, 1, 'int', '90', 0, 1095);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(49, 'history traffic stats', 'Глубина хранения статистики трафика юзеров', 'User traffic statistics storage depth', 0, 1, 'int', '365', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(50, 'urgent sync access', 'Немедленное изменение списков доступа на роутере после правки записи пользователя', 'Immediate change of access lists on the router after editing the user record ', 0, 1, 'bool', '0', 0, 1);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(51, 'Email_alert', 'Отправлять e-mail уведомления', 'Send e-mail notifications', 0, 1, 'bool', '1', 0, 1);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(52, 'Sender email', 'E-mail адрес, с которого рассылается почта', 'E-mail address from which mail is sent', 0, 1, 'text', 'root', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(53, 'log level', 'Каждый уровень включает в себя предыдущий:\r\n0 - ERROR - писать только ошибки\r\n1 - WARNING - писать предупреждения\r\n2 - INFO - писать информационные сообщения\r\n3 - VERBOSE - писать подробную информацию о выполняемых операциях', 'Each level includes the previous one:\r\n0 - ERROR - write only errors\r\n1 - WARNING - write warnings\r\n2 - INFO - write informational\r\n3 - VERBOSE - write detailed information about the operations performed ', 0, 1, 'int', '2', 0, 3);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(54, 'enable_quotes', 'Включить обработку квот по трафику', 'Enable traffic quota processing', 0, 1, 'bool', '0', 0, 1);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(55, 'netflow_step', 'Интервал сброса данных из коллектора netflow, минуты', 'Data reset interval from netflow collector, minutes', 0, 1, 'int', '1', 1, 10);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(56, 'traffic_ipstat_history', 'Время хранения полной статистики по трафику для каждого ip-адреса в сутках. Таблица в 6 раз больше обычной часовой статистики. Врядли кому-то потребуется глубина хранения более месяца.', 'The storage time of complete traffic statistics for each ip address in days. The table is 6 times larger than the usual hourly statistic Hardly anyone will need a storage depth of more than a month.', 0, 1, 'int', '30', 0, 365);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(57, 'nagios_url', 'Адрес сайта nagios', 'nagios site address', 0, 1, 'text', 'http://127.0.0.1/nagios', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(58, 'cacti_url', 'Адрес сайта cacti', 'cacti site address', 0, 1, 'text', 'http://127.0.0.1/cacti', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(59, 'torrus_url', 'Адрес сайта Torrus', 'Torrus website address', 0, 1, 'text', 'http://127.0.0.1/torrus/CollectorName/', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(60, 'wiki_url', 'Адрес wiki', 'Wiki website address', 0, 1, 'text', 'http://127.0.0.1/wiki', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(61, 'wiki_path', 'Путь к каталогу данных вики', 'Path to wiki data directory', 0, 1, 'text', '/var/www/foswiki/data/', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(62, 'stat_url', 'Адрес этого сайта', 'Address of this site', 0, 1, 'text', 'http://127.0.0.1/stat', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(63, 'wiki_web', 'Web for Wiki. Default - Main. http://example.local/Main/WebHome', 'Web for Wiki. Default - Main. http://example.local/Main/WebHome', 0, 1, 'text', 'Main', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(64, 'auto_mac_rule', 'Создавать автоматическую привязку мак-адреса к юзеру. Т.е. все ip-адреса для найденного мака будут привязываться к одном и тому же юзеру.', 'Create an automatic binding of the mac address to the user. I.e. all ip addresses for the found mac will be bound to the same user.', 0, 1, 'bool', '0', 0, 1);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(65, 'mikrotik_command_interface', 'Используемый способ конфигурирования (0 - cli для ROS 6, 1 - rest api для ROS 7)', 'Configuration method used (0 - cli for ROS 6, 1 - rest api for ROS 7)', 1, 1, 'int', '0', 0, 1);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(66, 'mikrotik_rest_api_ssl', 'Использовать https для rest api', 'Use HTTPS for rest api', 1, 1, 'bool', '1', 0, 1);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(67, 'mikrotik_rest_api_port', 'Порт вэб-интерфейса для rest api', 'Web interface port for rest API', 1, 1, 'int', '443', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(68, 'config_mode', 'Режим конфигурирования. Скрипт опроса устройств не выполняется.', 'Configuration mode. The device polling script is not running.', 0, 1, 'bool', '0', 0, 1);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(69, 'clean_empty_user', 'Автоматически удалять записи пользователей, не содержащие ip-адресов или автоматических привязок', 'Automatically delete user records that do not contain IP addresses or automatic bindings', 0, 1, 'bool', '0', 0, 1);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(70, 'dns_server_type', 'Тип используемого dns-сервера: Windows, Bind. Если используется локальный dnsmasq - параметры dns-сервера указывать не надо.', 'The type of dns server used: Windows, Bind. If you are using a local dnsmasq, you do not need to specify the dns server parameters.', 0, 1, 'list;windows;bind', 'bind', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(71, 'enable_dns_updates', 'Включить обновления DNS имен при изменении dns-имени в ip-записи', 'Enable DNS name updates when dns name changes in an ip record', 0, 1, 'bool', '0', 0, 1);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(72, 'netflow_path', 'Каталог для хранения данных, полученных по netflow от маршрутизаторов', 'The directory for storing data received via netflow from routers', 0, 1, 'text', '/opt/Eye/netflow', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(73, 'check_computer_exists', 'Проверять существование компьютера в домене перед обновлением DNS по DHCP запросу', 'Verify the existence of a computer in the domain before updating DNS by DHCP request', 0, 1, 'bool', '1', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(1, 'KB', 'Еденица измерения трафика - Килобайт (0) или кибибайт (1,default)', 'Traffic measurement unit - Kilobyte (1000b) or kibibyte (1024b,default)', 0, 1, 'bool', '1024', 0, 1);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(3, 'dns server', 'ip-адрес DNS-сервера', 'DNS server ip address', 0, 1, 'text', '127.0.0.1', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(5, 'dhcp server', 'ip-адрес DHCP-сервера', 'ip address of the DHCP server', 0, 1, 'text', '127.0.0.1', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(9, 'default snmp version', 'Версия snmp по умолчанию. В настоящий момент поддерживаются 1 и 2. Поддержка версии 3 в разработке.', 'The default version of snmp. Currently, 1 and 2 are supported. Support for version 3 is in development.', 0, 1, 'int', '2', 1, 3);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(11, 'default snmp community', 'Read snmp community по умолчанию', 'Read snmp community by default', 0, 1, 'text', 'public', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(21, 'admin email', 'E-mail администратора', 'Administrator e-mail', 0, 1, 'text', 'root', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(22, 'add user from netflow', 'Создавать ли новые записи для неизвестных адресов из анализа трафика netflow. Не включать, если netflow снимает данные с маршрутизатора локальной сети', 'Whether to create new records for unknown addresses from netflow traffic analysis. Do not enable if netflow get data from the local network router', 0, 1, 'bool', '0', 0, 1);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(23, 'save traffic detail', 'Сохранять ли детализацию трафика из netflow по ip-адресам пользователей', 'Whether to keep the details of traffic from netflow by ip addresses of users', 0, 1, 'bool', '1', 0, 1);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(26, 'history detail traffic', 'Глубина хранения детализации в сутках. Установка значения больше 3-7 дней приведёт к разрастанию базы данных и увеличит время отображения детализации в интерфейсе администратора', 'Depth of detail storage in days. Setting a value greater than 3-7 days will cause the database to grow and increase the time about to display details in the admin interface', 0, 1, 'int', '3', 1, 7);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(27, 'history dhcp lease', 'Глубина хранения аренды dhcp-сервера', 'Storage depth of the dhcp server lease', 0, 1, 'int', '1', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(28, 'router_login', 'Логин для входа на сетевые устройства по умолчанию', 'Default login for network devices', 0, 1, 'text', 'admin', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(29, 'router_password', 'Пароль по умолчанию на сетевые устройства', 'Default password for network devices', 0, 1, 'text', 'admin', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(30, 'router_ssh_port', 'Порт ssh по умолчанию', 'SSH default port', 0, 1, 'int', '22', 22, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(32, 'org name', 'Название организации', 'Organization name', 0, 1, 'text', 'ORG', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(33, 'office domain', 'Домен организации', 'Organization domain', 0, 1, 'text', 'local', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(34, 'debug', 'Включить отладку', 'Enable debugging', 0, 1, 'bool', '0', 0, 1);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(35, 'connections history, days', 'Время хранения истории мест подключения ip-адресов', 'Storage time of the history of connection locations of ip addresses', 0, 1, 'int', '90', 1, 365);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(37, 'refresh access lists', 'Расположение скрипта управления контролем доступа для роутеров Mikrotik', 'Location of the access control script for Mikrotik routers', 0, 1, 'text', '/opt/Eye/scripts/sync_mikrotik.pl', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(38, 'regenerate dhcp cconfig', 'Расположение скрипта управления конфигурацией dhcp-серверами', 'Location of the dhcp server configuration management script', 0, 1, 'text', '/opt/Eye/scripts/update-dnsmasq', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(39, 'regenerate dns cconfig', 'Расположение скрипта управления dns-сервером', 'Location of the dns server management script', 0, 1, 'text', '/opt/Eye/scripts/update-dns', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(40, 'regenerate nagios cconfig', 'Расположение скрипта конфигурирования Nagios', 'Location of the Nagios configuration script', 0, 1, 'text', '/etc/nagios/restart_nagios', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(41, 'discovery network', 'Расположение скрипта сканирования сети', 'Location of the network scan script', 0, 1, 'text', '/opt/Eye/scripts/fetch_new_arp.pl', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(44, 'Ignore hotspot dhcp log', 'Не писать лог событий dhcp-сервера хотспота. Имеет смысл вклчючать, поскольку время аренды в хот-споте как правило маленькое и в записях хот-спота становятся незаметны логи обычных пользователей', 'Do not write the event log of the hotspot dhcp server. It makes sense to include it, since the rental time in the hotspot is usually small and the logs of ordinary users become invisible in the hotspot records', 0, 1, 'bool', '1', 0, 1);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(45, 'ignore update dhcp event', 'Не писать события обновления ip-адреса dhcp-сервера. ', 'Do not write events for updating the IP address of the dhcp server. ', 0, 1, 'bool', '0', 0, 1);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(46, 'update hostname from dhcp', 'Обновлять имя хоста в DNS при получении адреса по DHCP', 'Update the hostname in DNS when receiving the address via DHCP', 0, 1, 'bool', '0', 0, 1);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(47, 'history worklog', 'Глубина хранения VERBOSE логов работы в интерфейсе администратора', 'Depth of work VERBOSE logs storage in the admin interface', 0, 1, 'int', '90', 0, 1095);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(48, 'history syslog', 'Глубина хранения логов работы syslog-сервера', 'Syslog server logs storage depth', 0, 1, 'int', '90', 0, 1095);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(49, 'history traffic stats', 'Глубина хранения статистики трафика юзеров', 'User traffic statistics storage depth', 0, 1, 'int', '365', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(50, 'urgent sync access', 'Немедленное изменение списков доступа на роутере после правки записи пользователя', 'Immediate change of access lists on the router after editing the user record ', 0, 1, 'bool', '0', 0, 1);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(51, 'Email_alert', 'Отправлять e-mail уведомления', 'Send e-mail notifications', 0, 1, 'bool', '1', 0, 1);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(52, 'Sender email', 'E-mail адрес, с которого рассылается почта', 'E-mail address from which mail is sent', 0, 1, 'text', 'root', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(53, 'log level', 'Каждый уровень включает в себя предыдущий:\r\n0 - ERROR - писать только ошибки\r\n1 - WARNING - писать предупреждения\r\n2 - INFO - писать информационные сообщения\r\n3 - VERBOSE - писать подробную информацию о выполняемых операциях', 'Each level includes the previous one:\r\n0 - ERROR - write only errors\r\n1 - WARNING - write warnings\r\n2 - INFO - write informational\r\n3 - VERBOSE - write detailed information about the operations performed ', 0, 1, 'int', '2', 0, 3);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(54, 'enable_quotes', 'Включить обработку квот по трафику', 'Enable traffic quota processing', 0, 1, 'bool', '0', 0, 1);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(55, 'netflow_step', 'Интервал сброса данных из коллектора netflow, минуты', 'Data reset interval from netflow collector, minutes', 0, 1, 'int', '1', 1, 10);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(56, 'traffic_ipstat_history', 'Время хранения полной статистики по трафику для каждого ip-адреса в сутках. Таблица в 6 раз больше обычной часовой статистики. Врядли кому-то потребуется глубина хранения более месяца.', 'The storage time of complete traffic statistics for each ip address in days. The table is 6 times larger than the usual hourly statistic Hardly anyone will need a storage depth of more than a month.', 0, 1, 'int', '30', 0, 365);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(57, 'nagios_url', 'Адрес сайта nagios', 'nagios site address', 0, 1, 'text', 'http://127.0.0.1/nagios', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(58, 'cacti_url', 'Адрес сайта cacti', 'cacti site address', 0, 1, 'text', 'http://127.0.0.1/cacti', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(59, 'torrus_url', 'Адрес сайта Torrus', 'Torrus website address', 0, 1, 'text', 'http://127.0.0.1/torrus/CollectorName/', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(60, 'wiki_url', 'Адрес wiki', 'Wiki website address', 0, 1, 'text', 'http://127.0.0.1/wiki', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(61, 'wiki_path', 'Путь к каталогу данных вики', 'Path to wiki data directory', 0, 1, 'text', '/var/www/foswiki/data/', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(62, 'stat_url', 'Адрес этого сайта', 'Address of this site', 0, 1, 'text', 'http://127.0.0.1/stat', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(63, 'wiki_web', 'Web for Wiki. Default - Main. http://example.local/Main/WebHome', 'Web for Wiki. Default - Main. http://example.local/Main/WebHome', 0, 1, 'text', 'Main', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(64, 'auto_mac_rule', 'Создавать автоматическую привязку мак-адреса к юзеру. Т.е. все ip-адреса для найденного мака будут привязываться к одном и тому же юзеру.', 'Create an automatic binding of the mac address to the user. I.e. all ip addresses for the found mac will be bound to the same user.', 0, 1, 'bool', '0', 0, 1);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(65, 'mikrotik_command_interface', 'Используемый способ конфигурирования (0 - cli для ROS 6, 1 - rest api для ROS 7)', 'Configuration method used (0 - cli for ROS 6, 1 - rest api for ROS 7)', 1, 1, 'int', '0', 0, 1);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(66, 'mikrotik_rest_api_ssl', 'Использовать https для rest api', 'Use HTTPS for rest api', 1, 1, 'bool', '1', 0, 1);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(67, 'mikrotik_rest_api_port', 'Порт вэб-интерфейса для rest api', 'Web interface port for rest API', 1, 1, 'int', '443', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(68, 'config_mode', 'Режим конфигурирования. Скрипт опроса устройств не выполняется.', 'Configuration mode. The device polling script is not running.', 0, 1, 'bool', '0', 0, 1);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(69, 'clean_empty_user', 'Автоматически удалять записи пользователей, не содержащие ip-адресов или автоматических привязок', 'Automatically delete user records that do not contain IP addresses or automatic bindings', 0, 1, 'bool', '0', 0, 1);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(70, 'dns_server_type', 'Тип используемого dns-сервера: Windows, Bind. Если используется локальный dnsmasq - параметры dns-сервера указывать не надо.', 'The type of dns server used: Windows, Bind. If you are using a local dnsmasq, you do not need to specify the dns server parameters.', 0, 1, 'list;windows;bind', 'bind', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(71, 'enable_dns_updates', 'Включить обновления DNS имен при изменении dns-имени в ip-записи', 'Enable DNS name updates when dns name changes in an ip record', 0, 1, 'bool', '0', 0, 1);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(72, 'netflow_path', 'Каталог для хранения данных, полученных по netflow от маршрутизаторов', 'The directory for storing data received via netflow from routers', 0, 1, 'text', '/opt/Eye/netflow', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(73, 'check_computer_exists', 'Проверять существование компьютера в домене перед обновлением DNS по DHCP запросу', 'Verify the existence of a computer in the domain before updating DNS by DHCP request', 0, 1, 'bool', '1', 0, 0);
 
-INSERT INTO `customers` (`id`, `Login`, `comment`, `password`, `api_key`,`rights`) VALUES (1, 'admin', 'Administrator', '$2y$11$wohV8Tuqu0Yai9Shacei5OKfMxG5bnLxB5ACcZcJJ3pYEbIH0qLGG', 'c3284d0f94606de1fd2af172aba15bf31','1') ON DUPLICATE KEY UPDATE `Login`="admin", `password`="$2y$11$wohV8Tuqu0Yai9Shacei5OKfMxG5bnLxB5ACcZcJJ3pYEbIH0qLGG", `rights`="1";
+INSERT INTO `customers` (`id`, `Login`, `description`, `password`, `api_key`,`rights`) VALUES (1, 'admin', 'Administrator', '$2y$11$wohV8Tuqu0Yai9Shacei5OKfMxG5bnLxB5ACcZcJJ3pYEbIH0qLGG', 'c3284d0f94606de1fd2af172aba15bf31','1') ON DUPLICATE KEY UPDATE `Login`="admin", `password`="$2y$11$wohV8Tuqu0Yai9Shacei5OKfMxG5bnLxB5ACcZcJJ3pYEbIH0qLGG", `rights`="1";
 
 INSERT INTO `device_models` (`id`, `model_name`, `vendor_id`, `poe_in`, `poe_out`, `nagios_template`) VALUES(1, '2011LS', 9, 1, 0, NULL);
 INSERT INTO `device_models` (`id`, `model_name`, `vendor_id`, `poe_in`, `poe_out`, `nagios_template`) VALUES(2, '2011UAS-2HnD', 9, 1, 0, NULL);
@@ -190,26 +190,26 @@ INSERT INTO `device_types` (`id`, name_russian, name_english) VALUES(3, 'Сер
 INSERT INTO `device_types` (`id`, name_russian, name_english) VALUES(4, 'Точка доступа', 'WiFi Access Point');
 INSERT INTO `device_types` (`id`, name_russian, name_english) VALUES(5, 'Сетевое устройство', 'Network device');
 
-INSERT INTO `filter_instances` (`id`, `name`, `comment`) VALUES(1, 'default', NULL);
+INSERT INTO `filter_instances` (`id`, `name`, `description`) VALUES(1, 'default', NULL);
 
-INSERT INTO `group_list` (`id`, `instance_id`, `group_name`, `comment`) VALUES(0, 1, 'default', 'Forbidden all');
-INSERT INTO `group_list` (`id`, `instance_id`, `group_name`, `comment`) VALUES(1, 1, 'Allow all', 'Allowed all');
-INSERT INTO `group_list` (`id`, `instance_id`, `group_name`, `comment`) VALUES(2, 1, 'Users','For users');
+INSERT INTO `group_list` (`id`, `instance_id`, `group_name`, `description`) VALUES(0, 1, 'default', 'Forbidden all');
+INSERT INTO `group_list` (`id`, `instance_id`, `group_name`, `description`) VALUES(1, 1, 'Allow all', 'Allowed all');
+INSERT INTO `group_list` (`id`, `instance_id`, `group_name`, `description`) VALUES(2, 1, 'Users','For users');
 
-INSERT INTO `OU` (`id`, `ou_name`, `comment`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(0, '!Any', NULL, 0, 0, '/etc/nagios/any', 'generic-host', 1, NULL, 0, 0, 0, 0, '24.00', NULL);
-INSERT INTO `OU` (`id`, `ou_name`, `comment`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(1, 'Servers', NULL, 0, 0, NULL, NULL, 1, NULL, 1, 1, 0, 0, '24.00', NULL);
-INSERT INTO `OU` (`id`, `ou_name`, `comment`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(2, 'Administrators', NULL, 0, 0, NULL, NULL, 1, NULL, 0, 0, 0, 0, '24.00', NULL);
-INSERT INTO `OU` (`id`, `ou_name`, `comment`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(3, 'Users', NULL, 0, 0, NULL, NULL, 1, NULL, 0, 0, 0, 0, '24.00', NULL);
-INSERT INTO `OU` (`id`, `ou_name`, `comment`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(4, 'VOIP', NULL, 0, 0, 'voip', 'voip', 1, NULL, 1, 4, 5, 0, '24.00', NULL);
-INSERT INTO `OU` (`id`, `ou_name`, `comment`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(5, 'IPCAM', NULL, 0, 0, 'videocam', 'ip-cam', 1, NULL, 0, 0, 0, 0, '24.00', NULL);
-INSERT INTO `OU` (`id`, `ou_name`, `comment`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(6, 'Printers', NULL, 0, 0, 'printers', 'printers', 1, 'printer-service', 0, 0, 0, 0, '24.00', NULL);
-INSERT INTO `OU` (`id`, `ou_name`, `comment`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(7, 'Switches', NULL, 0, 0, 'switches', 'switches', 1, NULL, 0, 0, 0, 0, '24.00', NULL);
-INSERT INTO `OU` (`id`, `ou_name`, `comment`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(8, 'UPS', NULL, 0, 0, 'ups', 'ups', 1, NULL, 0, 0, 0, 0, '24.00', NULL);
-INSERT INTO `OU` (`id`, `ou_name`, `comment`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(9, 'Security', NULL, 0, 0, 'security', 'security', 1, NULL, 0, 0, 0, 0, '24.00', NULL);
-INSERT INTO `OU` (`id`, `ou_name`, `comment`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(10, 'Routers', NULL, 0, 0, 'routers', 'routers', 1, NULL, 0, 0, 0, 0, '24.00', NULL);
-INSERT INTO `OU` (`id`, `ou_name`, `comment`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(11, 'WiFi AP', NULL, 0, 0, 'ap', 'ap', 1, NULL, 0, 0, 0, 0, '24.00', NULL);
-INSERT INTO `OU` (`id`, `ou_name`, `comment`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(12, 'DHCP', NULL, 1, 0, NULL, NULL, 1, NULL, 0, 0, 0, 0, '24.00', NULL);
-INSERT INTO `OU` (`id`, `ou_name`, `comment`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(13, 'Guests', NULL, 0, 0, NULL, NULL, 1, NULL, 1, 1, 4, 1, '24.00', NULL);
+INSERT INTO `OU` (`id`, `ou_name`, `description`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(0, '!Any', NULL, 0, 0, '/etc/nagios/any', 'generic-host', 1, NULL, 0, 0, 0, 0, '24.00', NULL);
+INSERT INTO `OU` (`id`, `ou_name`, `description`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(1, 'Servers', NULL, 0, 0, NULL, NULL, 1, NULL, 1, 1, 0, 0, '24.00', NULL);
+INSERT INTO `OU` (`id`, `ou_name`, `description`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(2, 'Administrators', NULL, 0, 0, NULL, NULL, 1, NULL, 0, 0, 0, 0, '24.00', NULL);
+INSERT INTO `OU` (`id`, `ou_name`, `description`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(3, 'Users', NULL, 0, 0, NULL, NULL, 1, NULL, 0, 0, 0, 0, '24.00', NULL);
+INSERT INTO `OU` (`id`, `ou_name`, `description`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(4, 'VOIP', NULL, 0, 0, 'voip', 'voip', 1, NULL, 1, 4, 5, 0, '24.00', NULL);
+INSERT INTO `OU` (`id`, `ou_name`, `description`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(5, 'IPCAM', NULL, 0, 0, 'videocam', 'ip-cam', 1, NULL, 0, 0, 0, 0, '24.00', NULL);
+INSERT INTO `OU` (`id`, `ou_name`, `description`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(6, 'Printers', NULL, 0, 0, 'printers', 'printers', 1, 'printer-service', 0, 0, 0, 0, '24.00', NULL);
+INSERT INTO `OU` (`id`, `ou_name`, `description`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(7, 'Switches', NULL, 0, 0, 'switches', 'switches', 1, NULL, 0, 0, 0, 0, '24.00', NULL);
+INSERT INTO `OU` (`id`, `ou_name`, `description`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(8, 'UPS', NULL, 0, 0, 'ups', 'ups', 1, NULL, 0, 0, 0, 0, '24.00', NULL);
+INSERT INTO `OU` (`id`, `ou_name`, `description`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(9, 'Security', NULL, 0, 0, 'security', 'security', 1, NULL, 0, 0, 0, 0, '24.00', NULL);
+INSERT INTO `OU` (`id`, `ou_name`, `description`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(10, 'Routers', NULL, 0, 0, 'routers', 'routers', 1, NULL, 0, 0, 0, 0, '24.00', NULL);
+INSERT INTO `OU` (`id`, `ou_name`, `description`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(11, 'WiFi AP', NULL, 0, 0, 'ap', 'ap', 1, NULL, 0, 0, 0, 0, '24.00', NULL);
+INSERT INTO `OU` (`id`, `ou_name`, `description`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(12, 'DHCP', NULL, 1, 0, NULL, NULL, 1, NULL, 0, 0, 0, 0, '24.00', NULL);
+INSERT INTO `OU` (`id`, `ou_name`, `description`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(13, 'Guests', NULL, 0, 0, NULL, NULL, 1, NULL, 1, 1, 4, 1, '24.00', NULL);
 
 INSERT INTO `queue_list` (`id`, `queue_name`, `Download`, `Upload`) VALUES(0, 'unlimited', 0, 0);
 INSERT INTO `queue_list` (`id`, `queue_name`, `Download`, `Upload`) VALUES(1, '2M/2M', 2048, 2048);
@@ -221,7 +221,7 @@ INSERT INTO `queue_list` (`id`, `queue_name`, `Download`, `Upload`) VALUES(6, '2
 INSERT INTO `queue_list` (`id`, `queue_name`, `Download`, `Upload`) VALUES(7, '1G/1G', 1024000, 1024000);
 INSERT INTO `queue_list` (`id`, `queue_name`, `Download`, `Upload`) VALUES(8, '2G/2G', 2048000, 2048000);
 
-INSERT INTO `subnets` (`id`, `subnet`, `vlan_tag`, `ip_int_start`, `ip_int_stop`, `dhcp_start`, `dhcp_stop`, `dhcp_lease_time`, `gateway`, `office`, `hotspot`, `vpn`, `free`, `dhcp`, `static`, `dhcp_update_hostname`, `discovery`, `notify`, `comment`) VALUES(1, '192.168.2.0/24', 2, 3232236032, 3232236287, 3232236132, 3232236182, 480, 3232236033, 1, 0, 0, 0, 1, 0, 1, 1, 7, 'LAN');
+INSERT INTO `subnets` (`id`, `subnet`, `vlan_tag`, `ip_int_start`, `ip_int_stop`, `dhcp_start`, `dhcp_stop`, `dhcp_lease_time`, `gateway`, `office`, `hotspot`, `vpn`, `free`, `dhcp`, `static`, `dhcp_update_hostname`, `discovery`, `notify`, `description`) VALUES(1, '192.168.2.0/24', 2, 3232236032, 3232236287, 3232236132, 3232236182, 480, 3232236033, 1, 0, 0, 0, 1, 0, 1, 1, 7, 'LAN');
 
 INSERT INTO `vendors` (`id`, `name`) VALUES(1, 'Unknown');
 INSERT INTO `vendors` (`id`, `name`) VALUES(2, 'Eltex');

+ 1 - 1
docs/databases/mysql/reset_admin.sql

@@ -1,3 +1,3 @@
 --- default user: admin
 --- default password admin
-INSERT INTO `Customers` (`id`, `Login`, `password`, `api_key`,`rights`) VALUES (1, 'admin', '$2y$11$wohV8Tuqu0Yai9Shacei5OKfMxG5bnLxB5ACcZcJJ3pYEbIH0qLGG', 'c3284d0f94606de1fd2af172aba15bf31','1') ON DUPLICATE KEY UPDATE Login="admin", password="$2y$11$wohV8Tuqu0Yai9Shacei5OKfMxG5bnLxB5ACcZcJJ3pYEbIH0qLGG";
+INSERT INTO `customers` (`id`, `Login`, `password`, `api_key`,`rights`) VALUES (1, 'admin', '$2y$11$wohV8Tuqu0Yai9Shacei5OKfMxG5bnLxB5ACcZcJJ3pYEbIH0qLGG', 'c3284d0f94606de1fd2af172aba15bf31','1') ON DUPLICATE KEY UPDATE Login="admin", password="$2y$11$wohV8Tuqu0Yai9Shacei5OKfMxG5bnLxB5ACcZcJJ3pYEbIH0qLGG";

+ 26 - 26
docs/databases/mysql/ru/create_db.sql

@@ -12,8 +12,8 @@ USE `stat`;
 CREATE TABLE `acl` (
   `id` int(11) NOT NULL,
   `name` varchar(30) NOT NULL,
-  description_english varchar(250) NOT NULL,
-  description_russian varchar(250) NOT NULL
+  `description_english` varchar(250) NOT NULL,
+  `description_russian` varchar(250) NOT NULL
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
 CREATE TABLE `ad_comp_cache` (
@@ -26,15 +26,15 @@ CREATE TABLE `auth_rules` (
   `id` int(11) NOT NULL,
   `user_id` int(11) DEFAULT NULL,
   `ou_id` int(11) DEFAULT NULL,
-  `type` int(11) NOT NULL,
+  `rule_type` int(11) NOT NULL,
   `rule` varchar(40) DEFAULT NULL,
-  `comment` varchar(250) DEFAULT NULL
+  `description` varchar(250) DEFAULT NULL
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
 CREATE TABLE `building` (
   `id` int(11) NOT NULL,
   `name` varchar(50) NOT NULL,
-  `comment` varchar(250) DEFAULT NULL
+  `description` varchar(250) DEFAULT NULL
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
 CREATE TABLE `config` (
@@ -46,11 +46,11 @@ CREATE TABLE `config` (
 CREATE TABLE `config_options` (
   `id` int(11) NOT NULL,
   `option_name` varchar(50) NOT NULL,
-  description_russian text DEFAULT NULL,
-  description_english text DEFAULT NULL,
+  `description_russian` text DEFAULT NULL,
+  `description_english` text DEFAULT NULL,
   `draft` tinyint(1) NOT NULL DEFAULT 0,
   `uniq` tinyint(1) NOT NULL DEFAULT 1,
-  `type` varchar(100) NOT NULL,
+  `option_type` varchar(100) NOT NULL,
   `default_value` varchar(250) DEFAULT NULL,
   `min_value` int(11) NOT NULL DEFAULT 0,
   `max_value` int(11) NOT NULL DEFAULT 0
@@ -67,7 +67,7 @@ CREATE TABLE `connections` (
 CREATE TABLE `customers` (
   `id` int(11) NOT NULL,
   `Login` varchar(20) DEFAULT 'NULL',
-  `comment` varchar(100) DEFAULT NULL,
+  `description` varchar(100) DEFAULT NULL,
   `password` varchar(255) DEFAULT 'NULL',
   `api_key` varchar(255) DEFAULT NULL,
   `rights` tinyint(1) NOT NULL DEFAULT 3
@@ -89,7 +89,7 @@ CREATE TABLE `devices` (
   `control_port` int(11) NOT NULL DEFAULT 23,
   `port_count` int(11) NOT NULL DEFAULT 0,
   `SN` varchar(80) DEFAULT NULL,
-  `comment` varchar(255) DEFAULT NULL,
+  `description` varchar(255) DEFAULT NULL,
   `snmp_version` tinyint(4) NOT NULL DEFAULT 0,
   `snmp3_auth_proto` varchar(10) NOT NULL DEFAULT 'sha512',
   `snmp3_priv_proto` varchar(10) NOT NULL DEFAULT 'aes128',
@@ -145,7 +145,7 @@ CREATE TABLE `device_ports` (
   `port` int(11) DEFAULT NULL,
   `ifName` varchar(40) DEFAULT NULL,
   `port_name` varchar(40) DEFAULT NULL,
-  `comment` varchar(50) DEFAULT NULL,
+  `description` varchar(50) DEFAULT NULL,
   `target_port_id` int(11) NOT NULL DEFAULT 0,
   `auth_id` bigint(20) UNSIGNED DEFAULT NULL,
   `last_mac_count` int(11) DEFAULT 0,
@@ -173,9 +173,9 @@ CREATE TABLE `dhcp_log` (
   `ts` timestamp NOT NULL DEFAULT current_timestamp(),
   `auth_id` bigint(20) UNSIGNED NOT NULL,
   `dhcp_hostname` varchar(250) DEFAULT NULL,
-  circuit_id varchar(255) DEFAULT NULL,
-  remote_id varchar(255) DEFAULT NULL,
-  client_id varchar(250) DEFAULT NULL
+  `circuit_id` varchar(255) DEFAULT NULL,
+  `remote_id` varchar(255) DEFAULT NULL,
+  `client_id` varchar(250) DEFAULT NULL
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci KEY_BLOCK_SIZE=8 ROW_FORMAT=COMPRESSED;
 
 CREATE TABLE `dhcp_queue` (
@@ -199,25 +199,25 @@ CREATE TABLE `dns_queue` (
   `auth_id` int(11) DEFAULT NULL,
   `name_type` varchar(10) NOT NULL DEFAULT 'A',
   `name` varchar(200) DEFAULT NULL,
-  `type` varchar(10) NOT NULL DEFAULT 'add',
+  `operation_type` varchar(10) NOT NULL DEFAULT 'add',
   `value` varchar(100) DEFAULT NULL
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
 CREATE TABLE `filter_instances` (
   `id` int(11) NOT NULL,
   `name` varchar(50) DEFAULT NULL,
-  `comment` varchar(200) DEFAULT NULL
+  `description` varchar(200) DEFAULT NULL
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
 CREATE TABLE `filter_list` (
   `id` int(11) NOT NULL,
   `name` varchar(50) DEFAULT NULL,
-  `comment` varchar(250) DEFAULT NULL,
+  `description` varchar(250) DEFAULT NULL,
   `proto` varchar(10) DEFAULT NULL,
   `dst` text DEFAULT NULL,
   `dstport` varchar(20) DEFAULT NULL,
   `srcport` varchar(20) DEFAULT NULL,
-  `type` int(10) UNSIGNED NOT NULL DEFAULT 0
+  `filter_type` int(10) UNSIGNED NOT NULL DEFAULT 0
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
 CREATE TABLE `gateway_subnets` (
@@ -238,7 +238,7 @@ CREATE TABLE `group_list` (
   `id` int(11) NOT NULL,
   `instance_id` int(11) NOT NULL DEFAULT 1,
   `group_name` varchar(50) DEFAULT NULL,
-  `comment` varchar(250) DEFAULT NULL
+  `description` varchar(250) DEFAULT NULL
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
 CREATE TABLE `mac_history` (
@@ -262,7 +262,7 @@ CREATE TABLE `mac_vendors` (
 CREATE TABLE `OU` (
   `id` int(11) NOT NULL,
   `ou_name` varchar(40) DEFAULT NULL,
-  `comment` varchar(250) DEFAULT NULL,
+  `description` varchar(250) DEFAULT NULL,
   `default_users` tinyint(1) NOT NULL DEFAULT 0,
   `default_hotspot` tinyint(1) NOT NULL DEFAULT 0,
   `nagios_dir` varchar(255) DEFAULT NULL,
@@ -286,7 +286,7 @@ CREATE TABLE `queue_list` (
 
 CREATE TABLE `remote_syslog` (
   `id` bigint(20) UNSIGNED NOT NULL,
-  `date` timestamp NOT NULL DEFAULT current_timestamp(),
+  `ts` timestamp NOT NULL DEFAULT current_timestamp(),
   `device_id` bigint(20) UNSIGNED NOT NULL,
   `ip` varchar(15) NOT NULL,
   `message` text NOT NULL
@@ -317,7 +317,7 @@ CREATE TABLE `subnets` (
   `dhcp_update_hostname` tinyint(1) NOT NULL DEFAULT 0,
   `discovery` tinyint(1) NOT NULL DEFAULT 1,
   `notify` tinyint(1) NOT NULL DEFAULT 7,
-  `comment` varchar(250) DEFAULT NULL
+  `description` varchar(250) DEFAULT NULL
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
 CREATE TABLE `traffic_detail` (
@@ -353,9 +353,9 @@ CREATE TABLE `user_auth` (
   `dhcp` tinyint(1) NOT NULL DEFAULT 1,
   `filter_group_id` tinyint(1) NOT NULL DEFAULT 0,
   `dynamic` tinyint(1) NOT NULL DEFAULT 0,
-  `eof` datetime DEFAULT NULL,
+  `end_life` datetime DEFAULT NULL,
   `deleted` tinyint(4) NOT NULL DEFAULT 0,
-  `comments` varchar(250) DEFAULT NULL,
+  `description` varchar(250) DEFAULT NULL,
   `dns_name` varchar(253) DEFAULT NULL,
   `dns_ptr_only` tinyint(1) NOT NULL DEFAULT 0,
   `WikiName` varchar(250) DEFAULT NULL,
@@ -368,13 +368,14 @@ CREATE TABLE `user_auth` (
   `dhcp_hostname` varchar(60) DEFAULT NULL,
   `last_found` datetime NOT NULL DEFAULT current_timestamp(),
   `arp_found` datetime DEFAULT NULL,
+  `mac_found` datetime DEFAULT NULL,
   `blocked` tinyint(1) NOT NULL DEFAULT 0,
   `day_quota` int(11) NOT NULL DEFAULT 0,
   `month_quota` int(11) NOT NULL DEFAULT 0,
   `device_model_id` int(11) DEFAULT 87,
   `firmware` varchar(100) DEFAULT NULL,
   `ts` timestamp NOT NULL DEFAULT current_timestamp(),
-  client_id varchar(250) DEFAULT NULL,
+  `client_id` varchar(250) DEFAULT NULL,
   `nagios` tinyint(1) NOT NULL DEFAULT 0,
   `nagios_status` varchar(10) NOT NULL DEFAULT '',
   `nagios_handler` varchar(50) NOT NULL DEFAULT '',
@@ -584,7 +585,6 @@ ALTER TABLE `mac_vendors`
 ALTER TABLE `OU`
   ADD PRIMARY KEY (`id`);
 ALTER TABLE `OU` ADD FULLTEXT KEY `ou_name` (`ou_name`);
-ALTER TABLE `OU` ADD FULLTEXT KEY `ou_name_2` (`ou_name`);
 
 ALTER TABLE `queue_list`
   ADD PRIMARY KEY (`id`),

+ 73 - 73
docs/databases/mysql/ru/data.sql

@@ -10,62 +10,62 @@ INSERT INTO `acl` (`id`, `name`, description_english, description_russian) VALUE
 INSERT INTO `acl` (`id`, `name`, description_english, description_russian) VALUES(2, 'Operator', 'Editing parameters that are not related to access rights', 'Редактирование параметров, не связанных с правами доступа');
 INSERT INTO `acl` (`id`, `name`, description_english, description_russian) VALUES(3, 'View only', 'View only', 'Только просмотр');
 
-INSERT INTO `building` (`id`, `name`, `comment`) VALUES(1, 'Earth', 'Somewhere');
+INSERT INTO `building` (`id`, `name`, `description`) VALUES(1, 'Earth', 'Somewhere');
 
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(1, 'KB', 'Еденица измерения трафика - Килобайт (0) или кибибайт (1,default)', 'Traffic measurement unit - Kilobyte (1000b) or kibibyte (1024b,default)', 0, 1, 'bool', '1024', 0, 1);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(3, 'dns server', 'ip-адрес DNS-сервера', 'DNS server ip address', 0, 1, 'text', '127.0.0.1', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(5, 'dhcp server', 'ip-адрес DHCP-сервера', 'ip address of the DHCP server', 0, 1, 'text', '127.0.0.1', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(9, 'default snmp version', 'Версия snmp по умолчанию. В настоящий момент поддерживаются 1 и 2. Поддержка версии 3 в разработке.', 'The default version of snmp. Currently, 1 and 2 are supported. Support for version 3 is in development.', 0, 1, 'int', '2', 1, 3);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(11, 'default snmp community', 'Read snmp community по умолчанию', 'Read snmp community by default', 0, 1, 'text', 'public', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(21, 'admin email', 'E-mail администратора', 'Administrator e-mail', 0, 1, 'text', 'root', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(22, 'add user from netflow', 'Создавать ли новые записи для неизвестных адресов из анализа трафика netflow. Не включать, если netflow снимает данные с маршрутизатора локальной сети', 'Whether to create new records for unknown addresses from netflow traffic analysis. Do not enable if netflow get data from the local network router', 0, 1, 'bool', '0', 0, 1);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(23, 'save traffic detail', 'Сохранять ли детализацию трафика из netflow по ip-адресам пользователей', 'Whether to keep the details of traffic from netflow by ip addresses of users', 0, 1, 'bool', '1', 0, 1);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(26, 'history detail traffic', 'Глубина хранения детализации в сутках. Установка значения больше 3-7 дней приведёт к разрастанию базы данных и увеличит время отображения детализации в интерфейсе администратора', 'Depth of detail storage in days. Setting a value greater than 3-7 days will cause the database to grow and increase the time about to display details in the admin interface', 0, 1, 'int', '3', 1, 7);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(27, 'history dhcp lease', 'Глубина хранения аренды dhcp-сервера', 'Storage depth of the dhcp server lease', 0, 1, 'int', '1', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(28, 'router_login', 'Логин для входа на сетевые устройства по умолчанию', 'Default login for network devices', 0, 1, 'text', 'admin', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(29, 'router_password', 'Пароль по умолчанию на сетевые устройства', 'Default password for network devices', 0, 1, 'text', 'admin', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(30, 'router_ssh_port', 'Порт ssh по умолчанию', 'SSH default port', 0, 1, 'int', '22', 22, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(32, 'org name', 'Название организации', 'Organization name', 0, 1, 'text', 'ORG', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(33, 'office domain', 'Домен организации', 'Organization domain', 0, 1, 'text', 'local', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(34, 'debug', 'Включить отладку', 'Enable debugging', 0, 1, 'bool', '0', 0, 1);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(35, 'connections history, days', 'Время хранения истории мест подключения ip-адресов', 'Storage time of the history of connection locations of ip addresses', 0, 1, 'int', '90', 1, 365);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(37, 'refresh access lists', 'Расположение скрипта управления контролем доступа для роутеров Mikrotik', 'Location of the access control script for Mikrotik routers', 0, 1, 'text', '/opt/Eye/scripts/sync_mikrotik.pl', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(38, 'regenerate dhcp cconfig', 'Расположение скрипта управления конфигурацией dhcp-серверами', 'Location of the dhcp server configuration management script', 0, 1, 'text', '/opt/Eye/scripts/update-dnsmasq', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(39, 'regenerate dns cconfig', 'Расположение скрипта управления dns-сервером', 'Location of the dns server management script', 0, 1, 'text', '/opt/Eye/scripts/update-dns', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(40, 'regenerate nagios cconfig', 'Расположение скрипта конфигурирования Nagios', 'Location of the Nagios configuration script', 0, 1, 'text', '/etc/nagios/restart_nagios', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(41, 'discovery network', 'Расположение скрипта сканирования сети', 'Location of the network scan script', 0, 1, 'text', '/opt/Eye/scripts/fetch_new_arp.pl', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(44, 'Ignore hotspot dhcp log', 'Не писать лог событий dhcp-сервера хотспота. Имеет смысл вклчючать, поскольку время аренды в хот-споте как правило маленькое и в записях хот-спота становятся незаметны логи обычных пользователей', 'Do not write the event log of the hotspot dhcp server. It makes sense to include it, since the rental time in the hotspot is usually small and the logs of ordinary users become invisible in the hotspot records', 0, 1, 'bool', '1', 0, 1);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(45, 'ignore update dhcp event', 'Не писать события обновления ip-адреса dhcp-сервера. ', 'Do not write events for updating the IP address of the dhcp server. ', 0, 1, 'bool', '0', 0, 1);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(46, 'update hostname from dhcp', 'Обновлять имя хоста в DNS при получении адреса по DHCP', 'Update the hostname in DNS when receiving the address via DHCP', 0, 1, 'bool', '0', 0, 1);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(47, 'history worklog', 'Глубина хранения VERBOSE логов работы в интерфейсе администратора', 'Depth of work VERBOSE logs storage in the admin interface', 0, 1, 'int', '90', 0, 1095);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(48, 'history syslog', 'Глубина хранения логов работы syslog-сервера', 'Syslog server logs storage depth', 0, 1, 'int', '90', 0, 1095);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(49, 'history traffic stats', 'Глубина хранения статистики трафика юзеров', 'User traffic statistics storage depth', 0, 1, 'int', '365', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(50, 'urgent sync access', 'Немедленное изменение списков доступа на роутере после правки записи пользователя', 'Immediate change of access lists on the router after editing the user record ', 0, 1, 'bool', '0', 0, 1);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(51, 'Email_alert', 'Отправлять e-mail уведомления', 'Send e-mail notifications', 0, 1, 'bool', '1', 0, 1);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(52, 'Sender email', 'E-mail адрес, с которого рассылается почта', 'E-mail address from which mail is sent', 0, 1, 'text', 'root', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(53, 'log level', 'Каждый уровень включает в себя предыдущий:\r\n0 - ERROR - писать только ошибки\r\n1 - WARNING - писать предупреждения\r\n2 - INFO - писать информационные сообщения\r\n3 - VERBOSE - писать подробную информацию о выполняемых операциях', 'Each level includes the previous one:\r\n0 - ERROR - write only errors\r\n1 - WARNING - write warnings\r\n2 - INFO - write informational\r\n3 - VERBOSE - write detailed information about the operations performed ', 0, 1, 'int', '2', 0, 3);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(54, 'enable_quotes', 'Включить обработку квот по трафику', 'Enable traffic quota processing', 0, 1, 'bool', '0', 0, 1);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(55, 'netflow_step', 'Интервал сброса данных из коллектора netflow, минуты', 'Data reset interval from netflow collector, minutes', 0, 1, 'int', '1', 1, 10);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(56, 'traffic_ipstat_history', 'Время хранения полной статистики по трафику для каждого ip-адреса в сутках. Таблица в 6 раз больше обычной часовой статистики. Врядли кому-то потребуется глубина хранения более месяца.', 'The storage time of complete traffic statistics for each ip address in days. The table is 6 times larger than the usual hourly statistic Hardly anyone will need a storage depth of more than a month.', 0, 1, 'int', '30', 0, 365);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(57, 'nagios_url', 'Адрес сайта nagios', 'nagios site address', 0, 1, 'text', 'http://127.0.0.1/nagios', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(58, 'cacti_url', 'Адрес сайта cacti', 'cacti site address', 0, 1, 'text', 'http://127.0.0.1/cacti', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(59, 'torrus_url', 'Адрес сайта Torrus', 'Torrus website address', 0, 1, 'text', 'http://127.0.0.1/torrus/CollectorName/', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(60, 'wiki_url', 'Адрес wiki', 'Wiki website address', 0, 1, 'text', 'http://127.0.0.1/wiki', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(61, 'wiki_path', 'Путь к каталогу данных вики', 'Path to wiki data directory', 0, 1, 'text', '/var/www/foswiki/data/', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(62, 'stat_url', 'Адрес этого сайта', 'Address of this site', 0, 1, 'text', 'http://127.0.0.1/stat', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(63, 'wiki_web', 'Web for Wiki. Default - Main. http://example.local/Main/WebHome', 'Web for Wiki. Default - Main. http://example.local/Main/WebHome', 0, 1, 'text', 'Main', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(64, 'auto_mac_rule', 'Создавать автоматическую привязку мак-адреса к юзеру. Т.е. все ip-адреса для найденного мака будут привязываться к одном и тому же юзеру.', 'Create an automatic binding of the mac address to the user. I.e. all ip addresses for the found mac will be bound to the same user.', 0, 1, 'bool', '0', 0, 1);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(65, 'mikrotik_command_interface', 'Используемый способ конфигурирования (0 - cli для ROS 6, 1 - rest api для ROS 7)', 'Configuration method used (0 - cli for ROS 6, 1 - rest api for ROS 7)', 1, 1, 'int', '0', 0, 1);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(66, 'mikrotik_rest_api_ssl', 'Использовать https для rest api', 'Use HTTPS for rest api', 1, 1, 'bool', '1', 0, 1);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(67, 'mikrotik_rest_api_port', 'Порт вэб-интерфейса для rest api', 'Web interface port for rest API', 1, 1, 'int', '443', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(68, 'config_mode', 'Режим конфигурирования. Скрипт опроса устройств не выполняется.', 'Configuration mode. The device polling script is not running.', 0, 1, 'bool', '0', 0, 1);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(69, 'clean_empty_user', 'Автоматически удалять записи пользователей, не содержащие ip-адресов или автоматических привязок', 'Automatically delete user records that do not contain IP addresses or automatic bindings', 0, 1, 'bool', '0', 0, 1);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(70, 'dns_server_type', 'Тип используемого dns-сервера: Windows, Bind. Если используется локальный dnsmasq - параметры dns-сервера указывать не надо.', 'The type of dns server used: Windows, Bind. If you are using a local dnsmasq, you do not need to specify the dns server parameters.', 0, 1, 'list;windows;bind', 'bind', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(71, 'enable_dns_updates', 'Включить обновления DNS имен при изменении dns-имени в ip-записи', 'Enable DNS name updates when dns name changes in an ip record', 0, 1, 'bool', '0', 0, 1);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(72, 'netflow_path', 'Каталог для хранения данных, полученных по netflow от маршрутизаторов', 'The directory for storing data received via netflow from routers', 0, 1, 'text', '/opt/Eye/netflow', 0, 0);
-INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `type`, `default_value`, `min_value`, `max_value`) VALUES(73, 'check_computer_exists', 'Проверять существование компьютера в домене перед обновлением DNS по DHCP запросу', 'Verify the existence of a computer in the domain before updating DNS by DHCP request', 0, 1, 'bool', '1', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(1, 'KB', 'Еденица измерения трафика - Килобайт (0) или кибибайт (1,default)', 'Traffic measurement unit - Kilobyte (1000b) or kibibyte (1024b,default)', 0, 1, 'bool', '1024', 0, 1);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(3, 'dns server', 'ip-адрес DNS-сервера', 'DNS server ip address', 0, 1, 'text', '127.0.0.1', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(5, 'dhcp server', 'ip-адрес DHCP-сервера', 'ip address of the DHCP server', 0, 1, 'text', '127.0.0.1', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(9, 'default snmp version', 'Версия snmp по умолчанию. В настоящий момент поддерживаются 1 и 2. Поддержка версии 3 в разработке.', 'The default version of snmp. Currently, 1 and 2 are supported. Support for version 3 is in development.', 0, 1, 'int', '2', 1, 3);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(11, 'default snmp community', 'Read snmp community по умолчанию', 'Read snmp community by default', 0, 1, 'text', 'public', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(21, 'admin email', 'E-mail администратора', 'Administrator e-mail', 0, 1, 'text', 'root', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(22, 'add user from netflow', 'Создавать ли новые записи для неизвестных адресов из анализа трафика netflow. Не включать, если netflow снимает данные с маршрутизатора локальной сети', 'Whether to create new records for unknown addresses from netflow traffic analysis. Do not enable if netflow get data from the local network router', 0, 1, 'bool', '0', 0, 1);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(23, 'save traffic detail', 'Сохранять ли детализацию трафика из netflow по ip-адресам пользователей', 'Whether to keep the details of traffic from netflow by ip addresses of users', 0, 1, 'bool', '1', 0, 1);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(26, 'history detail traffic', 'Глубина хранения детализации в сутках. Установка значения больше 3-7 дней приведёт к разрастанию базы данных и увеличит время отображения детализации в интерфейсе администратора', 'Depth of detail storage in days. Setting a value greater than 3-7 days will cause the database to grow and increase the time about to display details in the admin interface', 0, 1, 'int', '3', 1, 7);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(27, 'history dhcp lease', 'Глубина хранения аренды dhcp-сервера', 'Storage depth of the dhcp server lease', 0, 1, 'int', '1', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(28, 'router_login', 'Логин для входа на сетевые устройства по умолчанию', 'Default login for network devices', 0, 1, 'text', 'admin', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(29, 'router_password', 'Пароль по умолчанию на сетевые устройства', 'Default password for network devices', 0, 1, 'text', 'admin', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(30, 'router_ssh_port', 'Порт ssh по умолчанию', 'SSH default port', 0, 1, 'int', '22', 22, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(32, 'org name', 'Название организации', 'Organization name', 0, 1, 'text', 'ORG', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(33, 'office domain', 'Домен организации', 'Organization domain', 0, 1, 'text', 'local', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(34, 'debug', 'Включить отладку', 'Enable debugging', 0, 1, 'bool', '0', 0, 1);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(35, 'connections history, days', 'Время хранения истории мест подключения ip-адресов', 'Storage time of the history of connection locations of ip addresses', 0, 1, 'int', '90', 1, 365);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(37, 'refresh access lists', 'Расположение скрипта управления контролем доступа для роутеров Mikrotik', 'Location of the access control script for Mikrotik routers', 0, 1, 'text', '/opt/Eye/scripts/sync_mikrotik.pl', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(38, 'regenerate dhcp cconfig', 'Расположение скрипта управления конфигурацией dhcp-серверами', 'Location of the dhcp server configuration management script', 0, 1, 'text', '/opt/Eye/scripts/update-dnsmasq', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(39, 'regenerate dns cconfig', 'Расположение скрипта управления dns-сервером', 'Location of the dns server management script', 0, 1, 'text', '/opt/Eye/scripts/update-dns', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(40, 'regenerate nagios cconfig', 'Расположение скрипта конфигурирования Nagios', 'Location of the Nagios configuration script', 0, 1, 'text', '/etc/nagios/restart_nagios', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(41, 'discovery network', 'Расположение скрипта сканирования сети', 'Location of the network scan script', 0, 1, 'text', '/opt/Eye/scripts/fetch_new_arp.pl', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(44, 'Ignore hotspot dhcp log', 'Не писать лог событий dhcp-сервера хотспота. Имеет смысл вклчючать, поскольку время аренды в хот-споте как правило маленькое и в записях хот-спота становятся незаметны логи обычных пользователей', 'Do not write the event log of the hotspot dhcp server. It makes sense to include it, since the rental time in the hotspot is usually small and the logs of ordinary users become invisible in the hotspot records', 0, 1, 'bool', '1', 0, 1);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(45, 'ignore update dhcp event', 'Не писать события обновления ip-адреса dhcp-сервера. ', 'Do not write events for updating the IP address of the dhcp server. ', 0, 1, 'bool', '0', 0, 1);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(46, 'update hostname from dhcp', 'Обновлять имя хоста в DNS при получении адреса по DHCP', 'Update the hostname in DNS when receiving the address via DHCP', 0, 1, 'bool', '0', 0, 1);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(47, 'history worklog', 'Глубина хранения VERBOSE логов работы в интерфейсе администратора', 'Depth of work VERBOSE logs storage in the admin interface', 0, 1, 'int', '90', 0, 1095);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(48, 'history syslog', 'Глубина хранения логов работы syslog-сервера', 'Syslog server logs storage depth', 0, 1, 'int', '90', 0, 1095);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(49, 'history traffic stats', 'Глубина хранения статистики трафика юзеров', 'User traffic statistics storage depth', 0, 1, 'int', '365', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(50, 'urgent sync access', 'Немедленное изменение списков доступа на роутере после правки записи пользователя', 'Immediate change of access lists on the router after editing the user record ', 0, 1, 'bool', '0', 0, 1);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(51, 'Email_alert', 'Отправлять e-mail уведомления', 'Send e-mail notifications', 0, 1, 'bool', '1', 0, 1);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(52, 'Sender email', 'E-mail адрес, с которого рассылается почта', 'E-mail address from which mail is sent', 0, 1, 'text', 'root', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(53, 'log level', 'Каждый уровень включает в себя предыдущий:\r\n0 - ERROR - писать только ошибки\r\n1 - WARNING - писать предупреждения\r\n2 - INFO - писать информационные сообщения\r\n3 - VERBOSE - писать подробную информацию о выполняемых операциях', 'Each level includes the previous one:\r\n0 - ERROR - write only errors\r\n1 - WARNING - write warnings\r\n2 - INFO - write informational\r\n3 - VERBOSE - write detailed information about the operations performed ', 0, 1, 'int', '2', 0, 3);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(54, 'enable_quotes', 'Включить обработку квот по трафику', 'Enable traffic quota processing', 0, 1, 'bool', '0', 0, 1);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(55, 'netflow_step', 'Интервал сброса данных из коллектора netflow, минуты', 'Data reset interval from netflow collector, minutes', 0, 1, 'int', '1', 1, 10);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(56, 'traffic_ipstat_history', 'Время хранения полной статистики по трафику для каждого ip-адреса в сутках. Таблица в 6 раз больше обычной часовой статистики. Врядли кому-то потребуется глубина хранения более месяца.', 'The storage time of complete traffic statistics for each ip address in days. The table is 6 times larger than the usual hourly statistic Hardly anyone will need a storage depth of more than a month.', 0, 1, 'int', '30', 0, 365);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(57, 'nagios_url', 'Адрес сайта nagios', 'nagios site address', 0, 1, 'text', 'http://127.0.0.1/nagios', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(58, 'cacti_url', 'Адрес сайта cacti', 'cacti site address', 0, 1, 'text', 'http://127.0.0.1/cacti', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(59, 'torrus_url', 'Адрес сайта Torrus', 'Torrus website address', 0, 1, 'text', 'http://127.0.0.1/torrus/CollectorName/', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(60, 'wiki_url', 'Адрес wiki', 'Wiki website address', 0, 1, 'text', 'http://127.0.0.1/wiki', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(61, 'wiki_path', 'Путь к каталогу данных вики', 'Path to wiki data directory', 0, 1, 'text', '/var/www/foswiki/data/', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(62, 'stat_url', 'Адрес этого сайта', 'Address of this site', 0, 1, 'text', 'http://127.0.0.1/stat', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(63, 'wiki_web', 'Web for Wiki. Default - Main. http://example.local/Main/WebHome', 'Web for Wiki. Default - Main. http://example.local/Main/WebHome', 0, 1, 'text', 'Main', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(64, 'auto_mac_rule', 'Создавать автоматическую привязку мак-адреса к юзеру. Т.е. все ip-адреса для найденного мака будут привязываться к одном и тому же юзеру.', 'Create an automatic binding of the mac address to the user. I.e. all ip addresses for the found mac will be bound to the same user.', 0, 1, 'bool', '0', 0, 1);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(65, 'mikrotik_command_interface', 'Используемый способ конфигурирования (0 - cli для ROS 6, 1 - rest api для ROS 7)', 'Configuration method used (0 - cli for ROS 6, 1 - rest api for ROS 7)', 1, 1, 'int', '0', 0, 1);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(66, 'mikrotik_rest_api_ssl', 'Использовать https для rest api', 'Use HTTPS for rest api', 1, 1, 'bool', '1', 0, 1);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(67, 'mikrotik_rest_api_port', 'Порт вэб-интерфейса для rest api', 'Web interface port for rest API', 1, 1, 'int', '443', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(68, 'config_mode', 'Режим конфигурирования. Скрипт опроса устройств не выполняется.', 'Configuration mode. The device polling script is not running.', 0, 1, 'bool', '0', 0, 1);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(69, 'clean_empty_user', 'Автоматически удалять записи пользователей, не содержащие ip-адресов или автоматических привязок', 'Automatically delete user records that do not contain IP addresses or automatic bindings', 0, 1, 'bool', '0', 0, 1);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(70, 'dns_server_type', 'Тип используемого dns-сервера: Windows, Bind. Если используется локальный dnsmasq - параметры dns-сервера указывать не надо.', 'The type of dns server used: Windows, Bind. If you are using a local dnsmasq, you do not need to specify the dns server parameters.', 0, 1, 'list;windows;bind', 'bind', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(71, 'enable_dns_updates', 'Включить обновления DNS имен при изменении dns-имени в ip-записи', 'Enable DNS name updates when dns name changes in an ip record', 0, 1, 'bool', '0', 0, 1);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(72, 'netflow_path', 'Каталог для хранения данных, полученных по netflow от маршрутизаторов', 'The directory for storing data received via netflow from routers', 0, 1, 'text', '/opt/Eye/netflow', 0, 0);
+INSERT INTO `config_options` (`id`, `option_name`, description_russian, description_english, `draft`, `uniq`, `option_type`, `default_value`, `min_value`, `max_value`) VALUES(73, 'check_computer_exists', 'Проверять существование компьютера в домене перед обновлением DNS по DHCP запросу', 'Verify the existence of a computer in the domain before updating DNS by DHCP request', 0, 1, 'bool', '1', 0, 0);
 
-INSERT INTO `customers` (`id`, `Login`, `comment`, `password`, `api_key`,`rights`) VALUES (1, 'admin', 'Administrator', '$2y$11$wohV8Tuqu0Yai9Shacei5OKfMxG5bnLxB5ACcZcJJ3pYEbIH0qLGG', 'c3284d0f94606de1fd2af172aba15bf31','1') ON DUPLICATE KEY UPDATE `Login`="admin", `password`="$2y$11$wohV8Tuqu0Yai9Shacei5OKfMxG5bnLxB5ACcZcJJ3pYEbIH0qLGG", `rights`="1";
+INSERT INTO `customers` (`id`, `Login`, `description`, `password`, `api_key`,`rights`) VALUES (1, 'admin', 'Administrator', '$2y$11$wohV8Tuqu0Yai9Shacei5OKfMxG5bnLxB5ACcZcJJ3pYEbIH0qLGG', 'c3284d0f94606de1fd2af172aba15bf31','1') ON DUPLICATE KEY UPDATE `Login`="admin", `password`="$2y$11$wohV8Tuqu0Yai9Shacei5OKfMxG5bnLxB5ACcZcJJ3pYEbIH0qLGG", `rights`="1";
 
 INSERT INTO `device_models` (`id`, `model_name`, `vendor_id`, `poe_in`, `poe_out`, `nagios_template`) VALUES(1, '2011LS', 9, 1, 0, NULL);
 INSERT INTO `device_models` (`id`, `model_name`, `vendor_id`, `poe_in`, `poe_out`, `nagios_template`) VALUES(2, '2011UAS-2HnD', 9, 1, 0, NULL);
@@ -190,26 +190,26 @@ INSERT INTO `device_types` (`id`, name_russian, name_english) VALUES(3, 'Сер
 INSERT INTO `device_types` (`id`, name_russian, name_english) VALUES(4, 'Точка доступа', 'WiFi Access Point');
 INSERT INTO `device_types` (`id`, name_russian, name_english) VALUES(5, 'Сетевое устройство', 'Network device');
 
-INSERT INTO `filter_instances` (`id`, `name`, `comment`) VALUES(1, 'default', NULL);
+INSERT INTO `filter_instances` (`id`, `name`, `description`) VALUES(1, 'default', NULL);
 
-INSERT INTO `group_list` (`id`, `instance_id`, `group_name`, `comment`) VALUES(0, 1, 'default', 'Всё запрещено');
-INSERT INTO `group_list` (`id`, `instance_id`, `group_name`, `comment`) VALUES(1, 1, 'Allow all', 'Разрешено всё');
-INSERT INTO `group_list` (`id`, `instance_id`, `group_name`, `comment`) VALUES(2, 1, 'Users','Для пользователей');
+INSERT INTO `group_list` (`id`, `instance_id`, `group_name`, `description`) VALUES(0, 1, 'default', 'Всё запрещено');
+INSERT INTO `group_list` (`id`, `instance_id`, `group_name`, `description`) VALUES(1, 1, 'Allow all', 'Разрешено всё');
+INSERT INTO `group_list` (`id`, `instance_id`, `group_name`, `description`) VALUES(2, 1, 'Users','Для пользователей');
 
-INSERT INTO `OU` (`id`, `ou_name`, `comment`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(0, '!Всё', NULL, 0, 0, '/etc/nagios/any', 'generic-host', 1, NULL, 0, 0, 0, 0, '24.00', NULL);
-INSERT INTO `OU` (`id`, `ou_name`, `comment`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(1, 'Сервера', NULL, 0, 0, NULL, NULL, 1, NULL, 1, 1, 0, 0, '24.00', NULL);
-INSERT INTO `OU` (`id`, `ou_name`, `comment`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(2, 'Администраторы', NULL, 0, 0, NULL, NULL, 1, NULL, 0, 0, 0, 0, '24.00', NULL);
-INSERT INTO `OU` (`id`, `ou_name`, `comment`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(3, 'Пользователи', NULL, 0, 0, NULL, NULL, 1, NULL, 0, 0, 0, 0, '24.00', NULL);
-INSERT INTO `OU` (`id`, `ou_name`, `comment`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(4, 'VOIP', NULL, 0, 0, 'voip', 'voip', 1, NULL, 1, 4, 5, 0, '24.00', NULL);
-INSERT INTO `OU` (`id`, `ou_name`, `comment`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(5, 'IPCAM', NULL, 0, 0, 'videocam', 'ip-cam', 1, NULL, 0, 0, 0, 0, '24.00', NULL);
-INSERT INTO `OU` (`id`, `ou_name`, `comment`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(6, 'Принтеры', NULL, 0, 0, 'printers', 'printers', 1, 'printer-service', 0, 0, 0, 0, '24.00', NULL);
-INSERT INTO `OU` (`id`, `ou_name`, `comment`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(7, 'Свичи', NULL, 0, 0, 'switches', 'switches', 1, NULL, 0, 0, 0, 0, '24.00', NULL);
-INSERT INTO `OU` (`id`, `ou_name`, `comment`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(8, 'UPS', NULL, 0, 0, 'ups', 'ups', 1, NULL, 0, 0, 0, 0, '24.00', NULL);
-INSERT INTO `OU` (`id`, `ou_name`, `comment`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(9, 'Охрана', NULL, 0, 0, 'security', 'security', 1, NULL, 0, 0, 0, 0, '24.00', NULL);
-INSERT INTO `OU` (`id`, `ou_name`, `comment`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(10, 'Роутеры', NULL, 0, 0, 'routers', 'routers', 1, NULL, 0, 0, 0, 0, '24.00', NULL);
-INSERT INTO `OU` (`id`, `ou_name`, `comment`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(11, 'WiFi AP', NULL, 0, 0, 'ap', 'ap', 1, NULL, 0, 0, 0, 0, '24.00', NULL);
-INSERT INTO `OU` (`id`, `ou_name`, `comment`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(12, 'DHCP', NULL, 1, 0, NULL, NULL, 1, NULL, 0, 0, 0, 0, '24.00', NULL);
-INSERT INTO `OU` (`id`, `ou_name`, `comment`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(13, 'Гости', NULL, 0, 0, NULL, NULL, 1, NULL, 1, 1, 4, 1, '24.00', NULL);
+INSERT INTO `OU` (`id`, `ou_name`, `description`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(0, '!Всё', NULL, 0, 0, '/etc/nagios/any', 'generic-host', 1, NULL, 0, 0, 0, 0, '24.00', NULL);
+INSERT INTO `OU` (`id`, `ou_name`, `description`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(1, 'Сервера', NULL, 0, 0, NULL, NULL, 1, NULL, 1, 1, 0, 0, '24.00', NULL);
+INSERT INTO `OU` (`id`, `ou_name`, `description`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(2, 'Администраторы', NULL, 0, 0, NULL, NULL, 1, NULL, 0, 0, 0, 0, '24.00', NULL);
+INSERT INTO `OU` (`id`, `ou_name`, `description`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(3, 'Пользователи', NULL, 0, 0, NULL, NULL, 1, NULL, 0, 0, 0, 0, '24.00', NULL);
+INSERT INTO `OU` (`id`, `ou_name`, `description`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(4, 'VOIP', NULL, 0, 0, 'voip', 'voip', 1, NULL, 1, 4, 5, 0, '24.00', NULL);
+INSERT INTO `OU` (`id`, `ou_name`, `description`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(5, 'IPCAM', NULL, 0, 0, 'videocam', 'ip-cam', 1, NULL, 0, 0, 0, 0, '24.00', NULL);
+INSERT INTO `OU` (`id`, `ou_name`, `description`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(6, 'Принтеры', NULL, 0, 0, 'printers', 'printers', 1, 'printer-service', 0, 0, 0, 0, '24.00', NULL);
+INSERT INTO `OU` (`id`, `ou_name`, `description`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(7, 'Свичи', NULL, 0, 0, 'switches', 'switches', 1, NULL, 0, 0, 0, 0, '24.00', NULL);
+INSERT INTO `OU` (`id`, `ou_name`, `description`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(8, 'UPS', NULL, 0, 0, 'ups', 'ups', 1, NULL, 0, 0, 0, 0, '24.00', NULL);
+INSERT INTO `OU` (`id`, `ou_name`, `description`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(9, 'Охрана', NULL, 0, 0, 'security', 'security', 1, NULL, 0, 0, 0, 0, '24.00', NULL);
+INSERT INTO `OU` (`id`, `ou_name`, `description`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(10, 'Роутеры', NULL, 0, 0, 'routers', 'routers', 1, NULL, 0, 0, 0, 0, '24.00', NULL);
+INSERT INTO `OU` (`id`, `ou_name`, `description`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(11, 'WiFi AP', NULL, 0, 0, 'ap', 'ap', 1, NULL, 0, 0, 0, 0, '24.00', NULL);
+INSERT INTO `OU` (`id`, `ou_name`, `description`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(12, 'DHCP', NULL, 1, 0, NULL, NULL, 1, NULL, 0, 0, 0, 0, '24.00', NULL);
+INSERT INTO `OU` (`id`, `ou_name`, `description`, `default_users`, `default_hotspot`, `nagios_dir`, `nagios_host_use`, `nagios_ping`, `nagios_default_service`, `enabled`, `filter_group_id`, `queue_id`, `dynamic`, `life_duration`, `parent_id`) VALUES(13, 'Гости', NULL, 0, 0, NULL, NULL, 1, NULL, 1, 1, 4, 1, '24.00', NULL);
 
 INSERT INTO `queue_list` (`id`, `queue_name`, `Download`, `Upload`) VALUES(0, 'unlimited', 0, 0);
 INSERT INTO `queue_list` (`id`, `queue_name`, `Download`, `Upload`) VALUES(1, '2M/2M', 2048, 2048);
@@ -221,7 +221,7 @@ INSERT INTO `queue_list` (`id`, `queue_name`, `Download`, `Upload`) VALUES(6, '2
 INSERT INTO `queue_list` (`id`, `queue_name`, `Download`, `Upload`) VALUES(7, '1G/1G', 1024000, 1024000);
 INSERT INTO `queue_list` (`id`, `queue_name`, `Download`, `Upload`) VALUES(8, '2G/2G', 2048000, 2048000);
 
-INSERT INTO `subnets` (`id`, `subnet`, `vlan_tag`, `ip_int_start`, `ip_int_stop`, `dhcp_start`, `dhcp_stop`, `dhcp_lease_time`, `gateway`, `office`, `hotspot`, `vpn`, `free`, `dhcp`, `static`, `dhcp_update_hostname`, `discovery`, `notify`, `comment`) VALUES(1, '192.168.2.0/24', 2, 3232236032, 3232236287, 3232236132, 3232236182, 480, 3232236033, 1, 0, 0, 0, 1, 0, 1, 1, 7, 'LAN');
+INSERT INTO `subnets` (`id`, `subnet`, `vlan_tag`, `ip_int_start`, `ip_int_stop`, `dhcp_start`, `dhcp_stop`, `dhcp_lease_time`, `gateway`, `office`, `hotspot`, `vpn`, `free`, `dhcp`, `static`, `dhcp_update_hostname`, `discovery`, `notify`, `description`) VALUES(1, '192.168.2.0/24', 2, 3232236032, 3232236287, 3232236132, 3232236182, 480, 3232236033, 1, 0, 0, 0, 1, 0, 1, 1, 7, 'LAN');
 
 INSERT INTO `vendors` (`id`, `name`) VALUES(1, 'Unknown');
 INSERT INTO `vendors` (`id`, `name`) VALUES(2, 'Eltex');

+ 47 - 46
docs/databases/postgres/en/create_db.sql

@@ -29,19 +29,19 @@ CREATE TABLE auth_rules (
 id SERIAL PRIMARY KEY,
 user_id INTEGER,
 ou_id INTEGER,
-type SMALLINT NOT NULL,
+rule_type SMALLINT NOT NULL,
 rule VARCHAR(40) UNIQUE,
-comment VARCHAR(250)
+description VARCHAR(250)
 );
 COMMENT ON TABLE auth_rules IS 'User authentication and authorization rules';
-COMMENT ON COLUMN auth_rules.type IS 'Rule type: 0=allow, 1=deny, etc.';
+COMMENT ON COLUMN auth_rules.rule_type IS 'Rule type: 0=allow, 1=deny, etc.';
 COMMENT ON COLUMN auth_rules.rule IS 'Rule identifier (unique)';
 
 -- Buildings
 CREATE TABLE building (
 id SERIAL PRIMARY KEY,
 name VARCHAR(50) NOT NULL,
-comment VARCHAR(250)
+description VARCHAR(250)
 );
 COMMENT ON TABLE building IS 'Physical buildings/locations';
 COMMENT ON COLUMN building.name IS 'Building name';
@@ -62,7 +62,7 @@ description_russian TEXT,
 description_english TEXT,
 draft SMALLINT NOT NULL DEFAULT 0,
 uniq SMALLINT NOT NULL DEFAULT 1,
-type VARCHAR(100) NOT NULL,
+option_type VARCHAR(100) NOT NULL,
 default_value VARCHAR(250),
 min_value INTEGER NOT NULL DEFAULT 0,
 max_value INTEGER NOT NULL DEFAULT 0
@@ -90,7 +90,7 @@ COMMENT ON COLUMN connections.last_found IS 'Last connection activity time';
 CREATE TABLE customers (
 id SERIAL PRIMARY KEY,
 Login VARCHAR(20),
-comment VARCHAR(100),
+description VARCHAR(100),
 password VARCHAR(255),
 api_key VARCHAR(255),
 rights SMALLINT NOT NULL DEFAULT 3
@@ -116,7 +116,7 @@ protocol SMALLINT NOT NULL DEFAULT 0,
 control_port INTEGER NOT NULL DEFAULT 23,
 port_count INTEGER NOT NULL DEFAULT 0,
 SN VARCHAR(80),
-comment VARCHAR(255),
+description VARCHAR(255),
 snmp_version SMALLINT NOT NULL DEFAULT 0,
 snmp3_auth_proto VARCHAR(10) NOT NULL DEFAULT 'sha512',
 snmp3_priv_proto VARCHAR(10) NOT NULL DEFAULT 'aes128',
@@ -188,7 +188,7 @@ snmp_index INTEGER,
 port INTEGER,
 ifName VARCHAR(40),
 port_name VARCHAR(40),
-comment VARCHAR(50),
+description VARCHAR(50),
 target_port_id INTEGER NOT NULL DEFAULT 0,
 auth_id BIGINT,
 last_mac_count INTEGER DEFAULT 0,
@@ -222,7 +222,7 @@ mac MACADDR NOT NULL,
 ip_int BIGINT NOT NULL,
 ip INET NOT NULL,
 action VARCHAR(10) NOT NULL,
-timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
 auth_id BIGINT NOT NULL,
 dhcp_hostname VARCHAR(250),
 circuit_id VARCHAR(255),
@@ -239,7 +239,7 @@ id BIGSERIAL PRIMARY KEY,
 mac MACADDR NOT NULL,
 ip INET NOT NULL,
 action VARCHAR(10) NOT NULL,
-timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
 dhcp_hostname VARCHAR(250)
 );
 COMMENT ON TABLE dhcp_queue IS 'Queue of deferred DHCP operations';
@@ -249,7 +249,7 @@ CREATE TABLE dns_cache (
 id BIGSERIAL PRIMARY KEY,
 dns VARCHAR(250),
 ip BIGINT,
-timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
+ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
 );
 COMMENT ON TABLE dns_cache IS 'DNS resolution cache';
 
@@ -259,18 +259,18 @@ id SERIAL PRIMARY KEY,
 auth_id INTEGER,
 name_type VARCHAR(10) NOT NULL DEFAULT 'A',
 name VARCHAR(200),
-type VARCHAR(10) NOT NULL DEFAULT 'add',
+operation_type VARCHAR(10) NOT NULL DEFAULT 'add',
 value VARCHAR(100)
 );
 COMMENT ON TABLE dns_queue IS 'Queue of deferred DNS operations';
 COMMENT ON COLUMN dns_queue.name_type IS 'DNS record type: A, AAAA, PTR, CNAME';
-COMMENT ON COLUMN dns_queue.type IS 'Operation type: add, delete, update';
+COMMENT ON COLUMN dns_queue.operation_type IS 'Operation type: add, delete, update';
 
 -- Filter instances
 CREATE TABLE filter_instances (
 id SERIAL PRIMARY KEY,
 name VARCHAR(50) UNIQUE,
-comment VARCHAR(200)
+description VARCHAR(200)
 );
 COMMENT ON TABLE filter_instances IS 'Filtering policy instances';
 
@@ -278,17 +278,17 @@ COMMENT ON TABLE filter_instances IS 'Filtering policy instances';
 CREATE TABLE filter_list (
 id SERIAL PRIMARY KEY,
 name VARCHAR(50),
-comment VARCHAR(250),
+description VARCHAR(250),
 proto VARCHAR(10),
 dst TEXT,
 dstport VARCHAR(20),
 srcport VARCHAR(20),
-type SMALLINT NOT NULL DEFAULT 0
+filter_type SMALLINT NOT NULL DEFAULT 0
 );
 COMMENT ON TABLE filter_list IS 'Firewall/filtering rules';
 COMMENT ON COLUMN filter_list.proto IS 'Protocol: tcp, udp, icmp, etc.';
 COMMENT ON COLUMN filter_list.dst IS 'Destination IP/CIDR';
-COMMENT ON COLUMN filter_list.type IS 'Rule type: 0=allow, 1=deny';
+COMMENT ON COLUMN filter_list.filter_type IS 'Rule type: 0=allow, 1=deny';
 
 -- Subnet gateways
 CREATE TABLE gateway_subnets (
@@ -315,7 +315,7 @@ CREATE TABLE group_list (
 id SERIAL PRIMARY KEY,
 instance_id INTEGER NOT NULL DEFAULT 1,
 group_name VARCHAR(50),
-comment VARCHAR(250)
+description VARCHAR(250)
 );
 COMMENT ON TABLE group_list IS 'Filtering policy groups';
 
@@ -323,7 +323,7 @@ COMMENT ON TABLE group_list IS 'Filtering policy groups';
 CREATE TABLE mac_history (
 id BIGSERIAL PRIMARY KEY,
 mac VARCHAR(12),
-timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
 device_id BIGINT,
 port_id BIGINT,
 ip VARCHAR(16) NOT NULL DEFAULT '',
@@ -348,7 +348,7 @@ COMMENT ON COLUMN mac_vendors.oui IS 'Organizationally Unique Identifier (first
 CREATE TABLE OU (
 id SERIAL PRIMARY KEY,
 ou_name VARCHAR(40),
-comment VARCHAR(250),
+description VARCHAR(250),
 default_users SMALLINT NOT NULL DEFAULT 0,
 default_hotspot SMALLINT NOT NULL DEFAULT 0,
 nagios_dir VARCHAR(255),
@@ -380,7 +380,7 @@ COMMENT ON COLUMN queue_list.Upload IS 'Upload speed limit in Kbit/s';
 -- Remote syslog messages
 CREATE TABLE remote_syslog (
 id BIGSERIAL PRIMARY KEY,
-date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
 device_id BIGINT NOT NULL,
 ip VARCHAR(15) NOT NULL,
 message TEXT NOT NULL
@@ -415,7 +415,7 @@ static SMALLINT NOT NULL DEFAULT 0,
 dhcp_update_hostname SMALLINT NOT NULL DEFAULT 0,
 discovery SMALLINT NOT NULL DEFAULT 1,
 notify SMALLINT NOT NULL DEFAULT 7,
-comment VARCHAR(250)
+description VARCHAR(250)
 );
 COMMENT ON TABLE subnets IS 'Network subnet configuration';
 COMMENT ON COLUMN subnets.subnet IS 'Network in CIDR notation';
@@ -429,7 +429,7 @@ CREATE TABLE traffic_detail (
 id BIGSERIAL PRIMARY KEY,
 auth_id BIGINT,
 router_id INTEGER NOT NULL DEFAULT 0,
-timestamp TIMESTAMP,
+ts TIMESTAMP,
 proto SMALLINT,
 src_ip INTEGER NOT NULL,
 dst_ip INTEGER NOT NULL,
@@ -449,7 +449,7 @@ id BIGSERIAL PRIMARY KEY,
 mac VARCHAR(12),
 port_id BIGINT,
 device_id INTEGER,
-timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
+ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
 );
 COMMENT ON TABLE unknown_mac IS 'Recently detected unknown MAC addresses';
 
@@ -465,9 +465,9 @@ enabled SMALLINT NOT NULL DEFAULT 0,
 dhcp SMALLINT NOT NULL DEFAULT 1,
 filter_group_id SMALLINT NOT NULL DEFAULT 0,
 dynamic SMALLINT NOT NULL DEFAULT 0,
-eof TIMESTAMP,
+end_life TIMESTAMP,
 deleted SMALLINT NOT NULL DEFAULT 0,
-comments VARCHAR(250),
+description VARCHAR(250),
 dns_name VARCHAR(253),
 dns_ptr_only SMALLINT NOT NULL DEFAULT 0,
 WikiName VARCHAR(250),
@@ -480,12 +480,13 @@ dhcp_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
 dhcp_hostname VARCHAR(60),
 last_found TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
 arp_found TIMESTAMP,
+mac_found TIMESTAMP,
 blocked SMALLINT NOT NULL DEFAULT 0,
 day_quota INTEGER NOT NULL DEFAULT 0,
 month_quota INTEGER NOT NULL DEFAULT 0,
 device_model_id INTEGER DEFAULT 87,
 firmware VARCHAR(100),
-timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
 client_id VARCHAR(250),
 nagios SMALLINT NOT NULL DEFAULT 0,
 nagios_status VARCHAR(10) NOT NULL DEFAULT '',
@@ -508,14 +509,14 @@ id SERIAL PRIMARY KEY,
 auth_id INTEGER NOT NULL,
 alias VARCHAR(100),
 description VARCHAR(100),
-timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
+ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
 );
 COMMENT ON TABLE user_auth_alias IS 'Aliases/DNS names for authorization records';
 
 -- User list
 CREATE TABLE user_list (
 id BIGSERIAL PRIMARY KEY,
-timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
 login VARCHAR(255),
 fio VARCHAR(255),
 enabled SMALLINT NOT NULL DEFAULT 1,
@@ -551,7 +552,7 @@ CREATE TABLE user_stats (
 id BIGSERIAL PRIMARY KEY,
 router_id BIGINT DEFAULT 0,
 auth_id BIGINT NOT NULL DEFAULT 0,
-timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
 byte_in BIGINT NOT NULL DEFAULT 0,
 byte_out BIGINT NOT NULL DEFAULT 0
 );
@@ -562,7 +563,7 @@ CREATE TABLE user_stats_full (
 id BIGSERIAL PRIMARY KEY,
 router_id BIGINT DEFAULT 0,
 auth_id BIGINT NOT NULL DEFAULT 0,
-timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
 byte_in BIGINT NOT NULL DEFAULT 0,
 byte_out BIGINT NOT NULL DEFAULT 0,
 pkt_in INTEGER,
@@ -614,7 +615,7 @@ COMMENT ON COLUMN wan_stats.bytes_out IS 'Bytes sent from WAN interface';
 -- System activity log
 CREATE TABLE worklog (
 id BIGSERIAL PRIMARY KEY,
-timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
 auth_id BIGINT NOT NULL DEFAULT 0,
 customer VARCHAR(50) NOT NULL DEFAULT 'system',
 ip VARCHAR(18) NOT NULL DEFAULT '127.0.0.1',
@@ -633,25 +634,25 @@ CREATE INDEX idx_device_ports_device_id ON device_ports(device_id);
 CREATE INDEX idx_device_ports_port ON device_ports(port);
 CREATE INDEX idx_device_ports_target_port_id ON device_ports(target_port_id);
 
-CREATE INDEX idx_dhcp_log_timestamp ON dhcp_log(timestamp, action);
-CREATE INDEX idx_dhcp_queue_timestamp ON dhcp_queue(timestamp, action);
+CREATE INDEX idx_dhcp_log_ts ON dhcp_log(ts, action);
+CREATE INDEX idx_dhcp_queue_ts ON dhcp_queue(ts, action);
 
 CREATE INDEX idx_dns_cache_dns ON dns_cache(dns, ip);
-CREATE INDEX idx_dns_cache_timestamp ON dns_cache(timestamp);
+CREATE INDEX idx_dns_cache_ts ON dns_cache(ts);
 
-CREATE INDEX idx_mac_history_mac ON mac_history(mac, timestamp);
-CREATE INDEX idx_mac_history_ip ON mac_history(ip, timestamp);
-CREATE INDEX idx_mac_history_timestamp ON mac_history(timestamp);
+CREATE INDEX idx_mac_history_mac ON mac_history(mac, ts);
+CREATE INDEX idx_mac_history_ip ON mac_history(ip, ts);
+CREATE INDEX idx_mac_history_ts ON mac_history(ts);
 
 CREATE INDEX idx_ou_ou_name_gin ON OU USING GIN(ou_name gin_trgm_ops);
 
 CREATE INDEX idx_subnets_ip_int_start ON subnets(ip_int_start, ip_int_stop);
 CREATE INDEX idx_subnets_dhcp ON subnets(dhcp, office, hotspot, static);
 
-CREATE INDEX idx_traffic_detail_src ON traffic_detail(auth_id, timestamp, router_id, src_ip);
-CREATE INDEX idx_traffic_detail_dst ON traffic_detail(auth_id, timestamp, router_id, dst_ip);
+CREATE INDEX idx_traffic_detail_src ON traffic_detail(auth_id, ts, router_id, src_ip);
+CREATE INDEX idx_traffic_detail_dst ON traffic_detail(auth_id, ts, router_id, dst_ip);
 
-CREATE INDEX idx_unknown_mac_timestamp ON unknown_mac(timestamp, device_id, port_id, mac);
+CREATE INDEX idx_unknown_mac_ts ON unknown_mac(ts, device_id, port_id, mac);
 
 CREATE INDEX idx_user_auth_main ON user_auth(id, user_id, ip_int, mac, ip, deleted);
 CREATE INDEX idx_user_auth_deleted ON user_auth(deleted) WHERE deleted = 0;
@@ -663,11 +664,11 @@ CREATE INDEX idx_user_sessions_session_id ON user_sessions(session_id);
 CREATE INDEX idx_user_sessions_user_id ON user_sessions(user_id);
 CREATE INDEX idx_user_sessions_is_active ON user_sessions(is_active) WHERE is_active = 1;
 
-CREATE INDEX idx_user_stats_timestamp ON user_stats(timestamp, auth_id, router_id);
-CREATE INDEX idx_user_stats_full_timestamp ON user_stats_full(timestamp, auth_id, router_id);
+CREATE INDEX idx_user_stats_ts ON user_stats(ts, auth_id, router_id);
+CREATE INDEX idx_user_stats_full_ts ON user_stats_full(ts, auth_id, router_id);
 
 CREATE INDEX idx_wan_stats_time ON wan_stats(time, router_id, interface_id);
 
-CREATE INDEX idx_worklog_customer ON worklog(customer, level, timestamp);
-CREATE INDEX idx_worklog_timestamp ON worklog(level, timestamp);
-CREATE INDEX idx_worklog_auth_id ON worklog(auth_id, level, timestamp);
+CREATE INDEX idx_worklog_customer ON worklog(customer, level, ts);
+CREATE INDEX idx_worklog_ts ON worklog(level, ts);
+CREATE INDEX idx_worklog_auth_id ON worklog(auth_id, level, ts);

+ 16 - 16
docs/databases/postgres/en/data.sql

@@ -12,14 +12,14 @@ ON CONFLICT (id) DO UPDATE SET
     description_russian = EXCLUDED.description_russian;
 
 -- Buildings
-INSERT INTO building (id, name, comment)
+INSERT INTO building (id, name, description)
 VALUES (1, 'Earth', 'Somewhere')
 ON CONFLICT (id) DO UPDATE SET
     name = EXCLUDED.name,
-    comment = EXCLUDED.comment;
+    description = EXCLUDED.description;
 
 -- Configuration options
-INSERT INTO config_options (id, option_name, description_russian, description_english, draft, uniq, type, default_value, min_value, max_value)
+INSERT INTO config_options (id, option_name, description_russian, description_english, draft, uniq, option_type, default_value, min_value, max_value)
 VALUES
 (1, 'KB', 'Еденица измерения трафика - Килобайт (0) или кибибайт (1,default)', 'Traffic measurement unit - Kilobyte (1000b) or kibibyte (1024b,default)', 0, 1, 'bool', '1024', 0, 1),
 (3, 'dns server', 'ip-адрес DNS-сервера', 'DNS server ip address', 0, 1, 'text', '127.0.0.1', 0, 0),
@@ -122,11 +122,11 @@ ON CONFLICT (id) DO UPDATE SET
     value = EXCLUDED.value;
 
 -- System users/administrators
-INSERT INTO customers (id, Login, comment, password, api_key, rights)
+INSERT INTO customers (id, Login, description, password, api_key, rights)
 VALUES (1, 'admin', 'Administrator', '$2y$11$wohV8Tuqu0Yai9Shacei5OKfMxG5bnLxB5ACcZcJJ3pYEbIH0qLGG', 'c3284d0f94606de1fd2af172aba15bf31', 1)
 ON CONFLICT (id) DO UPDATE SET
     Login = EXCLUDED.Login,
-    comment = EXCLUDED.comment,
+    description = EXCLUDED.description,
     password = EXCLUDED.password,
     api_key = EXCLUDED.api_key,
     rights = EXCLUDED.rights;
@@ -270,14 +270,14 @@ ON CONFLICT (id) DO UPDATE SET
     name_english = EXCLUDED.name_english;
 
 -- Filter instances
-INSERT INTO filter_instances (id, name, comment)
+INSERT INTO filter_instances (id, name, description)
 VALUES (1, 'default', NULL)
 ON CONFLICT (id) DO UPDATE SET
     name = EXCLUDED.name,
-    comment = EXCLUDED.comment;
+    description = EXCLUDED.description;
 
 -- Filter groups
-INSERT INTO group_list (id, instance_id, group_name, comment)
+INSERT INTO group_list (id, instance_id, group_name, description)
 VALUES
 (0, 1, 'default', 'Forbidden all'),
 (1, 1, 'Allow all', 'Allowed all'),
@@ -285,10 +285,10 @@ VALUES
 ON CONFLICT (id) DO UPDATE SET
     instance_id = EXCLUDED.instance_id,
     group_name = EXCLUDED.group_name,
-    comment = EXCLUDED.comment;
+    description = EXCLUDED.description;
 
 -- Organizational Units
-INSERT INTO OU (id, ou_name, comment, default_users, default_hotspot, nagios_dir, nagios_host_use, nagios_ping, nagios_default_service, enabled, filter_group_id, queue_id, dynamic, life_duration, parent_id)
+INSERT INTO OU (id, ou_name, description, default_users, default_hotspot, nagios_dir, nagios_host_use, nagios_ping, nagios_default_service, enabled, filter_group_id, queue_id, dynamic, life_duration, parent_id)
 VALUES
 (0, '!Any', NULL, 0, 0, '/etc/nagios/any', 'generic-host', 1, NULL, 0, 0, 0, 0, 24.00, NULL),
 (1, 'Servers', NULL, 0, 0, NULL, NULL, 1, NULL, 1, 1, 0, 0, 24.00, NULL),
@@ -306,7 +306,7 @@ VALUES
 (13, 'Guests', NULL, 0, 0, NULL, NULL, 1, NULL, 1, 1, 4, 1, 24.00, NULL)
 ON CONFLICT (id) DO UPDATE SET
     ou_name = EXCLUDED.ou_name,
-    comment = EXCLUDED.comment,
+    description = EXCLUDED.description,
     default_users = EXCLUDED.default_users,
     default_hotspot = EXCLUDED.default_hotspot,
     nagios_dir = EXCLUDED.nagios_dir,
@@ -338,7 +338,7 @@ ON CONFLICT (id) DO UPDATE SET
     Upload = EXCLUDED.Upload;
 
 -- Network subnets
-INSERT INTO subnets (id, subnet, vlan_tag, ip_int_start, ip_int_stop, dhcp_start, dhcp_stop, dhcp_lease_time, gateway, office, hotspot, vpn, free, dhcp, static, dhcp_update_hostname, discovery, notify, comment)
+INSERT INTO subnets (id, subnet, vlan_tag, ip_int_start, ip_int_stop, dhcp_start, dhcp_stop, dhcp_lease_time, gateway, office, hotspot, vpn, free, dhcp, static, dhcp_update_hostname, discovery, notify, description)
 VALUES (1, '192.168.2.0/24', 2, 3232236032, 3232236287, 3232236132, 3232236182, 480, 3232236033, 1, 0, 0, 0, 1, 0, 1, 1, 7, 'LAN')
 ON CONFLICT (id) DO UPDATE SET
     subnet = EXCLUDED.subnet,
@@ -358,7 +358,7 @@ ON CONFLICT (id) DO UPDATE SET
     dhcp_update_hostname = EXCLUDED.dhcp_update_hostname,
     discovery = EXCLUDED.discovery,
     notify = EXCLUDED.notify,
-    comment = EXCLUDED.comment;
+    description = EXCLUDED.description;
 
 -- Device vendors
 INSERT INTO vendors (id, name)
@@ -422,7 +422,7 @@ ON CONFLICT (id) DO UPDATE SET
     name = EXCLUDED.name;
 
 -- Filter rules list
-INSERT INTO filter_list (id, name, comment, proto, dst, dstport, srcport, type)
+INSERT INTO filter_list (id, name, description, proto, dst, dstport, srcport, filter_type)
 VALUES
 (1, 'pop3', NULL, 'tcp', '0/0', '110', NULL, 0),
 (3, 'http', NULL, 'tcp', '0/0', '80', NULL, 0),
@@ -458,7 +458,7 @@ VALUES
 (108, 'gre', NULL, 'gre', '0/0', NULL, NULL, 0)
 ON CONFLICT (id) DO UPDATE SET
     name = EXCLUDED.name,
-    comment = EXCLUDED.comment,
+    description = EXCLUDED.description,
     proto = EXCLUDED.proto,
     dst = EXCLUDED.dst,
     dstport = EXCLUDED.dstport,
@@ -466,7 +466,7 @@ ON CONFLICT (id) DO UPDATE SET
     type = EXCLUDED.type;
 
 -- Filter group assignments
-INSERT INTO group_filters (id, group_id, filter_id, "order", action)
+INSERT INTO group_filters (id, group_id, filter_id, rule_order, action)
 VALUES
 (1, 2, 90, 1, 1),
 (2, 2, 91, 2, 1),

+ 7 - 0
docs/databases/postgres/reset_admin.sql

@@ -0,0 +1,7 @@
+-- default user: admin
+-- default password: admin
+INSERT INTO "customers" ("id", "Login", "password", "api_key", "rights")
+VALUES (1, 'admin', '$2y$11$wohV8Tuqu0Yai9Shacei5OKfMxG5bnLxB5ACcZcJJ3pYEbIH0qLGG', 'c3284d0f94606de1fd2af172aba15bf31', '1')
+ON CONFLICT ("id") DO UPDATE
+SET "Login" = EXCLUDED."Login",
+    "password" = EXCLUDED."password";

+ 46 - 45
docs/databases/postgres/ru/create_db.sql

@@ -29,19 +29,19 @@ CREATE TABLE auth_rules (
 id SERIAL PRIMARY KEY,
 user_id INTEGER,
 ou_id INTEGER,
-type SMALLINT NOT NULL,
+rule_type SMALLINT NOT NULL,
 rule VARCHAR(40) UNIQUE,
-comment VARCHAR(250)
+description VARCHAR(250)
 );
 COMMENT ON TABLE auth_rules IS 'Правила аутентификации и авторизации пользователей';
-COMMENT ON COLUMN auth_rules.type IS 'Тип правила: 0=разрешить, 1=запретить, и т.д.';
+COMMENT ON COLUMN auth_rules.rule_type IS 'Тип правила: 0=разрешить, 1=запретить, и т.д.';
 COMMENT ON COLUMN auth_rules.rule IS 'Идентификатор правила (уникальный)';
 
 -- Здания
 CREATE TABLE building (
 id SERIAL PRIMARY KEY,
 name VARCHAR(50) NOT NULL,
-comment VARCHAR(250)
+description VARCHAR(250)
 );
 COMMENT ON TABLE building IS 'Физические здания/локации';
 COMMENT ON COLUMN building.name IS 'Название здания';
@@ -62,7 +62,7 @@ description_russian TEXT,
 description_english TEXT,
 draft SMALLINT NOT NULL DEFAULT 0,
 uniq SMALLINT NOT NULL DEFAULT 1,
-type VARCHAR(100) NOT NULL,
+option_type VARCHAR(100) NOT NULL,
 default_value VARCHAR(250),
 min_value INTEGER NOT NULL DEFAULT 0,
 max_value INTEGER NOT NULL DEFAULT 0
@@ -90,7 +90,7 @@ COMMENT ON COLUMN connections.last_found IS 'Время последней ак
 CREATE TABLE customers (
 id SERIAL PRIMARY KEY,
 Login VARCHAR(20),
-comment VARCHAR(100),
+description VARCHAR(100),
 password VARCHAR(255),
 api_key VARCHAR(255),
 rights SMALLINT NOT NULL DEFAULT 3
@@ -116,7 +116,7 @@ protocol SMALLINT NOT NULL DEFAULT 0,
 control_port INTEGER NOT NULL DEFAULT 23,
 port_count INTEGER NOT NULL DEFAULT 0,
 SN VARCHAR(80),
-comment VARCHAR(255),
+description VARCHAR(255),
 snmp_version SMALLINT NOT NULL DEFAULT 0,
 snmp3_auth_proto VARCHAR(10) NOT NULL DEFAULT 'sha512',
 snmp3_priv_proto VARCHAR(10) NOT NULL DEFAULT 'aes128',
@@ -188,7 +188,7 @@ snmp_index INTEGER,
 port INTEGER,
 ifName VARCHAR(40),
 port_name VARCHAR(40),
-comment VARCHAR(50),
+description VARCHAR(50),
 target_port_id INTEGER NOT NULL DEFAULT 0,
 auth_id BIGINT,
 last_mac_count INTEGER DEFAULT 0,
@@ -222,7 +222,7 @@ mac MACADDR NOT NULL,
 ip_int BIGINT NOT NULL,
 ip INET NOT NULL,
 action VARCHAR(10) NOT NULL,
-timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
 auth_id BIGINT NOT NULL,
 dhcp_hostname VARCHAR(250),
 circuit_id VARCHAR(255),
@@ -239,7 +239,7 @@ id BIGSERIAL PRIMARY KEY,
 mac MACADDR NOT NULL,
 ip INET NOT NULL,
 action VARCHAR(10) NOT NULL,
-timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
 dhcp_hostname VARCHAR(250)
 );
 COMMENT ON TABLE dhcp_queue IS 'Очередь отложенных операций DHCP';
@@ -249,7 +249,7 @@ CREATE TABLE dns_cache (
 id BIGSERIAL PRIMARY KEY,
 dns VARCHAR(250),
 ip BIGINT,
-timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
+ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
 );
 COMMENT ON TABLE dns_cache IS 'Кэш DNS разрешений';
 
@@ -259,7 +259,7 @@ id SERIAL PRIMARY KEY,
 auth_id INTEGER,
 name_type VARCHAR(10) NOT NULL DEFAULT 'A',
 name VARCHAR(200),
-type VARCHAR(10) NOT NULL DEFAULT 'add',
+operation_type VARCHAR(10) NOT NULL DEFAULT 'add',
 value VARCHAR(100)
 );
 COMMENT ON TABLE dns_queue IS 'Очередь отложенных операций DNS';
@@ -270,7 +270,7 @@ COMMENT ON COLUMN dns_queue.type IS 'Тип операции: add, delete, updat
 CREATE TABLE filter_instances (
 id SERIAL PRIMARY KEY,
 name VARCHAR(50) UNIQUE,
-comment VARCHAR(200)
+description VARCHAR(200)
 );
 COMMENT ON TABLE filter_instances IS 'Экземпляры политик фильтрации';
 
@@ -278,17 +278,17 @@ COMMENT ON TABLE filter_instances IS 'Экземпляры политик фил
 CREATE TABLE filter_list (
 id SERIAL PRIMARY KEY,
 name VARCHAR(50),
-comment VARCHAR(250),
+description VARCHAR(250),
 proto VARCHAR(10),
 dst TEXT,
 dstport VARCHAR(20),
 srcport VARCHAR(20),
-type SMALLINT NOT NULL DEFAULT 0
+filter_type SMALLINT NOT NULL DEFAULT 0
 );
 COMMENT ON TABLE filter_list IS 'Правила firewall/фильтрации';
 COMMENT ON COLUMN filter_list.proto IS 'Протокол: tcp, udp, icmp и т.д.';
 COMMENT ON COLUMN filter_list.dst IS 'IP/CIDR назначения';
-COMMENT ON COLUMN filter_list.type IS 'Тип правила: 0=разрешить, 1=запретить';
+COMMENT ON COLUMN filter_list.filter_type IS 'Тип правила: 0=разрешить, 1=запретить';
 
 -- Шлюзы подсетей
 CREATE TABLE gateway_subnets (
@@ -315,7 +315,7 @@ CREATE TABLE group_list (
 id SERIAL PRIMARY KEY,
 instance_id INTEGER NOT NULL DEFAULT 1,
 group_name VARCHAR(50),
-comment VARCHAR(250)
+description VARCHAR(250)
 );
 COMMENT ON TABLE group_list IS 'Группы политик фильтрации';
 
@@ -323,7 +323,7 @@ COMMENT ON TABLE group_list IS 'Группы политик фильтрации
 CREATE TABLE mac_history (
 id BIGSERIAL PRIMARY KEY,
 mac VARCHAR(12),
-timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
 device_id BIGINT,
 port_id BIGINT,
 ip VARCHAR(16) NOT NULL DEFAULT '',
@@ -348,7 +348,7 @@ COMMENT ON COLUMN mac_vendors.oui IS 'Organizationally Unique Identifier (пер
 CREATE TABLE OU (
 id SERIAL PRIMARY KEY,
 ou_name VARCHAR(40),
-comment VARCHAR(250),
+description VARCHAR(250),
 default_users SMALLINT NOT NULL DEFAULT 0,
 default_hotspot SMALLINT NOT NULL DEFAULT 0,
 nagios_dir VARCHAR(255),
@@ -380,7 +380,7 @@ COMMENT ON COLUMN queue_list.Upload IS 'Ограничение скорости
 -- Удаленные syslog сообщения
 CREATE TABLE remote_syslog (
 id BIGSERIAL PRIMARY KEY,
-date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
 device_id BIGINT NOT NULL,
 ip VARCHAR(15) NOT NULL,
 message TEXT NOT NULL
@@ -415,7 +415,7 @@ static SMALLINT NOT NULL DEFAULT 0,
 dhcp_update_hostname SMALLINT NOT NULL DEFAULT 0,
 discovery SMALLINT NOT NULL DEFAULT 1,
 notify SMALLINT NOT NULL DEFAULT 7,
-comment VARCHAR(250)
+description VARCHAR(250)
 );
 COMMENT ON TABLE subnets IS 'Конфигурация сетевых подсетей';
 COMMENT ON COLUMN subnets.subnet IS 'Сеть в нотации CIDR';
@@ -429,7 +429,7 @@ CREATE TABLE traffic_detail (
 id BIGSERIAL PRIMARY KEY,
 auth_id BIGINT,
 router_id INTEGER NOT NULL DEFAULT 0,
-timestamp TIMESTAMP,
+ts TIMESTAMP,
 proto SMALLINT,
 src_ip INTEGER NOT NULL,
 dst_ip INTEGER NOT NULL,
@@ -449,7 +449,7 @@ id BIGSERIAL PRIMARY KEY,
 mac VARCHAR(12),
 port_id BIGINT,
 device_id INTEGER,
-timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
+ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
 );
 COMMENT ON TABLE unknown_mac IS 'Недавно обнаруженные неизвестные MAC-адреса';
 
@@ -465,9 +465,9 @@ enabled SMALLINT NOT NULL DEFAULT 0,
 dhcp SMALLINT NOT NULL DEFAULT 1,
 filter_group_id SMALLINT NOT NULL DEFAULT 0,
 dynamic SMALLINT NOT NULL DEFAULT 0,
-eof TIMESTAMP,
+end_life TIMESTAMP,
 deleted SMALLINT NOT NULL DEFAULT 0,
-comments VARCHAR(250),
+description VARCHAR(250),
 dns_name VARCHAR(253),
 dns_ptr_only SMALLINT NOT NULL DEFAULT 0,
 WikiName VARCHAR(250),
@@ -480,12 +480,13 @@ dhcp_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
 dhcp_hostname VARCHAR(60),
 last_found TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
 arp_found TIMESTAMP,
+mac_found TIMESTAMP,
 blocked SMALLINT NOT NULL DEFAULT 0,
 day_quota INTEGER NOT NULL DEFAULT 0,
 month_quota INTEGER NOT NULL DEFAULT 0,
 device_model_id INTEGER DEFAULT 87,
 firmware VARCHAR(100),
-timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
 client_id VARCHAR(250),
 nagios SMALLINT NOT NULL DEFAULT 0,
 nagios_status VARCHAR(10) NOT NULL DEFAULT '',
@@ -508,14 +509,14 @@ id SERIAL PRIMARY KEY,
 auth_id INTEGER NOT NULL,
 alias VARCHAR(100),
 description VARCHAR(100),
-timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
+ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
 );
 COMMENT ON TABLE user_auth_alias IS 'Алиасы/DNS имена для записей авторизации';
 
 -- Список пользователей
 CREATE TABLE user_list (
 id BIGSERIAL PRIMARY KEY,
-timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
 login VARCHAR(255),
 fio VARCHAR(255),
 enabled SMALLINT NOT NULL DEFAULT 1,
@@ -551,7 +552,7 @@ CREATE TABLE user_stats (
 id BIGSERIAL PRIMARY KEY,
 router_id BIGINT DEFAULT 0,
 auth_id BIGINT NOT NULL DEFAULT 0,
-timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
 byte_in BIGINT NOT NULL DEFAULT 0,
 byte_out BIGINT NOT NULL DEFAULT 0
 );
@@ -562,7 +563,7 @@ CREATE TABLE user_stats_full (
 id BIGSERIAL PRIMARY KEY,
 router_id BIGINT DEFAULT 0,
 auth_id BIGINT NOT NULL DEFAULT 0,
-timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
 byte_in BIGINT NOT NULL DEFAULT 0,
 byte_out BIGINT NOT NULL DEFAULT 0,
 pkt_in INTEGER,
@@ -614,7 +615,7 @@ COMMENT ON COLUMN wan_stats.bytes_out IS 'Байтов отправлено с W
 -- Журнал активности системы
 CREATE TABLE worklog (
 id BIGSERIAL PRIMARY KEY,
-timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
 auth_id BIGINT NOT NULL DEFAULT 0,
 customer VARCHAR(50) NOT NULL DEFAULT 'system',
 ip VARCHAR(18) NOT NULL DEFAULT '127.0.0.1',
@@ -633,25 +634,25 @@ CREATE INDEX idx_device_ports_device_id ON device_ports(device_id);
 CREATE INDEX idx_device_ports_port ON device_ports(port);
 CREATE INDEX idx_device_ports_target_port_id ON device_ports(target_port_id);
 
-CREATE INDEX idx_dhcp_log_timestamp ON dhcp_log(timestamp, action);
-CREATE INDEX idx_dhcp_queue_timestamp ON dhcp_queue(timestamp, action);
+CREATE INDEX idx_dhcp_log_ts ON dhcp_log(ts, action);
+CREATE INDEX idx_dhcp_queue_ts ON dhcp_queue(ts, action);
 
 CREATE INDEX idx_dns_cache_dns ON dns_cache(dns, ip);
-CREATE INDEX idx_dns_cache_timestamp ON dns_cache(timestamp);
+CREATE INDEX idx_dns_cache_ts ON dns_cache(ts);
 
-CREATE INDEX idx_mac_history_mac ON mac_history(mac, timestamp);
-CREATE INDEX idx_mac_history_ip ON mac_history(ip, timestamp);
-CREATE INDEX idx_mac_history_timestamp ON mac_history(timestamp);
+CREATE INDEX idx_mac_history_mac ON mac_history(mac, ts);
+CREATE INDEX idx_mac_history_ip ON mac_history(ip, ts);
+CREATE INDEX idx_mac_history_ts ON mac_history(ts);
 
 CREATE INDEX idx_ou_ou_name_gin ON OU USING GIN(ou_name gin_trgm_ops);
 
 CREATE INDEX idx_subnets_ip_int_start ON subnets(ip_int_start, ip_int_stop);
 CREATE INDEX idx_subnets_dhcp ON subnets(dhcp, office, hotspot, static);
 
-CREATE INDEX idx_traffic_detail_src ON traffic_detail(auth_id, timestamp, router_id, src_ip);
-CREATE INDEX idx_traffic_detail_dst ON traffic_detail(auth_id, timestamp, router_id, dst_ip);
+CREATE INDEX idx_traffic_detail_src ON traffic_detail(auth_id, ts, router_id, src_ip);
+CREATE INDEX idx_traffic_detail_dst ON traffic_detail(auth_id, ts, router_id, dst_ip);
 
-CREATE INDEX idx_unknown_mac_timestamp ON unknown_mac(timestamp, device_id, port_id, mac);
+CREATE INDEX idx_unknown_mac_ts ON unknown_mac(ts, device_id, port_id, mac);
 
 CREATE INDEX idx_user_auth_main ON user_auth(id, user_id, ip_int, mac, ip, deleted);
 CREATE INDEX idx_user_auth_deleted ON user_auth(deleted) WHERE deleted = 0;
@@ -663,12 +664,12 @@ CREATE INDEX idx_user_sessions_session_id ON user_sessions(session_id);
 CREATE INDEX idx_user_sessions_user_id ON user_sessions(user_id);
 CREATE INDEX idx_user_sessions_is_active ON user_sessions(is_active) WHERE is_active = 1;
 
-CREATE INDEX idx_user_stats_timestamp ON user_stats(timestamp, auth_id, router_id);
-CREATE INDEX idx_user_stats_full_timestamp ON user_stats_full(timestamp, auth_id, router_id);
+CREATE INDEX idx_user_stats_ts ON user_stats(ts, auth_id, router_id);
+CREATE INDEX idx_user_stats_full_ts ON user_stats_full(ts, auth_id, router_id);
 
 CREATE INDEX idx_wan_stats_time ON wan_stats(time, router_id, interface_id);
 
-CREATE INDEX idx_worklog_customer ON worklog(customer, level, timestamp);
-CREATE INDEX idx_worklog_timestamp ON worklog(level, timestamp);
-CREATE INDEX idx_worklog_auth_id ON worklog(auth_id, level, timestamp);
+CREATE INDEX idx_worklog_customer ON worklog(customer, level, ts);
+CREATE INDEX idx_worklog_ts ON worklog(level, ts);
+CREATE INDEX idx_worklog_auth_id ON worklog(auth_id, level, ts);
 

+ 15 - 15
docs/databases/postgres/ru/data.sql

@@ -12,14 +12,14 @@ ON CONFLICT (id) DO UPDATE SET
     description_russian = EXCLUDED.description_russian;
 
 -- Buildings
-INSERT INTO building (id, name, comment)
+INSERT INTO building (id, name, description)
 VALUES (1, 'Earth', 'Somewhere')
 ON CONFLICT (id) DO UPDATE SET
     name = EXCLUDED.name,
-    comment = EXCLUDED.comment;
+    description = EXCLUDED.description;
 
 -- Configuration options
-INSERT INTO config_options (id, option_name, description_russian, description_english, draft, uniq, type, default_value, min_value, max_value)
+INSERT INTO config_options (id, option_name, description_russian, description_english, draft, uniq, option_type, default_value, min_value, max_value)
 VALUES
 (1, 'KB', 'Еденица измерения трафика - Килобайт (0) или кибибайт (1,default)', 'Traffic measurement unit - Kilobyte (1000b) or kibibyte (1024b,default)', 0, 1, 'bool', '1024', 0, 1),
 (3, 'dns server', 'ip-адрес DNS-сервера', 'DNS server ip address', 0, 1, 'text', '127.0.0.1', 0, 0),
@@ -115,11 +115,11 @@ ON CONFLICT (id) DO UPDATE SET
 
 -- System users/administrators
 -- В PostgreSQL нет аналога ON DUPLICATE KEY UPDATE, используем ON CONFLICT
-INSERT INTO customers (id, Login, comment, password, api_key, rights)
+INSERT INTO customers (id, Login, description, password, api_key, rights)
 VALUES (1, 'admin', 'Administrator', '$2y$11$wohV8Tuqu0Yai9Shacei5OKfMxG5bnLxB5ACcZcJJ3pYEbIH0qLGG', 'c3284d0f94606de1fd2af172aba15bf31', 1)
 ON CONFLICT (id) DO UPDATE SET
     Login = EXCLUDED.Login,
-    comment = EXCLUDED.comment,
+    description = EXCLUDED.description,
     password = EXCLUDED.password,
     api_key = EXCLUDED.api_key,
     rights = EXCLUDED.rights;
@@ -263,14 +263,14 @@ ON CONFLICT (id) DO UPDATE SET
     name_english = EXCLUDED.name_english;
 
 -- Filter instances
-INSERT INTO filter_instances (id, name, comment)
+INSERT INTO filter_instances (id, name, description)
 VALUES (1, 'default', NULL)
 ON CONFLICT (id) DO UPDATE SET
     name = EXCLUDED.name,
-    comment = EXCLUDED.comment;
+    description = EXCLUDED.description;
 
 -- Filter groups (русские названия)
-INSERT INTO group_list (id, instance_id, group_name, comment)
+INSERT INTO group_list (id, instance_id, group_name, description)
 VALUES
 (0, 1, 'default', 'Всё запрещено'),
 (1, 1, 'Allow all', 'Разрешено всё'),
@@ -278,10 +278,10 @@ VALUES
 ON CONFLICT (id) DO UPDATE SET
     instance_id = EXCLUDED.instance_id,
     group_name = EXCLUDED.group_name,
-    comment = EXCLUDED.comment;
+    description = EXCLUDED.description;
 
 -- Organizational Units (русские названия)
-INSERT INTO OU (id, ou_name, comment, default_users, default_hotspot, nagios_dir, nagios_host_use, nagios_ping, nagios_default_service, enabled, filter_group_id, queue_id, dynamic, life_duration, parent_id)
+INSERT INTO OU (id, ou_name, description, default_users, default_hotspot, nagios_dir, nagios_host_use, nagios_ping, nagios_default_service, enabled, filter_group_id, queue_id, dynamic, life_duration, parent_id)
 VALUES
 (0, '!Всё', NULL, 0, 0, '/etc/nagios/any', 'generic-host', 1, NULL, 0, 0, 0, 0, 24.00, NULL),
 (1, 'Сервера', NULL, 0, 0, NULL, NULL, 1, NULL, 1, 1, 0, 0, 24.00, NULL),
@@ -299,7 +299,7 @@ VALUES
 (13, 'Гости', NULL, 0, 0, NULL, NULL, 1, NULL, 1, 1, 4, 1, 24.00, NULL)
 ON CONFLICT (id) DO UPDATE SET
     ou_name = EXCLUDED.ou_name,
-    comment = EXCLUDED.comment,
+    description = EXCLUDED.description,
     default_users = EXCLUDED.default_users,
     default_hotspot = EXCLUDED.default_hotspot,
     nagios_dir = EXCLUDED.nagios_dir,
@@ -331,7 +331,7 @@ ON CONFLICT (id) DO UPDATE SET
     Upload = EXCLUDED.Upload;
 
 -- Network subnets
-INSERT INTO subnets (id, subnet, vlan_tag, ip_int_start, ip_int_stop, dhcp_start, dhcp_stop, dhcp_lease_time, gateway, office, hotspot, vpn, free, dhcp, static, dhcp_update_hostname, discovery, notify, comment)
+INSERT INTO subnets (id, subnet, vlan_tag, ip_int_start, ip_int_stop, dhcp_start, dhcp_stop, dhcp_lease_time, gateway, office, hotspot, vpn, free, dhcp, static, dhcp_update_hostname, discovery, notify, description)
 VALUES (1, '192.168.2.0/24', 2, 3232236032, 3232236287, 3232236132, 3232236182, 480, 3232236033, 1, 0, 0, 0, 1, 0, 1, 1, 7, 'LAN')
 ON CONFLICT (id) DO UPDATE SET
     subnet = EXCLUDED.subnet,
@@ -351,7 +351,7 @@ ON CONFLICT (id) DO UPDATE SET
     dhcp_update_hostname = EXCLUDED.dhcp_update_hostname,
     discovery = EXCLUDED.discovery,
     notify = EXCLUDED.notify,
-    comment = EXCLUDED.comment;
+    description = EXCLUDED.description;
 
 -- Device vendors
 INSERT INTO vendors (id, name)
@@ -415,7 +415,7 @@ ON CONFLICT (id) DO UPDATE SET
     name = EXCLUDED.name;
 
 -- Filter rules list
-INSERT INTO filter_list (id, name, comment, proto, dst, dstport, srcport, type)
+INSERT INTO filter_list (id, name, description, proto, dst, dstport, srcport, filter_type)
 VALUES
 (1, 'pop3', NULL, 'tcp', '0/0', '110', NULL, 0),
 (3, 'http', NULL, 'tcp', '0/0', '80', NULL, 0),
@@ -451,7 +451,7 @@ VALUES
 (108, 'gre', NULL, 'gre', '0/0', NULL, NULL, 0)
 ON CONFLICT (id) DO UPDATE SET
     name = EXCLUDED.name,
-    comment = EXCLUDED.comment,
+    description = EXCLUDED.description,
     proto = EXCLUDED.proto,
     dst = EXCLUDED.dst,
     dstport = EXCLUDED.dstport,

+ 5 - 5
html/admin/customers/building.php

@@ -27,11 +27,11 @@ if (isset($_POST['save'])) {
                 continue;
             }
             $value = $_POST['f_building_name'][$j];
-            $value_comment = $_POST['f_building_comment'][$j];
+            $value_description = $_POST['f_building_description'][$j];
             if (isset($value)) {
                 $new['name'] = $value;
-                $new['comment'] = $value_comment;
-                LOG_INFO($db_link,"Change building id='{$save_id}': name=".$value." comment=".$value_comment);
+                $new['description'] = $value_description;
+                LOG_INFO($db_link,"Change building id='{$save_id}': name=".$value." description=".$value_description);
                 update_record($db_link, "building", "id='{$save_id}'", $new);
             }
         }
@@ -62,7 +62,7 @@ print_control_submenu($page_url);
 <td><input type="checkbox" onClick="checkAll(this.checked);"></td>
 <td><b>id</b></td>
 <td><b><?php echo WEB_cell_name; ?></b></td>
-<td><b><?php echo WEB_cell_comment; ?></b></td>
+<td><b><?php echo WEB_cell_description; ?></b></td>
 <td>
 <input type="submit" onclick="return confirm('<?php print WEB_btn_delete; ?>?')" name="remove" value="<?php print WEB_btn_remove; ?>">
 </td>
@@ -74,7 +74,7 @@ foreach ($t_building as $row) {
     print "<td class=\"data\" style='padding:0'><input type=checkbox name=f_id[] value='{$row['id']}'></td>\n";
     print "<td class=\"data\"><input type=\"hidden\" name='r_id[]' value='{$row['id']}'>{$row['id']}</td>\n";
     print "<td class=\"data\"><input type=\"text\" name='f_building_name[]' value='{$row['name']}'></td>\n";
-    print "<td class=\"data\"><input type=\"text\" name='f_building_comment[]' value='{$row['comment']}'></td>\n";
+    print "<td class=\"data\"><input type=\"text\" name='f_building_description[]' value='{$row['description']}'></td>\n";
     print "<td class=\"data\"><button name='save[]' value='{$row['id']}'>".WEB_btn_save."</button></td>\n";
     print "</tr>\n";
 }

+ 3 - 3
html/admin/customers/control-options.php

@@ -72,7 +72,7 @@ print_control_submenu($page_url);
                 <td width=20><input type="checkbox" onClick="checkAll(this.checked);"></td>
                 <td width=150><b><?php print WEB_config_option; ?></b></td>
                 <td width=150><b><?php print WEB_config_value; ?></b></td>
-                <td width=350><b><?php print WEB_msg_comment; ?></b></td>
+                <td width=350><b><?php print WEB_msg_description; ?></b></td>
                 <td class="warn">
                     <input type="submit" onclick="return confirm('<?php print WEB_btn_delete; ?>?')" name="remove" value="<?php print WEB_btn_remove; ?>">
                 </td>
@@ -82,8 +82,8 @@ print_control_submenu($page_url);
             </tr>
 
             <?php
-            $descr_field = "description." . HTML_LANG;
-            $config_sql = "SELECT `config`.`id`,`option_id`,`option_name`,`value`,`type`,`" . $descr_field . "`,`min_value`,`max_value` FROM `config`,`config_options` WHERE `config`.`option_id`=`config_options`.`id` AND `config_options`.`draft`=0 ORDER BY `option_name`";
+            $descr_field = "description_" . HTML_LANG;
+            $config_sql = "SELECT config.id,option_id,option_name,value,option_type," . $descr_field . ",min_value,max_value FROM config,config_options WHERE config.option_id=config_options.id AND config_options.draft=0 ORDER BY option_name";
             $t_config = get_records_sql($db_link, $config_sql);
             foreach ($t_config as $row) {
                 print "<tr align=center>\n";

+ 3 - 3
html/admin/customers/editcustom.php

@@ -8,7 +8,7 @@ $msg_error = "";
 if (isset($_POST["edituser"])) {
     global $salt;
     $new['Login'] = substr(trim($_POST["login"]), 0, 20);
-    $new['comment'] = substr(trim($_POST["comment"]), 0, 100);
+    $new['description'] = substr(trim($_POST["description"]), 0, 100);
     if (isset($_POST["pass"]) and (strlen(trim($_POST["pass"])) > 0)) {
         $new['password'] = password_hash($_POST["pass"], PASSWORD_BCRYPT);
 	}
@@ -40,8 +40,8 @@ $customer=get_record($db_link,'customers',"id=".$id);
 				<td><input type="text" name="login" value="<?php print $customer['Login']; ?>" size=20></td>
 			</tr>
 			<tr>
-				<td><?php echo WEB_cell_comment; ?></td>
-				<td><input type="text" name="comment" value="<?php print $customer['comment']; ?>" size=50></td>
+				<td><?php echo WEB_cell_description; ?></td>
+				<td><input type="text" name="description" value="<?php print $customer['description']; ?>" size=50></td>
 			</tr>
 			<tr>
 				<td><?php echo WEB_customer_password; ?></td>

+ 3 - 3
html/admin/customers/editsubnet.php

@@ -19,7 +19,7 @@ if (isset($_POST['s_save'])) {
         $new['discovery'] = intval_or_zero($_POST['s_discovery']);
         $new['notify'] = intval_or_zero($_POST['s_notify']);
         $new['dhcp_update_hostname'] = intval_or_zero($_POST['s_dhcp_update']);
-        $new['comment'] = trim($_POST['s_comment']);
+        $new['description'] = trim($_POST['s_description']);
 
         // === CIDR / RANGE PROCESSING =============================================================================
 
@@ -128,9 +128,9 @@ $subnet_info = get_record_sql($db_link, $sSQL);
             
             <tr>
                 <td></td>
-                <td><b><?php echo WEB_cell_comment; ?></b></td>
+                <td><b><?php echo WEB_cell_description; ?></b></td>
                 <td colspan="2" class="data">
-                    <input type="text" name="s_comment" value="<?php echo $subnet_info['comment']; ?>">
+                    <input type="text" name="s_description" value="<?php echo $subnet_info['description']; ?>">
                 </td>
             </tr>
             

+ 2 - 2
html/admin/customers/index-subnets.php

@@ -75,7 +75,7 @@ print_control_submenu($page_url);
                 <td><b><?php echo WEB_network_dyndns; ?></b></td>
                 <td><b><?php echo WEB_network_discovery; ?></b></td>
                 <td><b><?php echo WEB_network_notify; ?></b></td>
-                <td><b><?php echo WEB_cell_comment; ?></b></td>
+                <td><b><?php echo WEB_cell_description; ?></b></td>
             </tr>
             <?php
             $t_subnets = get_records($db_link, 'subnets', 'True ORDER BY ip_int_start');
@@ -93,7 +93,7 @@ print_control_submenu($page_url);
                 print_td_yes_no($row['dhcp_update_hostname']);
                 print_td_yes_no($row['discovery']);
                 print "<td class=\"data\">" . printFlagsByFirstLetter($row['notify']) . " </td>\n";
-                print "<td class=\"data\">" . $row['comment'] . " </td>\n";
+                print "<td class=\"data\">" . $row['description'] . " </td>\n";
                 print "</tr>\n";
                 }
             ?>

+ 2 - 2
html/admin/customers/index.php

@@ -50,7 +50,7 @@ print_control_submenu($page_url);
 <tr align="center">
 <td width="30"><input type="checkbox" onClick="checkAll(this.checked);"></td>
 <td><b>Login</b></td>
-<td><b><?php echo WEB_cell_comment; ?></b></td>
+<td><b><?php echo WEB_cell_description; ?></b></td>
 <td><b><?php echo WEB_customer_mode;?></b></td>
 </tr>
 <?php
@@ -61,7 +61,7 @@ foreach ($users as $row) {
     print "<tr align=center>\n";
     print "<td class=\"$cl\" style='padding:0'><input type=checkbox name=fid[] value=".$row['id']."></td>\n";
     print "<td class=\"$cl\" align=left width=200><a href=editcustom.php?id=".$row['id'].">" . $row['Login'] . "</a></td>\n";
-    print "<td class=\"$cl\" >". $row['comment']. "</a></td>\n";
+    print "<td class=\"$cl\" >". $row['description']. "</a></td>\n";
     print "<td class=\"$cl\" >". $acl['name']. "</a></td>\n";
 }
 ?>

+ 1 - 1
html/admin/devices/edit_gw_instances.php

@@ -57,7 +57,7 @@ print_url($device['device_name'],"/admin/devices/editdevice.php?id=$id"); ?>
         </td>
 </tr>
 <?php
-$gateway_instances = get_records_sql($db_link,'SELECT device_filter_instances.*,filter_instances.name,filter_instances.comment FROM device_filter_instances LEFT JOIN filter_instances ON device_filter_instances.instance_id = filter_instances.id WHERE device_filter_instances.device_id='.$id);
+$gateway_instances = get_records_sql($db_link,'SELECT device_filter_instances.*,filter_instances.name,filter_instances.description FROM device_filter_instances LEFT JOIN filter_instances ON device_filter_instances.instance_id = filter_instances.id WHERE device_filter_instances.device_id='.$id);
 foreach ( $gateway_instances as $row ) {
     print "<tr align=center>\n";
     print "<td class=\"data\" style='padding:0' width=30><input type=checkbox name=gs_id[] value='{$row['id']}'></td>\n";

+ 1 - 1
html/admin/devices/edit_gw_subnets.php

@@ -55,7 +55,7 @@ print_url($device['device_name'],"/admin/devices/editdevice.php?id=$id"); ?>
         </td>
 </tr>
 <?php
-$gateway_subnets = get_records_sql($db_link,'SELECT gateway_subnets.*,subnets.subnet,subnets.comment FROM gateway_subnets LEFT JOIN subnets ON gateway_subnets.subnet_id = subnets.id WHERE gateway_subnets.device_id='.$id);
+$gateway_subnets = get_records_sql($db_link,'SELECT gateway_subnets.*,subnets.subnet,subnets.description FROM gateway_subnets LEFT JOIN subnets ON gateway_subnets.subnet_id = subnets.id WHERE gateway_subnets.device_id='.$id);
 foreach ( $gateway_subnets as $row ) {
     print "<tr align=center>\n";
     print "<td class=\"data\" style='padding:0' width=30><input type=checkbox name=gs_id[] value='{$row['id']}'></td>\n";

+ 4 - 4
html/admin/devices/editdevice.php

@@ -56,8 +56,8 @@ if (isset($_POST["editdevice"]) and isset($id)) {
     if (isset($_POST["f_devtype_id"])) {
         $new['device_type'] = $_POST["f_devtype_id"] * 1;
     }
-    if (isset($_POST["f_comment"])) {
-        $new['comment'] = $_POST["f_comment"];
+    if (isset($_POST["f_description"])) {
+        $new['description'] = $_POST["f_description"];
     }
     if (isset($_POST["f_SN"])) {
         $new['SN'] = $_POST["f_SN"];
@@ -225,12 +225,12 @@ print_editdevice_submenu($page_url, $id, $device['device_type'], $user_info['log
             print "<td class='data' ><input type='text' name='f_firmware' value='" . $device['firmware'] . "'></td>\n";
             print "<td class='data' ><input type='text' name='f_SN' value='" . $device['SN'] . "'></td>\n";
             print "</tr>\n";
-            print "<tr><td colspan=2>" . WEB_location_name . "</td><td colspan=2>" . WEB_cell_comment . "</td>";
+            print "<tr><td colspan=2>" . WEB_location_name . "</td><td colspan=2>" . WEB_cell_description . "</td>";
             print "</tr><tr>";
             print "<td class='data'>";
             print_building_select($db_link, 'f_building_id', $device['building_id']);
             print "</td>\n";
-            print "<td class='data' colspan=3><input type='text' size=50 name='f_comment' value='" . $device['comment'] . "'></td>\n";
+            print "<td class='data' colspan=3><input type='text' size=50 name='f_description' value='" . $device['description'] . "'></td>\n";
             print "</tr>";
 
             //print gateway settings

+ 3 - 3
html/admin/devices/editport.php

@@ -8,7 +8,7 @@ if (isset($_POST["editport"])) {
     $new['uplink'] = $_POST["f_uplink"] * 1;
     $new['nagios'] = $_POST["f_nagios"] * 1;
     $new['skip'] = $_POST["f_skip"] * 1;
-    $new['comment'] = $_POST["f_comment"];
+    $new['description'] = $_POST["f_description"];
     update_record($db_link, "device_ports", "id='$id'", $new);
 
     $target_id = $_POST["f_target_port"];
@@ -58,8 +58,8 @@ print_editdevice_submenu($page_url, $device_id, $device['device_type'], $user_in
                 print_qa_select('f_skip', $port['skip']); ?>
             </div>
             <div class="field">
-                <?php print "<label for='f_comment'>" . WEB_cell_comment . "</label>";
-                print "<input type=\"text\" name='f_comment' value='" . $port['comment'] . "' size=38>"; ?>
+                <?php print "<label for='f_description'>" . WEB_cell_description . "</label>";
+                print "<input type=\"text\" name='f_description' value='" . $port['description'] . "' size=38>"; ?>
             </div>
             <div class="field">
                 <?php print "<label for='f_target_port'>" . WEB_device_port_uplink_device . "</label>";

+ 3 - 3
html/admin/devices/index-passive.php

@@ -130,13 +130,13 @@ print_navigation($page_url,$page,$displayed,$count_records,$total);
         <td align=Center><?php print $sort_url . "&sort=ip_int&order=$new_order>" . WEB_cell_ip . "</a>"; ?></td>
         <td align=Center><?php print $sort_url . "&sort=mac&order=$new_order>" . WEB_cell_mac . "</a>"; ?></td>
         <td align=Center><?php print $sort_url . "&sort=model_name&order=$new_order>".WEB_cell_host_model; ?></td>
-        <td align=Center><?php print WEB_cell_comment; ?></td>
+        <td align=Center><?php print WEB_cell_description; ?></td>
         <td align=Center><?php print WEB_cell_connection; ?></td>
         <td align=Center><?php print $sort_url . "&sort=last_found&order=$new_order>".WEB_cell_last_found."</a>"; ?></td>
     </tr>
 <?php
 
-$sSQL = "SELECT A.id, D.id as dev_id, D.device_type, A.ip, A.mac, A.user_id, L.login, D.comment, A.last_found, V.name, M.model_name
+$sSQL = "SELECT A.id, D.id as dev_id, D.device_type, A.ip, A.mac, A.user_id, L.login, D.description, A.last_found, V.name, M.model_name
 FROM user_auth A, user_list L, devices D, device_models M, vendors V
 WHERE D.user_id=L.id AND A.ip = D.ip AND D.device_model_id=M.id AND M.vendor_id=V.id AND A.deleted =0
 $u_filter $ip_list_filter $d_filter
@@ -152,7 +152,7 @@ foreach ($users as $user) {
     print "<td class='".$cl."' ><a href=/admin/users/edituser.php?id=".$user['user_id'].">" . $user['ip'] . "</a></td>\n";
     print "<td class='".$cl."' >" . expand_mac($db_link,$user['mac']) . "</td>\n";
     print "<td class='".$cl."' >".$user['name'].' '.$user['model_name']."</td>\n";
-    print "<td class='".$cl."' >".$user['comment']."</td>\n";
+    print "<td class='".$cl."' >".$user['description']."</td>\n";
     print "<td class='data'>" . get_connection($db_link, $user['id']) . "</td>\n";
     print "<td class='".$cl."' >".$user['last_found']."</td>\n";
     print "</tr>\n";

+ 1 - 1
html/admin/devices/index.php

@@ -76,7 +76,7 @@ foreach ($switches as $row) {
     print "<td class=\"$cl\">" . get_vendor_name($db_link, $row['vendor_id']) . " " . $row['model_name'] . "</td>\n";
     print '<td class="'.$cl.'" style="width: 1%; white-space: nowrap;">' . $row['SN'] ."</td>\n";
     print "<td class=\"$cl\">" . get_building($db_link, $row['building_id']);
-    if (!empty($row['comment'])) { print  '<hr style="opacity: 0;">' . $row['comment']; }
+    if (!empty($row['description'])) { print  '<hr style="opacity: 0;">' . $row['description']; }
     print "</td>\n";
     print "<td class=\"$cl\">" . $row['port_count'] . "</td>\n";
     print "<td class=\"$cl\">" . get_qa($row['nagios']) . "</td>\n";

+ 1 - 1
html/admin/devices/mactable.php

@@ -12,7 +12,7 @@ require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
 print_device_submenu($page_url);
 print_editdevice_submenu($page_url,$id,$device['device_type'],$user_info['login']);
 
-$sSQL = "SELECT port, snmp_index FROM `device_ports` WHERE device_id=".$id;
+$sSQL = "SELECT port, snmp_index FROM device_ports WHERE device_id=".$id;
 $ports_info = get_records_sql($db_link, $sSQL);
 $ports_by_snmp_index=NULL;
 foreach ($ports_info as &$row) { $ports_by_snmp_index[$row["snmp_index"]]=$row["port"]; }

+ 2 - 2
html/admin/devices/portmactable.php

@@ -4,7 +4,7 @@ require_once ($_SERVER['DOCUMENT_ROOT']."/inc/languages/" . HTML_LANG . ".php");
 require_once ($_SERVER['DOCUMENT_ROOT']."/inc/idfilter.php");
 
 $port_id = $id;
-$sSQL = "SELECT DP.device_id, DP.port, DP.snmp_index, D.device_name, D.ip, D.vendor_id FROM `device_ports` AS DP, devices AS D WHERE D.id = DP.device_id AND DP.id=$port_id";
+$sSQL = "SELECT DP.device_id, DP.port, DP.snmp_index, D.device_name, D.ip, D.vendor_id FROM device_ports AS DP, devices AS D WHERE D.id = DP.device_id AND DP.id=$port_id";
 $port_info = get_record_sql($db_link, $sSQL);
 if (empty($port_info)) {
     header("Location: /admin/devices/editdevice.php?id=".$device_id);
@@ -13,7 +13,7 @@ if (empty($port_info)) {
 
 $device_id = $port_info["device_id"];
 
-$sSQL = "SELECT port, snmp_index FROM `device_ports` WHERE device_id=".$device_id;
+$sSQL = "SELECT port, snmp_index FROM device_ports WHERE device_id=".$device_id;
 $ports_info = get_records_sql($db_link, $sSQL);
 if (empty($ports_info)) {
     header("Location: /admin/devices/editdevice.php?id=".$device_id);

+ 2 - 2
html/admin/devices/portsbyvlan.php

@@ -16,7 +16,7 @@ print_device_submenu($page_url);
 </form>
 
 <?php
-$countSQL="SELECT Count(*) FROM `device_ports` AS DP, devices AS D WHERE D.id = DP.device_id AND DP.vlan=$id";
+$countSQL="SELECT Count(*) FROM device_ports AS DP, devices AS D WHERE D.id = DP.device_id AND DP.vlan=$id";
 $count_records = get_single_field($db_link,$countSQL);
 $total=ceil($count_records/$displayed);
 if ($page>$total) { $page=$total; }
@@ -31,7 +31,7 @@ print_navigation($page_url,$page,$displayed,$count_records,$total);
 <td><?php echo WEB_device_port_name; ?></td>
 </tr>
 <?php
-$sSQL = "SELECT DP.id, DP.port, DP.device_id, D.device_name FROM `device_ports` AS DP, devices AS D WHERE D.id = DP.device_id AND DP.vlan=$id";
+$sSQL = "SELECT DP.id, DP.port, DP.device_id, D.device_name FROM device_ports AS DP, devices AS D WHERE D.id = DP.device_id AND DP.vlan=$id";
 $ports_info = get_records_sql($db_link, $sSQL);
 foreach ($ports_info as $row) {
     print "<tr>";

+ 1 - 1
html/admin/devices/switchport-conn.php

@@ -43,7 +43,7 @@ print_editdevice_submenu($page_url,$id,$device['device_type'],$user_info['login'
 
 <?php
 
-$connections = get_records_sql($db_link,"SELECT C.* FROM `connections` as C,`user_auth` as A WHERE A.id=C.auth_id AND A.deleted=0 AND C.device_id=$id ORDER BY C.port_id ASC");
+$connections = get_records_sql($db_link,"SELECT C.* FROM connections as C,user_auth as A WHERE A.id=C.auth_id AND A.deleted=0 AND C.device_id=$id ORDER BY C.port_id ASC");
 foreach ($connections as $key => $value) {
 print "<tr align=center>\n";
 print "<td class=\"data\" style='padding:0'><input type=checkbox name=f_id[] value='{$value['id']}'></td>\n";

+ 2 - 2
html/admin/devices/switchport.php

@@ -78,7 +78,7 @@ print_editdevice_submenu($page_url,$id,$device['device_type'],$user_info['login'
 <td><?php echo WEB_device_port_name; ?></td>
 <td><?php echo WEB_device_port_snmp_index; ?></td>
 <td><?php echo WEB_device_connected_endpoint; ?></td>
-<td><?php echo WEB_cell_comment; ?></td>
+<td><?php echo WEB_cell_description; ?></td>
 <td><?php echo WEB_device_port_uplink; ?></td>
 <td><?php echo WEB_nagios; ?></td>
 <td><?php echo WEB_cell_skip; ?></td>
@@ -104,7 +104,7 @@ foreach ($ports as $row) {
             print_auth_port($db_link, $row['id'],FALSE);
         }
         print "</td>\n";
-        print "<td class='".$cl."'>" . get_port_comment($db_link, $row['id'],$row['comment']) . "</td>\n";
+        print "<td class='".$cl."'>" . get_port_description($db_link, $row['id'],$row['description']) . "</td>\n";
         print_td_yes($row['uplink'],FALSE,$cl);
         print_td_yes($row['nagios'],FALSE,$cl);
         print_td_yes($row['skip'],FALSE,$cl);

+ 2 - 2
html/admin/devices/switchstatus.php

@@ -119,7 +119,7 @@ print_editdevice_submenu($page_url, $id, $device['device_type'], $user_info['log
         print "<td>" . WEB_device_port_name . "</td>\n";
         print "<td>" . WEB_device_port_snmp_index . "</td>\n";
         print "<td>" . WEB_device_connected_endpoint . "</td>\n";
-        print "<td>" . WEB_cell_comment . "</td>\n";
+        print "<td>" . WEB_cell_description . "</td>\n";
         print "<td>" . WEB_device_port_uplink . "</td>\n";
         print "<td>" . WEB_nagios . "</td>\n";
         print "<td>" . WEB_cell_skip . "</td>\n";
@@ -190,7 +190,7 @@ print_editdevice_submenu($page_url, $id, $device['device_type'], $user_info['log
                 print_auth_port($db_link, $row['id'], TRUE);
             }
             print "</td>\n";
-            print "<td class='" . $cl . "' >" . get_port_comment($db_link, $row['id'], $row['comment']) . "</td>\n";
+            print "<td class='" . $cl . "' >" . get_port_description($db_link, $row['id'], $row['description']) . "</td>\n";
             print_td_yes($row['uplink'],FALSE,$cl);
             print_td_yes($row['nagios'],FALSE,$cl);
             print_td_yes($row['skip'],FALSE,$cl);

+ 5 - 5
html/admin/filters/editfilter.php

@@ -9,7 +9,7 @@ if (isset($_POST["editfilter"])) {
     $new['proto'] = $_POST["f_proto"];
     $new['dstport'] = str_replace(':', '-', $_POST["f_dstport"]);
     $new['srcport'] = str_replace(':', '-', $_POST["f_srcport"]);
-    $new['comment'] = $_POST["f_comment"];
+    $new['description'] = $_POST["f_description"];
     update_record($db_link, "filter_list", "id='$id'", $new);
     unset($_POST);
     header("Location: " . $_SERVER["REQUEST_URI"]);
@@ -34,11 +34,11 @@ print "<input type=hidden name=id value=$id>";
 if (isset($filter['type']) and $filter['type'] == 0) {
     print "<table class=\"data\" cellspacing=\"0\" cellpadding=\"4\">";
     print "<tr><td><b>".WEB_cell_forename."</b></td>";
-    print "<td colspan=2><b>".WEB_cell_comment."</b></td>";
+    print "<td colspan=2><b>".WEB_cell_description."</b></td>";
     print "</tr>";
     print "<tr>";
     print "<td align=left><input type=text name=f_name value='".$filter['name']."'></td>";
-    print "<td colspan=2><input type=text name=f_comment value='".$filter['comment']."'></td>";
+    print "<td colspan=2><input type=text name=f_description value='".$filter['description']."'></td>";
     print "<td><input type=submit name=editfilter value='".WEB_btn_save."'></td>";
     print "</tr>";
     print "<tr>";
@@ -57,12 +57,12 @@ if (isset($filter['type']) and $filter['type'] == 0) {
 } else {
     print "<table class=\"data\" cellspacing=\"0\" cellpadding=\"4\">";
     print "<tr><td><b>".WEB_cell_forename."</b></td>";
-    print "<td><b>".WEB_cell_comment."</b></td>";
+    print "<td><b>".WEB_cell_description."</b></td>";
     print "<td><input type=submit name=editfilter value=".WEB_btn_save."></td>";
     print "</tr>";
     print "<tr>";
     print "<td align=left><input type=text name=f_name value='".$filter['name']."'></td>";
-    print "<td ><input type=text name=f_comment value='".$filter['comment']."'></td>";
+    print "<td ><input type=text name=f_description value='".$filter['description']."'></td>";
     print "<td ><input type=text name=f_dst value='".$filter['dst']."'></td>";
     print "</tr>";
     print "</table>";

+ 5 - 5
html/admin/filters/editgroup.php

@@ -6,7 +6,7 @@ require_once($_SERVER['DOCUMENT_ROOT'] . "/inc/idfilter.php");
 if (isset($_POST["editgroup"])) {
     $new['group_name'] = $_POST["f_group_name"];
     $new['instance_id'] = $_POST["f_instance_id"]*1;
-    $new['comment'] = $_POST["f_group_comment"];
+    $new['description'] = $_POST["f_group_description"];
     update_record($db_link, "group_list", "id='$id'", $new);
     header("Location: " . $_SERVER["REQUEST_URI"]);
     exit;
@@ -85,8 +85,8 @@ require_once($_SERVER['DOCUMENT_ROOT'] . "/inc/header.php");
                 <td class='data' align=right><input type="submit" name="editgroup" value="<?php echo WEB_btn_save; ?>"></td>
             </tr>
             <tr>
-                <td><?php echo WEB_cell_comment; ?></td>
-                <td class='data'><input type="text" name="f_group_comment" value="<?php echo $group['comment']; ?>"></td>
+                <td><?php echo WEB_cell_description; ?></td>
+                <td class='data'><input type="text" name="f_group_description" value="<?php echo $group['description']; ?>"></td>
                 <td class='data'></td>
             </tr>
             <tr>
@@ -107,7 +107,7 @@ require_once($_SERVER['DOCUMENT_ROOT'] . "/inc/header.php");
             </tr>
 
             <?php
-            $sSQL = "SELECT G.id, G.filter_id, F.name, G.order, G.action, F.comment FROM group_filters G, filter_list F WHERE F.id=G.filter_id and group_id=$id Order by G.order";
+            $sSQL = "SELECT G.id, G.filter_id, F.name, G.order, G.action, F.description FROM group_filters G, filter_list F WHERE F.id=G.filter_id and group_id=$id Order by G.order";
             $flist = get_records_sql($db_link, $sSQL);
             foreach ($flist as $row) {
                 print "<tr align=center>\n";
@@ -123,7 +123,7 @@ require_once($_SERVER['DOCUMENT_ROOT'] . "/inc/header.php");
                 print "<td class=" . $cl . ">";
                 print_action_select('f_action[' . $row['id'] . ']', $row['action']);
                 print "</td>";
-                print "<td colspan=2 class=\"data\" align=left>" . $row['comment'] . "</a></td>\n";
+                print "<td colspan=2 class=\"data\" align=left>" . $row['description'] . "</a></td>\n";
                 print "</tr>";
             }
             ?>

+ 2 - 2
html/admin/filters/groups.php

@@ -40,7 +40,7 @@ print_filters_submenu($page_url);
                 <td><b>Id</b></td>
                 <td width=200><b><?php echo WEB_cell_name; ?></b></td>
                 <td ><b><?php echo WEB_submenu_filter_instance; ?></b></td>
-                <td width=200><b><?php echo WEB_cell_comment; ?></b></td>
+                <td width=200><b><?php echo WEB_cell_description; ?></b></td>
                 <td><input type="submit" onclick="return confirm('<?php echo WEB_msg_delete; ?>?')" name="remove" value="<?php echo WEB_btn_delete; ?>"></td>
             </tr>
             <?php
@@ -52,7 +52,7 @@ print_filters_submenu($page_url);
                 print "<td class=\"data\" ><input type=\"hidden\" name=\"" . $row["id"] . "\" value=" . $row["id"] . ">" . $row["id"] . "</td>\n";
                 print "<td class=\"data\"><a href=editgroup.php?id=" . $row["id"] . ">" . $row["group_name"] . "</a></td>\n";
                 print "<td class=\"data\">". $filter_instance["name"]."</td>\n";
-                print "<td class=\"data\">" . $row["comment"] . "</td>\n";
+                print "<td class=\"data\">" . $row["description"] . "</td>\n";
                 print "<td></td></tr>";
             }
             ?>

+ 5 - 5
html/admin/filters/index.php

@@ -44,7 +44,7 @@ print_filters_submenu($page_url);
                 <td><b><?php echo WEB_traffic_dest_address; ?></b></td>
                 <td><b><?php echo WEB_traffic_dst_port; ?></b></td>
                 <td><b><?php echo WEB_traffic_src_port; ?></b></td>
-                <td><b><?php echo WEB_cell_comment; ?></b></td>
+                <td><b><?php echo WEB_cell_description; ?></b></td>
                 <td><input type="submit" onclick="return confirm('<?php echo WEB_msg_delete; ?>?')" name="remove" value="<?php echo WEB_btn_delete; ?>"></td>
             </tr>
             <?php
@@ -54,8 +54,8 @@ print_filters_submenu($page_url);
                 print "<td class=\"data\" style='padding:0'><input type=checkbox name=fid[] value=" . $row['id'] . "></td>\n";
                 print "<td class=\"data\" ><input type=hidden name=\"id\" value=" . $row['id'] . ">" . $row['id'] . "</td>\n";
                 print "<td class=\"data\" align=left><a href=editfilter.php?id=" . $row['id'] . ">" . $row['name'] . "</a></td>\n";
-                if (empty($row['comment'])) {
-                    $row['comment'] = '';
+                if (empty($row['description'])) {
+                    $row['description'] = '';
                 }
                 if (empty($row['proto'])) {
                     $row['proto'] = '';
@@ -75,14 +75,14 @@ print_filters_submenu($page_url);
                     print "<td class=\"data\">" . $row['dst'] . "</td>\n";
                     print "<td class=\"data\">" . $row['dstport'] . "</td>\n";
                     print "<td class=\"data\">" . $row['srcport'] . "</td>\n";
-                    print "<td class=\"data\">" . $row['comment'] . "</td>\n";
+                    print "<td class=\"data\">" . $row['description'] . "</td>\n";
                 } else {
                     print "<td class=\"data\">Name фильтр</td>\n";
                     print "<td class=\"data\"></td>\n";
                     print "<td class=\"data\">" . $row['dst'] . "</td>\n";
                     print "<td class=\"data\"></td>\n";
                     print "<td class=\"data\"></td>\n";
-                    print "<td class=\"data\">" . $row['comment'] . "</td>\n";
+                    print "<td class=\"data\">" . $row['description'] . "</td>\n";
                 }
                 print "<td></td></tr>";
             }

+ 4 - 4
html/admin/filters/instances.php

@@ -11,7 +11,7 @@ if (isset($_POST['save'])) {
             if (intval($_POST['r_id'][$j]) != $save_id) { continue; }
             $id = intval($_POST['r_id'][$j]);
             $new['name'] = trim($_POST['f_name'][$j]);
-            $new['comment'] = trim($_POST['f_comment'][$j]);
+            $new['description'] = trim($_POST['f_description'][$j]);
             update_record($db_link, "filter_instances", "id='$id'", $new);
         }
     }
@@ -34,7 +34,7 @@ if (isset($_POST["remove"])) {
     for ($i = 0; $i < $len; $i ++) {
         $id = intval($_POST['r_id'][$i]);
         if (!empty($id) and $id>1) {
-	    $deleted_groups = get_records_sql($db_link,"SELECT * FROM group_list WHERE `instance_id`>1 AND `instance_id`=".$id);
+	    $deleted_groups = get_records_sql($db_link,"SELECT * FROM group_list WHERE instance_id>1 AND instance_id=".$id);
 	    foreach ($deleted_groups as $d_group) {
 	        run_sql($db_link, "UPDATE user_auth SET filter_group_id=0, changed = 1 WHERE deleted=0 AND filter_group_id=" . $d_group['id']);
 		delete_record($db_link, "group_list", "id=" . $d_group['id']);
@@ -57,7 +57,7 @@ print_filters_submenu($page_url);
 	<td><input type="checkbox" onClick="checkAll(this.checked);"></td>
 	<td><b>Id</b></td>
 	<td><b><?php echo WEB_group_instance_name; ?></b></td>
-	<td><b><?php echo WEB_cell_comment; ?></b></td>
+	<td><b><?php echo WEB_cell_description; ?></b></td>
 	<td><input type="submit" onclick="return confirm('<?php echo WEB_msg_delete; ?>?')" name="remove" value="<?php echo WEB_btn_delete; ?>"></td>
         <?php print "<td><input type=\"submit\" name=\"save\" value='".WEB_btn_save."'></td>"; ?>
 </tr>
@@ -68,7 +68,7 @@ foreach ($t_instance as $row) {
     print "<td class=\"data\" style='padding:0'><input type=checkbox name=f_id[] value='".$row['id']."'></td>";
     print "<td class=\"data\"><input type=\"hidden\" name='r_id[]' value='".$row['id']."'>".$row['id']."</td>";
     print "<td class=\"data\"><input type=\"text\" name='f_name[]' value='".$row['name']."'></td>";
-    print "<td class=\"data\"><input type=\"text\" name='f_comment[]' value='".$row['comment']."'></td>";
+    print "<td class=\"data\"><input type=\"text\" name='f_description[]' value='".$row['description']."'></td>";
     print "<td colspan=2 class=\"data\"></td>";
     print "</tr>";
 }

+ 3 - 3
html/admin/groups/edit_group.php

@@ -47,7 +47,7 @@ if (isset($_POST['s_save'])) {
             if (intval($_POST['n_id'][$j]) != $save_id) { continue; }
             $new['type'] = $_POST['s_type'][$j];
             $new['rule'] = trim($_POST['s_rule'][$j]);
-            $new['comment'] = trim($_POST['s_comment'][$j]);
+            $new['description'] = trim($_POST['s_description'][$j]);
             update_record($db_link, "auth_rules", "id='{$save_id}'", $new);
         }
     }
@@ -130,7 +130,7 @@ if (!$ou_info['dynamic']) { print "disabled"; }; print " style=\"width:35%;\" ><
     <td width=30><b>id</b></td>
     <td><b><?php echo WEB_cell_type; ?></b></td>
     <td><b><?php echo WEB_ou_rule; ?></b></td>
-    <td><b><?php echo WEB_cell_comment; ?></b></td>
+    <td><b><?php echo WEB_cell_description; ?></b></td>
     <td><input type="submit" onclick="return confirm('<?php echo WEB_msg_delete; ?>?')" name="s_remove" value="<?php echo WEB_btn_delete; ?>"></td>
     <?php print "<td><button id='s_save' name='s_save'>".WEB_btn_save."</button></td>"; ?>
 </tr>
@@ -142,7 +142,7 @@ foreach ( $t_auth_rules as $row ) {
     print "<td class=\"data\"><input type=\"hidden\" name='n_id[]' value='{$row['id']}'>{$row['id']}</td>\n";
     print "<td class=\"data\">"; print_qa_rule_select("s_type[]","{$row['type']}"); print "</td>\n";
     print "<td class=\"data\"><input type=\"text\" name='s_rule[]' value='{$row['rule']}'></td>\n";
-    print "<td class=\"data\"><input type=\"text\" name='s_comment[]' value='{$row['comment']}'></td>\n";
+    print "<td class=\"data\"><input type=\"text\" name='s_description[]' value='{$row['description']}'></td>\n";
     print "<td colspan=2 class=\"data\"></td>\n";
     print "</tr>\n";
 }

+ 4 - 4
html/admin/iplist/auto_rules.php

@@ -50,10 +50,10 @@ if ($rule_target>0) {
     }
 
 $type_filter='';
-if ($rule_type>0) { $type_filter = ' AND `type`='.$rule_type; }
+if ($rule_type>0) { $type_filter = ' AND type='.$rule_type; }
 
 $rule_filter='';
-if (!empty($f_rule)) { $rule_filter = ' AND `rule` LIKE "'.$f_rule.'%"'; }
+if (!empty($f_rule)) { $rule_filter = ' AND rule LIKE "'.$f_rule.'%"'; }
 
 $rule_filters = '';
 if (!empty($target_filter) or !empty($type_filter) or !empty($rule_filter)) {
@@ -77,7 +77,7 @@ print_navigation($page_url,$page,$displayed,$count_records,$total);
 <td><b><?php echo WEB_cell_type; ?></b></td>
 <td><b><?php echo WEB_ou_rule; ?></b></td>
 <td colspan=2><b><?php echo WEB_rules_target; ?></b></td>
-<td><b><?php echo WEB_cell_comment; ?></b></td>
+<td><b><?php echo WEB_cell_description; ?></b></td>
 <td align=right><input type="submit" onclick="return confirm('<?php echo WEB_msg_delete; ?>?')" name="removeRule" value="<?php echo WEB_btn_delete; ?>"></td>
 </tr>
 <?php
@@ -102,7 +102,7 @@ foreach ( $t_auth_rules as $row ) {
 	if (!empty($ou_info)) { print "Group: &nbsp"; print_url($ou_info['ou_name'],'/admin/groups/edit_group.php?id='.$ou_info['id']); }
 	}
     print "</td>";
-    print "<td class=\"data\" colspan=2>".$row['comment']."</td>\n";
+    print "<td class=\"data\" colspan=2>".$row['description']."</td>\n";
     print "</tr>\n";
 }
 ?>

+ 14 - 14
html/admin/iplist/deleted.php

@@ -10,12 +10,12 @@ require_once ($_SERVER['DOCUMENT_ROOT']."/inc/sortfilter.php");
 require_once ($_SERVER['DOCUMENT_ROOT']."/inc/gatefilter.php");
 require_once ($_SERVER['DOCUMENT_ROOT']."/inc/enabledfilter.php");
 
-if (isset($_POST['searchComment'])) { $f_comment = $_POST['searchComment']; }
-if (isset($_GET['searchComment'])) { $f_comment = $_GET['searchComment']; }
-if (!isset($f_comment) and isset($_SESSION[$page_url]['comment'])) { $f_comment=$_SESSION[$page_url]['comment']; }
-if (!isset($f_comment)) { $f_comment=''; }
+if (isset($_POST['searchDescription'])) { $f_description = $_POST['searchDescription']; }
+if (isset($_GET['searchDescription'])) { $f_description = $_GET['searchDescription']; }
+if (!isset($f_description) and isset($_SESSION[$page_url]['description'])) { $f_description=$_SESSION[$page_url]['description']; }
+if (!isset($f_description)) { $f_description=''; }
 
-$_SESSION[$page_url]['comment']=$f_comment;
+$_SESSION[$page_url]['description']=$f_description;
 
 $sort_table = 'user_auth';
 
@@ -29,10 +29,10 @@ if ($rsubnet == 0) { $subnet_filter = ''; } else {
 $ip_list_filter = $subnet_filter;
 
 $ip_where = '';
-if (!empty($f_comment)) {
-    if (checkValidIp($f_comment)) { $ip_where = " and ip_int=inet_aton('" . $f_comment . "') "; }
-    if (checkValidMac($f_comment)) { $ip_where = " and mac='" . mac_dotted($f_comment) . "'  "; }
-    if (empty($ip_where)) { $ip_where=" and (user_auth.comments LIKE '$f_comment' OR user_auth.dhcp_hostname LIKE '$f_comment')"; }
+if (!empty($f_description)) {
+    if (checkValidIp($f_description)) { $ip_where = " and ip_int=inet_aton('" . $f_description . "') "; }
+    if (checkValidMac($f_description)) { $ip_where = " and mac='" . mac_dotted($f_description) . "'  "; }
+    if (empty($ip_where)) { $ip_where=" and (user_auth.description LIKE '$f_description' OR user_auth.dhcp_hostname LIKE '$f_description')"; }
     $ip_list_filter = $ip_where;
     } 
 
@@ -44,7 +44,7 @@ print_ip_submenu($page_url);
 <br>
 <div>
         <b><?php print WEB_network_subnet; ?> - </b><?php print_subnet_select_office($db_link, 'subnet', $rsubnet); ?>
-        <?php echo WEB_ips_search_full; ?>: &nbsp <input type=text name=searchComment value="<?php print $f_comment; ?>">
+        <?php echo WEB_ips_search_full; ?>: &nbsp <input type=text name=searchDescription value="<?php print $f_description; ?>">
         <?php print WEB_rows_at_page."&nbsp"; print_row_at_pages('rows',$displayed); ?>
         <input type="submit" value="<?php echo WEB_btn_show; ?>">
 </div>
@@ -64,7 +64,7 @@ print_navigation($page_url,$page,$displayed,$count_records,$total);
 	<tr>
 		<td align=Center><?php print $sort_url . "sort=ip_int&order=$new_order>" . WEB_cell_ip . "</a>"; ?></td>
 		<td align=Center><?php print $sort_url . "sort=mac&order=$new_order>" . WEB_cell_mac . "</a>"; ?></td>
-		<td align=Center><?php print WEB_cell_comment; ?></td>
+		<td align=Center><?php print WEB_cell_description; ?></td>
 		<td align=Center><?php print WEB_cell_dns_name; ?></td>
 		<td align=Center><?php print $sort_url . "sort=timestamp&order=$new_order>".WEB_cell_created."</a>"; ?></td>
 		<td align=Center><?php print $sort_url . "sort=changed_time&order=$new_order>".WEB_cell_deleted."</a>"; ?></td>
@@ -73,7 +73,7 @@ print_navigation($page_url,$page,$displayed,$count_records,$total);
 <?php
 
 $sSQL = "SELECT 
-user_auth.id, user_auth.ip, user_auth.mac, user_auth.comments, user_auth.dns_name, user_auth.dhcp_hostname, 
+user_auth.id, user_auth.ip, user_auth.mac, user_auth.description, user_auth.dns_name, user_auth.dhcp_hostname, 
 user_auth.dhcp_time, user_auth.last_found, user_auth.timestamp, user_auth.changed_time
 FROM user_auth WHERE user_auth.deleted = 1 $ip_list_filter
 ORDER BY $sort_table.$sort_field $order LIMIT $start,$displayed";
@@ -87,9 +87,9 @@ foreach ($users as $user) {
     print "<td class=\"$cl\" ><a href=/admin/users/editauth.php?id=".$user['id'].">" . $user['ip'] . "</a></td>\n";
     print "<td class=\"$cl\" >" . expand_mac($db_link,$user['mac']) . "</td>\n";
     if (isset($user['dhcp_hostname']) and strlen($user['dhcp_hostname']) > 0) {
-        print "<td class=\"$cl\" >".$user['comments']." [" . $user['dhcp_hostname'] . "]</td>\n";
+        print "<td class=\"$cl\" >".$user['description']." [" . $user['dhcp_hostname'] . "]</td>\n";
     } else {
-        print "<td class=\"$cl\" >".$user['comments']."</td>\n";
+        print "<td class=\"$cl\" >".$user['description']."</td>\n";
     }
     print "<td class=\"$cl\" >".$user['dns_name']."</td>\n";
     print "<td class=\"$cl\" >".$user['timestamp']."</td>\n";

+ 5 - 5
html/admin/iplist/doubles.php

@@ -33,7 +33,7 @@ if (empty($rcidr)) { $cidr_filter = ''; } else {
     <td align=Center><?php print WEB_cell_login; ?></td>
     <td align=Center><?php print WEB_cell_ip; ?></td>
     <td align=Center><?php print WEB_cell_mac ; ?></td>
-    <td align=Center><?php print WEB_cell_comment; ?></td>
+    <td align=Center><?php print WEB_cell_description; ?></td>
     <td align=Center><?php print WEB_cell_dns_name; ?></td>
     <td align=Center><?php print WEB_cell_created; ?></td>
     <td align=Center><?php print WEB_cell_last_found; ?></td>
@@ -81,9 +81,9 @@ foreach ($users as $row) {
             print "<td class=\"$cl\" ><a href=/admin/users/editauth.php?id=".$user['id'].">" . $user['ip'] . "</a></td>\n";
             print "<td class=\"$cl\" >" . expand_mac($db_link,$user['mac']) . "</td>\n";
             if (isset($user['dhcp_hostname']) and strlen($user['dhcp_hostname']) > 0) {
-                print "<td class=\"$cl\" >".$user['comments']." [" . $user['dhcp_hostname'] . "]</td>\n";
+                print "<td class=\"$cl\" >".$user['description']." [" . $user['dhcp_hostname'] . "]</td>\n";
                 } else {
-                print "<td class=\"$cl\" >".$user['comments']."</td>\n";
+                print "<td class=\"$cl\" >".$user['description']."</td>\n";
                 }
             print "<td class=\"$cl\" >".$user['dns_name']."</td>\n";
             print "<td class=\"$cl\" >".$user['timestamp']."</td>\n";
@@ -107,9 +107,9 @@ foreach ($users as $row) {
             print "<td class=\"$cl\" ><a href=/admin/users/editauth.php?id=".$user['id'].">" . $user['ip'] . "</a></td>\n";
             print "<td class=\"$cl\" >" . expand_mac($db_link,$user['mac']) . "</td>\n";
             if (isset($user['dhcp_hostname']) and strlen($user['dhcp_hostname']) > 0) {
-                print "<td class=\"$cl\" >".$user['comments']." [" . $user['dhcp_hostname'] . "]</td>\n";
+                print "<td class=\"$cl\" >".$user['description']." [" . $user['dhcp_hostname'] . "]</td>\n";
                 } else {
-                print "<td class=\"$cl\" >".$user['comments']."</td>\n";
+                print "<td class=\"$cl\" >".$user['description']."</td>\n";
                 }
             print "<td class=\"$cl\" >".$user['dns_name']."</td>\n";
             print "<td class=\"$cl\" >".$user['timestamp']."</td>\n";

+ 4 - 4
html/admin/iplist/index.php

@@ -72,7 +72,7 @@ if (!empty($f_search_str)) {
         } 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) . "%' or login like '".$f_search."%' or comments like '".$f_search."%' or dns_name like '".$f_search."%' or dhcp_hostname like '".$f_search."%')"; 
+            $ip_where =" and (mac like '" . mac_dotted($f_search) . "%' or login like '".$f_search."%' or description like '".$f_search."%' or dns_name like '".$f_search."%' or dhcp_hostname like '".$f_search."%')"; 
             }
         }
     }
@@ -204,7 +204,7 @@ print_navigation($page_url,$page,$displayed,$count_records,$total);
                 <td align=Center><?php print $sort_url . "&sort=login&order=$new_order>" . WEB_cell_login . "</a>"; ?></td>
                 <td align=Center><?php print $sort_url . "&sort=ip_int&order=$new_order>" . WEB_cell_ip . "</a>"; ?></td>
                 <td align=Center><?php print $sort_url . "&sort=mac&order=$new_order>" . WEB_cell_mac . "</a>"; ?></td>
-                <td align=Center><?php print WEB_cell_comment; ?></td>
+                <td align=Center><?php print WEB_cell_description; ?></td>
                 <td align=Center><?php print WEB_cell_dns_name; ?></td>
                 <td align=Center><?php print WEB_cell_filter; ?></td>
                 <td align=Center><?php print WEB_cell_shaper; ?></td>
@@ -246,9 +246,9 @@ foreach ($users as $user) {
     print "<td class=\"$cl\" ><a href=/admin/users/editauth.php?id=".$user['id'].">" . $user['ip'] . "</a></td>\n";
     print "<td class=\"$cl\" >" . expand_mac($db_link,$user['mac']) . "</td>\n";
     if (isset($user['dhcp_hostname']) and strlen($user['dhcp_hostname']) > 0) {
-        print "<td class=\"$cl\" width=200 >".$user['comments']." [" . $user['dhcp_hostname'] . "]</td>\n";
+        print "<td class=\"$cl\" width=200 >".$user['description']." [" . $user['dhcp_hostname'] . "]</td>\n";
     } else {
-        print "<td class=\"$cl\" width=200 >".$user['comments']."</td>\n";
+        print "<td class=\"$cl\" width=200 >".$user['description']."</td>\n";
     }
     print "<td class=\"$cl\" >".$user['dns_name']."</td>\n";
     print "<td class=\"$cl\" >" . get_group($db_link, $user['filter_group_id']) . "</td>\n";

+ 3 - 3
html/admin/iplist/nagios.php

@@ -85,7 +85,7 @@ print_navigation($page_url,$page,$displayed,$count_records,$total);
 		<td align=Center><?php print $sort_url . "&sort=login&order=$new_order>" . WEB_cell_login . "</a>"; ?></td>
 		<td align=Center><?php print $sort_url . "&sort=ip_int&order=$new_order>" . WEB_cell_ip . "</a>"; ?></td>
 		<td align=Center><?php print $sort_url . "&sort=mac&order=$new_order>" . WEB_cell_mac . "</a>"; ?></td>
-		<td align=Center><?php print WEB_cell_comment; ?></td>
+		<td align=Center><?php print WEB_cell_description; ?></td>
 		<td align=Center><?php print WEB_cell_wikiname; ?></td>
 		<td align=Center><?php print $sort_url . "&sort=nagios&order=$new_order>" . WEB_cell_nagios; ?></td>
 		<td align=Center><?php print $sort_url . "&sort=link_check&order=$new_order>" . WEB_cell_link; ?></td>
@@ -118,9 +118,9 @@ foreach ($users as $user) {
     print "<td class=\"$cl\" ><a href=/admin/users/editauth.php?id=".$user['id'].">" . $user['ip'] . "</a></td>\n";
     print "<td class=\"$cl\" >" . expand_mac($db_link,$user['mac']) . "</td>\n";
     if (isset($user['dhcp_hostname']) and strlen($user['dhcp_hostname']) > 0) {
-        print "<td class=\"$cl\" width=200>".$user['comments']." [" . $user['dhcp_hostname'] . "]</td>\n";
+        print "<td class=\"$cl\" width=200>".$user['description']." [" . $user['dhcp_hostname'] . "]</td>\n";
     } else {
-        print "<td class=\"$cl\" width=200>".$user['comments']."</td>\n";
+        print "<td class=\"$cl\" width=200>".$user['description']."</td>\n";
     }
     if (!empty($user['WikiName'])) {
         $wiki_url = rtrim(get_option($db_link, 60),'/');

+ 6 - 6
html/admin/logs/authlog.php

@@ -23,17 +23,17 @@ if (!isset($auth_id)) { header('Location: /admin/logs/index.php', true, 301); ex
 <?php
 $log_filter ='';
 
-if ($display_log_level == L_ERROR) { $log_filter = " and `level`=". L_ERROR." "; }
-if ($display_log_level == L_WARNING) { $log_filter = " and `level`<=".L_WARNING." "; }
-if ($display_log_level == L_INFO) { $log_filter = " and `level`<=".L_INFO." "; }
-if ($display_log_level == L_VERBOSE) { $log_filter = " and `level`<=".L_VERBOSE." "; }
+if ($display_log_level == L_ERROR) { $log_filter = " and level=". L_ERROR." "; }
+if ($display_log_level == L_WARNING) { $log_filter = " and level<=".L_WARNING." "; }
+if ($display_log_level == L_INFO) { $log_filter = " and level<=".L_INFO." "; }
+if ($display_log_level == L_VERBOSE) { $log_filter = " and level<=".L_VERBOSE." "; }
 if ($display_log_level == L_DEBUG) { $log_filter = ""; }
 
 if (!empty($log_filter)) { $log_filter = $log_filter." and auth_id=".$auth_id; } else { $log_filter = " and auth_id=".$auth_id; }
 if (!empty($fcustomer)) { $log_filter = $log_filter." and customer LIKE '%".$fcustomer."%'"; }
 if (!empty($fmessage)) { $log_filter = $log_filter." and message LIKE '%".$fmessage."%'"; }
 
-$countSQL="SELECT Count(*) FROM worklog WHERE `timestamp`>='$date1' AND `timestamp`<'$date2' $log_filter";
+$countSQL="SELECT Count(*) FROM worklog WHERE timestamp>='$date1' AND timestamp<'$date2' $log_filter";
 $count_records = get_single_field($db_link,$countSQL);
 $total=ceil($count_records/$displayed);
 if ($page>$total) { $page=$total; }
@@ -51,7 +51,7 @@ print_navigation($page_url,$page,$displayed,$count_records,$total);
 	</tr>
 <?php
 #speedup paging
-$sSQL = "SELECT timestamp,customer,message,level FROM worklog as S JOIN (SELECT id FROM worklog WHERE `timestamp`>='$date1' AND `timestamp`<'$date2' $log_filter ORDER BY id DESC LIMIT $start,$displayed) AS I ON S.id = I.id";
+$sSQL = "SELECT timestamp,customer,message,level FROM worklog as S JOIN (SELECT id FROM worklog WHERE timestamp>='$date1' AND timestamp<'$date2' $log_filter ORDER BY id DESC LIMIT $start,$displayed) AS I ON S.id = I.id";
 $userlog = get_records_sql($db_link, $sSQL);
 foreach ($userlog as $row) {
     print "<tr align=center class=\"tr1\" onmouseover=\"className='tr2'\" onmouseout=\"className='tr1'\">\n";

+ 4 - 4
html/admin/logs/detaillog.php

@@ -59,7 +59,7 @@ if (!empty($f_ip)) { $sort_url .='&f_ip="'.$f_ip.'"'; }
 $gateway_filter='';
 if (!empty($rgateway) and $rgateway>0) { $gateway_filter="(router_id=$rgateway) AND"; }
 
-$countSQL="SELECT Count(*) FROM traffic_detail as A WHERE $gateway_filter $ip_where `timestamp`>='$date1' AND `timestamp`<'$date2'";
+$countSQL="SELECT Count(*) FROM traffic_detail as A WHERE $gateway_filter $ip_where timestamp>='$date1' AND timestamp<'$date2'";
 $count_records = get_single_field($db_link,$countSQL);
 $total=ceil($count_records/$displayed);
 if ($page>$total) { $page=$total; }
@@ -87,9 +87,9 @@ $gateway_list = get_gateways($db_link);
 <td class="data" width=80><b><?php $url = $sort_url.'&sort=pkt&order='.$new_order."'>Pkt</a>"; print $url; ?></b></td>
 </tr>
 <?php
-$fsql = "SELECT A.id, A.auth_id, A.`timestamp`, A.router_id, A.proto, A.src_ip, A.src_port, A.dst_ip, A.dst_port, A.bytes, A.pkt FROM traffic_detail as A JOIN (SELECT id FROM traffic_detail 
-        WHERE $gateway_filter $ip_where `timestamp`>='$date1' AND `timestamp`<'$date2'
-        ORDER BY `timestamp` ASC LIMIT $start,$displayed) as T ON A.id = T.id ORDER BY $sort_table.$sort_field $order";
+$fsql = "SELECT A.id, A.auth_id, A.timestamp, A.router_id, A.proto, A.src_ip, A.src_port, A.dst_ip, A.dst_port, A.bytes, A.pkt FROM traffic_detail as A JOIN (SELECT id FROM traffic_detail 
+        WHERE $gateway_filter $ip_where timestamp>='$date1' AND timestamp<'$date2'
+        ORDER BY timestamp ASC LIMIT $start,$displayed) as T ON A.id = T.id ORDER BY $sort_table.$sort_field $order";
 $userdata = get_records_sql($db_link, $fsql);
 foreach ($userdata as $row) {
     print "<tr align=center class=\"tr1\" onmouseover=\"className='tr2'\" onmouseout=\"className='tr1'\">\n";

+ 2 - 2
html/admin/logs/dhcp.php

@@ -56,7 +56,7 @@ print_log_submenu($page_url);
 </form>
 
 <?php
-$countSQL="SELECT Count(*) FROM dhcp_log WHERE `timestamp`>='$date1' AND `timestamp`<'$date2' $dhcp_where";
+$countSQL="SELECT Count(*) FROM dhcp_log WHERE timestamp>='$date1' AND timestamp<'$date2' $dhcp_where";
 $count_records = get_single_field($db_link,$countSQL);
 $total=ceil($count_records/$displayed);
 if ($page>$total) { $page=$total; }
@@ -77,7 +77,7 @@ print_navigation($page_url,$page,$displayed,$count_records,$total);
 <?php
 
 #speedup dhcp log paging
-$sSQL = "SELECT * FROM dhcp_log as D JOIN (SELECT id FROM dhcp_log WHERE `timestamp`>='$date1' and `timestamp`<'$date2' $dhcp_where ORDER BY `id` DESC LIMIT $start,$displayed) AS I ON D.id = I.id";
+$sSQL = "SELECT * FROM dhcp_log as D JOIN (SELECT id FROM dhcp_log WHERE timestamp>='$date1' and timestamp<'$date2' $dhcp_where ORDER BY id DESC LIMIT $start,$displayed) AS I ON D.id = I.id";
 $userlog = get_records_sql($db_link, $sSQL);
 
 foreach ($userlog as $row) {

+ 6 - 6
html/admin/logs/index.php

@@ -29,17 +29,17 @@ print_log_submenu($page_url);
 <?php
 $log_filter ='';
 
-if ($display_log_level == L_ERROR) { $log_filter = " and `level`=". L_ERROR." "; }
-if ($display_log_level == L_WARNING) { $log_filter = " and `level`<=".L_WARNING." "; }
-if ($display_log_level == L_INFO) { $log_filter = " and `level`<=".L_INFO." "; }
-if ($display_log_level == L_VERBOSE) { $log_filter = " and `level`<=".L_VERBOSE." "; }
+if ($display_log_level == L_ERROR) { $log_filter = " and level=". L_ERROR." "; }
+if ($display_log_level == L_WARNING) { $log_filter = " and level<=".L_WARNING." "; }
+if ($display_log_level == L_INFO) { $log_filter = " and level<=".L_INFO." "; }
+if ($display_log_level == L_VERBOSE) { $log_filter = " and level<=".L_VERBOSE." "; }
 if ($display_log_level == L_DEBUG) { $log_filter = ""; }
 
 if (!empty($fcustomer)) { $log_filter = $log_filter." and customer LIKE '".$fcustomer."'"; }
 if (!empty($fmessage)) { $log_filter = $log_filter." and message LIKE '".$fmessage."'"; }
 if (!empty($fuser_ip)) { $log_filter = $log_filter." and ip LIKE '".$fuser_ip."'"; }
 
-$countSQL="SELECT Count(*) FROM worklog WHERE `timestamp`>='$date1' AND `timestamp`<'$date2' $log_filter";
+$countSQL="SELECT Count(*) FROM worklog WHERE timestamp>='$date1' AND timestamp<'$date2' $log_filter";
 $count_records = get_single_field($db_link,$countSQL);
 $total=ceil($count_records/$displayed);
 if ($page>$total) { $page=$total; }
@@ -48,7 +48,7 @@ $start = ($page * $displayed) - $displayed;
 print_navigation($page_url,$page,$displayed,$count_records,$total);
 
 #speedup paging
-$sSQL = "SELECT * FROM (SELECT * FROM worklog WHERE `timestamp`>='$date1' AND `timestamp`<'$date2' $log_filter ) AS W ORDER BY timestamp DESC LIMIT $start,$displayed";
+$sSQL = "SELECT * FROM (SELECT * FROM worklog WHERE timestamp>='$date1' AND timestamp<'$date2' $log_filter ) AS W ORDER BY timestamp DESC LIMIT $start,$displayed";
 
 ?>
 <br>

+ 2 - 2
html/admin/logs/ip.php

@@ -31,7 +31,7 @@ if (!empty($f_ip)) {
 </form>
 
 <?php
-$countSQL="SELECT Count(*) FROM user_auth WHERE `timestamp`>='$date1' AND `timestamp`<'$date2' $ip_where";
+$countSQL="SELECT Count(*) FROM user_auth WHERE timestamp>='$date1' AND timestamp<'$date2' $ip_where";
 $count_records = get_single_field($db_link,$countSQL);
 $total=ceil($count_records/$displayed);
 if ($page>$total) { $page=$total; }
@@ -53,7 +53,7 @@ print_navigation($page_url,$page,$displayed,$count_records,$total);
 
 <?php
 
-$sSQL = "SELECT * FROM user_auth WHERE `timestamp`>='$date1' AND `timestamp`<'$date2' $ip_where ORDER BY id DESC LIMIT $start,$displayed";
+$sSQL = "SELECT * FROM user_auth WHERE timestamp>='$date1' AND timestamp<'$date2' $ip_where ORDER BY id DESC LIMIT $start,$displayed";
 
 $iplog = get_records_sql($db_link, $sSQL);
 foreach ($iplog as $row) {

+ 2 - 2
html/admin/logs/mac.php

@@ -27,7 +27,7 @@ print_log_submenu($page_url);
 </form>
 
 <?php
-$countSQL="SELECT Count(*) FROM mac_history WHERE `timestamp`>='$date1' AND `timestamp`<'$date2' $mac_where ORDER BY id DESC";
+$countSQL="SELECT Count(*) FROM mac_history WHERE timestamp>='$date1' AND timestamp<'$date2' $mac_where ORDER BY id DESC";
 $count_records = get_single_field($db_link,$countSQL);
 $total=ceil($count_records/$displayed);
 if ($page>$total) { $page=$total; }
@@ -46,7 +46,7 @@ print_navigation($page_url,$page,$displayed,$count_records,$total);
 
 <?php
 
-$sSQL = "SELECT * FROM mac_history WHERE `timestamp`>='$date1' AND `timestamp`<'$date2' $mac_where ORDER BY `timestamp` DESC LIMIT $start,$displayed";
+$sSQL = "SELECT * FROM mac_history WHERE timestamp>='$date1' AND timestamp<'$date2' $mac_where ORDER BY timestamp DESC LIMIT $start,$displayed";
 $maclog = get_records_sql($db_link, $sSQL);
 
 foreach ($maclog as $row) {

+ 4 - 4
html/admin/logs/syslog.php

@@ -19,7 +19,7 @@ $log_filter = "";
 
 if ($f_id>0) {
     $dev_ips=get_device_ips($db_link,$f_id);
-    $log_filter=' and `ip` IN (';
+    $log_filter=' and ip IN (';
     foreach ($dev_ips as $index => $ip) {
 	$log_filter=$log_filter."'".$ip."',";
         }
@@ -40,9 +40,9 @@ if ($f_id>0) {
 
 <?php
 
-if (!empty($fmessage)) { $log_filter .= " AND `message` LIKE '%" . addslashes($fmessage) . "%'"; }
+if (!empty($fmessage)) { $log_filter .= " AND message LIKE '%" . addslashes($fmessage) . "%'"; }
 
-$countSQL="SELECT Count(*) FROM `remote_syslog` WHERE `date`>='$date1' AND `date`<'$date2' $log_filter";
+$countSQL="SELECT Count(*) FROM remote_syslog WHERE date>='$date1' AND date<'$date2' $log_filter";
 $count_records = get_single_field($db_link,$countSQL);
 $total=ceil($count_records/$displayed);
 if ($page>$total) { $page=$total; }
@@ -50,7 +50,7 @@ if ($page<1) { $page=1; }
 $start = ($page * $displayed) - $displayed; 
 print_navigation($page_url,$page,$displayed,$count_records,$total);
 #speedup pageing
-$sSQL = "SELECT * FROM (SELECT * FROM `remote_syslog` WHERE `date`>='$date1' AND `date`<'$date2' $log_filter) as R ORDER BY `date` DESC LIMIT $start,$displayed";
+$sSQL = "SELECT * FROM (SELECT * FROM remote_syslog WHERE date>='$date1' AND date<'$date2' $log_filter) as R ORDER BY date DESC LIMIT $start,$displayed";
 ?>
 
 <br>

+ 7 - 7
html/admin/reports/authday.php

@@ -41,7 +41,7 @@ $gateway_filter='';
 if (!empty($rgateway) and $rgateway>0) { $gateway_filter="(router_id=$rgateway) AND"; }
 
 print "<tr align=center class=\"tr1\" onmouseover=\"className='tr2'\" onmouseout=\"className='tr1'\">\n";
-print "<td class=\"data\" colspan=2>".$auth['comments']."</td>\n";
+print "<td class=\"data\" colspan=2>".$auth['description']."</td>\n";
 print "<td class=\"data\" colspan=2><a href=/admin/reports/userdaydetail.php?id=$id&date_start=$date1&date_stop=$date2>TOP 10</a></td>\n";
 print "<td class=\"data\" colspan=2><a href=/admin/reports/userdaydetaillog.php?id=$id&date_start=$date1&date_stop=$date2>".WEB_report_detail."</a></td>\n";
 print "</tr>\n";
@@ -53,14 +53,14 @@ if ($days_shift >1 and $days_shift <=30) { $display_date_format='%Y-%m-%d'; }
 if ($days_shift >30 and $days_shift <=730) { $display_date_format='%Y-%m'; }
 if ($days_shift >730) { $display_date_format='%Y'; }
 
-$sSQL = "SELECT router_id, DATE_FORMAT(`timestamp`,'$display_date_format') as tHour, 
-         SUM(`byte_in`) as byte_in_sum, SUM(`byte_out`) as byte_out_sum,
-         MAX(ROUND(`pkt_in`/`step`)) as pkt_in_max, MAX(ROUND(`pkt_out`/`step`)) as pkt_out_max
-         FROM user_stats_full WHERE `timestamp`>='$date1' AND `timestamp`<'$date2' AND auth_id=$id";
+$sSQL = "SELECT router_id, DATE_FORMAT(timestamp,'$display_date_format') as tHour, 
+         SUM(byte_in) as byte_in_sum, SUM(byte_out) as byte_out_sum,
+         MAX(ROUND(pkt_in/step)) as pkt_in_max, MAX(ROUND(pkt_out/step)) as pkt_out_max
+         FROM user_stats_full WHERE timestamp>='$date1' AND timestamp<'$date2' AND auth_id=$id";
 if ($rgateway == 0) {
-    $sSQL = $sSQL . " GROUP BY DATE_FORMAT(`timestamp`,'$display_date_format'),router_id ORDER BY tHour,router_id";
+    $sSQL = $sSQL . " GROUP BY DATE_FORMAT(timestamp,'$display_date_format'),router_id ORDER BY tHour,router_id";
 } else {
-    $sSQL = $sSQL . " AND router_id=$rgateway GROUP BY DATE_FORMAT(`timestamp`,'$display_date_format'),router_id ORDER BY tHour";
+    $sSQL = $sSQL . " AND router_id=$rgateway GROUP BY DATE_FORMAT(timestamp,'$display_date_format'),router_id ORDER BY tHour";
 }
 
 $userdata = get_records_sql($db_link, $sSQL);

+ 1 - 1
html/admin/reports/index-full.php

@@ -32,7 +32,7 @@ $gateway_list = get_gateways($db_link);
 
 $trafSQL = "SELECT 
 user_list.login,user_list.ou_id,user_auth.user_id, user_auth.ip, user_stats_full.auth_id, 
-user_stats_full.router_id, SUM( byte_in ) AS tin, SUM( byte_out ) AS tout, MAX(ROUND(`pkt_in`/`step`)) as pin, MAX(ROUND(`pkt_out`/`step`)) as pout 
+user_stats_full.router_id, SUM( byte_in ) AS tin, SUM( byte_out ) AS tout, MAX(ROUND(pkt_in/step)) as pin, MAX(ROUND(pkt_out/step)) as pout 
 FROM user_stats_full,user_auth,user_list WHERE user_list.id=user_auth.user_id 
 AND user_stats_full.auth_id = user_auth.id 
 AND user_stats_full.timestamp>='$date1' 

+ 2 - 2
html/admin/reports/userday.php

@@ -37,7 +37,7 @@ $gateway_list = get_gateways($db_link);
 $gateway_filter='';
 if (!empty($rgateway) and $rgateway>0) { $gateway_filter="(user_stats.router_id=$rgateway) AND"; }
 
-$sSQL = "SELECT id,ip,comments FROM user_auth WHERE (user_auth.user_id=$id) Order by IP";
+$sSQL = "SELECT id,ip,description FROM user_auth WHERE (user_auth.user_id=$id) Order by IP";
 $usersip = get_records_sql($db_link, $sSQL);
 
 $ipcount = 0;
@@ -47,7 +47,7 @@ $itog_out = 0;
 foreach ($usersip as $row) {
     $fid = $row["id"];
     $fip = $row["ip"];
-    $fcomm = $row["comments"];
+    $fcomm = $row["description"];
 
     $sSQL = "SELECT SUM(byte_in)+SUM(byte_out) as t_sum FROM user_stats 
     WHERE $gateway_filter user_stats.timestamp>='$date1' AND user_stats.timestamp<'$date2'AND auth_id=$fid";

+ 4 - 4
html/admin/reports/userdaydetail.php

@@ -6,7 +6,7 @@ require_once ($_SERVER['DOCUMENT_ROOT']."/inc/idfilter.php");
 require_once ($_SERVER['DOCUMENT_ROOT']."/inc/datetimefilter.php");
 require_once ($_SERVER['DOCUMENT_ROOT']."/inc/gatefilter.php");
 
-$usersip = get_record_sql($db_link, "SELECT ip,user_id,comments FROM user_auth WHERE user_auth.id=$id");
+$usersip = get_record_sql($db_link, "SELECT ip,user_id,description FROM user_auth WHERE user_auth.id=$id");
 if (empty($usersip)) {
     header("location: /admin/reports/index-full.php");
     exit;
@@ -14,7 +14,7 @@ if (empty($usersip)) {
 
 $fip = $usersip['ip'];
 $parent = $usersip['user_id'];
-$fcomm = $usersip['comments'];
+$fcomm = $usersip['description'];
 
 $rdns = 0;
 if (isset($_POST['dns'])) { $rdns=$_POST['dns']*1; }
@@ -52,7 +52,7 @@ $gateway_filter='';
 if (!empty($rgateway) and $rgateway>0) { $gateway_filter="(router_id=$rgateway) AND"; }
 
 $fsql = "SELECT A.proto, A.src_ip, A.src_port, SUM(A.bytes) as tin FROM traffic_detail A
-            WHERE $gateway_filter (auth_id='$id') and  `timestamp`>='$date1' and `timestamp`<'$date2' and (A.dst_ip='$ip_aton')
+            WHERE $gateway_filter (auth_id='$id') and  timestamp>='$date1' and timestamp<'$date2' and (A.dst_ip='$ip_aton')
             GROUP BY A.src_ip, A.src_port, A.proto ORDER BY tin DESC LIMIT 0,10";
 $userdata = get_records_sql($db_link, $fsql);
 foreach ($userdata as $row) {
@@ -82,7 +82,7 @@ foreach ($userdata as $row) {
 </tr>
 <?php
 $fsql = "SELECT A.proto, A.dst_ip, A.dst_port, SUM(A.bytes) as tout FROM traffic_detail A
-        WHERE $gateway_filter (auth_id='$id') and  `timestamp`>='$date1' and `timestamp`<'$date2' and (A.src_ip='$ip_aton')
+        WHERE $gateway_filter (auth_id='$id') and  timestamp>='$date1' and timestamp<'$date2' and (A.src_ip='$ip_aton')
         GROUP BY A.dst_ip, A.dst_port, A.proto ORDER BY tout DESC LIMIT 0,10";
 $userdata = get_records_sql($db_link, $fsql);
 foreach ($userdata as $row) {

+ 6 - 6
html/admin/reports/userdaydetaillog.php

@@ -17,7 +17,7 @@ if ($rdns) { $dns_checked='checked="checked"'; }
 
 $dns_cache=NULL;
 
-$usersip = get_record_sql($db_link, "SELECT ip,user_id,comments FROM user_auth WHERE user_auth.id=$id");
+$usersip = get_record_sql($db_link, "SELECT ip,user_id,description FROM user_auth WHERE user_auth.id=$id");
 if (empty($usersip)) {
     header("location: /admin/reports/index-full.php");
     exit;
@@ -25,7 +25,7 @@ if (empty($usersip)) {
 
 $fip = $usersip['ip'];
 $parent = $usersip['user_id'];
-$fcomm = $usersip['comments'];
+$fcomm = $usersip['description'];
 
 print_trafdetail_submenu($page_url,"id=$id&date_start='$date1'&date_stop='$date2'","<b>".WEB_log_detail_for."&nbsp<a href=/admin/users/editauth.php?id=$id>$fip</a></b> ::&nbsp");
 ?>
@@ -51,7 +51,7 @@ $gateway_filter='';
 if (!empty($rgateway) and $rgateway>0) { $gateway_filter="(router_id=$rgateway) AND"; }
 if (!empty($search)) { $gateway_filter.=' (src_ip='.ip2long($search).' OR dst_ip='.ip2long($search).') AND'; }
 
-$countSQL="SELECT Count(*) FROM traffic_detail as A WHERE $gateway_filter (auth_id='$id') and `timestamp`>='$date1' and `timestamp`<'$date2'";
+$countSQL="SELECT Count(*) FROM traffic_detail as A WHERE $gateway_filter (auth_id='$id') and timestamp>='$date1' and timestamp<'$date2'";
 $count_records = get_single_field($db_link,$countSQL);
 $total=ceil($count_records/$displayed);
 if ($page>$total) { $page=$total; }
@@ -77,9 +77,9 @@ $gateway_list = get_gateways($db_link);
 <td class="data" width=80><b><?php $url = $sort_url.'&sort=pkt&order='.$new_order."'>".WEB_pkts."</a>"; print $url; ?></b></td>
 </tr>
 <?php
-$fsql = "SELECT A.id, A.`timestamp`, A.router_id, A.proto, A.src_ip, A.src_port, A.dst_ip, A.dst_port, A.bytes, A.pkt FROM traffic_detail as A JOIN (SELECT id FROM traffic_detail 
-        WHERE $gateway_filter (auth_id='$id') and  `timestamp`>='$date1' and `timestamp`<'$date2'
-        ORDER BY `timestamp` ASC LIMIT $start,$displayed) as T ON A.id = T.id ORDER BY $sort_table.$sort_field $order";
+$fsql = "SELECT A.id, A.timestamp, A.router_id, A.proto, A.src_ip, A.src_port, A.dst_ip, A.dst_port, A.bytes, A.pkt FROM traffic_detail as A JOIN (SELECT id FROM traffic_detail 
+        WHERE $gateway_filter (auth_id='$id') and  timestamp>='$date1' and timestamp<'$date2'
+        ORDER BY timestamp ASC LIMIT $start,$displayed) as T ON A.id = T.id ORDER BY $sort_table.$sort_field $order";
 $userdata = get_records_sql($db_link, $fsql);
 foreach ($userdata as $row) {
     print "<tr align=center class=\"tr1\" onmouseover=\"className='tr2'\" onmouseout=\"className='tr1'\">\n";

+ 4 - 4
html/admin/reports/wan.php

@@ -32,8 +32,8 @@ $global_int_f_out = 0;
 print "<tr ><td class=\"info\" colspan=5><b>".$device_name."</b></td></tr>\n";
 
 foreach ($l3_interfaces as $row) {
-    if (!empty($row['comment'])) {
-        print "<tr ><td class=\"data\" colspan=5><b>".$row['name']." (".$row['comment'].")</b></td></tr>\n";
+    if (!empty($row['description'])) {
+        print "<tr ><td class=\"data\" colspan=5><b>".$row['name']." (".$row['description'].")</b></td></tr>\n";
         } else {
         print "<tr ><td class=\"data\" colspan=5><b>".$row['name']."</b></td></tr>\n";
         }
@@ -45,9 +45,9 @@ foreach ($l3_interfaces as $row) {
     print "<td >".WEB_title_forward_output."</td>\n";
     print "</tr>\n";
 
-    $trafSQL="SELECT DATE_FORMAT(`time`, '".$dt_template."'  ) AS dt,SUM(`in`) as byte_in,SUM(`out`) as byte_out, SUM(`forward_in`) as byte_f_in,SUM(`forward_out`) as byte_f_out FROM wan_stats ";
+    $trafSQL="SELECT DATE_FORMAT(ts, '".$dt_template."'  ) AS dt,SUM(bytes_in) as byte_in,SUM(bytes_out) as byte_out, SUM(forward_in) as byte_f_in,SUM(forward_out) as byte_f_out FROM wan_stats ";
     $trafSQL .=" WHERE router_id='".$device_id."' AND interface_id='".$row['snmpin']."' AND time>='$date1' AND time<'$date2'";
-    $trafSQL .=" GROUP BY DATE_FORMAT(`time`, '".$dt_template."' ) ORDER BY dt;";
+    $trafSQL .=" GROUP BY DATE_FORMAT(ts, '".$dt_template."' ) ORDER BY dt;";
 
     $int_statistics = get_records_sql($db,$trafSQL);
 

+ 3 - 3
html/admin/users/edit_alias.php

@@ -46,7 +46,7 @@ if (isset($_POST['s_save'])) {
                 }
             if (empty($f_dnsname) or !checkValidHostname($f_dnsname) or !checkUniqHostname($db_link,$id,$f_dnsname)) { continue; }
             $new['alias'] = $f_dnsname;
-            $new['description'] = trim($_POST['s_comment'][$j]);
+            $new['description'] = trim($_POST['s_description'][$j]);
             update_record($db_link, "user_auth_alias", "id='{$save_id}'", $new);
         }
     }
@@ -107,7 +107,7 @@ require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
 	<td></td>
 	<td width=30><b>id</b></td>
 	<td><b><?php echo WEB_cell_name; ?></b></td>
-	<td><b><?php echo WEB_cell_comment; ?></b></td>
+	<td><b><?php echo WEB_cell_description; ?></b></td>
 	<td><input type="submit" onclick="return confirm('<?php echo WEB_msg_delete; ?>?')" name="s_remove" value="<?php echo WEB_btn_delete; ?>"></td>
 </tr>
 <?php
@@ -118,7 +118,7 @@ foreach ( $t_user_auth_alias as $row ) {
     print "<td class=\"data\" style='padding:0'><input type=checkbox name=s_id[] value='{$row['id']}'></td>\n";
     print "<td class=\"data\"><input type=\"hidden\" name='n_id[]' value='{$row['id']}'>{$row['id']}</td>\n";
     print "<td class=\"data\"><input type=\"text\" name='s_alias[]' value='{$row['alias']}' 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>\n";
-    print "<td class=\"data\"><input type=\"text\" name='s_comment[]' value='{$row['description']}'></td>\n";
+    print "<td class=\"data\"><input type=\"text\" name='s_description[]' value='{$row['description']}'></td>\n";
     print "<td class=\"data\"><button name='s_save[]' value='{$row['id']}'>".WEB_btn_save."</button></td>\n";
     print "</tr>\n";
 }

+ 3 - 3
html/admin/users/edit_rules.php

@@ -30,7 +30,7 @@ if (isset($_POST['s_save'])) {
             if (intval($_POST['n_id'][$j]) != $save_id) { continue; }
             $new['type'] = $_POST['s_type'][$j]*1;
             $new['rule'] = trim($_POST['s_rule'][$j]);
-            $new['comment'] = trim($_POST['s_comment'][$j]);
+            $new['description'] = trim($_POST['s_description'][$j]);
             if ($new['type'] ==2) {
                 $new['rule'] = mac_dotted($new['rule']);
                 }
@@ -70,7 +70,7 @@ require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
     <td width=30><b>id</b></td>
     <td><b><?php echo WEB_cell_type; ?></b></td>
     <td><b><?php echo WEB_ou_rule; ?></b></td>
-    <td><b><?php echo WEB_cell_comment; ?></b></td>
+    <td><b><?php echo WEB_cell_description; ?></b></td>
     <td><input type="submit" onclick="return confirm('<?php echo WEB_msg_delete; ?>?')" name="s_remove" value="<?php echo WEB_btn_delete; ?>"></td>
 </tr>
 <?php
@@ -81,7 +81,7 @@ foreach ( $t_auth_rules as $row ) {
     print "<td class=\"data\"><input type=\"hidden\" name='n_id[]' value='{$row['id']}'>{$row['id']}</td>\n";
     print "<td class=\"data\">"; print_qa_rule_select("s_type[]","{$row['type']}"); print "</td>\n";
     print "<td class=\"data\"><input type=\"text\" name='s_rule[]' value='{$row['rule']}'></td>\n";
-    print "<td class=\"data\"><input type=\"text\" name='s_comment[]' value='{$row['comment']}'></td>\n";
+    print "<td class=\"data\"><input type=\"text\" name='s_description[]' value='{$row['description']}'></td>\n";
     print "<td class=\"data\"><button name='s_save[]' value='{$row['id']}'>".WEB_btn_save."</button></td>\n";
     print "</tr>\n";
 }

+ 14 - 14
html/admin/users/editauth.php

@@ -40,7 +40,7 @@ if (isset($_POST["editauth"]) and !$old_auth_info['deleted']) {
             }
         }
         //search ip
-        $dup_ip_record = get_record_sql($db_link, "SELECT * FROM user_auth WHERE `ip_int`=$ip_aton AND id<>$id AND deleted=0");
+        $dup_ip_record = get_record_sql($db_link, "SELECT * FROM user_auth WHERE ip_int=$ip_aton AND id<>$id AND deleted=0");
         if (!empty($dup_ip_record)) {
             $dup_info = get_record_sql($db_link, "SELECT * FROM user_list WHERE id=" . $dup_ip_record['user_id']);
             $msg_error = "$ip already exists. Skip creating $ip [$mac].<br>Old user id: " . $dup_info['id'] . " login: " . $dup_info['login'];
@@ -54,7 +54,7 @@ if (isset($_POST["editauth"]) and !$old_auth_info['deleted']) {
         $new['ou_id'] = $parent_ou_id;
         $new['ip_int'] = $ip_aton;
         $new['mac'] = mac_dotted($_POST["f_mac"]);
-        $new['comments'] = $_POST["f_comments"];
+        $new['description'] = $_POST["f_description"];
         $new['WikiName'] = $_POST["f_wiki"];
         $f_dnsname = trim($_POST["f_dns_name"]);
         $new['dns_ptr_only']=0;
@@ -128,7 +128,7 @@ if (isset($_POST["editauth"]) and !$old_auth_info['deleted']) {
         $new['dhcp_acl'] = trim($_POST["f_acl"]);
         $new['dhcp_option_set'] = trim($_POST["f_dhcp_option_set"]);
         $new['dynamic'] = trim($_POST["f_dynamic"]);
-        if ($new['dynamic']) { $new['eof'] =  trim($_POST["f_eof"]); }
+        if ($new['dynamic']) { $new['end_life'] =  trim($_POST["f_end_life"]); }
         if (get_const('default_user_ou_id') == $parent_ou_id or get_const('default_hotspot_ou_id') == $parent_ou_id) {
             $new['nagios_handler'] = '';
             $new['enabled'] = 0;
@@ -180,7 +180,7 @@ if (isset($_POST["editauth"]) and !$old_auth_info['deleted']) {
 
 if (isset($_POST["moveauth"]) and !$old_auth_info['deleted']) {
     $new_parent_id = $_POST["f_new_parent"] * 1;
-    $moved_auth = get_record_sql($db_link,"SELECT comments FROM user_auth WHERE id=".$id);
+    $moved_auth = get_record_sql($db_link,"SELECT description FROM user_auth WHERE id=".$id);
     $changes = apply_auth_rule($db_link, $moved_auth, $new_parent_id);
     update_record($db_link, "user_auth", "id='$id'", $changes);
     LOG_WARNING($db_link, "IP-address moved to another user! Applyed: " . get_rec_str($changes), $id);
@@ -215,7 +215,7 @@ if (isset($_POST["recovery"]) and $old_auth_info['deleted']) {
             }
         }
         //search ip
-        $dup_ip_record = get_record_sql($db_link, "SELECT * FROM user_auth WHERE `ip_int`=$ip_aton AND id<>$id AND deleted=0");
+        $dup_ip_record = get_record_sql($db_link, "SELECT * FROM user_auth WHERE ip_int=$ip_aton AND id<>$id AND deleted=0");
         if (!empty($dup_ip_record)) {
             $dup_info = get_record_sql($db_link, "SELECT * FROM user_list WHERE id=" . $dup_ip_record['user_id']);
             $msg_error = "$ip already exists. Skip creating $ip [$mac].<br>Old user id: " . $dup_info['id'] . " login: " . $dup_info['login'];
@@ -238,8 +238,8 @@ if (isset($_POST["recovery"]) and $old_auth_info['deleted']) {
             $new['user_id'] = $new_user_id;
             }
 
-        //save comments
-        $new['comments']=$old_parent['comments'];
+        //save description
+        $new['description']=$old_parent['description'];
 
         if (get_const('default_user_ou_id') == $parent_ou_id or get_const('default_hotspot_ou_id') == $parent_ou_id) {
             $new['nagios_handler'] = '';
@@ -300,9 +300,9 @@ if ($auth_info['arp_found'] == '0000-00-00 00:00:00') { $auth_info['arp_found']
 $now = DateTime::createFromFormat("Y-m-d H:i:s",date('Y-m-d H:i:s'));
 $created = DateTime::createFromFormat("Y-m-d H:i:s",$auth_info['timestamp']);
 
-if (empty($auth_info['eof']) or $auth_info['eof'] == '0000-00-00 00:00:00') { 
+if (empty($auth_info['end_life']) or $auth_info['end_life'] == '0000-00-00 00:00:00') { 
     $now->modify('+1 day');
-    $auth_info['eof'] = $now->format('Y-m-d H:i:s');
+    $auth_info['end_life'] = $now->format('Y-m-d H:i:s');
     }
 
 ?>
@@ -328,7 +328,7 @@ if (empty($auth_info['eof']) or $auth_info['eof'] == '0000-00-00 00:00:00') {
         <table class="data">
             <tr>
                 <td width=230><?php print WEB_cell_dns_name . " &nbsp | &nbsp "; print_url(WEB_cell_aliases, $alias_link); ?></td>
-                <td width=200><?php print WEB_cell_comment; ?></td>
+                <td width=200><?php print WEB_cell_description; ?></td>
                 <td width=70><?php print WEB_cell_enabled; ?></td>
                 <td><?php print WEB_cell_traf; ?></td>
                 <td></td>
@@ -337,7 +337,7 @@ if (empty($auth_info['eof']) or $auth_info['eof'] == '0000-00-00 00:00:00') {
                 <td><input type="text" name="f_dns_name" size="14"  value="<?php echo $auth_info['dns_name']; ?>" pattern="^([a-zA-Z0-9-]{1,63})(\.[a-zA-Z0-9-]{1,63})*\.?$">
                     <input type="checkbox" id="f_dns_ptr" name="f_dns_ptr" value="1" <?php echo $f_dns_ptr; ?>> &nbsp ptr
                 </td>
-                <td><input type="text" name="f_comments" value="<?php echo $auth_info['comments']; ?>"></td>
+                <td><input type="text" name="f_description" value="<?php echo $auth_info['description']; ?>"></td>
                 <td><?php print_qa_select('f_enabled', $auth_info['enabled']); ?></td>
                 <td><?php print_qa_select('f_save_traf', $auth_info['save_traf']); ?></td>
                 <td></td>
@@ -416,14 +416,14 @@ if (empty($auth_info['eof']) or $auth_info['eof'] == '0000-00-00 00:00:00') {
             <tr>
                 <td><?php print WEB_cell_temporary; ?></td>
                 <?php if ($auth_info['dynamic']) { print "<td class='cell_red'>"; } else { print "<td>"; } ?>
-                <?php print WEB_cell_eof; ?></td>
+                <?php print WEB_cell_end_life; ?></td>
                 <td></td>
                 <td></td>
                 <td></td>
             </tr>
             <tr>
                 <td><?php print_qa_select('f_dynamic',$auth_info['dynamic']); ?></td>
-                <td><input type="datetime-local" id="f_eof" name="f_eof" min="<?php print $created->format('Y-m-d H:i:s'); ?>" value="<?php print $auth_info['eof']; ?>" 
+                <td><input type="datetime-local" id="f_end_life" name="f_end_life" min="<?php print $created->format('Y-m-d H:i:s'); ?>" value="<?php print $auth_info['end_life']; ?>" 
                 <?php if (!$auth_info['dynamic']) { print "disabled"; } ?>
                 step=1 ></td>
                 <td></td>
@@ -489,7 +489,7 @@ if (empty($auth_info['eof']) or $auth_info['eof'] == '0000-00-00 00:00:00') {
 <script>
 document.getElementById('f_dynamic').addEventListener('change', function(event) {
   const selectValue = this.value;
-  const inputField = document.getElementById('f_eof');
+  const inputField = document.getElementById('f_end_life');
   if (selectValue === '1') {
     inputField.disabled = false;
   } else {

+ 12 - 12
html/admin/users/edituser.php

@@ -45,7 +45,7 @@ if (isset($_POST["edituser"])) {
         run_sql($db_link, "UPDATE user_auth SET enabled=0, changed=1 WHERE user_id=" . $id);
     }
     if (!empty($new["fio"])) {
-        run_sql($db_link, "UPDATE user_auth SET `comments`='" . db_escape($db_link, $new["fio"]) . "' WHERE `user_id`=" . $id . " AND `deleted`=0 AND (`comments` IS NULL or `comments`='' or `comments`='" . $user_info["fio"] . "')");
+        run_sql($db_link, "UPDATE user_auth SET description='" . db_escape($db_link, $new["fio"]) . "' WHERE user_id=" . $id . " AND deleted=0 AND (description IS NULL or description='' or description='" . $user_info["fio"] . "')");
     }
     run_sql($db_link, "UPDATE user_auth SET ou_id=" . $new["ou_id"] . " WHERE user_id=" . $id);
     run_sql($db_link, "UPDATE devices SET device_name='" . $new["login"] . "' WHERE user_id=" . $id);
@@ -120,11 +120,11 @@ if (isset($_POST["showDevice"])) {
 
 if (isset($_POST["addauth"])) {
     $fip = normalizeIpAddress(substr(trim($_POST["newip"]), 0, 18));
-    $fcomment = NULL;
+    $fdescription = NULL;
     $fmac = trim($_POST["newmac"]);
     if (!empty($fmac)) {
         if (!checkValidMac($fmac)) {
-                $fcomment = $fmac;
+                $fdescription = $fmac;
                 $fmac=NULL;
             } else {
             $fmac = mac_dotted($fmac);
@@ -155,7 +155,7 @@ if (isset($_POST["addauth"])) {
                 }
             }
             //search ip
-            $dup_ip_record = get_record_sql($db_link, "SELECT * FROM user_auth WHERE `ip_int`=$ip_aton AND user_id<>" . $id . " AND deleted=0");
+            $dup_ip_record = get_record_sql($db_link, "SELECT * FROM user_auth WHERE ip_int=$ip_aton AND user_id<>" . $id . " AND deleted=0");
             if (!empty($dup_ip_record)) {
                 $dup_info = get_record_sql($db_link, "SELECT * FROM user_list WHERE id=" . $dup_ip_record['user_id']);
                 $msg_error = "$fip already exists. Skip creating $fip [$fmac].<br>Old user id: " . $dup_info['id'] . " login: " . $dup_info['login'];
@@ -168,7 +168,7 @@ if (isset($_POST["addauth"])) {
             if (!empty($fid)) {
                 $new['dhcp'] = $f_dhcp;
                 $new['created_by'] = 'manual';
-                if (!empty($fcomment)) { $new['comments'] = $fcomment; }
+                if (!empty($fdescription)) { $new['description'] = $fdescription; }
                 update_record($db_link, "user_auth", "id=" . $fid, $new);
                 LOG_WARNING($db_link, "Add ip for login: " . $user_info["login"] . ": ip => $fip, mac => $fmac", $fid);
                 header("Location: /admin/users/editauth.php?id=" . $fid);
@@ -204,8 +204,8 @@ if (isset($_POST["new_user"])) {
             if (!empty($auth_info["dns_name"])) {
                 $login = $auth_info["dns_name"];
             }
-            if (empty($login) and !empty($auth_info["comments"])) {
-                $login = transliterate($auth_info["comments"]);
+            if (empty($login) and !empty($auth_info["description"])) {
+                $login = transliterate($auth_info["description"]);
             }
             if (empty($login) and !empty($auth_info["dhcp_hostname"])) {
                 $login = $auth_info["dhcp_hostname"];
@@ -228,7 +228,7 @@ if (isset($_POST["new_user"])) {
             } else {
                 $new["login"] = $login;
                 $new["ou_id"] = $ou_id;
-                if (!empty($auth_info["comments"])) { $new["fio"] = $auth_info["comments"]; }
+                if (!empty($auth_info["description"])) { $new["fio"] = $auth_info["description"]; }
                 if (!isset($new["fio"]) and !empty($auth_info["dns_name"])) { $new["fio"] = $auth_info["dns_name"]; }
                 if (!isset($new["fio"]) and !empty($auth_info["dhcp_hostname"])) { $new["fio"] = $auth_info["dhcp_hostname"]; }
                 $new["enabled"] = $auth_info["enabled"];
@@ -360,7 +360,7 @@ require_once($_SERVER["DOCUMENT_ROOT"] . "/inc/header.php");
                 <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>
-                <td class="data"><?php print WEB_cell_comment; ?></td>
+                <td class="data"><?php print WEB_cell_description; ?></td>
                 <td class="data"><?php print $sort_url . "&sort=dns_name&order=$new_order>" . WEB_cell_dns_name . "</a>"; ?></td>
                 <td class="data"><?php print WEB_cell_enabled; ?></td>
                 <td class="data"><?php print WEB_cell_dhcp; ?></td>
@@ -395,9 +395,9 @@ require_once($_SERVER["DOCUMENT_ROOT"] . "/inc/header.php");
                     print "</td>";
 
                     if (isset($row["dhcp_hostname"]) and strlen($row["dhcp_hostname"]) > 0) {
-                        print "<td class=\"data\" >" . $row["comments"] . " [" . $row["dhcp_hostname"] . "]</td>";
+                        print "<td class=\"data\" >" . $row["description"] . " [" . $row["dhcp_hostname"] . "]</td>";
                     } else {
-                        print "<td class=\"data\" >" . $row["comments"] . "</td>";
+                        print "<td class=\"data\" >" . $row["description"] . "</td>";
                     }
                     $f_dns_type = 'A';
                     if ($row["dns_ptr_only"]) { $f_dns_type = 'ptr'; }
@@ -430,7 +430,7 @@ require_once($_SERVER["DOCUMENT_ROOT"] . "/inc/header.php");
 
                     if ($row['dynamic']) { $cl = "data_red"; } else { $cl = "data_green"; }
                     print "<td class=\"$cl\" >". 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"; }
+                    if ($row['dynamic'] and !empty($row["end_life"])) { print "<p class='timestamp'>".FormatDateStr('Y.m.d H:i', $row["end_life"])."</p>"; } else { print "&nbsp"; }
                     print "</td>";
 
                     print "<td class=\"data\" >";

+ 5 - 5
html/api.php

@@ -37,10 +37,10 @@ if (!empty($action)) {
           $sql='';
           LOG_VERBOSE($db_link,"API: Get User Auth record with ip: $ip mac: $mac id: $rec_id");
           if (!empty($mac) and !empty($ip_aton)) { 
-                $sql="SELECT * FROM user_auth WHERE `ip_int`=".$ip_aton." AND `mac`='".$mac."' AND deleted=0"; 
+                $sql="SELECT * FROM user_auth WHERE ip_int=".$ip_aton." AND mac='".$mac."' AND deleted=0"; 
               } else {
-              if (!empty($ip_aton)) { $sql = "SELECT * FROM user_auth WHERE `ip_int`=".$ip_aton." AND deleted=0"; }
-              if (!empty($mac)) { $sql="SELECT * FROM user_auth WHERE `mac`='".$mac."' AND deleted=0"; }
+              if (!empty($ip_aton)) { $sql = "SELECT * FROM user_auth WHERE ip_int=".$ip_aton." AND deleted=0"; }
+              if (!empty($mac)) { $sql="SELECT * FROM user_auth WHERE mac='".$mac."' AND deleted=0"; }
               }
           if (!empty($rec_id)) { $sql="SELECT * FROM user_auth WHERE id=".$rec_id; }
           if (!empty($sql)) {
@@ -100,7 +100,7 @@ if (!empty($action)) {
       if ($action ==='get_dhcp_all') {
             $result=[];
             LOG_VERBOSE($db_link,"API: Get all dhcp records");
-            $sql = "SELECT ua.id, ua.ip, ua.ip_int, ua.mac, ua.comments, ua.dns_name, ua.dhcp_option_set, ua.dhcp_acl, ua.ou_id, SUBSTRING_INDEX(s.subnet, '/', 1) AS subnet_base 
+            $sql = "SELECT ua.id, ua.ip, ua.ip_int, ua.mac, ua.description, ua.dns_name, ua.dhcp_option_set, ua.dhcp_acl, ua.ou_id, SUBSTRING_INDEX(s.subnet, '/', 1) AS subnet_base 
                 FROM  user_auth ua JOIN subnets s ON ua.ip_int BETWEEN s.ip_int_start AND s.ip_int_stop
                 WHERE ua.dhcp = 1 AND ua.deleted = 0 AND s.dhcp = 1 ORDER BY ua.ip_int";
             $result = get_records_sql($db_link, $sql);
@@ -126,7 +126,7 @@ if (!empty($action)) {
             $result=[];
             $f_subnet = trim($f_subnet, "'");
             LOG_VERBOSE($db_link,"API: Get dhcp records for subnet ".$f_subnet);
-            $sql = "SELECT ua.id, ua.ip, ua.ip_int, ua.mac, ua.comments, ua.dns_name, ua.dhcp_option_set, ua.dhcp_acl, ua.ou_id, SUBSTRING_INDEX(s.subnet, '/', 1) AS subnet_base 
+            $sql = "SELECT ua.id, ua.ip, ua.ip_int, ua.mac, ua.description, ua.dns_name, ua.dhcp_option_set, ua.dhcp_acl, ua.ou_id, SUBSTRING_INDEX(s.subnet, '/', 1) AS subnet_base 
                 FROM  user_auth ua JOIN subnets s ON ua.ip_int BETWEEN s.ip_int_start AND s.ip_int_stop
                 WHERE ua.dhcp = 1 AND ua.deleted = 0 AND s.dhcp = 1 AND SUBSTRING_INDEX(s.subnet, '/', 1) = '".$f_subnet."' ORDER BY ua.ip_int";
             $result = get_records_sql($db_link, $sql);

+ 1 - 1
html/inc/auth.utils.php

@@ -231,7 +231,7 @@ function authenticate_by_credentials($db, $login, $password) {
     log_session_debug($db, "Authenticating by credentials", ['login' => $login]);
 
     $login = trim($login);
-    $stmt = $db->prepare("SELECT * FROM `customers` WHERE Login = ?");
+    $stmt = $db->prepare("SELECT * FROM customers WHERE Login = ?");
     $stmt->execute([$login]);
     $user = $stmt->fetch(PDO::FETCH_ASSOC);
 

+ 56 - 56
html/inc/common.php

@@ -687,7 +687,7 @@ function decrypt_string($crypted_string)
 function print_instance_select($db, $instance_name, $instance_value)
 {
     print "<select id=\"$instance_name\" name=\"$instance_name\" >\n";
-    $t_instance = get_records_sql($db, "SELECT id,name,comment FROM filter_instances ORDER BY id");
+    $t_instance = get_records_sql($db, "SELECT id,name,description FROM filter_instances ORDER BY id");
     foreach ($t_instance as $row) {
         print_select_item($row['name'], $row['id'], $instance_value);
     }
@@ -703,7 +703,7 @@ function get_subnet_description($db, $subnet_id)
     if (empty($subnet)) {
         return '';
     }
-    $result = $subnet['subnet'] . '&nbsp(' . $subnet['comment'] . ')';
+    $result = $subnet['subnet'] . '&nbsp(' . $subnet['description'] . ')';
     return $result;
 }
 
@@ -716,17 +716,17 @@ function get_filter_instance_description($db, $instance_id)
     if (empty($instance)) {
         return '';
     }
-    $result = $instance['name'] . '&nbsp(' . $instance['comment'] . ')';
+    $result = $instance['name'] . '&nbsp(' . $instance['description'] . ')';
     return $result;
 }
 
 function print_add_gw_subnets($db, $device_id, $gs_name)
 {
     print "<select id=\"$gs_name\" name=\"$gs_name\" >\n";
-    $t_gs = get_records_sql($db, "SELECT id,subnet,comment FROM subnets WHERE subnets.free=0 AND subnets.id NOT IN (SELECT subnet_id FROM gateway_subnets WHERE gateway_subnets.device_id=" . $device_id . ") ORDER BY subnet");
+    $t_gs = get_records_sql($db, "SELECT id,subnet,description FROM subnets WHERE subnets.free=0 AND subnets.id NOT IN (SELECT subnet_id FROM gateway_subnets WHERE gateway_subnets.device_id=" . $device_id . ") ORDER BY subnet");
     if (!empty($t_gs)) {
         foreach ($t_gs as $row) {
-            print_select_item($row['subnet'] . '(' . $row['comment'] . ')', $row['id'], 0);
+            print_select_item($row['subnet'] . '(' . $row['description'] . ')', $row['id'], 0);
         }
     }
     print "</select>\n";
@@ -735,10 +735,10 @@ function print_add_gw_subnets($db, $device_id, $gs_name)
 function print_add_gw_instances($db, $device_id, $gs_name)
 {
     print "<select id=\"$gs_name\" name=\"$gs_name\" >\n";
-    $t_gs = get_records_sql($db, "SELECT id,name,comment FROM filter_instances WHERE filter_instances.id NOT IN (SELECT instance_id FROM device_filter_instances WHERE device_filter_instances.device_id=" . $device_id . ") ORDER BY name");
+    $t_gs = get_records_sql($db, "SELECT id,name,description FROM filter_instances WHERE filter_instances.id NOT IN (SELECT instance_id FROM device_filter_instances WHERE device_filter_instances.device_id=" . $device_id . ") ORDER BY name");
     if (!empty($t_gs)) {
         foreach ($t_gs as $row) {
-            print_select_item($row['name'] . '(' . $row['comment'] . ')', $row['id'], 0);
+            print_select_item($row['name'] . '(' . $row['description'] . ')', $row['id'], 0);
         }
     }
     print "</select>\n";
@@ -1086,8 +1086,8 @@ function get_nagios_name($auth)
     if (!empty($auth['dhcp_hostname'])) {
         return $auth['dhcp_hostname'];
     }
-    if (!empty($auth['comments'])) {
-        $result = transliterate($auth['comments']);
+    if (!empty($auth['description'])) {
+        $result = transliterate($auth['description']);
         $result = preg_replace('/\(/', '-', $result);
         $result = preg_replace('/\)/', '-', $result);
         $result = preg_replace('/--/', '-', $result);
@@ -1211,10 +1211,10 @@ function print_devtypes_select($db, $devtype_name, $devtype_value, $mode)
     if (!empty($mode)) {
         $filter = "WHERE $mode";
     }
-    $t_devtype = get_records_sql($db, "SELECT id,`name." . HTML_LANG . "` FROM device_types $filter ORDER BY `name." . HTML_LANG . "`");
+    $t_devtype = get_records_sql($db, "SELECT id,name_" . HTML_LANG . " FROM device_types $filter ORDER BY name_" . HTML_LANG );
     if (!empty($t_devtype)) {
         foreach ($t_devtype as $row) {
-            print_select_item($row['name.' . HTML_LANG ], $row['id'], $devtype_value);
+            print_select_item($row['name_' . HTML_LANG ], $row['id'], $devtype_value);
         }
     }
     print "</select>\n";
@@ -1223,9 +1223,9 @@ function print_devtypes_select($db, $devtype_name, $devtype_value, $mode)
 function print_devtype_select($db, $devtype_name, $devtype_value)
 {
     print "<select id=\"$devtype_name\" name=\"$devtype_name\">\n";
-    $t_devtype = get_records_sql($db, "SELECT id,`name." . HTML_LANG . "` FROM device_types ORDER BY `name." . HTML_LANG . "`");
+    $t_devtype = get_records_sql($db, "SELECT id,name_" . HTML_LANG . " FROM device_types ORDER BY name_" . HTML_LANG );
     foreach ($t_devtype as $row) {
-        print_select_item($row['name.'.HTML_LANG], $row['id'], $devtype_value);
+        print_select_item($row['name_'.HTML_LANG], $row['id'], $devtype_value);
     }
     print "</select>\n";
 }
@@ -1241,9 +1241,9 @@ function get_group($db, $group_value)
 
 function get_devtype_name($db, $device_type_id)
 {
-    $type = get_record_sql($db, "SELECT `name." . HTML_LANG . "` FROM device_types WHERE id=$device_type_id");
-    if (!empty($type) and isset($type['name.'.HTML_LANG])) {
-        return $type['name.'.HTML_LANG];
+    $type = get_record_sql($db, "SELECT name_" . HTML_LANG . " FROM device_types WHERE id=$device_type_id");
+    if (!empty($type) and isset($type['name_'.HTML_LANG])) {
+        return $type['name_'.HTML_LANG];
     }
     return '';
 }
@@ -1288,21 +1288,21 @@ function get_wan_interfaces($db, $device_id)
     
     // Обрабатываем каждый интерфейс
     foreach ($t_l3int as &$row) { // & - передача по ссылке для изменения исходного массива
-        $row['comment'] = '';
+        $row['description'] = '';
         
         if (empty($row['snmpin'])) {
             continue;
         }
         
-        $con_sql = "SELECT * FROM `device_ports` 
+        $con_sql = "SELECT * FROM device_ports 
                     WHERE device_id = '" . $device_id . "' 
                       AND snmp_index = '" . $row['snmpin'] . "'";
         
         $conn = get_record_sql($db, $con_sql);
         
         // Проверяем, есть ли комментарий в результатах запроса
-        if (!empty($conn) && !empty($conn['comment'])) {
-            $row['comment'] = $conn['comment'];
+        if (!empty($conn) && !empty($conn['description'])) {
+            $row['description'] = $conn['description'];
         }
     }
     unset($row); 
@@ -1311,7 +1311,7 @@ function get_wan_interfaces($db, $device_id)
 
 function get_gw_subnets($db, $device_id)
 {
-    $gw_subnets_sql = 'SELECT gateway_subnets.*,subnets.subnet,subnets.comment FROM gateway_subnets LEFT JOIN subnets ON gateway_subnets.subnet_id = subnets.id WHERE gateway_subnets.device_id=' . $device_id . ' ORDER BY subnets.subnet ASC';
+    $gw_subnets_sql = 'SELECT gateway_subnets.*,subnets.subnet,subnets.description FROM gateway_subnets LEFT JOIN subnets ON gateway_subnets.subnet_id = subnets.id WHERE gateway_subnets.device_id=' . $device_id . ' ORDER BY subnets.subnet ASC';
     $gw_subnets = get_records_sql($db, $gw_subnets_sql);
     if (empty($gw_subnets)) { return ''; }
     $result = '';
@@ -1484,7 +1484,7 @@ function print_dhcp_select($qa_name, $qa_value = 0)
 
 function print_nagios_handler_select($db,$qa_name)
 {
-$nagios_handler = get_records_sql($db,"SELECT DISTINCT `nagios_handler` FROM user_auth WHERE `nagios_handler` IS NOT NULL AND `nagios_handler` != '' AND  `deleted`=0");
+$nagios_handler = get_records_sql($db,"SELECT DISTINCT nagios_handler FROM user_auth WHERE nagios_handler IS NOT NULL AND nagios_handler != '' AND  deleted=0");
 if (!empty($nagios_handler) and count($nagios_handler)>0) {
     print "<select name=\"$qa_name\">\n";
     print_select_simple(WEB_select_item_no, '');
@@ -1499,7 +1499,7 @@ if (!empty($nagios_handler) and count($nagios_handler)>0) {
 
 function print_dhcp_acl($db,$qa_name)
 {
-$dhcp_acl = get_records_sql($db,"SELECT DISTINCT `dhcp_acl` FROM user_auth WHERE `dhcp_acl` IS NOT NULL AND `dhcp_acl` != '' AND  `deleted`=0");
+$dhcp_acl = get_records_sql($db,"SELECT DISTINCT dhcp_acl FROM user_auth WHERE dhcp_acl IS NOT NULL AND dhcp_acl != '' AND  deleted=0");
 if (!empty($dhcp_acl) and count($dhcp_acl)>0) {
     print "<select name=\"$qa_name\">\n";
     print_select_simple(WEB_select_item_no, '');
@@ -1514,7 +1514,7 @@ if (!empty($dhcp_acl) and count($dhcp_acl)>0) {
 
 function print_dhcp_option_set($db,$qa_name)
 {
-$dhcp_option_sets = get_records_sql($db,"SELECT DISTINCT `dhcp_option_set` FROM user_auth WHERE `dhcp_option_set` IS NOT NULL AND `dhcp_option_set` != '' AND `deleted`=0");
+$dhcp_option_sets = get_records_sql($db,"SELECT DISTINCT dhcp_option_set FROM user_auth WHERE dhcp_option_set IS NOT NULL AND dhcp_option_set != '' AND deleted=0");
 if (!empty($dhcp_option_sets) and count($dhcp_option_sets)>0) {
     print "<select name=\"$qa_name\">\n";
     print_select_simple(WEB_select_item_no, '');
@@ -1529,7 +1529,7 @@ if (!empty($dhcp_option_sets) and count($dhcp_option_sets)>0) {
 
 function print_dhcp_acl_list($db,$qa_name,$value='')
 {
-$dhcp_acl = get_records_sql($db,"SELECT DISTINCT `dhcp_acl` FROM user_auth WHERE `dhcp_acl` IS NOT NULL AND `dhcp_acl` != '' AND  `deleted`=0");
+$dhcp_acl = get_records_sql($db,"SELECT DISTINCT dhcp_acl FROM user_auth WHERE dhcp_acl IS NOT NULL AND dhcp_acl != '' AND  deleted=0");
 if (!empty($dhcp_acl) and count($dhcp_acl)>0) {
     print "<input list=\"dhcp_acl\" id=\"$qa_name\" name=\"$qa_name\" value=\"$value\"/>";
     print "<datalist id=\"dhcp_acl\">";
@@ -1545,7 +1545,7 @@ if (!empty($dhcp_acl) and count($dhcp_acl)>0) {
 
 function print_dhcp_option_set_list($db,$qa_name,$value='')
 {
-$dhcp_option_sets = get_records_sql($db,"SELECT DISTINCT `dhcp_option_set` FROM user_auth WHERE `dhcp_option_set` IS NOT NULL AND `dhcp_option_set` != '' AND `deleted`=0");
+$dhcp_option_sets = get_records_sql($db,"SELECT DISTINCT dhcp_option_set FROM user_auth WHERE dhcp_option_set IS NOT NULL AND dhcp_option_set != '' AND deleted=0");
 if (!empty($dhcp_option_sets) and count($dhcp_option_sets)>0) {
     print "<input list=\"dhcp_option_set\" id=\"$qa_name\" name=\"$qa_name\" value=\"$value\"/>";
     print "<datalist id=\"dhcp_option_set\">";
@@ -1624,7 +1624,7 @@ function print_ip_type_select($qa_name, $qa_value)
 function print_vendor_select($db, $qa_name, $qa_value)
 {
     print "<select id=\"$qa_name\" name=\"$qa_name\"  style=\"width: 100%\">\n";
-    $sSQL = "SELECT id,`name` FROM `vendors` order by `name`";
+    $sSQL = "SELECT id,name FROM vendors order by name";
     $vendors = get_records_sql($db, $sSQL);
     print_select_item(WEB_select_item_all, 0, $qa_value);
     foreach ($vendors as $row) {
@@ -1636,7 +1636,7 @@ function print_vendor_select($db, $qa_name, $qa_value)
 function print_vendor_set($db, $qa_name, $qa_value)
 {
     print "<select id=\"$qa_name\" name=\"$qa_name\" style=\"width: 100%\">\n";
-    $sSQL = "SELECT id,`name` FROM `vendors` order by `name`";
+    $sSQL = "SELECT id,name FROM vendors order by name";
     $vendors = get_records_sql($db, $sSQL);
     foreach ($vendors as $row) {
         print_select_item($row['name'], $row['id'], $qa_value);
@@ -1646,7 +1646,7 @@ function print_vendor_set($db, $qa_name, $qa_value)
 
 function get_vendor_name($db, $v_id)
 {
-    $vendor = get_record_sql($db, "SELECT * FROM `vendors` WHERE id=" . $v_id);
+    $vendor = get_record_sql($db, "SELECT * FROM vendors WHERE id=" . $v_id);
     if (!empty($vendor) and isset($vendor['name'])) {
         return $vendor['name'];
     }
@@ -1999,25 +1999,25 @@ function print_auth_port($db, $port_id, $new_window = FALSE)
     }
 }
 
-function get_port_comment($db, $port_id, $port_comment = '')
+function get_port_description($db, $port_id, $port_description = '')
 {
-    $d_sql = "SELECT A.ip_int, A.comments FROM user_auth as A, connections as C WHERE C.port_id=$port_id and A.id=C.auth_id and A.deleted=0 order by A.ip_int";
+    $d_sql = "SELECT A.ip_int, A.description FROM user_auth as A, connections as C WHERE C.port_id=$port_id and A.id=C.auth_id and A.deleted=0 order by A.ip_int";
     $t_auth = get_records_sql($db, $d_sql);
-    $comment_found = 0;
+    $description_found = 0;
     $result = '';
     foreach ($t_auth as $row) {
-        if (!empty($row['comments'])) {
-            $comment_found = 1;
+        if (!empty($row['description'])) {
+            $description_found = 1;
         } else {
-            $row['comments'] = '';
+            $row['description'] = '';
         }
-        $result .= $row['comments'] . '<br>';
+        $result .= $row['description'] . '<br>';
     }
-    if (!$comment_found) {
-        return $port_comment;
+    if (!$description_found) {
+        return $port_description;
     }
-    if (!empty($port_comment)) {
-        $result .= '(' . $port_comment . ')';
+    if (!empty($port_description)) {
+        $result .= '(' . $port_description . ')';
     }
     return $result;
 }
@@ -2027,7 +2027,7 @@ function print_auth_simple($db, $auth_id)
     $auth = get_record($db, "user_auth", "id=$auth_id");
     $name = $auth['dns_name'];
     if (empty($name)) {
-        $name = $auth['comments'];
+        $name = $auth['description'];
     }
     if (empty($name)) {
         $name = $auth['ip'];
@@ -2040,9 +2040,9 @@ function print_auth($db, $auth_id)
     $auth = get_record($db, "user_auth", "id=$auth_id");
     $name = $auth['dns_name'];
     if (empty($name)) {
-        $name = $auth['comments'];
+        $name = $auth['description'];
     } else {
-        $name .= " (" . $auth['comments'] . ")";
+        $name .= " (" . $auth['description'] . ")";
     }
     if (empty($name)) {
         $name = $auth['ip'];
@@ -2057,9 +2057,9 @@ function print_auth_detail($db, $auth_id)
     $auth = get_record($db, "user_auth", "id=$auth_id");
     $name = $auth['dns_name'];
     if (empty($name)) {
-        $name = $auth['comments'];
+        $name = $auth['description'];
     } else {
-        $name .= " (" . $auth['comments'] . ")";
+        $name .= " (" . $auth['description'] . ")";
     }
     if (empty($name)) {
         $name = $auth['ip'];
@@ -2154,12 +2154,12 @@ function clean_dns_cache($db)
     $date = $date - 86400;
     $date_clean = DateTimeImmutable::createFromFormat('U', $date);
     $clean_date = $date_clean->format('Y-m-d H:i:s');
-    run_sql($db, "DELETE FROM dns_cache WHERE `timestamp`<='" . $clean_date . "'");
+    run_sql($db, "DELETE FROM dns_cache WHERE timestamp<='" . $clean_date . "'");
 }
 
 function clean_unreferensed_rules($db)
 {
-    run_sql($db, "DELETE FROM `auth_rules` WHERE user_id NOT IN (SELECT id FROM user_list)");
+    run_sql($db, "DELETE FROM auth_rules WHERE user_id NOT IN (SELECT id FROM user_list)");
 }
 
 function FormatDateStr($format = 'Y-m-d H:i:s', $date_str)
@@ -2230,7 +2230,7 @@ function get_ip_subnet($db, $ip)
         return;
     }
     $ip_aton = ip2long($ip);
-    $user_subnet = get_record_sql($db, "SELECT * FROM `subnets` WHERE hotspot=1 or office=1 and ( $ip_aton >= ip_int_start and $ip_aton <= ip_int_stop)");
+    $user_subnet = get_record_sql($db, "SELECT * FROM subnets WHERE hotspot=1 or office=1 and ( $ip_aton >= ip_int_start and $ip_aton <= ip_int_stop)");
     if (empty($user_subnet)) {
         return;
     }
@@ -2285,9 +2285,9 @@ function apply_auth_rule($db, $auth_record, $user_id)
     $auth_record['queue_id'] = $user_rec['queue_id'];
     $auth_record['enabled'] = $user_rec['enabled'];
     $auth_record['changed'] = 1;
-    //maybe fill comments?
-    if (!empty($user_rec['fio']) and empty($auth_record['comments'])) {
-        $auth_record['comments'] = $user_rec['fio'];
+    //maybe fill description?
+    if (!empty($user_rec['fio']) and empty($auth_record['description'])) {
+        $auth_record['description'] = $user_rec['fio'];
     }
 
     return $auth_record;
@@ -2296,7 +2296,7 @@ function apply_auth_rule($db, $auth_record, $user_id)
 function fix_auth_rules($db)
 {
     //cleanup hotspot subnet rules
-    $t_hotspot = get_records_sql($db, "SELECT * FROM `OU` WHERE default_users=1 or default_hotspot=1");
+    $t_hotspot = get_records_sql($db, "SELECT * FROM OU WHERE default_users=1 or default_hotspot=1");
     if (!empty($t_hotspot)) {
         foreach ($t_hotspot as $row) {
             delete_record($db, "auth_rules", "ou_id='" . $row['id'] . "'");
@@ -3455,7 +3455,7 @@ function get_subnet_range($db, $subnet_id)
     if (empty($subnet_id)) {
         return;
     }
-    $t_option = get_record_sql($db, "SELECT ip_int_start,ip_int_stop FROM `subnets` WHERE id=$subnet_id");
+    $t_option = get_record_sql($db, "SELECT ip_int_start,ip_int_stop FROM subnets WHERE id=$subnet_id");
     if (!isset($t_option['ip_int_start'])) {
         $t_option['ip_int_start'] = 0;
     }
@@ -3495,7 +3495,7 @@ function is_hotspot($db, $ip)
     }
     LOG_DEBUG($db, "Check hotspot network for ip: $ip");
     $ip_aton = ip2long($ip);
-    $t_option = get_records_sql($db, "SELECT subnet,ip_int_start,ip_int_stop FROM `subnets` WHERE hotspot=1");
+    $t_option = get_records_sql($db, "SELECT subnet,ip_int_start,ip_int_stop FROM subnets WHERE hotspot=1");
     foreach ($t_option as $row) {
         if ($ip_aton >= $row['ip_int_start'] and $ip_aton <= $row['ip_int_stop']) {
             LOG_DEBUG($db, "ip: $ip [$ip_aton] found in hotspot network ".$row['subnet'].": [" . $row['ip_int_start'] . ".." . $row['ip_int_stop'] . "]");
@@ -3513,7 +3513,7 @@ function is_office($db, $ip)
     }
     LOG_DEBUG($db, "Check office network for ip: $ip");
     $ip_aton = ip2long($ip);
-    $t_option = get_records_sql($db, "SELECT subnet,ip_int_start,ip_int_stop FROM `subnets` WHERE office=1");
+    $t_option = get_records_sql($db, "SELECT subnet,ip_int_start,ip_int_stop FROM subnets WHERE office=1");
     foreach ($t_option as $row) {
         if ($ip_aton >= $row['ip_int_start'] and $ip_aton <= $row['ip_int_stop']) {
             LOG_DEBUG($db, "ip: $ip [$ip_aton] found in office network ".$row['subnet'].": [" . $row['ip_int_start'] . ".." . $row['ip_int_stop'] . "]");
@@ -3531,7 +3531,7 @@ function get_office_subnet($db, $ip)
     }
     LOG_DEBUG($db, "Check office network for ip: $ip");
     $ip_aton = ip2long($ip);
-    $subnets = get_records_sql($db, 'SELECT * FROM `subnets` WHERE office=1');
+    $subnets = get_records_sql($db, 'SELECT * FROM subnets WHERE office=1');
     foreach ($subnets as $row) {
         if ($ip_aton >= $row['ip_int_start'] and $ip_aton <= $row['ip_int_stop']) {
             LOG_DEBUG($db, "ip: $ip [$ip_aton] found in office {$row['subnet']}: [" . $row['ip_int_start'] . ".." . $row['ip_int_stop'] . "]");

+ 5 - 5
html/inc/languages/english.php

@@ -34,7 +34,7 @@ define("WEB_msg_login","Login");
 define("WEB_msg_username","Username");
 define("WEB_msg_password","Password");
 define("WEB_msg_fullname","Full name");
-define("WEB_msg_comment","Comment");
+define("WEB_msg_description","Description");
 define("WEB_msg_now","Now");
 define("WEB_msg_forbidden","Forbidden");
 define("WEB_msg_traffic_blocked","Blocked");
@@ -188,7 +188,7 @@ define("WEB_cell_mac","MAC");
 define("WEB_cell_clientid","Client-id");
 define("WEB_cell_host_firmware","Firmware");
 define("WEB_cell_sn","SN");
-define("WEB_cell_comment","Comment");
+define("WEB_cell_description","Description");
 define("WEB_cell_wikiname","Wiki Name");
 define("WEB_cell_filter","Filter");
 define("WEB_cell_proxy","Proxy");
@@ -232,7 +232,7 @@ define("WEB_cell_poe_in","POE In");
 define("WEB_cell_poe_out","POE");
 define("WEB_cell_dynamic","Dynamic");
 define("WEB_cell_temporary","Temporary record");
-define("WEB_cell_eof","EOF time");
+define("WEB_cell_end_life","The END time");
 define("WEB_cell_life_hours","Life duration,hours");
 
 /* lists name */
@@ -454,10 +454,10 @@ define("WEB_rules_type_hostname","Hostname");
 /* all ip list */
 define("WEB_ips_show_by_state","By activity");
 define("WEB_ips_show_by_ip_type","By ip type");
-define("WEB_ips_search_host","Search ip,mac or comment");
+define("WEB_ips_search_host","Search ip,mac or description");
 define("WEB_ips_search","Search");
 define("WEB_selection_title","Apply to Selection");
-define("WEB_ips_search_full","Search by comment/ip/mac/dhcp hostname");
+define("WEB_ips_search_full","Search by description/ip/mac/dhcp hostname");
 
 /* logs */
 define("WEB_log_start_date","Start");

+ 3 - 3
html/inc/languages/russian.php

@@ -34,7 +34,7 @@ define("WEB_msg_login","Вход");
 define("WEB_msg_username","Имя пользователя");
 define("WEB_msg_password","Пароль");
 define("WEB_msg_fullname","ФИО");
-define("WEB_msg_comment","Комментарий");
+define("WEB_msg_description","Комментарий");
 define("WEB_msg_now","Сейчас");
 define("WEB_msg_forbidden","Запрещено");
 define("WEB_msg_traffic_blocked","Блок по трафику");
@@ -188,7 +188,7 @@ define("WEB_cell_mac","MAC");
 define("WEB_cell_clientid","Client-id");
 define("WEB_cell_host_firmware","Прошивка");
 define("WEB_cell_sn","SN");
-define("WEB_cell_comment","Комментарий");
+define("WEB_cell_description","Комментарий");
 define("WEB_cell_wikiname","Wiki Name");
 define("WEB_cell_filter","Фильтр");
 define("WEB_cell_proxy","Proxy");
@@ -232,7 +232,7 @@ define("WEB_cell_poe_in","Питается по POE");
 define("WEB_cell_poe_out","POE");
 define("WEB_cell_dynamic","Динамическая");
 define("WEB_cell_temporary","Временная запись");
-define("WEB_cell_eof","Дата ликвидация");
+define("WEB_cell_end_life","Дата ликвидация");
 define("WEB_cell_life_hours","Часов жизни");
 
 /* lists name */

+ 75 - 45
html/inc/sql.php

@@ -1,6 +1,5 @@
 <?php
 if (! defined("CONFIG")) die("Not defined");
-
 if (! defined("SQL")) { die("Not defined"); }
 
 function db_escape($connection, $value) {
@@ -8,47 +7,48 @@ function db_escape($connection, $value) {
     if ($value === null) {
         return '';
     }
-    
     if (is_bool($value)) {
         return $value ? 1 : 0;
     }
-    
     if (is_int($value) || is_float($value)) {
         return $value;
     }
-    
     // Для строковых значений
     $string = (string)$value;
-    
     if ($connection instanceof PDO) {
-        // PDO::quote() может вернуть false при ошибке
+        // Определяем тип базы данных
+        $driver = $connection->getAttribute(PDO::ATTR_DRIVER_NAME);
+        if ($driver === false) {
+            // Не удалось определить драйвер, используем универсальный метод
+            return addslashes($string);
+        }
         try {
             $quoted = $connection->quote($string);
             if ($quoted === false) {
-                // Если quote() не сработал, используем addslashes
                 return addslashes($string);
             }
-            // Убираем внешние кавычки
+            // Убираем внешние кавычки для совместимости
             if (strlen($quoted) >= 2 && $quoted[0] === "'" && $quoted[strlen($quoted)-1] === "'") {
                 return substr($quoted, 1, -1);
             }
             return $quoted;
         } catch (Exception $e) {
-            // В случае ошибки возвращаем addslashes
             return addslashes($string);
         }
     } elseif ($connection instanceof mysqli) {
         return mysqli_real_escape_string($connection, $string);
     } elseif (is_resource($connection) && get_resource_type($connection) === 'mysql link') {
         return mysql_real_escape_string($string, $connection);
-    } elseif ($connection instanceof PostgreSQL) {
+    } elseif (is_resource($connection) && get_resource_type($connection) === 'pgsql link') {
         return pg_escape_string($connection, $string);
     } else {
+        // Последнее средство
         return addslashes($string);
     }
 }
 
-function new_connection ($db_type, $db_host, $db_user, $db_password, $db_name)
+
+function new_connection ($db_type, $db_host, $db_user, $db_password, $db_name, $db_port = null)
 {
     // Создаем временный логгер для отладки до установки соединения
     $temp_debug_message = function($message) {
@@ -58,6 +58,14 @@ function new_connection ($db_type, $db_host, $db_user, $db_password, $db_name)
     $temp_debug_message("Starting new_connection function");
     $temp_debug_message("DB parameters - type: $db_type, host: $db_host, user: $db_user, db: $db_name");
 
+    if (function_exists('filter_var') && defined('FILTER_SANITIZE_FULL_SPECIAL_CHARS')) {
+        $db_host = filter_var($db_host, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
+    } else {
+        // Для PHP < 8.1
+        $db_host = htmlspecialchars($db_host, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
+    }
+    $db_name = preg_replace('/[^a-zA-Z0-9_-]/', '', $db_name);
+
     try {
         $temp_debug_message("Constructing DSN");
         
@@ -71,29 +79,31 @@ function new_connection ($db_type, $db_host, $db_user, $db_password, $db_name)
         
         if ($db_type === 'mysql') {
             $dsn = "mysql:host=$db_host;dbname=$db_name;charset=utf8mb4";
-            $options[PDO::MYSQL_ATTR_INIT_COMMAND] = "SET NAMES utf8mb4";
+            if (!empty($db_port)) { $dsn .= ";port=$db_port"; }
         } elseif ($db_type === 'pgsql' || $db_type === 'postgresql') {
-            $dsn = "pgsql:host=$db_host;dbname=$db_name;options='--client_encoding=UTF8'";
-            $options[PDO::ATTR_PERSISTENT] = true; // Опционально: включение постоянных соединений для PostgreSQL
+            $dsn = "pgsql:host=$db_host;dbname=$db_name";
+            if (!empty($db_port)) { $dsn .= ";port=$db_port"; }
+            $options[PDO::PGSQL_ATTR_DISABLE_PREPARES] = false;
         } else {
             throw new Exception("Unsupported database type: $db_type. Supported types: mysql, pgsql");
         }
-        
+
         $temp_debug_message("DSN: $dsn");
         $temp_debug_message("PDO options: " . json_encode($options));
         $temp_debug_message("Attempting to create PDO connection");
 
         $result = new PDO($dsn, $db_user, $db_password, $options);
+        // Устанавливаем кодировку для PostgreSQL
+        if ($db_type === 'pgsql' || $db_type === 'postgresql') {
+                $result->exec("SET client_encoding TO 'UTF8'");
+            }
 
-        // Теперь у нас есть соединение, можем использовать LOG_DEBUG
         $temp_debug_message("PDO connection created successfully");
         $temp_debug_message("PDO connection info: " . ($result->getAttribute(PDO::ATTR_CONNECTION_STATUS) ?? 'N/A for PostgreSQL'));
-        
         // Проверяем наличие атрибутов перед использованием
         if ($db_type === 'mysql') {
             $temp_debug_message("PDO client version: " . $result->getAttribute(PDO::ATTR_CLIENT_VERSION));
             $temp_debug_message("PDO server version: " . $result->getAttribute(PDO::ATTR_SERVER_VERSION));
-            
             // Проверка кодировки для MySQL
             $stmt = $result->query("SHOW VARIABLES LIKE 'character_set_connection'");
             $charset = $stmt->fetch(PDO::FETCH_ASSOC);
@@ -103,7 +113,6 @@ function new_connection ($db_type, $db_host, $db_user, $db_password, $db_name)
             $stmt = $result->query("SHOW server_encoding");
             $charset = $stmt->fetch(PDO::FETCH_ASSOC);
             $temp_debug_message("PostgreSQL server encoding: " . ($charset['server_encoding'] ?? 'not set'));
-            
             // Получаем версию PostgreSQL
             $stmt = $result->query("SELECT version()");
             $version = $stmt->fetch(PDO::FETCH_ASSOC);
@@ -523,7 +532,7 @@ function allow_update($table, $action = 'update', $field = '')
     if ($action == 'update') {
         $operator_acl = [
             'user_auth' => [
-                'comments' => '1',
+                'description' => '1',
                 'dns_name' => '1',
                 'dns_ptr_only' => '1',
                 'firmware' => '1',
@@ -661,7 +670,7 @@ function update_record($db, $table, $filter, $newvalue)
         if (!preg_match('/password/i', $key)) {
             $changed_log = $changed_log . " $key => $value (old: " . ($old[$key] ?? '') . "),";
         }
-        $set_parts[] = "`$key` = ?";
+        $set_parts[] = "$key = ?";
         $params[] = $value;
     }
 
@@ -741,11 +750,11 @@ function update_record($db, $table, $filter, $newvalue)
     }
 
     if ($network_changed) {
-        $set_parts[] = "`changed` = '1'";
+        $set_parts[] = "changed = '1'";
     }
 
     if ($dhcp_changed) {
-        $set_parts[] = "`dhcp_changed` = '1'";
+        $set_parts[] = "dhcp_changed = '1'";
     }
 
     $changed_log = substr_replace($changed_log, "", -1);
@@ -753,7 +762,7 @@ function update_record($db, $table, $filter, $newvalue)
 
     if ($table === 'user_auth') {
         $changed_time = GetNowTimeString();
-        $run_sql .= ", `changed_time` = ?";
+        $run_sql .= ", changed_time = ?";
         $params[] = $changed_time;
     }
 
@@ -842,7 +851,7 @@ function delete_record($db, $table, $filter)
     if ($table === 'user_auth') {
         $delete_it = 0;
         $changed_time = GetNowTimeString();
-        $new_sql = "UPDATE $table SET deleted=1, changed=1, `changed_time`='" . $changed_time . "' WHERE $filter";
+        $new_sql = "UPDATE $table SET deleted=1, changed=1, changed_time='" . $changed_time . "' WHERE $filter";
         LOG_DEBUG($db, "Run sql: $new_sql");
         try {
             $sql_result = $db->exec($new_sql);
@@ -923,44 +932,65 @@ function delete_record($db, $table, $filter)
 function insert_record($db, $table, $newvalue)
 {
     if (!allow_update($table, 'add')) {
-#        LOG_WARNING($db, "User does not have write permission");
+        // LOG_WARNING($db, "User does not have write permission");
         return;
     }
-    if (!isset($table)) {
-#        LOG_WARNING($db, "Create record for unknown table! Skip command.");
+    if (!isset($table) || empty($table)) {
+        // LOG_WARNING($db, "Create record for unknown table! Skip command.");
+        return;
+    }
+    if (empty($newvalue) || !is_array($newvalue)) {
+        // LOG_WARNING($db, "Create record ($table) with empty data! Skip command.");
         return;
     }
-    if (empty($newvalue)) {
-#        LOG_WARNING($db, "Create record ($table) with empty data! Skip command.");
+
+    // Валидация имени таблицы (защита от SQL-инъекций через имя таблицы)
+    if (!preg_match('/^[a-z_][a-z0-9_]*$/', $table)) {
+        // LOG_WARNING($db, "Invalid table name: $table");
         return;
     }
 
     $changed_log = '';
-    $field_list = '';
-    $value_list = '';
+    $field_list = [];
+    $value_list = [];
     $params = [];
+
     foreach ($newvalue as $key => $value) {
-        if (empty($value) and $value != '0') {
-            $value = '';
+        // Валидация имени колонки
+        if (!preg_match('/^[a-z_][a-z0-9_]*$/', $key)) {
+            // Пропускаем недопустимые имена колонок
+            continue;
         }
+
+        // Обработка пустых значений
+        if ('' === $value && '0' !== $value) {
+            $value = null; // или оставить как '', но null безопаснее для SQL
+        } else {
+            $value = trim((string)$value);
+        }
+
+        // Логирование (без паролей)
         if (!preg_match('/password/i', $key)) {
-            $changed_log = $changed_log . " $key => $value,";
+            $changed_log .= " $key => " . ($value ?? 'NULL') . ",";
         }
-        $field_list = $field_list . "`" . $key . "`,";
-        $value = trim($value);
-        $value_list = $value_list . "?,";
+
+        $field_list[] = $key;
+        $value_list[] = '?';
         $params[] = $value;
     }
-    if (empty($value_list)) {
+
+    if (empty($field_list)) {
         return;
     }
 
-    $changed_log = substr_replace($changed_log, "", -1);
-    $field_list = substr_replace($field_list, "", -1);
-    $value_list = substr_replace($value_list, "", -1);
-    $new_sql = "insert into $table(" . $field_list . ") values(" . $value_list . ")";
+    // Формируем SQL
+    $field_list_str = implode(',', $field_list);
+    $value_list_str = implode(',', $value_list);
+    $new_sql = "INSERT INTO $table ($field_list_str) VALUES ($value_list_str)";
+
     LOG_DEBUG($db, "Run sql: $new_sql");
-    
+
+
     try {
         $stmt = $db->prepare($new_sql);
         $sql_result = $stmt->execute($params);
@@ -1044,7 +1074,7 @@ function get_diff_rec($db, $table, $filter, $newvalue, $only_changed = false)
     if (!isset($table) || !isset($filter) || !isset($newvalue)) {
         return '';
     }
-    $old_sql = "SELECT * FROM `$table` WHERE $filter";
+    $old_sql = "SELECT * FROM $table WHERE $filter";
     try {
         $stmt = $db->query($old_sql);
         $old = $stmt->fetch(PDO::FETCH_ASSOC);

+ 4 - 4
html/public/blocked.php

@@ -88,7 +88,7 @@ if ($auth['blocked']) { print "<font color=red>".WEB_msg_traffic_blocked."</font
 <?php
 
 ####### day
-$sSQL = "SELECT SUM(byte_in) as tin, SUM(byte_out) as tout FROM user_stats WHERE `timestamp`>='".$date1."' AND `timestamp`<'".$date2."' AND auth_id='".$id."'";
+$sSQL = "SELECT SUM(byte_in) as tin, SUM(byte_out) as tout FROM user_stats WHERE timestamp>='".$date1."' AND timestamp<'".$date2."' AND auth_id='".$id."'";
 $day_auth_itog = get_record_sql($db_link,$sSQL);
 
 $day_auth_sum_in=0;
@@ -108,7 +108,7 @@ $auth_list = get_records_sql($db_link,"SELECT id FROM user_auth WHERE user_id='"
 
 if (!empty($auth_list)) {
     foreach ($auth_list as $row) {
-        $auth_itog2 = get_record_sql($db_link,"SELECT SUM(byte_in) as tin, SUM(byte_out) as tout FROM user_stats WHERE `timestamp`>='".$date1."' AND `timestamp`<'".$date2."' AND auth_id='".$row['id']."'");
+        $auth_itog2 = get_record_sql($db_link,"SELECT SUM(byte_in) as tin, SUM(byte_out) as tout FROM user_stats WHERE timestamp>='".$date1."' AND timestamp<'".$date2."' AND auth_id='".$row['id']."'");
         if (!empty($auth_itog2)) { 
                 if (empty($auth_itog2['tin'])) { $auth_itog2['tin']=0; }
                 if (empty($auth_itog2['tout'])) { $auth_itog2['tout']=0; }
@@ -119,7 +119,7 @@ if (!empty($auth_list)) {
     }
 
 #### month
-$sSQL = "SELECT SUM(byte_in) as tin, SUM(byte_out) as tout FROM user_stats WHERE `timestamp`>='".$date1m."' AND `timestamp`<'".$date2m."' AND auth_id='".$id."'";
+$sSQL = "SELECT SUM(byte_in) as tin, SUM(byte_out) as tout FROM user_stats WHERE timestamp>='".$date1m."' AND timestamp<'".$date2m."' AND auth_id='".$id."'";
 $month_auth_itog = get_record_sql($db_link,$sSQL);
 
 $month_auth_sum_in=0;
@@ -137,7 +137,7 @@ $month_user_sum_out=0;
 
 if (!empty($auth_list)) {
     foreach ($auth_list as $row) {
-        $auth_itog2 = get_record_sql($db_link,"SELECT SUM(byte_in) as tin, SUM(byte_out) as tout FROM user_stats WHERE `timestamp`>='".$date1m."' AND `timestamp`<'".$date2m."' AND auth_id='".$row['id']."'");
+        $auth_itog2 = get_record_sql($db_link,"SELECT SUM(byte_in) as tin, SUM(byte_out) as tout FROM user_stats WHERE timestamp>='".$date1m."' AND timestamp<'".$date2m."' AND auth_id='".$row['id']."'");
         if (!empty($auth_itog2)) {
                 if (empty($auth_itog2['tin'])) { $auth_itog2['tin']=0; }
                 if (empty($auth_itog2['tout'])) { $auth_itog2['tout']=0; }

+ 2 - 2
html/utils/auth_apply.php

@@ -67,8 +67,8 @@ if (isset($_POST["ApplyForAll"])) {
         if ($val) {
             unset($auth);
             //check user state
-            $cur_auth = get_record_sql($db_link, "SELECT * FROM user_auth WHERE `id`=" . $val);
-            if (!empty($cur_auth)) { $user_info = get_record_sql($db_link, "SELECT * FROM user_list WHERE `id`=" . $cur_auth["user_id"]); }
+            $cur_auth = get_record_sql($db_link, "SELECT * FROM user_auth WHERE id=" . $val);
+            if (!empty($cur_auth)) { $user_info = get_record_sql($db_link, "SELECT * FROM user_list WHERE id=" . $cur_auth["user_id"]); }
 
 
             if (isset($_POST["e_enabled"])) {

+ 4 - 4
html/utils/auth_export.php

@@ -5,15 +5,15 @@ require_once($_SERVER['DOCUMENT_ROOT'] . "/inc/languages/" . HTML_LANG . ".php")
 if (!defined("CONFIG")) die("Not defined");
 
 if (isset($_POST["ExportAuth"])) {
-    print "login;ip;mac;comment;dns name;last_found;connected\n";
+    print "login;ip;mac;description;dns name;last_found;connected\n";
     if (isset($_POST["a_selected"]) and $_POST["a_selected"] * 1) {
         //export selected only
         $auth_id = $_POST["fid"];
         foreach ($auth_id as $key => $val) {
             if ($val) {
-                $sSQL = "SELECT user_list.login, user_auth.ip, user_auth.mac, user_auth.comments, user_auth.dns_name, user_auth.last_found FROM user_auth, user_list WHERE user_auth.user_id = user_list.id AND user_auth.id = " . $val;
+                $sSQL = "SELECT user_list.login, user_auth.ip, user_auth.mac, user_auth.description, user_auth.dns_name, user_auth.last_found FROM user_auth, user_list WHERE user_auth.user_id = user_list.id AND user_auth.id = " . $val;
                 $record = get_record_sql($db_link, $sSQL);
-                print $record['login'] . ';' . $record['ip'] . ';' . $record['mac'] . ';' . $record['comments'] . ';' . $record['dns_name'] . ';' . $record['last_found'] . ';' . get_connection_string($db_link, $val)."\n";
+                print $record['login'] . ';' . $record['ip'] . ';' . $record['mac'] . ';' . $record['description'] . ';' . $record['dns_name'] . ';' . $record['last_found'] . ';' . get_connection_string($db_link, $val)."\n";
             }
         }
     } else {
@@ -25,6 +25,6 @@ if (isset($_POST["ExportAuth"])) {
         $sSQL = "SELECT user_auth.*, user_list.login, user_list.enabled as UEnabled, user_list.blocked as UBlocked FROM user_auth, user_list WHERE user_auth.user_id = user_list.id AND user_auth.deleted = 0 $ip_filter ORDER BY $sort";
         $auth_table = get_records_sql($db_link, $sSQL);
         foreach ($auth_table as $record) {
-            print $record['login'] . ';' . $record['ip'] . ';' . $record['mac'] . ';' . $record['comments'] . ';' . $record['dns_name'] . ';' . $record['last_found'] .';' . get_connection_string($db_link, $record['id']). "\n";
+            print $record['login'] . ';' . $record['ip'] . ';' . $record['mac'] . ';' . $record['description'] . ';' . $record['dns_name'] . ';' . $record['last_found'] .';' . get_connection_string($db_link, $record['id']). "\n";
         }
 }

+ 1 - 1
scripts/check_dhcp_pool.pl

@@ -58,7 +58,7 @@ $dhcp_conf{$subnet_name}->{dhcp_pool_size}=$subnet->{dhcp_stop}-$subnet->{dhcp_s
 }
 
 #get userid list
-my $sSQL="SELECT id,ip,ip_int,mac,comments,dns_name FROM user_auth where dhcp=1 and deleted=0 and ou_id<>$default_hotspot_ou_id and ou_id<>$default_user_ou_id ORDER by ip_int";
+my $sSQL="SELECT id,ip,ip_int,mac,description,dns_name FROM user_auth where dhcp=1 and deleted=0 and ou_id<>$default_hotspot_ou_id and ou_id<>$default_user_ou_id ORDER by ip_int";
 my @users = get_records_sql($dbh,$sSQL);
 foreach my $row (@users) {
 next if (!$row);

+ 1 - 1
scripts/eyelib/cmd.pm

@@ -733,7 +733,7 @@ exit";
 if ($device->{vendor_id} eq '9') {
     $telnet_cmd_mode = 4;
     if (!$descr) { $descr='""'; } else { $descr='"'.$descr.'"'; }
-    $cmd = "/interface ethernet set [ find default-name=$port ] comment=".$descr;
+    $cmd = "/interface ethernet set [ find default-name=$port ] description=".$descr;
     }
 
 #cisco

+ 29 - 29
scripts/eyelib/common.pm

@@ -127,7 +127,7 @@ my $id = shift;
 my $record = get_record_sql($db,'SELECT * FROM user_auth WHERE id='.$id);
 my $auth_ident = $record->{ip};
 $auth_ident = $auth_ident . '['.$record->{dns_name} .']' if ($record->{dns_name});
-$auth_ident = $auth_ident . ' :: '.$record->{comments} if ($record->{dns_name});
+$auth_ident = $auth_ident . ' :: '.$record->{description} if ($record->{dns_name});
 my $msg = "";
 my $txt_record = hash_to_text($record);
 #remove aliases
@@ -175,7 +175,7 @@ if (@user_auth and scalar @user_auth) {
         $send_alert = ($send_alert or isNotifyUpdate(get_notify_subnet($db,$record->{ip})));
         my $auth_ident = $record->{ip};
         $auth_ident = $auth_ident . '['.$record->{dns_name} .']' if ($record->{dns_name});
-        $auth_ident = $auth_ident . ' :: '.$record->{comments} if ($record->{dns_name});
+        $auth_ident = $auth_ident . ' :: '.$record->{description} if ($record->{dns_name});
         my $new;
         $new->{'blocked'}=0;
         $new->{'changed'}=1;
@@ -297,14 +297,14 @@ if ($hotspot_users->match_string($ip)) { $result->{ou_id}=$hotspot_users->match_
 if (defined $ip and $ip) {
     my $users = new Net::Patricia;
     #check ip rules
-    my @ip_rules = get_records_sql($db,'SELECT * FROM auth_rules WHERE type=1 and LENGTH(rule)>0 AND user_id IS NOT NULL');
+    my @ip_rules = get_records_sql($db,'SELECT * FROM auth_rules WHERE rule_type=1 and LENGTH(rule)>0 AND user_id IS NOT NULL');
     foreach my $row (@ip_rules) { eval { $users->add_string($row->{rule},$row->{user_id}); }; }
     if ($users->match_string($ip)) { $result->{user_id}=$users->match_string($ip); return $result; }
     }
 
 #check mac
 if (defined $mac and $mac) {
-    my @user_rules=get_records_sql($db,'SELECT * FROM auth_rules WHERE type=2 AND LENGTH(rule)>0 AND user_id IS NOT NULL');
+    my @user_rules=get_records_sql($db,'SELECT * FROM auth_rules WHERE rule_type=2 AND LENGTH(rule)>0 AND user_id IS NOT NULL');
     foreach my $user (@user_rules) {
 	my $rule = mac_simplify($user->{rule});
         if ($mac=~/$rule/i) { $result->{user_id}=$user->{user_id}; return $result; }
@@ -312,7 +312,7 @@ if (defined $mac and $mac) {
     }
 #check hostname
 if (defined $hostname and $hostname) {
-    my @user_rules=get_records_sql($db,'SELECT * FROM auth_rules WHERE type=3 AND LENGTH(rule)>0 AND user_id IS NOT NULL');
+    my @user_rules=get_records_sql($db,'SELECT * FROM auth_rules WHERE rule_type=3 AND LENGTH(rule)>0 AND user_id IS NOT NULL');
     foreach my $user (@user_rules) {
         if ($hostname=~/$user->{rule}/i) { $result->{user_id}=$user->{user_id}; return $result; }
         }
@@ -324,14 +324,14 @@ if (defined $hostname and $hostname) {
 if (defined $ip and $ip) {
     my $users = new Net::Patricia;
     #check ip rules
-    my @ip_rules = get_records_sql($db,'SELECT * FROM auth_rules WHERE type=1 and LENGTH(rule)>0 AND ou_id IS NOT NULL');
+    my @ip_rules = get_records_sql($db,'SELECT * FROM auth_rules WHERE rule_type=1 and LENGTH(rule)>0 AND ou_id IS NOT NULL');
     foreach my $row (@ip_rules) { eval { $users->add_string($row->{rule},$row->{ou_id}); }; }
     if ($users->match_string($ip)) { $result->{ou_id}=$users->match_string($ip); return $result; }
     }
 
 #check mac
 if (defined $mac and $mac) {
-    my @user_rules=get_records_sql($db,'SELECT * FROM auth_rules WHERE type=2 AND LENGTH(rule)>0 AND ou_id IS NOT NULL');
+    my @user_rules=get_records_sql($db,'SELECT * FROM auth_rules WHERE rule_type=2 AND LENGTH(rule)>0 AND ou_id IS NOT NULL');
     foreach my $user (@user_rules) {
 	my $rule = mac_simplify($user->{rule});
         if ($mac=~/$rule/i) { $result->{ou_id}=$user->{ou_id}; return $result; }
@@ -340,7 +340,7 @@ if (defined $mac and $mac) {
 
 #check hostname
 if (defined $hostname and $hostname) {
-    my @user_rules=get_records_sql($db,'SELECT * FROM auth_rules WHERE type=3 AND LENGTH(rule)>0 AND ou_id IS NOT NULL');
+    my @user_rules=get_records_sql($db,'SELECT * FROM auth_rules WHERE rule_type=3 AND LENGTH(rule)>0 AND ou_id IS NOT NULL');
     foreach my $user (@user_rules) {
         if ($hostname=~/$user->{rule}/i) { $result->{ou_id}=$user->{ou_id}; return $result; }
         }
@@ -418,11 +418,11 @@ if ($dns_cmd->{name_type}=~/^cname$/i) {
     $fqdn_parent = $fqdn_parent.".".$ad_zone;
 
     #remove cname
-    if ($dns_cmd->{type} eq 'del') {
+    if ($dns_cmd->{operation_type} eq 'del') {
         delete_dns_cname($fqdn_parent,$fqdn,$ad_zone,$ad_dns,$hdb);
         }
     #create cname
-    if ($dns_cmd->{type} eq 'add') {
+    if ($dns_cmd->{operation_type} eq 'add') {
         create_dns_cname($fqdn_parent,$fqdn,$ad_zone,$ad_dns,$hdb);
         }
     }
@@ -445,7 +445,7 @@ if ($dns_cmd->{name_type}=~/^a$/i) {
     #get aliases
     my @aliases = get_records_sql($hdb,"SELECT * FROM user_auth_alias WHERE auth_id=".$auth_id);
     #remove A & PTR
-    if ($dns_cmd->{type} eq 'del') {
+    if ($dns_cmd->{operation_type} eq 'del') {
         #remove aliases
         if (@aliases and scalar @aliases) {
                 foreach my $alias (@aliases) {
@@ -458,7 +458,7 @@ if ($dns_cmd->{name_type}=~/^a$/i) {
         delete_dns_ptr($fqdn,$fqdn_ip,$ad_zone,$ad_dns,$hdb);
         }
     #create A & PTR
-    if ($dns_cmd->{type} eq 'add') {
+    if ($dns_cmd->{operation_type} eq 'add') {
         my @dns_record=ResolveNames($fqdn,$dns_server);
         $static_exists = (scalar @dns_record>0);
         if ($static_exists) {
@@ -501,12 +501,12 @@ if ($dns_cmd->{name_type}=~/^ptr$/i) {
         next;
         }
     #remove A & PTR
-    if ($dns_cmd->{type} eq 'del') {
+    if ($dns_cmd->{operation_type} eq 'del') {
         #remove main record
         delete_dns_ptr($fqdn,$fqdn_ip,$ad_zone,$ad_dns,$hdb);
         }
     #create A & PTR
-    if ($dns_cmd->{type} eq 'add') {
+    if ($dns_cmd->{operation_type} eq 'add') {
         #create record
         create_dns_ptr($fqdn,$fqdn_ip,$ad_zone,$ad_dns,$hdb);
         }
@@ -1035,7 +1035,7 @@ my $result = insert_record($db,"user_list",$user);
 if ($result and $config_ref{auto_mac_rule} and $user_info->{mac}) {
     my $auth_rule;
     $auth_rule->{user_id} = $result;
-    $auth_rule->{type} = 2;
+    $auth_rule->{rule_type} = 2;
     $auth_rule->{rule} = mac_splitted($user_info->{mac});
     insert_record($db,"auth_rules",$auth_rule);
     }
@@ -1085,7 +1085,7 @@ my $ip = $ip_record->{'ip'};
 my $mac = $ip_record->{'mac'};
 my $action = $ip_record->{'type'};
 my $hostname = $ip_record->{'hostname_utf8'};
-my $client_id = $ip_record->{client_id};
+my $client_id = $ip_record->{'client_id'};
 
 if (!exists $ip_record->{ip_aton}) { $ip_record->{ip_aton}=StrToIp($ip); }
 if (!exists $ip_record->{hotspot}) { $ip_record->{hotspot}=is_hotspot($db,$ip); }
@@ -1104,7 +1104,7 @@ my $new_record;
 $new_record->{last_found}=$timestamp;
 $new_record->{arp_found}=$timestamp;
 
-if ($client_id) { $new_record->{client_id} = $client_id; }
+if ($client_id) { $new_record->{'client_id'} = $client_id; }
 
 #auth found?
 if ($record->{user_id}) {
@@ -1237,12 +1237,12 @@ if ($cur_auth_id) {
                     my $minutes = ($ou_info->{'life_duration'} - $hours) * 60;  # Дробная часть → минуты
                     # Создаём продолжительность с учётом дробных часов (в виде часов + минут)
                     my $duration = DateTime::Duration->new( hours   => $hours, minutes => $minutes);
-                    my $eof = $now + $duration;
+                    my $end_life = $now + $duration;
                     $new_record->{'dynamic'} = 1;
-                    $new_record->{'eof'} = $eof->strftime('%Y-%m-%d %H:%M:%S');
+                    $new_record->{'end_life'} = $end_life->strftime('%Y-%m-%d %H:%M:%S');
 		    }
 	    $new_record->{ou_id}=$user_record->{ou_id};
-	    $new_record->{comments}=$user_record->{fio};
+	    $new_record->{description}=$user_record->{fio};
 	    $new_record->{filter_group_id}=$user_record->{filter_group_id};
 	    $new_record->{queue_id}=$user_record->{queue_id};
 	    $new_record->{enabled}="$user_record->{enabled}";
@@ -1287,7 +1287,7 @@ $new_record->{ou_id}=$user_record->{ou_id};
 $new_record->{filter_group_id}=$user_record->{filter_group_id};
 $new_record->{queue_id}=$user_record->{queue_id};
 $new_record->{enabled}="$user_record->{enabled}";
-if ($user_record->{fio}) { $new_record->{comments}=$user_record->{fio}; }
+if ($user_record->{fio}) { $new_record->{description}=$user_record->{fio}; }
 
 my $cur_auth_id=insert_record($db,'user_auth',$new_record);
 if ($cur_auth_id) {
@@ -1511,11 +1511,11 @@ $dhcp_record->{'hostname'}=$client_hostname;
 $dhcp_record->{'network'}=$auth_network;
 $dhcp_record->{'type'}=$type;
 $dhcp_record->{'hostname_utf8'}=$client_hostname;
-$dhcp_record->{'timestamp'} = $timestamp;
+$dhcp_record->{'ts'} = $timestamp;
 $dhcp_record->{'last_time'} = time();
-$dhcp_record->{circuit_id} = $circuit_id;
-$dhcp_record->{client_id} = $client_id;
-$dhcp_record->{remote_id} = $remote_id;
+$dhcp_record->{'circuit_id'} = $circuit_id;
+$dhcp_record->{'client_id'} = $client_id;
+$dhcp_record->{'remote_id'} = $remote_id;
 $dhcp_record->{'hotspot'}=is_hotspot($dbh,$dhcp_record->{ip});
 
 #search actual record
@@ -1603,10 +1603,10 @@ $dhcp_log->{'ip_int'} = $dhcp_record->{'ip_aton'};
 $dhcp_log->{'mac'} = $dhcp_record->{'mac'};
 $dhcp_log->{'action'} = $type;
 $dhcp_log->{'dhcp_hostname'} = $dhcp_record->{'hostname_utf8'};
-$dhcp_log->{'timestamp'} = $dhcp_event_time;
-$dhcp_log->{circuit_id} = $circuit_id;
-$dhcp_log->{client_id} = $client_id;
-$dhcp_log->{remote_id} = $remote_id;
+$dhcp_log->{'ts'} = $dhcp_event_time;
+$dhcp_log->{'circuit_id'} = $circuit_id;
+$dhcp_log->{'client_id'} = $client_id;
+$dhcp_log->{'remote_id'} = $remote_id;
 
 insert_record($db,'dhcp_log',$dhcp_log);
 

+ 17 - 17
scripts/eyelib/database.pm

@@ -563,7 +563,7 @@ sub get_option_safe {
     my $sql = q{
         SELECT 
             COALESCE(c.value, co.default_value) as value,
-            co.type
+            co.option_type
         FROM config_options co
         LEFT JOIN config c ON c.option_id = co.id AND c.option_id = ?
         WHERE co.id = ?
@@ -580,7 +580,7 @@ sub get_option_safe {
     my $result = $record->{value};
     
     # Приводим к правильному типу
-    if ($record->{type} =~ /^(int|bool)/i) { 
+    if ($record->{option_type} =~ /^(int|bool)/i) { 
         $result = $result * 1; 
     }
     
@@ -752,7 +752,7 @@ if ($old_record->{'dns_name'} and $old_record->{'ip'} and !$old_record->{'dns_pt
 $del_dns->{'name_type'}='A';
 $del_dns->{'name'}=$old_record->{'dns_name'};
 $del_dns->{'value'}=$old_record->{'ip'};
-$del_dns->{'type'}='del';
+$del_dns->{'operation_type'}='del';
 if ($rec_id) { $del_dns->{'auth_id'}=$rec_id; }
 insert_record($db,'dns_queue',$del_dns);
 }
@@ -760,7 +760,7 @@ if ($old_record->{'dns_name'} and $old_record->{'ip'} and $old_record->{'dns_ptr
 $del_dns->{'name_type'}='PTR';
 $del_dns->{'name'}=$old_record->{'dns_name'};
 $del_dns->{'value'}=$old_record->{'ip'};
-$del_dns->{'type'}='del';
+$del_dns->{'operation_type'}='del';
 if ($rec_id) { $del_dns->{'auth_id'}=$rec_id; }
 insert_record($db,'dns_queue',$del_dns);
 }
@@ -773,7 +773,7 @@ if ($dns_rec_name and $dns_rec_ip and !$record->{'dns_ptr_only'} and $record->{'
 $new_dns->{'name_type'}='A';
 $new_dns->{'name'}=$dns_rec_name;
 $new_dns->{'value'}=$dns_rec_ip;
-$new_dns->{'type'}='add';
+$new_dns->{'operation_type'}='add';
 if ($rec_id) { $new_dns->{'auth_id'}=$rec_id; }
 insert_record($db,'dns_queue',$new_dns);
 }
@@ -781,7 +781,7 @@ if ($dns_rec_name and $dns_rec_ip and $record->{'dns_ptr_only'} and $record->{'d
 $new_dns->{'name_type'}='PTR';
 $new_dns->{'name'}=$dns_rec_name;
 $new_dns->{'value'}=$dns_rec_ip;
-$new_dns->{'type'}='add';
+$new_dns->{'operation_type'}='add';
 if ($rec_id) { $new_dns->{'auth_id'}=$rec_id; }
 insert_record($db,'dns_queue',$new_dns);
 }
@@ -793,7 +793,7 @@ my $del_dns;
 if ($old_record->{'alias'} and $old_record->{'alias'}!~/\.$/) {
 $del_dns->{'name_type'}='CNAME';
 $del_dns->{'name'}=$old_record->{'alias'};
-$del_dns->{'type'}='del';
+$del_dns->{'operation_type'}='del';
 $del_dns->{'value'}=get_dns_name($db,$old_record->{auth_id});
 $del_dns->{'auth_id'}=$old_record->{auth_id};
 insert_record($db,'dns_queue',$del_dns);
@@ -804,7 +804,7 @@ if ($record->{'alias'}) { $dns_rec_name = $record->{'alias'}; }
 if ($dns_rec_name and $record->{'alias'}!~/\.$/) {
 $new_dns->{'name_type'}='CNAME';
 $new_dns->{'name'}=$dns_rec_name;
-$new_dns->{'type'}='add';
+$new_dns->{'operation_type'}='add';
 $new_dns->{'value'}=get_dns_name($db,$old_record->{auth_id});
 $new_dns->{'auth_id'}=$rec_id;
 insert_record($db,'dns_queue',$new_dns);
@@ -879,7 +879,7 @@ my $add_dns;
 $add_dns->{'name_type'}='CNAME';
 $add_dns->{'name'}=$record->{'alias'};
 $add_dns->{'value'}=get_dns_name($db,$record->{'auth_id'});
-$add_dns->{'type'}='add';
+$add_dns->{'operation_type'}='add';
 $add_dns->{'auth_id'}=$record->{'auth_id'};
 insert_record($db,'dns_queue',$add_dns);
 }
@@ -890,7 +890,7 @@ my $add_dns;
 $add_dns->{'name_type'}='A';
 $add_dns->{'name'}=$record->{'dns_name'};
 $add_dns->{'value'}=$record->{'ip'};
-$add_dns->{'type'}='add';
+$add_dns->{'operation_type'}='add';
 $add_dns->{'auth_id'}=$result;
 insert_record($db,'dns_queue',$add_dns);
 }
@@ -899,7 +899,7 @@ my $add_dns;
 $add_dns->{'name_type'}='PTR';
 $add_dns->{'name'}=$record->{'dns_name'};
 $add_dns->{'value'}=$record->{'ip'};
-$add_dns->{'type'}='add';
+$add_dns->{'operation_type'}='add';
 $add_dns->{'auth_id'}=$result;
 insert_record($db,'dns_queue',$add_dns);
 }
@@ -949,7 +949,7 @@ my $del_dns;
 $del_dns->{'name_type'}='A';
 $del_dns->{'name'}=$old_record->{'dns_name'};
 $del_dns->{'value'}=$old_record->{'ip'};
-$del_dns->{'type'}='del';
+$del_dns->{'operation_type'}='del';
 $del_dns->{'auth_id'}=$old_record->{'id'};
 insert_record($db,'dns_queue',$del_dns);
 }
@@ -958,7 +958,7 @@ my $del_dns;
 $del_dns->{'name_type'}='PTR';
 $del_dns->{'name'}=$old_record->{'dns_name'};
 $del_dns->{'value'}=$old_record->{'ip'};
-$del_dns->{'type'}='del';
+$del_dns->{'operation_type'}='del';
 $del_dns->{'auth_id'}=$old_record->{'id'};
 insert_record($db,'dns_queue',$del_dns);
 }
@@ -973,7 +973,7 @@ my $del_dns;
 $del_dns->{'name_type'}='CNAME';
 $del_dns->{'name'}=$old_record->{'alias'};
 $del_dns->{'value'}=get_dns_name($db,$old_record->{'auth_id'});
-$del_dns->{'type'}='del';
+$del_dns->{'operation_type'}='del';
 $del_dns->{'auth_id'}=$old_record->{'auth_id'};
 insert_record($db,'dns_queue',$del_dns);
 }
@@ -994,9 +994,9 @@ my $default_option = get_record_sql($db,'SELECT * FROM config_options WHERE id='
 my $config_options = get_record_sql($db,'SELECT * FROM config WHERE option_id='.$option_id);
 my $result;
 if (!$config_options) {
-if ($default_option->{'type'}=~/^(int|bool)/i) { $result = $default_option->{'default_value'}*1; };
-if ($default_option->{'type'}=~/^(string|text)/i) { $result = $default_option->{'default_value'}; }
-if ($default_option->{'type'}=~/^list/i) { $result = $default_option->{'default_value'}; }
+if ($default_option->{'option_type'}=~/^(int|bool)/i) { $result = $default_option->{'default_value'}*1; };
+if ($default_option->{'option_type'}=~/^(string|text)/i) { $result = $default_option->{'default_value'}; }
+if ($default_option->{'option_type'}=~/^list/i) { $result = $default_option->{'default_value'}; }
 return $result;
 }
 $result = $config_options->{'value'};

+ 4 - 4
scripts/eyelib/nagios.pm

@@ -258,11 +258,11 @@ if (in_array([0,1,2],$device->{type})) {
             print(FH "       }\n\n");
     	    }
 	foreach my $conn (@{$device->{downlinks}}) {
-	    #id,port,snmp_index,comment
+	    #id,port,snmp_index,description
 	    print(FH "define service{\n");
     	    print(FH "       use                        $default_service\n");
             print(FH "       host_name                  $device->{name}\n");
-            my $port_description=translit($conn->{comment});
+            my $port_description=translit($conn->{description});
             if ($conn->{target_port_id}) { $port_description = $conn->{downlink_name}; }
             print(FH "       service_description port $conn->{port} - $port_description \n");
 	    if ($device->{snmp}->{version}<3) {
@@ -275,7 +275,7 @@ if (in_array([0,1,2],$device->{type})) {
 	    print(FH "define service{\n");
     	    print(FH "       use                        service-snmp-crc\n");
             print(FH "       host_name                  $device->{name}\n");
-            my $port_description=translit($conn->{comment});
+            my $port_description=translit($conn->{description});
             if ($conn->{target_port_id}) { $port_description = $conn->{downlink_name}; }
             print(FH "       service_description port $conn->{port} - $port_description CRC Errors\n");
             print(FH "       check_command              check_snmp_switch_crc!$snmp_string!$conn->{snmp_index}\n");
@@ -284,7 +284,7 @@ if (in_array([0,1,2],$device->{type})) {
 	    print(FH "define service{\n");
     	    print(FH "       use                        service-snmp-bandwidth\n");
             print(FH "       host_name                  $device->{name}\n");
-            my $port_description=translit($conn->{comment});
+            my $port_description=translit($conn->{description});
             if ($conn->{target_port_id}) { $port_description = $conn->{downlink_name}; }
             print(FH "       service_description port $conn->{port} - $port_description bandwidth usage\n");
             print(FH "       check_command              check_snmp_bandwidth!$snmp_string!$conn->{snmp_index}\n");

+ 8 - 23
scripts/fetch_new_arp.pl

@@ -67,12 +67,12 @@ foreach my $row (@u_ref) {
 # Clean temporary (dynamic) user authentication records that have expired
 my $now = DateTime->now(time_zone => 'local');
 my $clear_time = $dbh->quote($now->strftime('%Y-%m-%d %H:%M:%S'));
-my $users_sql = "SELECT * FROM user_auth WHERE deleted = 0 AND dynamic = 1 AND eof <= " . $clear_time;
+my $users_sql = "SELECT * FROM user_auth WHERE deleted = 0 AND dynamic = 1 AND end_life <= " . $clear_time;
 my @users_auth = get_records_sql($dbh, $users_sql);
 if (@users_auth and scalar @users_auth) {
     foreach my $row (@users_auth) {
         delete_user_auth($dbh, $row->{id});
-        db_log_info($dbh, "Removed dynamic user auth record for auth_id: $row->{'id'} by eof time: $row->{'eof'}", $row->{'id'});
+        db_log_info($dbh, "Removed dynamic user auth record for auth_id: $row->{'id'} by end_life time: $row->{'end_life'}", $row->{'id'});
         my $u_count = get_count_records($dbh, 'user_auth', 'deleted = 0 AND user_id = ' . $row->{user_id});
         if (!$u_count) {
             delete_user($dbh, $row->{'user_id'});
@@ -91,7 +91,7 @@ $year += 1900;
 # Set parallelization level: 5 processes per CPU core
 my $fork_count = $cpu_count * 5;
 
-# Optional: disable forking during debugging (currently commented out)
+# Optional: disable forking during debugging (currently descriptioned out)
 # if ($debug) { $fork_count = 0; }
 
 my $now_str = sprintf "%04d-%02d-%02d %02d:%02d:%02d", $year, $month, $day, $hour, $min, $sec;
@@ -169,9 +169,9 @@ $dbh = init_db();
 # Load all active user authentications indexed by IP
 my @authlist_ref = get_records_sql($dbh, "SELECT * FROM user_auth WHERE deleted = 0 ORDER BY ip_int");
 
+# full user ip records
 my $users = Net::Patricia->new;
 my %ip_list;
-my %oper_arp_list;
 
 foreach my $row (@authlist_ref) {
     $users->add_string($row->{ip}, $row->{id});
@@ -219,9 +219,6 @@ foreach my $arp_table (@arp_array) {
         } else {
             $mac_history{$simple_mac}{auth_id} = $cur_auth_id;
             $arp_record->{auth_id} = $cur_auth_id;
-            $arp_record->{updated} = 0;
-            $oper_arp_list{$cur_auth_id} = $arp_record;
-
             # Mark as changed if IP-to-auth mapping differs from previous state
             if ($auth_id ne $cur_auth_id) {
                 $mac_history{$simple_mac}{changed} = 1;
@@ -432,12 +429,11 @@ foreach my $device (@device_list) {
 
             if (exists $connections{$auth_id}) {
                 if ($port_id == $connections{$auth_id}{port}) {
-                    # No port change: just update last seen time if in current ARP
+                    # No port change: just update last seen time if in current MAC
                     if (exists $auth_table{oper_table}{$simple_mac}) {
                         my $auth_rec;
                         $auth_rec->{last_found} = $now_str;
-                        $auth_rec->{arp_found}  = $now_str;
-                        $oper_arp_list{$auth_id}{updated} = 1;
+	                $auth_rec->{mac_found}  = $now_str;
                         update_record($dbh, 'user_auth', $auth_rec, "id = $auth_id");
                     }
                     next;
@@ -451,8 +447,7 @@ foreach my $device (@device_list) {
 
                 my $auth_rec;
                 $auth_rec->{last_found} = $now_str;
-                $auth_rec->{arp_found}  = $now_str if exists $auth_table{oper_table}{$simple_mac};
-                $oper_arp_list{$auth_id}{updated} = 1;
+                $auth_rec->{mac_found}  = $now_str;
                 update_record($dbh, 'user_auth', $auth_rec, "id = $auth_id");
 
                 my $conn_rec;
@@ -468,8 +463,7 @@ foreach my $device (@device_list) {
 
                 my $auth_rec;
                 $auth_rec->{last_found} = $now_str;
-                $auth_rec->{arp_found}  = $now_str if exists $auth_table{oper_table}{$simple_mac};
-                $oper_arp_list{$auth_id}{updated} = 1;
+                $auth_rec->{mac_found}  = $now_str;
                 update_record($dbh, 'user_auth', $auth_rec, "id = $auth_id");
 
                 my $conn_rec;
@@ -506,15 +500,6 @@ foreach my $device (@device_list) {
     }
 }
 
-# Ensure all active ARP-auth entries have their 'last_found' timestamp updated
-foreach my $auth_id (keys %oper_arp_list) {
-    next if ($oper_arp_list{$auth_id}->{updated});
-    my $auth_rec;
-    $auth_rec->{last_found} = $now_str;
-    update_record($dbh, 'user_auth', $auth_rec, "id = $auth_id");
-    db_log_debug($dbh, "Update by ARP at unknown connection location for: " . Dumper($oper_arp_list{$auth_id})) if ($debug);
-}
-
 # Log all MAC movement/history events
 foreach my $mac (keys %mac_history) {
     next if (!$mac || !$mac_history{$mac}->{changed});

+ 5 - 5
scripts/garbage.pl

@@ -62,7 +62,7 @@ sub is_dhcp_pool {
     my $pools   = shift;
     my $ip_int  = shift;
     foreach my $subnet (keys %{$pools}) {
-        # Uncomment for debugging:
+        # Undescription for debugging:
         # print "net: $subnet ip: $ip_int pool: $pools->{$subnet}->{first_ip} .. $pools->{$subnet}->{last_ip}\n";
         if ($ip_int <= $pools->{$subnet}->{last_ip} && $ip_int >= $pools->{$subnet}->{first_ip}) {
             return $subnet;
@@ -291,7 +291,7 @@ if ($history_syslog_day) {
     my $clean_date = $now - $day_dur;
     my $clean_str = $dbh->quote($clean_date->ymd("-") . " 00:00:00");
     log_info($dbh, "Cleaning syslog entries older than $clean_str");
-    do_sql($dbh, "DELETE FROM remote_syslog WHERE date < $clean_str");
+    do_sql($dbh, "DELETE FROM remote_syslog WHERE ts < $clean_str");
 }
 
 # Clean old aggregated traffic statistics
@@ -350,7 +350,7 @@ foreach my $auth (@auth_full_list) {
         $new->{auth_id}   = $auth->{id};
         $new->{ip}        = $auth->{ip};
         $new->{mac}       = $auth_mac;
-        $new->{timestamp} = $auth->{last_found};
+        $new->{ts}        = $auth->{mac_found};
         db_log_info($dbh, "Auth id: $auth->{id} ($auth_mac) found at location: device_id=$new->{device_id}, port_id=$new->{port_id}");
         insert_record($dbh, "mac_history", $new);
         next;
@@ -364,7 +364,7 @@ foreach my $auth (@auth_full_list) {
         $new->{auth_id}   = $auth->{id};
         $new->{ip}        = $auth->{ip};
         $new->{mac}       = $auth_mac;
-        $new->{timestamp} = $auth->{last_found};
+        $new->{ts}        = $auth->{mac_found};
         db_log_info($dbh, "Auth id: $auth->{id} ($auth_mac) moved to new location: device_id=$new->{device_id}, port_id=$new->{port_id}");
         insert_record($dbh, "mac_history", $new);
     }
@@ -377,7 +377,7 @@ foreach my $auth (@auth_full_list) {
 #        my $opt_sql = "OPTIMIZE TABLE $table";
 #        my $opt_rf = $dbh->prepare($opt_sql) or die "Unable to prepare $opt_sql: " . $dbh->errstr;
 #        $opt_rf->execute();
-#        # Alternative (manual rebuild) is commented out:
+#        # Alternative (manual rebuild) is descriptioned out:
 #        # CREATE TABLE $table.new LIKE $table;
 #        # INSERT INTO $table.new SELECT * FROM $table;
 #        # RENAME TABLE $table TO $table.backup, $table.new TO $table;

+ 3 - 3
scripts/gen_nagios_config.pl

@@ -71,7 +71,7 @@ if (scalar(@netdev_list)>0) {
 	setCommunity($router);
 	$devices{$device_id}{snmp} = $router->{snmp};
 
-        $devices{$device_id}{description}=translit($router->{'comment'});
+        $devices{$device_id}{description}=translit($router->{'description'});
         $devices{$device_id}{name} = $router->{'device_name'};
         $devices{$device_id}{device_model_id} = $router->{'device_model_id'};
         if ($router->{'device_model_id'}) { $devices{$device_id}{device_model} = $models{$router->{'device_model_id'}};  }
@@ -127,7 +127,7 @@ if (scalar(@netdev_list)>0) {
 	#custom ports
         my @custom_ports = get_records_sql($dbh,"SELECT * FROM device_ports WHERE device_id=".$devices{$device_id}{device_id}." and target_port_id=0 and uplink=0 and nagios=1");
         foreach my $downlink_port (@custom_ports) {
-            #id,port,snmp_index,comment
+            #id,port,snmp_index,description
 	    push(@{$devices{$device_id}{downlinks}},$downlink_port);
     	    }
         }
@@ -185,7 +185,7 @@ if (scalar(@auth_list)>0) {
     		$devices{$device_id}{name} = "auth_id_".$auth->{id};
     		}
     	    }
-        $devices{$device_id}{description}=translit($auth->{'comments'}) || $devices{$device_id}{name};
+        $devices{$device_id}{description}=translit($auth->{'description'}) || $devices{$device_id}{name};
         $devices{$device_id}{auth_id} = $auth->{'id'};
         $devices{$device_id}{nagios_handler} = $auth->{'nagios_handler'};
         $devices{$device_id}{link_check} = $auth->{'link_check'};

+ 3 - 3
scripts/print-dnsmasq.pl

@@ -60,7 +60,7 @@ print "dhcp-option=net:net-$subnet_name,option:router,$dhcp_conf{$subnet_name}->
 }
 
 #get userid list
-my $sSQL="SELECT id,ip,ip_int,mac,comments,dns_name,dhcp_option_set,dhcp_acl,ou_id FROM user_auth where dhcp=1 and deleted=0 ORDER by ip_int";
+my $sSQL="SELECT id,ip,ip_int,mac,description,dns_name,dhcp_option_set,dhcp_acl,ou_id FROM user_auth where dhcp=1 and deleted=0 ORDER by ip_int";
 my @users = get_records_sql($dbh,$sSQL);
 foreach my $row (@users) {
 next if (!$row);
@@ -83,7 +83,7 @@ if (exists $mac_subnets{$subnet}{macs}{$row->{mac}}) {
 
 $mac_subnets{$subnet}{macs}{$row->{mac}} = $row;
 
-print '#Comment:'.$row->{comments}."\n" if ($row->{comments});
+print '#Comment:'.$row->{description}."\n" if ($row->{description});
 my $dns_name = '';
 if ($row->{dns_name}) {
     print '#DNS:'.$row->{dns_name}."\n";
@@ -130,7 +130,7 @@ next if (!$dns_name);
 
 #if (!$row->{dns_ptr_only} and ($dns_name or $row->{dhcp_hostname})) {
 if (!$row->{dns_ptr_only} and $dns_name) {
-    print '#Comment:'.$row->{comments}."\n" if ($row->{comments});
+    print '#Comment:'.$row->{description}."\n" if ($row->{description});
     if ($dns_name) {
         print '#DNS A-record '.$dns_name."\n";
         print 'address=/'.$dns_name.'/'.$row->{ip}."\n";

+ 2 - 2
scripts/stat-sync.pl

@@ -154,12 +154,12 @@ if (!$pid) {
             #clear temporary user auth records
             my $now = DateTime->now(time_zone=>'local');
             my $clear_time =$dbh->quote($now->strftime('%Y-%m-%d %H:%M:%S'));
-            my $users_sql = "SELECT * FROM user_auth WHERE deleted=0 AND dynamic=1 AND eof<=".$clear_time;
+            my $users_sql = "SELECT * FROM user_auth WHERE deleted=0 AND dynamic=1 AND end_life<=".$clear_time;
             my @users_auth = get_records_sql($hdb,$users_sql);
             if (@users_auth and scalar @users_auth) {
                     foreach my $row (@users_auth) {
                         delete_user_auth($hdb,$row->{id});
-                        db_log_info($hdb,"Removed dynamic user auth record for auth_id: $row->{'id'} by eof time: $row->{'eof'}",$row->{'id'});
+                        db_log_info($hdb,"Removed dynamic user auth record for auth_id: $row->{'id'} by end_life time: $row->{'end_life'}",$row->{'id'});
                         my $u_count=get_count_records($hdb,'user_auth','deleted=0 and user_id='.$row->{user_id});
                         if (!$u_count) { delete_user($hdb,$row->{'user_id'}); }
                         }

+ 12 - 12
scripts/sync_mikrotik.pl

@@ -245,17 +245,17 @@ my $found_subnet = $dhcp_networks->match_string($lease->{ip});
 next if (!$found_subnet);
 next if ($lease->{ip} eq $dhcp_conf{$found_subnet}->{relay_ip});
 $leases{$lease->{ip}}{ip}=$lease->{ip};
-$leases{$lease->{ip}}{comment}=$lease->{id};
+$leases{$lease->{ip}}{description}=$lease->{id};
 $leases{$lease->{ip}}{id}=$lease->{id};
 $leases{$lease->{ip}}{dns_name}=$lease->{dns_name};
-if ($lease->{comments}) { $leases{$lease->{ip}}{comment}=translit($lease->{comments}); }
+if ($lease->{description}) { $leases{$lease->{ip}}{description}=translit($lease->{description}); }
 $leases{$lease->{ip}}{mac}=uc(mac_splitted($lease->{mac}));
 if ($lease->{dhcp_acl}) {
     $leases{$lease->{ip}}{acl}=trim($lease->{dhcp_acl});
     $leases{$lease->{ip}}{acl}=~s/;/,/g;
     if ($leases{$lease->{ip}}{acl}=~/hotspot\-free/) {
         $hotspot_exceptions{$leases{$lease->{ip}}{mac}}=$leases{$lease->{ip}}{mac};
-        $hotspot_exceptions{$leases{$lease->{ip}}{mac}}=$leases{$lease->{ip}}{comment} if ($leases{$lease->{ip}}{comment});
+        $hotspot_exceptions{$leases{$lease->{ip}}{mac}}=$leases{$lease->{ip}}{description} if ($leases{$lease->{ip}}{description});
         }
     }
 if ($lease->{dhcp_option_set}) {
@@ -350,14 +350,14 @@ if ($leases{$ip}{acl}) { $acl = 'address-lists='.$leases{$ip}{acl}; }
 my $dhcp_option_set='';
 if ($leases{$ip}{dhcp_option_set}) { $dhcp_option_set = 'dhcp-option-set='.$leases{$ip}{dhcp_option_set}; }
 
-my $comment = $leases{$ip}{comment};
-$comment =~s/\=//g;
+my $description = $leases{$ip}{description};
+$description =~s/\=//g;
 
 my $dns_name='';
 if ($leases{$ip}{dns_name}) { $dns_name = $leases{$ip}{dns_name}; }
 $dns_name =~s/\=//g;
 
-if ($dns_name) { $comment = 'comment="'.$dns_name." - ".$comment.'"'; } else { $comment = 'comment="'.$comment.'"'; }
+if ($dns_name) { $description = 'description="'.$dns_name." - ".$description.'"'; } else { $description = 'description="'.$description.'"'; }
 
 if (!exists $active_leases{$ip}) {
     db_log_verbose($dbh,$gate_ident."Address $ip not found in router. Create static lease record.");
@@ -368,7 +368,7 @@ if (!exists $active_leases{$ip}) {
     push(@cmd_list,':foreach i in [/ip dhcp-server lease find where address='.$ip.' ] do={/ip dhcp-server lease remove $i};');
     push(@cmd_list,'/ip dhcp-server lease remove [find address='.$ip.']');
     #add new bind
-    push(@cmd_list,'/ip dhcp-server lease add address='.$ip.' mac-address='.$leases{$ip}{mac}.' '.$acl.' '.$dhcp_option_set.' server=dhcp-'.$int.' '.$comment);
+    push(@cmd_list,'/ip dhcp-server lease add address='.$ip.' mac-address='.$leases{$ip}{mac}.' '.$acl.' '.$dhcp_option_set.' server=dhcp-'.$int.' '.$description);
     #clear arp record
     push(@cmd_list,'/ip arp remove [find mac-address='.uc($leases{$ip}{mac}).']');
     next;
@@ -382,7 +382,7 @@ if ($leases{$ip}{mac}!~/$active_leases{$ip}{mac}/i) {
     push(@cmd_list,':foreach i in [/ip dhcp-server lease find where address='.$ip.' ] do={/ip dhcp-server lease remove $i};');
     push(@cmd_list,'/ip dhcp-server lease remove [find address='.$ip.']');
     #add new bind
-    push(@cmd_list,'/ip dhcp-server lease add address='.$ip.' mac-address='.$leases{$ip}{mac}.' '.$acl.' '.$dhcp_option_set.' server=dhcp-'.$int.' '.$comment);
+    push(@cmd_list,'/ip dhcp-server lease add address='.$ip.' mac-address='.$leases{$ip}{mac}.' '.$acl.' '.$dhcp_option_set.' server=dhcp-'.$int.' '.$description);
     #clear arp record
     push(@cmd_list,'/ip arp remove [find mac-address='.uc($leases{$ip}{mac}).']');
     next;
@@ -391,7 +391,7 @@ if (!(!$leases{$ip}{acl} and !$active_leases{$ip}{acl}) and $leases{$ip}{acl} ne
     db_log_error($dbh,$gate_ident."Acl mismatch for ip $ip. stat: $leases{$ip}{acl} active: $active_leases{$ip}{acl}. Create static lease record.");
     push(@cmd_list,':foreach i in [/ip dhcp-server lease find where mac-address='.uc($leases{$ip}{mac}).' ] do={/ip dhcp-server lease remove $i};');
     push(@cmd_list,'/ip dhcp-server lease remove [find mac-address='.uc($leases{$ip}{mac}).']');
-    push(@cmd_list,'/ip dhcp-server lease add address='.$ip.' mac-address='.$leases{$ip}{mac}.' '.$acl.' '.$dhcp_option_set.' server=dhcp-'.$int.' '.$comment);
+    push(@cmd_list,'/ip dhcp-server lease add address='.$ip.' mac-address='.$leases{$ip}{mac}.' '.$acl.' '.$dhcp_option_set.' server=dhcp-'.$int.' '.$description);
     #clear arp record
     push(@cmd_list,'/ip arp remove [find mac-address='.uc($leases{$ip}{mac}).']');
     next;
@@ -400,7 +400,7 @@ if (!(!$leases{$ip}{dhcp_option_set} and !$active_leases{$ip}{dhcp_option_set})
     db_log_error($dbh,$gate_ident."Acl mismatch for ip $ip. stat: $leases{$ip}{acl} active: $active_leases{$ip}{acl}. Create static lease record.");
     push(@cmd_list,':foreach i in [/ip dhcp-server lease find where mac-address='.uc($leases{$ip}{mac}).' ] do={/ip dhcp-server lease remove $i};');
     push(@cmd_list,'/ip dhcp-server lease remove [find mac-address='.uc($leases{$ip}{mac}).']');
-    push(@cmd_list,'/ip dhcp-server lease add address='.$ip.' mac-address='.$leases{$ip}{mac}.' '.$acl.' '.$dhcp_option_set.' server=dhcp-'.$int.' '.$comment);
+    push(@cmd_list,'/ip dhcp-server lease add address='.$ip.' mac-address='.$leases{$ip}{mac}.' '.$acl.' '.$dhcp_option_set.' server=dhcp-'.$int.' '.$description);
     #clear arp record
     push(@cmd_list,'/ip arp remove [find mac-address='.uc($leases{$ip}{mac}).']');
     next;
@@ -426,7 +426,7 @@ if (@ret_hotspot and scalar(@ret_hotspot)) {
             }
         if (exists $data{'mac-address'}) {
             $actual_hotspot_bindings{$data{'mac-address'}} = $data{'mac-address'};
-            $actual_hotspot_bindings{$data{'mac-address'}} = $data{comment} if (exists $data{comment});
+            $actual_hotspot_bindings{$data{'mac-address'}} = $data{description} if (exists $data{description});
             }
     }
     log_debug("Actual bindings:".Dumper(\%actual_hotspot_bindings));
@@ -442,7 +442,7 @@ if (@ret_hotspot and scalar(@ret_hotspot)) {
         if (!exists $actual_hotspot_bindings{$actual_mac}) {
             db_log_info($dbh,$gate_ident."Address $actual_mac added to hotspot ip-binding");
             push(@cmd_list,':foreach i in [/ip hotspot ip-binding find where mac-address='.uc($actual_mac).' ] do={/ip hotspot ip-binding remove $i};');
-            push(@cmd_list,'/ip hotspot ip-binding add mac-address='.uc($actual_mac).'  type=bypassed  comment="'.$hotspot_exceptions{$actual_mac}.'"');
+            push(@cmd_list,'/ip hotspot ip-binding add mac-address='.uc($actual_mac).'  type=bypassed  description="'.$hotspot_exceptions{$actual_mac}.'"');
             }
         }
     }

+ 3 - 3
scripts/sync_mikrotik_poe_monitor.pl

@@ -91,12 +91,12 @@ if (defined $work_list{$current_port}) {
     if ($work_list{$current_port}{ip} ne $current_list{$current_port}) {
         db_log_info($dbh,"Change settings poe monitor at $switch_name [$current_port] to ip: $work_list{$current_port}{ip}");
         push(@cmd_list,'/interface ethernet set [ find default-name='.$current_port.' ] power-cycle-ping-address='.$work_list{$current_port}{ip}.' power-cycle-ping-enabled=yes power-cycle-ping-timeout=5m'); 
-        push(@cmd_list,'/interface ethernet set [ find default-name='.$current_port.' ] comment='.$work_list{$current_port}{dns_name}); 
+        push(@cmd_list,'/interface ethernet set [ find default-name='.$current_port.' ] description='.$work_list{$current_port}{dns_name}); 
         }
     } else {
     db_log_info($dbh,"Disable poe monitor at $switch_name [$current_port]");
     push(@cmd_list,'/interface ethernet set [ find default-name='.$current_port.' ] power-cycle-ping-enabled=no');
-    push(@cmd_list,'/interface ethernet set [ find default-name='.$current_port.' ] comment=""'); 
+    push(@cmd_list,'/interface ethernet set [ find default-name='.$current_port.' ] description=""'); 
     }
 }
 
@@ -104,7 +104,7 @@ foreach my $work_port (keys %work_list) {
 if (!defined $current_list{$work_port}) {
     db_log_info($dbh,"Enable poe monitor at $switch_name [$work_port] for $work_list{$work_port}{ip}");
     push(@cmd_list,'/interface ethernet set [ find default-name='.$work_port.' ] power-cycle-ping-address='.$work_list{$work_port}{ip}.' power-cycle-ping-enabled=yes power-cycle-ping-timeout=5m');
-    push(@cmd_list,'/interface ethernet set [ find default-name='.$work_port.' ] comment='.$work_list{$work_port}{dns_name});
+    push(@cmd_list,'/interface ethernet set [ find default-name='.$work_port.' ] description='.$work_list{$work_port}{dns_name});
     }
 }
 

+ 12 - 0
scripts/updates/3-0-1/migration.msql

@@ -25,6 +25,10 @@ ALTER TABLE group_filters
 ALTER TABLE user_auth
   CHANGE COLUMN `client-id` client_id VARCHAR(250);
 
+-- Переименовываем eof → end_life в user_auth
+ALTER TABLE user_auth
+  CHANGE COLUMN `eof` end_life TIMESTAMP NULL DEFAULT NULL;
+
 ALTER TABLE dhcp_log
   CHANGE COLUMN `client-id` client_id VARCHAR(250),
   CHANGE COLUMN `circuit-id` circuit_id VARCHAR(255),
@@ -72,7 +76,15 @@ ALTER TABLE vendors         CHANGE COLUMN `comment` description VARCHAR(255);
 -- ⚠️ user_auth.comments → description
 ALTER TABLE user_auth       CHANGE COLUMN `comments` description VARCHAR(250);
 
+-- Добавляем поле mac_found в user_auth (аналог arp_found)
+ALTER TABLE user_auth
+  ADD COLUMN mac_found TIMESTAMP NULL DEFAULT NULL;
+
 -- type → уточнённые имена
 ALTER TABLE config_options  CHANGE COLUMN `type` option_type VARCHAR(100) NOT NULL;
 ALTER TABLE dns_queue       CHANGE COLUMN `type` operation_type VARCHAR(10) NOT NULL DEFAULT 'add';
 ALTER TABLE filter_list     CHANGE COLUMN `type` filter_type SMALLINT NOT NULL DEFAULT 0;
+
+UPDATE user_auth
+SET mac_found = last_found
+WHERE last_found IS NOT NULL;

+ 12 - 0
scripts/updates/3-0-1/migration.psql

@@ -24,6 +24,10 @@ ALTER TABLE group_filters RENAME COLUMN "order" TO rule_order;
 -- user_auth: client-id → client_id
 ALTER TABLE user_auth RENAME COLUMN "client-id" TO client_id;
 
+-- Переименовываем eof → end_life в user_auth
+ALTER TABLE user_auth
+  RENAME COLUMN eof TO end_life;
+
 -- dhcp_log: дефисы → подчёркивания
 ALTER TABLE dhcp_log RENAME COLUMN "client-id" TO client_id;
 ALTER TABLE dhcp_log RENAME COLUMN "circuit-id" TO circuit_id;
@@ -64,7 +68,15 @@ ALTER TABLE user_auth RENAME COLUMN comments TO description;
 ALTER TABLE user_list RENAME COLUMN comment TO description;
 ALTER TABLE vendors RENAME COLUMN comment TO description;
 
+-- Добавляем поле mac_found в user_auth (аналог arp_found)
+ALTER TABLE user_auth
+  ADD COLUMN mac_found TIMESTAMP;
+
 -- type → уточнённые имена
 ALTER TABLE config_options RENAME COLUMN type TO option_type;
 ALTER TABLE dns_queue RENAME COLUMN type TO operation_type;
 ALTER TABLE filter_list RENAME COLUMN type TO filter_type;
+
+UPDATE user_auth
+SET mac_found = last_found
+WHERE last_found IS NOT NULL;

+ 4 - 4
scripts/utils/import/import_auth.pl

@@ -128,9 +128,9 @@ if ($auth_record) {
         $device->{device_name}=$record->{dns_name};
         update_record($dbh,'devices',$device,"user_id=".$auth_record->{user_id});
         }
-    if (exists $record->{comments}) {
+    if (exists $record->{description}) {
         my $user_info;
-        $user_info->{fio}=$record->{comments};
+        $user_info->{fio}=$record->{description};
         update_record($dbh,'user_list',$user_info,"id=".$auth_record->{user_id});
         }
     next;
@@ -156,9 +156,9 @@ if ($auth_record) {
         $device->{device_name}=$record->{dns_name};
         update_record($dbh,'devices',$device,"user_id=".$auth_record->{user_id});
         }
-    if (exists $record->{comments}) {
+    if (exists $record->{description}) {
         my $user_info;
-        $user_info->{fio}=$record->{comments};
+        $user_info->{fio}=$record->{description};
         update_record($dbh,'user_list',$user_info,"id=".$auth_record->{user_id});
         }
     }

+ 3 - 3
scripts/utils/print_cacti_create.pl

@@ -14,7 +14,7 @@ use utf8;
 
 
 ##### unknown mac clean ############
-my $db_sql = "Select device_name,ip,comment,snmp_version,community from devices";
+my $db_sql = "Select device_name,ip,description,snmp_version,community from devices";
 $dbh->do("set character set utf8");
 $dbh->do("set names utf8");
 
@@ -24,10 +24,10 @@ my $db_list=$db->fetchall_arrayref();
 $db->finish;
 
 foreach my $row (@$db_list) {
-my ($device_name,$ip,$comment,$snmp_version,$community)=@$row;
+my ($device_name,$ip,$description,$snmp_version,$community)=@$row;
 next if (!$ip);
 my $notes='';
-if ($comment) { $notes="--notes='".$comment."'"; }
+if ($description) { $notes="--notes='".$description."'"; }
 print "php add_device.php --description='".$device_name."' $notes --ip='".$ip."' --template=2 --site=1 --version=$snmp_version --community='".$community."'\n";
 }
 

+ 3 - 3
scripts/utils/print_cacti_hosts.pl

@@ -15,7 +15,7 @@ use utf8;
 
 ##### unknown mac clean ############
 
-my $db_sql = "Select device_name,ip,comment,snmp_version,community from devices";
+my $db_sql = "Select device_name,ip,description,snmp_version,community from devices";
 $dbh->do("set character set utf8");
 $dbh->do("set names utf8");
 
@@ -25,10 +25,10 @@ my $db_list=$db->fetchall_arrayref();
 $db->finish;
 
 foreach my $row (@$db_list) {
-my ($device_name,$ip,$comment,$snmp_version,$community)=@$row;
+my ($device_name,$ip,$description,$snmp_version,$community)=@$row;
 next if (!$ip);
 my $notes='';
-if ($comment) { $notes="--notes='".$comment."'"; }
+if ($description) { $notes="--notes='".$description."'"; }
 print "php add_device.php --description='".$device_name."' $notes --ip='".$ip."' --template=2 --site=1 --version=$snmp_version --community='".$community."'\n";
 }
 

+ 1 - 1
scripts/utils/reaply_rules.pl

@@ -45,7 +45,7 @@ next if (!$row);
 my $new_user=get_new_user_id($dbh,$row->{'ip'},$row->{'mac'});
 if ($new_user->{ou_id} ne $group_id) { next; }
 if ($new_user->{ou_id} ne $row->{ou_id}) {
-    print "MOVED: $row->{ip} $row->{mac} $row->{comments} to $new_user->{ou_id}\n";
+    print "MOVED: $row->{ip} $row->{mac} $row->{description} to $new_user->{ou_id}\n";
     my $auth->{ou_id}=$new_user->{ou_id};
     update_record($dbh,"user_auth",$auth,"id=".$row->{id});
     my $user->{ou_id}=$new_user->{ou_id};

+ 6 - 6
scripts/utils/set_port_descr.pl

@@ -29,7 +29,7 @@ use Fcntl qw(:flock);
 open(SELF,"<",$0) or die "Cannot open $0 - $!";
 flock(SELF, LOCK_EX|LOCK_NB) or exit 1;
 
-my @auth_list = get_records_sql($dbh,"SELECT A.id,A.user_id,A.ip,A.mac,A.dns_name,A.comments,A.dhcp_hostname,A.WikiName,K.login,K.ou_id FROM user_auth as A, user_list as K WHERE K.id=A.user_id AND A.deleted=0 ORDER BY A.id");
+my @auth_list = get_records_sql($dbh,"SELECT A.id,A.user_id,A.ip,A.mac,A.dns_name,A.description,A.dhcp_hostname,A.WikiName,K.login,K.ou_id FROM user_auth as A, user_list as K WHERE K.id=A.user_id AND A.deleted=0 ORDER BY A.id");
 
 my %auth_ref;
 foreach my $auth (@auth_list) {
@@ -38,7 +38,7 @@ $auth_ref{$auth->{id}}{ou_id}=$auth->{ou_id};
 $auth_ref{$auth->{id}}{ip}=$auth->{ip};
 $auth_ref{$auth->{id}}{mac}=$auth->{mac};
 $auth_ref{$auth->{id}}{dns_name}=$auth->{dns_name};
-$auth_ref{$auth->{id}}{comments}=$auth->{comments};
+$auth_ref{$auth->{id}}{description}=$auth->{description};
 $auth_ref{$auth->{id}}{dhcp_hostname}=$auth->{dhcp_hostname};
 $auth_ref{$auth->{id}}{WikiName}=$auth->{WikiName};
 $auth_ref{$auth->{id}}{login}=$auth->{login};
@@ -46,7 +46,7 @@ my $a_netdev = get_record_sql($dbh,"SELECT * FROM devices WHERE user_id = ".$aut
 $auth_ref{$auth->{id}}{device}=$a_netdev;
 if ($auth->{dns_name}) { $auth_ref{$auth->{id}}{description} = $auth->{dns_name}; }
 if (!$auth_ref{$auth->{id}}{description} and $auth->{WikiName}) { $auth_ref{$auth->{id}}{description} = $auth->{WikiName}; }
-if (!$auth_ref{$auth->{id}}{description} and $auth->{comments}) { $auth_ref{$auth->{id}}{description} = translit($auth->{comments}); }
+if (!$auth_ref{$auth->{id}}{description} and $auth->{description}) { $auth_ref{$auth->{id}}{description} = translit($auth->{description}); }
 if (!$auth_ref{$auth->{id}}{description}) { $auth_ref{$auth->{id}}{description} = $auth->{ip}; }
 $auth_ref{$auth->{id}}{description}=~s/\./-/g;
 $auth_ref{$auth->{id}}{description}=~s/\(/_/g;
@@ -55,7 +55,7 @@ $auth_ref{$auth->{id}}{description}=~s/\)/_/g;
 
 my %port_info;
 
-my $d_sql="SELECT DP.id, D.ip, D.device_name, D.device_model_id, DP.port, DP.snmp_index, DP.comment, DP.target_port_id, D.vendor_id, D.device_type
+my $d_sql="SELECT DP.id, D.ip, D.device_name, D.device_model_id, DP.port, DP.snmp_index, DP.description, DP.target_port_id, D.vendor_id, D.device_type
 FROM devices AS D, device_ports AS DP
 WHERE D.id = DP.device_id AND (D.device_type <=1) AND D.deleted=0
 ORDER BY D.device_name,DP.port";
@@ -69,7 +69,7 @@ $port_info{$port->{id}}{ip}=$port->{ip};
 $port_info{$port->{id}}{device_model_id}=$port->{device_model_id};
 $port_info{$port->{id}}{port}=$port->{port};
 $port_info{$port->{id}}{snmp_index}=$port->{snmp_index};
-$port_info{$port->{id}}{comment}=$port->{comment};
+$port_info{$port->{id}}{description}=$port->{description};
 $port_info{$port->{id}}{target_port_id}=$port->{target_port_id};
 $port_info{$port->{id}}{vendor_id}=$port->{vendor_id};
 $port_info{$port->{id}}{device_type}=$port->{device_type};
@@ -116,7 +116,7 @@ foreach my $port_id (keys %port_info) {
 if ($port_info{$port_id}{target_port_id}) {
     $port_info{$port_id}{description}=$port_info{$port_info{$port_id}{target_port_id}}{device_name}." [".$port_info{$port_info{$port_id}{target_port_id}}{port}.']';
     }
-if (!$port_info{$port_id}{description} and $port_info{$port_id}{comment}) { $port_info{$port_id}{description}=translit($port_info{$port_id}{comment}); }
+if (!$port_info{$port_id}{description} and $port_info{$port_id}{description}) { $port_info{$port_id}{description}=translit($port_info{$port_id}{description}); }
 $devices{$port_info{$port_id}{device_name}}{ports}{$port_info{$port_id}{port}}{description}=$port_info{$port_id}{description};
 $devices{$port_info{$port_id}{device_name}}{ports}{$port_info{$port_id}{port}}{snmp_index}=$port_info{$port_id}{snmp_index};
 $devices{$port_info{$port_id}{device_name}}{device_name}=$port_info{$port_id}{device_name};

+ 2 - 2
scripts/utils/sync_ccd.pl

@@ -194,9 +194,9 @@ sub process_ovpn_config {
 
     # Обрабатываем каждый auth record
     foreach my $auth (@$ip_list) {
-        next unless $auth->{comments} && $auth->{ip};
+        next unless $auth->{description} && $auth->{ip};
         next if (!$ServerNet->match_string($auth->{ip}));
-        my $username = $auth->{comments};
+        my $username = $auth->{description};
         my $ip = $auth->{ip};
         process_ccd_file($ccd_dir, $username, $ip, $network_mask);
     }

+ 2 - 2
scripts/utils/win32/sync-dhcpd-netsh.pl

@@ -68,14 +68,14 @@ foreach my $scope (keys %dhcp_scope) {
         next if ($row!~/Add reservedip/i);
         $row=~s/\"//g;
         $row = $converter->convert($row);
-        my ($a1,$a2,$a3,$a4,$a5,$a6,$a7,$reserved_ip,$reserved_mac,$hostname,$comment,$dhcp_type)=split(/ /,$row);
+        my ($a1,$a2,$a3,$a4,$a5,$a6,$a7,$reserved_ip,$reserved_mac,$hostname,$description,$dhcp_type)=split(/ /,$row);
         if (length($reserved_mac)>12) {
             $dhcp_state_current{$scope}{$reserved_ip}{clientid}=$reserved_mac;
             } else {
             $dhcp_state_current{$scope}{$reserved_ip}{mac}=mac_simplify($reserved_mac);
             }
         $dhcp_state_current{$scope}{$reserved_ip}{hostname}=$hostname;
-        $dhcp_state_current{$scope}{$reserved_ip}{comment}=$comment;
+        $dhcp_state_current{$scope}{$reserved_ip}{description}=$description;
         }
     $run_cmd=$winexe." -U '".$domain_auth."' '//".$dhcp_server."' \"netsh Dhcp Server Scope ".$scope." show clients\" 2>/dev/null";
     @scope_dump=`$run_cmd`;