From c9ba30abcdd333b2fb5d2a6221ba4967494c5ecf Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Sun, 13 Jul 2003 14:44:43 +0000 Subject: More faffing git-svn-id: file:///svn/phpbb/trunk@4230 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/admin_styles.php | 226 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 193 insertions(+), 33 deletions(-) (limited to 'phpBB/adm/admin_styles.php') 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))); } - if (!empty($_POST['preview'])) + // 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?
+ + + + + + + + + + + + +

h1

h2

h3

mainmenu
 
-
+ + + +
titles +
-
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?
+ + + + +
-
+ + + + + + + + + + + + + + + + + + + + + + + + +
th
cattitle / catcatdiv
topictitle / row1topicauthor / row2topicdetails / row1
row3
spacer
postdetails / row2postbody / row1 posthilit
-
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?
+

-
+ + + + + + + + + +
gengenmedgensmall
copyright phpBB
+ +

-
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?
+
+ + + + + + + + + + + + + + +
+ +

+ + + + + + + + + + + + + + +
postbody / bold italic underline
+ + + +
A_N_Other wrote:
quote
+ + + + + + +
Code:
10 Print "hello"
20 Goto 10
+ + + + + + +
PHP:
// syntaxcomment
?>
<HTML>
<?php
echo $this = "HELLO";
+ +

- lang['SELECT_CLASS']; ?>:   + lang['SELECT_CLASS']; ?>:   @@ -988,6 +1128,14 @@ function csspreview() +'; + } + +?> @@ -1003,6 +1151,14 @@ function csspreview() +'; + } + +?> @@ -1078,18 +1234,18 @@ function csspreview() ?> - - +
Raw CSS
' . implode('
', $error) . '
Parameter Value
' . implode('
', $error) . '
Background
            
    
@@ -1161,7 +1317,11 @@ function csspreview() ?> - "> + ', $row['theme_name'], '') : $row['theme_name']; + +?>  ">Regenerate | ">Delete | ">Export | ">Preview