[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] trackerlib: Make email filters match searches without punctuation
"Victor Emanouilov \(@kroky\) via TikiWiki-cvs" <[email protected]> Tue, 30 Jun 2026 07:55:19 +0000
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <6a43766745765_38163e96c43382@gitlab-sidekiq-low-urgency-cpu-bound-v2-656d6f88d7-stxjf.mail> |
Victor Emanouilov pushed to branch master at Tiki Wiki CMS Groupware / Tiki
Commits:
ef9664f1 by UshindiG at 2026-06-30T07:35:41+00:00
[FIX] trackerlib: Make email filters match searches without punctuation
---
* [FIX] trackerlib: Make email filters match searches without punctuation
See merge request tikiwiki/tiki!10503
- - - - -
2 changed files:
- lib/trackers/trackerlib.php
- tiki-view_tracker.php
Changes:
=====================================
lib/trackers/trackerlib.php
=====================================
@@ -1633,11 +1633,29 @@ class TrackerLib extends TikiLib
}
$mid .= " upper(ttif$i.`value`) like upper(?) ";
if (str_starts_with($v, '*') || str_starts_with($v, '%')) {
- $bindvars[] = '%' . substr($v, 1);
+ $likeValue = substr($v, 1);
+ $likePattern = '%' . $likeValue;
} elseif (str_ends_with($v, '*') || str_ends_with($v, '%')) {
- $bindvars[] = substr($v, 0, strlen($v) - 1) . '%';
+ $likeValue = substr($v, 0, strlen($v) - 1);
+ $likePattern = $likeValue . '%';
} else {
- $bindvars[] = '%' . $v . '%';
+ $likeValue = $v;
+ $likePattern = '%' . $likeValue . '%';
+ }
+ $bindvars[] = $likePattern;
+
+ if ($filter['type'] === 'm') {
+ $emailSeparators = ['@', '.', '-', '_', '+'];
+ $normalizedValue = str_replace($emailSeparators, '', $likeValue);
+ if ($normalizedValue !== '' && $normalizedValue === $likeValue && ctype_alnum($normalizedValue)) {
+ // SQL is static; user input is still passed through $bindvars.
+ $normalizedEmailSql = "ttif$i.`value`";
+ foreach ($emailSeparators as $emailSeparator) {
+ $normalizedEmailSql = "REPLACE($normalizedEmailSql, '$emailSeparator', '')";
+ }
+ $mid .= " OR upper($normalizedEmailSql) like upper(?) ";
+ $bindvars[] = str_replace($likeValue, $normalizedValue, $likePattern);
+ }
}
}
$mid .= ')';
=====================================
tiki-view_tracker.php
=====================================
@@ -29,14 +29,14 @@ $inputConfiguration = [
'offset' => 'int', //get
'maxRecords' => 'int', //get
'filterfield' => 'word', //get
- 'filtervalue_other' => 'word', //get
+ 'filtervalue_other' => 'text', //get
'displayedFields' => 'word', //get
],
'staticKeyFiltersForArrays' => [
'action' => 'string', //get
'vals' => 'none', //get
'sort_mode' => 'alnumdash', //get
- 'filtervalue' => 'word',
+ 'filtervalue' => 'text',
],
],
];
@@ -524,6 +524,13 @@ if (isset($_REQUEST["filtervalue"]) and is_array($_REQUEST["filtervalue"]) and i
if (! empty($_REQUEST['filtervalue_other'])) {
$filtervalue = $_REQUEST['filtervalue_other'];
}
+if (is_array($filtervalue)) {
+ $filtervalue = array_map(static function ($value) {
+ return is_string($value) ? trim($value) : $value;
+ }, $filtervalue);
+} elseif (is_string($filtervalue)) {
+ $filtervalue = trim($filtervalue);
+}
if (! empty($filterfield)) {
$field = $trackerDefinition->getField($filterfield);
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/ef9664f1f20bfd0d3ac9bba40ab9ea6389d0bc4c
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/ef9664f1f20bfd0d3ac9bba40ab9ea6389d0bc4c
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help
_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs