diff --git a/phpBB/includes/installation.php b/phpBB/includes/installation.php deleted file mode 100644 index 93d25effa2..0000000000 --- a/phpBB/includes/installation.php +++ /dev/null @@ -1,59 +0,0 @@ - '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'; -?> diff --git a/phpBB/install.php b/phpBB/install.php index fff04a9208..50ce9fb4e5 100644 --- a/phpBB/install.php +++ b/phpBB/install.php @@ -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); // diff --git a/phpBB/language/lang_english.php b/phpBB/language/lang_english.php index 7ca132a737..b1e6ec8109 100755 --- a/phpBB/language/lang_english.php +++ b/phpBB/language/lang_english.php @@ -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 log into phpBB 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"; -?> \ No newline at end of file +?>