mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-27 04:18:55 +00:00
some minor odbc tweaks...
git-svn-id: file:///svn/phpbb/trunk@1163 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
06889f19fb
commit
2f10b2076e
1 changed files with 130 additions and 139 deletions
|
@ -292,12 +292,11 @@ else
|
||||||
// out some additional instruction_textions later on what to do after installation
|
// out some additional instruction_textions later on what to do after installation
|
||||||
// for the odbc DBMS.
|
// for the odbc DBMS.
|
||||||
//
|
//
|
||||||
if( ereg(':', $dbms) && $install_step < 2 )
|
if( ereg(':', $dbms) )
|
||||||
{
|
{
|
||||||
$dbms = explode(':', $dbms);
|
$dbms = explode(':', $dbms);
|
||||||
$dbhost = $dbms[1] . ':' . $dbhost;
|
$dbhost = $dbms[1] . ':' . $dbhost;
|
||||||
$dbms = $dbms[0];
|
$dbms = $dbms[0];
|
||||||
$install_step = 2;
|
|
||||||
}
|
}
|
||||||
else if( isset($dbms) )
|
else if( isset($dbms) )
|
||||||
{
|
{
|
||||||
|
@ -310,9 +309,10 @@ else
|
||||||
$remove_remarks = ( $dbms == 'mysql' ) ? 'remove_remarks' : 'remove_comments';
|
$remove_remarks = ( $dbms == 'mysql' ) ? 'remove_remarks' : 'remove_comments';
|
||||||
$delimiter = ( $dbms == 'mssql' ) ? 'GO' : ';';
|
$delimiter = ( $dbms == 'mssql' ) ? 'GO' : ';';
|
||||||
|
|
||||||
switch ( $install_step )
|
if( $install_step == 1 )
|
||||||
{
|
{
|
||||||
case 1:
|
if($dbms != 'odbc')
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// Ok we have the db info go ahead and read in the relevant schema
|
// Ok we have the db info go ahead and read in the relevant schema
|
||||||
// and work on building the table.. probably ought to provide some
|
// and work on building the table.. probably ought to provide some
|
||||||
|
@ -333,7 +333,7 @@ else
|
||||||
$error = $db->sql_error();
|
$error = $db->sql_error();
|
||||||
|
|
||||||
$template->assign_block_vars("error_install", array());
|
$template->assign_block_vars("error_install", array());
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
"L_ERROR_TITLE" => $lang['Installer_Error'],
|
"L_ERROR_TITLE" => $lang['Installer_Error'],
|
||||||
"L_ERROR" => $lang['Install_db_error'] . '<br>' . $error['message'])
|
"L_ERROR" => $lang['Install_db_error'] . '<br>' . $error['message'])
|
||||||
);
|
);
|
||||||
|
@ -348,7 +348,7 @@ else
|
||||||
$sql_query = @fread(@fopen($dbms_basic, 'r'), @filesize($dbms_basic));
|
$sql_query = @fread(@fopen($dbms_basic, 'r'), @filesize($dbms_basic));
|
||||||
$sql_query = $remove_remarks($sql_query);
|
$sql_query = $remove_remarks($sql_query);
|
||||||
$sql_query = split_sql_file($sql_query, $delimiter);
|
$sql_query = split_sql_file($sql_query, $delimiter);
|
||||||
$sql_count = count($sql_query);
|
$sql_count = count($sql_query);
|
||||||
$sql_query = preg_replace('/phpbb_/', $table_prefix, $sql_query);
|
$sql_query = preg_replace('/phpbb_/', $table_prefix, $sql_query);
|
||||||
|
|
||||||
for($i = 0; $i < $sql_count; $i++)
|
for($i = 0; $i < $sql_count; $i++)
|
||||||
|
@ -374,146 +374,137 @@ else
|
||||||
// this we are going to pass them over to the admin_forum.php script
|
// this we are going to pass them over to the admin_forum.php script
|
||||||
// to set up their forum defaults.
|
// to set up their forum defaults.
|
||||||
//
|
//
|
||||||
if( $dbms == 'odbc' )
|
$error = "";
|
||||||
|
//
|
||||||
|
// Update the default admin user with their information.
|
||||||
|
//
|
||||||
|
$sql = "INSERT INTO " . $table_prefix . "config (config_name, config_value)
|
||||||
|
VALUES ('board_startdate', " . time() . ")";
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
if( !$result )
|
||||||
|
{
|
||||||
|
$error .= "Could not insert board_startdate :: " . $sql . "<br /><br />";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "INSERT INTO " . $table_prefix . "config (config_name, config_value)
|
||||||
|
VALUES ('default_lang', '$language')";
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
if( !$result )
|
||||||
|
{
|
||||||
|
$error .= "Could not insert default_lang :: " . $sql . "<br /><br />";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "UPDATE " . $table_prefix . "users
|
||||||
|
SET username = '$admin_name', user_password='" . md5($admin_pass1) . "', user_lang = '" . $language . "'
|
||||||
|
WHERE username = 'Admin'";
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
if( !$result )
|
||||||
|
{
|
||||||
|
$error .= "Could not update admin info :: " . $sql . "<br /><br />";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "UPDATE " . $table_prefix . "users
|
||||||
|
SET user_regdate = " . time();
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
if( !$result )
|
||||||
|
{
|
||||||
|
$error .= "Could not update user_regdate :: " . $sql . "<br /><br />";
|
||||||
|
}
|
||||||
|
|
||||||
|
if( $error != "" )
|
||||||
|
{
|
||||||
|
$error = $db->sql_error();
|
||||||
|
|
||||||
|
$template->assign_block_vars("error_install", array());
|
||||||
|
$template->assign_vars(array(
|
||||||
|
"L_ERROR_TITLE" => $lang['Installer_Error'],
|
||||||
|
"L_ERROR" => $lang['Install_db_error'] . '<br /><br />' . $error)
|
||||||
|
);
|
||||||
|
|
||||||
|
$template->pparse('body');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$template->assign_block_vars("common_install", array());
|
||||||
|
//
|
||||||
|
// Write out the config file.
|
||||||
|
//
|
||||||
|
$config_data = '<?php'."\n\n";
|
||||||
|
$config_data .= "//\n// phpBB 2.x auto-generated config file\n// Do not change anything in this file!\n//\n\n";
|
||||||
|
$config_data .= '$dbms = "' . $dbms . '";' . "\n\n";
|
||||||
|
$config_data .= '$dbhost = "' . $dbhost . '";' . "\n";
|
||||||
|
$config_data .= '$dbname = "' . $dbname . '";' . "\n";
|
||||||
|
$config_data .= '$dbuser = "' . $dbuser . '";' . "\n";
|
||||||
|
$config_data .= '$dbpasswd = "' . $dbpasswd . '";' . "\n\n";
|
||||||
|
$config_data .= '$table_prefix = "' . $table_prefix . '";' . "\n\n";
|
||||||
|
$config_data .= 'define(\'PHPBB_INSTALLED\', true);'."\n\n";
|
||||||
|
$config_data .= '?' . '>'; // Done this to prevent highlighting editors getting confused!
|
||||||
|
|
||||||
|
@umask(0111);
|
||||||
|
$no_open = FALSE;
|
||||||
|
$fp = @fopen('config.php', 'w');
|
||||||
|
if( !$fp )
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Unable to open the file writeable do something here as an attempt
|
||||||
|
// to get around that...
|
||||||
|
//
|
||||||
|
$s_hidden_fields = '<input type="hidden" name="config_data" value="' . htmlspecialchars($config_data) . '" />';
|
||||||
|
$s_hidden_fields .= '<input type="hidden" name="send_file" value="1" />';
|
||||||
|
if ( $dbms == 'odbc' )
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Output the instruction_textions for the odbc...
|
// Output the instruction_textions for the odbc...
|
||||||
//
|
//
|
||||||
$template->assign_block_vars("common_install", array());
|
$template->assign_block_vars("common_install", array());
|
||||||
|
|
||||||
$s_hidden_fields = '<input type="hidden" name="install_step" value="3" />';
|
$s_hidden_fields .= '<input type="hidden" name="install_step" value="3" />';
|
||||||
|
$lang['Unwritable_config'] = $lang['ODBC_Instructs'] . '<br />' . $lang['Unwritable_config'];
|
||||||
$template->assign_vars(array(
|
|
||||||
"L_INSTRUCTION_TEXT" => $lang['ODBC_instruction_texts'],
|
|
||||||
"L_SUBMIT" => $lang['OK'],
|
|
||||||
|
|
||||||
"S_HIDDEN_FIELDS" => $s_hidden_fields,
|
|
||||||
"S_FORM_ACTION" => 'install.'.$phpEx)
|
|
||||||
);
|
|
||||||
exit();
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
$error = "";
|
|
||||||
//
|
|
||||||
// Update the default admin user with their information.
|
|
||||||
//
|
|
||||||
$sql = "INSERT INTO " . $table_prefix . "config (config_name, config_value)
|
|
||||||
VALUES ('board_startdate', " . time() . ")";
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
if( !$result )
|
|
||||||
{
|
|
||||||
$error .= "Could not insert board_startdate :: " . $sql . "<br /><br />";
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = "INSERT INTO " . $table_prefix . "config (config_name, config_value)
|
$template->assign_vars(array(
|
||||||
VALUES ('default_lang', '$language')";
|
"L_INSTRUCTION_TEXT" => $lang['Unwriteable_config'],
|
||||||
$result = $db->sql_query($sql);
|
"L_SUBMIT" => $lang['Download_config'],
|
||||||
if( !$result )
|
|
||||||
{
|
|
||||||
$error .= "Could not insert default_lang :: " . $sql . "<br /><br />";
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = "UPDATE " . $table_prefix . "users
|
"S_HIDDEN_FIELDS" => $s_hidden_fields,
|
||||||
SET username = '$admin_name', user_password='" . md5($admin_pass1) . "', user_lang = '" . $language . "'
|
"S_FORM_ACTION" => "install.$phpEx")
|
||||||
WHERE username = 'Admin'";
|
);
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
if( !$result )
|
|
||||||
{
|
|
||||||
$error .= "Could not update admin info :: " . $sql . "<br /><br />";
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = "UPDATE " . $table_prefix . "users
|
$template->pparse('body');
|
||||||
SET user_regdate = " . time();
|
exit();
|
||||||
$result = $db->sql_query($sql);
|
}
|
||||||
if( !$result )
|
|
||||||
{
|
|
||||||
$error .= "Could not update user_regdate :: " . $sql . "<br /><br />";
|
|
||||||
}
|
|
||||||
|
|
||||||
if( $error != "" )
|
$result = @fputs($fp, $config_data, strlen($config_data));
|
||||||
{
|
fclose($fp);
|
||||||
$error = $db->sql_error();
|
|
||||||
|
|
||||||
$template->assign_block_vars("error_install", array());
|
//
|
||||||
$template->assign_vars(array(
|
// Ok we are basically done with the install process let's go on
|
||||||
"L_ERROR_TITLE" => $lang['Installer_Error'],
|
// and let the user configure their board now.
|
||||||
"L_ERROR" => $lang['Install_db_error'] . '<br /><br />' . $error)
|
// We are going to do this by calling the admin_board.php from the
|
||||||
);
|
// normal board admin section.
|
||||||
|
//
|
||||||
|
$s_hidden_fields = '<input type="hidden" name="username" value="' . $admin_name . '" />';
|
||||||
|
$s_hidden_fields .= '<input type="hidden" name="password" value="' . $admin_pass1 . '" />';
|
||||||
|
$s_hidden_fields .= '<input type="hidden" name="forward_page" value="admin/" />';
|
||||||
|
$s_hidden_fields .= '<input type="hidden" name="submit" value="Login" />';
|
||||||
|
if ( $dbms == 'odbc' )
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Output the instruction_textions for the odbc...
|
||||||
|
//
|
||||||
|
$lang['Inst_Step_2'] = $lang['ODBC_Instructs'] . '<br />' . $lang['Inst_Step_2'];
|
||||||
|
}
|
||||||
|
|
||||||
$template->pparse('body');
|
$template->assign_vars(array(
|
||||||
exit;
|
"L_INSTRUCTION_TEXT" => $lang['Inst_Step_2'],
|
||||||
}
|
"L_SUBMIT" => $lang['Finish_Install'],
|
||||||
|
|
||||||
$template->assign_block_vars("common_install", array());
|
"S_HIDDEN_FIELDS" => $s_hidden_fields,
|
||||||
|
"S_FORM_ACTION" => "login.$phpEx")
|
||||||
|
);
|
||||||
|
|
||||||
//
|
$template->pparse('body');
|
||||||
// Write out the config file.
|
exit();
|
||||||
//
|
|
||||||
$config_data = '<?php'."\n\n";
|
|
||||||
$config_data .= "//\n// phpBB 2.x auto-generated config file\n// Do not change anything in this file!\n//\n\n";
|
|
||||||
$config_data .= '$dbms = "' . $dbms . '";' . "\n\n";
|
|
||||||
$config_data .= '$dbhost = "' . $dbhost . '";' . "\n";
|
|
||||||
$config_data .= '$dbname = "' . $dbname . '";' . "\n";
|
|
||||||
$config_data .= '$dbuser = "' . $dbuser . '";' . "\n";
|
|
||||||
$config_data .= '$dbpasswd = "' . $dbpasswd . '";' . "\n\n";
|
|
||||||
$config_data .= '$table_prefix = "' . $table_prefix . '";' . "\n\n";
|
|
||||||
$config_data .= 'define(\'PHPBB_INSTALLED\', true);'."\n\n";
|
|
||||||
$config_data .= '?' . '>'; // Done this to prevent highlighting editors getting confused!
|
|
||||||
|
|
||||||
@umask(0111);
|
|
||||||
$no_open = FALSE;
|
|
||||||
|
|
||||||
$fp = @fopen('config.php', 'w');
|
|
||||||
|
|
||||||
if( !$fp )
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Unable to open the file writeable do something here as an attempt
|
|
||||||
// to get around that...
|
|
||||||
//
|
|
||||||
$s_hidden_fields = '<input type="hidden" name="config_data" value="' . htmlspecialchars($config_data) . '" />';
|
|
||||||
$s_hidden_fields .= '<input type="hidden" name="send_file" value="1" />';
|
|
||||||
|
|
||||||
$template->assign_vars(array(
|
|
||||||
"L_INSTRUCTION_TEXT" => $lang['Unwriteable_config'],
|
|
||||||
"L_SUBMIT" => $lang['Download_config'],
|
|
||||||
|
|
||||||
"S_HIDDEN_FIELDS" => $s_hidden_fields,
|
|
||||||
"S_FORM_ACTION" => "install.$phpEx")
|
|
||||||
);
|
|
||||||
|
|
||||||
$template->pparse('body');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = @fputs($fp, $config_data, strlen($config_data));
|
|
||||||
fclose($fp);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Ok we are basically done with the install process let's go on
|
|
||||||
// and let the user configure their board now.
|
|
||||||
// We are going to do this by calling the admin_board.php from the
|
|
||||||
// normal board admin section.
|
|
||||||
//
|
|
||||||
$s_hidden_fields = '<input type="hidden" name="username" value="' . $admin_name . '" />';
|
|
||||||
$s_hidden_fields .= '<input type="hidden" name="password" value="' . $admin_pass1 . '" />';
|
|
||||||
$s_hidden_fields .= '<input type="hidden" name="forward_page" value="admin/" />';
|
|
||||||
$s_hidden_fields .= '<input type="hidden" name="submit" value="Login" />';
|
|
||||||
|
|
||||||
$template->assign_vars(array(
|
|
||||||
"L_INSTRUCTION_TEXT" => $lang['Inst_Step_2'],
|
|
||||||
"L_SUBMIT" => $lang['Finish_Install'],
|
|
||||||
|
|
||||||
"S_HIDDEN_FIELDS" => $s_hidden_fields,
|
|
||||||
"S_FORM_ACTION" => "login.$phpEx")
|
|
||||||
);
|
|
||||||
|
|
||||||
$template->pparse('body');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
Loading…
Add table
Reference in a new issue