1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* |
4
|
|
|
* Ideas extension for the phpBB Forum Software package. |
5
|
|
|
* |
6
|
|
|
* @copyright (c) phpBB Limited <https://www.phpbb.com> |
7
|
|
|
* @license GNU General Public License, version 2 (GPL-2.0) |
8
|
|
|
* |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace phpbb\ideas\acp; |
12
|
|
|
|
13
|
|
|
class ideas_module |
14
|
|
|
{ |
15
|
|
|
/** @var string */ |
16
|
|
|
public $page_title; |
17
|
|
|
|
18
|
|
|
/** @var string */ |
19
|
|
|
public $tpl_name; |
20
|
|
|
|
21
|
|
|
/** @var string */ |
22
|
|
|
public $u_action; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* Main ACP module |
26
|
|
|
* |
27
|
|
|
* @access public |
28
|
|
|
* @throws \Exception |
29
|
|
|
*/ |
30
|
|
|
public function main() |
31
|
|
|
{ |
32
|
|
|
global $phpbb_container; |
33
|
|
|
|
34
|
|
|
// Load a template from adm/style for our ACP page |
35
|
|
|
$this->tpl_name = 'acp_phpbb_ideas'; |
36
|
|
|
|
37
|
|
|
// Set the page title for our ACP page |
38
|
|
|
$this->page_title = 'ACP_PHPBB_IDEAS_SETTINGS'; |
39
|
|
|
|
40
|
|
|
$language = $phpbb_container->get('language'); |
41
|
|
|
$request = $phpbb_container->get('request'); |
42
|
|
|
|
43
|
|
|
// Get an instance of the admin controller |
44
|
|
|
/** @var \phpbb\ideas\controller\admin_controller $admin_controller */ |
45
|
|
|
$admin_controller = $phpbb_container->get('phpbb.ideas.admin.controller'); |
46
|
|
|
|
47
|
|
|
// Add the phpBB Ideas ACP lang file |
48
|
|
|
$language->add_lang('phpbb_ideas_acp', 'phpbb/ideas'); |
49
|
|
|
|
50
|
|
|
// Make the $u_action url available in the admin controller |
51
|
|
|
$admin_controller->set_page_url($this->u_action); |
52
|
|
|
|
53
|
|
|
// Create a form key for preventing CSRF attacks |
54
|
|
|
add_form_key('acp_phpbb_ideas_settings'); |
55
|
|
|
|
56
|
|
|
// Apply Ideas configuration settings |
57
|
|
|
if ($request->is_set_post('submit')) |
58
|
|
|
{ |
59
|
|
|
$admin_controller->set_config_options(); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
// Set Ideas forum options and registered user group forum permissions |
63
|
|
|
if ($request->is_set_post('ideas_forum_setup')) |
64
|
|
|
{ |
65
|
|
|
$admin_controller->set_ideas_forum_options(); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
// Display/set ACP configuration settings |
69
|
|
|
$admin_controller->display_options(); |
70
|
|
|
} |
71
|
|
|
} |
72
|
|
|
|