-
Notifications
You must be signed in to change notification settings - Fork 217
/
Copy pathhome.php
64 lines (49 loc) · 2.21 KB
/
home.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
if (!defined('AOWOW_REVISION'))
die('illegal access');
class HomePage extends GenericPage
{
protected $tpl = 'home';
protected $scripts = array(
[SC_JS_FILE, 'js/home.js'],
[SC_CSS_FILE, 'css/home.css'],
[SC_CSS_STRING, '.announcement { margin: auto; max-width: 1200px; padding: 0px 15px 15px 15px }']
);
protected $featuredBox = [];
protected $oneliner = '';
protected $homeTitle = '';
public function __construct()
{
parent::__construct('home');
}
protected function generateContent()
{
// load oneliner
if ($_ = DB::Aowow()->selectRow('SELECT * FROM ?_home_oneliner WHERE active = 1 LIMIT 1'))
$this->oneliner = Util::jsEscape(Util::localizedString($_, 'text'));
// load featuredBox (user web server time)
$this->featuredBox = DB::Aowow()->selectRow('SELECT id as ARRAY_KEY, n.* FROM ?_home_featuredbox n WHERE ?d BETWEEN startDate AND endDate ORDER BY id DESC LIMIT 1', time());
if (!$this->featuredBox)
return;
$this->featuredBox = Util::defStatic($this->featuredBox);
$this->featuredBox['text'] = Util::localizedString($this->featuredBox, 'text', true);
if ($_ = (new Markup($this->featuredBox['text']))->parseGlobalsFromText())
$this->extendGlobalData($_);
if (empty($this->featuredBox['boxBG']))
$this->featuredBox['boxBG'] = Cfg::get('STATIC_URL').'/images/'.User::$localeString.'/mainpage-bg-news.jpg';
// load overlay links
$this->featuredBox['overlays'] = DB::Aowow()->select('SELECT * FROM ?_home_featuredbox_overlay WHERE featureId = ?d', $this->featuredBox['id']);
foreach ($this->featuredBox['overlays'] as &$o)
{
$o['title'] = Util::localizedString($o, 'title', true);
$o['title'] = Util::defStatic($o['title']);
}
}
protected function generateTitle()
{
if ($_ = DB::Aowow()->selectCell('SELECT title FROM ?_home_titles WHERE active = 1 AND locale = ?d ORDER BY RAND() LIMIT 1', User::$localeId))
$this->homeTitle = Cfg::get('NAME').Lang::main('colon').$_;
}
protected function generatePath() {}
}
?>