Changeset 873 for trunk/Modules/Network
- Timestamp:
- Apr 6, 2020, 11:17:40 PM (5 years ago)
- Location:
- trunk/Modules/Network
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Network/HostList.php
r833 r873 11 11 function Show() 12 12 { 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í'); 15 15 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) '; 17 17 else $Where = ''; 18 18 $Output = '<div align="center" style="font-size: small;"><table class="WideTable">'; … … 22 22 'LEFT JOIN User ON Member.ResponsibleUser = User.Id '. 23 23 '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()) 25 25 { 26 if ($Device['Online'] == 1) $Style = 'color: blue;'; else $Style = '';26 if ($Device['Online'] == 1) $Style = 'color: blue;'; else $Style = ''; 27 27 $DbResult2 = $this->Database->query('SELECT COUNT(*) FROM NetworkInterface WHERE Device = '.$Device['Id']); 28 28 $DbRow = $DbResult2->fetch_row(); 29 if ($DbRow[0] == 1)29 if ($DbRow[0] == 1) 30 30 { 31 31 $DbResult2 = $this->Database->query('SELECT * FROM NetworkInterface WHERE Device = '.$Device['Id']); 32 32 $Interface = $DbResult2->fetch_assoc(); 33 if ($Interface['ExternalIP'] == '') $Interface['ExternalIP'] = ' ';34 if ($Interface['LocalIP'] == '') $Interface['LocalIP'] = ' ';35 if ($Interface['Online'] == 1) $Style = 'font-weight: bold; color: blue;'; else $Style = '';33 if ($Interface['ExternalIP'] == '') $Interface['ExternalIP'] = ' '; 34 if ($Interface['LocalIP'] == '') $Interface['LocalIP'] = ' '; 35 if ($Interface['Online'] == 1) $Style = 'font-weight: bold; color: blue;'; else $Style = ''; 36 36 $InterfaceName = $Device['Name']; 37 if ($Interface['Name'] != '') $InterfaceName .= '-'.$Interface['Name'];37 if ($Interface['Name'] != '') $InterfaceName .= '-'.$Interface['Name']; 38 38 $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>'; 39 39 } else … … 41 41 $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>'; 42 42 $DbResult2 = $this->Database->query('SELECT * FROM NetworkInterface WHERE Device = '.$Device['Id']); 43 while ($Interface = $DbResult2->fetch_assoc())43 while ($Interface = $DbResult2->fetch_assoc()) 44 44 { 45 if ($Interface['LocalIP'] == '') $Interface['LocalIP'] = ' ';46 if ($Interface['Online'] == 1) $Style = 'font-weight: bold; color: blue;'; else $Style = '';45 if ($Interface['LocalIP'] == '') $Interface['LocalIP'] = ' '; 46 if ($Interface['Online'] == 1) $Style = 'font-weight: bold; color: blue;'; else $Style = ''; 47 47 $InterfaceName = $Device['Name']; 48 if ($Interface['Name'] != '') $InterfaceName .= '-'.$Interface['Name'];48 if ($Interface['Name'] != '') $InterfaceName .= '-'.$Interface['Name']; 49 49 $Output .= '<tr><td style="text-align: left; '.$Style.'"> '.$InterfaceName.'</td><td>'.$Interface['LocalIP'].'</td><td> </td><td> </td><td> </td><td> </td></tr>'; 50 50 } … … 52 52 } 53 53 $Output .= '</table></div>'; 54 return ($Output);54 return ($Output); 55 55 } 56 56 } -
trunk/Modules/Network/Hosting.php
r790 r873 11 11 $Output = '<br /><table class="WideTable"><tr><th>Název projektu</th><th>Založeno</th><th>Umístění na serveru</th><th>Zodpovědná osoba</th></tr>'; 12 12 $DbResult = $this->Database->query('SELECT NetworkDevice.Name as ServerName, HostedProject.Name, HostedProject.Homepage, HostedProject.TimeCreate, User.Name AS UserName FROM HostedProject JOIN User ON User.Id = HostedProject.User JOIN NetworkDevice ON NetworkDevice.Id = HostedProject.Server ORDER BY HostedProject.Name'); 13 while ($DbRow = $DbResult->fetch_assoc())13 while ($DbRow = $DbResult->fetch_assoc()) 14 14 { 15 15 $Output .= '<tr><td><a href="'.$DbRow['Homepage'].'">'.$DbRow['Name'].'</a></td><td>'.HumanDate($DbRow['TimeCreate']).'</td><td>'.$DbRow['ServerName'].'</td><td>'.$DbRow['UserName'].'</td></tr>'; 16 16 } 17 17 $Output .= '</table>'; 18 return ($Output);18 return ($Output); 19 19 } 20 20 } -
trunk/Modules/Network/Network.php
r871 r873 25 25 '<tr><th/><br/>SSID<br/><br/></th>'; 26 26 $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') 29 29 { 30 30 $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; 32 32 } 33 if ($_GET['range'] == 'bc')33 if ($_GET['range'] == 'bc') 34 34 { 35 35 $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; 37 37 } 38 if ($_GET['range'] == 'd')38 if ($_GET['range'] == 'd') 39 39 { 40 40 $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; 42 42 } 43 43 44 foreach ($ChannelList as $Frequency)44 foreach ($ChannelList as $Frequency) 45 45 { 46 46 $Output .= '<th><div class="RotatedHeader">'.$Frequency.'<div></th>'; … … 48 48 $Output .= '</tr>'; 49 49 $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()) 51 51 { 52 52 $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()) 54 54 { 55 55 $LowFrequency = $DbRow['Frequency'] - $DbRow2['ChannelWidth'] / 2 - $DbRow2['ChannelWidthLower']; 56 56 $HighFrequency = $DbRow['Frequency'] + $DbRow2['ChannelWidth'] / 2 + $DbRow2['ChannelWidthUpper']; 57 57 $Output .= '<tr><td>'.$DbRow2['SSID'].'</td>'; 58 foreach ($ChannelList as $Frequency)58 foreach ($ChannelList as $Frequency) 59 59 { 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'; 63 63 else $Color = '#ffffff'; 64 64 $Output .= '<td style="background-color: '.$Color.';"> </td>'; … … 69 69 } 70 70 $Output .= '</table>'; 71 return ($Output);71 return ($Output); 72 72 } 73 73 } … … 81 81 function Show() 82 82 { 83 if (count($this->System->PathItems) > 1)83 if (count($this->System->PathItems) > 1) 84 84 { 85 85 $Output = $this->PageNotFound(); 86 86 } else $Output = $this->ShowInformation(); 87 return ($Output);87 return ($Output); 88 88 } 89 89 90 90 function ShowInformation() 91 91 { 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í'); 94 94 95 95 $Output = '<a href="'.$this->System->Link('/network/frequency-plan/').'">Frekvenční plán</a><br />'; 96 96 $Output .= '<a href="'.$this->System->Link('/network/subnet/').'">Výpis registrovaných podsítí</a><br />'; 97 97 $Output .= '<a href="'.$this->System->Link('/network/hosts/').'">Registrované zařízení</a><br />'; 98 return ($Output);98 return ($Output); 99 99 } 100 100 } … … 862 862 '(`NetworkInterface`.`LocalIP` != "") AND (`NetworkInterface`.`Enabled`=1)'. 863 863 'ORDER BY `Name` ASC'); 864 if ($DbResult3->num_rows > 0)864 if ($DbResult3->num_rows > 0) 865 865 { 866 866 $Output .= $Title.'<br/>'; 867 867 $Output .= '<table>'. 868 868 '<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()) 870 870 { 871 871 $Duration = $Time - MysqlDateTimeToTime($Item['LastOnline']); … … 874 874 sprintf('%02d', floor($Duration % 60)); 875 875 $Days = floor($Duration / (60 * 60 * 24)); 876 if ($Days > 0) $DurationText = $Days.' dnů '.$DurationText;876 if ($Days > 0) $DurationText = $Days.' dnů '.$DurationText; 877 877 878 878 $Output .= '<tr><td>'.$Item['Name'].'</td><td>'.$OnlineText[$Item['Online']]. … … 895 895 $Output .= $StillOffline['Report']; 896 896 $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')); 898 898 } 899 899 … … 918 918 $Output .= '<table>'. 919 919 '<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()) 921 921 { 922 922 $Duration = $Time - MysqlDateTimeToTime($Item['LastOnline']); … … 925 925 sprintf('%02d', floor($Duration % 60)); 926 926 $Days = floor($Duration / (60 * 60 * 24)); 927 if ($Days > 0) $DurationText = $Days.' dnů '.$DurationText;927 if ($Days > 0) $DurationText = $Days.' dnů '.$DurationText; 928 928 929 929 $Output .= '<tr><td>'.$Item['Name'].'</td><td>'.$OnlineText[$Item['Online']]. … … 947 947 $Output .= $StillOffline['Report']; 948 948 $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')); 950 950 } 951 951 } -
trunk/Modules/Network/Subnet.php
r825 r873 36 36 37 37 $DbResult = $this->Database->query($Query); 38 while ($Subnet = $DbResult->fetch_assoc())38 while ($Subnet = $DbResult->fetch_assoc()) 39 39 { 40 40 $DbResult2 = $this->Database->query('SELECT COUNT(*) FROM NetworkInterface WHERE CompareNetworkPrefix(INET_ATON("'.$Subnet['AddressRange'].'"), INET_ATON(LocalIP), '.$Subnet['Mask'].')'); … … 54 54 $Output .= '</table>'; 55 55 $Output .= $PageList['Output']; 56 return ($Output);56 return ($Output); 57 57 } 58 58 } -
trunk/Modules/Network/UserHosts.php
r738 r873 15 15 global $Config; 16 16 17 if ($this->System->User->User['Id'] == '') return($this->SystemMessage('Nepovolený přístup', 'Nemáte oprávnění pro tuto operaci'));17 if ($this->System->User->User['Id'] == '') return ($this->SystemMessage('Nepovolený přístup', 'Nemáte oprávnění pro tuto operaci')); 18 18 $Output = '<div align="center" style="font-size: small;"><table class="WideTable">'; 19 19 $Output .= '<tr><th>Jméno počítače</th><th>Místní adresa</th><th>Veřejná adresa</th><th>Fyzická adresa</th><th>Typ</th><th>Naposledy online</th></tr>'; … … 21 21 'LEFT JOIN NetworkDeviceType ON NetworkDeviceType.Id = NetworkDevice.Type '. 22 22 'WHERE NetworkDevice.Used = 1 AND NetworkDevice.Member = (SELECT Customer FROM UserCustomerRel WHERE User='.$this->System->User->User['Id'].') ORDER BY NetworkDevice.Name'); 23 while ($Device = $DbResult->fetch_assoc())23 while ($Device = $DbResult->fetch_assoc()) 24 24 { 25 if ($Device['Online'] == 1) $Style = 'color: blue;'; else $Style = '';25 if ($Device['Online'] == 1) $Style = 'color: blue;'; else $Style = ''; 26 26 $Output .= '<tr><td colspan="4" style="text-align: left; font-weight: bold; '. 27 27 $Style.'">'.$Device['Name'].'</td><td>'.$Device['HostType'].'</td><td style="text-align: right;">'.HumanDate($Device['LastOnline']).'</td></tr>'; 28 28 $DbResult2 = $this->Database->query('SELECT * FROM NetworkInterface WHERE Device = '.$Device['Id']); 29 while ($Interface = $DbResult2->fetch_assoc())29 while ($Interface = $DbResult2->fetch_assoc()) 30 30 { 31 if ($Interface['Online'] == 1) $Style = 'font-weight: bold; color: blue;'; else $Style = '';31 if ($Interface['Online'] == 1) $Style = 'font-weight: bold; color: blue;'; else $Style = ''; 32 32 $InterfaceName = $Device['Name']; 33 if ($Interface['Name'] != '') $InterfaceName .= '-'.$Interface['Name'];33 if ($Interface['Name'] != '') $InterfaceName .= '-'.$Interface['Name']; 34 34 $Output .= '<tr><td style="text-align: left; '.$Style.'"> '. 35 35 $InterfaceName.'</td><td>'.NotBlank($Interface['LocalIP']).'</td><td>'. … … 39 39 } 40 40 $Output .= '</table></div>'; 41 return ($Output);41 return ($Output); 42 42 } 43 43 }
Note:
See TracChangeset
for help on using the changeset viewer.