Fixed the last palces where ldap object must be passed
This commit is contained in:
parent
3c8a0485de
commit
6cc74873b2
@ -109,7 +109,9 @@ class Product {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function matches($terms) {
|
||||
// Ldap object must be passed to keep the arglist in sync
|
||||
// with User->matches()
|
||||
public function matches($terms, $ldap) {
|
||||
foreach($terms as $field => $values) {
|
||||
$matchvalues = array();
|
||||
if(property_exists($this, $field)) {
|
||||
|
@ -132,7 +132,7 @@ class SearchPage extends Page {
|
||||
$items = get_items($type);
|
||||
$out = array();
|
||||
foreach($items as $item) {
|
||||
if($item->matches($terms)) {
|
||||
if($item->matches($terms, $this->ldap)) {
|
||||
$out[] = $item;
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ class User {
|
||||
private $id = 0;
|
||||
private $name = '';
|
||||
private $notes = '';
|
||||
private $ldap = null;
|
||||
|
||||
public static function create_user($name) {
|
||||
$ins_user = prepare('insert into `user`(`name`) values (?)');
|
||||
@ -45,17 +44,17 @@ class User {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function matches($terms) {
|
||||
public function matches($terms, $ldap) {
|
||||
foreach($terms as $field => $values) {
|
||||
$matchvalues = array();
|
||||
if($field == 'name') {
|
||||
$matchvalues[] = $this->name;
|
||||
$matchvalues[] = $this->get_displayname();
|
||||
$matchvalues[] = $this->get_displayname($ldap);
|
||||
} else if(property_exists($this, $field)) {
|
||||
$matchvalues[] = $this->$field;
|
||||
} else if($field == 'fritext') {
|
||||
$matchvalues[] = $this->name;
|
||||
$matchvalues[] = $this->get_displayname();
|
||||
$matchvalues[] = $this->get_displayname($ldap);
|
||||
$matchvalues[] = $this->notes;
|
||||
} else {
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user