Passed
Push — master ( 360e2b...e8c113 )
by Dark❶
04:59 queued 04:44
created

controller/acp_memberlist.php (9 issues)

Severity
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\avatar;
23
24
/**
25
 * Member Avatar & Status [MAS] ACP controller Memberlist.
26
 */
27
class acp_memberlist extends acp_base
28
{
29
	/** @var \phpbb\config\config */
0 ignored issues
show
Either use statement or full name must be used.
Loading history...
30
	protected $config;
31
32
	/** @var \dark1\memberavatarstatus\core\avatar*/
0 ignored issues
show
Either use statement or full name must be used.
Loading history...
33
	protected $avatar;
34
35
	/**
36
	 * Constructor.
37
	 *
38
	 * @param \phpbb\language\language					$language	Language object
0 ignored issues
show
Either use statement or full name must be used.
Loading history...
39
	 * @param \phpbb\log\log							$log		Log object
0 ignored issues
show
Either use statement or full name must be used.
Loading history...
40
	 * @param \phpbb\request\request					$request	Request object
0 ignored issues
show
Either use statement or full name must be used.
Loading history...
41
	 * @param \phpbb\template\template					$template	Template object
0 ignored issues
show
Either use statement or full name must be used.
Loading history...
42
	 * @param \phpbb\user								$user		User object
0 ignored issues
show
Either use statement or full name must be used.
Loading history...
43
	 * @param \phpbb\config\config						$config		Config object
0 ignored issues
show
Either use statement or full name must be used.
Loading history...
44
	 * @param \dark1\memberavatarstatus\core\avatar		$avatar		dark1 avatar
0 ignored issues
show
Either use statement or full name must be used.
Loading history...
45
	 */
46
	public function __construct(language $language, log $log, request $request, template $template, user $user, config $config, avatar $avatar)
47
	{
48
		parent::__construct($language, $log, $request, $template, $user);
49
50
		$this->config	= $config;
51
		$this->avatar	= $avatar;
52
	}
53
54
	/**
55
	 * Display the options a user can configure for Memberlist 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_ml_av', $this->request->variable('dark1_mas_ml_av', 0));
69
			$this->config->set('dark1_mas_ml_ol', $this->request->variable('dark1_mas_ml_ol', 0));
70
			$this->config->set('dark1_mas_ml_av_sz', $this->avatar->mas_get_avatar_size($this->request->variable('dark1_mas_ml_av_sz', avatar::AV_DEF_SZ_BIG), avatar::AV_DEF_SZ_BIG, avatar::AV_MAX_SZ_BIG));
71
72
			$this->success_form_on_submit();
73
		}
74
75
		// Set output variables for display in the template
76
		$this->template->assign_vars([
77
			'MAS_COLOR_OFFLINE'	=> $this->config['dark1_mas_col_off'],
78
			'MAS_COLOR_ONLINE'	=> $this->config['dark1_mas_col_on'],
79
			'MAS_ML_AVATAR'		=> $this->config['dark1_mas_ml_av'],
80
			'MAS_ML_AV_SIZE'	=> $this->config['dark1_mas_ml_av_sz'],
81
			'MAS_ML_ONLINE'		=> $this->config['dark1_mas_ml_ol'],
82
			'MAS_NO_AVATAR_IMG'	=> $this->avatar->mas_get_no_avatar_img(),
83
		]);
84
	}
85
}
86