Exemple #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;
}
 * @package admin
 */
if (!defined('EVO_MAIN_INIT')) {
    die('Please, do not access this page directly.');
}
global $dispatcher, $flush_action;
phpbb_display_steps(6);
$Form = new Form();
$Form->begin_form('fform', T_('phpBB Importer') . ' - ' . T_('Step 6: Import replies'));
evo_flush();
$Form->add_crumb('phpbb');
$Form->hidden_ctrl();
$Form->hidden('action', 'messages');
if ($flush_action == 'replies') {
    $Form->begin_fieldset(T_('Import log'));
    // Import the replies into the comments
    phpbb_import_replies();
    $Form->end_fieldset();
}
$Form->begin_fieldset(T_('Report of the replies import'));
$Form->info(T_('Count of the imported replies'), '<b>' . (int) phpbb_get_var('replies_count_imported') . '</b>');
$Form->info(T_('Count of the imported topics'), (int) phpbb_get_var('topics_count_imported'));
$Form->info(T_('Count of the imported forums'), (int) phpbb_get_var('forums_count_imported'));
$Form->info(T_('Count of the imported users'), (int) phpbb_get_var('users_count_imported'));
$Form->info(T_('Count of the updated users'), (int) phpbb_get_var('users_count_updated'));
$BlogCache =& get_BlogCache();
$Blog =& $BlogCache->get_by_ID(phpbb_get_var('blog_ID'));
$Form->info(T_('Collection'), $Blog->get('name'), '');
$Form->end_fieldset();
$Form->buttons(array(array('submit', 'submit', T_('Continue!'), 'SaveButton')));
$Form->end_form();
}
$Form->info(T_('Source for avatars'), $path_avatars, $path_avatars_note);
$BlogCache =& get_BlogCache();
if ($phpbbBlog =& $BlogCache->get_by_ID(phpbb_get_var('blog_ID'))) {
    $Form->info(T_('Blog for import'), $phpbbBlog->get('name'));
}
$Form->end_fieldset();
$Form->begin_fieldset(T_('Users groups'));
$b2evo_groups = b2evo_groups();
$b2evo_groups_default = $b2evo_groups;
$b2evo_groups_default['0'] = T_('Select');
$Form->select_input_array('phpbb_group_default', phpbb_get_var('group_default'), $b2evo_groups_default, T_('Default group'), T_('Use this group as default for users without defined rank'), array('force_keys_as_values' => true));
$Form->select_input_array('phpbb_group_invalid', phpbb_get_var('group_invalid'), $b2evo_groups, '<span class="red">' . T_('Invalid users') . '</span>', T_('Use this group as default for users which was deleted from DB'), array('force_keys_as_values' => true));
echo T_('Please select the ranks which should be imported:');
$rank_values = phpbb_get_var('ranks');
$phpbb_ranks = phpbb_ranks();
foreach ($phpbb_ranks as $rank_ID => $rank_name) {
    $rank_users_count = phpbb_rank_info($rank_ID, true);
    if ($rank_users_count == 0) {
        // Don't display ranks without users
        continue;
    }
    $rank_value = isset($rank_values[$rank_ID]) ? $rank_values[$rank_ID] : phpbb_get_var('all_group_default');
    $Form->select_input_array('phpbb_ranks[' . $rank_ID . ']', $rank_value, $b2evo_groups, $rank_name, phpbb_rank_info($rank_ID), array('force_keys_as_values' => true));
}
$Form->end_fieldset();
$Form->begin_fieldset(T_('Select the forums which will be imported'));
phpbb_forums_list($Form);
$Form->end_fieldset();
$Form->buttons(array(array('submit', 'submit', T_('Continue !'), 'SaveButton'), array('button', 'button', T_('Back'), 'SaveButton', 'location.href=\'' . $dispatcher . '?ctrl=phpbbimport\'')));
$Form->end_form();
phpbb_display_steps(3);
$Form = new Form();
$Form->begin_form('fform', T_('phpBB Importer') . ' - ' . T_('Step 3: Import users'));
evo_flush();
$Form->add_crumb('phpbb');
$Form->hidden_ctrl();
$Form->hidden('action', 'forums');
if ($flush_action == 'users') {
    $Form->begin_fieldset(T_('Import log'));
    // Import the users
    phpbb_import_users();
    $Form->end_fieldset();
}
$Form->begin_fieldset(T_('Report of users import'));
$Form->info(T_('Count of the imported users'), '<b>' . (int) phpbb_get_var('users_count_imported') . '</b>');
$Form->info(T_('Count of the updated users'), '<b>' . (int) phpbb_get_var('users_count_updated') . '</b>');
$GroupCache =& get_GroupCache();
$group_default = phpbb_get_var('group_default');
if ($Group =& $GroupCache->get_by_ID($group_default, false)) {
    $Form->info(T_('Default group'), $Group->get_name());
}
$group_invalid = phpbb_get_var('group_invalid');
if (!empty($group_invalid) && ($Group =& $GroupCache->get_by_ID($group_invalid, false))) {
    $group_invalid_name = $Group->get_name();
} else {
    $group_invalid_name = T_('No import');
}
$Form->info(T_('Group for invalid users'), $group_invalid_name);
$Form->end_fieldset();
$Form->buttons(array(array('submit', 'submit', T_('Continue!'), 'SaveButton')));
$Form->end_form();
 *
 * @copyright (c)2003-2015 by Francois Planque - {@link http://fplanque.com/}.
 * Parts of this file are copyright (c)2005 by Daniel HAHLER - {@link http://thequod.de/contact}.
 *
 * @package admin
 */
if (!defined('EVO_MAIN_INIT')) {
    die('Please, do not access this page directly.');
}
global $phpbb_db_config, $phpbb_blog_ID, $dispatcher;
phpbb_display_steps(1);
$Form = new Form();
$Form->begin_form('fform', T_('phpBB Importer') . ' - ' . T_('Step 1: Database connection'));
evo_flush();
$Form->add_crumb('phpbb');
$Form->hidden_ctrl();
$Form->hidden('action', 'database');
$Form->begin_fieldset(T_('Access information for database of phpBB forum'));
$Form->text('db_host', param('db_host', 'string', $phpbb_db_config['host']), 20, T_('Database host'));
$Form->text('db_name', param('db_name', 'string', $phpbb_db_config['name']), 20, T_('Database name'));
$Form->text('db_user', param('db_user', 'string', $phpbb_db_config['user']), 20, T_('Username'));
$Form->password('db_pass', param('db_pass', 'string', $phpbb_db_config['password']), 20, T_('Password'));
$Form->text('db_prefix', param('db_prefix', 'string', $phpbb_db_config['prefix']), 20, T_('Table prefix'));
$Form->text('path_avatars', param('path_avatars', 'string', phpbb_get_var('path_avatars')), 80, T_('Source for avatars'), '', 1000);
$Form->end_fieldset();
$Form->begin_fieldset(T_('Select a blog for import'));
$BlogCache =& get_BlogCache();
$Form->select_input_object('forum_blog_ID', param('forum_blog_ID', 'integer', phpbb_get_var('blog_ID')), $BlogCache, T_('Blog for import'), array('note' => T_('Select the destination forum collection.') . ' <a href="' . $dispatcher . '?ctrl=collections&action=new">' . T_('Create new collection') . ' &raquo;</a>', 'allow_none' => true, 'object_callback' => 'get_option_list_forums'));
$Form->end_fieldset();
$Form->buttons(array(array('submit', 'submit', T_('Continue!'), 'SaveButton')));
$Form->end_form();