1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* |
5
|
|
|
* @package sitemaker |
6
|
|
|
* @copyright (c) 2013 Daniel A. (blitze) |
7
|
|
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 |
8
|
|
|
* |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace blitze\sitemaker\controller; |
12
|
|
|
|
13
|
|
|
class forum |
14
|
|
|
{ |
15
|
|
|
/** @var \phpbb\auth\auth */ |
16
|
|
|
protected $auth; |
17
|
|
|
|
18
|
|
|
/** @var \phpbb\config\config */ |
19
|
|
|
protected $config; |
20
|
|
|
|
21
|
|
|
/** @var \phpbb\controller\helper */ |
22
|
|
|
protected $helper; |
23
|
|
|
|
24
|
|
|
/** @var \phpbb\template\template */ |
25
|
|
|
protected $template; |
26
|
|
|
|
27
|
|
|
/** @var \phpbb\language\language */ |
28
|
|
|
protected $translator; |
29
|
|
|
|
30
|
|
|
/** @var \phpbb\user */ |
31
|
|
|
protected $user; |
32
|
|
|
|
33
|
|
|
/** @var string phpBB root path */ |
34
|
|
|
protected $phpbb_root_path; |
35
|
|
|
|
36
|
|
|
/** @var string phpEx */ |
37
|
|
|
protected $php_ext; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Constructor |
41
|
|
|
* |
42
|
|
|
* @param \phpbb\auth\auth $auth Auth object |
43
|
|
|
* @param \phpbb\config\config $config Config object |
44
|
|
|
* @param \phpbb\controller\helper $helper Controller Helper object |
45
|
|
|
* @param \phpbb\template\template $template Template object |
46
|
|
|
* @param \phpbb\language\language $translator Language object |
47
|
|
|
* @param \phpbb\user $user User object |
48
|
|
|
* @param string $root_path phpBB root path |
49
|
|
|
* @param string $php_ext phpEx |
50
|
3 |
|
*/ |
51
|
|
|
public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\controller\helper $helper, \phpbb\template\template $template, \phpbb\language\language $translator, \phpbb\user $user, $root_path, $php_ext) |
52
|
3 |
|
{ |
53
|
3 |
|
$this->auth = $auth; |
54
|
3 |
|
$this->config = $config; |
55
|
3 |
|
$this->helper = $helper; |
56
|
3 |
|
$this->template = $template; |
57
|
3 |
|
$this->translator = $translator; |
58
|
3 |
|
$this->user = $user; |
59
|
3 |
|
$this->phpbb_root_path = $root_path; |
60
|
3 |
|
$this->php_ext = $php_ext; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @return \Symfony\Component\HttpFoundation\Response |
65
|
3 |
|
*/ |
66
|
|
|
public function handle() |
67
|
|
|
{ |
68
|
|
|
/** |
69
|
|
|
* This is ugly but the only way I could find |
70
|
|
|
* to fix relative paths for forum images |
71
|
3 |
|
*/ |
72
|
3 |
|
global $phpbb_root_path; |
73
|
|
|
$phpbb_root_path = generate_board_url() . '/'; |
74
|
|
|
|
75
|
|
|
// @codeCoverageIgnoreStart |
76
|
|
|
if (!function_exists('display_forums')) |
77
|
|
|
{ |
78
|
|
|
include($this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext); |
79
|
|
|
} |
80
|
|
|
// @codeCoverageIgnoreEnd |
81
|
3 |
|
|
82
|
3 |
|
display_forums('', $this->config['load_moderators']); |
83
|
|
|
|
84
|
|
|
$this->set_mcp_url(); |
85
|
3 |
|
$this->set_mark_forums_url(); |
86
|
|
|
|
87
|
3 |
|
// restore phpbb_root_path |
88
|
3 |
|
$phpbb_root_path = $this->phpbb_root_path; |
89
|
3 |
|
|
90
|
3 |
|
$this->template->assign_block_vars('navlinks', array( |
91
|
|
|
'FORUM_NAME' => $this->translator->lang('FORUM'), |
92
|
3 |
|
'U_VIEW_FORUM' => $this->helper->route('blitze_sitemaker_forum'), |
93
|
|
|
)); |
94
|
|
|
|
95
|
|
|
return $this->helper->render('index_body.html', $this->translator->lang('FORUM_INDEX')); |
96
|
|
|
} |
97
|
|
|
|
98
|
3 |
|
/** |
99
|
|
|
* @return void |
100
|
3 |
|
*/ |
101
|
3 |
|
protected function set_mcp_url() |
102
|
1 |
|
{ |
103
|
1 |
|
if ($this->auth->acl_get('m_') || $this->auth->acl_getf_global('m_')) |
104
|
3 |
|
{ |
105
|
|
|
$this->template->assign_var('U_MCP', append_sid("{$this->phpbb_root_path}mcp.{$this->php_ext}", 'i=main&mode=front', true, $this->user->session_id)); |
106
|
|
|
} |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* @return void |
111
|
|
|
*/ |
112
|
|
|
protected function set_mark_forums_url() |
113
|
|
|
{ |
114
|
|
|
if ($this->user->data['is_registered'] || $this->config['load_anon_lastread']) |
115
|
|
|
{ |
116
|
|
|
$this->template->assign_var('U_MARK_FORUMS', $this->helper->route('blitze_sitemaker_forum', array( |
117
|
|
|
'hash' => generate_link_hash('global'), |
118
|
|
|
'mark' => 'forums', |
119
|
|
|
'mark_time' => time(), |
120
|
|
|
))); |
121
|
|
|
} |
122
|
|
|
} |
123
|
|
|
} |
124
|
|
|
|