Changeset 887 for trunk/Modules/Network/Network.php
- Timestamp:
- Nov 20, 2020, 12:08:12 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Network/Network.php
r879 r887 8 8 class PageFrequencyPlan extends Page 9 9 { 10 var $FullTitle = 'Výpis obsazení frekvenčních kanálů'; 11 var $ShortTitle = 'Frekvenční plán'; 12 var $ParentClass = 'PageNetwork'; 13 14 function Show() 10 function __construct(System $System) 11 { 12 parent::__construct($System); 13 $this->FullTitle = 'Výpis obsazení frekvenčních kanálů'; 14 $this->ShortTitle = 'Frekvenční plán'; 15 $this->ParentClass = 'PageNetwork'; 16 } 17 18 function Show(): string 15 19 { 16 20 // http://en.wikipedia.org/wiki/List_of_WLAN_channels … … 75 79 class PageNetwork extends Page 76 80 { 77 var $FullTitle = 'Technické informace o síti'; 78 var $ShortTitle = 'Síť'; 79 var $ParentClass = 'PagePortal'; 80 81 function Show() 82 { 83 if (count($this->System->PathItems) > 1) 84 { 85 $Output = $this->PageNotFound(); 86 } else $Output = $this->ShowInformation(); 87 return $Output; 88 } 89 90 function ShowInformation() 91 { 92 if (!$this->System->User->CheckPermission('Network', 'ShowInfo')) 81 function __construct(System $System) 82 { 83 parent::__construct($System); 84 $this->FullTitle = 'Technické informace o síti'; 85 $this->ShortTitle = 'Síť'; 86 $this->ParentClass = 'PagePortal'; 87 } 88 89 function Show(): string 90 { 91 if (!ModuleUser::Cast($this->System->GetModule('User'))->User->CheckPermission('Network', 'ShowInfo')) 93 92 return 'Nemáte oprávnění'; 94 93 … … 102 101 class ModuleNetwork extends AppModule 103 102 { 104 var$MinNotifyTime;105 106 function __construct( $System)103 public int $MinNotifyTime; 104 105 function __construct(System $System) 107 106 { 108 107 parent::__construct($System); … … 112 111 $this->License = 'GNU/GPLv3'; 113 112 $this->Description = 'Networking related tools'; 114 $this->Dependencies = array('Notify' );113 $this->Dependencies = array('Notify', 'IS'); 115 114 116 115 // TODO: Make notify time configurable … … 118 117 } 119 118 120 function DoInstall() 121 { 122 } 123 124 function DoUninstall() 125 { 126 } 127 128 function DoStart() 129 { 130 $this->System->ModuleManager->Modules['Notify']->RegisterCheck('NetworkReachability',119 function DoInstall(): void 120 { 121 } 122 123 function DoUninstall(): void 124 { 125 } 126 127 function DoStart(): void 128 { 129 ModuleNotify::Cast($this->System->GetModule('Notify'))->RegisterCheck('NetworkReachability', 131 130 array($this, 'ReachabilityCheck')); 132 $this->System->ModuleManager->Modules['Notify']->RegisterCheck('NetworkPort',131 ModuleNotify::Cast($this->System->GetModule('Notify'))->RegisterCheck('NetworkPort', 133 132 array($this, 'PortCheck')); 134 133 135 $this->System->RegisterPage( 'network', 'PageNetwork');136 $this->System->RegisterPage( array('network', 'administration'), 'PageNetworkAdministration');137 $this->System->RegisterPage( array('network', 'subnet'), 'PageSubnet');138 $this->System->RegisterPage( array('network', 'user-hosts'), 'PageNetworkHostList');139 $this->System->RegisterPage( array('network', 'hosting'),'PageHosting');140 $this->System->RegisterPage( array('network', 'hosts'), 'PageHostList');141 $this->System->RegisterPage( array('network', 'frequency-plan'), 'PageFrequencyPlan');142 143 $this->System->RegisterCommandLine('networklog_import', array($this, 'ImportNetworkLog'));134 $this->System->RegisterPage(['network'], 'PageNetwork'); 135 $this->System->RegisterPage(['network', 'administration'], 'PageNetworkAdministration'); 136 $this->System->RegisterPage(['network', 'subnet'], 'PageSubnet'); 137 $this->System->RegisterPage(['network', 'user-hosts'], 'PageNetworkHostList'); 138 $this->System->RegisterPage(['network', 'hosting'],'PageHosting'); 139 $this->System->RegisterPage(['network', 'hosts'], 'PageHostList'); 140 $this->System->RegisterPage(['network', 'frequency-plan'], 'PageFrequencyPlan'); 141 142 $this->System->RegisterCommandLine('networklog_import', 'Imports network logs from remote server', array($this, 'ImportNetworkLog')); 144 143 145 144 $this->System->FormManager->RegisterClass('NetworkDomainAlias', array( … … 750 749 )); 751 750 752 $this->System->ModuleManager->Modules['IS']->RegisterDashboardItem('Network',753 array( 'ModuleNetwork', 'ShowDashboardItem'));751 ModuleIS::Cast($this->System->GetModule('IS'))->RegisterDashboardItem('Network', 752 array($this, 'ShowDashboardItem')); 754 753 755 754 $this->System->RegisterModel('NetworkDevice', array( … … 761 760 } 762 761 763 function AfterInsertNetworkDevice( $Form)762 function AfterInsertNetworkDevice(Form $Form): void 764 763 { 765 764 $this->System->Models['NetworkDevice']->DoOnChange(); 766 765 } 767 766 768 function AfterModifyNetworkDevice( $Form, $Id)767 function AfterModifyNetworkDevice(Form $Form, string $Id): void 769 768 { 770 769 $this->System->Models['NetworkDevice']->DoOnChange(); 771 770 } 772 771 773 function AfterInsertNetworkInterface( $Form)772 function AfterInsertNetworkInterface(Form $Form): void 774 773 { 775 774 $this->System->Models['NetworkInterface']->DoOnChange(); 776 775 } 777 776 778 function AfterModifyNetworkInterface( $Form, $Id)777 function AfterModifyNetworkInterface(Form $Form, string $Id): void 779 778 { 780 779 $this->System->Models['NetworkInterface']->DoOnChange(); 781 780 } 782 781 783 function BeforeDeleteNetworkInterface( $Form, $Id)782 function BeforeDeleteNetworkInterface(Form $Form, string $Id): void 784 783 { 785 784 $this->Database->query('DELETE FROM `NetworkInterfaceUpDown` WHERE `Interface`='.$Id); … … 791 790 } 792 791 793 function ImportNetworkLog( $Parameters)792 function ImportNetworkLog(array $Parameters): void 794 793 { 795 794 global $Config; … … 813 812 { 814 813 $DbRow2 = $DbResult2->fetch_assoc(); 815 $DeviceI D= $DbRow2['Device'];814 $DeviceId = $DbRow2['Device']; 816 815 $this->System->Database->insert('NetworkDeviceLog', array('Time' => $DbRow['ReceivedAt'], 817 816 'Device' => $DeviceId, 'Message' => $DbRow['Message'], 'Tags' => $DbRow['SysLogTag'])); … … 820 819 } 821 820 822 function ShowDashboardItem() 821 function ShowDashboardItem(): string 823 822 { 824 823 $Output = ''; … … 841 840 } 842 841 843 function DoStop() 844 { 845 } 846 847 function OnlineList( $Title, $OnlineNow, $OnlinePrevious, $MinDuration)842 function DoStop(): void 843 { 844 } 845 846 function OnlineList(string $Title, string $OnlineNow, string $OnlinePrevious, int $MinDuration): array 848 847 { 849 848 $Time = time(); … … 886 885 } 887 886 888 function ReachabilityCheck() 887 function ReachabilityCheck(): array 889 888 { 890 889 $NewOnline = $this->OnlineList('Nově online', 1, 0, 0); … … 898 897 } 899 898 900 function PortCheckList( $Title, $OnlineNow, $OnlinePrevious, $MinDuration)899 function PortCheckList(string $Title, string $OnlineNow, string $OnlinePrevious, int $MinDuration): array 901 900 { 902 901 $Time = time(); … … 937 936 } 938 937 939 function PortCheck() 938 function PortCheck(): array 940 939 { 941 940 $Output = '';
Note:
See TracChangeset
for help on using the changeset viewer.