forked from supertuxkart/stk-addons
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
executable file
·82 lines (77 loc) · 2.7 KB
/
index.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
/**
* copyright 2009 Lucas Baudin <[email protected]>
* 2014-2015 Daniel Butum <danibutum at gmail dot com>
* This file is part of stk-addons.
*
* stk-addons is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* stk-addons is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with stk-addons. If not, see <http://www.gnu.org/licenses/>.
*/
require_once(__DIR__ . DIRECTORY_SEPARATOR . "config.php");
$description = _h('This is the official SuperTuxKart add-on repository. It contains extra karts and tracks for the SuperTuxKart game.');
$tpl = StkTemplate::get('index.tpl')
->assign('title', _h('SuperTuxKart Add-ons'))
->assign("show_stk_image", true)
->setMetaDesc($description)
->addScriptInclude("jquery.newsticker.js")
->addScriptInline('$("#news-messages").newsTicker();', StkTemplate::ORDER_AFTER);
// Display index menu
$type_kart = Addon::typeToString(Addon::KART);
$type_track = Addon::typeToString(Addon::TRACK);
$type_arena = Addon::typeToString(Addon::ARENA);
$tpl->assign(
'index_menu',
[
[
'href' => URL::rewriteFromConfig('addons.php?type=' . $type_kart),
'label' => _h('Karts'),
'type' => $type_kart
],
[
'href' => URL::rewriteFromConfig('addons.php?type=' . $type_track),
'label' => _h('Tracks'),
'type' => $type_track
],
[
'href' => URL::rewriteFromConfig('addons.php?type=' . $type_arena),
'label' => _h('Arenas'),
'type' => $type_arena
],
[
'href' => 'https://github.com/supertuxkart/stk-addons/wiki',
'label' => 'Help',
'type' => 'help'
]
]
);
// Display news messages
$news_messages = News::getWebVisible();
// Note most downloaded track and kart
$pop_kart = Statistic::mostDownloadedAddon(Addon::KART);
$pop_track = Statistic::mostDownloadedAddon(Addon::TRACK);
if ($pop_track !== null)
{
array_unshift(
$news_messages,
sprintf(_h('The most downloaded track is %s.'), $pop_track)
);
}
if ($pop_kart !== null)
{
array_unshift(
$news_messages,
sprintf(_h('The most downloaded kart is %s.'), $pop_kart)
);
}
$tpl->assign('news_messages', $news_messages);
echo $tpl;