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/Network/HostList.php

    r833 r873  
    1111  function Show()
    1212  {
    13     if(!$this->System->User->CheckPermission('Network', 'ShowHostList'))
    14       return('Nemáte oprávnění');
     13    if (!$this->System->User->CheckPermission('Network', 'ShowHostList'))
     14      return ('Nemáte oprávnění');
    1515
    16     if(array_key_exists('admin', $_GET)) $Where = 'AND NetworkDevice.Type IN (1,4,5) ';
     16    if (array_key_exists('admin', $_GET)) $Where = 'AND NetworkDevice.Type IN (1,4,5) ';
    1717      else $Where = '';
    1818    $Output = '<div align="center" style="font-size: small;"><table class="WideTable">';
     
    2222      'LEFT JOIN User ON Member.ResponsibleUser = User.Id '.
    2323      'LEFT JOIN NetworkDeviceType ON NetworkDeviceType.Id = NetworkDevice.Type WHERE NetworkDevice.Used = 1 '.$Where.'ORDER BY NetworkDevice.Name');
    24     while($Device = $DbResult->fetch_assoc())
     24    while ($Device = $DbResult->fetch_assoc())
    2525    {
    26       if($Device['Online'] == 1) $Style = 'color: blue;'; else $Style = '';
     26      if ($Device['Online'] == 1) $Style = 'color: blue;'; else $Style = '';
    2727      $DbResult2 = $this->Database->query('SELECT COUNT(*) FROM NetworkInterface WHERE Device = '.$Device['Id']);
    2828      $DbRow = $DbResult2->fetch_row();
    29       if($DbRow[0] == 1)
     29      if ($DbRow[0] == 1)
    3030      {
    3131        $DbResult2 = $this->Database->query('SELECT * FROM NetworkInterface WHERE Device = '.$Device['Id']);
    3232        $Interface = $DbResult2->fetch_assoc();
    33         if($Interface['ExternalIP'] == '') $Interface['ExternalIP'] = '&nbsp;';
    34         if($Interface['LocalIP'] == '') $Interface['LocalIP'] = '&nbsp;';
    35         if($Interface['Online'] == 1) $Style = 'font-weight: bold; color: blue;'; else $Style = '';
     33        if ($Interface['ExternalIP'] == '') $Interface['ExternalIP'] = '&nbsp;';
     34        if ($Interface['LocalIP'] == '') $Interface['LocalIP'] = '&nbsp;';
     35        if ($Interface['Online'] == 1) $Style = 'font-weight: bold; color: blue;'; else $Style = '';
    3636        $InterfaceName = $Device['Name'];
    37         if($Interface['Name'] != '') $InterfaceName .= '-'.$Interface['Name'];
     37        if ($Interface['Name'] != '') $InterfaceName .= '-'.$Interface['Name'];
    3838        $Output .= '<tr><td style="text-align: left; '.$Style.'">'.$InterfaceName.'</td><td>'.$Interface['LocalIP'].'</td><td>'.$Interface['ExternalIP'].'</td><td>'.$Device['HostType'].'</td><td style="text-align: right;">'.HumanDate($Device['LastOnline']).'</td><td style="text-align: right;">'.$Device['UserName'].'</td></tr>';
    3939      } else
     
    4141        $Output .= '<tr><td colspan="3" style="text-align: left; font-weight: bold; '.$Style.'">'.$Device['Name'].'</td><td>'.$Device['HostType'].'</td><td style="text-align: right;">'.HumanDate($Device['LastOnline']).'</td><td style="text-align: right;">'.$Device['UserName'].'</td></tr>';
    4242        $DbResult2 = $this->Database->query('SELECT * FROM NetworkInterface WHERE Device = '.$Device['Id']);
    43         while($Interface = $DbResult2->fetch_assoc())
     43        while ($Interface = $DbResult2->fetch_assoc())
    4444        {
    45           if($Interface['LocalIP'] == '') $Interface['LocalIP'] = '&nbsp;';
    46           if($Interface['Online'] == 1) $Style = 'font-weight: bold; color: blue;'; else $Style = '';
     45          if ($Interface['LocalIP'] == '') $Interface['LocalIP'] = '&nbsp;';
     46          if ($Interface['Online'] == 1) $Style = 'font-weight: bold; color: blue;'; else $Style = '';
    4747          $InterfaceName = $Device['Name'];
    48           if($Interface['Name'] != '') $InterfaceName .= '-'.$Interface['Name'];
     48          if ($Interface['Name'] != '') $InterfaceName .= '-'.$Interface['Name'];
    4949          $Output .= '<tr><td style="text-align: left; '.$Style.'">&nbsp;&nbsp;'.$InterfaceName.'</td><td>'.$Interface['LocalIP'].'</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>';
    5050        }
     
    5252    }
    5353    $Output .= '</table></div>';
    54     return($Output);
     54    return ($Output);
    5555  }
    5656}
Note: See TracChangeset for help on using the changeset viewer.