Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 45 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
||
| 1 | <?php |
| 2 | /** |
| 3 | * |
| 4 | * This file is part of the phpBB Forum Software package. |
| 5 | * |
| 6 | * @copyright (c) phpBB Limited <https://www.phpbb.com> |
| 7 | * @license GNU General Public License, version 2 (GPL-2.0) |
| 8 | * |
| 9 | * For full copyright and license information, please see |
| 10 | * the docs/CREDITS.txt file. |
| 11 | * |
| 12 | */ |
| 13 | |
| 14 | /** |
| 15 | */ |
| 16 | define('IN_PHPBB', true); |
| 17 | define('ADMIN_START', true); |
| 18 | |
| 19 | // Include files |
| 20 | $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../'; |
| 21 | $phpEx = substr(strrchr(__FILE__, '.'), 1); |
| 22 | require($phpbb_root_path . 'common.' . $phpEx); |
| 23 | require($phpbb_root_path . 'includes/functions_acp.' . $phpEx); |
| 24 | require($phpbb_root_path . 'includes/functions_admin.' . $phpEx); |
| 25 | require($phpbb_root_path . 'includes/functions_module.' . $phpEx); |
| 26 | |
| 27 | // Start session management |
| 28 | $user->session_begin(); |
| 29 | $auth->acl($user->data); |
| 30 | $user->setup('acp/common'); |
| 31 | // End session management |
| 32 | |
| 33 | // Have they authenticated (again) as an admin for this session? |
| 34 | if (!isset($user->data['session_admin']) || !$user->data['session_admin']) |
| 35 | { |
| 36 | login_box('', $user->lang['LOGIN_ADMIN_CONFIRM'], $user->lang['LOGIN_ADMIN_SUCCESS'], true, false); |
| 37 | } |
| 38 | |
| 39 | // Is user any type of admin? No, then stop here, each script needs to |
| 40 | // check specific permissions but this is a catchall |
| 41 | if (!$auth->acl_get('a_')) |
| 42 | { |
| 43 | send_status_line(403, 'Forbidden'); |
| 44 | trigger_error('NO_ADMIN'); |
| 45 | } |
| 46 | |
| 47 | // We define the admin variables now, because the user is now able to use the admin related features... |
| 48 | define('IN_ADMIN', true); |
| 49 | |
| 50 | // Some oft used variables |
| 51 | $file_uploads = (@ini_get('file_uploads') == '1' || strtolower(@ini_get('file_uploads')) === 'on') ? true : false; |
| 52 | $module_id = $request->variable('i', ''); |
| 53 | $mode = $request->variable('mode', ''); |
| 54 | |
| 55 | // Set custom style for admin area |
| 56 | /** @var \phpbb\template\base $template */ |
| 57 | $template->set_custom_style( |
| 58 | [ |
| 59 | [ |
| 60 | 'name' => 'adm', |
| 61 | 'ext_path' => 'adm/style/', |
| 62 | ] |
| 63 | ], |
| 64 | [ |
| 65 | $phpbb_admin_path . 'style', |
| 66 | $phpbb_root_path . 'styles/all/imgs/', |
| 67 | $phpbb_root_path . 'styles/all/template/', |
| 68 | ], |
| 69 | ); |
| 70 | |
| 71 | $template->assign_var('T_ASSETS_PATH', $phpbb_path_helper->update_web_root_path($phpbb_root_path . 'assets')); |
| 72 | $template->assign_var('T_TEMPLATE_PATH', $phpbb_path_helper->update_web_root_path($phpbb_root_path . 'style')); |
| 73 | |
| 74 | // Instantiate new module |
| 75 | $module = new p_master(); |
| 76 | |
| 77 | // Instantiate module system and generate list of available modules |
| 78 | $module->list_modules('acp'); |
| 79 | |
| 80 | // Select the active module |
| 81 | $module->set_active($module_id, $mode); |
| 82 | |
| 83 | // Assign data to the template engine for the list of modules |
| 84 | // We do this before loading the active module for correct menu display in trigger_error |
| 85 | $module->assign_tpl_vars(append_sid("{$phpbb_admin_path}index.$phpEx")); |
| 86 | |
| 87 | // Load and execute the relevant module |
| 88 | $module->load_active(); |
| 89 | |
| 90 | // Generate the page |
| 91 | adm_page_header($module->get_page_title()); |
| 92 | |
| 93 | $template->set_filenames(array( |
| 94 | 'body' => $module->get_tpl_name(), |
| 95 | )); |
| 96 | |
| 97 | adm_page_footer(); |