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