1 | <?php |
||
14 | class manager |
||
15 | { |
||
16 | /** @var \phpbb\auth\auth */ |
||
17 | protected $auth; |
||
18 | |||
19 | /** @var \phpbb\cache\driver\driver_interface */ |
||
20 | protected $cache; |
||
21 | |||
22 | /** @var \phpbb\config\config */ |
||
23 | protected $config; |
||
24 | |||
25 | /** @var \phpbb\db\driver\driver_interface */ |
||
26 | protected $db; |
||
27 | |||
28 | /** @var \phpbb\user */ |
||
29 | protected $user; |
||
30 | |||
31 | /** @var \acp_forums */ |
||
32 | protected $forum; |
||
33 | |||
34 | /** @var string */ |
||
35 | protected $phpbb_root_path; |
||
36 | |||
37 | /** @var string */ |
||
38 | protected $php_ext; |
||
39 | |||
40 | /** |
||
41 | * Constructor |
||
42 | * |
||
43 | * @param \phpbb\auth\auth $auth Auth object |
||
44 | * @param \phpbb\cache\driver\driver_interface $cache Cache driver interface |
||
45 | * @param \phpbb\config\config $config Config object |
||
46 | * @param \phpbb\db\driver\driver_interface $db Database object |
||
47 | * @param \phpbb\user $user User object |
||
48 | * @param string $phpbb_root_path Path to the phpbb includes directory. |
||
49 | * @param string $php_ext php file extension |
||
50 | */ |
||
51 | 1 | public function __construct(\phpbb\auth\auth $auth, \phpbb\cache\driver\driver_interface $cache, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\user $user, $phpbb_root_path, $php_ext) |
|
52 | { |
||
53 | 1 | $this->auth = $auth; |
|
54 | 1 | $this->cache = $cache; |
|
55 | 1 | $this->config = $config; |
|
56 | 1 | $this->db = $db; |
|
57 | 1 | $this->user = $user; |
|
58 | 1 | $this->phpbb_root_path = $phpbb_root_path; |
|
59 | 1 | $this->php_ext = $php_ext; |
|
60 | |||
61 | 1 | if (!class_exists('acp_forums')) |
|
62 | 1 | { |
|
63 | include($this->phpbb_root_path . 'includes/acp/acp_forums.' . $this->php_ext); |
||
64 | } |
||
65 | |||
66 | 1 | $this->user->add_lang('acp/forums'); |
|
67 | 1 | } |
|
68 | |||
69 | public function add(array &$forum_data, $forum_perm_from = 0) |
||
70 | { |
||
71 | $forum_data += array( |
||
72 | 'parent_id' => $this->config['sitemaker_parent_forum_id'], |
||
73 | ); |
||
74 | |||
75 | $errors = admin::save($forum_data); |
||
76 | |||
77 | if (!sizeof($errors)) |
||
78 | { |
||
79 | $forum_data['forum_id'] = (int) $forum_data['forum_id']; |
||
80 | |||
81 | // Copy permissions? |
||
82 | if ($forum_perm_from && $forum_perm_from != $forum_data['forum_id']) |
||
83 | { |
||
84 | copy_forum_permissions($forum_perm_from, $forum_data['forum_id'], false, false); |
||
85 | phpbb_cache_moderators($this->db, $this->cache, $this->auth); |
||
86 | } |
||
87 | |||
88 | $this->auth->acl_clear_prefetch(); |
||
89 | $this->cache->destroy('sql', FORUMS_TABLE); |
||
90 | } |
||
91 | |||
92 | return $errors; |
||
93 | } |
||
94 | |||
95 | 1 | public function remove($forum_id, $action_posts = 'delete', $action_subforums = 'delete', $posts_to_id = 0, $subforums_to_id = 0) |
|
99 | } |
||
100 |