Ignore:
Timestamp:
Nov 20, 2020, 12:08:12 AM (4 years ago)
Author:
chronos
Message:
  • Added: Static types added to almost all classes, methods and function. Supported by PHP 7.4.
  • Fixed: Various found code issues.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/NetworkConfigRouterOS/NetworkConfigRouterOS.php

    r874 r887  
    1818class ModuleNetworkConfigRouterOS extends AppModule
    1919{
    20   function __construct($System)
     20  function __construct(System $System)
    2121  {
    2222    parent::__construct($System);
     
    2929  }
    3030
    31   function DoInstall()
     31  function DoInstall(): void
    3232  {
    3333  }
    3434
    35   function DoUnInstall()
     35  function DoUnInstall(): void
    3636  {
    3737  }
    3838
    39   function DoStart()
     39  function DoStart(): void
    4040  {
    4141    $this->System->Pages['zdarma'] = 'PageFreeAccess';
    42     $this->System->ModuleManager->Modules['NetworkConfig']->RegisterConfigItem('routeros-dns', 'ConfigRouterOSDNS');
    43     $this->System->ModuleManager->Modules['NetworkConfig']->RegisterConfigItem('routeros-dhcp', 'ConfigRouterOSDHCP');
    44     $this->System->ModuleManager->Modules['NetworkConfig']->RegisterConfigItem('routeros-signal', 'ConfigRouterOSSignal');
    45     $this->System->ModuleManager->Modules['NetworkConfig']->RegisterConfigItem('routeros-netwatch', 'ConfigRouterOSNetwatch');
    46     $this->System->ModuleManager->Modules['NetworkConfig']->RegisterConfigItem('routeros-netwatch-import', 'ConfigRouterOSNetwatchImport');
    47     $this->System->ModuleManager->Modules['NetworkConfig']->RegisterConfigItem('routeros-firewall-filter', 'ConfigRouterOSFirewallFilter');
    48     $this->System->ModuleManager->Modules['NetworkConfig']->RegisterConfigItem('routeros-firewall-nat', 'ConfigRouterOSFirewallNAT');
    49     $this->System->ModuleManager->Modules['NetworkConfig']->RegisterConfigItem('routeros-firewall-mangle', 'ConfigRouterOSFirewallMangle');
    50     $this->System->ModuleManager->Modules['NetworkConfig']->RegisterConfigItem('routeros-queue', 'ConfigRouterOSQueue');
     42    ModuleNetworkConfig::Cast($this->System->GetModule('NetworkConfig'))->RegisterConfigItem('routeros-dns', 'ConfigRouterOSDNS');
     43    ModuleNetworkConfig::Cast($this->System->GetModule('NetworkConfig'))->RegisterConfigItem('routeros-dhcp', 'ConfigRouterOSDHCP');
     44    ModuleNetworkConfig::Cast($this->System->GetModule('NetworkConfig'))->RegisterConfigItem('routeros-signal', 'ConfigRouterOSSignal');
     45    ModuleNetworkConfig::Cast($this->System->GetModule('NetworkConfig'))->RegisterConfigItem('routeros-netwatch', 'ConfigRouterOSNetwatch');
     46    ModuleNetworkConfig::Cast($this->System->GetModule('NetworkConfig'))->RegisterConfigItem('routeros-netwatch-import', 'ConfigRouterOSNetwatchImport');
     47    ModuleNetworkConfig::Cast($this->System->GetModule('NetworkConfig'))->RegisterConfigItem('routeros-firewall-filter', 'ConfigRouterOSFirewallFilter');
     48    ModuleNetworkConfig::Cast($this->System->GetModule('NetworkConfig'))->RegisterConfigItem('routeros-firewall-nat', 'ConfigRouterOSFirewallNAT');
     49    ModuleNetworkConfig::Cast($this->System->GetModule('NetworkConfig'))->RegisterConfigItem('routeros-firewall-mangle', 'ConfigRouterOSFirewallMangle');
     50    ModuleNetworkConfig::Cast($this->System->GetModule('NetworkConfig'))->RegisterConfigItem('routeros-queue', 'ConfigRouterOSQueue');
    5151  }
    5252}
     
    5454class PageFreeAccess extends Page
    5555{
    56   var $FullTitle = 'Přístup zdarma k Internetu';
    57   var $ShortTitle = 'Internet zdarma';
    58   var $ParentClass = 'PagePortal';
    59   var $AddressList = 'free-access';
    60   var $Timeout;
     56  public string $AddressList = 'free-access';
     57  public int $Timeout;
    6158
    62   function __construct($System)
     59  function __construct(System $System)
    6360  {
    6461    parent::__construct($System);
     62    $this->FullTitle = 'Přístup zdarma k Internetu';
     63    $this->ShortTitle = 'Internet zdarma';
     64    $this->ParentClass = 'PagePortal';
     65
    6566    $this->Timeout = 24 * 60 * 60;
    6667  }
    6768
    68   function Show()
     69  function Show(): string
    6970  {
    7071    $IPAddress = GetRemoteAddress();
    7172    $Output = 'Vaše IP adresa je: '.$IPAddress.'<br/>';
    72     if (IsInternetAddr($IPAddress)) {
     73    if (IsInternetAddr($IPAddress))
     74    {
    7375      $Output .= '<p>Internet zdarma je dostupný pouze z vnitřní sítě.</p>';
    7476      return $Output;
     
    117119class ScheduleConfigureFreeAccess extends SchedulerTask
    118120{
    119   function Execute()
     121  function Execute(): string
    120122  {
    121123    $Output = '';
Note: See TracChangeset for help on using the changeset viewer.