From 99910d51cb6534b660a4f065b0882bc1773a86ba Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Thu, 5 Jun 2003 20:27:43 +0000 Subject: A little more thinking out loud ... regular users are welcome to give feedback via area51 git-svn-id: file:///svn/phpbb/trunk@4088 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/admin_styles.php | 563 ++++++++++++++++++++++++++++----------------- 1 file changed, 353 insertions(+), 210 deletions(-) (limited to 'phpBB/adm') diff --git a/phpBB/adm/admin_styles.php b/phpBB/adm/admin_styles.php index 7fbf6a9e0d..953052f207 100644 --- a/phpBB/adm/admin_styles.php +++ b/phpBB/adm/admin_styles.php @@ -8,10 +8,10 @@ if ( !empty($setmodules) ) } $filename = basename(__FILE__); - $module['STYLE']['EDIT_STYLE'] = $filename . "$SID&mode=newstyle"; - $module['STYLE']['EDIT_TEMPLATE'] = $filename . "$SID&mode=edittemplate"; - $module['STYLE']['EDIT_THEME'] = $filename . "$SID&mode=edittheme"; - $module['STYLE']['EDIT_IMAGESET'] = $filename . "$SID&mode=editimageset"; + $module['STYLE']['EDIT_STYLE'] = $filename . "$SID&mode=styles"; + $module['STYLE']['EDIT_TEMPLATE'] = $filename . "$SID&mode=templates"; + $module['STYLE']['EDIT_THEME'] = $filename . "$SID&mode=themes"; + $module['STYLE']['EDIT_IMAGESET'] = $filename . "$SID&mode=imagesets"; return; } @@ -30,6 +30,7 @@ if (!$auth->acl_get('a_styles')) // $mode = (isset($_REQUEST['mode'])) ? htmlspecialchars($_REQUEST['mode']) : ''; +$action = (isset($_REQUEST['action'])) ? htmlspecialchars($_REQUEST['action']) : ''; @@ -135,88 +136,102 @@ switch ($mode) break; - case 'edittemplate': - $tplcols = (isset($_POST['tplcols'])) ? max(60, intval($_POST['tplcols'])) : 90; - $tplrows = (isset($_POST['tplrows'])) ? max(4, intval($_POST['tplrows'])) : 30; - $tplname = (isset($_POST['tplname'])) ? $_POST['tplname'] : ''; - $tplroot = (isset($_POST['tplroot'])) ? $_POST['tplroot'] : 'subSilver'; - $str = ''; - if (isset($_POST['tpl_compile']) && !empty($_POST['decompile'])) - { - $str = "compile(stripslashes($_POST['decompile'])) . "\n?".">"; - - $fp = fopen($phpbb_root_path . 'cache/templates/' . $tplroot . '/' . $tplname . '.html.' . $phpEx, 'w+'); - fwrite ($fp, $str); - fclose($fp); - @chmod($phpbb_root_path . 'templates/cache/' . $tplroot . '/' . $tplname . '.html.' . $phpEx, 0644); - add_log('admin', 'log_template_edit', $tplname, $tplroot); + case 'templates': - exit; - } - else if (!empty($tplname) && isset($_POST['tpl_name'])) - { - $fp = fopen($phpbb_root_path . 'cache/templates/' . $tplroot . '/' . $tplname . '.html.' . $phpEx, 'r'); - while (!feof($fp)) - { - $str .= fread($fp, 4096); - } - @fclose($fp); - - $match_preg = array( - '#\$this\->_tpl_include\(\'(.*?)\'\);#', - '#echo \$this->_tpldata\[\'\.\'\]\[0\]\[\'(.*?)\'\];#', - '#echo \(\(isset\(\$this\->_tpldata\[\'\.\'\]\[0\]\[\'(.*?)\'\]\)\).*?;#', - '#if \(.*?\[\'\.\'\]\[0\]\[\'(.*?)\'\]\) \{ #', - '#\$_(.*?)_count.*?;if \(.*?\)\{#', - ); - - $replace_preg = array( - '', - '{$1}', - '{$1}', - '', - '', - ); - - $str = preg_replace($match_preg, $replace_preg, $str); - $str = str_replace('', '', $str); - } - else - { - $str = (!empty($_POST['decompile'])) ? stripslashes($_POST['decompile']) : ''; - } + $template_id = (isset($_REQUEST['id'])) ? $_REQUEST['id'] : ''; - if (isset($_POST['tpl_download'])) + switch ($action) { - header("Content-Type: text/html; name=\"" . $tplname . ".html\""); - header("Content-disposition: attachment; filename=" . $tplname . ".html"); - echo $str; - exit; - - } - - $tplroot_options = get_templates($tplroot); - - $tplname_options = ''; - $dp = @opendir($phpbb_root_path . 'cache/templates/' . $tplroot . '/'); - while ($file = readdir($dp)) - { - if (strstr($file, '.html.' . $phpEx) && is_file($phpbb_root_path . 'cache/templates/' . $tplroot . '/' . $file)) - { - $tpl = substr($file, 0, strpos($file, '.')); - $selected = ($tplname == $tpl) ? ' selected="selected"' : ''; - $tplname_options .= ''; - } - } - closedir($dp); - - // - adm_page_header($user->lang['Edit_template']); + case 'preview': + + break; + + case 'edit': + + $tplcols = (isset($_POST['tplcols'])) ? max(60, intval($_POST['tplcols'])) : 76; + $tplrows = (isset($_POST['tplrows'])) ? max(4, intval($_POST['tplrows'])) : 30; + $tplname = (isset($_POST['tplname'])) ? $_POST['tplname'] : ''; + $tplroot = (isset($_POST['tplroot'])) ? $_POST['tplroot'] : 'subSilver'; + + $str = ''; + if (isset($_POST['tpl_compile']) && !empty($_POST['decompile'])) + { + $str = "compile(stripslashes($_POST['decompile'])) . "\n?".">"; + + $fp = fopen($phpbb_root_path . 'cache/templates/' . $tplroot . '/' . $tplname . '.html.' . $phpEx, 'w+'); + fwrite ($fp, $str); + fclose($fp); + + @chmod($phpbb_root_path . 'templates/cache/' . $tplroot . '/' . $tplname . '.html.' . $phpEx, 0644); + + add_log('admin', 'log_template_edit', $tplname, $tplroot); + + exit; + } + else if (!empty($tplname) && isset($_POST['tpl_name'])) + { + $fp = fopen($phpbb_root_path . 'cache/templates/' . $tplroot . '/' . $tplname . '.html.' . $phpEx, 'r'); + while (!feof($fp)) + { + $str .= fread($fp, 4096); + } + @fclose($fp); + + $match_preg = array( + '#\$this\->_tpl_include\(\'(.*?)\'\);#', + '#echo \$this->_tpldata\[\'\.\'\]\[0\]\[\'(.*?)\'\];#', + '#echo \(\(isset\(\$this\->_tpldata\[\'\.\'\]\[0\]\[\'(.*?)\'\]\)\).*?;#', + '#if \(.*?\[\'\.\'\]\[0\]\[\'(.*?)\'\]\) \{ #', + '#\$_(.*?)_count.*?;if \(.*?\)\{#', + ); + + $replace_preg = array( + '', + '{$1}', + '{$1}', + '', + '', + ); + + $str = preg_replace($match_preg, $replace_preg, $str); + $str = str_replace('', '', $str); + } + else + { + $str = (!empty($_POST['decompile'])) ? stripslashes($_POST['decompile']) : ''; + } + + if (isset($_POST['tpl_download'])) + { + header("Content-Type: text/html; name=\"" . $tplname . ".html\""); + header("Content-disposition: attachment; filename=" . $tplname . ".html"); + echo $str; + exit; + + } + +// $tplroot_options = get_templates($tplroot); + + $tplname_options = ''; + $dp = @opendir($phpbb_root_path . 'cache/templates/' . $tplroot . '/'); + while ($file = readdir($dp)) + { + if (strstr($file, '.html.' . $phpEx) && is_file($phpbb_root_path . 'cache/templates/' . $tplroot . '/' . $file)) + { + $tpl = substr($file, 0, strpos($file, '.')); + $selected = ($tplname == $tpl) ? ' selected="selected"' : ''; + $tplname_options .= ''; + } + } + closedir($dp); + + // + adm_page_header($user->lang['Edit_template']); ?> @@ -224,11 +239,7 @@ switch ($mode)

