diff options
Diffstat (limited to 'phpBB/style.php')
-rw-r--r-- | phpBB/style.php | 90 |
1 files changed, 4 insertions, 86 deletions
diff --git a/phpBB/style.php b/phpBB/style.php index eaab4544bc..22788ece94 100644 --- a/phpBB/style.php +++ b/phpBB/style.php @@ -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)) |