diff --git a/phpBB/adm/admin_styles.php b/phpBB/adm/admin_styles.php
index 3a254cff41..e1bdc1279a 100644
--- a/phpBB/adm/admin_styles.php
+++ b/phpBB/adm/admin_styles.php
@@ -700,7 +700,7 @@ switch ($mode)
}
$stylesheet = fread($fp, filesize($phpbb_root_path . 'styles/themes/' . $css_external));
fclose($fp);
- $stylesheet = str_replace(array("\t", "\n"), " ", $stylesheet);
+// $stylesheet = str_replace(array("\t", "\n"), " ", $stylesheet);
// Pull out list of "custom" tags
@@ -734,16 +734,16 @@ 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']) && !empty($_POST['hidecss']))
+ if (!empty($_POST['rawcss']) && (!empty($_POST['hidecss']) || !empty($_POST['preview']) || !empty($_POST['update'])))
{
$css_element = preg_replace("#;[\r\n]*#s", "\n", stripslashes($_POST['rawcss']));
$css_element = explode("\n", $css_element);
}
- else if (($showcss && !empty($_POST['showcss'])) || !empty($_POST['preview']))
+ else if (($showcss && !empty($_POST['showcss'])) || !empty($_POST['preview']) || !empty($_POST['update']))
{
if (!empty($_POST['cssother']))
{
- $css_element = explode('; ', stripslashes(substr($_POST['cssother'], 0, -2)));
+ $css_element = explode('; ', stripslashes($_POST['cssother']));
}
foreach ($match_elements as $type => $match_ary)
@@ -758,52 +758,199 @@ switch ($mode)
}
}
}
- else if (preg_match('#^.*?' . $class . ' {(.*?)}#m', $stylesheet, $matches))
+ else if (preg_match('#^' . $class . ' {(.*?)}#m', $stylesheet, $matches))
{
$css_element = explode('; ', ltrim(substr($matches[1], 0, -2)));
}
+ // User wants to submit data ...
+ if (!empty($_POST['update']))
+ {
+ $updated_element = implode('; ', $css_element) . ';';
+ if (preg_match('#^' . $class . ' {(.*?)}#m', $stylesheet))
+ {
+ $stylesheet = preg_replace('#^(' . $class . ' {).*?(})#m', '\1 ' . $updated_element . ' \2', $stylesheet);
+ }
+ else
+ {
+ $stylesheet .= '';
+ }
+
+ if (!($fp = fopen($phpbb_root_path . 'styles/themes/' . $css_external, 'wb')))
+ {
+ die("ERROR");
+ }
+ $stylesheet = fwrite($fp, $stylesheet);
+ fclose($fp);
+
+ $error[] = $user->lang['THEME_UPDATED'];
+ }
+
+
+ // I guess really this needs some basic examples, pulled from subSilver
+ // to demonstrate the default classes. Other, custom classes can just use
+ // the div/span and some text? This is gonna get nasty :(
if (!empty($_POST['preview']))
{
-
+ $output = '%s';
+
?>
-
+
+
+
+
-
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?