예제 #1
0
/**
 * Initialize the config variables for phpBB
 */
function phpbb_init_config()
{
    global $Session;
    global $phpbb_db_config, $phpbb_DB;
    $phpbb_db_config = phpbb_get_var('db_config');
    if (is_array($phpbb_db_config) && count($phpbb_db_config) > 0) {
        // Connect to DB when config is already defined
        $phpbb_db_config['show_errors'] = true;
        $phpbb_db_config['aliases'] = phpbb_tables_aliases($phpbb_db_config['prefix']);
        $phpbb_DB = new DB($phpbb_db_config);
    } else {
        // Default config values
        global $db_config, $test_install_all_features;
        $phpbb_db_config = array('host' => $db_config['host'], 'name' => '', 'user' => $db_config['user'], 'password' => '', 'prefix' => 'phpbb_');
        if ($test_install_all_features) {
            // Set maximum default values in test mode
            $phpbb_db_config['password'] = $db_config['password'];
            phpbb_set_var('blog_ID', '5');
            // Forums
            $GroupCache =& get_GroupCache();
            if ($normal_Group =& $GroupCache->get_by_name('Normal Users', false)) {
                phpbb_set_var('group_default', $normal_Group->ID);
                // Basic Users
                phpbb_set_var('all_group_default', $normal_Group->ID);
                // Privileged Bloggers
            }
            if ($invalid_Group =& $GroupCache->get_by_name('Misbehaving/Suspect Users', false)) {
                phpbb_set_var('group_invalid', $invalid_Group->ID);
                // Invalid Users
            }
        }
    }
}
예제 #2
0
     $phpbb_db_host = param('db_host', 'string', true);
     $phpbb_db_name = param('db_name', 'string', true);
     $phpbb_db_user = param('db_user', 'string', true);
     $phpbb_db_pass = param('db_pass', 'string', true);
     $phpbb_db_prefix = param('db_prefix', 'string', '');
     $phpbb_path_avatars = param('path_avatars', 'string', '');
     $forum_blog_ID = param('forum_blog_ID', 'integer', 0);
     param_check_not_empty('db_host', T_('Please enter a database host!'));
     param_check_not_empty('db_name', T_('Please enter a database name!'));
     param_check_not_empty('db_user', T_('Please enter a username!'));
     param_check_not_empty('db_pass', T_('Please enter a password!'));
     param_check_not_empty('forum_blog_ID', T_('Please select a blog!'));
     if (param_errors_detected()) {
         break;
     }
     $phpbb_db_config = array('user' => $phpbb_db_user, 'password' => $phpbb_db_pass, 'name' => $phpbb_db_name, 'host' => $phpbb_db_host, 'prefix' => $phpbb_db_prefix, 'aliases' => phpbb_tables_aliases($phpbb_db_prefix), 'use_transactions' => $db_config['use_transactions'], 'table_options' => $db_config['table_options'], 'connection_charset' => $DB->connection_charset, 'halt_on_error' => false, 'show_errors' => false, 'new_link' => true, 'log_queries' => true, 'debug_dump_rows' => 20);
     // Test connect to DB:
     $phpbb_DB = new DB($phpbb_db_config);
     unset($phpbb_db_config['aliases']);
     if ($phpbb_DB->error) {
         $Messages->add($phpbb_DB->last_error, 'error');
         break;
     }
     // Save DB config of phpBB in the session
     phpbb_set_var('db_config', $phpbb_db_config);
     phpbb_set_var('blog_ID', $forum_blog_ID);
     phpbb_set_var('path_avatars', $phpbb_path_avatars);
     $step = 'groups';
     break;
 case "users":
     // Action for Step 2