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

Legend:

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

    r871 r873  
    2525    '<tr><th/><br/>SSID<br/><br/></th>';
    2626    $ChannelList = array();
    27     if(!array_key_exists('range', $_GET)) $_GET['range'] = 'a';
    28     if($_GET['range'] == 'a')
     27    if (!array_key_exists('range', $_GET)) $_GET['range'] = 'a';
     28    if ($_GET['range'] == 'a')
    2929    {
    3030      $Where = '(Frequency < 5000)';
    31       for($Freq = 2402; $Freq <= 2482; $Freq = $Freq + 5) $ChannelList[] = $Freq;
     31      for ($Freq = 2402; $Freq <= 2482; $Freq = $Freq + 5) $ChannelList[] = $Freq;
    3232    }
    33     if($_GET['range'] == 'bc')
     33    if ($_GET['range'] == 'bc')
    3434    {
    3535      $Where = '(Frequency >= 5000) AND (Frequency <= 5350)';
    36       for($Freq = 5150; $Freq <= 5350; $Freq = $Freq + 5) $ChannelList[] = $Freq;
     36      for ($Freq = 5150; $Freq <= 5350; $Freq = $Freq + 5) $ChannelList[] = $Freq;
    3737    }
    38     if($_GET['range'] == 'd')
     38    if ($_GET['range'] == 'd')
    3939    {
    4040      $Where = '(Frequency >= 5470)';
    41       for($Freq = 5470; $Freq <= 5725; $Freq = $Freq + 5) $ChannelList[] = $Freq;
     41      for ($Freq = 5470; $Freq <= 5725; $Freq = $Freq + 5) $ChannelList[] = $Freq;
    4242    }
    4343
    44     foreach($ChannelList as $Frequency)
     44    foreach ($ChannelList as $Frequency)
    4545    {
    4646      $Output .= '<th><div class="RotatedHeader">'.$Frequency.'<div></th>';
     
    4848    $Output .= '</tr>';
    4949    $DbResult = $this->Database->query('SELECT `Frequency` FROM `NetworkInterfaceWireless` WHERE '.$Where.' AND (`Mode`=0) GROUP BY `Frequency`');
    50     while($DbRow = $DbResult->fetch_assoc())
     50    while ($DbRow = $DbResult->fetch_assoc())
    5151    {
    5252      $DbResult2 = $this->Database->query('SELECT * FROM `NetworkInterfaceWireless` WHERE (`Frequency`='.$DbRow['Frequency'].') AND '.$Where);
    53       while($DbRow2 = $DbResult2->fetch_assoc())
     53      while ($DbRow2 = $DbResult2->fetch_assoc())
    5454      {
    5555        $LowFrequency = $DbRow['Frequency'] - $DbRow2['ChannelWidth'] / 2 - $DbRow2['ChannelWidthLower'];
    5656        $HighFrequency = $DbRow['Frequency'] + $DbRow2['ChannelWidth'] / 2 + $DbRow2['ChannelWidthUpper'];
    5757        $Output .= '<tr><td>'.$DbRow2['SSID'].'</td>';
    58         foreach($ChannelList as $Frequency)
     58        foreach ($ChannelList as $Frequency)
    5959        {
    60           if(($DbRow2['Frequency'] == $Frequency)) $Color = '#000000';
    61             else if(($LowFrequency <= ($Frequency - 2.5)) and ($HighFrequency >= ($Frequency + 2.5))) $Color = '#808080';
    62             else if(($LowFrequency == $Frequency) or ($HighFrequency == $Frequency)) $Color = '#c0c0c0';
     60          if (($DbRow2['Frequency'] == $Frequency)) $Color = '#000000';
     61            else if (($LowFrequency <= ($Frequency - 2.5)) and ($HighFrequency >= ($Frequency + 2.5))) $Color = '#808080';
     62            else if (($LowFrequency == $Frequency) or ($HighFrequency == $Frequency)) $Color = '#c0c0c0';
    6363            else $Color = '#ffffff';
    6464          $Output .= '<td style="background-color: '.$Color.';">&nbsp;</td>';
     
    6969    }
    7070    $Output .= '</table>';
    71     return($Output);
     71    return ($Output);
    7272  }
    7373}
     
    8181  function Show()
    8282  {
    83     if(count($this->System->PathItems) > 1)
     83    if (count($this->System->PathItems) > 1)
    8484    {
    8585      $Output = $this->PageNotFound();
    8686    } else $Output = $this->ShowInformation();
    87     return($Output);
     87    return ($Output);
    8888  }
    8989
    9090  function ShowInformation()
    9191  {
    92     if(!$this->System->User->CheckPermission('Network', 'ShowInfo'))
    93       return('Nemáte oprávnění');
     92    if (!$this->System->User->CheckPermission('Network', 'ShowInfo'))
     93      return ('Nemáte oprávnění');
    9494
    9595    $Output = '<a href="'.$this->System->Link('/network/frequency-plan/').'">Frekvenční plán</a><br />';
    9696    $Output .= '<a href="'.$this->System->Link('/network/subnet/').'">Výpis registrovaných podsítí</a><br />';
    9797    $Output .= '<a href="'.$this->System->Link('/network/hosts/').'">Registrované zařízení</a><br />';
    98     return($Output);
     98    return ($Output);
    9999  }
    100100}
     
    862862      '(`NetworkInterface`.`LocalIP` != "") AND (`NetworkInterface`.`Enabled`=1)'.
    863863      'ORDER BY `Name` ASC');
    864     if($DbResult3->num_rows > 0)
     864    if ($DbResult3->num_rows > 0)
    865865    {
    866866      $Output .= $Title.'<br/>';
    867867      $Output .= '<table>'.
    868868        '<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";
    869       while($Item = $DbResult3->fetch_assoc())
     869      while ($Item = $DbResult3->fetch_assoc())
    870870      {
    871871        $Duration = $Time - MysqlDateTimeToTime($Item['LastOnline']);
     
    874874          sprintf('%02d', floor($Duration % 60));
    875875        $Days = floor($Duration / (60 * 60 * 24));
    876         if($Days > 0) $DurationText = $Days.' dnů '.$DurationText;
     876        if ($Days > 0) $DurationText = $Days.' dnů '.$DurationText;
    877877
    878878        $Output .= '<tr><td>'.$Item['Name'].'</td><td>'.$OnlineText[$Item['Online']].
     
    895895    $Output .= $StillOffline['Report'];
    896896    $Offline = $this->OnlineList('Offline', 0, -1, 0);
    897     return(array('Report' => $Output, 'Count' => $Offline['Count'], 'ShortTitle' => 'Odezva'));
     897    return (array('Report' => $Output, 'Count' => $Offline['Count'], 'ShortTitle' => 'Odezva'));
    898898  }
    899899
     
    918918      $Output .= '<table>'.
    919919        '<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";
    920       while($Item = $DbResult3->fetch_assoc())
     920      while ($Item = $DbResult3->fetch_assoc())
    921921      {
    922922        $Duration = $Time - MysqlDateTimeToTime($Item['LastOnline']);
     
    925925          sprintf('%02d', floor($Duration % 60));
    926926        $Days = floor($Duration / (60 * 60 * 24));
    927         if($Days > 0) $DurationText = $Days.' dnů '.$DurationText;
     927        if ($Days > 0) $DurationText = $Days.' dnů '.$DurationText;
    928928
    929929        $Output .= '<tr><td>'.$Item['Name'].'</td><td>'.$OnlineText[$Item['Online']].
     
    947947    $Output .= $StillOffline['Report'];
    948948    $Offline = $this->PortCheckList('Offline', 0, -1, 0);
    949     return(array('Report' => $Output, 'Count' => $Offline['Count'], 'ShortTitle' => 'Port'));
     949    return (array('Report' => $Output, 'Count' => $Offline['Count'], 'ShortTitle' => 'Port'));
    950950  }
    951951}
Note: See TracChangeset for help on using the changeset viewer.