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/Generators/Signal.php

    r851 r873  
    1212        '(SELECT `LocalIP` FROM `NetworkInterface` WHERE `NetworkInterface`.`Device` = `NetworkDevice`.`Id` LIMIT 1) AS `LocalIP` '.
    1313        'FROM `NetworkDevice` WHERE (`API` = 1) AND (`Used` = 1)');
    14     while($Device = $DbResult3->fetch_assoc())
     14    while ($Device = $DbResult3->fetch_assoc())
    1515    {
    1616      echo($Device['LocalIP']."\n");
     
    1919      //$Routerboard->Port = 8729;
    2020      $Routerboard->Connect($Device['LocalIP'], $this->System->Config['API']['UserName'], $this->System->Config['API']['Password']);
    21       if(!$Routerboard->Connected) continue;
     21      if (!$Routerboard->Connected) continue;
    2222      $Routerboard->Write('/interface/wireless/registration-table/getall', false);
    2323      $Routerboard->Write('=.proplist=signal-strength,mac-address,rx-rate,tx-rate', false);
     
    2525      $Read = $Routerboard->Read(false);
    2626      $Array = $Routerboard->ParseResponse($Read);
    27       foreach($Array as $Properties)
     27      foreach ($Array as $Properties)
    2828      {
    2929        $DbResult = $this->Database->select('NetworkInterface', 'Id', 'MAC="'.$Properties['mac-address'].'"');
    30         if($DbResult->num_rows > 0)
     30        if ($DbResult->num_rows > 0)
    3131        {
    3232          $DbRow = $DbResult->fetch_assoc();
     
    3434        } else $Interface = 'NULL';
    3535
    36         if(strpos($Properties['signal-strength'], '@') === false)
     36        if (strpos($Properties['signal-strength'], '@') === false)
    3737        {
    3838          $Strength = $Properties['signal-strength'];
    3939        } else {
    4040          $Parts = explode('@', $Properties['signal-strength']);
    41           if(substr($Parts[0], -3) == 'dBm')
     41          if (substr($Parts[0], -3) == 'dBm')
    4242            $Strength = substr($Parts[0], 0, -3); // without dBm
    4343            else $Strength = $Parts[0];
     
    5050        /*
    5151         $DbResult = $this->Database->select('Measure', 'Id', '`Name` = "'.$Properties['mac-address'].'"');
    52          if($DbResult->num_rows > 0)
     52         if ($DbResult->num_rows > 0)
    5353         {
    5454         $this->Database->insert('Measure', array('Name' => $Properties['mac-address']));
     
    7474    if (substr($Value, -3, 3) == "Mbp") $Value = substr($Value, 0, -3); // without Mbp unit   
    7575    if (substr($Value, -1, 1) == "M") $Value = substr($Value, 0, -1); // without M unit
    76     return($Value);
     76    return ($Value);
    7777  }
    7878
Note: See TracChangeset for help on using the changeset viewer.