Merge branch 'test' into prod
This commit is contained in:
commit
b14603c7fb
@ -37,7 +37,7 @@ abstract class Page extends Responder {
|
||||
$this->render_foot();
|
||||
}
|
||||
|
||||
final private function render_head() {
|
||||
private function render_head() {
|
||||
$headtitle = $this->title;
|
||||
$pagetitle = $this->title;
|
||||
if($this->subtitle) {
|
||||
@ -78,13 +78,13 @@ abstract class Page extends Responder {
|
||||
return $menu;
|
||||
}
|
||||
|
||||
final private function render_error() {
|
||||
private function render_error() {
|
||||
print(replace(array('type' => 'error',
|
||||
'message' => $this->error),
|
||||
$this->fragments['message']));
|
||||
}
|
||||
|
||||
final private function render_foot() {
|
||||
private function render_foot() {
|
||||
print($this->template_parts['foot']);
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,7 @@ class Product extends Entity {
|
||||
// If $key is a standard field, check against its value
|
||||
$getter = $fields[$key];
|
||||
$value = $this->$getter();
|
||||
if(match($term, $value)) {
|
||||
if(match_term($term, $value)) {
|
||||
//Record a successful match
|
||||
$matches[$key] = $value;
|
||||
$matched = true;
|
||||
@ -170,7 +170,7 @@ class Product extends Entity {
|
||||
// First check basic fields
|
||||
foreach($fields as $field => $getter) {
|
||||
$value = $this->$getter();
|
||||
if(match($term, $value)) {
|
||||
if(match_term($term, $value)) {
|
||||
$matches[$field] = $value;
|
||||
$matched = true;
|
||||
}
|
||||
@ -189,7 +189,7 @@ class Product extends Entity {
|
||||
}
|
||||
// Then custom fields
|
||||
foreach($this->get_info() as $field => $value) {
|
||||
if(match($term, $value)) {
|
||||
if(match_term($term, $value)) {
|
||||
//Record a successful match
|
||||
$matches[$field] = $value;
|
||||
$matched = true;
|
||||
@ -202,7 +202,7 @@ class Product extends Entity {
|
||||
if(isset($info[$key])) {
|
||||
// If $key is a valid custom field on this product
|
||||
$value = $info[$key];
|
||||
if(match($term, $value)) {
|
||||
if(match_term($term, $value)) {
|
||||
//Record a successful match
|
||||
$matches[$key] = $value;
|
||||
$matched = true;
|
||||
@ -228,7 +228,7 @@ class Product extends Entity {
|
||||
$tags = $this->get_tags();
|
||||
$matches = array();
|
||||
foreach($tags as $tag) {
|
||||
if(match($term, $tag)) {
|
||||
if(match_term($term, $tag)) {
|
||||
$matches[] = $tag;
|
||||
}
|
||||
}
|
||||
|
@ -55,12 +55,12 @@ class User extends Entity {
|
||||
case 'name':
|
||||
// If the key is name, check username and displayname
|
||||
$name = $this->get_name();
|
||||
if(match($term, $name)) {
|
||||
if(match_term($term, $name)) {
|
||||
$matches['name'] = $name;
|
||||
$matched = true;
|
||||
}
|
||||
$dname = $this->get_displayname($ldap);
|
||||
if(match($term, $dname)) {
|
||||
if(match_term($term, $dname)) {
|
||||
$matches['displayname'] = $dname;
|
||||
$matched = true;
|
||||
}
|
||||
@ -68,14 +68,14 @@ class User extends Entity {
|
||||
case 'note':
|
||||
// If the key is note, check it.
|
||||
$note = $this->get_note();
|
||||
if($note && match($term, $note)) {
|
||||
if($note && match_term($term, $note)) {
|
||||
$matches['note'] = $note;
|
||||
$matched = true;
|
||||
}
|
||||
break;
|
||||
case 'email':
|
||||
$email = $this->get_email($ldap, false);
|
||||
if($email && match($term, $email)) {
|
||||
if($email && match_term($term, $email)) {
|
||||
$matches['email'] = $email;
|
||||
$matched = true;
|
||||
}
|
||||
@ -83,12 +83,12 @@ class User extends Entity {
|
||||
case 'fritext':
|
||||
//Check everything if the key is fritext
|
||||
$name = $this->get_name();
|
||||
if(match($term, $name)) {
|
||||
if(match_term($term, $name)) {
|
||||
$matches['name'] = $name;
|
||||
$matched = true;
|
||||
}
|
||||
$dname = $this->get_displayname($ldap);
|
||||
if(match($term, $dname)) {
|
||||
if(match_term($term, $dname)) {
|
||||
$matches['displayname'] = $dname;
|
||||
$matched = true;
|
||||
}
|
||||
|
@ -253,7 +253,7 @@ function suggest_content($fieldname) {
|
||||
return $out;
|
||||
}
|
||||
|
||||
function match($term, $subject) {
|
||||
function match_term($term, $subject) {
|
||||
if(fnmatch('*'.$term->get_query().'*', $subject, FNM_CASEFOLD)) {
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user