diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php
index 31ad37bc8d..73c758f642 100644
--- a/phpBB/includes/session.php
+++ b/phpBB/includes/session.php
@@ -1394,11 +1394,77 @@ class user extends session
AND image_lang IN('" . $db->sql_escape($this->img_lang) . "', '')";
$result = $db->sql_query($sql, 3600);
+ $localised_images = false;
while ($row = $db->sql_fetchrow($result))
{
+ if ($row['image_lang'])
+ {
+ $localised_images = true;
+ }
$this->img_array[$row['image_name']] = $row;
}
+ // there were no localised images, try to refresh the localised imageset for the user's language
+ if (!$localised_images)
+ {
+ // Attention: this code ignores the image definition list from acp_styles and just takes everything
+ // that the config file contains
+ $sql_ary = array();
+
+ $db->sql_transaction('begin');
+
+ $sql = 'DELETE FROM ' . STYLES_IMAGESET_DATA_TABLE . '
+ WHERE imageset_id = ' . $this->theme['imageset_id'] . '
+ AND image_lang = \'' . $db->sql_escape($this->img_lang) . '\'';
+ $result = $db->sql_query($sql);
+
+ if (@file_exists("{$phpbb_root_path}styles/{$this->theme['imageset_path']}/imageset/{$this->img_lang}/imageset.cfg"))
+ {
+ $cfg_data_imageset_data = parse_cfg_file("{$phpbb_root_path}styles/{$this->theme['imageset_path']}/imageset/{$this->img_lang}/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);
+ $sql_ary[] = array(
+ 'image_name' => $image_name,
+ 'image_filename' => $image_filename,
+ 'image_height' => $image_height,
+ 'image_width' => $image_width,
+ 'imageset_id' => $this->theme['imageset_id'],
+ 'image_lang' => $this->img_lang,
+ );
+ }
+ }
+ }
+
+ $db->sql_multi_insert(STYLES_IMAGESET_DATA_TABLE, $sql_ary);
+
+ $db->sql_transaction('commit');
+
+ $cache->destroy('sql', STYLES_IMAGESET_DATA_TABLE);
+
+ add_log('admin', 'LOG_IMAGESET_REFRESHED', $this->theme['imageset_name'], $this->img_lang);
+ }
+
// If this function got called from the error handler we are finished here.
if (defined('IN_ERROR_HANDLER'))
{
diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php
index f72a8f423d..854dc198af 100644
--- a/phpBB/language/en/acp/common.php
+++ b/phpBB/language/en/acp/common.php
@@ -517,13 +517,14 @@ $lang = array_merge($lang, array(
'LOG_USERS_APPROVED' => 'Users approved in usergroup %1$s
» %2$s',
'LOG_USERS_ADDED' => 'Added new members to usergroup %1$s
» %2$s',
- 'LOG_IMAGESET_ADD_DB' => 'Added new imageset to database
» %s',
- 'LOG_IMAGESET_ADD_FS' => 'Add new imageset on filesystem
» %s',
- 'LOG_IMAGESET_DELETE' => 'Deleted imageset
» %s',
- 'LOG_IMAGESET_EDIT_DETAILS' => 'Edited imageset details
» %s',
- 'LOG_IMAGESET_EDIT' => 'Edited imageset
» %s',
- 'LOG_IMAGESET_EXPORT' => 'Exported imageset
» %s',
- 'LOG_IMAGESET_REFRESHED' => 'Refreshed imageset
» %s',
+ 'LOG_IMAGESET_ADD_DB' => 'Added new imageset to database
» %s',
+ 'LOG_IMAGESET_ADD_FS' => 'Add new imageset on filesystem
» %s',
+ 'LOG_IMAGESET_DELETE' => 'Deleted imageset
» %s',
+ 'LOG_IMAGESET_EDIT_DETAILS' => 'Edited imageset details
» %s',
+ 'LOG_IMAGESET_EDIT' => 'Edited imageset
» %s',
+ 'LOG_IMAGESET_EXPORT' => 'Exported imageset
» %s',
+ 'LOG_IMAGESET_LANG_REFRESHED' => 'Refreshed “%2$s” localisation of imageset
» %1$s',
+ 'LOG_IMAGESET_REFRESHED' => 'Refreshed imageset
» %s',
'LOG_INACTIVE_ACTIVATE' => 'Activated inactive users
» %s',
'LOG_INACTIVE_DELETE' => 'Deleted inactive users
» %s',
diff --git a/phpBB/style.php b/phpBB/style.php
index a5a3b44778..9be0d6a0dc 100644
--- a/phpBB/style.php
+++ b/phpBB/style.php
@@ -96,10 +96,12 @@ if ($id && $sid)
$user['user_lang'] = $config['default_lang'];
}
+ $user_image_lang = (file_exists($phpbb_root_path . 'styles/' . $theme['imageset_path'] . '/imageset/' . $user['user_lang'])) ? $user['user_lang'] : $config['default_lang'];
+
$sql = 'SELECT *
FROM ' . STYLES_IMAGESET_DATA_TABLE . '
WHERE imageset_id = ' . $theme['imageset_id'] . "
- AND image_lang IN('" . $db->sql_escape($user['user_lang']) . "', '')";
+ AND image_lang IN('" . $db->sql_escape($user_image_lang) . "', '')";
$result = $db->sql_query($sql, 3600);
$img_array = array();
@@ -174,7 +176,7 @@ if ($id && $sid)
'{T_THEME_PATH}' => "{$phpbb_root_path}styles/" . $theme['theme_path'] . '/theme',
'{T_TEMPLATE_PATH}' => "{$phpbb_root_path}styles/" . $theme['template_path'] . '/template',
'{T_IMAGESET_PATH}' => "{$phpbb_root_path}styles/" . $theme['imageset_path'] . '/imageset',
- '{T_IMAGESET_LANG_PATH}' => "{$phpbb_root_path}styles/" . $theme['imageset_path'] . '/imageset/' . $user['user_lang'],
+ '{T_IMAGESET_LANG_PATH}' => "{$phpbb_root_path}styles/" . $theme['imageset_path'] . '/imageset/' . $user_image_lang,
'{T_STYLESHEET_NAME}' => $theme['theme_name'],
'{S_USER_LANG}' => $user['user_lang']
);
@@ -190,8 +192,11 @@ if ($id && $sid)
foreach ($matches[1] as $i => $img)
{
$img = strtolower($img);
+ $find[] = $matches[0][$i];
+
if (!isset($img_array[$img]))
{
+ $replace[] = '';
continue;
}
@@ -223,7 +228,6 @@ if ($id && $sid)
default:
continue;
}
- $find[] = $matches[0][$i];
}
if (sizeof($find))