mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
moved error code for wrong Ids and pageNames to Tempate-Class
throw an error if an invalid category-parameter is passed
This commit is contained in:
130
pages/title.php
130
pages/title.php
@@ -14,83 +14,73 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||
{
|
||||
$title = new TitleList(array(['id', $id]));
|
||||
if ($title->error)
|
||||
{
|
||||
$smarty->updatePageVars(array(
|
||||
'subject' => ucfirst(Lang::$game['title']),
|
||||
'id' => $id,
|
||||
'notFound' => sprintf(Lang::$main['pageNotFound'], Lang::$game['title']),
|
||||
));
|
||||
$smarty->assign('lang', Lang::$main);
|
||||
$smarty->display('404.tpl');
|
||||
exit();
|
||||
}
|
||||
$smarty->notFound(Lang::$game['title']);
|
||||
|
||||
$title->addGlobalsToJscript($pageData);
|
||||
|
||||
$infobox = [];
|
||||
$colon = User::$localeId == LOCALE_FR ? ' : ' : ': '; // Je suis un prick! <_<
|
||||
if ($title->getField('side') == 1)
|
||||
$infobox[] = Lang::$main['side'].$colon.'[span class=alliance-icon]'.Lang::$game['alliance'].'[/span]';
|
||||
else if ($title->getField('side') == 2)
|
||||
$infobox[] = Lang::$main['side'].$colon.'[span class=horde-icon]'.Lang::$game['horde'].'[/span]';
|
||||
else
|
||||
$infobox[] = Lang::$main['side'].$colon.Lang::$main['both'];
|
||||
|
||||
if ($g = $title->getField('gender'))
|
||||
$infobox[] = Lang::$main['gender'].$colon.'[span class='.($g == 2 ? 'female' : 'male').'-icon]'.Lang::$main['sex'][$g].'[/span]';
|
||||
|
||||
if ($e = $title->getField('eventId'))
|
||||
$infobox[] = Lang::$game['eventShort'].$colon.'[url=?event='.$e.']'.WorldEvent::getName($e).'[/url]';
|
||||
|
||||
$title->reset();
|
||||
$pageData = array(
|
||||
'page' => array(
|
||||
'name' => $title->getHtmlizedName(),
|
||||
'id' => $id,
|
||||
'expansion' => Util::$expansionString[$title->getField('expansion')]
|
||||
),
|
||||
'infobox' => '[li][ul]'.implode('[/ul][ul]', $infobox).'[/ul][/li]',
|
||||
);
|
||||
|
||||
foreach ($title->sources[$id] as $type => $entries)
|
||||
{
|
||||
$title->addGlobalsToJscript($pageData);
|
||||
|
||||
$infobox = [];
|
||||
$colon = User::$localeId == LOCALE_FR ? ' : ' : ': '; // Je suis un prick! <_<
|
||||
if ($title->getField('side') == 1)
|
||||
$infobox[] = Lang::$main['side'].$colon.'[span class=alliance-icon]'.Lang::$game['alliance'].'[/span]';
|
||||
else if ($title->getField('side') == 2)
|
||||
$infobox[] = Lang::$main['side'].$colon.'[span class=horde-icon]'.Lang::$game['horde'].'[/span]';
|
||||
else
|
||||
$infobox[] = Lang::$main['side'].$colon.Lang::$main['both'];
|
||||
|
||||
if ($g = $title->getField('gender'))
|
||||
$infobox[] = Lang::$main['gender'].$colon.'[span class='.($g == 2 ? 'female' : 'male').'-icon]'.Lang::$main['sex'][$g].'[/span]';
|
||||
|
||||
if ($e = $title->getField('eventId'))
|
||||
$infobox[] = Lang::$game['eventShort'].$colon.'[url=?event='.$e.']'.WorldEvent::getName($e).'[/url]';
|
||||
|
||||
$pageData = array(
|
||||
'page' => array(
|
||||
'name' => $title->getHtmlizedName(),
|
||||
'id' => $id,
|
||||
'expansion' => Util::$expansionString[$title->getField('expansion')]
|
||||
),
|
||||
'infobox' => '[li][ul]'.implode('[/ul][ul]', $infobox).'[/ul][/li]',
|
||||
);
|
||||
|
||||
foreach ($title->sources[$id] as $type => $entries)
|
||||
// todo: hidden-/visibleCols by actual use
|
||||
switch ($type)
|
||||
{
|
||||
// todo: hidden-/visibleCols by actual use
|
||||
switch ($type)
|
||||
{
|
||||
case 4:
|
||||
$quests = new QuestList(array(['id', $entries]));
|
||||
$quests->addRewardsToJscript($pageData);
|
||||
case 4:
|
||||
$quests = new QuestList(array(['id', $entries]));
|
||||
$quests->addRewardsToJscript($pageData);
|
||||
|
||||
$pageData['page']['questReward'] = $quests->getListviewData();
|
||||
$pageData['page']['questParams'] = array(
|
||||
'id' => 'reward-from-quest',
|
||||
'name' => '$LANG.tab_rewardfrom',
|
||||
'hiddenCols' => "$['side']",
|
||||
'visibleCols' => "$['category']"
|
||||
);
|
||||
break;
|
||||
case 12:
|
||||
$acvs = new AchievementList(array(['id', $entries]));
|
||||
$acvs->addGlobalsToJscript($pageData);
|
||||
$acvs->addRewardsToJscript($pageData);
|
||||
$pageData['page']['questReward'] = $quests->getListviewData();
|
||||
$pageData['page']['questParams'] = array(
|
||||
'id' => 'reward-from-quest',
|
||||
'name' => '$LANG.tab_rewardfrom',
|
||||
'hiddenCols' => "$['side']",
|
||||
'visibleCols' => "$['category']"
|
||||
);
|
||||
break;
|
||||
case 12:
|
||||
$acvs = new AchievementList(array(['id', $entries]));
|
||||
$acvs->addGlobalsToJscript($pageData);
|
||||
$acvs->addRewardsToJscript($pageData);
|
||||
|
||||
$pageData['page']['acvReward'] = $acvs->getListviewData();
|
||||
$pageData['page']['acvParams'] = array(
|
||||
'id' => 'reward-from-achievement',
|
||||
'name' => '$LANG.tab_rewardfrom',
|
||||
'visibleCols' => "$['category']",
|
||||
'sort' => "$['reqlevel', 'name']"
|
||||
);
|
||||
break;
|
||||
case 13:
|
||||
// not displayed
|
||||
}
|
||||
$pageData['page']['acvReward'] = $acvs->getListviewData();
|
||||
$pageData['page']['acvParams'] = array(
|
||||
'id' => 'reward-from-achievement',
|
||||
'name' => '$LANG.tab_rewardfrom',
|
||||
'visibleCols' => "$['category']",
|
||||
'sort' => "$['reqlevel', 'name']"
|
||||
);
|
||||
break;
|
||||
// case 13:
|
||||
// not displayed
|
||||
}
|
||||
$pageData['title'] = ucFirst(trim(str_replace('%s', '', str_replace(',', '', $title->name[0]))));
|
||||
$pageData['path'] = '[0, 10, '.$title->getField('category').']';
|
||||
|
||||
$smarty->saveCache($cacheKeyPage, $pageData);
|
||||
}
|
||||
$pageData['title'] = ucFirst(trim(str_replace('%s', '', str_replace(',', '', $title->names[$title->id][0]))));
|
||||
$pageData['path'] = '[0, 10, '.$title->getField('category').']';
|
||||
|
||||
$smarty->saveCache($cacheKeyPage, $pageData);
|
||||
}
|
||||
|
||||
$smarty->updatePageVars(array(
|
||||
|
||||
Reference in New Issue
Block a user