phpbb-extensions /
mediaembed
| 1 | <?php |
||||
| 2 | /** |
||||
| 3 | * |
||||
| 4 | * phpBB Media Embed PlugIn extension for the phpBB Forum Software package. |
||||
| 5 | * |
||||
| 6 | * @copyright (c) 2016 phpBB Limited <https://www.phpbb.com> |
||||
| 7 | * @license GNU General Public License, version 2 (GPL-2.0) |
||||
| 8 | * |
||||
| 9 | */ |
||||
| 10 | |||||
| 11 | namespace phpbb\mediaembed\acp; |
||||
| 12 | |||||
| 13 | /** |
||||
| 14 | * phpBB Media Embed Plugin ACP module. |
||||
| 15 | */ |
||||
| 16 | class main_module |
||||
| 17 | { |
||||
| 18 | /** @var string $page_title */ |
||||
| 19 | public $page_title; |
||||
| 20 | |||||
| 21 | /** @var string $tpl_name */ |
||||
| 22 | public $tpl_name; |
||||
| 23 | |||||
| 24 | /** @var string $u_action */ |
||||
| 25 | public $u_action; |
||||
| 26 | |||||
| 27 | /** |
||||
| 28 | * Main ACP module |
||||
| 29 | * |
||||
| 30 | * @param int $id The module ID (not used) |
||||
| 31 | * @param string $mode The module mode (manage|settings) |
||||
| 32 | * @throws \Exception |
||||
| 33 | */ |
||||
| 34 | public function main($id, $mode) |
||||
| 35 | { |
||||
| 36 | global $phpbb_container; |
||||
| 37 | |||||
| 38 | $mode = strtolower($mode); |
||||
| 39 | |||||
| 40 | /** @var \phpbb\mediaembed\controller\acp_controller $acp_controller */ |
||||
| 41 | $acp_controller = $phpbb_container->get('phpbb.mediaembed.acp_controller'); |
||||
| 42 | |||||
| 43 | // Make the $u_action url available in the admin controller |
||||
| 44 | $acp_controller->set_page_url($this->u_action); |
||||
| 45 | |||||
| 46 | // Load a template from adm/style for our ACP page |
||||
| 47 | $this->tpl_name = 'acp_phpbb_mediaembed_' . $mode; |
||||
| 48 | |||||
| 49 | // Set the page title for our ACP page |
||||
| 50 | $this->page_title = 'ACP_MEDIA_' . strtoupper($mode); |
||||
| 51 | |||||
| 52 | $form_key = 'phpbb/mediaembed'; |
||||
| 53 | add_form_key($form_key); |
||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||
| 54 | |||||
| 55 | /** @var \phpbb\request\request $request */ |
||||
| 56 | $request = $phpbb_container->get('request'); |
||||
| 57 | if ($request->is_set_post('action_purge_cache')) |
||||
| 58 | { |
||||
| 59 | $result = $acp_controller->purge_mediaembed_cache(); |
||||
| 60 | trigger_error($result['message'] . adm_back_link($this->u_action), $result['code']); |
||||
|
0 ignored issues
–
show
The function
adm_back_link was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 61 | } |
||||
| 62 | |||||
| 63 | if ($request->is_set_post('submit')) |
||||
| 64 | { |
||||
| 65 | if (!check_form_key($form_key)) |
||||
|
0 ignored issues
–
show
The function
check_form_key was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 66 | { |
||||
| 67 | $language = $phpbb_container->get('language'); |
||||
| 68 | trigger_error($language->lang('FORM_INVALID'), E_USER_WARNING); |
||||
| 69 | } |
||||
| 70 | |||||
| 71 | $result = $acp_controller->{'save_' . $mode}(); |
||||
| 72 | trigger_error($result['message'] . adm_back_link($this->u_action), $result['code']); |
||||
| 73 | } |
||||
| 74 | |||||
| 75 | $acp_controller->{'display_' . $mode}(); |
||||
| 76 | } |
||||
| 77 | } |
||||
| 78 |