Filter/Errors

* move checks to __construct so they can be run on $_POST data
   and don't create malformed filter urls
 * if we received malformed $_GET params, build new params and reload
 * do not store error state in cache
 * cleanup
This commit is contained in:
Sarjuuk 2025-10-14 19:36:47 +02:00
parent c0097f3987
commit 37beaa2db5
18 changed files with 280 additions and 202 deletions

View file

@ -35,6 +35,12 @@ class ObjectsBaseResponse extends TemplateResponse implements ICache
$this->subCat = $pageParam !== '' ? '='.$pageParam : '';
$this->filter = new GameObjectListFilter($this->_get['filter'] ?? '', ['parentCats' => $this->category]);
if ($this->filter->shouldReload)
{
$_SESSION['error']['fi'] = $this->filter::class;
$get = $this->filter->buildGETParam();
$this->forward('?' . $this->pageName . $this->subCat . ($get ? '&filter=' . $get : ''));
}
$this->filterError = $this->filter->error;
}
@ -46,16 +52,12 @@ class ObjectsBaseResponse extends TemplateResponse implements ICache
if (!User::isInGroup(U_GROUP_EMPLOYEE))
$conditions[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0];
$this->filter->evalCriteria();
if ($_ = $this->filter->getConditions())
$conditions[] = $_;
if ($this->category)
$conditions[] = ['typeCat', (int)$this->category[0]];
$this->filterError = $this->filter->error; // maybe the evalX() caused something
/*************/
/* Menu Path */