lang['Edit_template_explain']; ?>

-
"> - -

lang['Select_template']; ?>:  

- - +">
@@ -248,129 +259,201 @@ switch ($mode) lang['EDIT_TEMPLATE']); +?> +

lang['Edit_template']; ?>

+

lang['Edit_template_explain']; ?>

+">
+ + + + +sql_query($sql); - case 'edittheme': + if ($row = $db->sql_fetchrow($result)) + { + do + { + $row_class = ($row_class != 'row1') ? 'row1' : 'row2'; - $theme_id = (isset($_POST['themeroot'])) ? $_POST['themeroot'] : ''; +?> + + + + +sql_fetchrow($result)); + } + else { - $sql = "SELECT theme_id, theme_name - FROM " . STYLES_CSS_TABLE . " - WHERE theme_id = $theme_id"; - $result = $db->sql_query($sql); + } + $db->sql_freeresult($result); - if ($row = $db->sql_fetchrow($result)) - { - $theme_name = $row['theme_name']; - $css_data = (!empty($_POST['css_data'])) ? htmlentities($_POST['css_data']) : ''; - $css_external = (!empty($_POST['css_data'])) ? $_POST['css_data'] : ''; +?> + + + +
Template name 
"> ">BBCode | ">Delete | ">Export | ">Preview 
 
- $sql = "UPDATE " > STYLES_CSS_TABLE . " - SET css_data = '$css_data', css_external = '$css_external' - WHERE theme_id = $theme_id"; - $db->sql_query($sql); +lang['Success_theme_update']); - } - } + break; - adm_page_header($user->lang['Edit_theme']); - $sql = "SELECT theme_id, theme_name - FROM " . STYLES_CSS_TABLE; - $result = $db->sql_query($sql); - $theme_options = ''; - if ($row = $db->sql_fetchrow($result)) - { - do - { - $theme_options .= (($theme_options != '') ? ', ' : '') . ''; - } - while ($row = $db->sql_fetchrow($result)); - } - $db->sql_freeresult($result); - $css_data = ''; - $css_external = ''; - if ($theme_id) - { - $sql = "SELECT css_data, css_external - FROM " . STYLES_CSS_TABLE . " - WHERE theme_id = $theme_id"; - $result = $db->sql_query($sql); - if ($row = $db->sql_fetchrow($result)) - { - $css_data = preg_replace('/\t{1,}/i', ' ', $row['css_data']); - $css_external = $row['css_external']; - } - } - $user->lang = array_merge($user->lang, array( - 'SELECT_CLASS' => 'Select class', - 'style_body' => 'Body', - 'style_p' => 'Paragraphs', - 'style_th' => 'Table Header Cell', - 'style_td' => 'Table Data Cell', - 'style_postdetails' => 'Post Information', - 'style_postbody' => 'Post text', - 'style_gen' => 'General Text', - 'style_genmed' => 'Medium Text', - 'style_gensmall' => 'Small Text', - 'style_copyright' => 'Copyright Text', - - )); - - $base_classes = array( - 'body', - 'p', - 'th', - 'td', - 'postdetails', - 'postbody', - 'gen', - 'gensmall', - 'copyright' - ); - - $class_options = ''; - foreach ($base_classes as $class) - { - $class_options .= ''; - } - $imglist = filelist($phpbb_root_path . 'templates'); - $bg_imglist = ''; - foreach ($imglist as $img) - { - $img = substr($img['path'], 1) . (($img['path'] != '') ? '/' : '') . $img['file']; + case 'themes': -// $selected = ' selected="selected"'; - $bg_imglist .= ''; - } - $bg_imglist = '' . $bg_imglist; + $theme_id = (isset($_REQUEST['id'])) ? $_REQUEST['id'] : ''; + switch ($action) + { + case 'preview': + + break; + + case 'edit': + + if (isset($_POST['update'])) + { + } + + + $class = (isset($_POST['classname'])) ? htmlspecialchars($_POST['classname']) : ''; + + if ($theme_id) + { + $sql = 'SELECT * + FROM ' . STYLES_CSS_TABLE . " + WHERE theme_id = $theme_id"; + $result = $db->sql_query($sql); + + if ($theme_data = $db->sql_fetchrow($result)) + { + } + $db->sql_freeresult($result); + } + + $user->lang = array_merge($user->lang, array( + 'SELECT_CLASS' => 'Select class', + + 'style_cat_general' => 'General classes', + 'style_cat_bbcode' => 'BBCode classes', + 'style_body' => 'Body', + 'style_p' => 'Paragraphs', + 'style_th' => 'Table Header Cell', + 'style_td' => 'Table Data Cell', + 'style_postdetails' => 'Post Information', + 'style_postbody' => 'Post text', + 'style_gen' => 'General Text', + 'style_genmed' => 'Medium Text', + 'style_gensmall' => 'Small Text', + 'style_copyright' => 'Copyright Text', + + 'style_b' => 'Bold', + 'style_u' => 'Underline', + 'style_i' => 'Italics', + 'style_color' => 'Colour', + 'style_size' => 'Size', + 'style_code' => 'Code', + 'style_quote' => 'Quote', + 'style_flash' => 'Flash', + 'style_syntaxbg' => 'Syntax Background', + 'style_syntaxcomment' => 'Syntax Comments', + 'style_syntaxdefault' => 'Syntax Default', + 'style_syntaxhtml' => 'Syntax HTML', + 'style_syntaxkeyword' => 'Syntax Keyword', + 'style_syntaxstring' => 'Syntax String', + + )); + + $base_classes = array( + 'general' => array( + 'body', + 'p', + 'th', + 'td', + 'postdetails', + 'postbody', + 'gen', + 'gensmall', + 'copyright' + ), + 'bbcode' => array( + 'b', + 'u', + 'i', + 'color', + 'size', + 'code', + 'quote', + 'flash', + 'syntaxbg', + 'syntaxcomment', + 'syntaxdefault', + 'syntaxhtml', + 'syntaxkeyword', + 'syntaxstring', + ) + ); + + $class_options = ''; + foreach ($base_classes as $category => $class_ary) + { + $class_options .= ''; + foreach ($class_ary as $class_name) + { + $selected = ($class_name == $class) ? ' selected="selected"' : ''; + $class_options .= ''; + } + } + + // Grab list of potential images for class backgrounds + $imglist = filelist($phpbb_root_path . 'templates'); + + $bg_imglist = ''; + foreach ($imglist as $img) + { + $img = substr($img['path'], 1) . (($img['path'] != '') ? '/' : '') . $img['file']; + + // $selected = ' selected="selected"'; + $bg_imglist .= ''; + } + $bg_imglist = '' . $bg_imglist; + + + // Output the page + adm_page_header($user->lang['EDIT_THEME']); ?> @@ -386,13 +469,16 @@ function swatch(field) //--> +

lang['Edit_theme']; ?>

lang['Edit_theme_explain']; ?>

-
"> +

Selected Theme:

+ +">
- + @@ -453,39 +560,75 @@ function swatch(field) lang['EDIT_THEME']); + +?> +

