Completed
Push — develop ( cdfa3b...22e8b5 )
by Daniel
08:38
created

setup::set_js_vars()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 6
cts 6
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 *
4
 * @package sitemaker
5
 * @copyright (c) 2017 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\services\filemanager;
11
12
/**
13
* @package sitemaker
14
*/
15
class setup
16
{
17
	/** @var \phpbb\auth\auth */
18
	protected $auth;
19
20
	/** @var \phpbb\config\config */
21
	protected $config;
22
23
	/** @var \phpbb\template\template */
24
	protected $template;
25
26
	/** @var \phpbb\user */
27
	protected $user;
28
29
	/** @var string */
30
	protected $config_path;
31
32
	/**
33
	 * Constructor
34
	 *
35
	 * @param \phpbb\auth\auth				$auth				Auth object
36
	 * @param \phpbb\config\config			$config				Config object
37
	 * @param \phpbb\template\template		$template			Template object
38
	 * @param \phpbb\user					$user				User object
39
	 */
40 12
	public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\template\template $template, \phpbb\user $user, $config_path)
41
	{
42 12
		$this->auth = $auth;
43 12
		$this->config = $config;
44 12
		$this->template = $template;
45 12
		$this->user = $user;
46 12
		$this->config_path = $config_path;
47 12
	}
48
49
	/**
50
	 * @return bool
51
	 */
52 4
	public function is_enabled()
53
	{
54 4
		return is_dir($this->config_path) && $this->config['sm_filemanager'] && $this->auth->acl_get('u_sm_filemanager');
55
	}
56
57
	/**
58
	 * @return void
59
	 */
60 4
	public function get_access_key()
61
	{
62 4
		return sha1($this->user->data['user_form_salt'] . 'filemanager');
63
	}
64
}
65