mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
moved announcements to template-class .. its the same for every single page...
This commit is contained in:
@@ -70,6 +70,21 @@ class Smarty_AoWoW extends Smarty
|
||||
$this->_tpl_vars['page'][$var] = $val;
|
||||
}
|
||||
|
||||
public function display($tpl)
|
||||
{
|
||||
// since it's the same for every page, except index..
|
||||
if ($this->_tpl_vars['query'][0])
|
||||
{
|
||||
$ann = DB::Aowow()->Select('SELECT * FROM ?_announcements WHERE flags & 0x10 AND (page = ?s OR page = "*")', $this->_tpl_vars['query'][0]);
|
||||
foreach ($ann as $k => $v)
|
||||
$ann[$k]['text'] = Util::localizedString($v, 'text');
|
||||
|
||||
$this->_tpl_vars['announcements'] = $ann;
|
||||
}
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
// creates the actual cache file
|
||||
public function saveCache($key, $data)
|
||||
{
|
||||
@@ -157,10 +172,9 @@ User::setLocale();
|
||||
User::assignUserToTemplate($smarty, true);
|
||||
|
||||
// parse page-parameters .. sanitize before use!
|
||||
$query = $_SERVER['QUERY_STRING'];
|
||||
$smarty->assign('query', $query);
|
||||
@list($str, $trash) = explode('&', $query, 2);
|
||||
@list($str, $trash) = explode('&', $_SERVER['QUERY_STRING'], 2);
|
||||
@list($pageCall, $pageParam) = explode('=', $str, 2);
|
||||
$smarty->assign('query', [$pageCall, $pageParam]);
|
||||
|
||||
// init global vars for smarty
|
||||
$pageData = array(
|
||||
|
||||
@@ -377,10 +377,6 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||
$smarty->saveCache($cacheKeyPage, $pageData);
|
||||
}
|
||||
|
||||
$announcements = DB::Aowow()->Select('SELECT * FROM ?_announcements WHERE flags & 0x10 AND (page = "achievement" OR page = "*")');
|
||||
foreach ($announcements as $k => $v)
|
||||
$announcements[$k]['text'] = Util::localizedString($v, 'text');
|
||||
|
||||
$vars = array(
|
||||
'title' => implode(" - ", $pageData['title']),
|
||||
'path' => "[".implode(", ", $pageData['path'])."]",// menuId 9: Achievement (g_initPath)
|
||||
@@ -391,7 +387,6 @@ $vars = array(
|
||||
|
||||
$smarty->updatePageVars($vars);
|
||||
$smarty->assign('community', CommunityContent::getAll(TYPE_ACHIEVEMENT, $id)); // comments, screenshots, videos
|
||||
$smarty->assign('announcements', $announcements);
|
||||
$smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$achievement));
|
||||
$smarty->assign('data', $pageData);
|
||||
|
||||
|
||||
@@ -64,10 +64,6 @@ if ($compareString)
|
||||
}
|
||||
}
|
||||
|
||||
// Announcements
|
||||
$announcements = DB::Aowow()->Select('SELECT * FROM ?_announcements WHERE flags & 0x10 AND (page = "compare" OR page = "*")');
|
||||
foreach ($announcements as $k => $v)
|
||||
$announcements[$k]['text'] = Util::localizedString($v, 'text');
|
||||
|
||||
$page = array(
|
||||
'title' => Lang::$compare['compare'],
|
||||
@@ -89,7 +85,6 @@ $page = array(
|
||||
$smarty->updatePageVars($page);
|
||||
$smarty->assign('data', $pageData);
|
||||
$smarty->assign('lang', array_merge(Lang::$main, Lang::$compare));
|
||||
$smarty->assign('announcements', $announcements);
|
||||
$smarty->assign('mysql', DB::Aowow()->getStatistics());
|
||||
$smarty->display('compare.tpl');
|
||||
|
||||
|
||||
@@ -3,14 +3,8 @@
|
||||
if (!defined('AOWOW_REVISION'))
|
||||
die('illegal access');
|
||||
|
||||
// Announcements
|
||||
$announcements = DB::Aowow()->Select('SELECT * FROM ?_announcements WHERE flags & 0x10 AND (page = "*")');
|
||||
foreach ($announcements as $k => $v)
|
||||
$announcements[$k]['text'] = Util::localizedString($v, 'text');
|
||||
|
||||
|
||||
$smarty->assign('lang', array_merge(Lang::$main, Lang::$error));
|
||||
$smarty->assign('announcements', $announcements);
|
||||
$smarty->assign('mysql', DB::Aowow()->getStatistics());
|
||||
$smarty->display('error.tpl');
|
||||
exit();
|
||||
|
||||
@@ -4,11 +4,6 @@ if (!defined('AOWOW_REVISION'))
|
||||
die('illegal access');
|
||||
|
||||
|
||||
// Announcements
|
||||
$announcements = DB::Aowow()->Select('SELECT * FROM ?_announcements WHERE flags & 0x10 AND (page = "maps" OR page = "*")');
|
||||
foreach ($announcements as $k => $v)
|
||||
$announcements[$k]['text'] = Util::localizedString($v, 'text');
|
||||
|
||||
$page = array(
|
||||
'reqCSS' => array(
|
||||
array('string' => 'zone-picker { margin-left: 4px }'),
|
||||
@@ -27,7 +22,6 @@ $page = array(
|
||||
|
||||
$smarty->updatePageVars($page);
|
||||
$smarty->assign('lang', array_merge(Lang::$main, Lang::$maps));
|
||||
$smarty->assign('announcements', $announcements);
|
||||
$smarty->assign('mysql', DB::Aowow()->getStatistics());
|
||||
$smarty->display('maps.tpl');
|
||||
|
||||
|
||||
@@ -6,13 +6,6 @@ if (!defined('AOWOW_REVISION'))
|
||||
|
||||
$petCalc = $pageCall == 'petcalc';
|
||||
|
||||
// Announcements
|
||||
$announcements = DB::Aowow()->Select('SELECT * FROM ?_announcements WHERE flags & 0x10 AND (page = ?s OR page = "*")',
|
||||
$petCalc ? 'petcalc' : 'talent'
|
||||
);
|
||||
foreach ($announcements as $k => $v)
|
||||
$announcements[$k]['text'] = Util::localizedString($v, 'text');
|
||||
|
||||
$page = array(
|
||||
'reqCSS' => array(
|
||||
array('path' => 'template/css/TalentCalc.css', 'condition' => false),
|
||||
@@ -43,7 +36,6 @@ if ($petCalc)
|
||||
$smarty->updatePageVars($page);
|
||||
$smarty->assign('tcType', $petCalc ? 'pc' : 'tc');
|
||||
$smarty->assign('lang', array_merge(Lang::$main, Lang::$talent));
|
||||
$smarty->assign('announcements', $announcements);
|
||||
$smarty->assign('mysql', DB::Aowow()->getStatistics());
|
||||
$smarty->display('talent.tpl');
|
||||
|
||||
|
||||
@@ -102,16 +102,10 @@ $smarty->updatePageVars(array(
|
||||
));
|
||||
|
||||
|
||||
// Announcements
|
||||
$announcements = DB::Aowow()->Select('SELECT * FROM ?_announcements WHERE flags & 0x10 AND (page = "title" OR page = "*")');
|
||||
foreach ($announcements as $k => $v)
|
||||
$announcements[$k]['text'] = Util::localizedString($v, 'text');
|
||||
|
||||
$smarty->assign('community', CommunityContent::getAll(TYPE_TITLE, $id)); // comments, screenshots, videos
|
||||
$smarty->assign('lang', array_merge(Lang::$main));
|
||||
$smarty->assign('data', $pageData);
|
||||
$smarty->assign('mysql', DB::Aowow()->getStatistics());
|
||||
$smarty->assign('announcements', $announcements);
|
||||
$smarty->display('title.tpl');
|
||||
|
||||
?>
|
||||
|
||||
@@ -30,11 +30,6 @@ if (!$smarty->loadCache($cacheKey, $pageData))
|
||||
$smarty->saveCache($cacheKey, $pageData);
|
||||
}
|
||||
|
||||
// Announcements
|
||||
$announcements = DB::Aowow()->Select('SELECT * FROM ?_announcements WHERE flags & 0x10 AND (page = "titles" OR page = "*")');
|
||||
foreach ($announcements as $k => $v)
|
||||
$announcements[$k]['text'] = Util::localizedString($v, 'text');
|
||||
|
||||
$page = array(
|
||||
'tab' => 0, // for g_initHeader($tab)
|
||||
'title' => implode(" - ", $title),
|
||||
@@ -45,7 +40,6 @@ $smarty->updatePageVars($page);
|
||||
$smarty->assign('lang', Lang::$main);
|
||||
$smarty->assign('data', $pageData);
|
||||
$smarty->assign('mysql', DB::Aowow()->getStatistics());
|
||||
$smarty->assign('announcements', $announcements);
|
||||
$smarty->display('titles.tpl');
|
||||
|
||||
?>
|
||||
|
||||
@@ -492,11 +492,6 @@ else /* if ($searchMask & SEARCH_TYPE_REGULAR) */
|
||||
// die();
|
||||
// }
|
||||
|
||||
// Announcements
|
||||
$announcements = DB::Aowow()->Select('SELECT * FROM ?_announcements WHERE flags & 0x10 AND (page = "search" OR page = "*")');
|
||||
foreach ($announcements as $k => $v)
|
||||
$announcements[$k]['text'] = Util::localizedString($v, 'text');
|
||||
|
||||
$vars = array(
|
||||
'title' => $search.' - '.Lang::$search['search'],
|
||||
'tab' => 0, // tabId 0: Database for g_initHeader($tab)
|
||||
@@ -510,7 +505,6 @@ else /* if ($searchMask & SEARCH_TYPE_REGULAR) */
|
||||
$smarty->assign('search', $search);
|
||||
$smarty->assign('mysql', DB::Aowow()->getStatistics());
|
||||
$smarty->assign('util', new Util); // just for debugging / optimizing
|
||||
$smarty->assign('announcements', $announcements);
|
||||
|
||||
$smarty->display('search.tpl');
|
||||
}
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
{include file='header.tpl'}
|
||||
|
||||
<div id="main">
|
||||
|
||||
<div id="main-precontents"></div>
|
||||
<div id="main-precontents" class="main-precontents"></div>
|
||||
<div id="main-contents" class="main-contents">
|
||||
{if !empty($announcements)}
|
||||
{foreach from=$announcements item=item}
|
||||
{include file='bricks/announcement.tpl' an=$item}
|
||||
{/foreach}
|
||||
{/if}
|
||||
|
||||
<div class="pad3"></div>
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
{/foreach}
|
||||
{/if}
|
||||
<div class="text">
|
||||
<a href="http://www.wowhead.com/?{$query}" class="button-red"><em><b><i>Wowhead</i></b><span>Wowhead</span></em></a>
|
||||
<a href="http://www.wowhead.com/?{$query[0]}={$query[1]}" class="button-red"><em><b><i>Wowhead</i></b><span>Wowhead</span></em></a>
|
||||
{if !empty($found)}
|
||||
<h1>{$lang.foundResult} <i>{$search|escape:"html"}</i></h1>
|
||||
</div>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<a href="javascript:;" id="open-links-button" class="button-red" onclick="this.blur(); Links.show({ldelim} type: 11, typeId: {$data.page.id} {rdelim});">
|
||||
<em><b><i>{$lang.link}</i></b><span>{$lang.link}</span></em>
|
||||
</a>
|
||||
<a href="http://old.wowhead.com/?{$query}" class="button-red"><em><b><i>Wowhead</i></b><span>Wowhead</span></em></a>
|
||||
<a href="http://old.wowhead.com/?{$query[0]}={$query[1]}" class="button-red"><em><b><i>Wowhead</i></b><span>Wowhead</span></em></a>
|
||||
<h1 class="h1-icon">{if isset($data.page.expansion)}<span class="{$data.page.expansion}-icon-right">{$data.page.name}</span>{else}{$data.page.name}{/if}</h1>
|
||||
<h2 class="clear">{$lang.related}</h2>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user