diff options
| author | 2022-05-15 21:53:13 +0200 | |
|---|---|---|
| committer | 2022-05-15 21:53:13 +0200 | |
| commit | ffd1061850d73182d40126658a0e9dd7f28f646e (patch) | |
| tree | 03c81f09311f82441e427217316746a4963e4600 | |
| parent | 807ea755e0bddb814f5c55bdfa5321ce144fe816 (diff) | |
User query automatic reconstruct of URL (#4360)
* User query automatic reconstruct of URL
(Invisible through the Web UI, only when working with configuration files manually)
Avoid the requirement of storing user queries with duplicated information (parsed parameters AND the resulting URL):
Before:
```
[
'name' => 'Hello',
'search' => 'Hello OR World',
'state' => '3',
'url' => './?search=Hello+OR+World&state=3',
]
```
After:
```
[
'name' => 'Hello',
'search' => 'Hello OR World',
'state' => '3',
]
```
* Fix test
| -rw-r--r-- | app/Models/UserQuery.php | 11 | ||||
| -rw-r--r-- | app/layout/header.phtml | 2 |
2 files changed, 9 insertions, 4 deletions
diff --git a/app/Models/UserQuery.php b/app/Models/UserQuery.php index 7f8aa07ef..236813942 100644 --- a/app/Models/UserQuery.php +++ b/app/Models/UserQuery.php @@ -39,6 +39,14 @@ class FreshRSS_UserQuery { if (isset($query['order'])) { $this->order = $query['order']; } + if (empty($query['url'])) { + if (!empty($query)) { + unset($query['name']); + $this->url = Minz_Url::display(array('params' => $query)); + } + } else { + $this->url = $query['url']; + } if (!isset($query['search'])) { $query['search'] = ''; } @@ -47,9 +55,6 @@ class FreshRSS_UserQuery { if (isset($query['state'])) { $this->state = $query['state']; } - if (isset($query['url'])) { - $this->url = $query['url']; - } } /** diff --git a/app/layout/header.phtml b/app/layout/header.phtml index 6040df2d3..b5a9b662c 100644 --- a/app/layout/header.phtml +++ b/app/layout/header.phtml @@ -40,7 +40,7 @@ <a class="btn dropdown-toggle" href="#dropdown-configure"><?= _i('configure') ?></a> <ul class="dropdown-menu scrollbar-thin"> <li class="dropdown-header-close"><a class="toggle_aside" href="#close"><?= _i('close') ?></a></li> - + <li class="dropdown-header"><?= _t('gen.menu.account') ?>: <?= htmlspecialchars(Minz_Session::param('currentUser', '_'), ENT_NOQUOTES, 'UTF-8') ?></li> <li class="item"><a href="<?= _url('user', 'profile') ?>"><?= _t('gen.menu.user_profile') ?></a></li> <?php if (FreshRSS_Auth::accessNeedsAction()): ?> |
