diff options
author | Nils Adermann <naderman@naderman.de> | 2006-08-08 19:02:44 +0000 |
---|---|---|
committer | Nils Adermann <naderman@naderman.de> | 2006-08-08 19:02:44 +0000 |
commit | c69a6f7acd9c9c0b1293e6977fe1ec5b490725d4 (patch) | |
tree | 7b52ef2b8f7c9525cc039517d8fa98da57e8728d /phpBB/style.php | |
parent | 2ed25800c5ad5125740f574092098d284071300b (diff) | |
download | forums-c69a6f7acd9c9c0b1293e6977fe1ec5b490725d4.tar forums-c69a6f7acd9c9c0b1293e6977fe1ec5b490725d4.tar.gz forums-c69a6f7acd9c9c0b1293e6977fe1ec5b490725d4.tar.bz2 forums-c69a6f7acd9c9c0b1293e6977fe1ec5b490725d4.tar.xz forums-c69a6f7acd9c9c0b1293e6977fe1ec5b490725d4.zip |
- fixed some problems with themes
- added support for {IMG_NAME_SRC}, {IMG_NAME_WIDTH} and {IMG_NAME_HEIGHT}
- fulltext_native has to use group by in a few more quries
git-svn-id: file:///svn/phpbb/trunk@6254 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/style.php')
-rw-r--r-- | phpBB/style.php | 62 |
1 files changed, 61 insertions, 1 deletions
diff --git a/phpBB/style.php b/phpBB/style.php index 3c93b847a0..075f20db3d 100644 --- a/phpBB/style.php +++ b/phpBB/style.php @@ -74,7 +74,7 @@ if ($id && $sid) if ($user) { - $sql = "SELECT s.style_id, c.theme_data, c.theme_path, c.theme_name, c.theme_mtime, i.imageset_path, t.template_path + $sql = "SELECT s.style_id, c.theme_data, c.theme_path, c.theme_name, c.theme_mtime, i.*, t.template_path FROM {$table_prefix}styles s, {$table_prefix}styles_template t, {$table_prefix}styles_theme c, {$table_prefix}styles_imageset i WHERE s.style_id = $id AND t.template_id = s.template_id @@ -110,6 +110,66 @@ if ($id && $sid) $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); + if (!isset($theme[$img])) + { + continue; + } + + if (!isset($imgs[$img])) + { + // Do not include dimensions? + if (strpos($theme[$img], '*') === false) + { + $imgsrc = trim($theme[$img]); + $width = $height = null; + } + else + { + list($imgsrc, $height, $width) = explode('*', $theme[$img]); + } + + $imgs[$img] = array( + 'src' => $phpbb_root_path . 'styles/' . $theme['imageset_path'] . '/imageset/' . str_replace('{LANG}', $user['user_lang'], $imgsrc), + 'width' => $width, + 'height' => $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; + } + $find = $matches[0][$i]; + } + + if (sizeof($find)) + { + $theme['theme_data'] = str_replace($find, $replace, $theme['theme_data']); + } + } + echo $theme['theme_data']; } |