diff options
-rw-r--r-- | phpBB/db/mssql-odbc.php | 5 | ||||
-rw-r--r-- | phpBB/db/schemas/mssql_schema.sql | 190 | ||||
-rw-r--r-- | phpBB/db/schemas/mysql_schema.sql | 28 | ||||
-rw-r--r-- | phpBB/install.php | 680 | ||||
-rw-r--r-- | phpBB/language/lang_english/lang_admin.php | 93 |
5 files changed, 490 insertions, 506 deletions
diff --git a/phpBB/db/mssql-odbc.php b/phpBB/db/mssql-odbc.php index 02db28da7d..ff26c5e11d 100644 --- a/phpBB/db/mssql-odbc.php +++ b/phpBB/db/mssql-odbc.php @@ -50,11 +50,11 @@ class sql_db if($this->persistency) { - $this->db_connect_id = odbc_pconnect($this->server, "", ""); + $this->db_connect_id = odbc_pconnect($this->server, $this->user, $this->password); } else { - $this->db_connect_id = odbc_connect($this->server, "", ""); + $this->db_connect_id = odbc_connect($this->server, $this->user, $this->password); } if($this->db_connect_id) @@ -169,7 +169,6 @@ class sql_db { $query = preg_replace("/\\\'/s", "''", $query); } - $this->query_result = odbc_exec($this->db_connect_id, $query); if($this->query_result) diff --git a/phpBB/db/schemas/mssql_schema.sql b/phpBB/db/schemas/mssql_schema.sql index f88e506ae0..6c39728549 100644 --- a/phpBB/db/schemas/mssql_schema.sql +++ b/phpBB/db/schemas/mssql_schema.sql @@ -9,142 +9,6 @@ BEGIN TRANSACTION GO -if exists (select * from dbo.sysobjects where id = object_id(N'[FK_phpbb_user_group_phpbb_groups]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) -ALTER TABLE [phpbb_user_group] DROP CONSTRAINT FK_phpbb_user_group_phpbb_groups -GO - -if exists (select * from dbo.sysobjects where id = object_id(N'[FK_phpbb_posts_text_phpbb_posts]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) -ALTER TABLE [phpbb_posts_text] DROP CONSTRAINT FK_phpbb_posts_text_phpbb_posts -GO - -if exists (select * from dbo.sysobjects where id = object_id(N'[FK_phpbb_privmsgs_text_phpbb_privmsgs]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) -ALTER TABLE [phpbb_privmsgs_text] DROP CONSTRAINT FK_phpbb_privmsgs_text_phpbb_privmsgs -GO - -if exists (select * from dbo.sysobjects where id = object_id(N'[FK_phpbb_search_wordmatch_phpbb_search_wordlist]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) -ALTER TABLE [phpbb_search_wordmatch] DROP CONSTRAINT FK_phpbb_search_wordmatch_phpbb_search_wordlist -GO - -if exists (select * from dbo.sysobjects where id = object_id(N'[FK_phpbb_themes_name_phpbb_themes]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) -ALTER TABLE [phpbb_themes_name] DROP CONSTRAINT FK_phpbb_themes_name_phpbb_themes -GO - -if exists (select * from dbo.sysobjects where id = object_id(N'[FK_phpbb_topics_watch_phpbb_topics]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) -ALTER TABLE [phpbb_topics_watch] DROP CONSTRAINT FK_phpbb_topics_watch_phpbb_topics -GO - -if exists (select * from dbo.sysobjects where id = object_id(N'[phpbb_auth_access]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) -drop table [phpbb_auth_access] -GO - -if exists (select * from dbo.sysobjects where id = object_id(N'[phpbb_banlist]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) -drop table [phpbb_banlist] -GO - -if exists (select * from dbo.sysobjects where id = object_id(N'[phpbb_categories]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) -drop table [phpbb_categories] -GO - -if exists (select * from dbo.sysobjects where id = object_id(N'[phpbb_config]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) -drop table [phpbb_config] -GO - -if exists (select * from dbo.sysobjects where id = object_id(N'[phpbb_disallow]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) -drop table [phpbb_disallow] -GO - -if exists (select * from dbo.sysobjects where id = object_id(N'[phpbb_forum_prune]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) -drop table [phpbb_forum_prune] -GO - -if exists (select * from dbo.sysobjects where id = object_id(N'[phpbb_forums]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) -drop table [phpbb_forums] -GO - -if exists (select * from dbo.sysobjects where id = object_id(N'[phpbb_groups]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) -drop table [phpbb_groups] -GO - -if exists (select * from dbo.sysobjects where id = object_id(N'[phpbb_posts]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) -drop table [phpbb_posts] -GO - -if exists (select * from dbo.sysobjects where id = object_id(N'[phpbb_posts_text]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) -drop table [phpbb_posts_text] -GO - -if exists (select * from dbo.sysobjects where id = object_id(N'[phpbb_privmsgs]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) -drop table [phpbb_privmsgs] -GO - -if exists (select * from dbo.sysobjects where id = object_id(N'[phpbb_privmsgs_text]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) -drop table [phpbb_privmsgs_text] -GO - -if exists (select * from dbo.sysobjects where id = object_id(N'[phpbb_ranks]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) -drop table [phpbb_ranks] -GO - -if exists (select * from dbo.sysobjects where id = object_id(N'[phpbb_search_results]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) -drop table [phpbb_search_results] -GO - -if exists (select * from dbo.sysobjects where id = object_id(N'[phpbb_search_wordlist]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) -drop table [phpbb_search_wordlist] -GO - -if exists (select * from dbo.sysobjects where id = object_id(N'[phpbb_search_wordmatch]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) -drop table [phpbb_search_wordmatch] -GO - -if exists (select * from dbo.sysobjects where id = object_id(N'[phpbb_sessions]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) -drop table [phpbb_sessions] -GO - -if exists (select * from dbo.sysobjects where id = object_id(N'[phpbb_smilies]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) -drop table [phpbb_smilies] -GO - -if exists (select * from dbo.sysobjects where id = object_id(N'[phpbb_themes]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) -drop table [phpbb_themes] -GO - -if exists (select * from dbo.sysobjects where id = object_id(N'[phpbb_themes_name]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) -drop table [phpbb_themes_name] -GO - -if exists (select * from dbo.sysobjects where id = object_id(N'[phpbb_topics]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) -drop table [phpbb_topics] -GO - -if exists (select * from dbo.sysobjects where id = object_id(N'[phpbb_topics_watch]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) -drop table [phpbb_topics_watch] -GO - -if exists (select * from dbo.sysobjects where id = object_id(N'[phpbb_user_group]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) -drop table [phpbb_user_group] -GO - -if exists (select * from dbo.sysobjects where id = object_id(N'[phpbb_users]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) -drop table [phpbb_users] -GO - -if exists (select * from dbo.sysobjects where id = object_id(N'[phpbb_vote_desc]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) -drop table [phpbb_vote_desc] -GO - -if exists (select * from dbo.sysobjects where id = object_id(N'[phpbb_vote_results]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) -drop table [phpbb_vote_results] -GO - -if exists (select * from dbo.sysobjects where id = object_id(N'[phpbb_vote_voters]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) -drop table [phpbb_vote_voters] -GO - -if exists (select * from dbo.sysobjects where id = object_id(N'[phpbb_words]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) -drop table [phpbb_words] -GO - CREATE TABLE [phpbb_auth_access] ( [group_id] [int] NULL , [forum_id] [int] NULL , @@ -789,59 +653,5 @@ GO CREATE INDEX [IX_phpbb_vote_voters_1] ON [phpbb_vote_voters]([vote_user_id]) ON [PRIMARY] GO -ALTER TABLE [phpbb_posts_text] ADD - CONSTRAINT [FK_phpbb_posts_text_phpbb_posts] FOREIGN KEY - ( - [post_id] - ) REFERENCES [phpbb_posts] ( - [post_id] - ) -GO - -ALTER TABLE [phpbb_privmsgs_text] ADD - CONSTRAINT [FK_phpbb_privmsgs_text_phpbb_privmsgs] FOREIGN KEY - ( - [privmsgs_text_id] - ) REFERENCES [phpbb_privmsgs] ( - [privmsgs_id] - ) -GO - -ALTER TABLE [phpbb_search_wordmatch] ADD - CONSTRAINT [FK_phpbb_search_wordmatch_phpbb_search_wordlist] FOREIGN KEY - ( - [word_id] - ) REFERENCES [phpbb_search_wordlist] ( - [word_id] - ) -GO - -ALTER TABLE [phpbb_themes_name] ADD - CONSTRAINT [FK_phpbb_themes_name_phpbb_themes] FOREIGN KEY - ( - [themes_id] - ) REFERENCES [phpbb_themes] ( - [themes_id] - ) -GO - -ALTER TABLE [phpbb_topics_watch] ADD - CONSTRAINT [FK_phpbb_topics_watch_phpbb_topics] FOREIGN KEY - ( - [topic_id] - ) REFERENCES [phpbb_topics] ( - [topic_id] - ) -GO - -ALTER TABLE [phpbb_user_group] ADD - CONSTRAINT [FK_phpbb_user_group_phpbb_groups] FOREIGN KEY - ( - [group_id] - ) REFERENCES [phpbb_groups] ( - [group_id] - ) -GO - COMMIT GO diff --git a/phpBB/db/schemas/mysql_schema.sql b/phpBB/db/schemas/mysql_schema.sql index 83813f1309..9a888e0e51 100644 --- a/phpBB/db/schemas/mysql_schema.sql +++ b/phpBB/db/schemas/mysql_schema.sql @@ -7,7 +7,6 @@ # # Table structure for table 'phpbb_auth_access' # -DROP TABLE IF EXISTS phpbb_auth_access; CREATE TABLE phpbb_auth_access ( group_id mediumint(8) DEFAULT '0' NOT NULL, forum_id smallint(5) UNSIGNED DEFAULT '0' NOT NULL, @@ -31,7 +30,6 @@ CREATE TABLE phpbb_auth_access ( # # Table structure for table 'phpbb_user_group' # -DROP TABLE IF EXISTS phpbb_user_group; CREATE TABLE phpbb_user_group ( group_id mediumint(8) DEFAULT '0' NOT NULL, user_id mediumint(8) DEFAULT '0' NOT NULL, @@ -43,7 +41,6 @@ CREATE TABLE phpbb_user_group ( # # Table structure for table 'phpbb_groups' # -DROP TABLE IF EXISTS phpbb_groups; CREATE TABLE phpbb_groups ( group_id mediumint(8) NOT NULL auto_increment, group_type tinyint(4) DEFAULT '1' NOT NULL, @@ -60,7 +57,6 @@ CREATE TABLE phpbb_groups ( # # Table structure for table 'phpbb_banlist' # -DROP TABLE IF EXISTS phpbb_banlist; CREATE TABLE phpbb_banlist ( ban_id mediumint(8) UNSIGNED NOT NULL auto_increment, ban_userid mediumint(8) NOT NULL, @@ -75,7 +71,6 @@ CREATE TABLE phpbb_banlist ( # # Table structure for table 'phpbb_categories' # -DROP TABLE IF EXISTS phpbb_categories; CREATE TABLE phpbb_categories ( cat_id mediumint(8) UNSIGNED NOT NULL auto_increment, cat_title varchar(100), @@ -89,7 +84,6 @@ CREATE TABLE phpbb_categories ( # # Table structure for table 'phpbb_config' # -DROP TABLE IF EXISTS phpbb_config; CREATE TABLE phpbb_config ( config_name varchar(255) NOT NULL, config_value varchar(255) NOT NULL, @@ -101,7 +95,6 @@ CREATE TABLE phpbb_config ( # # Table structure for table 'phpbb_disallow' # -DROP TABLE IF EXISTS phpbb_disallow; CREATE TABLE phpbb_disallow ( disallow_id mediumint(8) UNSIGNED NOT NULL auto_increment, disallow_username varchar(25), @@ -113,7 +106,6 @@ CREATE TABLE phpbb_disallow ( # # Table structure for table 'phpbb_forum_prune' # -DROP TABLE IF EXISTS phpbb_forum_prune; CREATE TABLE phpbb_forum_prune ( prune_id mediumint(8) UNSIGNED NOT NULL auto_increment, forum_id smallint(5) UNSIGNED NOT NULL, @@ -128,7 +120,6 @@ CREATE TABLE phpbb_forum_prune ( # # Table structure for table 'phpbb_forums' # -DROP TABLE IF EXISTS phpbb_forums; CREATE TABLE phpbb_forums ( forum_id smallint(5) UNSIGNED NOT NULL auto_increment, cat_id mediumint(8) UNSIGNED NOT NULL, @@ -163,7 +154,6 @@ CREATE TABLE phpbb_forums ( # # Table structure for table 'phpbb_posts' # -DROP TABLE IF EXISTS phpbb_posts; CREATE TABLE phpbb_posts ( post_id mediumint(8) UNSIGNED NOT NULL auto_increment, topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, @@ -190,7 +180,6 @@ CREATE TABLE phpbb_posts ( # # Table structure for table 'phpbb_posts_text' # -DROP TABLE IF EXISTS phpbb_posts_text; CREATE TABLE phpbb_posts_text ( post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, bbcode_uid char(10) NOT NULL, @@ -204,7 +193,6 @@ CREATE TABLE phpbb_posts_text ( # # Table structure for table 'phpbb_privmsgs' # -DROP TABLE IF EXISTS phpbb_privmsgs; CREATE TABLE phpbb_privmsgs ( privmsgs_id mediumint(8) UNSIGNED NOT NULL auto_increment, privmsgs_type tinyint(4) DEFAULT '0' NOT NULL, @@ -227,7 +215,6 @@ CREATE TABLE phpbb_privmsgs ( # # Table structure for table 'phpbb_privmsgs_text' # -DROP TABLE IF EXISTS phpbb_privmsgs_text; CREATE TABLE phpbb_privmsgs_text ( privmsgs_text_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, privmsgs_bbcode_uid char(10) DEFAULT '0' NOT NULL, @@ -240,7 +227,6 @@ CREATE TABLE phpbb_privmsgs_text ( # # Table structure for table 'phpbb_ranks' # -DROP TABLE IF EXISTS phpbb_ranks; CREATE TABLE phpbb_ranks ( rank_id smallint(5) UNSIGNED NOT NULL auto_increment, rank_title varchar(50) NOT NULL, @@ -256,7 +242,6 @@ CREATE TABLE phpbb_ranks ( # # Table structure for table `phpbb_search_results` # -DROP TABLE IF EXISTS phpbb_search_results; CREATE TABLE phpbb_search_results ( search_id mediumint(8) UNSIGNED NOT NULL default '0', session_id char(32) NOT NULL default '', @@ -270,7 +255,6 @@ CREATE TABLE phpbb_search_results ( # # Table structure for table `phpbb_search_wordlist` # -DROP TABLE IF EXISTS phpbb_search_wordlist; CREATE TABLE phpbb_search_wordlist ( word_text varchar(50) binary NOT NULL default '', word_id mediumint(8) UNSIGNED NOT NULL auto_increment, @@ -283,7 +267,6 @@ CREATE TABLE phpbb_search_wordlist ( # # Table structure for table `phpbb_search_wordmatch` # -DROP TABLE IF EXISTS phpbb_search_wordmatch; CREATE TABLE phpbb_search_wordmatch ( post_id mediumint(8) UNSIGNED NOT NULL default '0', word_id mediumint(8) UNSIGNED NOT NULL default '0', @@ -307,7 +290,6 @@ CREATE TABLE phpbb_search_wordmatch ( # competing boards, just that I find it's best not to # look at any code ... ! # -DROP TABLE IF EXISTS phpbb_sessions; CREATE TABLE phpbb_sessions ( session_id char(32) DEFAULT '' NOT NULL, session_user_id mediumint(8) DEFAULT '0' NOT NULL, @@ -327,7 +309,6 @@ CREATE TABLE phpbb_sessions ( # # Table structure for table 'phpbb_smilies' # -DROP TABLE IF EXISTS phpbb_smilies; CREATE TABLE phpbb_smilies ( smilies_id smallint(5) UNSIGNED NOT NULL auto_increment, code varchar(50), @@ -341,7 +322,6 @@ CREATE TABLE phpbb_smilies ( # # Table structure for table 'phpbb_themes' # -DROP TABLE IF EXISTS phpbb_themes; CREATE TABLE phpbb_themes ( themes_id mediumint(8) UNSIGNED NOT NULL auto_increment, template_name varchar(30) NOT NULL default '', @@ -394,7 +374,6 @@ CREATE TABLE phpbb_themes ( # # Table structure for table 'phpbb_themes_name' # -DROP TABLE IF EXISTS phpbb_themes_name; CREATE TABLE phpbb_themes_name ( themes_id smallint(5) UNSIGNED DEFAULT '0' NOT NULL, tr_color1_name char(50), @@ -435,7 +414,6 @@ CREATE TABLE phpbb_themes_name ( # # Table structure for table 'phpbb_topics' # -DROP TABLE IF EXISTS phpbb_topics; CREATE TABLE phpbb_topics ( topic_id mediumint(8) UNSIGNED NOT NULL auto_increment, forum_id smallint(8) UNSIGNED DEFAULT '0' NOT NULL, @@ -460,7 +438,6 @@ CREATE TABLE phpbb_topics ( # # Table structure for table 'phpbb_topics_watch' # -DROP TABLE IF EXISTS phpbb_topics_watch; CREATE TABLE phpbb_topics_watch ( topic_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', user_id mediumint(8) NOT NULL DEFAULT '0', @@ -475,7 +452,6 @@ CREATE TABLE phpbb_topics_watch ( # # Table structure for table 'phpbb_users' # -DROP TABLE IF EXISTS phpbb_users; CREATE TABLE phpbb_users ( user_id mediumint(8) NOT NULL auto_increment, user_active tinyint(1) DEFAULT '1', @@ -529,7 +505,6 @@ CREATE TABLE phpbb_users ( # # Table structure for table 'phpbb_vote_desc' # -DROP TABLE IF EXISTS phpbb_vote_desc; CREATE TABLE phpbb_vote_desc ( vote_id mediumint(8) UNSIGNED NOT NULL auto_increment, topic_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', @@ -545,7 +520,6 @@ CREATE TABLE phpbb_vote_desc ( # # Table structure for table 'phpbb_vote_results' # -DROP TABLE IF EXISTS phpbb_vote_results; CREATE TABLE phpbb_vote_results ( vote_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', vote_option_id tinyint(4) UNSIGNED NOT NULL DEFAULT '0', @@ -560,7 +534,6 @@ CREATE TABLE phpbb_vote_results ( # # Table structure for table 'phpbb_vote_voters' # -DROP TABLE IF EXISTS phpbb_vote_voters; CREATE TABLE phpbb_vote_voters ( vote_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', vote_user_id mediumint(8) NOT NULL DEFAULT '0', @@ -575,7 +548,6 @@ CREATE TABLE phpbb_vote_voters ( # # Table structure for table 'phpbb_words' # -DROP TABLE IF EXISTS phpbb_words; CREATE TABLE phpbb_words ( word_id mediumint(8) UNSIGNED NOT NULL auto_increment, word char(100) NOT NULL, diff --git a/phpBB/install.php b/phpBB/install.php index 64c5de37a6..77875b72e5 100644 --- a/phpBB/install.php +++ b/phpBB/install.php @@ -22,6 +22,10 @@ $phpbb_root_path='./'; include($phpbb_root_path.'extension.inc'); +$userdata = array(); +$lang = array(); +$reinstall = false; + if( !get_magic_quotes_gpc() ) { if( is_array($HTTP_GET_VARS) ) @@ -96,30 +100,89 @@ if( !get_magic_quotes_gpc() ) $default_language = 'english'; $default_template = 'subSilver'; - + $available_dbms = array( - array( - "LABEL" => "MySQL", - "VALUE" => "mysql" + "mysql" => array( + "LABEL" => "MySQL 3.x", + "SCHEMA" => "mysql", + "DELIM" => ";", + "DELIM_BASIC" => ";", + "COMMENTS" => "remove_remarks" ), - array( + "mysql4" => array( + "LABEL" => "MySQL 4.x", + "SCHEMA" => "mysql", + "DELIM" => ";", + "DELIM_BASIC" => ";", + "COMMENTS" => "remove_remarks" + ), + "postgres" => array( "LABEL" => "PostgreSQL 7.x", - "VALUE" => "postgres" + "SCHEMA" => "postgres", + "DELIM" => ";", + "DELIM_BASIC" => ";", + "COMMENTS" => "remove_comments" ), - array( + "mssql" => array( "LABEL" => "MS SQL Server 7/2000", - "VALUE" => "mssql" + "SCHEMA" => "mssql", + "DELIM" => "GO", + "DELIM_BASIC" => ";", + "COMMENTS" => "remove_comments" ), - array( + "msaccess" => array( "LABEL" => "MS Access [ ODBC ]", - "VALUE" => "msaccess" + "SCHEMA" => "", + "DELIM" => "", + "DELIM_BASIC" => ";", + "COMMENTS" => "" + ), + "mssql-odbc" => array( + "LABEL" => "MS SQL Server [ ODBC ]", + "SCHEMA" => "mssql", + "DELIM" => "GO", + "DELIM_BASIC" => ";", + "COMMENTS" => "remove_comments" ) ); // -// Uncomment the following line to completely disable the ftp option... +// drop table schema // +$sql_array = array(); + +$sql_array['drop_schema'][] = "DROP TABLE phpbb_auth_access"; +$sql_array['drop_schema'][] = "DROP TABLE phpbb_banlist"; +$sql_array['drop_schema'][] = "DROP TABLE phpbb_categories"; +$sql_array['drop_schema'][] = "DROP TABLE phpbb_config"; +$sql_array['drop_schema'][] = "DROP TABLE phpbb_disallow"; +$sql_array['drop_schema'][] = "DROP TABLE phpbb_forum_prune"; +$sql_array['drop_schema'][] = "DROP TABLE phpbb_forums"; +$sql_array['drop_schema'][] = "DROP TABLE phpbb_groups"; +$sql_array['drop_schema'][] = "DROP TABLE phpbb_posts"; +$sql_array['drop_schema'][] = "DROP TABLE phpbb_posts_text"; +$sql_array['drop_schema'][] = "DROP TABLE phpbb_privmsgs"; +$sql_array['drop_schema'][] = "DROP TABLE phpbb_privmsgs_text"; +$sql_array['drop_schema'][] = "DROP TABLE phpbb_ranks"; +$sql_array['drop_schema'][] = "DROP TABLE phpbb_search_results"; +$sql_array['drop_schema'][] = "DROP TABLE phpbb_search_wordlist"; +$sql_array['drop_schema'][] = "DROP TABLE phpbb_search_wordmatch"; +$sql_array['drop_schema'][] = "DROP TABLE phpbb_sessions"; +$sql_array['drop_schema'][] = "DROP TABLE phpbb_smilies"; +$sql_array['drop_schema'][] = "DROP TABLE phpbb_themes"; +$sql_array['drop_schema'][] = "DROP TABLE phpbb_themes_name"; +$sql_array['drop_schema'][] = "DROP TABLE phpbb_topics"; +$sql_array['drop_schema'][] = "DROP TABLE phpbb_topics_watch"; +$sql_array['drop_schema'][] = "DROP TABLE phpbb_user_group"; +$sql_array['drop_schema'][] = "DROP TABLE phpbb_users"; +$sql_array['drop_schema'][] = "DROP TABLE phpbb_vote_desc"; +$sql_array['drop_schema'][] = "DROP TABLE phpbb_vote_results"; +$sql_array['drop_schema'][] = "DROP TABLE phpbb_vote_voters"; +$sql_array['drop_schema'][] = "DROP TABLE phpbb_words"; +// +// Uncomment the following line to completely disable the ftp option... +// // define('NO_FTP', true); /*************************************************************************** @@ -128,12 +191,12 @@ $available_dbms = array( * ***************************************************************************/ -$userdata = array(); -$lang = array(); - // // Obtain various vars // +$confirm = ( isset($HTTP_POST_VARS['confirm']) ) ? true : false; +$cancel = ( isset($HTTP_POST_VARS['cancel']) ) ? true : false; + if( isset($HTTP_POST_VARS['install_step']) || isset($HTTP_GET_VARS['install_step']) ) { $install_step = ( isset($HTTP_POST_VARS['install_step']) ) ? $HTTP_POST_VARS['install_step'] : $HTTP_GET_VARS['install_step']; @@ -143,6 +206,7 @@ else $install_step = ""; } +$upgrade = ( !empty($HTTP_POST_VARS['upgrade']) ) ? $HTTP_POST_VARS['upgrade']: ''; $dbms = isset($HTTP_POST_VARS['dbms']) ? $HTTP_POST_VARS['dbms'] : ""; $language = ( !empty($HTTP_POST_VARS['language']) ) ? $HTTP_POST_VARS['language'] : $default_language; @@ -151,71 +215,125 @@ $dbuser = ( !empty($HTTP_POST_VARS['dbuser']) ) ? $HTTP_POST_VARS['dbuser'] : "" $dbpasswd = ( !empty($HTTP_POST_VARS['dbpasswd']) ) ? $HTTP_POST_VARS['dbpasswd'] : ""; $dbname = ( !empty($HTTP_POST_VARS['dbname']) ) ? $HTTP_POST_VARS['dbname'] : ""; +$table_prefix = ( !empty($HTTP_POST_VARS['prefix']) ) ? $HTTP_POST_VARS['prefix'] : ""; + $admin_username = ( !empty($HTTP_POST_VARS['admin_user']) ) ? $HTTP_POST_VARS['admin_user'] : ""; $admin_pass1 = ( !empty($HTTP_POST_VARS['admin_pass1']) ) ? $HTTP_POST_VARS['admin_pass1'] : ""; $admin_pass2 = ( !empty($HTTP_POST_VARS['admin_pass2']) ) ? $HTTP_POST_VARS['admin_pass2'] : ""; -$table_prefix = ( !empty($HTTP_POST_VARS['prefix']) ) ? $HTTP_POST_VARS['prefix'] : ""; $ftp_path = ( !empty($HTTP_POST_VARS['ftp_path']) ) ? $HTTP_POST_VARS['ftp_path'] : ""; $ftp_user = ( !empty($HTTP_POST_VARS['ftp_user']) ) ? $HTTP_POST_VARS['ftp_user'] : ""; $ftp_pass = ( !empty($HTTP_POST_VARS['ftp_pass']) ) ? $HTTP_POST_VARS['ftp_pass'] : ""; -$upgrade = ( !empty($HTTP_POST_VARS['upgrade']) ) ? $HTTP_POST_VARS['upgrade']: ''; - -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/functions.'.$phpEx); -include($phpbb_root_path.'includes/sessions.'.$phpEx); - -// -// Import language file, setup template ... -// -include($phpbb_root_path.'language/lang_' . $language . '/lang_main.'.$phpEx); -include($phpbb_root_path.'language/lang_' . $language . '/lang_admin.'.$phpEx); - -$template = new Template($phpbb_root_path . "templates/" . $default_template); -if( $upgrade == 1 ) -{ - require('upgrade.'.$phpEx); - $install_step = 1; -} - -// -// Load default template for install -// -$template->set_filenames(array( - "body" => "install.tpl") -); - -$template->assign_vars(array( - "L_INSTALLATION" => $lang['Welcome_install']) -); - - -// -// Start main program ... -// if( @file_exists('config.'.$phpEx) ) { include('config.'.$phpEx); } -if( defined("PHPBB_INSTALLED") ) +if( !defined("PHPBB_INSTALLED") ) { + 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/functions.'.$phpEx); + include($phpbb_root_path.'includes/sessions.'.$phpEx); + // - // Sorry this has already been installed can't do anything more with it + // Import language file, setup template ... // - $template->assign_block_vars("switch_error_install", array()); + include($phpbb_root_path.'language/lang_' . $language . '/lang_main.'.$phpEx); + include($phpbb_root_path.'language/lang_' . $language . '/lang_admin.'.$phpEx); + + $template = new Template($phpbb_root_path . "templates/" . $default_template); + + if( $upgrade == 1 ) + { + require('upgrade.'.$phpEx); + $install_step = 1; + } + + // + // Load default template for install + // + $template->set_filenames(array( + "body" => "install.tpl") + ); + $template->assign_vars(array( - "L_ERROR_TITLE" => $lang['Installer_Error'], - "L_ERROR" => $lang['Previous_Install']) + "L_INSTALLATION" => $lang['Welcome_install']) ); +} +else +{ + define("IN_ADMIN", 1); - $template->pparse('body'); - exit; + include($phpbb_root_path.'common.'.$phpEx); + include($phpbb_root_path.'includes/sql_parse.'.$phpEx); + + // + // Set page ID for session management + // + $userdata = session_pagestart($user_ip, PAGE_INDEX, $session_length); + init_userprefs($userdata); + // + // End session management + // + + if( $userdata['user_level'] == ADMIN && !$cancel && $dbms != 'msaccess' ) + { + if( !$confirm ) + { + // + // Sorry this has already been installed can't do anything more with it + // + include($phpbb_root_path . 'includes/page_header.'.$phpEx); + + $template->set_filenames(array( + "confirm" => "confirm_body.tpl") + ); + + $template->assign_vars(array( + "MESSAGE_TITLE" => $lang['Admin_config'], + "MESSAGE_TEXT" => $lang['Re_install'], + + "L_YES" => $lang['Yes'], + "L_NO" => $lang['No'], + + "S_CONFIRM_ACTION" => append_sid("install.$phpEx"), + "S_HIDDEN_FIELDS" => $hidden_fields) + ); + + $template->pparse("confirm"); + + include($phpbb_root_path . 'includes/page_tail.'.$phpEx); + } + + include($phpbb_root_path.'language/lang_' . $language . '/lang_main.'.$phpEx); + include($phpbb_root_path.'language/lang_' . $language . '/lang_admin.'.$phpEx); + + $template = new Template($phpbb_root_path . "templates/" . $default_template); + + $template->set_filenames(array( + "body" => "install.tpl") + ); + + $template->assign_vars(array( + "L_INSTALLATION" => $lang['Welcome_install']) + ); + + $reinstall = true; + } + else + { + header("HTTP/1.0 302 Redirect"); + header("Location: " . append_sid("index.$phpEx", true)); + } } -else if( !empty($HTTP_POST_VARS['send_file']) && $HTTP_POST_VARS['send_file'] == 1 ) + +// +// +// +if( !empty($HTTP_POST_VARS['send_file']) && $HTTP_POST_VARS['send_file'] == 1 && !defined("PHPBB_INSTALLED") ) { header("Content-Type: text/x-delimtext; name=\"config.php\""); header("Content-disposition: attachment; filename=config.php"); @@ -231,7 +349,7 @@ else if( !empty($HTTP_POST_VARS['send_file']) && $HTTP_POST_VARS['send_file'] == exit; } -else if( !empty($HTTP_POST_VARS['send_file']) && $HTTP_POST_VARS['send_file'] == 2 ) +else if( !empty($HTTP_POST_VARS['send_file']) && $HTTP_POST_VARS['send_file'] == 2 && !defined("PHPBB_INSTALLED") ) { // // Ok we couldn't write the config file so let's try ftping it. @@ -239,93 +357,101 @@ else if( !empty($HTTP_POST_VARS['send_file']) && $HTTP_POST_VARS['send_file'] == $HTTP_POST_VARS['config_data'] = stripslashes($HTTP_POST_VARS['config_data']); - $s_hidden_fields = '<input type="hidden" name="config_data" value="'.htmlspecialchars($HTTP_POST_VARS['config_data']).'" />'; + $s_hidden_fields = '<input type="hidden" name="config_data" value="' . htmlspecialchars($HTTP_POST_VARS['config_data']) . '" />'; $s_hidden_fields .= '<input type="hidden" name="ftp_file" value="1" />'; + $template->assign_block_vars("switch_ftp_file", array()); $template->assign_block_vars("switch_common_install", array()); + $template->assign_vars(array( - "L_INSTRUCTION_TEXT" => $lang['ftp_instructs'], - "L_FTP_INFO" => $lang['ftp_info'], - "L_FTP_PATH" => $lang['ftp_path'], - "L_FTP_PASS" => $lang['ftp_password'], - "L_FTP_USER" => $lang['ftp_username'], - "L_SUBMIT" => $lang['Transfer_config'], - "S_HIDDEN_FIELDS" => $s_hidden_fields, - "S_FORM_ACTION" => "install.$phpEx") + "L_INSTRUCTION_TEXT" => $lang['ftp_instructs'], + "L_FTP_INFO" => $lang['ftp_info'], + "L_FTP_PATH" => $lang['ftp_path'], + "L_FTP_PASS" => $lang['ftp_password'], + "L_FTP_USER" => $lang['ftp_username'], + "L_SUBMIT" => $lang['Transfer_config'], + + "S_HIDDEN_FIELDS" => $s_hidden_fields, + "S_FORM_ACTION" => "install.$phpEx") ); + $template->pparse("body"); + exit; + } -else if( !empty($HTTP_POST_VARS['ftp_file']) ) +else if( !empty($HTTP_POST_VARS['ftp_file']) && !defined("PHPBB_INSTALLED") ) { // // Here we'll actually send the file... // $HTTP_POST_VARS['config_data'] = stripslashes($HTTP_POST_VARS['config_data']); - $conn_id = ftp_connect('localhost'); - $login_result = ftp_login($conn_id, "$ftp_user", "$ftp_pass"); - if( (!$conn_id) || (!$login_result) ) + $conn_id = @ftp_connect('localhost'); + $login_result = @ftp_login($conn_id, "$ftp_user", "$ftp_pass"); + + if( !$conn_id || !$login_result ) { // // Error couldn't get connected... Go back to option to send file... // $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_block_vars("switch_common_install", array()); - if ( $dbms == 'odbc' ) - { - // - // Output the instruction_textions for the odbc... - // - $s_hidden_fields .= '<input type="hidden" name="install_step" value="3" />'; - $lang['NoFTP_config'] = $lang['ODBC_Instructs'] . '<br />' . $lang['NoFTP_config']; - } + $template->assign_vars(array( "L_INSTRUCTION_TEXT" => $lang['NoFTP_config'], "L_SUBMIT" => $lang['Download_config'], + "S_HIDDEN_FIELDS" => $s_hidden_fields, "S_FORM_ACTION" => "install.$phpEx") ); + $template->pparse('body'); - exit(); + + exit; } else { // // Write out a temp file... // - $tmpfname = tempnam('/tmp', 'cfg'); + $tmpfname = @tempnam('/tmp', 'cfg'); + @unlink($tmpfname); // unlink for safety on php4.0.3+ + $fp = @fopen($tmpfname, 'w'); + @fwrite($fp, $HTTP_POST_VARS['config_data']); + @fclose($fp); + // // Now ftp it across. // @ftp_chdir($conn_id, $ftp_dir); + $res = ftp_put($conn_id, 'config.php', $tmpfname, FTP_ASCII); + @ftp_quit($conn_id); + unlink($tmpfname); // // 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="redirect" 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']; - } + $s_hidden_fields .= '<input type="hidden" name="submit" value="' . $lang['Login'] . '" />'; + $template->assign_block_vars("switch_common_install", array()); + $template->assign_vars(array( "L_INSTRUCTION_TEXT" => $lang['Inst_Step_2'], "L_SUBMIT" => $lang['Finish_Install'], @@ -335,10 +461,11 @@ else if( !empty($HTTP_POST_VARS['ftp_file']) ) ); $template->pparse('body'); + exit(); } } -else if( empty($install_step) || $admin_pass1 != $admin_pass2 || $dbhost == "" ) +else if( ( empty($install_step) || $admin_pass1 != $admin_pass2 || $dbhost == "" ) && !defined("PHPBB_INSTALLED") ) { // // Ok we haven't installed before so lets work our way through the various @@ -360,25 +487,17 @@ else if( empty($install_step) || $admin_pass1 != $admin_pass2 || $dbhost == "" ) $lang_options = language_select($language, 'language'); $dbms_options = '<select name="dbms">'; - for($i = 0; $i < count($available_dbms); $i++) + while( list($dbms_name, $details) = @each($available_dbms) ) { - $selected = ( $available_dbms[$i]['VALUE'] == $dbms ) ? "selected=\"selected\"" : ""; - $dbms_options .= '<option value="' . $available_dbms[$i]['VALUE'] . '">' . $available_dbms[$i]['LABEL'] . '</option>'; + $selected = ( $dbms_name == $dbms ) ? "selected=\"selected\"" : ""; + $dbms_options .= '<option value="' . $dbms_name . '">' . $details['LABEL'] . '</option>'; } $dbms_options .= '</select>'; $upgrade_option = '<select name="upgrade"'; - $upgrade_option .= 'onchange="if(this.options[this.selectedIndex].value==1) - { - document.install_form.dbms.selectedIndex=0; - document.install_form.dbms.disabled=1; - } - else - { - document.install_form.dbms.disabled=0; - }">'; - $upgrade_option .= '<option value="0">'.$lang['Install'].'</option>'; - $upgrade_option .= '<option value="1">'.$lang['Upgrade'].'</option></select>'; + $upgrade_option .= 'onchange="if( this.options[this.selectedIndex].value == 1 ) { document.install_form.dbms.selectedIndex=0; document.install_form.dbms.disabled=1; } else { document.install_form.dbms.disabled=0; }">'; + $upgrade_option .= '<option value="0">' . $lang['Install'] . '</option>'; + $upgrade_option .= '<option value="1">' . $lang['Upgrade'] . '</option></select>'; $s_hidden_fields = '<input type="hidden" name="install_step" value="1" />'; @@ -401,10 +520,9 @@ else if( empty($install_step) || $admin_pass1 != $admin_pass2 || $dbhost == "" ) "L_ADMIN_USERNAME" => $lang['Administrator'] . ' ' . $lang['Username'], "L_ADMIN_PASSWORD" => $lang['Administrator'] . ' ' . $lang['Password'], "L_ADMIN_CONFIRM_PASSWORD" => $lang['Confirm'] . ' ' . $lang['Password'], - "L_SUBMIT" => $lang['Start_Install'], - "DB_PREFIX" => ( $table_prefix != "" ) ? $table_prefix : "phpbb_", + "DB_PREFIX" => ( !empty($table_prefix) ) ? $table_prefix : "phpbb_", "DB_HOST" => ( $dbhost != "" ) ? $dbhost : "", "DB_USER" => ( $dbuser != "" ) ? $dbuser : "", "DB_PASSWD" => ( $dbpasswd != "" ) ? $dbpasswd : "", @@ -417,92 +535,132 @@ else if( empty($install_step) || $admin_pass1 != $admin_pass2 || $dbhost == "" ) "S_FORM_ACTION" => "install.$phpEx") ); -// "L_DOMAIN_NAME" => $lang['Domain_name'], -// "L_DOMAIN_NAME_EXPLAIN" => $lang['Domain_name_explain'], - $template->pparse("body"); - exit(); + exit; } else { // - // If the dbms is set to be odbc then we need to skip most of the - // steps and go straight to writing the config file. We'll spit - // out some additional instruction_textions later on what to do after installation - // for the odbc DBMS. + // Go ahead and create the DB, then populate it // - print "dbms = - $dbms -<br>"; - if( isset($dbms) ) + // MS Access is slightly different in that a pre-built, pre- + // populated DB is supplied, all we need do here is update + // the relevant entries + // + if( $reinstall ) + { + $sql_query = preg_replace('/phpbb_/', $table_prefix, $sql_array['drop_schema']); + $sql_count = count($sql_query); + + for($i = 0; $i < $sql_count; $i++) + { + $result = $db->sql_query($sql_query[$i]); + if( !$result ) + { + $error = $db->sql_error(); + + $template->assign_block_vars("switch_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; + } + } + + $admin_name = $userdata['username']; + $admin_pass1 = $userdata['user_password']; + $language = $userdata['user_lang']; + } + else if( isset($dbms) ) { include($phpbb_root_path.'includes/db.'.$phpEx); } - $dbms_schema = 'db/schemas/' . $dbms.'_schema.sql'; - $dbms_basic = 'db/schemas/' . $dbms . '_basic.sql'; + $dbms_schema = 'db/schemas/' . $available_dbms[$dbms]['SCHEMA'] . '_schema.sql'; + $dbms_basic = 'db/schemas/' . $available_dbms[$dbms]['SCHEMA'] . '_basic.sql'; - $remove_remarks = ( $dbms == 'mysql' ) ? 'remove_remarks' : 'remove_comments'; - $delimiter = ( $dbms == 'mssql' ) ? 'GO' : ';'; + $remove_remarks = $available_dbms[$dbms]['COMMENTS'];; + $delimiter = $available_dbms[$dbms]['DELIM']; + $delimiter_basic = $available_dbms[$dbms]['DELIM_BASIC']; - if( $install_step == 1 ) + if( $install_step == 1 || $reinstall ) { - if( $dbms != 'msaccess' && $upgrade != 1 ) + if( $upgrade != 1 ) { - // - // 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 - // kind of feedback to the user as we are working here in order - // to let them know we are actually doing something. - // - $sql_query = @fread(@fopen($dbms_schema, 'r'), @filesize($dbms_schema)); - $sql_query = $remove_remarks($sql_query); - $sql_query = split_sql_file($sql_query, $delimiter); - $sql_count = count($sql_query); - $sql_query = preg_replace('/phpbb_/', $table_prefix, $sql_query); - - for($i = 0; $i < $sql_count; $i++) + if( $dbms != 'msaccess' ) { - $result = $db->sql_query($sql_query[$i]); - if( !$result ) + // + // 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 + // kind of feedback to the user as we are working here in order + // to let them know we are actually doing something. + // + $sql_query = @fread(@fopen($dbms_schema, 'r'), @filesize($dbms_schema)); + $sql_query = preg_replace('/phpbb_/', $table_prefix, $sql_query); + + $sql_query = $remove_remarks($sql_query); + $sql_query = split_sql_file($sql_query, $delimiter); + + $sql_count = count($sql_query); + + for($i = 0; $i < $sql_count; $i++) { - $error = $db->sql_error(); - - $template->assign_block_vars("switch_error_install", array()); + $result = $db->sql_query($sql_query[$i]); + if( !$result ) + { + $error = $db->sql_error(); + + $template->assign_block_vars("switch_error_install", array()); - $template->assign_vars(array( - "L_ERROR_TITLE" => $lang['Installer_Error'], - "L_ERROR" => $lang['Install_db_error'] . '<br>' . $error['message']) - ); - $template->pparse('body'); - exit; + $template->assign_vars(array( + "L_ERROR_TITLE" => $lang['Installer_Error'], + "L_ERROR" => $lang['Install_db_error'] . '<br />' . $error['message']) + ); + + $template->pparse('body'); + + exit; + } } - } - - // - // Ok tables have been built, let's fill in the basic information - // - $sql_query = @fread(@fopen($dbms_basic, 'r'), @filesize($dbms_basic)); - $sql_query = $remove_remarks($sql_query); - $sql_query = split_sql_file($sql_query, $delimiter); + + // + // Ok tables have been built, let's fill in the basic information + // + $sql_query = @fread(@fopen($dbms_basic, 'r'), @filesize($dbms_basic)); + $sql_query = preg_replace('/phpbb_/', $table_prefix, $sql_query); + + $sql_query = $remove_remarks($sql_query); + $sql_query = split_sql_file($sql_query, $delimiter_basic); + $sql_count = count($sql_query); - $sql_query = preg_replace('/phpbb_/', $table_prefix, $sql_query); - - for($i = 0; $i < $sql_count; $i++) - { - $result = $db->sql_query($sql_query[$i]); - if( !$result ) + + for($i = 0; $i < $sql_count; $i++) { - $error = $db->sql_error(); - - $template->assign_block_vars("switch_error_install", array()); - $template->assign_vars(array( - "L_ERROR_TITLE" => $lang['Installer_Error'], - "L_ERROR" => $lang['Install_db_error'] . "<br />" . $error["message"]) - ); - $template->pparse('body'); - exit; + $result = $db->sql_query($sql_query[$i]); + if( !$result ) + { + $error = $db->sql_error(); + + $template->assign_block_vars("switch_error_install", array()); + + $template->assign_vars(array( + "L_ERROR_TITLE" => $lang['Installer_Error'], + "L_ERROR" => $lang['Install_db_error'] . "<br />" . $error["message"]) + ); + + $template->pparse('body'); + + exit; + } } } + // // Ok at this point they have entered their admin password, let's go // ahead and create the admin account with some basic default information @@ -511,6 +669,7 @@ else // to set up their forum defaults. // $error = ""; + // // Update the default admin user with their information. // @@ -519,7 +678,7 @@ else $result = $db->sql_query($sql); if( !$result ) { - $error .= "Could not insert board_startdate :: " . $sql . "<br /><br />"; + $error .= "Could not insert board_startdate :: " . $sql . " :: " . __LINE__ . " :: " . __FILE__ . "<br /><br />"; } $sql = "INSERT INTO " . $table_prefix . "config (config_name, config_value) @@ -527,16 +686,18 @@ else $result = $db->sql_query($sql); if( !$result ) { - $error .= "Could not insert default_lang :: " . $sql . "<br /><br />"; + $error .= "Could not insert default_lang :: " . $sql . " :: " . __LINE__ . " :: " . __FILE__ . "<br /><br />"; } + $admin_pass_md5 = ( $confirm && $userdata['user_level'] == ADMIN ) ? $admin_pass1 : md5($admin_pass1); + $sql = "UPDATE " . $table_prefix . "users - SET username = '$admin_name', user_password='" . md5($admin_pass1) . "', user_lang = '" . $language . "' + SET username = '$admin_name', user_password='$admin_pass_md5', user_lang = '" . $language . "' WHERE username = 'Admin'"; $result = $db->sql_query($sql); if( !$result ) { - $error .= "Could not update admin info :: " . $sql . "<br /><br />"; + $error .= "Could not update admin info :: " . $sql . " :: " . __LINE__ . " :: " . __FILE__ . "<br /><br />"; } $sql = "UPDATE " . $table_prefix . "users @@ -544,104 +705,133 @@ else $result = $db->sql_query($sql); if( !$result ) { - $error .= "Could not update user_regdate :: " . $sql . "<br /><br />"; + $error .= "Could not update user_regdate :: " . $sql . " :: " . __LINE__ . " :: " . __FILE__ . "<br /><br />"; } - if( $error != "" ) + // + // Change session table to HEAP if MySQL version matches + // + if( preg_match("/^mysql/", $dbms) ) { - $error = $db->sql_error(); + $sql = "SELECT VERSION() AS mysql_version"; + if($result = $db->sql_query($sql)) + { + $row = $db->sql_fetchrow($result); + $version = $row['mysql_version']; + + if( preg_match("/^(3\.23|4\.)/", $version) ) + { + $sql = "ALTER TABLE " . $table_prefix . "sessions + TYPE=HEAP"; + if( !$result = $db->sql_query($sql)) + { + $error .= "Could not alter session table to HEAP type :: " . $sql . " :: " . __LINE__ . " :: " . __FILE__ . "<br /><br />"; + } + } + } + } + if( $error != "" ) + { $template->assign_block_vars("switch_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("switch_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 ) + + if( !$reinstall ) { + $template->assign_block_vars("switch_common_install", array()); + // - // Unable to open the file writeable do something here as an attempt - // to get around that... + // Write out the config file. // - $s_hidden_fields = '<input type="hidden" name="config_data" value="' . htmlspecialchars($config_data) . '" />'; - if( extension_loaded('ftp') && !defined('NO_FTP') ) - { - $template->assign_block_vars('switch_ftp_option', array()); - $lang['Unwriteable_config'] .= '<p>'.$lang['ftp_option'].'</p>'; - $template->assign_vars(array( - "L_CHOOSE_FTP" => $lang['ftp_choose'], - "L_ATTEMPT_FTP" => $lang['Attempt_ftp'], - "L_SEND_FILE" => $lang['Send_file']) - ); - } - else - { - $s_hidden_fields .= '<input type="hidden" name="send_file" value="1" />'; - } - if ( $dbms == 'odbc' ) + $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 ) { // - // Output the instruction_textions for the odbc... + // Unable to open the file writeable do something here as an attempt + // to get around that... // - // $template->assign_block_vars("common_install", array()); - - $s_hidden_fields .= '<input type="hidden" name="install_step" value="3" />'; - $lang['Unwriteable_config'] = $lang['ODBC_Instructs'] . '<p>' . $lang['Unwriteable_config'] . '</p>'; - } + $s_hidden_fields = '<input type="hidden" name="config_data" value="' . htmlspecialchars($config_data) . '" />'; - $template->assign_vars(array( - "L_INSTRUCTION_TEXT" => $lang['Unwriteable_config'], - "L_SUBMIT" => $lang['Download_config'], + if( extension_loaded('ftp') && !defined('NO_FTP') ) + { + $template->assign_block_vars('switch_ftp_option', array()); - "S_HIDDEN_FIELDS" => $s_hidden_fields, - "S_FORM_ACTION" => "install.$phpEx") - ); + $lang['Unwriteable_config'] .= '<p>' . $lang['ftp_option'] . '</p>'; - $template->pparse('body'); - exit(); - } + $template->assign_vars(array( + "L_CHOOSE_FTP" => $lang['ftp_choose'], + "L_ATTEMPT_FTP" => $lang['Attempt_ftp'], + "L_SEND_FILE" => $lang['Send_file']) + ); + } + else + { + $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") + ); - $result = @fputs($fp, $config_data, strlen($config_data)); - fclose($fp); + $template->pparse('body'); + + exit; + } + + $result = @fputs($fp, $config_data, strlen($config_data)); + + @fclose($fp); + } + else + { + $template->assign_block_vars("switch_common_install", array()); + } // // 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="redirect" value="admin/" />'; - $s_hidden_fields .= '<input type="hidden" name="submit" value="Login" />'; - if ( $dbms == 'odbc' ) + if( !$reinstall ) { - // - // Output the instruction_textions for the odbc... - // - $lang['Inst_Step_2'] = $lang['ODBC_Instructs'] . '<br />' . $lang['Inst_Step_2']; + $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="redirect" value="admin/" />'; + $s_hidden_fields .= '<input type="hidden" name="login" value="true" />'; + } + else + { + $s_hidden_fields = ""; } $template->assign_vars(array( @@ -649,11 +839,13 @@ else "L_SUBMIT" => $lang['Finish_Install'], "S_HIDDEN_FIELDS" => $s_hidden_fields, - "S_FORM_ACTION" => "login.$phpEx") + "S_FORM_ACTION" => ( $reinstall ) ? append_sid("login.$phpEx") : "login.$phpEx") ); $template->pparse('body'); - exit(); + + exit; } } -?> + +?>
\ No newline at end of file diff --git a/phpBB/language/lang_english/lang_admin.php b/phpBB/language/lang_english/lang_admin.php index 8f31b4a8f7..6b6f276cd4 100644 --- a/phpBB/language/lang_english/lang_admin.php +++ b/phpBB/language/lang_english/lang_admin.php @@ -493,47 +493,6 @@ $lang['Click_return_massemail'] = "Click %sHere%s to return to the Mass Email fo // -// Install Process -// -$lang['Welcome_install'] = "Welcome to phpBB 2 Installation"; -$lang['Initial_config'] = "Basic Configuration"; -$lang['DB_config'] = "Database Configuration"; -$lang['Admin_config'] = "Admin Configuration"; -$lang['Installer_Error'] = "An error has occurred during installation"; -$lang['Previous_Install'] = "A previous installation has been detected"; -$lang['Inst_Step_0'] = "Thank you for choosing phpBB 2. In order to complete this install please fill out the details requested below. Please note that the database you install into should already exist"; -$lang['Start_Install'] = "Start Install"; -$lang['Default_lang'] = "Default board language"; -$lang['DB_Host'] = "Database Server Hostname"; -$lang['DB_Name'] = "Your Database Name"; -$lang['Database'] = "Your Database"; -$lang['Install_lang'] = "Choose Language for Installation"; -$lang['dbms'] = "Database Type"; -$lang['Inst_Step_1'] = "Your database tables have been created and filled with some basic default data. Please enter your chosen phpBB Admin Username and Password."; -$lang['Create_User'] = "Create User"; -$lang['Inst_Step_2'] = "Your admin username has been created. At this point your basic installation is complete. You will now be taken to a screen which will allow you to administer your new installation. Please be sure to check the General Configuration details and make any required changes. Thank you for choosing phpBB 2."; -$lang['Finish_Install'] = "Finish Installation"; -$lang['Install_db_error'] = "An error occurred trying to update the database"; -$lang['ODBC_Instructs'] = "To complete your installation of this database you need to create a System Data Source Name, or System DSN pointing towards the relevant data source. You should refer to the ODBC section of your database server installation manual for assistance. If you are hosting this board on a host to which you do not have control you should request your provider to install or run the necessary files and create an appropriate DSN."; -$lang['Table_Prefix'] = "Prefix for tables in database"; -$lang['Unwriteable_config'] = "Your config file is un-writeable at present. A copy of the config file will be downloaded to your when you click the button below. You should upload this file to the same directory as phpBB 2. Once this is done you should log in using the administrator name and password you provided on the previous form and visit the admin control centre (a link will appear at the bottom of each screen once logged in) to check the general configuration. Thank you for choosing phpBB 2."; -$lang['Download_config'] = "Download Config"; -$lang['ftp_choose'] = "Choose Download Method"; -$lang['Attempt_ftp'] = "Attempt to ftp config file into place"; -$lang['Send_file'] = "Just send the file to me and I'll ftp it manually"; -$lang['ftp_option'] = "<br />Since FTP extensions are enabled in this version of PHP you may also be given the option of first trying to automatically ftp the config file into place."; -$lang['ftp_instructs'] = "You have chosen to ftp the file to the account containing phpBB 2 automatically. Please enter the information below to facilitate this process. Note that the FTP path should be the exact path via ftp to your phpBB2 installation as if you were ftping to it using any normal client."; -$lang['ftp_path'] = "FTP path to phpBB2"; -$lang['ftp_username'] = "Your FTP Username"; -$lang['ftp_password'] = "Your FTP Password"; -$lang['Transfer_config'] = "Start Transfer"; -$lang['ftp_info'] = "Enter Your FTP Information"; -$lang['Install'] = "Install"; -$lang['Upgrade'] = "Upgrade"; -$lang['Install_Method'] = "Choose your installation method"; - - -// // Ranks admin // $lang['Ranks_title'] = "Rank Administration"; @@ -665,6 +624,58 @@ $lang['span_class3'] = "Span Class 3"; $lang['img_poll_size'] = "Polling Image Size [px]"; $lang['img_pm_size'] = "Private Message Status size [px]"; + +// +// Install Process +// +$lang['Welcome_install'] = "Welcome to phpBB 2 Installation"; +$lang['Initial_config'] = "Basic Configuration"; +$lang['DB_config'] = "Database Configuration"; +$lang['Admin_config'] = "Admin Configuration"; + +$lang['Installer_Error'] = "An error has occurred during installation"; +$lang['Previous_Install'] = "A previous installation has been detected"; +$lang['Install_db_error'] = "An error occurred trying to update the database"; + +$lang['Re_install'] = "Your previous installation is still active. <br /><br />If you would like to re-install phpBB 2 you should click the Yes button below. Please be aware that doing so will destroy all existing data, no backups will be made! The administrator username and password you have used to login in to the board will be re-created after the re-installation, no other settings will be retained. <br /><br />Think carefully before pressing Yes!"; + +$lang['Inst_Step_0'] = "Thank you for choosing phpBB 2. In order to complete this install please fill out the details requested below. Please note that the database you install into should already exist. If you are installing to a database that uses ODBC, e.g. MS Access you should first create a DSN for it before proceeding."; + +$lang['Start_Install'] = "Start Install"; +$lang['Finish_Install'] = "Finish Installation"; + +$lang['Default_lang'] = "Default board language"; +$lang['DB_Host'] = "Database Server Hostname / DSN"; +$lang['DB_Name'] = "Your Database Name"; +$lang['Database'] = "Your Database"; +$lang['Install_lang'] = "Choose Language for Installation"; +$lang['dbms'] = "Database Type"; +$lang['Table_Prefix'] = "Prefix for tables in database"; +$lang['Admin_Username'] = "Administrator Username"; +$lang['Admin_Password'] = "Administrator Password"; +$lang['Admin_Password_confirm'] = "Administrator Password [ Confirm ]"; + +$lang['Inst_Step_2'] = "Your admin username has been created. At this point your basic installation is complete. You will now be taken to a screen which will allow you to administer your new installation. Please be sure to check the General Configuration details and make any required changes. Thank you for choosing phpBB 2."; + +$lang['Unwriteable_config'] = "Your config file is un-writeable at present. A copy of the config file will be downloaded to your when you click the button below. You should upload this file to the same directory as phpBB 2. Once this is done you should log in using the administrator name and password you provided on the previous form and visit the admin control centre (a link will appear at the bottom of each screen once logged in) to check the general configuration. Thank you for choosing phpBB 2."; +$lang['Download_config'] = "Download Config"; + +$lang['ftp_choose'] = "Choose Download Method"; +$lang['ftp_option'] = "<br />Since FTP extensions are enabled in this version of PHP you may also be given the option of first trying to automatically ftp the config file into place."; +$lang['ftp_instructs'] = "You have chosen to ftp the file to the account containing phpBB 2 automatically. Please enter the information below to facilitate this process. Note that the FTP path should be the exact path via ftp to your phpBB2 installation as if you were ftping to it using any normal client."; +$lang['ftp_info'] = "Enter Your FTP Information"; +$lang['Attempt_ftp'] = "Attempt to ftp config file into place"; +$lang['Send_file'] = "Just send the file to me and I'll ftp it manually"; +$lang['ftp_path'] = "FTP path to phpBB 2"; +$lang['ftp_username'] = "Your FTP Username"; +$lang['ftp_password'] = "Your FTP Password"; +$lang['Transfer_config'] = "Start Transfer"; + +$lang['Install'] = "Install"; +$lang['Upgrade'] = "Upgrade"; + +$lang['Install_Method'] = "Choose your installation method"; + // // That's all Folks! // ------------------------------------------------- |