Changeset 126 for system


Ignore:
Timestamp:
Dec 11, 2008, 9:19:49 AM (16 years ago)
Author:
george
Message:
  • Přidáno: Filtrování seznamů podle zadaných podmínek.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • system/generators/routerboard.php

    r125 r126  
    4141  }
    4242
    43   function GetList($Command, $Properties)
     43  function GetList($Command, $Properties, $Conditions = '')
    4444  {
    4545    $PropertyList = '"';
     
    4949    }
    5050    $PropertyList = substr($PropertyList, 0, -3);
    51     $Result = $this->Execute($Command.' {:foreach i in=[find] do={:put ('.$PropertyList.')}}');
     51    if(is_array($Conditions))
     52    {
     53      $ConditionList = '';
     54      foreach($Conditions as $Name => $Value)
     55        $ConditionList .= $Name.'='.$Value.' ';
     56    } else $ConditionList = $Conditions;
     57    $Result = $this->Execute($Command.' {:foreach i in=[find '.$ConditionList.'] do={:put ('.$PropertyList.')}}');
    5258    $List = array();
    5359    foreach($Result as $ResultLine)
     
    7076  }
    7177
    72   function GetFirewallFilterList()
     78  function GetFirewallFilterList($Conditions = '')
    7379  {
    74     return($this->GetList('/ip firewall filter', array('src-address', 'dst-address', 'bytes')));
     80    return($this->GetList('/ip firewall nat', array('src-address', 'dst-address', 'bytes'), $Conditions));
    7581  }
    7682
    77   function GetDHCPServerLeasesList()
     83  function GetDHCPServerLeasesList($Conditions = '')
    7884  {
    79     return($this->GetList('/ip dhcp-server lease', array('address', 'active-address', 'comment', 'lease-time', 'status', 'host-name')));
     85    return($this->GetList('/ip dhcp-server lease', array('address', 'active-address', 'comment', 'lease-time', 'status', 'host-name'), $Conditions));
    8086  }
    8187}
Note: See TracChangeset for help on using the changeset viewer.