mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-11 05:48:51 +00:00
[feature/remove-imagesets] Adjustments to php files
Removing imagesets. Adjustments to php files PHPBB3-10336
This commit is contained in:
parent
98590201d8
commit
830c3f4047
12 changed files with 16 additions and 342 deletions
|
@ -127,7 +127,7 @@ if (!$feed_updated_time)
|
|||
// Some default assignments
|
||||
// FEED_IMAGE is not used (atom)
|
||||
$global_vars = array_merge($global_vars, array(
|
||||
'FEED_IMAGE' => ($user->img('site_logo', '', false, '', 'src')) ? $board_url . '/' . substr($user->img('site_logo', '', false, '', 'src'), strlen($phpbb_root_path)) : '',
|
||||
'FEED_IMAGE' => '',
|
||||
'SELF_LINK' => feed_append_sid('/feed.' . $phpEx, $params),
|
||||
'FEED_LINK' => $board_url . '/index.' . $phpEx,
|
||||
'FEED_TITLE' => $config['sitename'],
|
||||
|
|
|
@ -797,11 +797,6 @@ 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));
|
||||
|
@ -866,66 +861,6 @@ 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' => (string) $image_name,
|
||||
'image_filename' => (string) $image_filename,
|
||||
'image_height' => (int) $image_height,
|
||||
'image_width' => (int) $image_width,
|
||||
'imageset_id' => (int) $imageset_row['imageset_id'],
|
||||
'image_lang' => (string) $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 . "
|
||||
|
|
|
@ -4557,6 +4557,7 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0
|
|||
'T_RANKS_PATH' => "{$web_path}{$config['ranks_path']}/",
|
||||
'T_UPLOAD_PATH' => "{$web_path}{$config['upload_path']}/",
|
||||
'T_STYLESHEET_LINK' => (!$user->theme['theme_storedb']) ? "{$web_path}styles/" . $user->theme['theme_path'] . '/theme/stylesheet.css' : append_sid("{$phpbb_root_path}style.$phpEx", 'id=' . $user->theme['style_id'] . '&lang=' . $user->lang_name),
|
||||
'T_STYLESHEET_LANG_LINK' => "{$web_path}styles/" . $user->theme['theme_path'] . '/theme/' . $user->lang_name . '/stylesheet.css',
|
||||
'T_STYLESHEET_NAME' => $user->theme['theme_name'],
|
||||
|
||||
'T_THEME_NAME' => $user->theme['theme_path'],
|
||||
|
|
|
@ -458,7 +458,6 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
|
|||
$l_post_click_count => $post_click_count,
|
||||
'FORUM_IMG_STYLE' => $folder_image,
|
||||
'FORUM_FOLDER_IMG' => $user->img($folder_image, $folder_alt),
|
||||
'FORUM_FOLDER_IMG_SRC' => $user->img($folder_image, $folder_alt, false, '', 'src'),
|
||||
'FORUM_FOLDER_IMG_ALT' => isset($user->lang[$folder_alt]) ? $user->lang[$folder_alt] : '',
|
||||
'FORUM_IMAGE' => ($row['forum_image']) ? '<img src="' . $phpbb_root_path . $row['forum_image'] . '" alt="' . $user->lang[$folder_alt] . '" />' : '',
|
||||
'FORUM_IMAGE_SRC' => ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : '',
|
||||
|
|
|
@ -227,7 +227,6 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
|
|||
'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
|
||||
'TOPIC_IMG_STYLE' => $folder_img,
|
||||
'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt),
|
||||
'TOPIC_FOLDER_IMG_SRC' => $user->img($folder_img, $folder_alt, false, '', 'src'),
|
||||
'TOPIC_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '',
|
||||
'TOPIC_ICON_IMG_WIDTH' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '',
|
||||
'TOPIC_ICON_IMG_HEIGHT' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '',
|
||||
|
|
|
@ -1655,12 +1655,11 @@ class user extends session
|
|||
$style = ($style) ? $style : ((!$config['override_user_style']) ? $this->data['user_style'] : $config['default_style']);
|
||||
}
|
||||
|
||||
$sql = 'SELECT s.style_id, t.template_storedb, t.template_path, t.template_id, t.bbcode_bitfield, t.template_inherits_id, t.template_inherit_path, c.theme_path, c.theme_name, c.theme_storedb, c.theme_id, i.imageset_path, i.imageset_id, i.imageset_name
|
||||
FROM ' . STYLES_TABLE . ' s, ' . STYLES_TEMPLATE_TABLE . ' t, ' . STYLES_THEME_TABLE . ' c, ' . STYLES_IMAGESET_TABLE . " i
|
||||
$sql = 'SELECT s.style_id, t.template_storedb, t.template_path, t.template_id, t.bbcode_bitfield, t.template_inherits_id, t.template_inherit_path, c.theme_path, c.theme_name, c.theme_storedb, c.theme_id
|
||||
FROM ' . STYLES_TABLE . ' s, ' . STYLES_TEMPLATE_TABLE . ' t, ' . STYLES_THEME_TABLE . " c
|
||||
WHERE s.style_id = $style
|
||||
AND t.template_id = s.template_id
|
||||
AND c.theme_id = s.theme_id
|
||||
AND i.imageset_id = s.imageset_id";
|
||||
AND c.theme_id = s.theme_id";
|
||||
$result = $db->sql_query($sql, 3600);
|
||||
$this->theme = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
@ -1675,12 +1674,11 @@ class user extends session
|
|||
WHERE user_id = {$this->data['user_id']}";
|
||||
$db->sql_query($sql);
|
||||
|
||||
$sql = 'SELECT s.style_id, t.template_storedb, t.template_path, t.template_id, t.bbcode_bitfield, c.theme_path, c.theme_name, c.theme_storedb, c.theme_id, i.imageset_path, i.imageset_id, i.imageset_name
|
||||
FROM ' . STYLES_TABLE . ' s, ' . STYLES_TEMPLATE_TABLE . ' t, ' . STYLES_THEME_TABLE . ' c, ' . STYLES_IMAGESET_TABLE . " i
|
||||
$sql = 'SELECT s.style_id, t.template_storedb, t.template_path, t.template_id, t.bbcode_bitfield, c.theme_path, c.theme_name, c.theme_storedb, c.theme_id
|
||||
FROM ' . STYLES_TABLE . ' s, ' . STYLES_TEMPLATE_TABLE . ' t, ' . STYLES_THEME_TABLE . " c
|
||||
WHERE s.style_id = $style
|
||||
AND t.template_id = s.template_id
|
||||
AND c.theme_id = s.theme_id
|
||||
AND i.imageset_id = s.imageset_id";
|
||||
AND c.theme_id = s.theme_id";
|
||||
$result = $db->sql_query($sql, 3600);
|
||||
$this->theme = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
@ -1761,95 +1759,7 @@ class user extends session
|
|||
|
||||
$template->set_template();
|
||||
|
||||
$this->img_lang = (file_exists($phpbb_root_path . 'styles/' . $this->theme['imageset_path'] . '/imageset/' . $this->lang_name)) ? $this->lang_name : $config['default_lang'];
|
||||
|
||||
// Same query in style.php
|
||||
$sql = 'SELECT *
|
||||
FROM ' . STYLES_IMAGESET_DATA_TABLE . '
|
||||
WHERE imageset_id = ' . $this->theme['imageset_id'] . "
|
||||
AND image_filename <> ''
|
||||
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;
|
||||
}
|
||||
|
||||
$row['image_filename'] = rawurlencode($row['image_filename']);
|
||||
$this->img_array[$row['image_name']] = $row;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// 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' => (string) $image_name,
|
||||
'image_filename' => (string) $image_filename,
|
||||
'image_height' => (int) $image_height,
|
||||
'image_width' => (int) $image_width,
|
||||
'imageset_id' => (int) $this->theme['imageset_id'],
|
||||
'image_lang' => (string) $this->img_lang,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sizeof($sql_ary))
|
||||
{
|
||||
$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_LANG_REFRESHED', $this->theme['imageset_name'], $this->img_lang);
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->sql_transaction('commit');
|
||||
add_log('admin', 'LOG_IMAGESET_LANG_MISSING', $this->theme['imageset_name'], $this->img_lang);
|
||||
}
|
||||
}
|
||||
$this->img_lang = $this->lang_name;
|
||||
|
||||
// Call phpbb_user_session_handler() in case external application want to "bend" some variables or replace classes...
|
||||
// After calling it we continue script execution...
|
||||
|
@ -2284,89 +2194,11 @@ class user extends session
|
|||
|
||||
/**
|
||||
* Specify/Get image
|
||||
* $suffix is no longer used - we know it. ;) It is there for backward compatibility.
|
||||
*/
|
||||
function img($img, $alt = '', $width = false, $suffix = '', $type = 'full_tag')
|
||||
function img($img, $alt = '')
|
||||
{
|
||||
static $imgs;
|
||||
global $phpbb_root_path;
|
||||
|
||||
$img_data = &$imgs[$img];
|
||||
|
||||
if (empty($img_data))
|
||||
{
|
||||
if (!isset($this->img_array[$img]))
|
||||
{
|
||||
// Do not fill the image to let designers decide what to do if the image is empty
|
||||
$img_data = '';
|
||||
return $img_data;
|
||||
}
|
||||
|
||||
// Use URL if told so
|
||||
$root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_root_path;
|
||||
|
||||
$path = 'styles/' . rawurlencode($this->theme['imageset_path']) . '/imageset/' . ($this->img_array[$img]['image_lang'] ? $this->img_array[$img]['image_lang'] .'/' : '') . $this->img_array[$img]['image_filename'];
|
||||
|
||||
$img_data['src'] = $root_path . $path;
|
||||
$img_data['width'] = $this->img_array[$img]['image_width'];
|
||||
$img_data['height'] = $this->img_array[$img]['image_height'];
|
||||
|
||||
// We overwrite the width and height to the phpbb logo's width
|
||||
// and height here if the contents of the site_logo file are
|
||||
// really equal to the phpbb_logo
|
||||
// This allows us to change the dimensions of the phpbb_logo without
|
||||
// modifying the imageset.cfg and causing a conflict for everyone
|
||||
// who modified it for their custom logo on updating
|
||||
if ($img == 'site_logo' && file_exists($phpbb_root_path . $path))
|
||||
{
|
||||
global $cache;
|
||||
|
||||
$img_file_hashes = $cache->get('imageset_site_logo_md5');
|
||||
|
||||
if ($img_file_hashes === false)
|
||||
{
|
||||
$img_file_hashes = array();
|
||||
}
|
||||
|
||||
$key = $this->theme['imageset_path'] . '::' . $this->img_array[$img]['image_lang'];
|
||||
if (!isset($img_file_hashes[$key]))
|
||||
{
|
||||
$img_file_hashes[$key] = md5(file_get_contents($phpbb_root_path . $path));
|
||||
$cache->put('imageset_site_logo_md5', $img_file_hashes);
|
||||
}
|
||||
|
||||
$phpbb_logo_hash = '0c461a32cd3621643105f0d02a772c10';
|
||||
|
||||
if ($phpbb_logo_hash == $img_file_hashes[$key])
|
||||
{
|
||||
$img_data['width'] = '149';
|
||||
$img_data['height'] = '52';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$alt = (!empty($this->lang[$alt])) ? $this->lang[$alt] : $alt;
|
||||
|
||||
switch ($type)
|
||||
{
|
||||
case 'src':
|
||||
return $img_data['src'];
|
||||
break;
|
||||
|
||||
case 'width':
|
||||
return ($width === false) ? $img_data['width'] : $width;
|
||||
break;
|
||||
|
||||
case 'height':
|
||||
return $img_data['height'];
|
||||
break;
|
||||
|
||||
default:
|
||||
$use_width = ($width === false) ? $img_data['width'] : $width;
|
||||
|
||||
return '<img src="' . $img_data['src'] . '"' . (($use_width) ? ' width="' . $use_width . '"' : '') . (($img_data['height']) ? ' height="' . $img_data['height'] . '"' : '') . ' alt="' . $alt . '" title="' . $alt . '" />';
|
||||
break;
|
||||
}
|
||||
return '<span class="imageset ' . $img . '">' . $alt . '</span>';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -161,7 +161,6 @@ class ucp_main
|
|||
|
||||
'TOPIC_IMG_STYLE' => $folder_img,
|
||||
'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt),
|
||||
'TOPIC_FOLDER_IMG_SRC' => $user->img($folder_img, $folder_alt, false, '', 'src'),
|
||||
'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', '') : '',
|
||||
|
||||
'S_USER_POSTED' => (!empty($row['topic_posted']) && $row['topic_posted']) ? true : false,
|
||||
|
@ -348,7 +347,6 @@ class ucp_main
|
|||
'FORUM_ID' => $forum_id,
|
||||
'FORUM_IMG_STYLE' => $folder_image,
|
||||
'FORUM_FOLDER_IMG' => $user->img($folder_image, $folder_alt),
|
||||
'FORUM_FOLDER_IMG_SRC' => $user->img($folder_image, $folder_alt, false, '', 'src'),
|
||||
'FORUM_IMAGE' => ($row['forum_image']) ? '<img src="' . $phpbb_root_path . $row['forum_image'] . '" alt="' . $user->lang[$folder_alt] . '" />' : '',
|
||||
'FORUM_IMAGE_SRC' => ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : '',
|
||||
'FORUM_NAME' => $row['forum_name'],
|
||||
|
@ -825,7 +823,6 @@ class ucp_main
|
|||
|
||||
'TOPIC_IMG_STYLE' => $folder_img,
|
||||
'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt),
|
||||
'TOPIC_FOLDER_IMG_SRC' => $user->img($folder_img, $folder_alt, false, '', 'src'),
|
||||
'TOPIC_FOLDER_IMG_ALT' => $user->lang[$folder_alt],
|
||||
'TOPIC_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '',
|
||||
'TOPIC_ICON_IMG_WIDTH' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '',
|
||||
|
|
|
@ -166,7 +166,6 @@ function view_folder($id, $mode, $folder_id, $folder)
|
|||
'PM_ICON_URL' => (!empty($icons[$row['icon_id']])) ? $config['icons_path'] . '/' . $icons[$row['icon_id']]['img'] : '',
|
||||
'FOLDER_IMG' => $user->img($folder_img, $folder_alt),
|
||||
'FOLDER_IMG_STYLE' => $folder_img,
|
||||
'FOLDER_IMG_SRC' => $user->img($folder_img, $folder_alt, false, '', 'src'),
|
||||
'PM_IMG' => ($row_indicator) ? $user->img('pm_' . $row_indicator, '') : '',
|
||||
'ATTACH_ICON_IMG' => ($auth->acl_get('u_pm_download') && $row['message_attachment'] && $config['allow_pm_attach']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
|
||||
|
||||
|
|
|
@ -872,10 +872,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
|||
|
||||
'TOPIC_IMG_STYLE' => $folder_img,
|
||||
'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt),
|
||||
'TOPIC_FOLDER_IMG_SRC' => $user->img($folder_img, $folder_alt, false, '', 'src'),
|
||||
'TOPIC_FOLDER_IMG_ALT' => $user->lang[$folder_alt],
|
||||
'TOPIC_FOLDER_IMG_WIDTH'=> $user->img($folder_img, '', false, '', 'width'),
|
||||
'TOPIC_FOLDER_IMG_HEIGHT' => $user->img($folder_img, '', false, '', 'height'),
|
||||
|
||||
'TOPIC_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '',
|
||||
'TOPIC_ICON_IMG_WIDTH' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '',
|
||||
|
|
|
@ -111,12 +111,11 @@ if ($id)
|
|||
$user = array('user_id' => ANONYMOUS);
|
||||
}
|
||||
|
||||
$sql = 'SELECT s.style_id, c.theme_id, c.theme_data, c.theme_path, c.theme_name, c.theme_mtime, i.*, t.template_path
|
||||
FROM ' . STYLES_TABLE . ' s, ' . STYLES_TEMPLATE_TABLE . ' t, ' . STYLES_THEME_TABLE . ' c, ' . STYLES_IMAGESET_TABLE . ' i
|
||||
$sql = 'SELECT s.style_id, c.theme_id, c.theme_data, c.theme_path, c.theme_name, c.theme_mtime, t.template_path
|
||||
FROM ' . STYLES_TABLE . ' s, ' . STYLES_TEMPLATE_TABLE . ' t, ' . STYLES_THEME_TABLE . ' c
|
||||
WHERE s.style_id = ' . $id . '
|
||||
AND t.template_id = s.template_id
|
||||
AND c.theme_id = s.theme_id
|
||||
AND i.imageset_id = s.imageset_id';
|
||||
AND c.theme_id = s.theme_id';
|
||||
$result = $db->sql_query($sql, 300);
|
||||
$theme = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
@ -131,23 +130,6 @@ if ($id)
|
|||
$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'];
|
||||
|
||||
// Same query in session.php
|
||||
$sql = 'SELECT *
|
||||
FROM ' . STYLES_IMAGESET_DATA_TABLE . '
|
||||
WHERE imageset_id = ' . $theme['imageset_id'] . "
|
||||
AND image_filename <> ''
|
||||
AND image_lang IN ('" . $db->sql_escape($user_image_lang) . "', '')";
|
||||
$result = $db->sql_query($sql, 3600);
|
||||
|
||||
$img_array = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$img_array[$row['image_name']] = $row;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// gzip_compression
|
||||
if ($config['gzip_compress'])
|
||||
{
|
||||
|
@ -228,71 +210,7 @@ if ($id)
|
|||
|
||||
header('Content-type: text/css; charset=UTF-8');
|
||||
|
||||
// Parse Theme Data
|
||||
$replace = array(
|
||||
'{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_image_lang,
|
||||
'{T_STYLESHEET_NAME}' => $theme['theme_name'],
|
||||
'{S_USER_LANG}' => $user['user_lang']
|
||||
);
|
||||
|
||||
$theme['theme_data'] = str_replace(array_keys($replace), array_values($replace), $theme['theme_data']);
|
||||
|
||||
$matches = array();
|
||||
preg_match_all('#\{IMG_([A-Za-z0-9_]*?)_(WIDTH|HEIGHT|SRC)\}#', $theme['theme_data'], $matches);
|
||||
|
||||
$imgs = $find = $replace = array();
|
||||
if (isset($matches[0]) && sizeof($matches[0]))
|
||||
{
|
||||
foreach ($matches[1] as $i => $img)
|
||||
{
|
||||
$img = strtolower($img);
|
||||
$find[] = $matches[0][$i];
|
||||
|
||||
if (!isset($img_array[$img]))
|
||||
{
|
||||
$replace[] = '';
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($imgs[$img]))
|
||||
{
|
||||
$img_data = &$img_array[$img];
|
||||
$imgsrc = ($img_data['image_lang'] ? $img_data['image_lang'] . '/' : '') . $img_data['image_filename'];
|
||||
$imgs[$img] = array(
|
||||
'src' => $phpbb_root_path . 'styles/' . $theme['imageset_path'] . '/imageset/' . $imgsrc,
|
||||
'width' => $img_data['image_width'],
|
||||
'height' => $img_data['image_height'],
|
||||
);
|
||||
}
|
||||
|
||||
switch ($matches[2][$i])
|
||||
{
|
||||
case 'SRC':
|
||||
$replace[] = $imgs[$img]['src'];
|
||||
break;
|
||||
|
||||
case 'WIDTH':
|
||||
$replace[] = $imgs[$img]['width'];
|
||||
break;
|
||||
|
||||
case 'HEIGHT':
|
||||
$replace[] = $imgs[$img]['height'];
|
||||
break;
|
||||
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (sizeof($find))
|
||||
{
|
||||
$theme['theme_data'] = str_replace($find, $replace, $theme['theme_data']);
|
||||
}
|
||||
}
|
||||
|
||||
// Echo Theme Data
|
||||
echo $theme['theme_data'];
|
||||
|
||||
if (!empty($cache))
|
||||
|
|
|
@ -688,10 +688,7 @@ if (sizeof($topic_list))
|
|||
|
||||
'TOPIC_IMG_STYLE' => $folder_img,
|
||||
'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt),
|
||||
'TOPIC_FOLDER_IMG_SRC' => $user->img($folder_img, $folder_alt, false, '', 'src'),
|
||||
'TOPIC_FOLDER_IMG_ALT' => $user->lang[$folder_alt],
|
||||
'TOPIC_FOLDER_IMG_WIDTH'=> $user->img($folder_img, '', false, '', 'width'),
|
||||
'TOPIC_FOLDER_IMG_HEIGHT' => $user->img($folder_img, '', false, '', 'height'),
|
||||
|
||||
'TOPIC_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '',
|
||||
'TOPIC_ICON_IMG_WIDTH' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '',
|
||||
|
|
|
@ -840,7 +840,7 @@ if (!empty($topic_data['poll_start']))
|
|||
'POLL_OPTION_RESULT' => $poll_option['poll_option_total'],
|
||||
'POLL_OPTION_PERCENT' => $option_pct_txt,
|
||||
'POLL_OPTION_PCT' => round($option_pct * 100),
|
||||
'POLL_OPTION_IMG' => $user->img('poll_center', $option_pct_txt, round($option_pct * 250)),
|
||||
'POLL_OPTION_WIDTH' => round($option_pct * 250),
|
||||
'POLL_OPTION_VOTED' => (in_array($poll_option['poll_option_id'], $cur_voted_id)) ? true : false)
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue