needed fixes

git-svn-id: file:///svn/phpbb/trunk@7929 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2007-07-23 16:25:26 +00:00
parent 4373e62a56
commit d4fb1870be
2 changed files with 28 additions and 17 deletions

View file

@ -492,6 +492,16 @@ else
$exit = false; $exit = false;
if (version_compare($current_version, '3.0.RC3', '<=')) if (version_compare($current_version, '3.0.RC3', '<='))
{ {
/* </p>
<h1>Clean Usernames</h1>
<br />
<p>Please note that this can take a while... Please do not stop the script.</p>
*/
flush();
$submit = (isset($_POST['resolve_conflicts'])) ? true : false; $submit = (isset($_POST['resolve_conflicts'])) ? true : false;
$modify_users = request_var('modify_users', array(0 => '')); $modify_users = request_var('modify_users', array(0 => ''));
$new_usernames = request_var('new_usernames', array(0 => ''), true); $new_usernames = request_var('new_usernames', array(0 => ''), true);
@ -505,7 +515,7 @@ if (version_compare($current_version, '3.0.RC3', '<='))
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$users = 0; $users = 0;
while ($row = $db->sql_fetchrow()) while ($row = $db->sql_fetchrow($result))
{ {
$users++; $users++;
$user_id = (int) $row['user_id']; $user_id = (int) $row['user_id'];
@ -516,6 +526,7 @@ if (version_compare($current_version, '3.0.RC3', '<='))
$modify_users[$user_id] = $row; $modify_users[$user_id] = $row;
} }
} }
$db->sql_freeresult($result);
// only if all ids really existed // only if all ids really existed
if (sizeof($modify_users) == $users) if (sizeof($modify_users) == $users)
@ -554,10 +565,11 @@ if (version_compare($current_version, '3.0.RC3', '<='))
if (!$errors) if (!$errors)
{ {
// We use utf8_new_clean_string() here to make sure the new one is really used.
$sql = 'UPDATE ' . USERS_TABLE . ' $sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', array( SET ' . $db->sql_build_array('UPDATE', array(
'username' => $data['username'], 'username' => $data['username'],
'username_clean' => utf8_clean_string($data['username']) 'username_clean' => utf8_new_clean_string($data['username'])
)) . ' )) . '
WHERE user_id = ' . $user_id; WHERE user_id = ' . $user_id;
$db->sql_query($sql); $db->sql_query($sql);
@ -588,7 +600,8 @@ if (version_compare($current_version, '3.0.RC3', '<='))
// must not exist. We need identify them and let the admin decide what to do // must not exist. We need identify them and let the admin decide what to do
// about them. // about them.
$sql = 'SELECT user_id, username, username_clean $sql = 'SELECT user_id, username, username_clean
FROM ' . USERS_TABLE; FROM ' . USERS_TABLE . '
ORDER BY user_id';
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$colliding_users = $found_names = array(); $colliding_users = $found_names = array();
@ -609,10 +622,10 @@ if (version_compare($current_version, '3.0.RC3', '<='))
$sql = 'SELECT user_id, username $sql = 'SELECT user_id, username
FROM ' . USERS_TABLE . ' FROM ' . USERS_TABLE . '
WHERE username_clean = \'' . $db->sql_escape($clean_name) . '\''; WHERE username_clean = \'' . $db->sql_escape($clean_name) . '\'';
$result = $db->sql_query($sql); $result2 = $db->sql_query($sql);
$user_ids = array($user_id); $user_ids = array($user_id);
while ($row = $db->sql_fetchrow()) while ($row = $db->sql_fetchrow($result2))
{ {
// Make sure this clean name will still be the same with the // Make sure this clean name will still be the same with the
// new function. If it is, then we have to add it to the list // new function. If it is, then we have to add it to the list
@ -622,7 +635,7 @@ if (version_compare($current_version, '3.0.RC3', '<='))
$user_ids[] = (int) $row['user_id']; $user_ids[] = (int) $row['user_id'];
} }
} }
$db->sql_freeresult(); $db->sql_freeresult($result2);
// if we already found a collision save it // if we already found a collision save it
if (sizeof($user_ids) > 1) if (sizeof($user_ids) > 1)
@ -832,6 +845,7 @@ if (version_compare($current_version, '3.0.RC3', '<='))
$db->sql_query($sql); $db->sql_query($sql);
} }
} }
$db->sql_freeresult($result);
} }
unset($colliding_users); unset($colliding_users);
} }

View file

@ -62,7 +62,7 @@ class install_install extends module
switch ($sub) switch ($sub)
{ {
case 'intro' : case 'intro':
$this->page_title = $lang['SUB_INTRO']; $this->page_title = $lang['SUB_INTRO'];
$template->assign_vars(array( $template->assign_vars(array(
@ -75,27 +75,27 @@ class install_install extends module
break; break;
case 'requirements' : case 'requirements':
$this->check_server_requirements($mode, $sub); $this->check_server_requirements($mode, $sub);
break; break;
case 'database' : case 'database':
$this->obtain_database_settings($mode, $sub); $this->obtain_database_settings($mode, $sub);
break; break;
case 'administrator' : case 'administrator':
$this->obtain_admin_settings($mode, $sub); $this->obtain_admin_settings($mode, $sub);
break; break;
case 'config_file' : case 'config_file':
$this->create_config_file($mode, $sub); $this->create_config_file($mode, $sub);
break; break;
case 'advanced' : case 'advanced':
$this->obtain_advanced_settings($mode, $sub); $this->obtain_advanced_settings($mode, $sub);
break; break;
@ -104,7 +104,7 @@ class install_install extends module
$this->load_schema($mode, $sub); $this->load_schema($mode, $sub);
break; break;
case 'final' : case 'final':
$this->build_search_index($mode, $sub); $this->build_search_index($mode, $sub);
$this->add_modules($mode, $sub); $this->add_modules($mode, $sub);
$this->add_language($mode, $sub); $this->add_language($mode, $sub);
@ -1388,6 +1388,7 @@ class install_install extends module
// Obtain any submitted data // Obtain any submitted data
$data = $this->get_submitted_data(); $data = $this->get_submitted_data();
$table_prefix = $data['table_prefix'];
// If we get here and the extension isn't loaded it should be safe to just go ahead and load it // If we get here and the extension isn't loaded it should be safe to just go ahead and load it
$available_dbms = get_available_dbms($data['dbms']); $available_dbms = get_available_dbms($data['dbms']);
@ -1439,7 +1440,6 @@ class install_install extends module
{ {
global $db, $lang, $phpbb_root_path, $phpEx; global $db, $lang, $phpbb_root_path, $phpEx;
include_once($phpbb_root_path . 'includes/constants.' . $phpEx);
include_once($phpbb_root_path . 'includes/acp/acp_modules.' . $phpEx); include_once($phpbb_root_path . 'includes/acp/acp_modules.' . $phpEx);
$_module = &new acp_modules(); $_module = &new acp_modules();
@ -1857,9 +1857,6 @@ class install_install extends module
// Obtain any submitted data // Obtain any submitted data
$data = $this->get_submitted_data(); $data = $this->get_submitted_data();
// Load the basic configuration data
include_once($phpbb_root_path . 'includes/constants.' . $phpEx);
$sql = 'SELECT * $sql = 'SELECT *
FROM ' . CONFIG_TABLE; FROM ' . CONFIG_TABLE;
$result = $db->sql_query($sql); $result = $db->sql_query($sql);