diff options
| author | Meik Sievertsen <acydburn@phpbb.com> | 2007-04-30 15:35:12 +0000 |
|---|---|---|
| committer | Meik Sievertsen <acydburn@phpbb.com> | 2007-04-30 15:35:12 +0000 |
| commit | 00a63fa813601877377ab746aa95429ba9846b43 (patch) | |
| tree | 30365851d7dc70c4b30983c97290144871ebd4e9 /phpBB/includes/functions.php | |
| parent | 35cf64c370ddc9dbae6ea211ae2a2849e071ea98 (diff) | |
| download | forums-00a63fa813601877377ab746aa95429ba9846b43.tar forums-00a63fa813601877377ab746aa95429ba9846b43.tar.gz forums-00a63fa813601877377ab746aa95429ba9846b43.tar.bz2 forums-00a63fa813601877377ab746aa95429ba9846b43.tar.xz forums-00a63fa813601877377ab746aa95429ba9846b43.zip | |
#10283 - no style if banning anonymous/ip and using style requiring stylesheet parsing. Also fixes a bug for non-parsed THEME_DATA...
git-svn-id: file:///svn/phpbb/trunk@7439 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions.php')
| -rw-r--r-- | phpBB/includes/functions.php | 68 |
1 files changed, 67 insertions, 1 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index c192cf8264..efff0424d8 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3973,7 +3973,6 @@ function page_header($page_title = '', $display_online_list = true) 'T_UPLOAD_PATH' => "{$phpbb_root_path}{$config['upload_path']}/", 'T_STYLESHEET_LINK' => (!$user->theme['theme_storedb']) ? "{$phpbb_root_path}styles/" . $user->theme['theme_path'] . '/theme/stylesheet.css' : "{$phpbb_root_path}style.$phpEx?sid=$user->session_id&id=" . $user->theme['style_id'] . '&lang=' . $user->data['user_lang'], 'T_STYLESHEET_NAME' => $user->theme['theme_name'], - 'T_THEME_DATA' => (!$user->theme['theme_storedb']) ? '' : $user->theme['theme_data'], 'SITE_LOGO_IMG' => $user->img('site_logo')) ); @@ -3981,6 +3980,73 @@ function page_header($page_title = '', $display_online_list = true) // Once used, we do not want to have the whole theme data twice in memory... if ($user->theme['theme_storedb']) { + // Parse Theme Data + $replace = array( + '{T_THEME_PATH}' => "{$phpbb_root_path}styles/" . $user->theme['theme_path'] . '/theme', + '{T_TEMPLATE_PATH}' => "{$phpbb_root_path}styles/" . $user->theme['template_path'] . '/template', + '{T_IMAGESET_PATH}' => "{$phpbb_root_path}styles/" . $user->theme['imageset_path'] . '/imageset', + '{T_IMAGESET_LANG_PATH}' => "{$phpbb_root_path}styles/" . $user->theme['imageset_path'] . '/imageset/' . $user->data['user_lang'], + '{T_STYLESHEET_NAME}' => $user->theme['theme_name'], + '{S_USER_LANG}' => $user->data['user_lang'] + ); + + $user->theme['theme_data'] = str_replace(array_keys($replace), array_values($replace), $user->theme['theme_data']); + + $matches = array(); + if (strpos($user->theme['theme_data'], '{IMG_') !== false) + { + preg_match_all('#\{IMG_([A-Za-z0-9_]*?)_(WIDTH|HEIGHT|SRC)\}#', $user->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($img_array[$img])) + { + 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/' . $user->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; + } + $find[] = $matches[0][$i]; + } + + if (sizeof($find)) + { + $user->theme['theme_data'] = str_replace($find, $replace, $user->theme['theme_data']); + } + } + } + + $template->assign_var('T_THEME_DATA', $user->theme['theme_data']); $user->theme['theme_data'] = ''; } |
