Ignore:
Timestamp:
Apr 6, 2020, 11:17:40 PM (5 years ago)
Author:
chronos
Message:
  • Modified: Improved code format.
File:
1 edited

Legend:

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

    r860 r873  
    7070    $IPAddress = GetRemoteAddress();
    7171    $Output = 'Vaše IP adresa je: '.$IPAddress.'<br/>';
    72     if(IsInternetAddr($IPAddress)) {
     72    if (IsInternetAddr($IPAddress)) {
    7373      $Output .= '<p>Internet zdarma je dostupný pouze z vnitřní sítě.</p>';
    74       return($Output);
     74      return ($Output);
    7575    }
    7676    $Time = time();
     
    7878    $DbResult = $this->Database->select('NetworkFreeAccess', '*', '(IPAddress="'.$IPAddress.
    7979      '") ORDER BY Time DESC LIMIT 1');
    80     if($DbResult->num_rows > 0)
     80    if ($DbResult->num_rows > 0)
    8181    {
    8282      $DbRow = $DbResult->fetch_assoc();
    8383      $ActivationTime = MysqlDateTimeToTime($DbRow['Time']);
    84       if(($ActivationTime + $this->Timeout) < $Time)
     84      if (($ActivationTime + $this->Timeout) < $Time)
    8585      {
    8686        $Activated = false;
     
    8888    } else $Activated = false;
    8989
    90     if(array_key_exists('a', $_GET))
     90    if (array_key_exists('a', $_GET))
    9191    {
    92       if($_GET['a'] == 'activate')
     92      if ($_GET['a'] == 'activate')
    9393      {
    94         if($Activated == false)
     94        if ($Activated == false)
    9595        {
    9696          $DbResult = $this->Database->insert('NetworkFreeAccess',
     
    108108
    109109    $PrefixMultiplier = new PrefixMultiplier();
    110     if($Activated) $Output .= 'Aktivováno. Vyprší za '.$PrefixMultiplier->Add($ActivationTime + $this->Timeout - $Time, '', 4, 'Time');
     110    if ($Activated) $Output .= 'Aktivováno. Vyprší za '.$PrefixMultiplier->Add($ActivationTime + $this->Timeout - $Time, '', 4, 'Time');
    111111      else $Output .= '<a href="?a=activate">Aktivovat</a>';
    112112
    113     return($Output);
     113    return ($Output);
    114114  }
    115115}
     
    122122    $Commands = array();
    123123    $DbResult = $this->Database->select('NetworkFreeAccess', '`Id`, `IPAddress`', '(`Configured`=0)');
    124     while($DbRow = $DbResult->fetch_assoc())
     124    while ($DbRow = $DbResult->fetch_assoc())
    125125    {
    126126      $Commands[] = '/ip firewall address-list add address='.$DbRow['IPAddress'].
     
    135135    $Routerboard->ExecuteBatch(implode(';', $Commands));
    136136
    137     return($Output);
     137    return ($Output);
    138138  }
    139139}
Note: See TracChangeset for help on using the changeset viewer.