Core/Endpoints
* don't use raw input to recreate subcategories for filter urls and external links * if a page does not expect categories it will now error out if it is called with parameters * fixed infite redirect loop that could occur if the pageName was an invalid string * added lost filter string for external page call to NPCs Page
This commit is contained in:
parent
23c5c71f4a
commit
715c1534eb
91 changed files with 288 additions and 261 deletions
|
|
@ -13,11 +13,11 @@ class AboutusBaseResponse extends TemplateResponse
|
|||
protected ?int $activeTab = parent::TAB_MORE;
|
||||
protected array $breadcrumb = [2, 0];
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if ($pageParam)
|
||||
if ($rawParam)
|
||||
$this->generateError();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,12 +42,12 @@ class AccountBaseResponse extends TemplateResponse
|
|||
|
||||
public ?array $bans;
|
||||
|
||||
public function __construct($pageParam)
|
||||
public function __construct($rawParam)
|
||||
{
|
||||
if (!User::isLoggedIn())
|
||||
$this->forwardToSignIn('account');
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
}
|
||||
|
||||
protected function generate() : void
|
||||
|
|
|
|||
|
|
@ -35,12 +35,12 @@ class AccountConfirmdeleteResponse extends TemplateResponse
|
|||
|
||||
private bool $success = false;
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
if (Cfg::get('ACC_AUTH_MODE') != AUTH_MODE_SELF)
|
||||
$this->generateError();
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
}
|
||||
|
||||
protected function generate() : void
|
||||
|
|
|
|||
|
|
@ -28,12 +28,12 @@ class AccountDeleteResponse extends TemplateResponse
|
|||
public string $deleteFormTarget = '?account=delete';
|
||||
public ?array $inputbox = null;
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
if (Cfg::get('ACC_AUTH_MODE') != AUTH_MODE_SELF)
|
||||
$this->generateError();
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
}
|
||||
|
||||
protected function generate() : void
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class AccountforgotpasswordResponse extends TemplateResponse
|
|||
|
||||
private bool $success = false;
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
// don't redirect logged in users
|
||||
// you can be forgetful AND logged in
|
||||
|
|
@ -40,7 +40,7 @@ class AccountforgotpasswordResponse extends TemplateResponse
|
|||
if (Cfg::get('ACC_AUTH_MODE') != AUTH_MODE_SELF)
|
||||
$this->generateError();
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
}
|
||||
|
||||
protected function generate() : void
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class AccountforgotusernameResponse extends TemplateResponse
|
|||
|
||||
private bool $success = false;
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
// if the user is looged in goto account dashboard
|
||||
if (User::isLoggedIn())
|
||||
|
|
@ -40,7 +40,7 @@ class AccountforgotusernameResponse extends TemplateResponse
|
|||
if (Cfg::get('ACC_AUTH_MODE') != AUTH_MODE_SELF)
|
||||
$this->generateError();
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
}
|
||||
|
||||
protected function generate() : void
|
||||
|
|
|
|||
|
|
@ -20,12 +20,12 @@ class AccountResendsubmitResponse extends TemplateResponse
|
|||
'email' => ['filter' => FILTER_VALIDATE_EMAIL, 'flags' => FILTER_FLAG_STRIP_AOWOW]
|
||||
);
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
if (!Cfg::get('ACC_ALLOW_REGISTER') || Cfg::get('ACC_AUTH_MODE') != AUTH_MODE_SELF)
|
||||
$this->generateError();
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
}
|
||||
|
||||
protected function generate() : void
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class AccountResendResponse extends TemplateResponse
|
|||
|
||||
private bool $success = false;
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
if (Cfg::get('ACC_EXT_RECOVER_URL'))
|
||||
$this->forward(Cfg::get('ACC_EXT_RECOVER_URL'));
|
||||
|
|
@ -30,7 +30,7 @@ class AccountResendResponse extends TemplateResponse
|
|||
if (!Cfg::get('ACC_ALLOW_REGISTER') || Cfg::get('ACC_AUTH_MODE') != AUTH_MODE_SELF)
|
||||
$this->generateError();
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
}
|
||||
|
||||
protected function generate() : void
|
||||
|
|
|
|||
|
|
@ -15,13 +15,13 @@ class AccountSignoutResponse extends TextResponse
|
|||
'global' => ['filter' => FILTER_CALLBACK, 'options' => [self::class, 'checkEmptySet'] ]
|
||||
);
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
// if the user not is logged in goto login page
|
||||
if (!User::isLoggedIn())
|
||||
$this->forwardToSignIn();
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
}
|
||||
|
||||
protected function generate() : void
|
||||
|
|
|
|||
|
|
@ -22,12 +22,12 @@ class AccountUpdateemailResponse extends TextResponse
|
|||
|
||||
private bool $success = false;
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
if (Cfg::get('ACC_AUTH_MODE') != AUTH_MODE_SELF)
|
||||
(new TemplateResponse())->generateError();
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
}
|
||||
|
||||
protected function generate() : void
|
||||
|
|
|
|||
|
|
@ -25,12 +25,12 @@ class AccountUpdatepasswordResponse extends TextResponse
|
|||
|
||||
private bool $success = false;
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
if (Cfg::get('ACC_AUTH_MODE') != AUTH_MODE_SELF)
|
||||
(new TemplateResponse())->generateError();
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
}
|
||||
|
||||
protected function generate() : void
|
||||
|
|
|
|||
|
|
@ -22,12 +22,12 @@ class AccountUpdateusernameResponse extends TextResponse
|
|||
|
||||
private bool $success = false;
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
if (Cfg::get('ACC_AUTH_MODE') != AUTH_MODE_SELF)
|
||||
(new TemplateResponse())->generateError();
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
}
|
||||
|
||||
protected function generate() : void
|
||||
|
|
|
|||
|
|
@ -46,13 +46,15 @@ class AchievementsBaseResponse extends TemplateResponse implements ICache
|
|||
)
|
||||
);
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
$this->getCategoryFromUrl($pageParam);
|
||||
$this->getCategoryFromUrl($rawParam);
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if ($this->category)
|
||||
$this->subCat = '='.implode('.', $this->category);
|
||||
|
||||
$this->subCat = $pageParam !== '' ? '='.$pageParam : '';
|
||||
$this->filter = new AchievementListFilter($this->_get['filter'] ?? '', ['parentCats' => $this->category]);
|
||||
if ($this->filter->shouldReload)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,14 +23,14 @@ class AreatriggersBaseResponse extends TemplateResponse implements ICache
|
|||
protected array $expectedGET = ['filter' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => Filter::PATTERN_PARAM]]];
|
||||
protected array $validCats = [0, 1, 2, 3, 4, 5];
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
$this->getCategoryFromUrl($pageParam);
|
||||
$this->getCategoryFromUrl($rawParam);
|
||||
|
||||
if (isset($this->category[0]))
|
||||
$this->forward('?areatriggers&filter=ty='.$this->category[0]);
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
$this->filter = new AreaTriggerListFilter($this->_get['filter'] ?? '');
|
||||
if ($this->filter->shouldReload)
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@ class ArenaTeamResyncResponse extends TextResponse
|
|||
'profile' => ['filter' => FILTER_CALLBACK, 'options' => [self::class, 'checkEmptySet']]
|
||||
);
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if (!Cfg::get('PROFILER_ENABLE'))
|
||||
$this->generate404();
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@ class ArenaTeamStatusResponse extends TextResponse
|
|||
'id' => ['filter' => FILTER_CALLBACK, 'options' => [self::class, 'checkIdList']]
|
||||
);
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if (!Cfg::get('PROFILER_ENABLE'))
|
||||
$this->generate404();
|
||||
|
|
|
|||
|
|
@ -29,14 +29,14 @@ class ArenateamsBaseResponse extends TemplateResponse implements IProfilerList
|
|||
|
||||
private int $sumSubjects = 0;
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
if (!Cfg::get('PROFILER_ENABLE'))
|
||||
$this->generateError();
|
||||
|
||||
$this->getSubjectFromUrl($pageParam);
|
||||
$this->getSubjectFromUrl($rawParam);
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
$realms = [];
|
||||
foreach (Profiler::getRealms() as $idx => $r)
|
||||
|
|
@ -51,7 +51,9 @@ class ArenateamsBaseResponse extends TemplateResponse implements IProfilerList
|
|||
$realms[] = $idx;
|
||||
}
|
||||
|
||||
$this->subCat = $pageParam !== '' ? '='.$pageParam : '';
|
||||
if ($this->category)
|
||||
$this->subCat = '='.implode('.', $this->category);
|
||||
|
||||
$this->filter = new ArenaTeamListFilter($this->_get['filter'] ?? '', ['realms' => $realms]);
|
||||
if ($this->filter->shouldReload)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -18,11 +18,11 @@ class ClassesBaseResponse extends TemplateResponse implements ICache
|
|||
protected ?int $activeTab = parent::TAB_DATABASE;
|
||||
protected array $breadcrumb = [0, 12];
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
$this->getCategoryFromUrl($pageParam);
|
||||
$this->getCategoryFromUrl($rawParam);
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
}
|
||||
|
||||
protected function generate() : void
|
||||
|
|
|
|||
|
|
@ -34,9 +34,9 @@ class CompareBaseResponse extends TemplateResponse
|
|||
|
||||
private string $compareString = '';
|
||||
|
||||
public function __construct($pageParam)
|
||||
public function __construct($rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
// prefer GET over COOKIE
|
||||
if ($this->_get['compare'])
|
||||
|
|
|
|||
|
|
@ -20,11 +20,11 @@ class CurrenciesBaseResponse extends TemplateResponse implements ICache
|
|||
|
||||
protected array $validCats = [1, 2, 3, 22];
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
$this->getCategoryFromUrl($pageParam);
|
||||
$this->getCategoryFromUrl($rawParam);
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
}
|
||||
|
||||
protected function generate() : void
|
||||
|
|
|
|||
|
|
@ -17,9 +17,9 @@ class DataBaseResponse extends TextResponse
|
|||
'callback' => ['filter' => FILTER_CALLBACK, 'options' => [self::class, 'checkCallback' ]]
|
||||
);
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if ($this->_get['locale']?->validate())
|
||||
Lang::load($this->_get['locale']);
|
||||
|
|
|
|||
|
|
@ -18,11 +18,11 @@ class EmotesBaseResponse extends TemplateResponse implements ICache
|
|||
protected ?int $activeTab = parent::TAB_DATABASE;
|
||||
protected array $breadcrumb = [0, 100];
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
$this->getCategoryFromUrl($pageParam);
|
||||
$this->getCategoryFromUrl($rawParam);
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
}
|
||||
|
||||
protected function generate() : void
|
||||
|
|
|
|||
|
|
@ -24,16 +24,18 @@ class EnchantmentsBaseResponse extends TemplateResponse implements ICache
|
|||
);
|
||||
protected array $validCats = [1, 2, 3, 4, 5, 6, 7, 8];
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
$this->getCategoryFromUrl($pageParam);
|
||||
$this->getCategoryFromUrl($rawParam);
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if ($this->category)
|
||||
$this->forward('?enchantments&filter=ty='.$this->category[0]);
|
||||
|
||||
$this->subCat = $pageParam !== '' ? '='.$pageParam : '';
|
||||
if ($this->category)
|
||||
$this->subCat = '='.implode('.', $this->category);
|
||||
|
||||
$this->filter = new EnchantmentListFilter($this->_get['filter'] ?? '', ['parentCats' => $this->category]);
|
||||
if ($this->filter->shouldReload)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -20,11 +20,11 @@ class EventsBaseResponse extends TemplateResponse implements ICache
|
|||
|
||||
protected array $validCats = [0, 1, 2, 3];
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
$this->getCategoryFromUrl($pageParam);
|
||||
$this->getCategoryFromUrl($rawParam);
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
}
|
||||
|
||||
protected function generate() : void
|
||||
|
|
|
|||
|
|
@ -25,11 +25,11 @@ class FactionsBaseResponse extends TemplateResponse implements ICache
|
|||
0 => true
|
||||
);
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
$this->getCategoryFromUrl($pageParam);
|
||||
$this->getCategoryFromUrl($rawParam);
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
}
|
||||
|
||||
protected function generate() : void
|
||||
|
|
|
|||
|
|
@ -13,11 +13,11 @@ class FaqBaseResponse extends TemplateResponse
|
|||
protected ?int $activeTab = parent::TAB_MORE;
|
||||
protected array $breadcrumb = [2, 3];
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if ($pageParam)
|
||||
if ($rawParam)
|
||||
$this->generateError();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,18 +12,18 @@ class FilterBaseResponse extends TextResponse
|
|||
private string $page = '';
|
||||
private ?Filter $filter = null;
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
if (!$pageParam)
|
||||
if (!$rawParam)
|
||||
return;
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
$catg = null;
|
||||
if (strstr($pageParam, '='))
|
||||
[$this->page, $catg] = explode('=', $pageParam);
|
||||
if (strstr($rawParam, '='))
|
||||
[$this->page, $catg] = explode('=', $rawParam);
|
||||
else
|
||||
$this->page = $pageParam;
|
||||
$this->page = $rawParam;
|
||||
|
||||
if ($catg !== null)
|
||||
$this->catg = explode('.', $catg);
|
||||
|
|
|
|||
|
|
@ -20,11 +20,11 @@ class GuidesBaseResponse extends TemplateResponse // implements ICache
|
|||
|
||||
protected array $validCats = [null, 1, 2, 3, 4, 5, 6, 7, 8, 9];
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
$this->getCategoryFromUrl($pageParam);
|
||||
$this->getCategoryFromUrl($rawParam);
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
}
|
||||
|
||||
protected function generate() : void
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@ class GuildResyncResponse extends TextResponse
|
|||
'profile' => ['filter' => FILTER_CALLBACK, 'options' => [self::class, 'checkEmptySet']]
|
||||
);
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if (!Cfg::get('PROFILER_ENABLE'))
|
||||
$this->generate404();
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@ class GuildStatusResponse extends TextResponse
|
|||
'id' => ['filter' => FILTER_CALLBACK, 'options' => [self::class, 'checkIdList']]
|
||||
);
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if (!Cfg::get('PROFILER_ENABLE'))
|
||||
$this->generate404();
|
||||
|
|
|
|||
|
|
@ -29,14 +29,14 @@ class GuildsBaseResponse extends TemplateResponse implements IProfilerList
|
|||
|
||||
private int $sumSubjects = 0;
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
if (!Cfg::get('PROFILER_ENABLE'))
|
||||
$this->generateError();
|
||||
|
||||
$this->getSubjectFromUrl($pageParam);
|
||||
$this->getSubjectFromUrl($rawParam);
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
$realms = [];
|
||||
foreach (Profiler::getRealms() as $idx => $r)
|
||||
|
|
@ -51,7 +51,9 @@ class GuildsBaseResponse extends TemplateResponse implements IProfilerList
|
|||
$realms[] = $idx;
|
||||
}
|
||||
|
||||
$this->subCat = $pageParam !== '' ? '='.$pageParam : '';
|
||||
if ($this->category)
|
||||
$this->subCat = '='.implode('.', $this->category);
|
||||
|
||||
$this->filter = new GuildListFilter($this->_get['filter'] ?? '', ['realms' => $realms]);
|
||||
if ($this->filter->shouldReload)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -17,18 +17,18 @@ class HelpBaseResponse extends TemplateResponse
|
|||
|
||||
private string $catg = '';
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if (!$pageParam)
|
||||
if (!$rawParam)
|
||||
$this->generateError();
|
||||
|
||||
$pageId = array_search($pageParam, $this->validCats);
|
||||
$pageId = array_search($rawParam, $this->validCats);
|
||||
if ($pageId === false)
|
||||
$this->generateError();
|
||||
|
||||
$this->catg = $pageParam;
|
||||
$this->catg = $rawParam;
|
||||
}
|
||||
|
||||
protected function generate() : void
|
||||
|
|
|
|||
|
|
@ -24,13 +24,15 @@ class IconsBaseResponse extends TemplateResponse implements ICache
|
|||
);
|
||||
protected array $validCats = [0, 1, 2, 3];
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
$this->getCategoryFromUrl($pageParam);
|
||||
$this->getCategoryFromUrl($rawParam);
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if ($this->category)
|
||||
$this->subCat = '='.implode('.', $this->category);
|
||||
|
||||
$this->subCat = $pageParam !== '' ? '='.$pageParam : '';
|
||||
$this->filter = new IconListFilter($this->_get['filter'] ?? '', ['parentCats' => $this->category]);
|
||||
if ($this->filter->shouldReload)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -91,13 +91,15 @@ class ItemsBaseResponse extends TemplateResponse implements ICache
|
|||
'extraCols' => []
|
||||
);
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
$this->getCategoryFromUrl($pageParam);
|
||||
$this->getCategoryFromUrl($rawParam);
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if ($this->category)
|
||||
$this->subCat = '='.implode('.', $this->category);
|
||||
|
||||
$this->subCat = $pageParam !== '' ? '='.$pageParam : '';
|
||||
$this->filter = new ItemListFilter($this->_get['filter'] ?? '', ['parentCats' => $this->category]);
|
||||
if ($this->filter->shouldReload)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,13 +24,15 @@ class ItemsetsBaseResponse extends TemplateResponse implements ICache
|
|||
'filter' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => Filter::PATTERN_PARAM]]
|
||||
);
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
$this->getCategoryFromUrl($pageParam);
|
||||
$this->getCategoryFromUrl($rawParam);
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if ($this->category)
|
||||
$this->subCat = '='.implode('.', $this->category);
|
||||
|
||||
$this->subCat = $pageParam !== '' ? '='.$pageParam : '';
|
||||
$this->filter = new ItemsetListFilter($this->_get['filter'] ?? '', ['parentCats' => $this->category]);
|
||||
if ($this->filter->shouldReload)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -18,11 +18,11 @@ class MailsBaseResponse extends TemplateResponse implements ICache
|
|||
protected ?int $activeTab = parent::TAB_DATABASE;
|
||||
protected array $breadcrumb = [0, 103];
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
$this->getCategoryFromUrl($pageParam);
|
||||
$this->getCategoryFromUrl($rawParam);
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
}
|
||||
|
||||
protected function generate() : void
|
||||
|
|
|
|||
|
|
@ -15,11 +15,11 @@ class MostcommentsBaseResponse extends TemplateResponse
|
|||
|
||||
protected array $validCats = [1, 7, 30];
|
||||
|
||||
public function __construct($pageParam)
|
||||
public function __construct($rawParam)
|
||||
{
|
||||
$this->getCategoryFromUrl($pageParam);
|
||||
$this->getCategoryFromUrl($rawParam);
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
}
|
||||
|
||||
protected function onInvalidCategory() : never
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@ class MostcommentsRssResponse extends TextResponse
|
|||
|
||||
private array $validCats = [1, 7, 30];
|
||||
|
||||
public function __construct($pageParam)
|
||||
public function __construct($rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if ($this->params && !in_array($this->params[0], $this->validCats))
|
||||
$this->forward('?most-comments=1&rss');
|
||||
|
|
|
|||
|
|
@ -17,11 +17,11 @@ class MyguidesBaseResponse extends TemplateResponse
|
|||
protected ?int $activeTab = parent::TAB_GUIDES;
|
||||
// protected array $breadcrumb = [6]; // breadcrumb menu not displayed by WH.?
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if (!User::isLoggedIn() || $pageParam)
|
||||
if (!User::isLoggedIn() || $rawParam)
|
||||
$this->generateError();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,13 +27,15 @@ class NpcsBaseResponse extends TemplateResponse implements ICache
|
|||
|
||||
public bool $petFamPanel = false;
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
$this->getCategoryFromUrl($pageParam);
|
||||
$this->getCategoryFromUrl($rawParam);
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if ($this->category)
|
||||
$this->subCat = '='.implode('.', $this->category);
|
||||
|
||||
$this->subCat = $pageParam !== '' ? '='.$pageParam : '';
|
||||
$this->filter = new CreatureListFilter($this->_get['filter'] ?? '', ['parentCats' => $this->category]);
|
||||
if ($this->filter->shouldReload)
|
||||
{
|
||||
|
|
@ -93,6 +95,8 @@ class NpcsBaseResponse extends TemplateResponse implements ICache
|
|||
/****************/
|
||||
|
||||
$this->redButtons[BUTTON_WOWHEAD] = true;
|
||||
if ($fiQuery = $this->filter->buildGETParam())
|
||||
$this->wowheadLink .= '&filter='.$fiQuery;
|
||||
|
||||
// beast subtypes are selected via filter
|
||||
$tabData = ['data' => []];
|
||||
|
|
|
|||
|
|
@ -27,13 +27,15 @@ class ObjectsBaseResponse extends TemplateResponse implements ICache
|
|||
|
||||
public bool $petFamPanel = false;
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
$this->getCategoryFromUrl($pageParam);
|
||||
$this->getCategoryFromUrl($rawParam);
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if ($this->category)
|
||||
$this->subCat = '='.implode('.', $this->category);
|
||||
|
||||
$this->subCat = $pageParam !== '' ? '='.$pageParam : '';
|
||||
$this->filter = new GameObjectListFilter($this->_get['filter'] ?? '', ['parentCats' => $this->category]);
|
||||
if ($this->filter->shouldReload)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -20,11 +20,11 @@ class PetsBaseResponse extends TemplateResponse implements ICache
|
|||
|
||||
protected array $validCats = [PET_TALENT_TYPE_FEROCITY, PET_TALENT_TYPE_TENACITY, PET_TALENT_TYPE_CUNNING];
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
$this->getCategoryFromUrl($pageParam);
|
||||
$this->getCategoryFromUrl($rawParam);
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
}
|
||||
|
||||
protected function generate() : void
|
||||
|
|
|
|||
|
|
@ -34,17 +34,17 @@ class PrivilegeBaseResponse extends TemplateResponse
|
|||
17 => 'REP_REQ_PREMIUM' // premium status
|
||||
);
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
$this->getCategoryFromUrl($pageParam);
|
||||
$this->getCategoryFromUrl($rawParam);
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if (!$pageParam)
|
||||
if (!$rawParam)
|
||||
$this->generateError();
|
||||
|
||||
// apply actual values
|
||||
$this->repVal = Cfg::get($this->req2priv[$pageParam]);
|
||||
$this->repVal = Cfg::get($this->req2priv[$rawParam]);
|
||||
}
|
||||
|
||||
protected function generate() : void
|
||||
|
|
|
|||
|
|
@ -31,11 +31,11 @@ class PrivilegesBaseResponse extends TemplateResponse
|
|||
17 => 'REP_REQ_PREMIUM' // premium status
|
||||
);
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if ($pageParam)
|
||||
if ($rawParam)
|
||||
$this->generateError();
|
||||
|
||||
// apply actual values and order by requirement ASC
|
||||
|
|
|
|||
|
|
@ -26,9 +26,9 @@ class ProfileAvatarResponse extends TextResponse
|
|||
'size' => ['filter' => FILTER_CALLBACK, 'options' => [self::class, 'checkTextLine']]
|
||||
);
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if (!Cfg::get('PROFILER_ENABLE'))
|
||||
$this->generate404();
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@ class ProfileDeleteResponse extends TextResponse
|
|||
'id' => ['filter' => FILTER_CALLBACK, 'options' => [self::class, 'checkIdList']],
|
||||
);
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if (!Cfg::get('PROFILER_ENABLE'))
|
||||
$this->generate404();
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@ class ProfileLinkResponse extends TextResponse
|
|||
'id' => ['filter' => FILTER_VALIDATE_INT]
|
||||
);
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if (!Cfg::get('PROFILER_ENABLE'))
|
||||
$this->generate404();
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@ class ProfileLoadResponse extends TextResponse
|
|||
'items' => ['filter' => FILTER_CALLBACK, 'options' => [self::class, 'checkItemList']]
|
||||
);
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if (!Cfg::get('PROFILER_ENABLE'))
|
||||
$this->generate404();
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@ class ProfilePinResponse extends TextResponse
|
|||
'user' => ['filter' => FILTER_CALLBACK, 'options' => [Util::class, 'validateUsername']]
|
||||
);
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if (!Cfg::get('PROFILER_ENABLE'))
|
||||
$this->generate404();
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@ class ProfilePrivateResponse extends TextResponse
|
|||
// 'bookmarked' => ['filter' => FILTER_CALLBACK, 'options' => [self::class, 'checkEmptySet'] ] // something with signatures? (must have bookmarked profile to create signature from)
|
||||
);
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if (!Cfg::get('PROFILER_ENABLE'))
|
||||
$this->generate404();
|
||||
|
|
|
|||
|
|
@ -19,9 +19,9 @@ class ProfilePowerResponse extends TextResponse implements ICache
|
|||
'domain' => ['filter' => FILTER_CALLBACK, 'options' => [Locale::class, 'tryFromDomain']]
|
||||
);
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if (!Cfg::get('PROFILER_ENABLE'))
|
||||
$this->generate404();
|
||||
|
|
@ -30,9 +30,9 @@ class ProfilePowerResponse extends TextResponse implements ICache
|
|||
if ($this->_get['domain'])
|
||||
Lang::load($this->_get['domain']);
|
||||
|
||||
$this->getSubjectFromUrl($pageParam);
|
||||
$this->getSubjectFromUrl($rawParam);
|
||||
|
||||
if ($this->subjectName) // pageParam is fully defined profiler string
|
||||
if ($this->subjectName) // rawParam is fully defined profiler string
|
||||
{
|
||||
// pending rename
|
||||
if (preg_match('/([^\-]+)-(\d+)/i', $this->subjectName, $m))
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@ class ProfilePublicResponse extends TextResponse
|
|||
// 'bookmarked' => ['filter' => FILTER_CALLBACK, 'options' => [self::class, 'checkEmptySet'] ] // something with signatures? (must have bookmarked profile to create signature from)
|
||||
);
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if (!Cfg::get('PROFILER_ENABLE'))
|
||||
$this->generate404();
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@ class ProfileResyncResponse extends TextResponse
|
|||
'id' => ['filter' => FILTER_CALLBACK, 'options' => [self::class, 'checkIdList']]
|
||||
);
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if (!Cfg::get('PROFILER_ENABLE'))
|
||||
$this->generate404();
|
||||
|
|
|
|||
|
|
@ -35,9 +35,9 @@ class ProfileSaveResponse extends TextResponse
|
|||
'inv' => ['filter' => FILTER_CALLBACK, 'options' => [self::class, 'checkIdList'], 'flags' => FILTER_REQUIRE_ARRAY]
|
||||
);
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if (!Cfg::get('PROFILER_ENABLE'))
|
||||
$this->generate404();
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@ class ProfileStatusResponse extends TextResponse
|
|||
'arena-team' => ['filter' => FILTER_CALLBACK, 'options' => [self::class, 'checkEmptySet']]
|
||||
);
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if (!Cfg::get('PROFILER_ENABLE'))
|
||||
$this->generate404();
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@ class ProfileUnlinkResponse extends TextResponse
|
|||
'user' => ['filter' => FILTER_CALLBACK, 'options' => [Util::class, 'validateUsername']]
|
||||
);
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if (!Cfg::get('PROFILER_ENABLE'))
|
||||
$this->generate404();
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@ class ProfileUnpinResponse extends TextResponse
|
|||
'user' => ['filter' => FILTER_CALLBACK, 'options' => [Util::class, 'validateUsername']]
|
||||
);
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if (!Cfg::get('PROFILER_ENABLE'))
|
||||
$this->generate404();
|
||||
|
|
|
|||
|
|
@ -33,11 +33,11 @@ class ProfilesBaseResponse extends TemplateResponse implements IProfilerList
|
|||
|
||||
private int $sumSubjects = 0;
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
$this->getSubjectFromUrl($pageParam);
|
||||
$this->getSubjectFromUrl($rawParam);
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if (!Cfg::get('PROFILER_ENABLE'))
|
||||
$this->generateError();
|
||||
|
|
@ -55,7 +55,9 @@ class ProfilesBaseResponse extends TemplateResponse implements IProfilerList
|
|||
$realms[] = $idx;
|
||||
}
|
||||
|
||||
$this->subCat = $pageParam !== '' ? '='.$pageParam : '';
|
||||
if ($this->category)
|
||||
$this->subCat = '='.implode('.', $this->category);
|
||||
|
||||
$this->filter = new ProfileListFilter($this->_get['filter'] ?? '', ['realms' => $realms]);
|
||||
if ($this->filter->shouldReload)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -45,13 +45,15 @@ class QuestsBaseResponse extends TemplateResponse implements ICache
|
|||
);
|
||||
protected array $validCats = Game::QUEST_CLASSES;
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
$this->getCategoryFromUrl($pageParam);
|
||||
$this->getCategoryFromUrl($rawParam);
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if ($this->category)
|
||||
$this->subCat = '='.implode('.', $this->category);
|
||||
|
||||
$this->subCat = $pageParam !== '' ? '='.$pageParam : '';
|
||||
$this->filter = new QuestListFilter($this->_get['filter'] ?? '', ['parentCats' => $this->category]);
|
||||
if ($this->filter->shouldReload)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -18,11 +18,11 @@ class RacesBaseResponse extends TemplateResponse implements ICache
|
|||
protected ?int $activeTab = parent::TAB_DATABASE;
|
||||
protected array $breadcrumb = [0, 13];
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
$this->getCategoryFromUrl($pageParam);
|
||||
$this->getCategoryFromUrl($rawParam);
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
}
|
||||
|
||||
protected function generate() : void
|
||||
|
|
|
|||
|
|
@ -15,11 +15,11 @@ class ReputationBaseResponse extends TemplateResponse
|
|||
protected ?int $activeTab = parent::TAB_COMMUNITY;
|
||||
protected array $breadcrumb = [3, 10];
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if ($pageParam)
|
||||
if ($rawParam)
|
||||
$this->generateError();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@ class ScreenshotAddResponse extends TextResponse
|
|||
private int $destType = 0;
|
||||
private int $destTypeId = 0;
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
// get screenshot destination
|
||||
// target delivered as screenshot=<command>&<type>.<typeId>.<hash:16> (hash is optional)
|
||||
|
|
|
|||
|
|
@ -30,9 +30,9 @@ class ScreenshotCompleteResponse extends TextResponse
|
|||
private int $destTypeId = 0;
|
||||
private string $imgHash = '';
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
// get screenshot destination
|
||||
// target delivered as screenshot=<command>&<type>.<typeId>.<hash:16> (hash is optional)
|
||||
|
|
|
|||
|
|
@ -32,9 +32,9 @@ class ScreenshotCropResponse extends TemplateResponse
|
|||
public int $destTypeId = 0;
|
||||
public string $imgHash = '';
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
// get screenshot destination
|
||||
// target delivered as screenshot=<command>&<type>.<typeId>.<hash:16> (hash is optional)
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@ class ScreenshotThankyouResponse extends TemplateResponse
|
|||
private int $destType = 0;
|
||||
private int $destTypeId = 0;
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
// get screenshot destination
|
||||
// target delivered as screenshot=<command>&<type>.<typeId>.<hash:16> (hash is optional)
|
||||
|
|
|
|||
|
|
@ -29,11 +29,11 @@ class SearchBaseResponse extends TemplateResponse implements ICache
|
|||
|
||||
public string $invalidTerms = '';
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam); // just to set g_user and g_locale
|
||||
parent::__construct($rawParam); // just to set g_user and g_locale
|
||||
|
||||
$this->query = $this->_get['search']; // technically pageParam, but prepared
|
||||
$this->query = $this->_get['search']; // technically rawParam, but prepared
|
||||
|
||||
$this->searchMask = Search::TYPE_REGULAR | self::SEARCH_MODS_ALL;
|
||||
|
||||
|
|
|
|||
|
|
@ -33,11 +33,11 @@ class SearchJsonResponse extends TextResponse implements ICache
|
|||
private array $extraOpts = []; // for weighted search
|
||||
private array $extraCnd = []; // for weighted search
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
$this->query = $this->_get['search']; // technically pageParam, but prepared
|
||||
$this->query = $this->_get['search']; // technically rawParam, but prepared
|
||||
|
||||
if ($this->_get['wt'] && $this->_get['wtv']) // slots and type should get ignored
|
||||
{
|
||||
|
|
|
|||
|
|
@ -62,11 +62,11 @@ class SearchOpenResponse extends TextResponse implements ICache
|
|||
'search' => ['filter' => FILTER_CALLBACK, 'options' => [self::class, 'checkTextLine']]
|
||||
);
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam); // just to set g_user and g_locale
|
||||
parent::__construct($rawParam); // just to set g_user and g_locale
|
||||
|
||||
$this->query = $this->_get['search']; // technically pageParam, but prepared
|
||||
$this->query = $this->_get['search']; // technically rawParam, but prepared
|
||||
|
||||
$this->searchMask = Search::TYPE_OPEN | self::SEARCH_MODS_OPEN;
|
||||
|
||||
|
|
|
|||
|
|
@ -13,11 +13,11 @@ class SearchboxBaseResponse extends TemplateResponse
|
|||
protected ?int $activeTab = parent::TAB_MORE;
|
||||
protected array $breadcrumb = [2, 16];
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if ($pageParam)
|
||||
if ($rawParam)
|
||||
$this->generateError();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,11 +13,11 @@ class SearchpluginsBaseResponse extends TemplateResponse
|
|||
protected ?int $activeTab = parent::TAB_MORE;
|
||||
protected array $breadcrumb = [2, 8];
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if ($pageParam)
|
||||
if ($rawParam)
|
||||
$this->generateError();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@ class SignatureDeleteResponse extends TextResponse
|
|||
'id' => ['filter' => FILTER_CALLBACK, 'options' => [self::class, 'checkIdListUnsigned']]
|
||||
);
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
}
|
||||
|
||||
protected function generate() : void
|
||||
|
|
|
|||
|
|
@ -24,9 +24,9 @@ class SignatureGenerateResponse extends TextResponse
|
|||
'id' => ['filter' => FILTER_CALLBACK, 'options' => [self::class, 'checkProfileId']]
|
||||
);
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
}
|
||||
|
||||
protected function generate() : void
|
||||
|
|
|
|||
|
|
@ -18,12 +18,12 @@ class SignatureBaseResponse extends TemplateResponse
|
|||
|
||||
private int $id = 0;
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if ($pageParam)
|
||||
$this->id = intVal($pageParam);
|
||||
if ($rawParam)
|
||||
$this->id = intVal($rawParam);
|
||||
else if ($this->assertGET('profile'))
|
||||
$this->id = $this->_get['profile'];
|
||||
else
|
||||
|
|
|
|||
|
|
@ -20,11 +20,11 @@ class SkillsBaseResponse extends TemplateResponse implements ICache
|
|||
|
||||
protected array $validCats = [-6, -5, -4, 6, 7, 8, 9, 10, 11];
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
$this->getCategoryFromUrl($pageParam);
|
||||
$this->getCategoryFromUrl($rawParam);
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
}
|
||||
|
||||
protected function generate() : void
|
||||
|
|
|
|||
|
|
@ -24,15 +24,17 @@ class SoundsBaseResponse extends TemplateResponse implements ICache
|
|||
);
|
||||
protected array $validCats = [1, 2, 3, 4, 6, 9, 10, 12, 13, 14, 16, 17, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 50, 52, 53];
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
$this->getCategoryFromUrl($pageParam);
|
||||
$this->getCategoryFromUrl($rawParam);
|
||||
if ($this->category)
|
||||
$this->forward('?sounds&filter=ty='.$this->category[0]);
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if ($this->category)
|
||||
$this->subCat = '='.implode('.', $this->category);
|
||||
|
||||
$this->subCat = $pageParam !== '' ? '='.$pageParam : '';
|
||||
$this->filter = new SoundListFilter($this->_get['filter'] ?? '', ['parentCats' => $this->category]);
|
||||
if ($this->filter->shouldReload)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -91,13 +91,15 @@ class SpellsBaseResponse extends TemplateResponse implements ICache
|
|||
public bool $classPanel = false;
|
||||
public bool $glyphPanel = false;
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
$this->getCategoryFromUrl($pageParam);
|
||||
$this->getCategoryFromUrl($rawParam);
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if ($this->category)
|
||||
$this->subCat = '='.implode('.', $this->category);
|
||||
|
||||
$this->subCat = $pageParam !== '' ? '='.$pageParam : '';
|
||||
$this->filter = new SpellListFilter($this->_get['filter'] ?? '', ['parentCats' => $this->category]);
|
||||
if ($this->filter->shouldReload)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -20,11 +20,11 @@ class TitlesBaseResponse extends TemplateResponse implements ICache
|
|||
|
||||
protected array $validCats = [0, 1, 2, 3, 4, 5, 6];
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
$this->getCategoryFromUrl($pageParam);
|
||||
$this->getCategoryFromUrl($rawParam);
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
}
|
||||
|
||||
protected function generate() : void
|
||||
|
|
|
|||
|
|
@ -13,11 +13,11 @@ class TooltipsBaseResponse extends TemplateResponse
|
|||
protected ?int $activeTab = parent::TAB_MORE;
|
||||
protected array $breadcrumb = [2, 10];
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if ($pageParam)
|
||||
if ($rawParam)
|
||||
$this->generateError();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,11 +15,11 @@ class TopusersBaseResponse extends TemplateResponse
|
|||
protected ?int $activeTab = parent::TAB_COMMUNITY;
|
||||
protected array $breadcrumb = [3, 11];
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if ($pageParam)
|
||||
if ($rawParam)
|
||||
$this->generateError();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,12 +19,12 @@ class UploadImagecompleteResponse extends TextResponse
|
|||
public string $imgHash;
|
||||
public int $newId;
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
if (User::isBanned())
|
||||
$this->generate404();
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if (!preg_match('/^upload=image-complete&(\d+)\.(\w{16})$/i', $_SERVER['QUERY_STRING'] ?? '', $m, PREG_UNMATCHED_AS_NULL))
|
||||
$this->generate404();
|
||||
|
|
|
|||
|
|
@ -23,12 +23,12 @@ class UploadImagecropResponse extends TemplateResponse
|
|||
public int $nextId = 0;
|
||||
public string $imgHash = '';
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
if (User::isBanned())
|
||||
$this->generateError();
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
}
|
||||
|
||||
protected function generate() : void
|
||||
|
|
|
|||
|
|
@ -28,24 +28,24 @@ class UserBaseResponse extends TemplateResponse
|
|||
|
||||
private array $user = [];
|
||||
|
||||
public function __construct($pageParam)
|
||||
public function __construct($rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if (!$pageParam && User::isLoggedIn())
|
||||
if (!$rawParam && User::isLoggedIn())
|
||||
$this->forward('?user='.User::$username);
|
||||
|
||||
if (!$pageParam)
|
||||
if (!$rawParam)
|
||||
$this->forwardToSignIn('user');
|
||||
|
||||
if ($user = DB::Aowow()->selectRow('SELECT a.`id`, a.`username`, a.`consecutiveVisits`, a.`userGroups`, a.`avatar`, a.`avatarborder`, a.`wowicon`, a.`title`, a.`description`, a.`joinDate`, a.`prevLogin`, IFNULL(SUM(ar.`amount`), 0) AS "sumRep", a.`prevIP`, a.`email` FROM ?_account a LEFT JOIN ?_account_reputation ar ON a.`id` = ar.`userId` WHERE LOWER(a.`username`) = LOWER(?) GROUP BY a.`id`', $pageParam))
|
||||
if ($user = DB::Aowow()->selectRow('SELECT a.`id`, a.`username`, a.`consecutiveVisits`, a.`userGroups`, a.`avatar`, a.`avatarborder`, a.`wowicon`, a.`title`, a.`description`, a.`joinDate`, a.`prevLogin`, IFNULL(SUM(ar.`amount`), 0) AS "sumRep", a.`prevIP`, a.`email` FROM ?_account a LEFT JOIN ?_account_reputation ar ON a.`id` = ar.`userId` WHERE LOWER(a.`username`) = LOWER(?) GROUP BY a.`id`', $rawParam))
|
||||
$this->user = $user;
|
||||
else
|
||||
$this->generateNotFound(Lang::user('notFound', [$pageParam]));
|
||||
$this->generateNotFound(Lang::user('notFound', [$rawParam]));
|
||||
|
||||
// do not display system account
|
||||
if (!$this->user['id'])
|
||||
$this->generateNotFound(Lang::user('notFound', [$pageParam]));
|
||||
$this->generateNotFound(Lang::user('notFound', [$rawParam]));
|
||||
}
|
||||
|
||||
protected function generate() : void
|
||||
|
|
|
|||
|
|
@ -27,9 +27,9 @@ class VideoAddResponse extends TextResponse
|
|||
private int $destType = 0;
|
||||
private int $destTypeId = 0;
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
// get video destination
|
||||
// target delivered as video=<command>&<type>.<typeId>.<hash:16> (hash is optional)
|
||||
|
|
|
|||
|
|
@ -27,9 +27,9 @@ class VideoCompleteResponse extends TextResponse
|
|||
private int $destType = 0;
|
||||
private int $destTypeId = 0;
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
// get video destination
|
||||
// target delivered as video=<command>&<type>.<typeId>.<hash:16> (hash is optional)
|
||||
|
|
|
|||
|
|
@ -32,9 +32,9 @@ class VideoConfirmResponse extends TemplateResponse
|
|||
public array $video = [];
|
||||
public string $viTitle = '';
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
// get video destination
|
||||
// target delivered as video=<command>&<type>.<typeId>.<hash:16> (hash is optional)
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@ class VideoThankyouResponse extends TemplateResponse
|
|||
private int $destType = 0;
|
||||
private int $destTypeId = 0;
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
// get video destination
|
||||
// target delivered as video=<command>&<type>.<typeId>
|
||||
|
|
|
|||
|
|
@ -13,11 +13,11 @@ class WhatsnewBaseResponse extends TemplateResponse
|
|||
protected ?int $activeTab = parent::TAB_MORE;
|
||||
protected array $breadcrumb = [2, 7];
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
|
||||
if ($pageParam)
|
||||
if ($rawParam)
|
||||
$this->generateError();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,11 +23,11 @@ class ZonesBaseResponse extends TemplateResponse implements ICache
|
|||
|
||||
public ?array $map = null;
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
public function __construct(string $rawParam)
|
||||
{
|
||||
$this->getCategoryFromUrl($pageParam);
|
||||
$this->getCategoryFromUrl($rawParam);
|
||||
|
||||
parent::__construct($pageParam);
|
||||
parent::__construct($rawParam);
|
||||
}
|
||||
|
||||
protected function generate() : void
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ trait TrDetailPage
|
|||
|
||||
trait TrListPage
|
||||
{
|
||||
public ?string $subCat = null;
|
||||
public string $subCat = '';
|
||||
public ?Filter $filter = null;
|
||||
|
||||
public function getCacheKeyComponents() : array
|
||||
|
|
@ -150,7 +150,7 @@ class TemplateResponse extends BaseResponse
|
|||
public array $pageTemplate = []; // js PageTemplate object
|
||||
public array $jsGlobals = []; // ready to be used in template
|
||||
|
||||
public function __construct(string $pageParam = '')
|
||||
public function __construct(string $rawParam = '')
|
||||
{
|
||||
$this->title[] = Cfg::get('NAME');
|
||||
self::$time = microtime(true);
|
||||
|
|
@ -158,8 +158,8 @@ class TemplateResponse extends BaseResponse
|
|||
parent::__construct();
|
||||
|
||||
$this->fullParams = $this->pageName;
|
||||
if ($pageParam)
|
||||
$this->fullParams .= '='.$pageParam;
|
||||
if ($this->category)
|
||||
$this->fullParams .= '='.implode('.', $this->category);
|
||||
|
||||
// prep js+css includes
|
||||
$parentVars = get_class_vars(__CLASS__);
|
||||
|
|
@ -175,7 +175,7 @@ class TemplateResponse extends BaseResponse
|
|||
|
||||
if ($this->pageName)
|
||||
{
|
||||
$this->wowheadLink = sprintf(WOWHEAD_LINK, Lang::getLocale()->domain(), $this->pageName, $pageParam ? '=' . $pageParam : '');
|
||||
$this->wowheadLink = sprintf(WOWHEAD_LINK, Lang::getLocale()->domain(), $this->fullParams, '');
|
||||
$this->pageTemplate['pageName'] = $this->pageName;
|
||||
}
|
||||
|
||||
|
|
@ -672,15 +672,13 @@ class TemplateResponse extends BaseResponse
|
|||
// has a valid combination of categories
|
||||
private function isValidPage() : bool
|
||||
{
|
||||
if (!$this->category || !$this->validCats)
|
||||
if (!$this->category)
|
||||
return true;
|
||||
|
||||
$c = $this->category; // shorthand
|
||||
|
||||
switch (count($c))
|
||||
{
|
||||
case 0: // no params works always
|
||||
return true;
|
||||
case 1: // null is valid || value in a 1-dim-array || (key for a n-dim-array && ( has more subcats || no further subCats ))
|
||||
$filtered = array_filter($this->validCats, fn ($x) => is_int($x));
|
||||
return $c[0] === null || in_array($c[0], $filtered) || (!empty($this->validCats[$c[0]]) && (is_array($this->validCats[$c[0]]) || $this->validCats[$c[0]] === true));
|
||||
|
|
|
|||
|
|
@ -96,12 +96,12 @@ class TextResponse extends BaseResponse
|
|||
protected array $params = [];
|
||||
|
||||
/// generation stats
|
||||
protected static float $time = 0.0;
|
||||
protected static float $time = 0.0;
|
||||
|
||||
public function __construct(string $pageParam = '')
|
||||
public function __construct(string $rawParam = '')
|
||||
{
|
||||
self::$time = microtime(true);
|
||||
$this->params = explode('.', $pageParam);
|
||||
$this->params = explode('.', $rawParam);
|
||||
// todo - validate params?
|
||||
|
||||
parent::__construct();
|
||||
|
|
|
|||
|
|
@ -23,8 +23,9 @@ foreach ($query as $page => $param)
|
|||
// fix page calls - pages like search use the page call directly and expect it as lower case
|
||||
if (preg_match('/[A-Z]/', $page))
|
||||
{
|
||||
$url = str_replace('?'.$page.'=', '?'.Util::lower($page).'=', $_SERVER['REQUEST_URI']);
|
||||
header('Location: '.$url, true, 302);
|
||||
$url = explode('=', $_SERVER['REQUEST_URI'], 2);
|
||||
$page = Util::lower(array_shift($url)).($url ? '=' . $url[0] : '');
|
||||
header('Location: '.$page, true, 302);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue