aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/install
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-02-02 17:58:34 +0100
committerJoas Schilling <nickvergessen@gmx.de>2014-02-06 11:32:06 +0100
commit7d049619196a49957c58c896a1fc50c334b9bc7f (patch)
tree3b6f6af903574b466f83f40866dfba683b2ec36d /phpBB/install
parent3c640e57c5815c970e706f724fb29a3114826352 (diff)
downloadforums-7d049619196a49957c58c896a1fc50c334b9bc7f.tar
forums-7d049619196a49957c58c896a1fc50c334b9bc7f.tar.gz
forums-7d049619196a49957c58c896a1fc50c334b9bc7f.tar.bz2
forums-7d049619196a49957c58c896a1fc50c334b9bc7f.tar.xz
forums-7d049619196a49957c58c896a1fc50c334b9bc7f.zip
[ticket/12115] Add language entries for the profile fields
PHPBB3-12115
Diffstat (limited to 'phpBB/install')
-rw-r--r--phpBB/install/install_install.php25
-rw-r--r--phpBB/install/schemas/schema_data.sql2
2 files changed, 26 insertions, 1 deletions
diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php
index 1a7e1d1094..a2d44f2b6c 100644
--- a/phpBB/install/install_install.php
+++ b/phpBB/install/install_install.php
@@ -1718,6 +1718,7 @@ class install_install extends module
$this->error('Unable to access the language directory', __LINE__, __FILE__);
}
+ $installed_languages = array();
while (($file = readdir($dir)) !== false)
{
$path = $phpbb_root_path . 'language/' . $file;
@@ -1741,6 +1742,7 @@ class install_install extends module
$db->sql_query('INSERT INTO ' . LANG_TABLE . ' ' . $db->sql_build_array('INSERT', $lang_pack));
+ $installed_languages[] = (int) $db->sql_nextid();
if ($db->sql_error_triggered)
{
$error = $db->sql_error($db->sql_error_sql);
@@ -1749,6 +1751,29 @@ class install_install extends module
}
}
closedir($dir);
+
+ $sql = 'SELECT *
+ FROM ' . PROFILE_FIELDS_TABLE;
+ $result = $db->sql_query($sql);
+
+ $profile_fields = array();
+ $insert_buffer = new \phpbb\db\sql_insert_buffer($db, PROFILE_LANG_TABLE);
+ while ($row = $db->sql_fetchrow($result))
+ {
+ foreach ($installed_languages as $lang_id)
+ {
+ $insert_buffer->insert(array(
+ 'field_id' => $row['field_id'],
+ 'lang_id' => $lang_id,
+ 'lang_name' => strtoupper(substr($row['field_name'], 6)),// Remove phpbb_ from field name
+ 'lang_explain' => '',
+ 'lang_default_value' => '',
+ ));
+ }
+ }
+ $db->sql_freeresult($result);
+
+ $insert_buffer->flush();
}
/**
diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql
index ff224a6ce2..1d14285660 100644
--- a/phpBB/install/schemas/schema_data.sql
+++ b/phpBB/install/schemas/schema_data.sql
@@ -788,7 +788,7 @@ INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'ogg');
INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'ogm');
# Add default profile fields
-INSERT INTO phpbb_profile_fields ('field_name', 'field_type', 'field_ident', 'field_length', 'field_minlen', 'field_maxlen', 'field_novalue', 'field_default_value', 'field_validation', 'field_required', 'field_show_novalue', 'field_show_on_reg', 'field_show_on_pm', 'field_show_on_vt', 'field_show_profile', 'field_hide', 'field_no_view', 'field_active', 'field_order') VALUES ('phpbb_occupation', 'profilefields.type.text', 'phpbb_occupation', '3|30', '2', '500', '', '', '.*', 0, 0, 0, 0, 0, 1, 0, 0, 1, 1);
+INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_profile, field_hide, field_no_view, field_active, field_order) VALUES ('phpbb_occupation', 'profilefields.type.text', 'phpbb_occupation', '3|30', '2', '500', '', '', '.*', 0, 0, 0, 0, 0, 1, 0, 0, 1, 1);
# User Notification Options (for first user)
INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('post', 0, 2, '');