1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

Merge remote-tracking branch 'github-cs278/feature/remove-db-styles' into develop

* github-cs278/feature/remove-db-styles:
  [feature/remove-db-styles] Remove forgotten template variables.
  [feature/remove-db-styles] Removed style.php!
  [feature/remove-db-styles] Rework filesystem permission checks from 6d24a71.
  [feature/remove-db-styles] Update language to reflect removal of db storage.
  [feature/remove-db-styles] Mark log entrys as deprecated.
  [feature/remove-db-styles] Add error if template/theme file is unwritable.
  [feature/remove-db-styles] Add schema changes sinces 3.0.x.
  [feature/remove-db-styles] Readd table constant for upgrades etc.
  [feature/remove-db-styles] Update database schemas.
  [feature/remove-db-styles] Remove style.php DB storage.
  [feature/remove-db-styles] Remove parse_css_file option from themes.
  [feature/remove-db-styles] Remove DB theme handling code from session.
  [feature/remove-db-styles] ACP has forgotten how to store themes in the DB.
  [feature/remove-db-styles] Missed a few template DB bits in acp_styles.
  [feature/remove-db-styles] Removing unused methods from acp_style.
  [feature/remove-db-styles] Removed database storage of style components.
This commit is contained in:
Nils Adermann
2011-09-21 01:09:18 +02:00
22 changed files with 140 additions and 1173 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -4566,7 +4566,7 @@ 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' => (!$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_LINK' => "{$web_path}styles/" . $user->theme['theme_path'] . '/theme/stylesheet.css',
'T_STYLESHEET_LANG_LINK' => "{$web_path}styles/" . $user->theme['theme_path'] . '/theme/' . $user->lang_name . '/stylesheet.css',
'T_STYLESHEET_NAME' => $user->theme['theme_name'],

View File

@@ -1655,7 +1655,7 @@ 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
$sql = 'SELECT s.style_id, 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_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
@@ -1674,7 +1674,7 @@ 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
$sql = 'SELECT s.style_id, t.template_path, t.template_id, t.bbcode_bitfield, c.theme_path, c.theme_name, 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
@@ -1696,7 +1696,6 @@ class user extends session
$parsed_items = $parsed_items['theme'];
$check_for = array(
'parse_css_file' => (int) 0,
'pagination_sep' => (string) ', '
);
@@ -1711,52 +1710,6 @@ class user extends session
}
}
// If the style author specified the theme needs to be cached
// (because of the used paths and variables) than make sure it is the case.
// For example, if the theme uses language-specific images it needs to be stored in db.
if (!$this->theme['theme_storedb'] && $this->theme['parse_css_file'])
{
$this->theme['theme_storedb'] = 1;
$stylesheet = file_get_contents("{$phpbb_root_path}styles/{$this->theme['theme_path']}/theme/stylesheet.css");
// Match CSS imports
$matches = array();
preg_match_all('/@import url\(["\'](.*)["\']\);/i', $stylesheet, $matches);
if (sizeof($matches))
{
$content = '';
foreach ($matches[0] as $idx => $match)
{
if ($content = @file_get_contents("{$phpbb_root_path}styles/{$this->theme['theme_path']}/theme/" . $matches[1][$idx]))
{
$content = trim($content);
}
else
{
$content = '';
}
$stylesheet = str_replace($match, $content, $stylesheet);
}
unset($content);
}
$stylesheet = str_replace('./', 'styles/' . $this->theme['theme_path'] . '/theme/', $stylesheet);
$sql_ary = array(
'theme_data' => $stylesheet,
'theme_mtime' => time(),
'theme_storedb' => 1
);
$sql = 'UPDATE ' . STYLES_THEME_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
WHERE theme_id = ' . $this->theme['theme_id'];
$db->sql_query($sql);
unset($sql_ary);
}
$template->set_template();
$this->img_lang = $this->lang_name;