lang['Edit_theme']; ?>

+ +

lang['Edit_theme_explain']; ?>

+

Selected Theme: subSilver

+">
lang['SELECT_CLASS']; ?>:   lang['SELECT_CLASS']; ?>:  
@@ -401,51 +487,72 @@ function swatch(field) - + + + + + + + + - + - - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + - +
Value
Background image:Background
Color:
This is a hex-triplet of the form RRGGBB
[ Web-safe Colour Swatch ]
Image:
Repeat background:Repeat background:
Background color: [ Web-safe Colour Swatch ]Text
Foreground color:Color:
This is a hex-triplet of the form RRGGBB
[ Web-safe Colour Swatch ]
Font:Font:
You can specify multiple fonts seperated by commas
Font size:Size:
Font Bold:Bold: lang['YES']; ?>   lang['NO']; ?>
Font Italic:Italic: lang['YES']; ?>   lang['NO']; ?>
Font Underline:Underline: lang['YES']; ?>   lang['NO']; ?>
Line spacing:Line spacing:
Borders
Color:
This is a hex-triplet of the form RRGGBB
[ Web-safe Colour Swatch ]
Width:
Style:
      
+ + + + +sql_query($sql); + if ($row = $db->sql_fetchrow($result)) + { + do + { + $row_class = ($row_class != 'row1') ? 'row1' : 'row2'; +?> + + + + +sql_fetchrow($result)); + } + else + { + } + $db->sql_freeresult($result); +?> + + + +
Theme name 
"> ">Recreate | ">Delete | ">Export | ">Preview 
 
+ +sql_query($sql); - $tplroot_options = ''; - while ($row = $db->sql_fetchrow($result)) - { - $selected = ($tplroot == $row['template_path']) ? ' selected="selected"' : ''; - $tplroot_options .= ''; - } - return $tplroot_options; } ?> \ No newline at end of file -- cgit v1.2.1