diff options
author | David M <davidmj@users.sourceforge.net> | 2007-04-25 23:59:59 +0000 |
---|---|---|
committer | David M <davidmj@users.sourceforge.net> | 2007-04-25 23:59:59 +0000 |
commit | 9d446dcf21b3225161b03e5b44d5de28804fca1b (patch) | |
tree | 3eab6423270b1a1e10f938a437d9b8a17261ef4d /phpBB/includes/acp/acp_language.php | |
parent | 1996d965dc58db174ea83b2eaf66215737e97ed9 (diff) | |
download | forums-9d446dcf21b3225161b03e5b44d5de28804fca1b.tar forums-9d446dcf21b3225161b03e5b44d5de28804fca1b.tar.gz forums-9d446dcf21b3225161b03e5b44d5de28804fca1b.tar.bz2 forums-9d446dcf21b3225161b03e5b44d5de28804fca1b.tar.xz forums-9d446dcf21b3225161b03e5b44d5de28804fca1b.zip |
Installing a language will now automatically install the localized imageset stuff, deleting a language will do the reverse
git-svn-id: file:///svn/phpbb/trunk@7404 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/acp/acp_language.php')
-rw-r--r-- | phpBB/includes/acp/acp_language.php | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/phpBB/includes/acp/acp_language.php b/phpBB/includes/acp/acp_language.php index 5805318a93..896cd51fa3 100644 --- a/phpBB/includes/acp/acp_language.php +++ b/phpBB/includes/acp/acp_language.php @@ -690,6 +690,11 @@ class acp_language $sql = 'DELETE FROM ' . PROFILE_FIELDS_LANG_TABLE . ' WHERE lang_id = ' . $lang_id; $db->sql_query($sql); + $sql = 'DELETE FROM ' . STYLES_IMAGESET_DATA_TABLE . " WHERE image_lang = '" . $db->sql_escape($row['lang_iso']) . "'"; + $result = $db->sql_query($sql); + + $cache->destroy('sql', STYLES_IMAGESET_DATA_TABLE); + 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)); @@ -743,6 +748,66 @@ class acp_language $db->sql_query('INSERT INTO ' . LANG_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); $lang_id = $db->sql_nextid(); + $valid_localized = array( + 'icon_back_top', 'icon_contact_aim', 'icon_contact_email', 'icon_contact_icq', 'icon_contact_jabber', 'icon_contact_msnm', 'icon_contact_pm', 'icon_contact_yahoo', 'icon_contact_www', 'icon_post_delete', 'icon_post_edit', 'icon_post_info', 'icon_post_quote', 'icon_post_report', 'icon_user_online', 'icon_user_offline', 'icon_user_profile', 'icon_user_search', 'icon_user_warn', 'button_pm_forward', 'button_pm_new', 'button_pm_reply', 'button_topic_locked', 'button_topic_new', 'button_topic_reply', + ); + + $sql_ary = array(); + + $sql = 'SELECT * + FROM ' . STYLES_IMAGESET_TABLE; + $result = $db->sql_query($sql); + while ($imageset_row = $db->sql_fetchrow($result)) + { + if (@file_exists("{$phpbb_root_path}styles/{$imageset_row['imageset_path']}/imageset/{$lang_pack['iso']}/imageset.cfg")) + { + $cfg_data_imageset_data = parse_cfg_file("{$phpbb_root_path}styles/{$imageset_row['imageset_path']}/imageset/{$lang_pack['iso']}/imageset.cfg"); + foreach ($cfg_data_imageset_data as $image_name => $value) + { + if (strpos($value, '*') !== false) + { + if (substr($value, -1, 1) === '*') + { + list($image_filename, $image_height) = explode('*', $value); + $image_width = 0; + } + else + { + list($image_filename, $image_height, $image_width) = explode('*', $value); + } + } + else + { + $image_filename = $value; + $image_height = $image_width = 0; + } + + if (strpos($image_name, 'img_') === 0 && $image_filename) + { + $image_name = substr($image_name, 4); + if (in_array($image_name, $valid_localized)) + { + $sql_ary[] = array( + 'image_name' => $image_name, + 'image_filename' => $image_filename, + 'image_height' => $image_height, + 'image_width' => $image_width, + 'imageset_id' => $imageset_row['imageset_id'], + 'image_lang' => $lang_pack['iso'], + ); + } + } + } + } + } + $db->sql_freeresult($result); + + if (sizeof($sql_ary)) + { + $db->sql_multi_insert(STYLES_IMAGESET_DATA_TABLE, $sql_ary); + $cache->destroy('sql', STYLES_IMAGESET_DATA_TABLE); + } + // 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 . " |