mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
Merge install and includes/installation, and updated error handling for config file unwritable.
git-svn-id: file:///svn/phpbb/trunk@1125 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
2d769f1c10
commit
ba4944f1c7
3 changed files with 112 additions and 63 deletions
|
@ -1,59 +0,0 @@
|
|||
<?php
|
||||
/***************************************************************************
|
||||
* install.php
|
||||
* -------------------
|
||||
* begin : Tuesday, Sept 11, 2001
|
||||
* copyright : (C) 2001 The phpBB Group
|
||||
* email : supportphpbb.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
$phpbb_root_path = '';
|
||||
//
|
||||
// Initialize a couple of needed variables. It really doesn't matter what we
|
||||
// put in userdata... It just has to be set so that message_die will work.
|
||||
// Basically all of the following variables are to setup the template engine.
|
||||
//
|
||||
$userdata = "some false data";
|
||||
$theme = array(
|
||||
'themes_id' => '2',
|
||||
'themes_name' => 'Default',
|
||||
'template_name' => 'Default',
|
||||
'td_color1' => 'CCCCCC',
|
||||
'td_color2' => 'DDDDDD'
|
||||
);
|
||||
$default_language = 'english';
|
||||
$default_template = 'Default';
|
||||
|
||||
$available_dbms[] = array(
|
||||
"LABEL" => "MySQL",
|
||||
"VALUE" => "mysql"
|
||||
);
|
||||
$available_dbms[] = array(
|
||||
"LABEL" => "MS SQL",
|
||||
"VALUE" => "mssql"
|
||||
);
|
||||
$available_dbms[] = array(
|
||||
"LABEL" => "Postgres",
|
||||
"VALUE" => "postgres"
|
||||
);
|
||||
$available_dbms[] = array(
|
||||
"LABEL" => "ODBC - MSAccess",
|
||||
"VALUE" => "odbc:access"
|
||||
);
|
||||
$available_dbms[] = array(
|
||||
"LABEL" => "ODBC - DB2",
|
||||
"VALUE" => "odbc:db2"
|
||||
);
|
||||
$available_lang[] = 'english';
|
||||
?>
|
|
@ -18,15 +18,93 @@
|
|||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
//
|
||||
// First thing to check for is the case that we couldn't write the config
|
||||
// file and they chose to have use send it to them.
|
||||
//
|
||||
|
||||
if($HTTP_POST_VARS['send_file'] == 1)
|
||||
{
|
||||
header("Content-Type: text/x-delimtext; name=\"config.php\"");
|
||||
header("Content-disposition: attachment; filename=config.php");
|
||||
if(get_magic_quotes_gpc())
|
||||
{
|
||||
$HTTP_POST_VARS['config_data'] = stripslashes($HTTP_POST_VARS['config_data']);
|
||||
}
|
||||
echo $HTTP_POST_VARS['config_data'];
|
||||
exit();
|
||||
}
|
||||
|
||||
$phpbb_root_path='./';
|
||||
include($phpbb_root_path.'extension.inc');
|
||||
include($phpbb_root_path.'includes/installation.'.$phpEx);
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* Install Customization Section
|
||||
*
|
||||
* This section can be modified to set up some basic default information
|
||||
* used by the install script. Specifically the default theme data
|
||||
* and the default template.
|
||||
*
|
||||
**************************************************************************/
|
||||
$userdata = "some false data";
|
||||
$theme = array(
|
||||
'themes_id' => '2',
|
||||
'themes_name' => 'Default',
|
||||
'template_name' => 'Default',
|
||||
'td_color1' => 'CCCCCC',
|
||||
'td_color2' => 'DDDDDD'
|
||||
);
|
||||
$default_language = 'english';
|
||||
$default_template = 'Default';
|
||||
|
||||
$available_dbms[] = array(
|
||||
"LABEL" => "MySQL",
|
||||
"VALUE" => "mysql"
|
||||
);
|
||||
$available_dbms[] = array(
|
||||
"LABEL" => "MS SQL",
|
||||
"VALUE" => "mssql"
|
||||
);
|
||||
$available_dbms[] = array(
|
||||
"LABEL" => "Postgres",
|
||||
"VALUE" => "postgres"
|
||||
);
|
||||
$available_dbms[] = array(
|
||||
"LABEL" => "ODBC - MSAccess",
|
||||
"VALUE" => "odbc:access"
|
||||
);
|
||||
$available_dbms[] = array(
|
||||
"LABEL" => "ODBC - DB2",
|
||||
"VALUE" => "odbc:db2"
|
||||
);
|
||||
/***************************************************************************
|
||||
*
|
||||
* End Install Customization Section
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
//
|
||||
// Fill an array with a list of available languages.
|
||||
//
|
||||
|
||||
$dir = opendir($phpbb_root_path.'/language');
|
||||
while($file = readdir($dir))
|
||||
{
|
||||
if(preg_match("/^lang_(.*)\.$phpEx/", $file, $matches))
|
||||
{
|
||||
$available_lang[] = $matches[1];
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Bring in the extra files that contain functions we need.
|
||||
//
|
||||
|
||||
$language = ($HTTP_POST_VARS['language']) ? $HTTP_POST_VARS['language'] : $default_language;
|
||||
include($phpbb_root_path.'includes/sql_parse.'.$phpEx);
|
||||
include($phpbb_root_path.'includes/constants.'.$phpEx);
|
||||
include($phpbb_root_path.'includes/template.'.$phpEx);
|
||||
//include($phpbb_root_path.'includes/message.'.$phpEx);
|
||||
include($phpbb_root_path.'includes/functions.'.$phpEx);
|
||||
include($phpbb_root_path.'language/lang_'.$language.'.'.$phpEx);
|
||||
|
||||
|
@ -301,7 +379,32 @@ switch ( $installStep )
|
|||
$config_data.= '$table_prefix = "'.$HTTP_POST_VARS['prefix'].'";'."\n";
|
||||
$config_data.= '?>';
|
||||
@umask(0111);
|
||||
$fp = fopen('config.php', 'w');
|
||||
$noOpen = False;
|
||||
$fp = @fopen('config.php', 'w');
|
||||
if(!$fp)
|
||||
{
|
||||
//
|
||||
// Unable to open the file writeable do something here as an attempt
|
||||
// to get around that...
|
||||
$template->set_filenames(array(
|
||||
"body" => "install.tpl")
|
||||
);
|
||||
$template->assign_vars(array(
|
||||
"L_INSTRUCT" => $lang['UnWrite_Config'],
|
||||
"L_SUBMIT" => $lang['Send_Config'],
|
||||
"S_FORM_ACTION" => 'install.'.$phpEx)
|
||||
);
|
||||
$template->assign_block_vars("hidden_fields", array(
|
||||
"NAME" => "config_data",
|
||||
"VALUE" => htmlspecialchars($config_data) )
|
||||
);
|
||||
$template->assign_block_vars("hidden_fields", array(
|
||||
"NAME" => "send_file",
|
||||
"VALUE" => "1")
|
||||
);
|
||||
$template->pparse('body');
|
||||
exit();
|
||||
}
|
||||
$result = fputs($fp, $config_data, strlen($config_data));
|
||||
fclose($fp);
|
||||
//
|
||||
|
|
|
@ -971,6 +971,11 @@ $lang['Finish_Install'] = "Finish Installation";
|
|||
$lang['Install_db_error'] = "An error occured trying to update the database";
|
||||
$lang['ODBC_Instructs'] = "Someone please write some odbc instructions in the \$lang['ODBC_Instructs'] variable!";
|
||||
$lang['Table_Prefix'] = "Table Name Prefix";
|
||||
$lang['Send_Config'] = "Send Config File";
|
||||
$lang['UnWrite_Config'] = "Setup was unable to write your config file to the phpBB directory. You can either correct this by making the config file writable
|
||||
by the webserver, and running this setup again, or you may choose to have the config.php file sent to you by clicking the button below. Once the file has been
|
||||
saved to your local hard drive you should then ftp it to the server in your phpBB directory, and then <a href='login.php'>log into phpBB</a> and go the administration Panel to customize your board.";
|
||||
|
||||
//
|
||||
// End
|
||||
// -------------------------------------------------
|
||||
|
@ -1010,4 +1015,4 @@ $l_emailpass = "Email Lost Password";
|
|||
$l_passexplain = "Please fill out the form, a new password will be sent to your Email address";
|
||||
$l_sendpass = "Send Password";
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
Loading…
Add table
Reference in a new issue