1 | <?php |
||
22 | class admin_controller |
||
23 | { |
||
24 | /** @var manager Topic prefixes manager object */ |
||
25 | protected $manager; |
||
26 | |||
27 | /** @var log phpBB log object */ |
||
28 | protected $log; |
||
29 | |||
30 | /** @var request phpBB request object */ |
||
31 | protected $request; |
||
32 | |||
33 | /** @var template phpBB template object */ |
||
34 | protected $template; |
||
35 | |||
36 | /** @var user phpBB user object */ |
||
37 | protected $user; |
||
38 | |||
39 | /** @var string phpBB root path */ |
||
40 | protected $root_path; |
||
41 | |||
42 | /** @var string PHP extension */ |
||
43 | protected $php_ext; |
||
44 | |||
45 | /** @var string Form key used for form validation */ |
||
46 | protected $form_key; |
||
47 | |||
48 | /** @var int Forum identifier */ |
||
49 | protected $forum_id; |
||
50 | |||
51 | /** @var string Custom form action */ |
||
52 | protected $u_action; |
||
53 | |||
54 | /** |
||
55 | * Constructor |
||
56 | * |
||
57 | * @param manager $manager Topic prefixes manager object |
||
58 | * @param log $log phpBB log object |
||
59 | * @param request $request phpBB request object |
||
60 | * @param template $template phpBB template object |
||
61 | * @param user $user phpBB user object |
||
62 | * @param string $phpbb_root_path phpBB root path |
||
63 | * @param string $phpEx PHP extension |
||
64 | */ |
||
65 | public function __construct(manager $manager, log $log, request $request, template $template, user $user, $phpbb_root_path, $phpEx) |
||
75 | |||
76 | /** |
||
77 | * Main handler, called by the ACP module |
||
78 | * |
||
79 | * @return null |
||
80 | */ |
||
81 | public function main() |
||
109 | |||
110 | /** |
||
111 | * Display topic prefix settings |
||
112 | * |
||
113 | * @return null |
||
114 | */ |
||
115 | public function display_settings() |
||
135 | |||
136 | /** |
||
137 | * Add a prefix |
||
138 | * |
||
139 | * @return null |
||
140 | */ |
||
141 | public function add_prefix() |
||
155 | |||
156 | /** |
||
157 | * Edit a prefix |
||
158 | * |
||
159 | * @param int $prefix_id The prefix identifier to edit |
||
160 | * @return null |
||
161 | */ |
||
162 | public function edit_prefix($prefix_id) |
||
179 | |||
180 | /** |
||
181 | * Delete a prefix |
||
182 | * |
||
183 | * @param int $prefix_id The prefix identifier to delete |
||
184 | * @return null |
||
185 | */ |
||
186 | public function delete_prefix($prefix_id) |
||
211 | |||
212 | /** |
||
213 | * Move a prefix up/down |
||
214 | * |
||
215 | * @param int $prefix_id The prefix identifier to move |
||
216 | * @param string $direction The direction (up|down) |
||
217 | * @param int $amount The amount of places to move (default: 1) |
||
218 | * @return null |
||
219 | */ |
||
220 | public function move_prefix($prefix_id, $direction, $amount = 1) |
||
242 | |||
243 | /** |
||
244 | * Set u_action |
||
245 | * |
||
246 | * @param string $u_action Custom form action |
||
247 | * @return admin_controller |
||
248 | */ |
||
249 | public function set_u_action($u_action) |
||
254 | |||
255 | /** |
||
256 | * Set forum ID |
||
257 | * |
||
258 | * @param int $forum_id Forum identifier |
||
259 | * @return admin_controller |
||
260 | */ |
||
261 | public function set_forum_id($forum_id) |
||
266 | |||
267 | /** |
||
268 | * Check link hash helper |
||
269 | * |
||
270 | * @param string $hash A hashed string |
||
271 | * @return bool True if hash matches, false if not |
||
272 | */ |
||
273 | protected function check_hash($hash) |
||
277 | |||
278 | /** |
||
279 | * Trigger a message and back link for error/success dialogs |
||
280 | * |
||
281 | * @param string $message A language key |
||
282 | * @param int $error Error type constant, optional |
||
283 | * @return null |
||
284 | */ |
||
285 | protected function trigger_message($message = '', $error = E_USER_NOTICE) |
||
289 | |||
290 | /** |
||
291 | * Helper for logging topic prefix admin actions |
||
292 | * |
||
293 | * @param string $tag The topic prefix tag |
||
294 | * @param string $message The log action language key |
||
295 | * @return null |
||
296 | */ |
||
297 | protected function log($tag, $message) |
||
303 | |||
304 | /** |
||
305 | * Get a forum's information |
||
306 | * |
||
307 | * @param int $forum_id |
||
308 | * @return mixed Array with the current row, false, if the row does not exist |
||
309 | */ |
||
310 | protected function get_forum_info($forum_id) |
||
321 | } |
||
322 |