-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathIndex.php
More file actions
71 lines (61 loc) · 2.17 KB
/
Index.php
File metadata and controls
71 lines (61 loc) · 2.17 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
66
67
68
69
70
71
<?php
/**
* Copyright (C) 2015-2019 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\Interfaces\ForumSettings;
use FeatherBB\Core\Interfaces\Hooks;
use FeatherBB\Core\Interfaces\Lang;
use FeatherBB\Core\Interfaces\Router;
use FeatherBB\Core\Interfaces\User;
use FeatherBB\Core\Interfaces\View;
use FeatherBB\Core\Track;
use FeatherBB\Core\Utils;
use FeatherBB\Model\Auth;
class Index
{
public function __construct()
{
$this->model = new \FeatherBB\Model\Index();
Lang::load('index');
Lang::load('misc');
}
public function display($req, $res, $args)
{
Hooks::fire('controller.index.index');
return View::setPageInfo([
'title' => [Utils::escape(ForumSettings::get('o_board_title'))],
'active_page' => 'index',
'is_indexed' => true,
'index_data' => $this->model->printCategoriesForums(),
'stats' => $this->model->stats(),
'online' => $this->model->usersOnline(),
'forum_actions' => $this->model->forumActions(),
'cur_cat' => 0
])->addTemplate('@forum/index')->display();
}
public function rules()
{
Hooks::fire('controller.index.rules');
if (ForumSettings::get('o_rules') == '0' || (User::get()->is_guest && !User::can('board.read') && ForumSettings::get('o_regs_allow') == '0')) {
throw new Error(__('Bad request'), 404);
}
return View::setPageInfo([
'title' => [Utils::escape(ForumSettings::get('o_board_title')), __('Forum rules')],
'active_page' => 'rules'
]
)->addTemplate('@forum/misc/rules')->display();
}
public function markread()
{
Hooks::fire('controller.index.markread');
Auth::setLastVisit(User::get()->id, User::get()->logged);
// Reset tracked topics
Track::setTrackedTopics(null);
return Router::redirect(Router::pathFor('home'), __('Mark read redirect'));
}
}