From ba4944f1c7431f4d3895190251a40f94e14b6466 Mon Sep 17 00:00:00 2001 From: the_systech Date: Tue, 2 Oct 2001 14:30:15 +0000 Subject: 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 --- phpBB/install.php | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 106 insertions(+), 3 deletions(-) (limited to 'phpBB/install.php') 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); // -- cgit v1.2.1