mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-06 22:45:02 +02:00
- style.php uses default language fallback for the imageset like session.php now
- style.php removes placeholders for non-existant images instead of leaving them alone - automatically try to load a localised part of an imageset if the folder exists and no images for that language were found in the database, thanks PhilippK git-svn-id: file:///svn/phpbb/trunk@7654 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
2f9992bc3a
commit
40e43384d7
@ -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'))
|
||||
{
|
||||
|
@ -517,13 +517,14 @@ $lang = array_merge($lang, array(
|
||||
'LOG_USERS_APPROVED' => '<strong>Users approved in usergroup</strong> %1$s<br />» %2$s',
|
||||
'LOG_USERS_ADDED' => '<strong>Added new members to usergroup</strong> %1$s<br />» %2$s',
|
||||
|
||||
'LOG_IMAGESET_ADD_DB' => '<strong>Added new imageset to database</strong><br />» %s',
|
||||
'LOG_IMAGESET_ADD_FS' => '<strong>Add new imageset on filesystem</strong><br />» %s',
|
||||
'LOG_IMAGESET_DELETE' => '<strong>Deleted imageset</strong><br />» %s',
|
||||
'LOG_IMAGESET_EDIT_DETAILS' => '<strong>Edited imageset details</strong><br />» %s',
|
||||
'LOG_IMAGESET_EDIT' => '<strong>Edited imageset</strong><br />» %s',
|
||||
'LOG_IMAGESET_EXPORT' => '<strong>Exported imageset</strong><br />» %s',
|
||||
'LOG_IMAGESET_REFRESHED' => '<strong>Refreshed imageset</strong><br />» %s',
|
||||
'LOG_IMAGESET_ADD_DB' => '<strong>Added new imageset to database</strong><br />» %s',
|
||||
'LOG_IMAGESET_ADD_FS' => '<strong>Add new imageset on filesystem</strong><br />» %s',
|
||||
'LOG_IMAGESET_DELETE' => '<strong>Deleted imageset</strong><br />» %s',
|
||||
'LOG_IMAGESET_EDIT_DETAILS' => '<strong>Edited imageset details</strong><br />» %s',
|
||||
'LOG_IMAGESET_EDIT' => '<strong>Edited imageset</strong><br />» %s',
|
||||
'LOG_IMAGESET_EXPORT' => '<strong>Exported imageset</strong><br />» %s',
|
||||
'LOG_IMAGESET_LANG_REFRESHED' => '<strong>Refreshed “%2$s” localisation of imageset</strong><br />» %1$s',
|
||||
'LOG_IMAGESET_REFRESHED' => '<strong>Refreshed imageset</strong><br />» %s',
|
||||
|
||||
'LOG_INACTIVE_ACTIVATE' => '<strong>Activated inactive users</strong><br />» %s',
|
||||
'LOG_INACTIVE_DELETE' => '<strong>Deleted inactive users</strong><br />» %s',
|
||||
|
@ -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))
|
||||
|
Loading…
x
Reference in New Issue
Block a user