forked from featherbb/featherbb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIndex.php
More file actions
65 lines (55 loc) · 2.05 KB
/
Copy pathIndex.php
File metadata and controls
65 lines (55 loc) · 2.05 KB
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
<?php
/**
* Copyright (C) 2015-2016 FeatherBB
* based on code by (C) 2008-2015 FluxBB
* and Rickard Andersson (C) 2002-2008 PunBB
* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
*/
namespace FeatherBB\Controller;
use FeatherBB\Core\Error;
use FeatherBB\Core\Track;
use FeatherBB\Core\Url;
use FeatherBB\Core\Utils;
use FeatherBB\Model\Auth;
class Index
{
public function __construct()
{
$this->model = new \FeatherBB\Model\Index();
translate('index');
translate('misc');
}
public function display($req, $res, $args)
{
Container::get('hooks')->fire('controller.index.index');
View::setPageInfo(array(
'title' => array(Utils::escape(ForumSettings::get('o_board_title'))),
'active_page' => 'index',
'is_indexed' => true,
'index_data' => $this->model->print_categories_forums(),
'stats' => $this->model->collect_stats(),
'online' => $this->model->fetch_users_online(),
'forum_actions' => $this->model->get_forum_actions(),
'cur_cat' => 0
))->addTemplate('index.php')->display();
}
public function rules()
{
Container::get('hooks')->fire('controller.index.rules');
if (ForumSettings::get('o_rules') == '0' || (User::get()->is_guest && User::get()->g_read_board == '0' && ForumSettings::get('o_regs_allow') == '0')) {
throw new Error(__('Bad request'), 404);
}
View::setPageInfo(array(
'title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Forum rules')),
'active_page' => 'rules'
))->addTemplate('misc/rules.php')->display();
}
public function markread()
{
Container::get('hooks')->fire('controller.index.markread');
Auth::set_last_visit(User::get()->id, User::get()->logged);
// Reset tracked topics
Track::set_tracked_topics(null);
return Router::redirect(Router::pathFor('home'), __('Mark read redirect'));
}
}