diff --git a/phpBB/adm/admin_styles.php b/phpBB/adm/admin_styles.php
index bedc705daa..3a254cff41 100644
--- a/phpBB/adm/admin_styles.php
+++ b/phpBB/adm/admin_styles.php
@@ -641,16 +641,16 @@ switch ($mode)
// List of default classes, categorised
$base_classes = array(
'text' => array(
- 'body', 'p', 'h1', 'h2', 'h3', 'tabletitle', 'cattitle', 'topictitle', 'topicauthor', 'topicdetails', 'postdetails', 'postbody', 'posthilit', 'postauthor', 'mainmenu', 'nav', 'genmed', 'gensmall', 'copyright',
+ 'body', 'p', 'h1', 'h2', 'h3', '.tabletitle', '.cattitle', '.topictitle', '.topicauthor', '.topicdetails', '.postdetails', '.postbody', '.posthilit', '.postauthor', '.mainmenu', '.nav', '.genmed', '.gensmall', '.copyright',
),
'tables' => array(
- 'table', 'th', 'cat', 'catdiv', 'td', 'row1', 'row2', 'row3', 'spacer', 'hr',
+ 'table', 'th', '.cat', '.catdiv', 'td', '.row1', '.row2', '.row3', '.spacer', 'hr',
),
'forms' => array(
- 'form', 'input', 'select', 'textarea', 'post', 'btnlite', 'btnmain', 'btnbbcode',
+ 'form', 'input', 'select', '.textarea', '.post', '.btnlite', '.btnmain', '.btnbbcode',
),
'bbcode' => array(
- 'b', 'u', 'i', 'color', 'size', 'code', 'quote', 'flash', 'syntaxbg', 'syntaxcomment', 'syntaxdefault', 'syntaxhtml', 'syntaxkeyword', 'syntaxstring',
+ '.b', '.u', '.i', '.color', '.size', '.code', '.quote', 'flash', '.syntaxbg', '.syntaxcomment', '.syntaxdefault', '.syntaxhtml', '.syntaxkeyword', '.syntaxstring',
),
'custom' => array(),
);
@@ -670,7 +670,7 @@ switch ($mode)
$map_elements = array(
'colors' => '%s',
'sizes' => '%d%s',
- 'images' => 'url(\'%s\')',
+ 'images' => 'url(\'./../%s\')',
'repeat' => '%s',
'other' => '%s',
);
@@ -734,12 +734,12 @@ switch ($mode)
// have just selected a class. We must also cope with switching between
// simple and rawcss mode
$css_element = array();
- if (!empty($_POST['rawcss']))
+ if (!empty($_POST['rawcss']) && !empty($_POST['hidecss']))
{
$css_element = preg_replace("#;[\r\n]*#s", "\n", stripslashes($_POST['rawcss']));
$css_element = explode("\n", $css_element);
}
- else if ($showcss)
+ else if (($showcss && !empty($_POST['showcss'])) || !empty($_POST['preview']))
{
if (!empty($_POST['cssother']))
{
@@ -753,21 +753,62 @@ switch ($mode)
$var = str_replace('-', '_', $match);
if (!empty($_POST[$var]))
{
- $css_element[] = str_replace('_', '-', $var) . ': ' . (($type == 'sizes') ? sprintf($map_elements[$type], $_POST[$var], $_POST[$var . '_units']) : sprintf($map_elements[$type], $_POST[$var]));
+ $css_element[] = str_replace('_', '-', $var) . ': ' . (($type == 'sizes') ? sprintf($map_elements[$type], stripslashes($_POST[$var]), $_POST[$var . '_units']) : sprintf($map_elements[$type], stripslashes($_POST[$var])));
}
}
}
}
else if (preg_match('#^.*?' . $class . ' {(.*?)}#m', $stylesheet, $matches))
{
- $css_element = explode('; ', ltrim($matches[1]));
+ $css_element = explode('; ', ltrim(substr($matches[1], 0, -2)));
+ }
+
+
+ if (!empty($_POST['preview']))
+ {
+
+?>
+
+
+
+
+
+
+Hello, this is some text. How does it look? Hello, this is some text. How does it look? Hello, this is some text. How does it look? Hello, this is some text. How does it look? Hello, this is some text. How does it look? Hello, this is some text. How does it look? Hello, this is some text. How does it look?
+
+
+
+Hello, this is some text. How does it look? Hello, this is some text. How does it look? Hello, this is some text. How does it look? Hello, this is some text. How does it look? Hello, this is some text. How does it look? Hello, this is some text. How does it look? Hello, this is some text. How does it look?
+
+
+
+Hello, this is some text. How does it look? Hello, this is some text. How does it look? Hello, this is some text. How does it look? Hello, this is some text. How does it look? Hello, this is some text. How does it look? Hello, this is some text. How does it look? Hello, this is some text. How does it look?
+
+
+
+Hello, this is some text. How does it look? Hello, this is some text. How does it look? Hello, this is some text. How does it look? Hello, this is some text. How does it look? Hello, this is some text. How does it look? Hello, this is some text. How does it look? Hello, this is some text. How does it look?
+
+
+
+ $match_ary)
{
@@ -776,43 +817,46 @@ switch ($mode)
$var = str_replace('-', '_', $match);
$$var = '';
- foreach ($css_element as $key => $element)
+ if (sizeof($css_element))
{
- if (preg_match('#^' . $match . ': (.*?)$#', $element, $matches))
+ foreach ($css_element as $key => $element)
{
- switch ($type)
+ if (preg_match('#^' . preg_quote($match, '#') . ': (.*?)$#', $element, $matches))
{
- case 'colors':
- $$var = trim($matches[1]);
- break;
-
- case 'sizes':
- if (preg_match('#(.*?)(px|%|em|pt)#', $matches[1], $matches))
- {
- ${$var . '_units'} = trim($matches[2]);
- }
- $$var = trim($matches[1]);
- break;
-
- case 'images':
- if (preg_match('#url\(\'(.*?)\'\)#', $matches[1], $matches))
- {
+ switch ($type)
+ {
+ case 'colors':
$$var = trim($matches[1]);
- }
- $$var = str_replace('./', $theme_name . '/', $$var);
- break;
+ break;
- case 'repeat':
- $$var = trim($matches[1]);
- break;
+ case 'sizes':
+ if (preg_match('#(.*?)(px|%|em|pt)#', $matches[1], $matches))
+ {
+ ${$var . '_units'} = trim($matches[2]);
+ }
+ $$var = trim($matches[1]);
+ break;
- default:
- $$var = trim($matches[1]);
+ case 'images':
+ if (preg_match('#url\(\'(.*?)\'\)#', $matches[1], $matches))
+ {
+ $$var = trim($matches[1]);
+ }
+ $$var = str_replace('./', $theme_name . '/', $$var);
+ break;
+
+ case 'repeat':
+ $$var = trim($matches[1]);
+ break;
+
+ default:
+ $$var = trim($matches[1]);
+ }
+
+ // Remove this element from array
+ unset($css_element[$key]);
+ break;
}
-
- // Remove this element from array
- unset($css_element[$key]);
- break;
}
}
}
@@ -836,7 +880,7 @@ switch ($mode)
foreach ($class_ary as $class_name)
{
$selected = ($class_name == $class) ? ' selected="selected"' : '';
- $class_options .= '' . (($category == 'custom') ? $class_name : $user->lang['style_' . $class_name]) . ' ';
+ $class_options .= '' . (($category == 'custom') ? $class_name : $user->lang['style_' . str_replace('.', '', $class_name)]) . ' ';
}
}
@@ -866,10 +910,25 @@ switch ($mode)
function swatch(field)
{
- window.open('./swatch.?form=style&name=' + field, '_swatch', 'HEIGHT=115,resizable=yes,scrollbars=no,WIDTH=636');
+ window.open('./swatch.' + field, '_swatch', 'HEIGHT=115,resizable=yes,scrollbars=no,WIDTH=636');
return false;
}
+function csspreview()
+{
+ if (document.myvar == 'preview')
+ {
+ window.open('', '_preview', 'HEIGHT=400,resizable=yes,scrollbars=yes,WIDTH=500');
+ document.forms['style'].target = '_preview';
+ }
+ else
+ {
+ document.forms['style'].target = '_self';
+ }
+
+ return true;
+}
+
//-->
@@ -877,7 +936,23 @@ function swatch(field)
lang['EDIT_THEME_EXPLAIN']; ?>
-