| 1 | <?php
|
|---|
| 2 |
|
|---|
| 3 | include_once(dirname(__FILE__).'/NetworkModels.php');
|
|---|
| 4 | include_once(dirname(__FILE__).'/HostList.php');
|
|---|
| 5 | include_once(dirname(__FILE__).'/Subnet.php');
|
|---|
| 6 | include_once(dirname(__FILE__).'/Hosting.php');
|
|---|
| 7 | include_once(dirname(__FILE__).'/UserHosts.php');
|
|---|
| 8 |
|
|---|
| 9 | class PageFrequencyPlan extends Page
|
|---|
| 10 | {
|
|---|
| 11 | function __construct(System $System)
|
|---|
| 12 | {
|
|---|
| 13 | parent::__construct($System);
|
|---|
| 14 | $this->Title = 'Frekvenční plán';
|
|---|
| 15 | $this->Description = 'Výpis obsazení frekvenčních kanálů';
|
|---|
| 16 | $this->ParentClass = 'PageNetwork';
|
|---|
| 17 | }
|
|---|
| 18 |
|
|---|
| 19 | function Show(): string
|
|---|
| 20 | {
|
|---|
| 21 | // http://en.wikipedia.org/wiki/List_of_WLAN_channels
|
|---|
| 22 | //$ChannelList = array(2412 => 1, 2417 => 2, 2422 => 3, 2427 => 4, 2432 => 5, 2437 => 6, 2442 => 7, 2447 => 8, 2452 => 9, 2457 => 10, 2462 => 11, 2467 => 12, 2472 => 13, 5200 => 40, 5205 => 41, 5210 => 42, 5215 => 43, 5220 => 44, 5225 => 45, 5230 => 46, 5235 => 47, 5240 => 48, 5245 => 49, 5250 => 50, 5255 => 51, 5260 => 52, 5265 => 53, 5270 => 54, 5275 => 55, 5280 => 56, 5285 => 57, 5290 => 58, 5295 => 59, 5300 => 60, 5500 => 100, 5520 => 104, 5540 => 108, 5560 => 112, 5580 => 116, 5600 => 120, 5620 => 124, 5640 => 128, 5660 => 132, 5700 => 140, 5720 => 144);
|
|---|
| 23 | $Output = '<div align="center">'.
|
|---|
| 24 | '<a href="?section=obsazeni_wifi_kanalu&range=a">Pásmo 2,4 GHz (a)</a> '.
|
|---|
| 25 | '<a href="?section=obsazeni_wifi_kanalu&range=bc">Pásmo 5 GHz dolní (b, c)</a> '.
|
|---|
| 26 | '<a href="?section=obsazeni_wifi_kanalu&range=d">Pásmo 5 GHz horní (d)</a> '.
|
|---|
| 27 | '<a href="https://www.ctu.cz/sites/default/files/obsah/vo-r12-032021-3.pdf">VO-R/12/03.2021-3</a><br/>'.
|
|---|
| 28 | '<strong>Seznam známých AP a obsazení kmitočtových pásem:</strong></div>'.
|
|---|
| 29 | '<table class="WideTable">'.
|
|---|
| 30 | '<tr><th/><br/>SSID<br/><br/></th>';
|
|---|
| 31 | $ChannelList = array();
|
|---|
| 32 | if (!array_key_exists('range', $_GET)) $_GET['range'] = 'a';
|
|---|
| 33 | if ($_GET['range'] == 'a')
|
|---|
| 34 | {
|
|---|
| 35 | $Where = '(Frequency < 5000)';
|
|---|
| 36 | for ($Freq = 2402; $Freq <= 2482; $Freq = $Freq + 5) $ChannelList[] = $Freq;
|
|---|
| 37 | }
|
|---|
| 38 | if ($_GET['range'] == 'bc')
|
|---|
| 39 | {
|
|---|
| 40 | $Where = '(Frequency >= 5000) AND (Frequency <= 5350)';
|
|---|
| 41 | for ($Freq = 5150; $Freq <= 5350; $Freq = $Freq + 5) $ChannelList[] = $Freq;
|
|---|
| 42 | }
|
|---|
| 43 | if ($_GET['range'] == 'd')
|
|---|
| 44 | {
|
|---|
| 45 | $Where = '(Frequency >= 5470)';
|
|---|
| 46 | for ($Freq = 5470; $Freq <= 5725; $Freq = $Freq + 5) $ChannelList[] = $Freq;
|
|---|
| 47 | }
|
|---|
| 48 |
|
|---|
| 49 | foreach ($ChannelList as $Frequency)
|
|---|
| 50 | {
|
|---|
| 51 | $Output .= '<th><div class="RotatedHeader">'.$Frequency.'<div></th>';
|
|---|
| 52 | }
|
|---|
| 53 | $Output .= '</tr>';
|
|---|
| 54 | $DbResult = $this->Database->query('SELECT `Frequency` FROM `NetworkInterfaceWireless` WHERE '.$Where.' AND (`Mode`=0) GROUP BY `Frequency`');
|
|---|
| 55 | while ($DbRow = $DbResult->fetch_assoc())
|
|---|
| 56 | {
|
|---|
| 57 | $DbResult2 = $this->Database->query('SELECT * FROM `NetworkInterfaceWireless` WHERE (`Frequency`='.$DbRow['Frequency'].') AND '.$Where);
|
|---|
| 58 | while ($DbRow2 = $DbResult2->fetch_assoc())
|
|---|
| 59 | {
|
|---|
| 60 | $LowFrequency = $DbRow['Frequency'] - $DbRow2['ChannelWidth'] / 2 - $DbRow2['ChannelWidthLower'];
|
|---|
| 61 | $HighFrequency = $DbRow['Frequency'] + $DbRow2['ChannelWidth'] / 2 + $DbRow2['ChannelWidthUpper'];
|
|---|
| 62 | $Output .= '<tr><td>'.$DbRow2['SSID'].'</td>';
|
|---|
| 63 | foreach ($ChannelList as $Frequency)
|
|---|
| 64 | {
|
|---|
| 65 | if (($DbRow2['Frequency'] == $Frequency)) $Color = '#408040';
|
|---|
| 66 | else if (($LowFrequency <= ($Frequency - 2.5)) and ($HighFrequency >= ($Frequency + 2.5))) $Color = '#50d050';
|
|---|
| 67 | else if (($LowFrequency == $Frequency) or ($HighFrequency == $Frequency)) $Color = '#a0d0a0';
|
|---|
| 68 | else $Color = '#ffffff';
|
|---|
| 69 | $Output .= '<td style="background-color: '.$Color.';"> </td>';
|
|---|
| 70 | }
|
|---|
| 71 |
|
|---|
| 72 | $Output .= '</tr>';
|
|---|
| 73 | }
|
|---|
| 74 | }
|
|---|
| 75 | $Output .= '</table>';
|
|---|
| 76 | return $Output;
|
|---|
| 77 | }
|
|---|
| 78 | }
|
|---|
| 79 |
|
|---|
| 80 | class PageNetwork extends Page
|
|---|
| 81 | {
|
|---|
| 82 | function __construct(System $System)
|
|---|
| 83 | {
|
|---|
| 84 | parent::__construct($System);
|
|---|
| 85 | $this->Title = 'Síť';
|
|---|
| 86 | $this->Description = 'Technické informace o síti';
|
|---|
| 87 | $this->ParentClass = 'PagePortal';
|
|---|
| 88 | }
|
|---|
| 89 |
|
|---|
| 90 | function Show(): string
|
|---|
| 91 | {
|
|---|
| 92 | if (!ModuleUser::Cast($this->System->GetModule('User'))->User->CheckPermission('Network', 'ShowInfo'))
|
|---|
| 93 | return 'Nemáte oprávnění';
|
|---|
| 94 |
|
|---|
| 95 | $Output = '<a href="'.$this->System->Link('/network/frequency-plan/').'">Frekvenční plán</a><br />';
|
|---|
| 96 | $Output .= '<a href="'.$this->System->Link('/network/subnet/').'">Výpis registrovaných podsítí</a><br />';
|
|---|
| 97 | $Output .= '<a href="'.$this->System->Link('/network/hosts/').'">Registrované zařízení</a><br />';
|
|---|
| 98 | return $Output;
|
|---|
| 99 | }
|
|---|
| 100 | }
|
|---|
| 101 |
|
|---|
| 102 | class ModuleNetwork extends Module
|
|---|
| 103 | {
|
|---|
| 104 | public int $MinNotifyTime;
|
|---|
| 105 |
|
|---|
| 106 | function __construct(System $System)
|
|---|
| 107 | {
|
|---|
| 108 | parent::__construct($System);
|
|---|
| 109 | $this->Name = 'Network';
|
|---|
| 110 | $this->Version = '1.0';
|
|---|
| 111 | $this->Creator = 'Chronos';
|
|---|
| 112 | $this->License = 'GNU/GPLv3';
|
|---|
| 113 | $this->Description = 'Networking related tools';
|
|---|
| 114 | $this->Dependencies = array(ModuleNotify::GetName(), ModuleIS::GetName());
|
|---|
| 115 | $this->Models = array(NetworkDomainAlias::GetClassName(), NetworkDevice::GetClassName(), NetworkDeviceType::GetClassName(),
|
|---|
| 116 | NetworkDeviceLog::GetClassName(), NetworkInterface::GetClassName(), NetworkInterfaceType::GetClassName(),
|
|---|
| 117 | NetworkSubnet::GetClassName(), NetworkPort::GetClassName(), NetworkSpeedLimit::GetClassName(),
|
|---|
| 118 | NetworkInterfaceLatency::GetClassName(), NetworkLink::GetClassName(), NetworkLinkType::GetClassName(),
|
|---|
| 119 | NetworkSignal::GetClassName(), NetworkAddressCategory::GetClassName(), NetworkDeviceConfig::GetClassName(),
|
|---|
| 120 | NetworkDomain::GetClassName(), NetworkDomainServer::GetClassName(), NetworkDomainView::GetClassName(),
|
|---|
| 121 | NetworkDomainItemFilter::GetClassName(), DeviceAPIType::GetClassName(), NetworkInterfaceWireless::GetClassName(),
|
|---|
| 122 | NetworkInterfaceUpDown::GetClassName(), NetworkPortUpDown::GetClassName(), NetworkMac::GetClassName());
|
|---|
| 123 |
|
|---|
| 124 | // TODO: Make notify time configurable
|
|---|
| 125 | $this->MinNotifyTime = 30; // seconds
|
|---|
| 126 | }
|
|---|
| 127 |
|
|---|
| 128 | function DoStart(): void
|
|---|
| 129 | {
|
|---|
| 130 | ModuleNotify::Cast($this->System->GetModule('Notify'))->RegisterCheck('NetworkReachability',
|
|---|
| 131 | array($this, 'ReachabilityCheck'));
|
|---|
| 132 | ModuleNotify::Cast($this->System->GetModule('Notify'))->RegisterCheck('NetworkPort',
|
|---|
| 133 | array($this, 'PortCheck'));
|
|---|
| 134 |
|
|---|
| 135 | $this->System->RegisterPage(['network'], 'PageNetwork');
|
|---|
| 136 | $this->System->RegisterPage(['network', 'administration'], 'PageNetworkAdministration');
|
|---|
| 137 | $this->System->RegisterPage(['network', 'subnet'], 'PageSubnet');
|
|---|
| 138 | $this->System->RegisterPage(['network', 'user-hosts'], 'PageNetworkHostList');
|
|---|
| 139 | $this->System->RegisterPage(['network', 'hosting'],'PageHosting');
|
|---|
| 140 | $this->System->RegisterPage(['network', 'hosts'], 'PageHostList');
|
|---|
| 141 | $this->System->RegisterPage(['network', 'frequency-plan'], 'PageFrequencyPlan');
|
|---|
| 142 |
|
|---|
| 143 | $this->System->RegisterCommandLine('networklog_import', 'Imports network logs from remote server', array($this, 'ImportNetworkLog'));
|
|---|
| 144 |
|
|---|
| 145 | $this->System->FormManager->RegisterClass('NetworkDomainAlias', array(
|
|---|
| 146 | 'Title' => 'Alias domény',
|
|---|
| 147 | 'Table' => 'NetworkDomainAlias',
|
|---|
| 148 | 'Items' => array(
|
|---|
| 149 | 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
|
|---|
| 150 | 'Target' => array('Type' => 'String', 'Caption' => 'Cíl', 'Default' => ''),
|
|---|
| 151 | 'Comment' => array('Type' => 'String', 'Caption' => 'Komentář', 'Default' => ''),
|
|---|
| 152 | 'Domain' => array('Type' => 'TNetworkDomain', 'Caption' => 'Síťová doména', 'Default' => ''),
|
|---|
| 153 | ),
|
|---|
| 154 | ));
|
|---|
| 155 | $this->System->FormManager->RegisterFormType('TNetworkDomainAliasListDomain', array(
|
|---|
| 156 | 'Type' => 'ManyToOne',
|
|---|
| 157 | 'Table' => 'NetworkDomainAlias',
|
|---|
| 158 | 'Id' => 'Id',
|
|---|
| 159 | 'Ref' => 'Domain',
|
|---|
| 160 | 'Filter' => '1',
|
|---|
| 161 | ));
|
|---|
| 162 | $this->System->FormManager->RegisterClass('NetworkDevice', array(
|
|---|
| 163 | 'Title' => 'Síťové zařízení',
|
|---|
| 164 | 'Table' => 'NetworkDevice',
|
|---|
| 165 | 'Items' => array(
|
|---|
| 166 | 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
|
|---|
| 167 | 'Type' => array('Type' => 'TNetworkDeviceType', 'Caption' => 'Typ', 'Default' => '0'),
|
|---|
| 168 | 'Member' => array('Type' => 'TMember', 'Caption' => 'Zákazník', 'Default' => '0'),
|
|---|
| 169 | 'Location' => array('Type' => 'TMember', 'Caption' => 'Umístění', 'Default' => '0'),
|
|---|
| 170 | 'Service' => array('Type' => 'TServiceCustomerRel', 'Caption' => 'Služba', 'Default' => '', 'Null' => true),
|
|---|
| 171 | 'Used' => array('Type' => 'Boolean', 'Caption' => 'Použito', 'Default' => '1'),
|
|---|
| 172 | 'Online' => array('Type' => 'TOnlineState', 'Caption' => 'Běží', 'Default' => '0', 'ReadOnly' => true),
|
|---|
| 173 | 'LastOnline' => array('Type' => 'DateTime', 'Caption' => 'Naposledy běželo', 'Default' => '', 'ReadOnly' => true),
|
|---|
| 174 | 'PermanentOnline' => array('Type' => 'Boolean', 'Caption' => 'Běží stále', 'Default' => '0'),
|
|---|
| 175 | 'Interfaces' => array('Type' => 'TInterfaceList', 'Caption' => 'Rozhraní', 'Default' => ''),
|
|---|
| 176 | 'MapPosition' => array('Type' => 'TMapPosition', 'Caption' => 'Pozice na mapě', 'Default' => '0', 'Null' => true),
|
|---|
| 177 | 'Product' => array('Type' => 'TProduct', 'Caption' => 'Produkt', 'Default' => '', 'Null' => true),
|
|---|
| 178 | 'LoginName' => array('Type' => 'String', 'Caption' => 'Přihlašovací jméno', 'Default' => '', 'Null' => true, 'NotInList' => true),
|
|---|
| 179 | 'LoginPassword' => array('Type' => 'String', 'Caption' => 'Přihlašovací heslo', 'Default' => '', 'Null' => true, 'NotInList' => true),
|
|---|
| 180 | 'API' => array('Type' => 'TDeviceAPIType', 'Caption' => 'API', 'Default' => '', 'Null' => true),
|
|---|
| 181 | 'Logs' => array('Type' => 'TDeviceLogList', 'Caption' => 'Záznamy', 'Default' => ''),
|
|---|
| 182 | 'InboundNATPriority' => array('Type' => 'Integer', 'Caption' => 'Priorita příchozího NATu', 'Default' => '1'),
|
|---|
| 183 | ),
|
|---|
| 184 | 'AfterInsert' => array($this, 'AfterInsertNetworkDevice'),
|
|---|
| 185 | 'AfterModify' => array($this, 'AfterModifyNetworkDevice'),
|
|---|
| 186 | 'AfterDelete' => array($this, 'AfterModifyNetworkDevice'),
|
|---|
| 187 | ));
|
|---|
| 188 | $this->System->FormManager->RegisterClass('NetworkDeviceType', array(
|
|---|
| 189 | 'Title' => 'Typ síťového zařízení',
|
|---|
| 190 | 'Table' => 'NetworkDeviceType',
|
|---|
| 191 | 'Items' => array(
|
|---|
| 192 | 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
|
|---|
| 193 | 'ShowOnline' => array('Type' => 'Boolean', 'Caption' => 'Ukázat online', 'Default' => '0'),
|
|---|
| 194 | 'IconName' => array('Type' => 'String', 'Caption' => 'Jméno ikony', 'Default' => '0'),
|
|---|
| 195 | 'Devices' => array('Type' => 'TNetworkDeviceListType', 'Caption' => 'Síťová zařízení', 'Default' => ''),
|
|---|
| 196 | ),
|
|---|
| 197 | ));
|
|---|
| 198 | $this->System->FormManager->RegisterFormType('TNetworkDeviceListType', array(
|
|---|
| 199 | 'Type' => 'ManyToOne',
|
|---|
| 200 | 'Table' => 'NetworkDevice',
|
|---|
| 201 | 'Id' => 'Id',
|
|---|
| 202 | 'Ref' => 'Type',
|
|---|
| 203 | 'Filter' => '1',
|
|---|
| 204 | ));
|
|---|
| 205 | $this->System->FormManager->RegisterClass('NetworkDeviceLog', array(
|
|---|
| 206 | 'Title' => 'Zprávy zařízení',
|
|---|
| 207 | 'Table' => 'NetworkDeviceLog',
|
|---|
| 208 | 'DefaultSortColumn' => 'Time',
|
|---|
| 209 | 'DefaultSortOrder' => 1,
|
|---|
| 210 | 'Items' => array(
|
|---|
| 211 | 'Time' => array('Type' => 'DateTime', 'Caption' => 'Čas', 'Default' => ''),
|
|---|
| 212 | 'Device' => array('Type' => 'TNetworkDevice', 'Caption' => 'Zařízení', 'Default' => ''),
|
|---|
| 213 | 'Message' => array('Type' => 'String', 'Caption' => 'Zpáva', 'Default' => ''),
|
|---|
| 214 | 'Tags' => array('Type' => 'String', 'Caption' => 'Značky', 'Default' => ''),
|
|---|
| 215 | ),
|
|---|
| 216 | ));
|
|---|
| 217 | $this->System->FormManager->RegisterClass('NetworkInterface', array(
|
|---|
| 218 | 'Title' => 'Síťové rozhraní',
|
|---|
| 219 | 'Table' => 'NetworkInterface',
|
|---|
| 220 | 'Items' => array(
|
|---|
| 221 | 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
|
|---|
| 222 | 'Type' => array('Type' => 'TNetworkInterfaceType', 'Caption' => 'Typ', 'Default' => '0'),
|
|---|
| 223 | 'MAC' => array('Type' => 'MacAddress', 'Caption' => 'Fyzická adresa (MAC)', 'Default' => ''),
|
|---|
| 224 | 'LocalIP' => array('Type' => 'IPv4Address', 'Caption' => 'IPv4', 'Default' => '', 'Null' => true),
|
|---|
| 225 | 'IPv6' => array('Type' => 'IPv6Address', 'Caption' => 'IPv6', 'Default' => '', 'Null' => true),
|
|---|
| 226 | 'ExternalIP' => array('Type' => 'IPv4Address', 'Caption' => 'Veřejná IPv4', 'Default' => '', 'Null' => true),
|
|---|
| 227 | 'Device' => array('Type' => 'TNetworkDevice', 'Caption' => 'Zařízení', 'Default' => ''),
|
|---|
| 228 | 'Enabled' => array('Type' => 'Boolean', 'Caption' => 'Povoleno', 'Default' => '1'),
|
|---|
| 229 | 'Online' => array('Type' => 'TOnlineState', 'Caption' => 'Běží', 'Default' => '0', 'ReadOnly' => true),
|
|---|
| 230 | 'LastOnline' => array('Type' => 'DateTime', 'Caption' => 'Naposledy běželo', 'Default' => '', 'ReadOnly' => true),
|
|---|
| 231 | 'Links' => array('Type' => 'TNetworkLinkListInterface', 'Caption' => 'Propojení', 'Default' => ''),
|
|---|
| 232 | 'UpDown' => array('Type' => 'TNetworkInterfaceUpDown', 'Caption' => 'Změny stavu', 'Default' => ''),
|
|---|
| 233 | 'Signal' => array('Type' => 'TNetworkSignalListInterface', 'Caption' => 'Signál', 'Default' => ''),
|
|---|
| 234 | 'Wireless' => array('Type' => 'TNetworkInterfaceWirelessListInterface', 'Caption' => 'Bezdrátové spoje', 'Default' => ''),
|
|---|
| 235 | 'Ports' => array('Type' => 'TDevicePortListInterface', 'Caption' => 'Síťové porty', 'Default' => ''),
|
|---|
| 236 | 'Latency' => array('Type' => 'TDeviceInterfaceLatencyListInterface', 'Caption' => 'Síťová odezva', 'Default' => ''),
|
|---|
| 237 | ),
|
|---|
| 238 | 'AfterInsert' => array($this, 'AfterInsertNetworkInterface'),
|
|---|
| 239 | 'AfterModify' => array($this, 'AfterModifyNetworkInterface'),
|
|---|
| 240 | 'BeforeDelete' => array($this, 'BeforeDeleteNetworkInterface'),
|
|---|
| 241 | 'AfterDelete' => array($this, 'AfterModifyNetworkInterface'),
|
|---|
| 242 | ));
|
|---|
| 243 | $this->System->FormManager->RegisterClass('NetworkInterfaceType', array(
|
|---|
| 244 | 'Title' => 'Typ síťového rozhraní',
|
|---|
| 245 | 'Table' => 'NetworkInterfaceType',
|
|---|
| 246 | 'Items' => array(
|
|---|
| 247 | 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
|
|---|
| 248 | 'MaxSpeed' => array('Type' => 'Integer', 'Caption' => 'Max. rychlost', 'Default' => '0', 'Suffix' => 'Mbit/s'),
|
|---|
| 249 | 'FullDuplex' => array('Type' => 'Boolean', 'Caption' => 'Plně duplexní', 'Default' => '0'),
|
|---|
| 250 | 'Color' => array('Type' => 'Color', 'Caption' => 'Barva', 'Default' => '0'),
|
|---|
| 251 | ),
|
|---|
| 252 | ));
|
|---|
| 253 | $this->System->FormManager->RegisterClass('NetworkSubnet', array(
|
|---|
| 254 | 'Title' => 'Podsítě',
|
|---|
| 255 | 'DefaultSortColumn' => 'Name',
|
|---|
| 256 | 'Table' => 'NetworkSubnet',
|
|---|
| 257 | 'Items' => array(
|
|---|
| 258 | 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
|
|---|
| 259 | 'AddressRange' => array('Type' => 'String', 'Caption' => 'Rozsah adres', 'Default' => ''),
|
|---|
| 260 | 'Mask' => array('Type' => 'Integer', 'Caption' => 'Prefix', 'Default' => ''),
|
|---|
| 261 | 'DHCP' => array('Type' => 'IPv4Address', 'Caption' => 'DHCP', 'Default' => ''),
|
|---|
| 262 | 'Gateway' => array('Type' => 'IPv4Address', 'Caption' => 'Brána', 'Default' => ''),
|
|---|
| 263 | 'WINS' => array('Type' => 'IPv4Address', 'Caption' => 'WINS', 'Default' => ''),
|
|---|
| 264 | 'DNS' => array('Type' => 'String', 'Caption' => 'DNS', 'Default' => ''),
|
|---|
| 265 | 'Domain' => array('Type' => 'String', 'Caption' => 'Doména', 'Default' => ''),
|
|---|
| 266 | 'NTP' => array('Type' => 'String', 'Caption' => 'NTP', 'Default' => ''),
|
|---|
| 267 | 'Member' => array('Type' => 'TMember', 'Caption' => 'Zákazník', 'Default' => '', 'Null' => true),
|
|---|
| 268 | 'Service' => array('Type' => 'TServiceCustomerRel', 'Caption' => 'Služba', 'Default' => '', 'Null' => true),
|
|---|
| 269 | 'ExtAddressRange' => array('Type' => 'String', 'Caption' => 'Vnější rozsah adres', 'Default' => ''),
|
|---|
| 270 | 'ExtMask' => array('Type' => 'String', 'Caption' => 'Vnější prefix', 'Default' => ''),
|
|---|
| 271 | 'AddressRangeIPv6' => array('Type' => 'String', 'Caption' => 'Rozsah adres IPv6', 'Default' => ''),
|
|---|
| 272 | 'MaskIPv6' => array('Type' => 'Integer', 'Caption' => 'Prefix IPv6', 'Default' => ''),
|
|---|
| 273 | 'Configure' => array('Type' => 'Boolean', 'Caption' => 'Nastavovat', 'Default' => ''),
|
|---|
| 274 | 'Interfaces' => array('Type' => 'TNetworkSubnetInterfaceList', 'Caption' => 'Rozhraní', 'Default' => ''),
|
|---|
| 275 | ),
|
|---|
| 276 | ));
|
|---|
| 277 | $this->System->FormManager->RegisterFormType('TNetworkSubnetInterfaceList', array(
|
|---|
| 278 | 'Type' => 'ManyToOne',
|
|---|
| 279 | 'Table' => 'NetworkInterface',
|
|---|
| 280 | 'Id' => 'Id',
|
|---|
| 281 | 'Ref' => null,
|
|---|
| 282 | 'Filter' => '(`TX`.`LocalIP` != "") AND CompareNetworkPrefix(INET_ATON(`TX`.`LocalIP`), INET_ATON((SELECT `NetworkSubnet`.`AddressRange` FROM `NetworkSubnet` WHERE `NetworkSubnet`.`Id`=#Id)), '.
|
|---|
| 283 | '(SELECT `NetworkSubnet`.`Mask` FROM `NetworkSubnet` WHERE `NetworkSubnet`.`Id`=#Id))',
|
|---|
| 284 | ));
|
|---|
| 285 | $this->System->FormManager->RegisterClass('NetworkPort', array(
|
|---|
| 286 | 'Title' => 'Síťový port',
|
|---|
| 287 | 'Table' => 'NetworkPort',
|
|---|
| 288 | 'Items' => array(
|
|---|
| 289 | 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
|
|---|
| 290 | 'Protocol' => array('Type' => 'TNetworkProtocol', 'Caption' => 'Protokol', 'Default' => '0'),
|
|---|
| 291 | 'Number' => array('Type' => 'Integer', 'Caption' => 'Číslo', 'Default' => ''),
|
|---|
| 292 | 'Interface' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní', 'Default' => ''),
|
|---|
| 293 | 'Enabled' => array('Type' => 'Boolean', 'Caption' => 'Povoleno', 'Default' => '1'),
|
|---|
| 294 | 'Online' => array('Type' => 'TOnlineState', 'Caption' => 'Běží', 'Default' => '0', 'ReadOnly' => true),
|
|---|
| 295 | 'LastOnline' => array('Type' => 'DateTime', 'Caption' => 'Naposledy běželo', 'Default' => '', 'ReadOnly' => true),
|
|---|
| 296 | 'UpDown' => array('Type' => 'TNetworkPortUpDown', 'Caption' => 'Změny stavu', 'Default' => ''),
|
|---|
| 297 | ),
|
|---|
| 298 | ));
|
|---|
| 299 | $this->System->FormManager->RegisterClass('NetworkSpeedLimit', array(
|
|---|
| 300 | 'Title' => 'Omezení přenosové rychlosti',
|
|---|
| 301 | 'Table' => 'NetworkSpeedLimit',
|
|---|
| 302 | 'Items' => array(
|
|---|
| 303 | 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
|
|---|
| 304 | 'SpeedMaxOut' => array('Type' => 'Integer', 'Caption' => 'Max. rychlost odesílání', 'Default' => '0', 'Suffix' => 'bits/s'),
|
|---|
| 305 | 'SpeedMaxIn' => array('Type' => 'Integer', 'Caption' => 'Max. rychlost přijímání', 'Default' => 0, 'Suffix' => 'bits/s'),
|
|---|
| 306 | 'Parent' => array('Type' => 'TNetworkSpeedLimit', 'Caption' => 'Rodič', 'Default' => '', 'Null' => true),
|
|---|
| 307 | 'Items' => array('Type' => 'TNetworkSpeedLimitListParent', 'Caption' => 'Položky'),
|
|---|
| 308 | 'CustomerServices' => array('Type' => 'TServiceCustomerRelListSpeedLimit', 'Caption' => 'Služby zákazníka'),
|
|---|
| 309 | ),
|
|---|
| 310 | ));
|
|---|
| 311 | $this->System->FormManager->RegisterFormType('TNetworkSpeedLimit', array(
|
|---|
| 312 | 'Type' => 'Reference',
|
|---|
| 313 | 'Table' => 'NetworkSpeedLimit',
|
|---|
| 314 | 'Id' => 'Id',
|
|---|
| 315 | 'Name' => 'Name',
|
|---|
| 316 | 'Filter' => '1',
|
|---|
| 317 | ));
|
|---|
| 318 | $this->System->FormManager->RegisterFormType('TNetworkSpeedLimitListParent', array(
|
|---|
| 319 | 'Type' => 'ManyToOne',
|
|---|
| 320 | 'Table' => 'NetworkSpeedLimit',
|
|---|
| 321 | 'Id' => 'Id',
|
|---|
| 322 | 'Ref' => 'Parent',
|
|---|
| 323 | 'Filter' => '1',
|
|---|
| 324 | ));
|
|---|
| 325 | $this->System->FormManager->RegisterFormType('TServiceCustomerRelListSpeedLimit', array(
|
|---|
| 326 | 'Type' => 'ManyToOne',
|
|---|
| 327 | 'Table' => 'ServiceCustomerRel',
|
|---|
| 328 | 'Id' => 'Id',
|
|---|
| 329 | 'Ref' => 'SpeedLimit',
|
|---|
| 330 | 'Filter' => '1',
|
|---|
| 331 | ));
|
|---|
| 332 | $this->System->FormManager->RegisterClass('NetworkInterfaceLatency', array(
|
|---|
| 333 | 'Title' => 'Síťová odezva',
|
|---|
| 334 | 'Table' => 'NetworkInterfaceLatency',
|
|---|
| 335 | 'DefaultSortColumn' => 'Time',
|
|---|
| 336 | 'DefaultSortOrder' => 1,
|
|---|
| 337 | 'Items' => array(
|
|---|
| 338 | 'Time' => array('Type' => 'DateTime', 'Caption' => 'Čas', 'Default' => ''),
|
|---|
| 339 | 'Interface' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní', 'Default' => ''),
|
|---|
| 340 | 'Value' => array('Type' => 'Float', 'Caption' => 'Hodnota', 'Default' => '0', 'Suffix' => 'ms'),
|
|---|
| 341 | ),
|
|---|
| 342 | ));
|
|---|
| 343 | $this->System->FormManager->RegisterClass('NetworkLink', array(
|
|---|
| 344 | 'Title' => 'Síťové propojení',
|
|---|
| 345 | 'Table' => 'NetworkLink',
|
|---|
| 346 | 'Items' => array(
|
|---|
| 347 | 'Type' => array('Type' => 'TNetworkLinkType', 'Caption' => 'Typ', 'Default' => '1'),
|
|---|
| 348 | 'Interface1' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní 1', 'Default' => ''),
|
|---|
| 349 | 'Interface2' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní 2', 'Default' => ''),
|
|---|
| 350 | ),
|
|---|
| 351 | ));
|
|---|
| 352 | $this->System->FormManager->RegisterClass('NetworkLinkUnion', array(
|
|---|
| 353 | 'Title' => 'Síťové propojení',
|
|---|
| 354 | 'BaseTable' => 'NetworkLink',
|
|---|
| 355 | 'SQL' => '(SELECT `Id`, `Type`, `Interface1` AS `Interface`, `Interface2` AS `InterfaceOther` FROM `NetworkLink`) '.
|
|---|
| 356 | 'UNION (SELECT `Id`, `Type`, `Interface2` AS `Interface`, `Interface1` AS `InterfaceOther` FROM `NetworkLink`)',
|
|---|
| 357 | 'Items' => array(
|
|---|
| 358 | 'Type' => array('Type' => 'TNetworkLinkType', 'Caption' => 'Typ', 'Default' => '1', 'ReadOnly' => true),
|
|---|
| 359 | 'Interface' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní 1', 'Default' => '', 'ReadOnly' => true),
|
|---|
| 360 | 'InterfaceOther' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní 2', 'Default' => '', 'ReadOnly' => true),
|
|---|
| 361 | ),
|
|---|
| 362 | ));
|
|---|
| 363 |
|
|---|
| 364 | $this->System->FormManager->RegisterClass('NetworkLinkType', array(
|
|---|
| 365 | 'Title' => 'Typ síťového propojení',
|
|---|
| 366 | 'Table' => 'NetworkLinkType',
|
|---|
| 367 | 'Items' => array(
|
|---|
| 368 | 'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),
|
|---|
| 369 | 'MaxLinkSpeed' => array('Type' => 'Integer', 'Caption' => 'Maximální spojová rychlost', 'Default' => '0', 'Suffix' => 'bits/s'),
|
|---|
| 370 | 'MaxRealSpeed' => array('Type' => 'Integer', 'Caption' => 'Maximální reálná rychlost', 'Default' => '0', 'Suffix' => 'bits/s'),
|
|---|
| 371 | 'FullDuplex' => array('Type' => 'Boolean', 'Caption' => 'Plně duplexní', 'Default' => '0'),
|
|---|
| 372 | 'Color' => array('Type' => 'Color', 'Caption' => 'Barva', 'Default' => '0'),
|
|---|
| 373 | ),
|
|---|
| 374 | ));
|
|---|
| 375 | $this->System->FormManager->RegisterClass('NetworkSignal', array(
|
|---|
| 376 | 'Title' => 'Signál rozhraní',
|
|---|
| 377 | 'Table' => 'NetworkSignal',
|
|---|
| 378 | 'DefaultSortColumn' => 'Time',
|
|---|
| 379 | 'DefaultSortOrder' => 1,
|
|---|
| 380 | 'Items' => array(
|
|---|
| 381 | 'Time' => array('Type' => 'DateTime', 'Caption' => 'Čas', 'Default' => ''),
|
|---|
| 382 | 'MAC' => array('Type' => 'TNetworkMac', 'Caption' => 'Fyzická adresa (MAC)', 'Default' => ''),
|
|---|
| 383 | 'Interface' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní', 'Default' => '', 'Null' => true),
|
|---|
| 384 | 'Value' => array('Type' => 'Integer', 'Caption' => 'Signál', 'Default' => '0', 'Suffix' => 'dBm'),
|
|---|
| 385 | 'Remote' => array('Type' => 'Integer', 'Caption' => 'Vzdálený signál', 'Default' => '0', 'Suffix' => 'dBm'),
|
|---|
| 386 | 'RateRx' => array('Type' => 'Integer', 'Caption' => 'Rychlost Rx', 'Default' => '0', 'Suffix' => 'Mbps'),
|
|---|
| 387 | 'RateTx' => array('Type' => 'Integer', 'Caption' => 'Rychlost Tx', 'Default' => '0', 'Suffix' => 'Mbps'),
|
|---|
| 388 | 'Device' => array('Type' => 'TNetworkDevice', 'Caption' => 'Měřeno z', 'Default' => '0'),
|
|---|
| 389 | ),
|
|---|
| 390 | ));
|
|---|
| 391 | $this->System->FormManager->RegisterClass('NetworkAddressCategory', array(
|
|---|
| 392 | 'Title' => 'Kategorie síťové adresy',
|
|---|
| 393 | 'Table' => 'NetworkAddressCategory',
|
|---|
| 394 | 'DefaultSortColumn' => 'Name',
|
|---|
| 395 | 'DefaultSortOrder' => 1,
|
|---|
| 396 | 'Items' => array(
|
|---|
| 397 | 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
|
|---|
| 398 | ),
|
|---|
| 399 | ));
|
|---|
| 400 | $this->System->FormManager->RegisterFormType('TNetworkAddressCategory', array(
|
|---|
| 401 | 'Type' => 'Reference',
|
|---|
| 402 | 'Table' => 'NetworkAddressCategory',
|
|---|
| 403 | 'Id' => 'Id',
|
|---|
| 404 | 'Name' => 'Name',
|
|---|
| 405 | 'Filter' => '1',
|
|---|
| 406 | ));
|
|---|
| 407 | $this->System->FormManager->RegisterClass('NetworkDeviceConfig', array(
|
|---|
| 408 | 'Title' => 'Nastavení zařízení',
|
|---|
| 409 | 'Table' => 'NetworkDeviceConfig',
|
|---|
| 410 | 'DefaultSortColumn' => 'Time',
|
|---|
| 411 | 'DefaultSortOrder' => 1,
|
|---|
| 412 | 'Items' => array(
|
|---|
| 413 | 'Device' => array('Type' => 'TNetworkDevice', 'Caption' => 'Zařízení', 'Default' => ''),
|
|---|
| 414 | 'Time' => array('Type' => 'Date', 'Caption' => 'Čas vytvoření', 'Default' => ''),
|
|---|
| 415 | 'ConfigFull' => array('Type' => 'Text', 'Caption' => 'Kompletní nastavení', 'Default' => ''),
|
|---|
| 416 | 'ConfigCompact' => array('Type' => 'Text', 'Caption' => 'Rozdílové nastavení', 'Default' => ''),
|
|---|
| 417 | ),
|
|---|
| 418 | ));
|
|---|
| 419 | $this->System->FormManager->RegisterClass('NetworkDomain', array(
|
|---|
| 420 | 'Title' => 'Síťová doména',
|
|---|
| 421 | 'Table' => 'NetworkDomain',
|
|---|
| 422 | 'DefaultSortColumn' => 'Name',
|
|---|
| 423 | 'DefaultSortOrder' => 1,
|
|---|
| 424 | 'Items' => array(
|
|---|
| 425 | 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
|
|---|
| 426 | 'Parent' => array('Type' => 'TNetworkDomain', 'Caption' => 'Nadřazená doména', 'Default' => '', 'Null' => true),
|
|---|
| 427 | 'Description' => array('Type' => 'String', 'Caption' => 'Popis', 'Default' => ''),
|
|---|
| 428 | 'Serial' => array('Type' => 'Integer', 'Caption' => 'Sériové číslo', 'Default' => '1'),
|
|---|
| 429 | 'Minimum' => array('Type' => 'Integer', 'Caption' => 'Minimum', 'Default' => '10800'),
|
|---|
| 430 | 'Retry' => array('Type' => 'Integer', 'Caption' => 'Opakování', 'Default' => '7200'),
|
|---|
| 431 | 'Expire' => array('Type' => 'Integer', 'Caption' => 'Čas vypršení', 'Default' => '2419200'),
|
|---|
| 432 | 'Refresh' => array('Type' => 'Integer', 'Caption' => 'Obnovení', 'Default' => '28800'),
|
|---|
| 433 | 'TTL' => array('Type' => 'Integer', 'Caption' => 'TTL', 'Default' => '86400', 'Suffix' => 'sekund'),
|
|---|
| 434 | 'Servers' => array('Type' => 'TNetworkDomainServerList', 'Caption' => 'Servery', 'Default' => ''),
|
|---|
| 435 | 'Views' => array('Type' => 'TNetworkDomainViewListDomain', 'Caption' => 'Pohledy', 'Default' => ''),
|
|---|
| 436 | 'ItemFilters' => array('Type' => 'TNetworkDomainItemFilterListDomain', 'Caption' => 'Filtry položek', 'Default' => ''),
|
|---|
| 437 | 'Aliases' => array('Type' => 'TNetworkDomainAliasListDomain', 'Caption' => 'Aliasy', 'Default' => ''),
|
|---|
| 438 | ),
|
|---|
| 439 | ));
|
|---|
| 440 | $this->System->FormManager->RegisterFormType('TNetworkDomain', array(
|
|---|
| 441 | 'Type' => 'Reference',
|
|---|
| 442 | 'Table' => 'NetworkDomain',
|
|---|
| 443 | 'Id' => 'Id',
|
|---|
| 444 | 'Name' => 'Name',
|
|---|
| 445 | 'Filter' => '1',
|
|---|
| 446 | ));
|
|---|
| 447 | $this->System->FormManager->RegisterClass('NetworkDomainServer', array(
|
|---|
| 448 | 'Title' => 'Doménový server',
|
|---|
| 449 | 'Table' => 'NetworkDomainServer',
|
|---|
| 450 | 'DefaultSortColumn' => 'Address',
|
|---|
| 451 | 'DefaultSortOrder' => 1,
|
|---|
| 452 | 'Items' => array(
|
|---|
| 453 | 'Address' => array('Type' => 'String', 'Caption' => 'Adresa', 'Default' => ''),
|
|---|
| 454 | 'Domain' => array('Type' => 'TNetworkDomain', 'Caption' => 'Doména', 'Default' => ''),
|
|---|
| 455 | 'Sequence' => array('Type' => 'Integer', 'Caption' => 'Pořadí', 'Default' => '1'),
|
|---|
| 456 | ),
|
|---|
| 457 | ));
|
|---|
| 458 | $this->System->FormManager->RegisterFormType('TNetworkDomainServerList', array(
|
|---|
| 459 | 'Type' => 'ManyToOne',
|
|---|
| 460 | 'Table' => 'NetworkDomainServer',
|
|---|
| 461 | 'Id' => 'Id',
|
|---|
| 462 | 'Ref' => 'Domain',
|
|---|
| 463 | 'Filter' => '1',
|
|---|
| 464 | ));
|
|---|
| 465 | $this->System->FormManager->RegisterClass('NetworkDomainView', array(
|
|---|
| 466 | 'Title' => 'Pohled síťové domény',
|
|---|
| 467 | 'Table' => 'NetworkDomainView',
|
|---|
| 468 | 'DefaultSortColumn' => 'Name',
|
|---|
| 469 | 'DefaultSortOrder' => 1,
|
|---|
| 470 | 'Items' => array(
|
|---|
| 471 | 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
|
|---|
| 472 | 'SysName' => array('Type' => 'String', 'Caption' => 'Systémové jméno', 'Default' => ''),
|
|---|
| 473 | 'Domain' => array('Type' => 'TNetworkDomain', 'Caption' => 'Doména', 'Default' => ''),
|
|---|
| 474 | 'AddressRange' => array('Type' => 'String', 'Caption' => 'Rozsah adres', 'Default' => ''),
|
|---|
| 475 | 'ItemFilters' => array('Type' => 'TNetworkDomainItemFilterListView', 'Caption' => 'Filtry položek', 'Default' => ''),
|
|---|
| 476 | ),
|
|---|
| 477 | ));
|
|---|
| 478 | $this->System->FormManager->RegisterFormType('TNetworkDomainView', array(
|
|---|
| 479 | 'Type' => 'Reference',
|
|---|
| 480 | 'Table' => 'NetworkDomainView',
|
|---|
| 481 | 'Id' => 'Id',
|
|---|
| 482 | 'Name' => 'Name',
|
|---|
| 483 | 'Filter' => '1',
|
|---|
| 484 | ));
|
|---|
| 485 | $this->System->FormManager->RegisterFormType('TNetworkDomainViewListDomain', array(
|
|---|
| 486 | 'Type' => 'ManyToOne',
|
|---|
| 487 | 'Table' => 'NetworkDomainView',
|
|---|
| 488 | 'Id' => 'Id',
|
|---|
| 489 | 'Ref' => 'Domain',
|
|---|
| 490 | 'Filter' => '1',
|
|---|
| 491 | ));
|
|---|
| 492 | $this->System->FormManager->RegisterClass('NetworkDomainItemFilter', array(
|
|---|
| 493 | 'Title' => 'Filtr doménových položek',
|
|---|
| 494 | 'Table' => 'NetworkDomainItemFilter',
|
|---|
| 495 | 'DefaultSortColumn' => 'Name',
|
|---|
| 496 | 'DefaultSortOrder' => 1,
|
|---|
| 497 | 'Items' => array(
|
|---|
| 498 | 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
|
|---|
| 499 | 'Domain' => array('Type' => 'TNetworkDomain', 'Caption' => 'Domén', 'Default' => ''),
|
|---|
| 500 | 'AddressCategory' => array('Type' => 'TNetworkAddressCategory', 'Caption' => 'Kategorie adresy', 'Default' => ''),
|
|---|
| 501 | 'Suffix' => array('Type' => 'String', 'Caption' => 'Přípona jména položek', 'Default' => ''),
|
|---|
| 502 | 'View' => array('Type' => 'TNetworkDomainView', 'Caption' => 'Pohled', 'Default' => ''),
|
|---|
| 503 | 'AddressRange' => array('Type' => 'String', 'Caption' => 'Rozsah adres', 'Default' => ''),
|
|---|
| 504 | ),
|
|---|
| 505 | ));
|
|---|
| 506 | $this->System->FormManager->RegisterFormType('TNetworkDomainItemFilterListDomain', array(
|
|---|
| 507 | 'Type' => 'ManyToOne',
|
|---|
| 508 | 'Table' => 'NetworkDomainItemFilter',
|
|---|
| 509 | 'Id' => 'Id',
|
|---|
| 510 | 'Ref' => 'Domain',
|
|---|
| 511 | 'Filter' => '1',
|
|---|
| 512 | ));
|
|---|
| 513 | $this->System->FormManager->RegisterFormType('TNetworkDomainItemFilterListView', array(
|
|---|
| 514 | 'Type' => 'ManyToOne',
|
|---|
| 515 | 'Table' => 'NetworkDomainItemFilter',
|
|---|
| 516 | 'Id' => 'Id',
|
|---|
| 517 | 'Ref' => 'View',
|
|---|
| 518 | 'Filter' => '1',
|
|---|
| 519 | ));
|
|---|
| 520 | $this->System->FormManager->RegisterClass('DeviceAPIType', array(
|
|---|
| 521 | 'Title' => 'Typ API zařízení',
|
|---|
| 522 | 'Table' => 'DeviceAPIType',
|
|---|
| 523 | 'Items' => array(
|
|---|
| 524 | 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
|
|---|
| 525 | 'Devices' => array('Type' => 'TDeviceListAPI', 'Caption' => 'Zařízení', 'Default' => ''),
|
|---|
| 526 | ),
|
|---|
| 527 | ));
|
|---|
| 528 | $this->System->FormManager->RegisterClass('NetworkInterfaceWireless', array(
|
|---|
| 529 | 'Title' => 'Bezdrátová rozhraní',
|
|---|
| 530 | 'Table' => 'NetworkInterfaceWireless',
|
|---|
| 531 | 'Items' => array(
|
|---|
| 532 | 'SSID' => array('Type' => 'String', 'Caption' => 'SSID', 'Default' => ''),
|
|---|
| 533 | 'MAC' => array('Type' => 'MacAddress', 'Caption' => 'MAC', 'Default' => ''),
|
|---|
| 534 | 'NetworkInterface' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní', 'Default' => ''),
|
|---|
| 535 | 'TxPower' => array('Type' => 'Integer', 'Caption' => 'Výstupní výkon', 'Default' => '18', 'Suffix' => 'dBm'),
|
|---|
| 536 | 'CableAttenuation' => array('Type' => 'Integer', 'Caption' => 'Útlum vedení', 'Default' => '0', 'Suffix' => 'dB'),
|
|---|
| 537 | 'Antenna' => array('Type' => 'TProduct', 'Caption' => 'Anténa', 'Default' => '', 'Null' => true),
|
|---|
| 538 | 'AntenaGain' => array('Type' => 'Integer', 'Caption' => 'Zisk antény', 'Default' => '', 'Suffix' => 'dBi'),
|
|---|
| 539 | 'AntennaPolarity' => array('Type' => 'TAntennaPolarity', 'Caption' => 'Polarizace antény', 'Default' => '0'),
|
|---|
| 540 | 'Frequency' => array('Type' => 'Float', 'Caption' => 'Frekvence', 'Default' => '5600', 'Suffix' => 'MHz'),
|
|---|
| 541 | 'ChannelWidthLower' => array('Type' => 'Integer', 'Caption' => 'Šířka kanálu dolního', 'Default' => '0', 'Suffix' => 'MHz'),
|
|---|
| 542 | 'ChannelWidth' => array('Type' => 'Integer', 'Caption' => 'Šířka kanálu', 'Default' => '20', 'Suffix' => 'MHz'),
|
|---|
| 543 | 'ChannelWidthUpper' => array('Type' => 'Integer', 'Caption' => 'Šířka kanálu horního', 'Default' => '0', 'Suffix' => 'MHz'),
|
|---|
| 544 | 'Mode' => array('Type'
|
|---|
| 545 | => 'TWirelessMode', 'Caption' => 'Režim', 'Default' => '0', 'Suffix' => ''),
|
|---|
| 546 | 'TotalPower' => array('Type' => 'Integer', 'Caption' => 'Celkový výkon', 'Default' => '20', 'Suffix' => 'dBm',
|
|---|
| 547 | 'SQL' => '(`TxPower` - `CableAttenuation` + `AntenaGain`)', 'ReadOnly' => true),
|
|---|
| 548 | 'LimitPower' => array('Type' => 'Integer', 'Caption' => 'Max. limit', 'Default' => '', 'Suffix' => 'dBm',
|
|---|
| 549 | 'ReadOnly' => true, 'SQL' => '(CASE WHEN `Frequency` >= 5450 AND `Frequency` <= 5725 THEN 27 ELSE 20 END)'),
|
|---|
| 550 | 'UnderLimit' => array('Type' => 'Boolean', 'Caption' => 'V limitu', 'Default' => '', 'Suffix' => '',
|
|---|
| 551 | 'ReadOnly' => true, 'SQL' => '((`TxPower` - `CableAttenuation` + `AntenaGain`) <= (CASE WHEN `Frequency` >= 5450 AND `Frequency` <= 5725 THEN 27 ELSE 20 END))'),
|
|---|
| 552 | 'Description' => array('Type' => 'String', 'Caption' => 'Popis', 'Default' => ''),
|
|---|
| 553 | ),
|
|---|
| 554 | 'Actions' => array(
|
|---|
| 555 | array('Caption' => 'Frekvenční plán', 'URL' => '/network/frequency-plan/'),
|
|---|
| 556 | ),
|
|---|
| 557 | ));
|
|---|
| 558 | $this->System->FormManager->RegisterClass('NetworkInterfaceWirelessCTU', array(
|
|---|
| 559 | 'Title' => 'Bezdrátová rozhraní pro ČTÚ',
|
|---|
| 560 | 'Table' => 'NetworkInterfaceWireless',
|
|---|
| 561 | 'Items' => array(
|
|---|
| 562 | 'SSID' => array('Type' => 'String', 'Caption' => 'SSID', 'Default' => ''),
|
|---|
| 563 | 'MAC' => array('Type' => 'MacAddress', 'Caption' => 'MAC', 'Default' => ''),
|
|---|
| 564 | 'TxPower' => array('Type' => 'Integer', 'Caption' => 'Výstupní výkon', 'Default' => '18', 'Suffix' => 'dBm'),
|
|---|
| 565 | 'CableAttenuation' => array('Type' => 'Integer', 'Caption' => 'Útlum vedení', 'Default' => '0', 'Suffix' => 'dB'),
|
|---|
| 566 | 'AntenaGain' => array('Type' => 'Integer', 'Caption' => 'Zisk antény', 'Default' => '', 'Suffix' => 'dBi'),
|
|---|
| 567 | 'AntennaPolarity' => array('Type' => 'TAntennaPolarity', 'Caption' => 'Polarizace antény', 'Default' => '0'),
|
|---|
| 568 | 'Frequency' => array('Type' => 'Float', 'Caption' => 'Frekvence', 'Default' => '5600', 'Suffix' => 'MHz'),
|
|---|
| 569 | 'ChannelWidthLower' => array('Type' => 'Integer', 'Caption' => 'Šířka kanálu dolního', 'Default' => '0', 'Suffix' => 'MHz'),
|
|---|
| 570 | 'ChannelWidth' => array('Type' => 'Integer', 'Caption' => 'Šířka kanálu', 'Default' => '20', 'Suffix' => 'MHz'),
|
|---|
| 571 | 'ChannelWidthUpper' => array('Type' => 'Integer', 'Caption' => 'Šířka kanálu horního', 'Default' => '0', 'Suffix' => 'MHz'),
|
|---|
| 572 | 'Mode' => array('Type' => 'TWirelessMode', 'Caption' => 'Režim', 'Default' => '0', 'Suffix' => ''),
|
|---|
| 573 | 'TotalPower' => array('Type' => 'Integer', 'Caption' => 'Celkový výkon', 'Default' => '20', 'Suffix' => 'dBm',
|
|---|
| 574 | 'SQL' => '(`TxPower` - `CableAttenuation` + `AntenaGain`)', 'ReadOnly' => true),
|
|---|
| 575 | 'LimitPower' => array('Type' => 'Integer', 'Caption' => 'Max. limit', 'Default' => '', 'Suffix' => 'dBm',
|
|---|
| 576 | 'ReadOnly' => true, 'SQL' => '(CASE WHEN `Frequency` >= 5450 AND `Frequency` <= 5725 THEN 27 ELSE 20 END)'),
|
|---|
| 577 | 'UnderLimit' => array('Type' => 'Boolean', 'Caption' => 'V limitu', 'Default' => '', 'Suffix' => '',
|
|---|
| 578 | 'ReadOnly' => true, 'SQL' => '((`TxPower` - `CableAttenuation` + `AntenaGain`) <= (CASE WHEN `Frequency` >= 5450 AND `Frequency` <= 5725 THEN 27 ELSE 20 END))'),
|
|---|
| 579 | 'Position' => array('Type' => 'String', 'Caption' => 'GPS poloha', 'Default' => '',
|
|---|
| 580 | 'SQL' => '(SELECT MapPosition.Pos FROM MapPosition WHERE MapPosition.Id=(SELECT MapPosition FROM NetworkDevice WHERE NetworkDevice.Id=(SELECT NetworkInterface.Device FROM NetworkInterface WHERE NetworkInterface.Id=NetworkInterface)))'),
|
|---|
| 581 | 'Description' => array('Type' => 'String', 'Caption' => 'Popis', 'Default' => ''),
|
|---|
| 582 | ),
|
|---|
| 583 | 'Actions' => array(
|
|---|
| 584 | array('Caption' => 'Frekvenční plán', 'URL' => '/network/frequency-plan/'),
|
|---|
| 585 | ),
|
|---|
| 586 | ));
|
|---|
| 587 | $this->System->FormManager->RegisterClass('NetworkInterfaceUpDown', array(
|
|---|
| 588 | 'Title' => 'Změny stavu rozhraní',
|
|---|
| 589 | 'Table' => 'NetworkInterfaceUpDown',
|
|---|
| 590 | 'DefaultSortColumn' => 'Time',
|
|---|
| 591 | 'DefaultSortOrder' => 1,
|
|---|
| 592 | 'Items' => array(
|
|---|
| 593 | 'Time' => array('Type' => 'DateTime', 'Caption' => 'Čas', 'Default' => '', 'ReadOnly' => true),
|
|---|
| 594 | 'Interface' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní', 'Default' => '', 'ReadOnly' => true),
|
|---|
| 595 | 'State' => array('Type' => 'TOnlineState', 'Caption' => 'Stav', 'Default' => '', 'ReadOnly' => true),
|
|---|
| 596 | 'Duration' => array('Type' => 'TimeDiff', 'Caption' => 'Trvání', 'Default' => '', 'ReadOnly' => true),
|
|---|
| 597 | ),
|
|---|
| 598 | ));
|
|---|
| 599 | $this->System->FormManager->RegisterClass('NetworkPortUpDown', array(
|
|---|
| 600 | 'Title' => 'Změny stavu portů',
|
|---|
| 601 | 'Table' => 'NetworkPortUpDown',
|
|---|
| 602 | 'DefaultSortColumn' => 'Time',
|
|---|
| 603 | 'DefaultSortOrder' => 1,
|
|---|
| 604 | 'Items' => array(
|
|---|
| 605 | 'Time' => array('Type' => 'DateTime', 'Caption' => 'Čas', 'Default' => '', 'ReadOnly' => true),
|
|---|
| 606 | 'Port' => array('Type' => 'TNetworkPort', 'Caption' => 'Port', 'Default' => '', 'ReadOnly' => true),
|
|---|
| 607 | 'State' => array('Type' => 'TOnlineState', 'Caption' => 'Stav', 'Default' => '', 'ReadOnly' => true),
|
|---|
| 608 | 'Duration' => array('Type' => 'TimeDiff', 'Caption' => 'Trvání', 'Default' => '', 'ReadOnly' => true),
|
|---|
| 609 | ),
|
|---|
| 610 | ));
|
|---|
| 611 | $this->System->FormManager->RegisterClass('NetworkMac', array(
|
|---|
| 612 | 'Title' => 'Fyzická síťová adresa',
|
|---|
| 613 | 'Table' => 'NetworkMac',
|
|---|
| 614 | 'Items' => array(
|
|---|
| 615 | 'MAC' => array('Type' => 'String', 'Caption' => 'Fyzická adresa', 'Default' => ''),
|
|---|
| 616 | 'Signal' => array('Type' => 'TNetworkSignalListMac', 'Caption' => 'Signál rozhraní', 'Default' => ''),
|
|---|
| 617 | ),
|
|---|
| 618 | ));
|
|---|
| 619 | $this->System->FormManager->RegisterFormType('TNetworkMac', array(
|
|---|
| 620 | 'Type' => 'Reference',
|
|---|
| 621 | 'Table' => 'NetworkMac',
|
|---|
| 622 | 'Id' => 'Id',
|
|---|
| 623 | 'Name' => 'MAC',
|
|---|
| 624 | 'Filter' => '1',
|
|---|
| 625 | ));
|
|---|
| 626 | $this->System->FormManager->RegisterFormType('TNetworkSignalListMac', array(
|
|---|
| 627 | 'Type' => 'ManyToOne',
|
|---|
| 628 | 'Table' => 'NetworkSignal',
|
|---|
| 629 | 'Id' => 'Id',
|
|---|
| 630 | 'Ref' => 'Mac',
|
|---|
| 631 | 'Filter' => '1',
|
|---|
| 632 | ));
|
|---|
| 633 | $this->System->FormManager->RegisterFormType('TNetworkProtocol', array(
|
|---|
| 634 | 'Type' => 'Enumeration',
|
|---|
| 635 | 'States' => array('TCP', 'UDP'),
|
|---|
| 636 | ));
|
|---|
| 637 | $this->System->FormManager->RegisterFormType('TNetworkDevice', array(
|
|---|
| 638 | 'Type' => 'Reference',
|
|---|
| 639 | 'Table' => 'NetworkDevice',
|
|---|
| 640 | 'Id' => 'Id',
|
|---|
| 641 | 'Name' => 'Name',
|
|---|
| 642 | 'Filter' => '1',
|
|---|
| 643 | ));
|
|---|
| 644 | $this->System->FormManager->RegisterFormType('TNetworkDeviceType', array(
|
|---|
| 645 | 'Type' => 'Reference',
|
|---|
| 646 | 'Table' => 'NetworkDeviceType',
|
|---|
| 647 | 'Id' => 'Id',
|
|---|
| 648 | 'Name' => 'Name',
|
|---|
| 649 | 'Filter' => '1',
|
|---|
| 650 | ));
|
|---|
| 651 | $this->System->FormManager->RegisterFormType('TNetworkInterface', array(
|
|---|
| 652 | 'Type' => 'Reference',
|
|---|
| 653 | 'Table' => 'NetworkInterface',
|
|---|
| 654 | 'View' => '(SELECT NetworkInterface.*, CONCAT_WS("-", NetworkDevice.Name, NULLIF(NetworkInterface.Name, "")) AS DeviceName FROM NetworkInterface '.
|
|---|
| 655 | 'LEFT JOIN NetworkDevice ON NetworkDevice.Id = NetworkInterface.Device) AS T',
|
|---|
| 656 | 'Id' => 'Id',
|
|---|
| 657 | 'Name' => 'DeviceName',
|
|---|
| 658 | 'Filter' => '1',
|
|---|
| 659 | ));
|
|---|
| 660 | $this->System->FormManager->RegisterFormType('TNetworkPort', array(
|
|---|
| 661 | 'Type' => 'Reference',
|
|---|
| 662 | 'Table' => 'NetworkPort',
|
|---|
| 663 | 'View' => '(SELECT `NetworkPort`.*, CONCAT(CONCAT_WS("-", `NetworkDevice`.`Name`, NULLIF(`NetworkInterface`.`Name`, "")), ":", `NetworkPort`.`Number`) AS `PortName` FROM `NetworkPort` '.
|
|---|
| 664 | 'LEFT JOIN `NetworkInterface` ON `NetworkInterface`.`Id` = `NetworkPort`.`Interface` '.
|
|---|
| 665 | 'LEFT JOIN `NetworkDevice` ON `NetworkDevice`.`Id` = `NetworkInterface`.`Device`) AS `T`',
|
|---|
| 666 | 'Id' => 'Id',
|
|---|
| 667 | 'Name' => 'PortName',
|
|---|
| 668 | 'Filter' => '1',
|
|---|
| 669 | ));
|
|---|
| 670 | $this->System->FormManager->RegisterFormType('TNetworkInterfaceType', array(
|
|---|
| 671 | 'Type' => 'Reference',
|
|---|
| 672 | 'Table' => 'NetworkInterfaceType',
|
|---|
| 673 | 'Id' => 'Id',
|
|---|
| 674 | 'Name' => 'Name',
|
|---|
| 675 | 'Filter' => '1',
|
|---|
| 676 | ));
|
|---|
| 677 | $this->System->FormManager->RegisterFormType('TDeviceList', array(
|
|---|
| 678 | 'Type' => 'ManyToOne',
|
|---|
| 679 | 'Table' => 'NetworkDevice',
|
|---|
| 680 | 'Id' => 'Id',
|
|---|
| 681 | 'Ref' => 'Member',
|
|---|
| 682 | 'Filter' => '1',
|
|---|
| 683 | ));
|
|---|
| 684 | $this->System->FormManager->RegisterFormType('TDeviceListAPI', array(
|
|---|
| 685 | 'Type' => 'ManyToOne',
|
|---|
| 686 | 'Table' => 'NetworkDevice',
|
|---|
| 687 | 'Id' => 'Id',
|
|---|
| 688 | 'Ref' => 'API',
|
|---|
| 689 | 'Filter' => '1',
|
|---|
| 690 | ));
|
|---|
| 691 | $this->System->FormManager->RegisterFormType('TDevicePortListInterface', array(
|
|---|
| 692 | 'Type' => 'ManyToOne',
|
|---|
| 693 | 'Table' => 'NetworkPort',
|
|---|
| 694 | 'Id' => 'Id',
|
|---|
| 695 | 'Ref' => 'Interface',
|
|---|
| 696 | 'Filter' => '1',
|
|---|
| 697 | ));
|
|---|
| 698 | $this->System->FormManager->RegisterFormType('TDeviceInterfaceLatencyListInterface', array(
|
|---|
| 699 | 'Type' => 'ManyToOne',
|
|---|
| 700 | 'Table' => 'NetworkInterfaceLatency',
|
|---|
| 701 | 'Id' => 'Id',
|
|---|
| 702 | 'Ref' => 'Interface',
|
|---|
| 703 | 'Filter' => '1',
|
|---|
| 704 | ));
|
|---|
| 705 | $this->System->FormManager->RegisterFormType('TNetworkLinkType', array(
|
|---|
| 706 | 'Type' => 'Reference',
|
|---|
| 707 | 'Table' => 'NetworkLinkType',
|
|---|
| 708 | 'Id' => 'Id',
|
|---|
| 709 | 'Name' => 'Name',
|
|---|
| 710 | 'Filter' => '1',
|
|---|
| 711 | ));
|
|---|
| 712 | $this->System->FormManager->RegisterFormType('TDeviceAPIType', array(
|
|---|
| 713 | 'Type' => 'Reference',
|
|---|
| 714 | 'Table' => 'DeviceAPIType',
|
|---|
| 715 | 'Id' => 'Id',
|
|---|
| 716 | 'Name' => 'Name',
|
|---|
| 717 | 'Filter' => '1',
|
|---|
| 718 | ));
|
|---|
| 719 | $this->System->FormManager->RegisterFormType('TNetworkInterfaceWirelessListInterface', array(
|
|---|
| 720 | 'Type' => 'ManyToOne',
|
|---|
| 721 | 'Table' => 'NetworkInterfaceWireless',
|
|---|
| 722 | 'Id' => 'Id',
|
|---|
| 723 | 'Ref' => 'NetworkInterface',
|
|---|
| 724 | 'Filter' => '1',
|
|---|
| 725 | ));
|
|---|
| 726 | $this->System->FormManager->RegisterFormType('TInterfaceList', array(
|
|---|
| 727 | 'Type' => 'ManyToOne',
|
|---|
| 728 | 'Table' => 'NetworkInterface',
|
|---|
| 729 | 'Id' => 'Id',
|
|---|
| 730 | 'Ref' => 'Device',
|
|---|
| 731 | 'Filter' => '1',
|
|---|
| 732 | ));
|
|---|
| 733 | $this->System->FormManager->RegisterFormType('TDeviceLogList', array(
|
|---|
| 734 | 'Type' => 'ManyToOne',
|
|---|
| 735 | 'Table' => 'NetworkDeviceLog',
|
|---|
| 736 | 'Id' => 'Id',
|
|---|
| 737 | 'Ref' => 'Device',
|
|---|
| 738 | 'Filter' => '1',
|
|---|
| 739 | ));
|
|---|
| 740 | $this->System->FormManager->RegisterFormType('TNetworkLinkListInterface', array(
|
|---|
| 741 | 'Type' => 'ManyToOne',
|
|---|
| 742 | 'Table' => 'NetworkLinkUnion',
|
|---|
| 743 | 'Id' => 'Id',
|
|---|
| 744 | 'Ref' => 'Interface',
|
|---|
| 745 | 'Filter' => '1',
|
|---|
| 746 | ));
|
|---|
| 747 | $this->System->FormManager->RegisterFormType('TNetworkLinkListInterface1', array(
|
|---|
| 748 | 'Type' => 'ManyToOne',
|
|---|
| 749 | 'Table' => 'NetworkLink',
|
|---|
| 750 | 'Id' => 'Id',
|
|---|
| 751 | 'Ref' => 'Interface1',
|
|---|
| 752 | 'Filter' => '1',
|
|---|
| 753 | ));
|
|---|
| 754 | $this->System->FormManager->RegisterFormType('TNetworkLinkListInterface2', array(
|
|---|
| 755 | 'Type' => 'ManyToOne',
|
|---|
| 756 | 'Table' => 'NetworkLink',
|
|---|
| 757 | 'Id' => 'Id',
|
|---|
| 758 | 'Ref' => 'Interface2',
|
|---|
| 759 | 'Filter' => '1',
|
|---|
| 760 | ));
|
|---|
| 761 | $this->System->FormManager->RegisterFormType('TNetworkInterfaceUpDown', array(
|
|---|
| 762 | 'Type' => 'ManyToOne',
|
|---|
| 763 | 'Table' => 'NetworkInterfaceUpDown',
|
|---|
| 764 | 'Id' => 'Id',
|
|---|
| 765 | 'Ref' => 'Interface',
|
|---|
| 766 | 'Filter' => '1',
|
|---|
| 767 | ));
|
|---|
| 768 | $this->System->FormManager->RegisterFormType('TNetworkPortUpDown', array(
|
|---|
| 769 | 'Type' => 'ManyToOne',
|
|---|
| 770 | 'Table' => 'NetworkPortUpDown',
|
|---|
| 771 | 'Id' => 'Id',
|
|---|
| 772 | 'Ref' => 'Port',
|
|---|
| 773 | 'Filter' => '1',
|
|---|
| 774 | ));
|
|---|
| 775 |
|
|---|
| 776 | ModuleIS::Cast($this->System->GetModule('IS'))->RegisterDashboardItem('Network',
|
|---|
| 777 | array($this, 'ShowDashboardItem'));
|
|---|
| 778 |
|
|---|
| 779 | $this->System->RegisterModel('NetworkDevice', array(
|
|---|
| 780 | 'Title' => 'Síťové zařízení',
|
|---|
| 781 | ));
|
|---|
| 782 | $this->System->RegisterModel('NetworkInterface', array(
|
|---|
| 783 | 'Title' => 'Síťové rozhraní',
|
|---|
| 784 | ));
|
|---|
| 785 | }
|
|---|
| 786 |
|
|---|
| 787 | function AfterInsertNetworkDevice(Form $Form, string $Id): array
|
|---|
| 788 | {
|
|---|
| 789 | $this->System->Models['NetworkDevice']->DoOnChange();
|
|---|
| 790 | return $Form->Values;
|
|---|
| 791 | }
|
|---|
| 792 |
|
|---|
| 793 | function AfterModifyNetworkDevice(Form $Form, string $Id): array
|
|---|
| 794 | {
|
|---|
| 795 | $this->System->Models['NetworkDevice']->DoOnChange();
|
|---|
| 796 | return $Form->Values;
|
|---|
| 797 | }
|
|---|
| 798 |
|
|---|
| 799 | function AfterInsertNetworkInterface(Form $Form, string $Id): array
|
|---|
| 800 | {
|
|---|
| 801 | $this->System->Models['NetworkInterface']->DoOnChange();
|
|---|
| 802 | return $Form->Values;
|
|---|
| 803 | }
|
|---|
| 804 |
|
|---|
| 805 | function AfterModifyNetworkInterface(Form $Form, string $Id): array
|
|---|
| 806 | {
|
|---|
| 807 | $this->System->Models['NetworkInterface']->DoOnChange();
|
|---|
| 808 | return $Form->Values;
|
|---|
| 809 | }
|
|---|
| 810 |
|
|---|
| 811 | function BeforeDeleteNetworkInterface(Form $Form, string $Id): void
|
|---|
| 812 | {
|
|---|
| 813 | $this->Database->query('DELETE FROM `NetworkInterfaceUpDown` WHERE `Interface`='.$Id);
|
|---|
| 814 | $this->Database->query('DELETE FROM `NetworkLink` WHERE `Interface1`='.$Id.' OR `Interface2`='.$Id);
|
|---|
| 815 | $this->Database->query('DELETE FROM `NetworkPort` WHERE `Interface`='.$Id);
|
|---|
| 816 | $this->Database->query('DELETE FROM `NetworkSignal` WHERE `Interface`='.$Id);
|
|---|
| 817 | $this->Database->query('DELETE FROM `NetworkInterfaceWireless` WHERE `NetworkInterface`='.$Id);
|
|---|
| 818 | $this->Database->query('DELETE FROM `NetworkInterfaceLatency` WHERE `Interface`='.$Id);
|
|---|
| 819 | }
|
|---|
| 820 |
|
|---|
| 821 | function ImportNetworkLog(array $Parameters): void
|
|---|
| 822 | {
|
|---|
| 823 | global $Config;
|
|---|
| 824 |
|
|---|
| 825 | $StartTime = time();
|
|---|
| 826 |
|
|---|
| 827 | $DbResult = $this->System->Database->select('NetworkDeviceLog', 'Time',
|
|---|
| 828 | '1 ORDER BY Time DESC LIMIT 1');
|
|---|
| 829 | if ($DbResult->num_rows > 0)
|
|---|
| 830 | {
|
|---|
| 831 | $DbRow = $DbResult->fetch_assoc();
|
|---|
| 832 | $WhereTime = ' AND (`Time` > "'.$DbRow['Time'].'")';
|
|---|
| 833 | } else $WhereTime = '';
|
|---|
| 834 |
|
|---|
| 835 | $RemoteDb = new Database();
|
|---|
| 836 | $RemoteDb->Connect($Config['NetworkLog']['Host'], $Config['NetworkLog']['User'],
|
|---|
| 837 | $Config['NetworkLog']['Password'], $Config['NetworkLog']['Database']);
|
|---|
| 838 | $DbResult = $RemoteDb->select('SystemEvents', '*', '`ReceivedAt`>"'. TimeToMysqlDate($StartTime).'"'.$WhereTime.' ORDER BY `Time` DESC');
|
|---|
| 839 | while ($DbRow = $DbResult->fetch_array())
|
|---|
| 840 | {
|
|---|
| 841 | $DbResult2 = $this->System->Database->select('NetworkInterface', 'Device, CONCAT(CONCAT_WS("-", `NetworkDevice`.`Name`, NULLIF(`NetworkInterface`.`Name`, "")), ".") AS `Name` ', '`Name` LIKE "'.$DbRow['FromHost'].'"');
|
|---|
| 842 | if ($DbResult2->num_rows > 0)
|
|---|
| 843 | {
|
|---|
| 844 | $DbRow2 = $DbResult2->fetch_assoc();
|
|---|
| 845 | $DeviceId = $DbRow2['Device'];
|
|---|
| 846 | $this->System->Database->insert('NetworkDeviceLog', array('Time' => $DbRow['ReceivedAt'],
|
|---|
| 847 | 'Device' => $DeviceId, 'Message' => $DbRow['Message'], 'Tags' => $DbRow['SysLogTag']));
|
|---|
| 848 | } else echo('Host '.$DbRow['Host'].' not paired with network device.'."\n");
|
|---|
| 849 | }
|
|---|
| 850 | }
|
|---|
| 851 |
|
|---|
| 852 | function ShowDashboardItem(): string
|
|---|
| 853 | {
|
|---|
| 854 | $Output = '';
|
|---|
| 855 |
|
|---|
| 856 | // Devices
|
|---|
| 857 | $DbResult = $this->Database->select('NetworkDevice', 'COUNT(*)', '1');
|
|---|
| 858 | $DbRow = $DbResult->fetch_row();
|
|---|
| 859 | $Output .= 'Síťových zařízení: registrovaných: <a href="'.$this->System->Link('/is/?a=list&t=NetworkDevice').'">'.$DbRow['0'].'</a>';
|
|---|
| 860 |
|
|---|
| 861 | $DbResult = $this->Database->select('NetworkDevice', 'COUNT(*)', '`Used`=1');
|
|---|
| 862 | $DbRow = $DbResult->fetch_row();
|
|---|
| 863 | $Output .= ' použitých: <a href="'.$this->System->Link('/is/?a=list&t=NetworkDevice&filter=1&FilterUsed=1').'">'.$DbRow['0'].'</a>';
|
|---|
| 864 |
|
|---|
| 865 | $DbResult = $this->Database->select('NetworkDevice', 'COUNT(*)', '`Used`=1 AND `PermanentOnline`=1 AND `Online`=0');
|
|---|
| 866 | $DbRow = $DbResult->fetch_row();
|
|---|
| 867 | $Output .= ' nedostupných: <a href="'.$this->System->Link('/is/?a=list&t=NetworkDevice&filter=1&FilterUsed=1&FilterOnline=0&FilterPermanentOnline=1').'">'.$DbRow['0'].'</a>';
|
|---|
| 868 |
|
|---|
| 869 | $Output .= '<br/>';
|
|---|
| 870 |
|
|---|
| 871 | // Interfaces
|
|---|
| 872 | $DbResult = $this->Database->select('NetworkInterface', 'COUNT(*)', '1');
|
|---|
| 873 | $DbRow = $DbResult->fetch_row();
|
|---|
| 874 | $Output .= 'Síťových rozhraní: registrovaných: <a href="'.$this->System->Link('/is/?a=list&t=NetworkDevice').'">'.$DbRow['0'].'</a>';
|
|---|
| 875 |
|
|---|
| 876 | $DbResult = $this->Database->select('NetworkInterface', 'COUNT(*)', '`Enabled`=1');
|
|---|
| 877 | $DbRow = $DbResult->fetch_row();
|
|---|
| 878 | $Output .= ' použitých: <a href="'.$this->System->Link('/is/?a=list&t=NetworkInterface&filter=1&FilterEnabled=1').'">'.$DbRow['0'].'</a>';
|
|---|
| 879 |
|
|---|
| 880 | //$DbResult = $this->Database->select('NetworkInterface', 'COUNT(*)', '`Enabled`=1 AND `PermanentOnline`=1 AND `Online`=0');
|
|---|
| 881 | //$DbRow = $DbResult->fetch_row();
|
|---|
| 882 | //$Output .= ' nedostupných: <a href="'.$this->System->Link('/is/?a=list&t=NetworkInterface&filter=1&FilterEnabled=1&FilterOnline=0&FilterPermanentOnline=1').'">'.$DbRow['0'].'</a>';
|
|---|
| 883 |
|
|---|
| 884 | $Output .= '<br/>';
|
|---|
| 885 |
|
|---|
| 886 | // Ports
|
|---|
| 887 | $DbResult = $this->Database->select('NetworkPort', 'COUNT(*)', '1');
|
|---|
| 888 | $DbRow = $DbResult->fetch_row();
|
|---|
| 889 | $Output .= 'Síťových portů: <a href="'.$this->System->Link('/is/?a=list&t=NetworkPort').'">'.$DbRow['0'].'</a>';
|
|---|
| 890 |
|
|---|
| 891 | $DbResult = $this->Database->select('NetworkPort', 'COUNT(*)', '`Enabled`=1');
|
|---|
| 892 | $DbRow = $DbResult->fetch_row();
|
|---|
| 893 | $Output .= ' použitých: <a href="'.$this->System->Link('/is/?a=list&t=NetworkPort&filter=1&FilterEnabled=1').'">'.$DbRow['0'].'</a>';
|
|---|
| 894 |
|
|---|
| 895 | $DbResult = $this->Database->select('NetworkPort', 'COUNT(*)', '`Enabled`=1 AND `Online`=0');
|
|---|
| 896 | $DbRow = $DbResult->fetch_row();
|
|---|
| 897 | $Output .= ' nedostupných: <a href="'.$this->System->Link('/is/?a=list&t=NetworkPort&filter=1&FilterEnabled=1&FilterOnline=0').'">'.$DbRow['0'].'</a>';
|
|---|
| 898 |
|
|---|
| 899 | $Output .= '<br/>';
|
|---|
| 900 |
|
|---|
| 901 | // Subnets
|
|---|
| 902 | $DbResult = $this->Database->select('NetworkSubnet', 'COUNT(*)', '1');
|
|---|
| 903 | $DbRow = $DbResult->fetch_row();
|
|---|
| 904 | $Output .= 'Síťových podsítí: <a href="'.$this->System->Link('/is/?a=list&t=NetworkSubnet').'">'.$DbRow['0'].'</a><br/>';
|
|---|
| 905 |
|
|---|
| 906 | return $Output;
|
|---|
| 907 | }
|
|---|
| 908 |
|
|---|
| 909 | function OnlineList(string $Title, int $OnlineNow, int $OnlinePrevious, int $MinDuration): array
|
|---|
| 910 | {
|
|---|
| 911 | $Time = time();
|
|---|
| 912 | $OnlineText = array('<span style="color:red;">Nedostupný</span>', '<span style="color:green;">Dostupný</span>');
|
|---|
| 913 | $Output = '';
|
|---|
| 914 | $Condition = 'WHERE (`NetworkInterface`.`LastOnline` <= "'.TimeToMysqlDateTime($Time - $MinDuration).'")';
|
|---|
| 915 | if ($OnlineNow >= 0) $Condition .= ' AND (`NetworkInterface`.`Online` = '.$OnlineNow.')';
|
|---|
| 916 | if ($OnlinePrevious >= 0) $Condition .= ' AND (`NetworkInterface`.`OnlineNotify` = '.$OnlinePrevious.')';
|
|---|
| 917 | $DbResult3 = $this->Database->query('SELECT CONCAT_WS("-", `NetworkDevice`.`Name`, NULLIF(`NetworkInterface`.`Name`, "")) AS `Name`, '.
|
|---|
| 918 | '`NetworkInterface`.`Online`, `NetworkInterface`.`LastOnline` FROM `NetworkInterface` '.
|
|---|
| 919 | 'LEFT JOIN `NetworkDevice` ON `NetworkDevice`.`Id` = `NetworkInterface`.`Device` '.
|
|---|
| 920 | $Condition.' AND (`NetworkDevice`.`PermanentOnline`=1) AND (`NetworkDevice`.`Used`=1) AND '.
|
|---|
| 921 | '(`NetworkInterface`.`LocalIP` != "") AND (`NetworkInterface`.`Enabled`=1)'.
|
|---|
| 922 | 'ORDER BY `Name` ASC');
|
|---|
| 923 | if ($DbResult3->num_rows > 0)
|
|---|
| 924 | {
|
|---|
| 925 | $Output .= $Title.'<br/>';
|
|---|
| 926 | $Output .= '<table>'.
|
|---|
| 927 | '<tr><th align="center">Jméno</th><th align="center">Stav</th><th align="center">Čas</th><th align="center">Trvání</th></tr>'."\n";
|
|---|
| 928 | while ($Item = $DbResult3->fetch_assoc())
|
|---|
| 929 | {
|
|---|
| 930 | $Duration = $Time - MysqlDateTimeToTime($Item['LastOnline']);
|
|---|
| 931 | $DurationText = sprintf('%02d', floor($Duration / 3600) % 24).':'.
|
|---|
| 932 | sprintf('%02d', floor($Duration / 60) % 60).':'.
|
|---|
| 933 | sprintf('%02d', floor($Duration) % 60);
|
|---|
| 934 | $Days = floor($Duration / (60 * 60 * 24));
|
|---|
| 935 | if ($Days > 0) $DurationText = $Days.' dnů '.$DurationText;
|
|---|
| 936 |
|
|---|
| 937 | $Output .= '<tr><td>'.$Item['Name'].'</td><td>'.$OnlineText[$Item['Online']].
|
|---|
| 938 | '</td><td>'.$Item['LastOnline'].'</td><td>'.$DurationText.'</td></tr>'."\n";
|
|---|
| 939 | }
|
|---|
| 940 | $Output .= '</table><br/>'."\n";
|
|---|
| 941 | }
|
|---|
| 942 |
|
|---|
| 943 | if (($OnlineNow >= 0) and ($OnlinePrevious >= 0))
|
|---|
| 944 | {
|
|---|
| 945 | $this->Database->query('UPDATE `NetworkInterface` SET `OnlineNotify` = `Online` '.$Condition);
|
|---|
| 946 | }
|
|---|
| 947 | return array('Report' => $Output, 'Count' => $DbResult3->num_rows);
|
|---|
| 948 | }
|
|---|
| 949 |
|
|---|
| 950 | function ReachabilityCheck(): array
|
|---|
| 951 | {
|
|---|
| 952 | $NewOnline = $this->OnlineList('Nově online', 1, 0, 0);
|
|---|
| 953 | $Output = $NewOnline['Report'];
|
|---|
| 954 | $NewOffline = $this->OnlineList('Nově offline', 0, 1, $this->MinNotifyTime);
|
|---|
| 955 | $Output .= $NewOffline['Report'];
|
|---|
| 956 | if ($Output != '')
|
|---|
| 957 | {
|
|---|
| 958 | $StillOffline = $this->OnlineList('Stále offline', 0, 0, 0);
|
|---|
| 959 | $Output .= $StillOffline['Report'];
|
|---|
| 960 | }
|
|---|
| 961 | $Offline = $this->OnlineList('Offline', 0, -1, 0);
|
|---|
| 962 | return array('Report' => $Output, 'Count' => $Offline['Count'], 'Title' => 'Odezva');
|
|---|
| 963 | }
|
|---|
| 964 |
|
|---|
| 965 | function PortCheckList(string $Title, int $OnlineNow, int $OnlinePrevious, int $MinDuration): array
|
|---|
| 966 | {
|
|---|
| 967 | $Time = time();
|
|---|
| 968 | $OnlineText = array('<span style="color:red;">Nedostupný</span>', '<span style="color:green;">Dostupný</span>');
|
|---|
| 969 | $Output = '';
|
|---|
| 970 | $Condition = 'WHERE (`NetworkPort`.`LastOnline` <= "'.TimeToMysqlDateTime($Time - $MinDuration).'")';
|
|---|
| 971 | if ($OnlineNow >= null) $Condition .= ' AND (`NetworkPort`.`Online` = '.$OnlineNow.')';
|
|---|
| 972 | if ($OnlinePrevious >= null) $Condition .= ' AND (`NetworkPort`.`OnlineNotify` = '.$OnlinePrevious.')';
|
|---|
| 973 | $DbResult3 = $this->Database->query('SELECT CONCAT(CONCAT_WS("-", `NetworkDevice`.`Name`, NULLIF(`NetworkInterface`.`Name`, "")), ":", `NetworkPort`.`Number`, "(", `NetworkPort`.`Name`, ")") AS `Name`, '.
|
|---|
| 974 | '`NetworkPort`.`Online`, `NetworkPort`.`LastOnline` FROM `NetworkPort` '.
|
|---|
| 975 | 'LEFT JOIN `NetworkInterface` ON `NetworkInterface`.`Id` = `NetworkPort`.`Interface` '.
|
|---|
| 976 | 'LEFT JOIN `NetworkDevice` ON `NetworkDevice`.`Id` = `NetworkInterface`.`Device` '.
|
|---|
| 977 | $Condition.' AND (`NetworkDevice`.`PermanentOnline`=1) AND (`NetworkDevice`.`Used`=1) AND '.
|
|---|
| 978 | '(`NetworkInterface`.`LocalIP` != "") AND (`NetworkPort`.`Enabled` = 1)'.
|
|---|
| 979 | 'ORDER BY `Name` ASC');
|
|---|
| 980 | if ($DbResult3->num_rows > 0)
|
|---|
| 981 | {
|
|---|
| 982 | $Output .= $Title.'<br/>';
|
|---|
| 983 | $Output .= '<table>'.
|
|---|
| 984 | '<tr><th align="center">Jméno</th><th align="center">Stav</th><th align="center">Čas</th><th align="center">Trvání</th></tr>'."\n";
|
|---|
| 985 | while ($Item = $DbResult3->fetch_assoc())
|
|---|
| 986 | {
|
|---|
| 987 | $Duration = $Time - MysqlDateTimeToTime($Item['LastOnline']);
|
|---|
| 988 | $DurationText = sprintf('%02d', floor($Duration / 3600) % 24).':'.
|
|---|
| 989 | sprintf('%02d', floor($Duration / 60) % 60).':'.
|
|---|
| 990 | sprintf('%02d', floor($Duration) % 60);
|
|---|
| 991 | $Days = floor($Duration / (60 * 60 * 24));
|
|---|
| 992 | if ($Days > 0) $DurationText = $Days.' dnů '.$DurationText;
|
|---|
| 993 |
|
|---|
| 994 | $Output .= '<tr><td>'.$Item['Name'].'</td><td>'.$OnlineText[$Item['Online']].
|
|---|
| 995 | '</td><td>'.$Item['LastOnline'].'</td><td>'.$DurationText.'</td></tr>'."\n";
|
|---|
| 996 | }
|
|---|
| 997 | $Output .= '</table><br/>'."\n";
|
|---|
| 998 | }
|
|---|
| 999 |
|
|---|
| 1000 | if (($OnlineNow >= 0) and ($OnlinePrevious >= 0))
|
|---|
| 1001 | {
|
|---|
| 1002 | $this->Database->query('UPDATE `NetworkPort` SET `OnlineNotify` = `Online` '.$Condition);
|
|---|
| 1003 | }
|
|---|
| 1004 | return array('Report' => $Output, 'Count' => $DbResult3->num_rows);
|
|---|
| 1005 | }
|
|---|
| 1006 |
|
|---|
| 1007 | function PortCheck(): array
|
|---|
| 1008 | {
|
|---|
| 1009 | $Output = '';
|
|---|
| 1010 | $NewOnline = $this->PortCheckList('Nově online', 1, 0, 0);
|
|---|
| 1011 | $Output .= $NewOnline['Report'];
|
|---|
| 1012 | $NewOffline = $this->PortCheckList('Nově offline', 0, 1, $this->MinNotifyTime);
|
|---|
| 1013 | $Output .= $NewOffline['Report'];
|
|---|
| 1014 | if ($Output != '')
|
|---|
| 1015 | {
|
|---|
| 1016 | $StillOffline = $this->PortCheckList('Stále offline', 0, 0, 0);
|
|---|
| 1017 | $Output .= $StillOffline['Report'];
|
|---|
| 1018 | }
|
|---|
| 1019 | $Offline = $this->PortCheckList('Offline', 0, -1, 0);
|
|---|
| 1020 | return array('Report' => $Output, 'Count' => $Offline['Count'], 'Title' => 'Port');
|
|---|
| 1021 | }
|
|---|
| 1022 | }
|
|---|