summaryrefslogtreecommitdiff
path: root/program/lib/Roundcube/rcube_contacts.php
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-01-07 14:21:25 +0100
committerAleksander Machniak <alec@alec.pl>2013-01-07 14:21:25 +0100
commit83f7077ec930952cdc9cfc8982b80cd4dad06b5f (patch)
tree8bd24c93de5d1dbc8d356aa29aea0c73cd518619 /program/lib/Roundcube/rcube_contacts.php
parenta5b8ef99d4e26bdb00e9b74221f107767a084a6e (diff)
Fix searching by date in address book (#1488888)
Diffstat (limited to 'program/lib/Roundcube/rcube_contacts.php')
-rw-r--r--program/lib/Roundcube/rcube_contacts.php25
1 files changed, 5 insertions, 20 deletions
diff --git a/program/lib/Roundcube/rcube_contacts.php b/program/lib/Roundcube/rcube_contacts.php
index a98b13865..062bd1e19 100644
--- a/program/lib/Roundcube/rcube_contacts.php
+++ b/program/lib/Roundcube/rcube_contacts.php
@@ -45,6 +45,7 @@ class rcube_contacts extends rcube_addressbook
private $fulltext_cols = array('name', 'firstname', 'surname', 'middlename', 'nickname',
'jobtitle', 'organization', 'department', 'maidenname', 'email', 'phone',
'address', 'street', 'locality', 'zipcode', 'region', 'country', 'website', 'im', 'notes');
+ protected $date_types = array('birthday', 'anniversary');
// public properties
public $primary_key = 'contact_id';
@@ -401,32 +402,16 @@ class rcube_contacts extends rcube_addressbook
for ($i=0; $i<$pages; $i++) {
$this->list_records(null, $i, true);
while ($row = $this->result->next()) {
- $id = $row[$this->primary_key];
+ $id = $row[$this->primary_key];
$found = array();
foreach (preg_grep($regexp, array_keys($row)) as $col) {
$pos = strpos($col, ':');
$colname = $pos ? substr($col, 0, $pos) : $col;
$search = $post_search[$colname];
foreach ((array)$row[$col] as $value) {
- // composite field, e.g. address
- foreach ((array)$value as $val) {
- $val = mb_strtolower($val);
- switch ($mode) {
- case 1:
- $got = ($val == $search);
- break;
- case 2:
- $got = ($search == substr($val, 0, strlen($search)));
- break;
- default:
- $got = (strpos($val, $search) !== false);
- break;
- }
-
- if ($got) {
- $found[$colname] = true;
- break 2;
- }
+ if ($this->compare_search_value($colname, $value, $search, $mode)) {
+ $found[$colname] = true;
+ break 2;
}
}
}