|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* |
|
4
|
|
|
* PayPal Donation extension for the phpBB Forum Software package. |
|
5
|
|
|
* |
|
6
|
|
|
* @copyright (c) 2015-2020 Skouat |
|
7
|
|
|
* @license GNU General Public License, version 2 (GPL-2.0) |
|
8
|
|
|
* |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace skouat\ppde\actions; |
|
12
|
|
|
|
|
13
|
|
|
class auth |
|
14
|
|
|
{ |
|
15
|
|
|
protected $auth; |
|
16
|
|
|
protected $auth_admin; |
|
17
|
|
|
protected $phpbb_root_path; |
|
18
|
|
|
protected $php_ext; |
|
19
|
|
|
protected $config; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* currency constructor. |
|
23
|
|
|
* |
|
24
|
|
|
* @param \phpbb\auth\auth $auth Auth Auth object |
|
25
|
|
|
* @param \phpbb\config\config $config Config object |
|
26
|
|
|
* @param string $phpbb_root_path phpBB root path |
|
27
|
|
|
* @param string $php_ext phpEx |
|
28
|
|
|
* |
|
29
|
|
|
* @access public |
|
30
|
|
|
*/ |
|
31
|
|
|
|
|
32
|
|
|
public function __construct( |
|
33
|
|
|
\phpbb\auth\auth $auth, |
|
34
|
|
|
\phpbb\config\config $config, |
|
35
|
|
|
$phpbb_root_path, |
|
36
|
|
|
$php_ext |
|
37
|
|
|
) |
|
38
|
|
|
{ |
|
39
|
|
|
$this->auth = $auth; |
|
40
|
|
|
$this->config = $config; |
|
41
|
|
|
$this->phpbb_root_path = $phpbb_root_path; |
|
42
|
|
|
$this->php_ext = $php_ext; |
|
43
|
|
|
|
|
44
|
|
|
if (!class_exists('auth_admin')) |
|
45
|
|
|
{ |
|
46
|
|
|
include($this->phpbb_root_path . 'includes/acp/auth.' . $this->php_ext); |
|
47
|
|
|
} |
|
48
|
|
|
$this->auth_admin = new \auth_admin(); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
public function set_guest_acl() |
|
52
|
|
|
{ |
|
53
|
|
|
$auth['u_ppde_use'] = (int) $this->config['ppde_allow_guest']; |
|
|
|
|
|
|
54
|
|
|
$auth['u_ppde_view_donorlist'] = (int) $this->config['ppde_ipn_dl_allow_guest']; |
|
55
|
|
|
|
|
56
|
|
|
$this->auth_admin->acl_set('user', [0], [ANONYMOUS], $auth); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* Get template vars |
|
61
|
|
|
* |
|
62
|
|
|
* @return bool |
|
63
|
|
|
* @access public |
|
64
|
|
|
*/ |
|
65
|
|
|
public function guest_can_use_ppde() |
|
66
|
|
|
{ |
|
67
|
|
|
return (bool) $this->auth->acl_get_list(ANONYMOUS, 'u_ppde_use'); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* @return bool |
|
72
|
|
|
* @access public |
|
73
|
|
|
*/ |
|
74
|
|
|
public function can_use_ppde() |
|
75
|
|
|
{ |
|
76
|
|
|
return $this->auth->acl_get('u_ppde_use'); |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
/** |
|
80
|
|
|
* @return bool |
|
81
|
|
|
* @access public |
|
82
|
|
|
*/ |
|
83
|
|
|
public function can_view_ppde_donorlist() |
|
84
|
|
|
{ |
|
85
|
|
|
return $this->auth->acl_get('u_ppde_view_donorlist'); |
|
86
|
|
|
} |
|
87
|
|
|
} |
|
88
|
|
|
|