Esempio n. 1
0
// From this point we'll be able to use the full STK layout
$template->assign_var('S_STK_FULL_BODY', true);
// Perform some quick tasks here that require the user to be authenticated
perform_authed_quick_tasks($action);
// If they canceled redirect them to the STK index.
if (isset($_POST['cancel'])) {
    redirect(append_sid(STK_INDEX, false, true, $user->session_id));
}
// Setup the plugin manager
$plugin = new plugin();
// Output common stuff
$template->assign_vars(array('U_ACTION' => append_sid(STK_INDEX, $plugin->url_arg(), true, $user->session_id), 'U_ADM_INDEX' => append_sid(PHPBB_ROOT_PATH . 'adm/index.' . PHP_EXT, false, true, $user->session_id), 'U_STK_INDEX' => append_sid(STK_INDEX, false, true, $user->session_id), 'U_STK_LOGOUT' => append_sid(STK_INDEX, 'action=stklogout', true, $user->session_id), 'U_BACK_TOOL' => $plugin->get_part('t') ? append_sid(STK_INDEX, $plugin->url_arg(), true, $user->session_id) : false, 'U_INDEX' => append_sid(PHPBB_ROOT_PATH . 'index.' . PHP_EXT), 'U_LOGOUT' => append_sid(PHPBB_ROOT_PATH . 'ucp.' . PHP_EXT, 'mode=logout', true, $user->session_id), 'USERNAME' => $user->data['username']));
// Does the user want to run a tool?
if ($plugin->get_part('t')) {
    // Load the tool
    $tool = $plugin->load_tool($plugin->get_part('c'), $plugin->get_part('t'));
    // Can we use this tool?
    if (method_exists($tool, 'tool_active')) {
        if (($msg = $tool->tool_active()) !== true) {
            if ($msg === false) {
                $msg = $user->lang['TOOL_NOT_AVAILABLE'];
            } else {
                $msg = isset($user->lang[$msg]) ? $user->lang[$msg] : $msg;
            }
            trigger_error($msg);
        }
    }
    $error = array();
    if ($submit) {
        // In run_tool do whatever is required.  If there is an error, put it into the array and the display options will be ran again
        $tool->run_tool($error);