2003-07-24 10:52:09 +00:00
|
|
|
<?php
|
2005-04-09 12:26:45 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @package phpBB3
|
|
|
|
* @version $Id$
|
|
|
|
* @copyright (c) 2005 phpBB Group
|
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
|
|
*
|
|
|
|
*/
|
2003-07-24 10:52:09 +00:00
|
|
|
|
2005-04-09 12:26:45 +00:00
|
|
|
/**
|
2006-05-05 17:56:33 +00:00
|
|
|
* @ignore
|
2005-04-09 12:26:45 +00:00
|
|
|
*/
|
2003-07-24 10:52:09 +00:00
|
|
|
define('IN_PHPBB', true);
|
|
|
|
$phpbb_root_path = './';
|
2003-09-07 13:46:51 +00:00
|
|
|
$phpEx = substr(strrchr(__FILE__, '.'), 1);
|
2006-06-06 20:53:46 +00:00
|
|
|
require($phpbb_root_path . 'config.' . $phpEx);
|
2003-07-24 10:52:09 +00:00
|
|
|
|
2007-03-22 00:59:15 +00:00
|
|
|
if (version_compare(PHP_VERSION, '6.0.0-dev', '<'))
|
|
|
|
{
|
|
|
|
set_magic_quotes_runtime(0);
|
|
|
|
}
|
2003-07-24 10:52:09 +00:00
|
|
|
|
|
|
|
// Load Extensions
|
|
|
|
if (!empty($load_extensions))
|
|
|
|
{
|
|
|
|
$load_extensions = explode(',', $load_extensions);
|
|
|
|
|
|
|
|
foreach ($load_extensions as $extension)
|
|
|
|
{
|
|
|
|
@dl(trim($extension));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-12-28 17:35:20 +00:00
|
|
|
|
|
|
|
$sid = (isset($_GET['sid'])) ? htmlspecialchars($_GET['sid']) : '';
|
|
|
|
$id = (isset($_GET['id'])) ? intval($_GET['id']) : 0;
|
|
|
|
|
2007-04-16 11:27:10 +00:00
|
|
|
if (strspn($sid, 'abcdefABCDEF0123456789') !== strlen($sid))
|
2005-12-28 17:35:20 +00:00
|
|
|
{
|
|
|
|
$sid = '';
|
|
|
|
}
|
|
|
|
|
2003-07-24 10:52:09 +00:00
|
|
|
// This is a simple script to grab and output the requested CSS data stored in the DB
|
|
|
|
// We include a session_id check to try and limit 3rd party linking ... unless they
|
|
|
|
// happen to have a current session it will output nothing. We will also cache the
|
|
|
|
// resulting CSS data for five minutes ... anything to reduce the load on the SQL
|
|
|
|
// server a little
|
2005-12-28 17:35:20 +00:00
|
|
|
if ($id && $sid)
|
2003-07-24 10:52:09 +00:00
|
|
|
{
|
2006-06-06 20:53:46 +00:00
|
|
|
if (empty($acm_type) || empty($dbms))
|
|
|
|
{
|
|
|
|
die('Hacking attempt');
|
|
|
|
}
|
|
|
|
|
2003-07-24 10:52:09 +00:00
|
|
|
// Include files
|
2006-06-06 20:53:46 +00:00
|
|
|
require($phpbb_root_path . 'includes/acm/acm_' . $acm_type . '.' . $phpEx);
|
2006-07-07 20:38:04 +00:00
|
|
|
require($phpbb_root_path . 'includes/cache.' . $phpEx);
|
2006-06-06 20:53:46 +00:00
|
|
|
require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx);
|
2006-10-06 18:43:55 +00:00
|
|
|
require($phpbb_root_path . 'includes/constants.' . $phpEx);
|
2003-07-24 10:52:09 +00:00
|
|
|
|
2005-08-19 10:48:39 +00:00
|
|
|
$db = new $sql_db();
|
2005-10-04 21:39:47 +00:00
|
|
|
$cache = new cache();
|
2006-06-03 22:19:41 +00:00
|
|
|
|
2003-07-24 10:52:09 +00:00
|
|
|
// Connect to DB
|
2007-02-19 04:15:35 +00:00
|
|
|
if (!@$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, false))
|
2003-07-24 10:52:09 +00:00
|
|
|
{
|
|
|
|
exit;
|
|
|
|
}
|
2007-04-30 10:59:47 +00:00
|
|
|
unset($dbpasswd);
|
2003-07-24 10:52:09 +00:00
|
|
|
|
2006-10-06 18:43:55 +00:00
|
|
|
$config = $cache->obtain_config();
|
|
|
|
|
2007-05-05 17:59:14 +00:00
|
|
|
$sql = 'SELECT u.user_id, u.user_lang
|
#10005, #10003, #10001, #9999, #9945, #9965, #9909, #9906, #9877, #9861, #9831, #9830, #9815, #9665, #9624
prosilver adjustments for important announcements in ucp - #9995
MCP fixes for user notes/warnings - #9981
Preserving imageset values on save/edit
find a member link for Mass PM's - #9925
syndicate window.onload events where necessary - #9878
Duplicate topics in forums with announcements - #9840
Email template for forced re-activation - #9808
Topic pagination adjustment - #9763
Changed compose message layout in UCP - #9706, #9702
Fixed inline attachment font size (hopefully)
git-svn-id: file:///svn/phpbb/trunk@7384 89ea8834-ac86-4346-8a33-228a782c2dd0
2007-04-22 15:27:40 +00:00
|
|
|
FROM ' . SESSIONS_TABLE . ' s, ' . USERS_TABLE . " u
|
2005-12-28 17:35:20 +00:00
|
|
|
WHERE s.session_id = '" . $db->sql_escape($sid) . "'
|
2005-01-20 20:57:45 +00:00
|
|
|
AND s.session_user_id = u.user_id";
|
2003-07-24 10:52:09 +00:00
|
|
|
$result = $db->sql_query($sql);
|
2005-12-28 17:35:20 +00:00
|
|
|
$user = $db->sql_fetchrow($result);
|
|
|
|
$db->sql_freeresult($result);
|
2006-06-03 22:19:41 +00:00
|
|
|
|
2005-12-28 17:35:20 +00:00
|
|
|
if ($user)
|
2003-07-24 10:52:09 +00:00
|
|
|
{
|
#10005, #10003, #10001, #9999, #9945, #9965, #9909, #9906, #9877, #9861, #9831, #9830, #9815, #9665, #9624
prosilver adjustments for important announcements in ucp - #9995
MCP fixes for user notes/warnings - #9981
Preserving imageset values on save/edit
find a member link for Mass PM's - #9925
syndicate window.onload events where necessary - #9878
Duplicate topics in forums with announcements - #9840
Email template for forced re-activation - #9808
Topic pagination adjustment - #9763
Changed compose message layout in UCP - #9706, #9702
Fixed inline attachment font size (hopefully)
git-svn-id: file:///svn/phpbb/trunk@7384 89ea8834-ac86-4346-8a33-228a782c2dd0
2007-04-22 15:27:40 +00:00
|
|
|
$sql = 'SELECT s.style_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
|
|
|
|
WHERE s.style_id = ' . $id . '
|
2005-01-20 20:57:45 +00:00
|
|
|
AND t.template_id = s.template_id
|
|
|
|
AND c.theme_id = s.theme_id
|
#10005, #10003, #10001, #9999, #9945, #9965, #9909, #9906, #9877, #9861, #9831, #9830, #9815, #9665, #9624
prosilver adjustments for important announcements in ucp - #9995
MCP fixes for user notes/warnings - #9981
Preserving imageset values on save/edit
find a member link for Mass PM's - #9925
syndicate window.onload events where necessary - #9878
Duplicate topics in forums with announcements - #9840
Email template for forced re-activation - #9808
Topic pagination adjustment - #9763
Changed compose message layout in UCP - #9706, #9702
Fixed inline attachment font size (hopefully)
git-svn-id: file:///svn/phpbb/trunk@7384 89ea8834-ac86-4346-8a33-228a782c2dd0
2007-04-22 15:27:40 +00:00
|
|
|
AND i.imageset_id = s.imageset_id';
|
2005-12-28 17:35:20 +00:00
|
|
|
$result = $db->sql_query($sql, 300);
|
|
|
|
$theme = $db->sql_fetchrow($result);
|
|
|
|
$db->sql_freeresult($result);
|
2003-07-24 10:52:09 +00:00
|
|
|
|
2007-05-05 17:59:14 +00:00
|
|
|
if ($user['user_id'] == ANONYMOUS)
|
|
|
|
{
|
|
|
|
$user['user_lang'] = $config['default_lang'];
|
|
|
|
}
|
|
|
|
|
2007-04-08 17:40:36 +00:00
|
|
|
$sql = 'SELECT *
|
|
|
|
FROM ' . STYLES_IMAGESET_DATA_TABLE . '
|
2007-04-09 05:10:00 +00:00
|
|
|
WHERE imageset_id = ' . $theme['imageset_id'] . "
|
2007-04-08 17:40:36 +00:00
|
|
|
AND image_lang IN('" . $db->sql_escape($user['user_lang']) . "', '')";
|
|
|
|
$result = $db->sql_query($sql, 3600);
|
|
|
|
|
|
|
|
$img_array = array();
|
|
|
|
|
|
|
|
while ($row = $db->sql_fetchrow($result))
|
|
|
|
{
|
|
|
|
$img_array[$row['image_name']] = $row;
|
|
|
|
}
|
|
|
|
|
2005-12-28 17:35:20 +00:00
|
|
|
if (!$theme)
|
2003-07-24 10:52:09 +00:00
|
|
|
{
|
2005-01-20 20:57:45 +00:00
|
|
|
exit;
|
2003-07-24 10:52:09 +00:00
|
|
|
}
|
2006-05-20 23:56:12 +00:00
|
|
|
|
2006-10-06 18:43:55 +00:00
|
|
|
// Re-cache stylesheet data if necessary
|
|
|
|
if ($config['load_tplcompile'] && $theme['theme_mtime'] < @filemtime("{$phpbb_root_path}styles/" . $theme['theme_path'] . '/theme/stylesheet.css'))
|
|
|
|
{
|
|
|
|
include_once($phpbb_root_path . 'includes/acp/acp_styles.' . $phpEx);
|
|
|
|
|
|
|
|
$theme['theme_data'] = acp_styles::db_theme_data($theme);
|
|
|
|
$theme['theme_mtime'] = @filemtime("{$phpbb_root_path}styles/" . $theme['theme_path'] . '/theme/stylesheet.css');
|
|
|
|
|
|
|
|
// Save CSS contents
|
|
|
|
$sql_ary = array(
|
|
|
|
'theme_mtime' => $theme['theme_mtime'],
|
|
|
|
'theme_data' => $theme['theme_data']
|
|
|
|
);
|
|
|
|
|
|
|
|
$sql = 'UPDATE ' . STYLES_THEME_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
|
|
|
|
WHERE theme_id = $id";
|
|
|
|
$db->sql_query($sql);
|
|
|
|
|
|
|
|
$cache->destroy('sql', STYLES_THEME_TABLE);
|
2007-05-02 21:08:50 +00:00
|
|
|
|
|
|
|
header('Expires: 0');
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 3600));
|
2006-10-06 18:43:55 +00:00
|
|
|
}
|
2006-06-06 20:53:46 +00:00
|
|
|
|
2005-01-20 20:57:45 +00:00
|
|
|
header('Content-type: text/css');
|
2006-06-03 22:19:41 +00:00
|
|
|
|
2005-01-20 20:57:45 +00:00
|
|
|
// Parse Theme Data
|
|
|
|
$replace = array(
|
|
|
|
'{T_THEME_PATH}' => "{$phpbb_root_path}styles/" . $theme['theme_path'] . '/theme',
|
2005-12-22 16:28:27 +00:00
|
|
|
'{T_TEMPLATE_PATH}' => "{$phpbb_root_path}styles/" . $theme['template_path'] . '/template',
|
|
|
|
'{T_IMAGESET_PATH}' => "{$phpbb_root_path}styles/" . $theme['imageset_path'] . '/imageset',
|
2005-01-20 20:57:45 +00:00
|
|
|
'{T_IMAGESET_LANG_PATH}' => "{$phpbb_root_path}styles/" . $theme['imageset_path'] . '/imageset/' . $user['user_lang'],
|
|
|
|
'{T_STYLESHEET_NAME}' => $theme['theme_name'],
|
2005-12-22 16:28:27 +00:00
|
|
|
'{S_USER_LANG}' => $user['user_lang']
|
2005-01-20 20:57:45 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
$theme['theme_data'] = str_replace(array_keys($replace), array_values($replace), $theme['theme_data']);
|
|
|
|
|
2006-08-08 19:02:44 +00:00
|
|
|
$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);
|
2007-04-08 17:40:36 +00:00
|
|
|
if (!isset($img_array[$img]))
|
2006-08-08 19:02:44 +00:00
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!isset($imgs[$img]))
|
|
|
|
{
|
2007-04-08 17:40:36 +00:00
|
|
|
$img_data = &$img_array[$img];
|
|
|
|
$imgsrc = ($img_data['image_lang'] ? $img_data['image_lang'] . '/' : '') . $img_data['image_filename'];
|
2006-08-08 19:02:44 +00:00
|
|
|
$imgs[$img] = array(
|
2007-04-08 17:40:36 +00:00
|
|
|
'src' => $phpbb_root_path . 'styles/' . $theme['imageset_path'] . '/imageset/' . $imgsrc,
|
|
|
|
'width' => $img_data['image_width'],
|
|
|
|
'height' => $img_data['image_height'],
|
2006-08-08 19:02:44 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
switch ($matches[2][$i])
|
|
|
|
{
|
|
|
|
case 'SRC':
|
2007-04-08 17:40:36 +00:00
|
|
|
$replace[] = $imgs[$img]['src'];
|
2006-08-08 19:02:44 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'WIDTH':
|
2007-04-08 17:40:36 +00:00
|
|
|
$replace[] = $imgs[$img]['width'];
|
2006-08-08 19:02:44 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'HEIGHT':
|
2007-04-08 17:40:36 +00:00
|
|
|
$replace[] = $imgs[$img]['height'];
|
2006-08-08 19:02:44 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
continue;
|
|
|
|
}
|
2007-04-08 17:40:36 +00:00
|
|
|
$find[] = $matches[0][$i];
|
2006-08-08 19:02:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (sizeof($find))
|
|
|
|
{
|
|
|
|
$theme['theme_data'] = str_replace($find, $replace, $theme['theme_data']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-01-20 20:57:45 +00:00
|
|
|
echo $theme['theme_data'];
|
2003-07-24 10:52:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!empty($cache))
|
|
|
|
{
|
|
|
|
$cache->unload();
|
|
|
|
}
|
|
|
|
$db->sql_close();
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|