aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/acp/acp_language.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2007-01-04 16:07:38 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2007-01-04 16:07:38 +0000
commit3a8c3971da12623aeb86c67c34fe0b962d672ad9 (patch)
treef1110b30cc9bbe41b2b7126b172d38b7e7394cf4 /phpBB/includes/acp/acp_language.php
parentfbef3990e74034f5cf205867a2b37e0e13a98997 (diff)
downloadforums-3a8c3971da12623aeb86c67c34fe0b962d672ad9.tar
forums-3a8c3971da12623aeb86c67c34fe0b962d672ad9.tar.gz
forums-3a8c3971da12623aeb86c67c34fe0b962d672ad9.tar.bz2
forums-3a8c3971da12623aeb86c67c34fe0b962d672ad9.tar.xz
forums-3a8c3971da12623aeb86c67c34fe0b962d672ad9.zip
- use var_export instead of our format_array function [Bug #6748]
- fix dumb error in column naming [Bug #6750] - Make sure to catch some special conditions for cpf translation as well as correctly removing/adding default values on language installation/removing [Bug #6752] git-svn-id: file:///svn/phpbb/trunk@6839 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/acp/acp_language.php')
-rw-r--r--phpBB/includes/acp/acp_language.php44
1 files changed, 44 insertions, 0 deletions
diff --git a/phpBB/includes/acp/acp_language.php b/phpBB/includes/acp/acp_language.php
index 94a79fa2d3..16f75d9c92 100644
--- a/phpBB/includes/acp/acp_language.php
+++ b/phpBB/includes/acp/acp_language.php
@@ -674,6 +674,13 @@ class acp_language
WHERE user_lang = '" . $db->sql_escape($row['lang_iso']) . "'";
$db->sql_query($sql);
+ // We also need to remove the translated entries for custom profile fields - we want clean tables, don't we?
+ $sql = 'DELETE FROM ' . PROFILE_LANG_TABLE . ' WHERE lang_id = ' . $lang_id;
+ $db->sql_query($sql);
+
+ $sql = 'DELETE FROM ' . PROFILE_FIELDS_LANG_TABLE . ' WHERE lang_id = ' . $lang_id;
+ $db->sql_query($sql);
+
add_log('admin', 'LOG_LANGUAGE_PACK_DELETED', $row['lang_english_name']);
trigger_error(sprintf($user->lang['LANGUAGE_PACK_DELETED'], $row['lang_english_name']) . adm_back_link($this->u_action));
@@ -725,6 +732,43 @@ class acp_language
);
$db->sql_query('INSERT INTO ' . LANG_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
+ $lang_id = $db->sql_nextid();
+
+ // Now let's copy the default language entries for custom profile fields for this new language - makes admin's life easier.
+ $sql = 'SELECT lang_id
+ FROM ' . LANG_TABLE . "
+ WHERE lang_iso = '" . $db->sql_escape($config['default_lang']) . "'";
+ $result = $db->sql_query($sql);
+ $default_lang_id = (int) $db->sql_fetchfield('lang_id');
+ $db->sql_freeresult($result);
+
+ // From the mysql documentation:
+ // Prior to MySQL 4.0.14, the target table of the INSERT statement cannot appear in the FROM clause of the SELECT part of the query. This limitation is lifted in 4.0.14.
+ // Due to this we stay on the safe side if we do the insertion "the manual way"
+
+ $sql = 'SELECT field_id, lang_name, lang_explain, lang_default_value
+ FROM ' . PROFILE_LANG_TABLE . '
+ WHERE lang_id = ' . $default_lang_id;
+ $result = $db->sql_query($sql);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $row['lang_id'] = $lang_id;
+ $db->sql_query('INSERT INTO ' . PROFILE_LANG_TABLE . ' ' . $db->sql_build_array('INSERT', $row));
+ }
+ $db->sql_freeresult($result);
+
+ $sql = 'SELECT field_id, option_id, field_type, lang_value
+ FROM ' . PROFILE_FIELDS_LANG_TABLE . '
+ WHERE lang_id = ' . $default_lang_id;
+ $result = $db->sql_query($sql);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $row['lang_id'] = $lang_id;
+ $db->sql_query('INSERT INTO ' . PROFILE_FIELDS_LANG_TABLE . ' ' . $db->sql_build_array('INSERT', $row));
+ }
+ $db->sql_freeresult($result);
add_log('admin', 'LOG_LANGUAGE_PACK_INSTALLED', $lang_pack['name']);