fixed list filtering
This commit is contained in:
parent
29c3f6582c
commit
b7396de612
|
@ -735,7 +735,7 @@ By default, the nodes are configured as H-Nodes which fits for small networks. I
|
||||||
*/
|
*/
|
||||||
private function getDefaultLeaseTime() {
|
private function getDefaultLeaseTime() {
|
||||||
$return = null;
|
$return = null;
|
||||||
if (is_array($this->attributes['dhcpStatements'])) {
|
if (!empty($this->attributes['dhcpStatements'])) {
|
||||||
for ($i = 0; $i < sizeof($this->attributes['dhcpStatements']); $i++) {
|
for ($i = 0; $i < sizeof($this->attributes['dhcpStatements']); $i++) {
|
||||||
if (substr($this->attributes['dhcpStatements'][$i], 0, 19) == 'default-lease-time ') {
|
if (substr($this->attributes['dhcpStatements'][$i], 0, 19) == 'default-lease-time ') {
|
||||||
$return = substr($this->attributes['dhcpStatements'][$i],19);
|
$return = substr($this->attributes['dhcpStatements'][$i],19);
|
||||||
|
@ -773,7 +773,7 @@ By default, the nodes are configured as H-Nodes which fits for small networks. I
|
||||||
*/
|
*/
|
||||||
private function getUnknownClients() {
|
private function getUnknownClients() {
|
||||||
$return = null;
|
$return = null;
|
||||||
if (is_array($this->attributes['dhcpStatements'])) {
|
if (!empty($this->attributes['dhcpStatements'])) {
|
||||||
for ($i = 0; $i < sizeof($this->attributes['dhcpStatements']); $i++) {
|
for ($i = 0; $i < sizeof($this->attributes['dhcpStatements']); $i++) {
|
||||||
$val = $this->attributes['dhcpStatements'][$i];
|
$val = $this->attributes['dhcpStatements'][$i];
|
||||||
if (strpos($val, 'unknown-clients') === (strlen($val) - strlen('unknown-clients'))) {
|
if (strpos($val, 'unknown-clients') === (strlen($val) - strlen('unknown-clients'))) {
|
||||||
|
@ -791,7 +791,7 @@ By default, the nodes are configured as H-Nodes which fits for small networks. I
|
||||||
* @param String $option allow/deny
|
* @param String $option allow/deny
|
||||||
*/
|
*/
|
||||||
private function setUnknownClients($option) {
|
private function setUnknownClients($option) {
|
||||||
if (!is_array($this->attributes['dhcpStatements'])) {
|
if (!isset($this->attributes['dhcpStatements'])) {
|
||||||
$this->attributes['dhcpStatements'] = array();
|
$this->attributes['dhcpStatements'] = array();
|
||||||
}
|
}
|
||||||
for ($i = 0; $i < sizeof($this->attributes['dhcpStatements']); $i++) {
|
for ($i = 0; $i < sizeof($this->attributes['dhcpStatements']); $i++) {
|
||||||
|
@ -813,7 +813,7 @@ By default, the nodes are configured as H-Nodes which fits for small networks. I
|
||||||
*/
|
*/
|
||||||
private function getMaxLeaseTime() {
|
private function getMaxLeaseTime() {
|
||||||
$return = null;
|
$return = null;
|
||||||
if (is_array($this->attributes['dhcpStatements'])) {
|
if (!empty($this->attributes['dhcpStatements'])) {
|
||||||
for ($i = 0; $i < sizeof($this->attributes['dhcpStatements']); $i++) {
|
for ($i = 0; $i < sizeof($this->attributes['dhcpStatements']); $i++) {
|
||||||
if (substr($this->attributes['dhcpStatements'][$i], 0, 15) == 'max-lease-time ') {
|
if (substr($this->attributes['dhcpStatements'][$i], 0, 15) == 'max-lease-time ') {
|
||||||
$return = substr($this->attributes['dhcpStatements'][$i],15);
|
$return = substr($this->attributes['dhcpStatements'][$i],15);
|
||||||
|
|
|
@ -182,7 +182,7 @@ class lamDHCPList extends lamList {
|
||||||
* @see lamList::isFilterMatching()
|
* @see lamList::isFilterMatching()
|
||||||
*/
|
*/
|
||||||
protected function isFilterMatching(&$data, $filterAttribute, $regex) {
|
protected function isFilterMatching(&$data, $filterAttribute, $regex) {
|
||||||
if ($filterAttribute == "fixed_ips") {
|
if ($filterAttribute === "fixed_ips") {
|
||||||
if (empty($regex)) {
|
if (empty($regex)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -211,6 +211,26 @@ class lamDHCPList extends lamList {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
elseif ($filterAttribute === "dhcprange") {
|
||||||
|
if (isset($entry['dhcprange'])) {
|
||||||
|
foreach ($entry['dhcprange'] as $range) {
|
||||||
|
if (preg_match($regex, $range)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$pooledRanges = searchLDAP($data['dn'], '(objectclass=dhcpPool)', array('dhcprange'));
|
||||||
|
foreach ($pooledRanges as $pooledRange) {
|
||||||
|
if (empty($pooledRange['dhcprange'])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
foreach ($pooledRange['dhcprange'] as $range) {
|
||||||
|
if (preg_match($regex, $range)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return parent::isFilterMatching($data, $filterAttribute, $regex);
|
return parent::isFilterMatching($data, $filterAttribute, $regex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue