aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/style.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2005-01-20 20:57:45 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2005-01-20 20:57:45 +0000
commit9c1a4bdac16945c7d616b3449cc7d97a2548fc22 (patch)
tree27e35d979f7b8fd6b7844a6cba941b5b04a438bd /phpBB/style.php
parenta7ef13c639e048e9ee9edc25e7f7d9a5bf155812 (diff)
downloadforums-9c1a4bdac16945c7d616b3449cc7d97a2548fc22.tar
forums-9c1a4bdac16945c7d616b3449cc7d97a2548fc22.tar.gz
forums-9c1a4bdac16945c7d616b3449cc7d97a2548fc22.tar.bz2
forums-9c1a4bdac16945c7d616b3449cc7d97a2548fc22.tar.xz
forums-9c1a4bdac16945c7d616b3449cc7d97a2548fc22.zip
- bugfixes
- default sort options for posts too - adjusted format_date to remove the (time intensive) preg_ calls - temporary style.php code. git-svn-id: file:///svn/phpbb/trunk@5068 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/style.php')
-rw-r--r--phpBB/style.php50
1 files changed, 38 insertions, 12 deletions
diff --git a/phpBB/style.php b/phpBB/style.php
index f1e14b21b4..b9c2c27cd1 100644
--- a/phpBB/style.php
+++ b/phpBB/style.php
@@ -52,26 +52,52 @@ if (!empty($_GET['id']) && !empty($_GET['sid']))
$sid = htmlspecialchars($_GET['sid']);
$id = intval($_GET['id']);
- $sql = "SELECT session_id
- FROM {$table_prefix}sessions
- WHERE session_id = '" . ((!get_magic_quotes_gpc()) ? $db->sql_escape($sid) : $sid) . "'";
+ $sql = "SELECT s.session_id, u.user_lang
+ FROM {$table_prefix}sessions s, {$table_prefix}users u
+ WHERE s.session_id = '" . ((!get_magic_quotes_gpc()) ? $db->sql_escape($sid) : $sid) . "'
+ AND s.session_user_id = u.user_id";
$result = $db->sql_query($sql);
- if ($db->sql_fetchrow($result))
+ if ($user = $db->sql_fetchrow($result))
{
- $sql = "SELECT theme_data
- FROM {$table_prefix}styles_theme
- WHERE theme_id = $id";
+ $sql = "SELECT s.style_id, c.theme_data, c.theme_path, c.theme_mtime, i.imageset_path, 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
+ AND c.theme_id = s.theme_id
+ AND i.imageset_id = s.imageset_id";
$result2 = $db->sql_query($sql, 300);
- if ($row = $db->sql_fetchrow($result2))
+ if (!($theme = $db->sql_fetchrow($result2)))
{
- header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 3600));
- header('Content-type: text/css');
-
- echo $row['theme_data'];
+ exit;
}
$db->sql_freeresult($result2);
+
+ if ($theme['theme_mtime'] < filemtime("{$phpbb_root_path}styles/" . $theme['theme_path'] . '/theme/stylesheet.css'))
+ {
+ $theme['theme_data'] = implode('', file("{$phpbb_root_path}styles/" . $theme['theme_path'] . '/theme/stylesheet.css'));
+
+ $db->sql_query("UPDATE {$table_prefix}styles_theme SET theme_data = '" . $db->sql_escape($theme['theme_data']) . "', theme_mtime = " . time() . "
+ WHERE theme_id = $id");
+ }
+
+ header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 3600));
+ header('Content-type: text/css');
+
+ // 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['user_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']);
+
+ echo $theme['theme_data'];
}
$db->sql_freeresult($result);