From daa0435614af7bed95e71f3b11aa2c372df3958d Mon Sep 17 00:00:00 2001 From: Graham Eames Date: Wed, 21 Jun 2006 20:18:02 +0000 Subject: [PATCH] Improve i18n by installing all available language packs on install + unb0rk the mysql schema ;) git-svn-id: file:///svn/phpbb/trunk@6113 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/install_install.php | 35 ++++++++++++++++++++++++++ phpBB/install/schemas/mysql_schema.sql | 24 +++++++++--------- phpBB/install/schemas/schema_data.sql | 3 --- 3 files changed, 47 insertions(+), 15 deletions(-) diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 6530876ee4..4ce0b27bfd 100755 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -87,6 +87,7 @@ class install_install extends module case 'final' : $this->load_schema($mode, $sub); $this->add_modules($mode, $sub); + $this->add_language($mode, $sub); $this->add_bots($mode, $sub); $this->email_admin($mode, $sub); @@ -1354,6 +1355,40 @@ class install_install extends module } } + /** + * Populate the language tables + */ + function add_language($mode, $sub) + { + global $db, $lang, $phpbb_root_path, $phpEx; + + $dir = @opendir($phpbb_root_path . 'language'); + while (($file = readdir($dir)) !== false) + { + $path = $phpbb_root_path . 'language/' . $file; + + if (is_dir($path) && !is_link($path) && file_exists($path . '/iso.txt')) + { + $lang_pack = file("{$phpbb_root_path}language/$path/iso.txt"); + $sql_ary = array( + 'lang_iso' => basename($path), + 'lang_dir' => basename($path), + 'lang_english_name' => trim(htmlspecialchars($lang_pack[0])), + 'lang_local_name' => trim(htmlspecialchars($lang_pack[1])), + 'lang_author' => trim(htmlspecialchars($lang_pack[2])), + ); + + $db->sql_query('INSERT INTO ' . LANG_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); + + if ($db->sql_error_triggered) + { + $error = $db->sql_error($db->sql_error_sql); + $this->p_master->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__); + } + } + } + } + /** * Add search robots to the database */ diff --git a/phpBB/install/schemas/mysql_schema.sql b/phpBB/install/schemas/mysql_schema.sql index fad2c457e3..b996eea287 100644 --- a/phpBB/install/schemas/mysql_schema.sql +++ b/phpBB/install/schemas/mysql_schema.sql @@ -195,9 +195,9 @@ CREATE TABLE phpbb_extension_groups ( # Table: 'phpbb_forums' CREATE TABLE phpbb_forums ( forum_id smallint(5) UNSIGNED NOT NULL auto_increment, - parent_id smallint(5) DEFAULT '0' UNSIGNED NOT NULL, - left_id smallint(5) DEFAULT '0' UNSIGNED NOT NULL, - right_id smallint(5) DEFAULT '0' UNSIGNED NOT NULL, + parent_id smallint(5) UNSIGNED DEFAULT '0' NOT NULL, + left_id smallint(5) UNSIGNED DEFAULT '0' NOT NULL, + right_id smallint(5) UNSIGNED DEFAULT '0' NOT NULL, forum_parents text, forum_name text, forum_desc text, @@ -227,8 +227,8 @@ CREATE TABLE phpbb_forums ( enable_icons tinyint(1) DEFAULT '1' NOT NULL, enable_prune tinyint(1) DEFAULT '0' NOT NULL, prune_next int(11) UNSIGNED, - prune_days tinyint(4) DEFAULT '0' UNSIGNED NOT NULL, - prune_viewed tinyint(4) DEFAULT '0' UNSIGNED NOT NULL, + prune_days tinyint(4) UNSIGNED DEFAULT '0' NOT NULL, + prune_viewed tinyint(4) UNSIGNED DEFAULT '0' NOT NULL, prune_freq tinyint(4) UNSIGNED DEFAULT '0' NOT NULL, PRIMARY KEY (forum_id), KEY left_right_id (left_id, right_id), @@ -289,9 +289,9 @@ CREATE TABLE phpbb_groups ( CREATE TABLE phpbb_icons ( icons_id tinyint(4) UNSIGNED NOT NULL auto_increment, icons_url varchar(255), - icons_width tinyint(4) DEFAULT '0' UNSIGNED NOT NULL, - icons_height tinyint(4) DEFAULT '0' UNSIGNED NOT NULL, - icons_order tinyint(4) DEFAULT '0' UNSIGNED NOT NULL, + icons_width tinyint(4) UNSIGNED DEFAULT '0' NOT NULL, + icons_height tinyint(4) UNSIGNED DEFAULT '0' NOT NULL, + icons_order tinyint(4) UNSIGNED DEFAULT '0' NOT NULL, display_on_posting tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, PRIMARY KEY (icons_id) ); @@ -329,7 +329,7 @@ CREATE TABLE phpbb_log ( # Table: 'phpbb_moderator_cache' CREATE TABLE phpbb_moderator_cache ( - forum_id mediumint(8) DEFAULT '0' UNSIGNED NOT NULL, + forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, username varchar(255) DEFAULT '' NOT NULL, group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, @@ -637,9 +637,9 @@ CREATE TABLE phpbb_smilies ( code varchar(50), emotion varchar(50), smiley_url varchar(50), - smiley_width tinyint(4) DEFAULT '0' UNSIGNED NOT NULL, - smiley_height tinyint(4) DEFAULT '0' UNSIGNED NOT NULL, - smiley_order tinyint(4) DEFAULT '0' UNSIGNED NOT NULL, + smiley_width tinyint(4) UNSIGNED DEFAULT '0' NOT NULL, + smiley_height tinyint(4) UNSIGNED DEFAULT '0' NOT NULL, + smiley_order tinyint(4) UNSIGNED DEFAULT '0' NOT NULL, display_on_posting tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, PRIMARY KEY (smiley_id) ); diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 80901a23b8..ac34328cfa 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -389,9 +389,6 @@ INSERT INTO phpbb_styles_template (template_name, template_copyright, template_p # -- phpbb_styles_theme INSERT INTO phpbb_styles_theme (theme_name, theme_copyright, theme_path, theme_data) VALUES ('subSilver', '© phpBB Group', 'subSilver', ''); -# -- Language -INSERT INTO phpbb_lang (lang_iso, lang_dir, lang_english_name, lang_local_name, lang_author) VALUES ('en', 'en', 'English [ GB ]', 'English [ GB ]', 'phpBB Group'); - # -- Forums INSERT INTO phpbb_forums (forum_name, forum_desc, left_id, right_id, parent_id, forum_type, forum_posts, forum_topics, forum_topics_real, forum_last_post_id, forum_last_poster_id, forum_last_poster_name, forum_last_post_time, forum_link, forum_password, forum_image, forum_rules, forum_rules_link, forum_rules_uid, forum_desc_uid, prune_days, prune_viewed) VALUES ('My first Category', '', 1, 4, 0, 0, 1, 1, 1, 1, 2, 'Admin', 972086460, '', '', '', '', '', '', '', 0, 0);