mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
Merge PR #839 branch 'p/ticket/10743' into develop
* p/ticket/10743: [ticket/10743] Renaming user->theme [ticket/10743] Changing obtain_cfg_items
This commit is contained in:
commit
436ade19fc
5 changed files with 47 additions and 61 deletions
|
@ -130,7 +130,7 @@ class bbcode
|
|||
|
||||
if (empty($this->template_filename))
|
||||
{
|
||||
$this->template_bitfield = new bitfield($user->theme['bbcode_bitfield']);
|
||||
$this->template_bitfield = new bitfield($user->style['bbcode_bitfield']);
|
||||
|
||||
$style_resource_locator = new phpbb_style_resource_locator();
|
||||
$style_path_provider = new phpbb_style_extension_path_provider($phpbb_extension_manager, new phpbb_style_path_provider());
|
||||
|
|
63
phpBB/includes/cache/service.php
vendored
63
phpBB/includes/cache/service.php
vendored
|
@ -321,50 +321,39 @@ class phpbb_cache_service
|
|||
/**
|
||||
* Obtain cfg file data
|
||||
*/
|
||||
function obtain_cfg_items($theme)
|
||||
function obtain_cfg_items($style)
|
||||
{
|
||||
global $config, $phpbb_root_path;
|
||||
|
||||
$parsed_items = array(
|
||||
'theme' => array(),
|
||||
'template' => array(),
|
||||
'imageset' => array()
|
||||
);
|
||||
$parsed_array = $this->driver->get('_cfg_' . $style['style_path']);
|
||||
|
||||
foreach ($parsed_items as $key => $parsed_array)
|
||||
if ($parsed_array === false)
|
||||
{
|
||||
$parsed_array = $this->driver->get('_cfg_' . $key . '_' . $theme[$key . '_path']);
|
||||
|
||||
if ($parsed_array === false)
|
||||
{
|
||||
$parsed_array = array();
|
||||
}
|
||||
|
||||
$reparse = false;
|
||||
$filename = $phpbb_root_path . 'styles/' . $theme[$key . '_path'] . '/' . $key . '/' . $key . '.cfg';
|
||||
|
||||
if (!file_exists($filename))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($parsed_array['filetime']) || (($config['load_tplcompile'] && @filemtime($filename) > $parsed_array['filetime'])))
|
||||
{
|
||||
$reparse = true;
|
||||
}
|
||||
|
||||
// Re-parse cfg file
|
||||
if ($reparse)
|
||||
{
|
||||
$parsed_array = parse_cfg_file($filename);
|
||||
$parsed_array['filetime'] = @filemtime($filename);
|
||||
|
||||
$this->driver->put('_cfg_' . $key . '_' . $theme[$key . '_path'], $parsed_array);
|
||||
}
|
||||
$parsed_items[$key] = $parsed_array;
|
||||
$parsed_array = array();
|
||||
}
|
||||
|
||||
return $parsed_items;
|
||||
$reparse = false;
|
||||
$filename = $phpbb_root_path . 'styles/' . $style['style_path'] . '/style.cfg';
|
||||
|
||||
if (!file_exists($filename))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($parsed_array['filetime']) || (($config['load_tplcompile'] && @filemtime($filename) > $parsed_array['filetime'])))
|
||||
{
|
||||
$reparse = true;
|
||||
}
|
||||
|
||||
// Re-parse cfg file
|
||||
if ($reparse)
|
||||
{
|
||||
$parsed_array = parse_cfg_file($filename);
|
||||
$parsed_array['filetime'] = @filemtime($filename);
|
||||
|
||||
$this->driver->put('_cfg_' . $style['style_path'], $parsed_array);
|
||||
}
|
||||
return $parsed_array;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4772,9 +4772,9 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0
|
|||
|
||||
'T_ASSETS_VERSION' => $config['assets_version'],
|
||||
'T_ASSETS_PATH' => "{$web_path}assets",
|
||||
'T_THEME_PATH' => "{$web_path}styles/" . rawurlencode($user->theme['style_path']) . '/theme',
|
||||
'T_TEMPLATE_PATH' => "{$web_path}styles/" . rawurlencode($user->theme['style_path']) . '/template',
|
||||
'T_SUPER_TEMPLATE_PATH' => "{$web_path}styles/" . rawurlencode($user->theme['style_path']) . '/template',
|
||||
'T_THEME_PATH' => "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/theme',
|
||||
'T_TEMPLATE_PATH' => "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/template',
|
||||
'T_SUPER_TEMPLATE_PATH' => "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/template',
|
||||
'T_IMAGES_PATH' => "{$web_path}images/",
|
||||
'T_SMILIES_PATH' => "{$web_path}{$config['smilies_path']}/",
|
||||
'T_AVATAR_PATH' => "{$web_path}{$config['avatar_path']}/",
|
||||
|
@ -4782,16 +4782,16 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0
|
|||
'T_ICONS_PATH' => "{$web_path}{$config['icons_path']}/",
|
||||
'T_RANKS_PATH' => "{$web_path}{$config['ranks_path']}/",
|
||||
'T_UPLOAD_PATH' => "{$web_path}{$config['upload_path']}/",
|
||||
'T_STYLESHEET_LINK' => "{$web_path}styles/" . rawurlencode($user->theme['style_path']) . '/theme/stylesheet.css?assets_version=' . $config['assets_version'],
|
||||
'T_STYLESHEET_LANG_LINK' => "{$web_path}styles/" . rawurlencode($user->theme['style_path']) . '/theme/' . $user->lang_name . '/stylesheet.css?assets_version=' . $config['assets_version'],
|
||||
'T_STYLESHEET_NAME' => $user->theme['style_name'],
|
||||
'T_STYLESHEET_LINK' => "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/theme/stylesheet.css?assets_version=' . $config['assets_version'],
|
||||
'T_STYLESHEET_LANG_LINK' => "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/theme/' . $user->lang_name . '/stylesheet.css?assets_version=' . $config['assets_version'],
|
||||
'T_STYLESHEET_NAME' => $user->style['style_name'],
|
||||
'T_JQUERY_LINK' => ($config['load_jquery_cdn'] && !empty($config['load_jquery_url'])) ? $config['load_jquery_url'] : "{$web_path}assets/javascript/jquery.js?assets_version=" . $config['assets_version'],
|
||||
'S_JQUERY_FALLBACK' => ($config['load_jquery_cdn']) ? true : false,
|
||||
|
||||
'T_THEME_NAME' => rawurlencode($user->theme['style_path']),
|
||||
'T_THEME_NAME' => rawurlencode($user->style['style_path']),
|
||||
'T_THEME_LANG_NAME' => $user->data['user_lang'],
|
||||
'T_TEMPLATE_NAME' => $user->theme['style_path'],
|
||||
'T_SUPER_TEMPLATE_NAME' => rawurlencode((isset($user->theme['style_parent_tree']) && $user->theme['style_parent_tree']) ? $user->theme['style_parent_tree'] : $user->theme['style_path']),
|
||||
'T_TEMPLATE_NAME' => $user->style['style_path'],
|
||||
'T_SUPER_TEMPLATE_NAME' => rawurlencode((isset($user->style['style_parent_tree']) && $user->style['style_parent_tree']) ? $user->style['style_parent_tree'] : $user->style['style_path']),
|
||||
'T_IMAGES' => 'images',
|
||||
'T_SMILIES' => $config['smilies_path'],
|
||||
'T_AVATAR' => $config['avatar_path'],
|
||||
|
|
|
@ -89,8 +89,8 @@ class phpbb_style
|
|||
*/
|
||||
public function set_style()
|
||||
{
|
||||
$style_name = $this->user->theme['style_path'];
|
||||
$style_dirs = ($this->user->theme['style_parent_id']) ? array_reverse(explode('/', $this->user->theme['style_parent_tree'])) : array();
|
||||
$style_name = $this->user->style['style_path'];
|
||||
$style_dirs = ($this->user->style['style_parent_id']) ? array_reverse(explode('/', $this->user->style['style_parent_tree'])) : array();
|
||||
$paths = array($this->get_style_path($style_name));
|
||||
foreach ($style_dirs as $dir)
|
||||
{
|
||||
|
|
|
@ -27,7 +27,7 @@ class phpbb_user extends phpbb_session
|
|||
{
|
||||
var $lang = array();
|
||||
var $help = array();
|
||||
var $theme = array();
|
||||
var $style = array();
|
||||
var $date_format;
|
||||
var $timezone;
|
||||
var $dst;
|
||||
|
@ -159,11 +159,11 @@ class phpbb_user extends phpbb_session
|
|||
FROM ' . STYLES_TABLE . " s
|
||||
WHERE s.style_id = $style_id";
|
||||
$result = $db->sql_query($sql, 3600);
|
||||
$this->theme = $db->sql_fetchrow($result);
|
||||
$this->style = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// User has wrong style
|
||||
if (!$this->theme && $style_id == $this->data['user_style'])
|
||||
if (!$this->style && $style_id == $this->data['user_style'])
|
||||
{
|
||||
$style_id = $this->data['user_style'] = $config['default_style'];
|
||||
|
||||
|
@ -176,20 +176,17 @@ class phpbb_user extends phpbb_session
|
|||
FROM ' . STYLES_TABLE . " s
|
||||
WHERE s.style_id = $style_id";
|
||||
$result = $db->sql_query($sql, 3600);
|
||||
$this->theme = $db->sql_fetchrow($result);
|
||||
$this->style = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
if (!$this->theme)
|
||||
if (!$this->style)
|
||||
{
|
||||
trigger_error('Could not get style data', E_USER_ERROR);
|
||||
}
|
||||
|
||||
// Now parse the cfg file and cache it
|
||||
$parsed_items = $cache->obtain_cfg_items($this->theme);
|
||||
|
||||
// We are only interested in the theme configuration for now
|
||||
$parsed_items = $parsed_items['theme'];
|
||||
$parsed_items = $cache->obtain_cfg_items($this->style);
|
||||
|
||||
$check_for = array(
|
||||
'pagination_sep' => (string) ', '
|
||||
|
@ -197,12 +194,12 @@ class phpbb_user extends phpbb_session
|
|||
|
||||
foreach ($check_for as $key => $default_value)
|
||||
{
|
||||
$this->theme[$key] = (isset($parsed_items[$key])) ? $parsed_items[$key] : $default_value;
|
||||
settype($this->theme[$key], gettype($default_value));
|
||||
$this->style[$key] = (isset($parsed_items[$key])) ? $parsed_items[$key] : $default_value;
|
||||
settype($this->style[$key], gettype($default_value));
|
||||
|
||||
if (is_string($default_value))
|
||||
{
|
||||
$this->theme[$key] = htmlspecialchars($this->theme[$key]);
|
||||
$this->style[$key] = htmlspecialchars($this->style[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue