Example #1
0
/**
 * Check if we can process current step
 *
 * @param string Step name
 * @return boolean TRUE - step is available to process
 */
function phpbb_check_step($step_name)
{
    $steps_levels = array('users' => 1, 'forums' => 2, 'topics' => 3, 'replies' => 4, 'messages' => 5);
    if (empty($steps_levels[$step_name])) {
        // Invalid step name!
        return false;
    }
    $current_step = phpbb_get_var('current_step');
    if (empty($current_step)) {
        // It is first step
        phpbb_set_var('current_step', $step_name, true);
        return true;
    } else {
        if (empty($steps_levels[$current_step])) {
            // Invalid current step name!
            return false;
        } else {
            if ($steps_levels[$step_name] <= $steps_levels[$current_step]) {
                // User tries open previous step that already been processed
                phpbb_log(T_('This import step has already been processed.'), 'error', ' ');
                // Continue button
                // echo '<input type="submit" class="SaveButton" value="'.( $steps_levels[ $step_name ] < max( $steps_levels ) ? T_('Continue !') : T_('Go to Forum') ).'" name="submit" />';
                return false;
            }
        }
    }
    // Save step name in the Sessions
    phpbb_set_var('current_step', $step_name, true);
    return true;
}
Example #2
0
     break;
 case "users":
     // Action for Step 2
     // Check that this action request is not a CSRF hacked request:
     $Session->assert_received_crumb('phpbb');
     $phpbb_ranks = param('phpbb_ranks', 'array/integer', array());
     $phpbb_group_default = param('phpbb_group_default', 'integer');
     $phpbb_group_invalid = param('phpbb_group_invalid', 'integer');
     param_check_not_empty('phpbb_group_default', T_('Please select a default group!'));
     phpbb_set_var('ranks', $phpbb_ranks);
     phpbb_set_var('group_default', $phpbb_group_default);
     phpbb_set_var('group_invalid', $phpbb_group_invalid);
     $phpbb_categories = param('phpbb_categories', 'array/integer', array());
     $phpbb_forums = param('phpbb_forums', 'array/integer', array());
     phpbb_set_var('import_categories', $phpbb_categories);
     phpbb_set_var('import_forums', $phpbb_forums);
     if (empty($phpbb_categories) && empty($phpbb_forums)) {
         $Messages->add(T_('Please select at least one forum to import!'));
     }
     if (param_errors_detected()) {
         $step = 'groups';
         break;
     }
     // Set this action to complete all processes in the form
     $flush_action = 'users';
     $step = 'users';
     break;
 case 'forums':
     // Action for Step 3
 // Action for Step 3
 case 'topics':