1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* |
4
|
|
|
* Member Avatar & Status [MAS]. An extension for the phpBB Forum Software package. |
5
|
|
|
* |
6
|
|
|
* @copyright (c) 2018-2020, Dark❶ [dark1] |
7
|
|
|
* @license GNU General Public License, version 2 (GPL-2.0-only) |
8
|
|
|
* |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace dark1\memberavatarstatus\controller; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* @ignore |
15
|
|
|
*/ |
16
|
|
|
use phpbb\language\language; |
17
|
|
|
use phpbb\log\log; |
18
|
|
|
use phpbb\request\request; |
19
|
|
|
use phpbb\template\template; |
20
|
|
|
use phpbb\user; |
21
|
|
|
use phpbb\config\config; |
22
|
|
|
use dark1\memberavatarstatus\core\status; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* Member Avatar & Status [MAS] ACP controller General. |
26
|
|
|
*/ |
27
|
|
|
class acp_general extends acp_base |
28
|
|
|
{ |
29
|
|
|
/** @var \phpbb\config\config */ |
30
|
|
|
protected $config; |
31
|
|
|
|
32
|
|
|
/** @var \dark1\memberavatarstatus\core\status*/ |
33
|
|
|
protected $status; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Constructor. |
37
|
|
|
* |
38
|
|
|
* @param \phpbb\language\language $language Language object |
39
|
|
|
* @param \phpbb\log\log $log Log object |
40
|
|
|
* @param \phpbb\request\request $request Request object |
41
|
|
|
* @param \phpbb\template\template $template Template object |
42
|
|
|
* @param \phpbb\user $user User object |
43
|
|
|
* @param \phpbb\config\config $config Config object |
44
|
|
|
* @param \dark1\memberavatarstatus\core\status $status dark1 status |
45
|
|
|
*/ |
46
|
|
|
public function __construct(language $language, log $log, request $request, template $template, user $user, config $config, status $status) |
47
|
|
|
{ |
48
|
|
|
parent::__construct($language, $log, $request, $template, $user); |
49
|
|
|
|
50
|
|
|
$this->config = $config; |
51
|
|
|
$this->status = $status; |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Display the options a user can configure for General Mode. |
56
|
|
|
* |
57
|
|
|
* @return void |
58
|
|
|
* @access public |
59
|
|
|
*/ |
60
|
|
|
public function handle() |
61
|
|
|
{ |
62
|
|
|
// Is the form being submitted to us? |
63
|
|
|
if ($this->request->is_set_post('submit')) |
64
|
|
|
{ |
65
|
|
|
$this->check_form_on_submit(); |
66
|
|
|
|
67
|
|
|
// Set the options the user configured |
68
|
|
|
$this->config->set('dark1_mas_avatar', $this->request->variable('dark1_mas_avatar', 0)); |
69
|
|
|
$this->config->set('dark1_mas_online', $this->request->variable('dark1_mas_online', 0)); |
70
|
|
|
$this->config->set('dark1_mas_col_off', $this->status->mas_config_color('off', $this->request->variable('dark1_mas_col_off', status::COL_DEF_OFF))); |
71
|
|
|
$this->config->set('dark1_mas_col_on', $this->status->mas_config_color('on', $this->request->variable('dark1_mas_col_on', status::COL_DEF_ON))); |
72
|
|
|
|
73
|
|
|
$this->success_form_on_submit(); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
// Set output variables for display in the template |
77
|
|
|
$this->template->assign_vars([ |
78
|
|
|
'MAS_AVATAR' => $this->config['dark1_mas_avatar'], |
79
|
|
|
'MAS_ONLINE' => $this->config['dark1_mas_online'], |
80
|
|
|
'MAS_COLOR_OFFLINE' => $this->config['dark1_mas_col_off'], |
81
|
|
|
'MAS_COLOR_ONLINE' => $this->config['dark1_mas_col_on'], |
82
|
|
|
]); |
83
|
|
|
} |
84
|
|
|
} |
85
|
|
|
|