diff options
| author | 2025-10-16 21:23:32 +0200 | |
|---|---|---|
| committer | 2025-10-16 21:23:32 +0200 | |
| commit | 14fc3e9b6467254c59781c14cc533ddc804d9414 (patch) | |
| tree | 1f28369113a7e80e08f5a7f35c7888c37cc1d2a8 /app/Controllers/searchController.php | |
| parent | 50eeede063bb3d17f3129da1775df4dcf391a05f (diff) | |
Add to search UI the user modification date (#8122)
* Add to search UI the user modification date
Follow-up of:
* https://github.com/FreshRSS/FreshRSS/pull/8103
* https://github.com/FreshRSS/FreshRSS/pull/8093
* Easier UI to cancel filtering by date
* Add blank <option> to ease deselection of <select>
Diffstat (limited to 'app/Controllers/searchController.php')
| -rw-r--r-- | app/Controllers/searchController.php | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/app/Controllers/searchController.php b/app/Controllers/searchController.php index 19ec04606..616c4c878 100644 --- a/app/Controllers/searchController.php +++ b/app/Controllers/searchController.php @@ -149,6 +149,27 @@ class FreshRSS_search_Controller extends FreshRSS_ActionController { } } + // User modification date + $userDateFrom = trim(Minz_Request::paramString('userdate_from')); + $userDateTo = trim(Minz_Request::paramString('userdate_to')); + $userDateNumber = Minz_Request::paramInt('userdate_number'); + $userDateUnit = trim(Minz_Request::paramString('userdate_unit')); + + if ($userDateNumber > 0 && $userDateUnit !== '') { + // Convert to ISO 8601 duration format: P1D, P1W, P1M, PT1H, etc. + // Time units (H, M, S) require a T separator + $prefix = ($userDateUnit === 'H' || $userDateUnit === 'M' || $userDateUnit === 'S') ? 'PT' : 'P'; + $searchTerms[] = "userdate:{$prefix}{$userDateNumber}{$userDateUnit}"; + } elseif ($userDateFrom !== '' || $userDateTo !== '') { + if ($userDateFrom !== '' && $userDateTo !== '') { + $searchTerms[] = "userdate:$userDateFrom/$userDateTo"; + } elseif ($userDateFrom !== '') { + $searchTerms[] = "userdate:$userDateFrom/"; + } elseif ($userDateTo !== '') { + $searchTerms[] = "userdate:/$userDateTo"; + } + } + $feedIds = Minz_Request::paramArrayInt('feed_ids'); if (!empty($feedIds)) { $searchTerms[] = 'f:' . implode(',', $feedIds); |
