Changeset 214 for trunk/system


Ignore:
Timestamp:
May 11, 2009, 9:28:16 PM (16 years ago)
Author:
george
Message:
  • Opraveno: Nezobrazovat nepoužité počítač v seznamu uživatelů.
  • Opraveno: Aktualizovat online stav zařízení dle stavu rozhraní.
  • Opraveno: Nepoužívané zařízení nezařazovat do systému omezování rychlosti.
Location:
trunk/system
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/system/generators/traffic_shaping_routerboard.php

    r213 r214  
    7575  $Commands[] = ' /queue tree add name='.$Member['Name'].'-in limit-at='.$SpeedOut.' max-limit='.$UserMaxSpeedOut.' parent=main-in queue=wireless-default';
    7676
    77   $DbResult2 = $Database->select('NetworkDevice', 'COUNT(*)', 'Member='.$Member['Id']);
     77  $DbResult2 = $Database->select('NetworkDevice', 'COUNT(*)', 'Used = 1 AND Member='.$Member['Id']);
    7878  $Row = $DbResult2->fetch_row();
    7979  $HostCount = $Row[0];
     
    8888  }
    8989
    90   $DbResult2 = $Database->select('NetworkDevice', '*', 'Member = '.$Member['Id']);
     90  $DbResult2 = $Database->select('NetworkDevice', '*', 'Used = 1 AND Member = '.$Member['Id']);
    9191  while($Device = $DbResult2->fetch_assoc())
    9292  {
  • trunk/system/netwatch_import.php

    r213 r214  
    3434    {
    3535      $Online = 1;
    36       $Values = array('Online' => $Online,  'LastOnline' => 'NOW()');
     36      $Values = array('Online' => $Online, 'LastOnline' => 'NOW()');
    3737    } else
    3838    {
     
    4545    {
    4646      $DbResult = $Database->select('NetworkInterface', 'Id', 'LocalIP = "'.$Properties['host'].'"');
    47       $DbRow = $DbResult->fetch_array();
     47      $DbRow = $DbResult->fetch_assoc();
    4848      $HostId = $DbRow['Id'];
    4949      $DbResult2 = $Database->select('stat_hosts', '*', '(host_id="'.$HostId.'") AND (time = DATE_FORMAT(NOW(), "%Y-%m-%d %H:00:00"))');
     
    5454}
    5555
     56// Update device online state
     57$DbResult = $Database->select('NetworkDevice', 'Id', 'Used=1');
     58while($Device = $DbResult->fetch_assoc())
     59{
     60  $DbResult2 = $Database->select('NetworkInterface', 'SUM(Online)', 'Device='.$Device['Id']);
     61  $DbRow = $DbResult2->fetch_array();
     62  if($DbRow['SUM(Online)'] > 0) $Online = 1; else $Online = 0; 
     63  $Database->update('NetworkDevice', 'Id='.$Device['Id'], array('Online' => $Online));
     64}
     65
    5666?>
Note: See TracChangeset for help on using the changeset viewer.