diff --git a/phpBB/adm/admin_styles.php b/phpBB/adm/admin_styles.php index 48add918fe..bedc705daa 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=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"; + $module['STYLE']['MANAGE_STYLE'] = $filename . "$SID&mode=styles"; + $module['STYLE']['MANAGE_TEMPLATE'] = $filename . "$SID&mode=templates"; + $module['STYLE']['MANAGE_THEME'] = $filename . "$SID&mode=themes"; + $module['STYLE']['MANAGE_IMAGESET'] = $filename . "$SID&mode=imagesets"; return; } @@ -136,12 +136,12 @@ switch ($mode) break; } - adm_page_header($user->lang['EDIT_STYLE']); + adm_page_header($user->lang['MANAGE_STYLE']); ?> -

lang['EDIT_STYLE']; ?>

+

lang['MANAGE_STYLE']; ?>

-

lang['EDIT_STYLE_EXPLAIN']; ?>

+

lang['MANAGE_STYLE_EXPLAIN']; ?>

"> @@ -186,17 +186,69 @@ switch ($mode) break; + + + case 'imagesets': + + + + adm_page_header($user->lang['MANAGE_IMAGESET']); + +?> +

lang['MANAGE_IMAGESET']; ?>

+ +

lang['MANAGE_IMAGESET_EXPLAIN']; ?>

+ +">
+ + + + +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); + + +?> + + + +
Imageset name 
"> ">Deactivate | ">Delete | ">Export | ">Preview 
 
+sql_query($sql); @@ -280,7 +332,7 @@ switch ($mode) array( + 'confirm_body.html', 'faq_body.html', 'index_body.html', 'message_body.html', 'viewonline_body.html', + ), + 'includes' => array( + 'overall_footer.html', 'overall_header.html', 'simple_footer.html', 'simple_header.html', 'searchbox.html', 'jumpbox.html', + ), + 'forum' => array( + 'viewforum_body.html', 'viewforum_subforum.html', + ), + 'topic' => array( + 'viewtopic_attach_body.html', 'viewtopic_body.html', 'viewtopic_print.html', + ), + 'group' => array( + 'gcp_body.html', 'gcp_pending_info.html', 'gcp_user_body.html', + ), + 'user' => array( + 'ucp_agreement.html', 'ucp_footer.html', 'ucp_header.html', 'ucp_main.html', 'ucp_pm_body.html', 'ucp_pm_popup.html', 'ucp_pm_preview.html', 'ucp_pm_read.html', 'ucp_prefs.html', 'ucp_profile.html', 'ucp_register.html', 'ucp_remind.html', + ), + 'profile' => array( + 'memberlist_body.html', 'memberlist_email.html', 'memberlist_im.html', 'memberlist_view.html', + ), + 'mod' => array( + 'mcp_forum.html', 'mcp_foruminfo.html', 'mcp_front.html', 'mcp_header.html', 'mcp_jumpbox.html', 'mcp_move.html', 'mcp_post.html', 'mcp_queue.html', 'mcp_reports.html', 'mcp_topic.html', 'mcp_viewlogs.html', 'report_body.html', + ), + 'search' => array( + 'search_body.html', 'search_results_posts.html', 'search_results_topics.html', + ), + 'posting' => array( + 'posting_attach_body.html', 'posting_body.html', 'posting_poll_body.html', 'posting_preview.html', 'posting_smilies.html', 'posting_topic_review.html', + ), + 'login' => array( + 'login_body.html', 'login_forum.html', + ), + 'custom' => array(), + ); + + $tpldata = ''; + if ($template_id) { - $str = "compile(stripslashes($_POST['decompile'])) . "\n?".">"; + $sql = 'SELECT * + FROM ' . STYLES_TPL_TABLE . " + WHERE template_id = $template_id"; + $result = $db->sql_query($sql); - $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)) + if (!(extract($db->sql_fetchrow($result)))) { - $str .= fread($fp, 4096); + trigger_error($user->lang['NO_TEMPLATE']); } - @fclose($fp); + $db->sql_freeresult($result); - $match_preg = array( - '#\$this\->_tpl_include\(\'(.*?)\'\);#', - '#echo \$this->_tpldata\[\'\.\'\]\[0\]\[\'(.*?)\'\];#', - '#echo \(\(isset\(\$this\->_tpldata\[\'\.\'\]\[0\]\[\'(.*?)\'\]\)\).*?;#', - '#if \(.*?\[\'\.\'\]\[0\]\[\'(.*?)\'\]\) \{ #', - '#\$_(.*?)_count.*?;if \(.*?\)\{#', - ); - $replace_preg = array( - '', - '{$1}', - '{$1}', - '', - '', - ); + $test_ary = array(); + foreach ($tpllist as $category => $tpl_ary) + { + $test_ary = array_merge($test_ary, $tpl_ary); + } - $str = preg_replace($match_preg, $replace_preg, $str); - $str = str_replace('', '', $str); - } - else - { - $str = (!empty($_POST['decompile'])) ? stripslashes($_POST['decompile']) : ''; + $dp = @opendir($phpbb_root_path . 'styles/templates/' . $template_path); + while ($file = readdir($dp)) + { + if (!strstr($file, 'bbcode.') && strstr($file, '.html') && is_file($phpbb_root_path . 'styles/templates/' . $template_path . '/' . $file)) + { + if (!in_array($file, $test_ary)) + { + $tpllist['custom'][] = $file; + } + } + } + closedir($dp); + unset($matches); + unset($test_ary); + + + + if ($tplname) + { + $fp = fopen($phpbb_root_path . 'styles/templates/' . $template_path . '/' . $tplname, 'r');// . '.html' + while (!feof($fp)) + { + $tpldata .= fread($fp, 4096); + } + @fclose($fp); + + /* $match_preg = array( + '#\$this\->_tpl_include\(\'(.*?)\'\);#', + '#echo \$this->_tpldata\[\'\.\'\]\[0\]\[\'(.*?)\'\];#', + '#echo \(\(isset\(\$this\->_tpldata\[\'\.\'\]\[0\]\[\'(.*?)\'\]\)\).*?;#', + '#if \(.*?\[\'\.\'\]\[0\]\[\'(.*?)\'\]\) \{ #', + '#\$_(.*?)_count.*?;if \(.*?\)\{#', + '#\<\?php #', + '# \?\>#', + ); + + $replace_preg = array( + '', + '{$1}', + '{$1}', + '', + '', + '', + '' + ); + + */ + + // $tpldata = preg_replace($match_preg, $replace_preg, $tpldata); + + preg_match_all('##', $tpldata, $included_tpls); + $included_tpls = $included_tpls[1]; + } } - if (isset($_POST['tpl_download'])) +/* if (isset($_POST['tpl_download'])) { header("Content-Type: text/html; name=\"" . $tplname . ".html\""); header("Content-disposition: attachment; filename=" . $tplname . ".html"); @@ -363,14 +479,33 @@ switch ($mode) exit; } +*/ + + + // Generate list of template options + $tpl_options = ''; + ksort($tpllist); + foreach ($tpllist as $category => $tpl_ary) + { + if (sizeof($tpl_ary)) + { + sort($tpl_ary); + $tpl_options .= ''; + + foreach ($tpl_ary as $tpl_file) + { + $selected = ($tpl_file == $tplname) ? ' selected="selected"' : ''; + $tpl_options .= ''; + } + } + } -// $tplroot_options = get_templates($tplroot); $tplname_options = ''; - $dp = @opendir($phpbb_root_path . 'cache/templates/' . $tplroot . '/'); + $dp = @opendir($phpbb_root_path . 'styles/templates/' . $template_path); while ($file = readdir($dp)) { - if (strstr($file, '.html.' . $phpEx) && is_file($phpbb_root_path . 'cache/templates/' . $tplroot . '/' . $file)) + if (strstr($file, '.html') && is_file($phpbb_root_path . 'styles/templates/' . $template_path . '/' . $file)) { $tpl = substr($file, 0, strpos($file, '.')); $selected = ($tplname == $tpl) ? ' selected="selected"' : ''; @@ -379,6 +514,8 @@ switch ($mode) } closedir($dp); + + // adm_page_header($user->lang['Edit_template']); @@ -388,22 +525,26 @@ switch ($mode)

lang['Edit_template_explain']; ?>

-
"> +">
- - - + +
+ + + + - - - - - -
lang['SELECT_TEMPLATE']; ?>:  
- - - + + + + + + + + + +
 Template:   Columns:  Rows:    Columns:  Rows:  
Raw HTML
  
   
 
 
array( - 'body', 'p', 'a', 'h1', 'h2', 'h3', 'tabletitle', 'cattitle', 'topictitle', 'topicauthor', 'topicdetails', 'postdetails', 'postbody', 'posthilit', 'postauthor', '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', @@ -517,13 +655,29 @@ switch ($mode) 'custom' => array(), ); + // We categorise the elements which comprise the css class so that we set + // any appropriate additional data, e.g. sizes require the scale type to be set, + // images require the relevant image be pulled and selected in the dropdown, etc. + $match_elements = array( + 'colors' => array('background-color', 'color',), + 'sizes' => array('font-size', 'line-height',), + 'images' => array('background-image',), + 'repeat' => array('background-repeat',), + 'other' => array('font-weight', 'font-family', 'font-style', 'text-decoration',), + ); - // We want to submit the updates - if (isset($_POST['update'])) - { - } + // Used in an sprintf statement to generate appropriate output for rawcss mode + $map_elements = array( + 'colors' => '%s', + 'sizes' => '%d%s', + 'images' => 'url(\'%s\')', + 'repeat' => '%s', + 'other' => '%s', + ); + + + $s_hidden_fields = ''; - // Do we want to edit an existing theme? if ($theme_id) { @@ -575,71 +729,105 @@ switch ($mode) // Do we have a class set? If so, we need to extract and set the relevant data if (!empty($class)) { - // Here we pull out the appropriate class entry then proceed to pull it apart, - // setting appropriate variables to their respective values. We only match - // certain css elements, the rest are "hidden" and can be accessed by exposing - // the raw css - if (preg_match('#^.*?' . $class . ' {(.*?)}#m', $stylesheet, $matches)) + // We must generate the relevant data ... what we need depends on whether + // we are looking @ the rawcss or the simplified settings and whether we + // have just selected a class. We must also cope with switching between + // simple and rawcss mode + $css_element = array(); + if (!empty($_POST['rawcss'])) { - $css_element = &$matches[1]; - - // We categorise the elements which comprise the css class so that we set - // any appropriate additional data, e.g. sizes require the scale type to be set, - // images require the relevant image be pulled and selected in the dropdown, etc. - $match_elements = array( - 'colors' => array('background-color', 'color',), - 'sizes' => array('font-size', 'line-height',), - 'images' => array('background-image',), - 'repeat' => array('background-repeat',), - 'other' => array('font-weight', 'font-family', 'font-style', 'text-decoration',), - ); + $css_element = preg_replace("#;[\r\n]*#s", "\n", stripslashes($_POST['rawcss'])); + $css_element = explode("\n", $css_element); + } + else if ($showcss) + { + if (!empty($_POST['cssother'])) + { + $css_element = explode('; ', stripslashes(substr($_POST['cssother'], 0, -2))); + } foreach ($match_elements as $type => $match_ary) { foreach ($match_ary as $match) { - $$match = ''; - $var = str_replace('-', '', $match); - - if (preg_match('# ' . $match . ': (.*?);#s', $css_element, $matches)) + $var = str_replace('-', '_', $match); + if (!empty($_POST[$var])) { - switch ($type) - { - 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)) - { - $$var = trim($matches[1]); - } - $$var = str_replace('./', $theme_data['theme_name'] . '/', $$var); - break; - - case 'repeat': - $$var = trim($matches[1]); - break; - - default: - $$var = trim($matches[1]); - } + $css_element[] = str_replace('_', '-', $var) . ': ' . (($type == 'sizes') ? sprintf($map_elements[$type], $_POST[$var], $_POST[$var . '_units']) : sprintf($map_elements[$type], $_POST[$var])); } } } } + else if (preg_match('#^.*?' . $class . ' {(.*?)}#m', $stylesheet, $matches)) + { + $css_element = explode('; ', ltrim($matches[1])); + } + + // Here we pull out the appropriate class entry then proceed to pull it apart, + // setting appropriate variables to their respective values. We only match + // certain css elements, the rest are "hidden" and can be accessed by exposing + // the raw css + if (sizeof($css_element) && !$showcss) + { + foreach ($match_elements as $type => $match_ary) + { + foreach ($match_ary as $match) + { + $var = str_replace('-', '_', $match); + $$var = ''; + + foreach ($css_element as $key => $element) + { + if (preg_match('#^' . $match . ': (.*?)$#', $element, $matches)) + { + switch ($type) + { + 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)) + { + $$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; + } + } + } + } + + // Any remaining elements must be custom data so we save that + // in a hidden field + if (sizeof($css_element)) + { + $s_hidden_fields .= ''; + } + } } // End of class element variable setting - // Generate list of class options $class_options = ''; foreach ($base_classes as $category => $class_ary) @@ -661,7 +849,7 @@ switch ($mode) { $img = substr($img['path'], 1) . (($img['path'] != '') ? '/' : '') . $img['file']; - $selected = (preg_match('#' . preg_quote($img) . '#', $backgroundimage)) ? ' selected="selected"' : ''; + $selected = (preg_match('#' . preg_quote($img) . '$#', $background_image)) ? ' selected="selected"' : ''; $bg_imglist .= ''; } $bg_imglist = '' . $bg_imglist; @@ -678,19 +866,36 @@ switch ($mode) function swatch(field) { - window.open('./swatch.php?form=style&name=' + field, '_swatch', 'HEIGHT=115,resizable=yes,scrollbars=no,WIDTH=636'); + window.open('./swatch.?form=style&name=' + field, '_swatch', 'HEIGHT=115,resizable=yes,scrollbars=no,WIDTH=636'); return false; } //--> -

lang['EDIT_THEME']; ?>

lang['EDIT_THEME_EXPLAIN']; ?>

"> + @@ -702,18 +907,14 @@ function swatch(field) { ?> - - - - - + - + Parameter - - - - - + - + - @@ -764,38 +961,38 @@ function swatch(field) - + - - + - + - + - @@ -806,7 +1003,7 @@ function swatch(field) ?> - +?> -
lang['SELECT_CLASS']; ?>:  
Columns:  Rows:    
Raw CSS
Theme name:lang['SHOW_RAW_CSS_EXPLAIN']; ?>
Value
Theme name:
Background
Color:
This is a hex-triplet of the form RRGGBB
Web-safe Colour Swatch
 
 
Image:
Repeat background: '------', 'none' => 'No', 'repeat-x' => 'Horizontally Only', 'repeat-y' => 'Vertically Only', 'both' => 'Both Directions') as $cssvalue => $cssrepeat) { - echo ''; + echo ''; } ?>
Font:
You can specify multiple fonts seperated by commas
Size:
Bold: /> lang['YES']; ?>   /> lang['NO']; ?> /> lang['YES']; ?>   /> lang['NO']; ?>
Italic: /> lang['YES']; ?>   /> lang['NO']; ?> /> lang['YES']; ?>   /> lang['NO']; ?>
Underline: /> lang['YES']; ?>   /> lang['NO']; ?> /> lang['YES']; ?>   /> lang['NO']; ?>
Line spacing:
            
- + + + -

Custom Class

+

Custom Class

-

You can add additional classes to this theme if you wish. You must provide the actual CSS class name below, it must be the same as that you have or will use in your template. Please remember that class names may contain only alphanumeric characters, periods (.), colons (:) and number/hash/pound (#). The new class will be added to the Custom Class category in the select box above.

+

You can add additional classes to this theme if you wish. You must provide the actual CSS class name below, it must be the same as that you have or will use in your template. Please remember that class names may contain only alphanumeric characters, periods (.), colons (:) and number/hash/pound (#). The new class will be added to the Custom Class category in the select box above.

- +
+ +
- + @@ -860,7 +1060,7 @@ function swatch(field) // Output list of themes - adm_page_header($user->lang['EDIT_THEME']); + adm_page_header($user->lang['THEMES']); ?>

lang['THEMES']; ?>

@@ -887,7 +1087,7 @@ function swatch(field) ?> - + 'Icons', 'WORD_CENSOR' => 'Word Censors', - 'STYLE_CAT' => 'Styles', - 'EDIT_STYLE' => 'Styles', - 'EDIT_TEMPLATE' => 'Templates', - 'EDIT_THEME' => 'Themes', - 'EDIT_IMAGESET' => 'Imagesets', + 'STYLE_CAT' => 'Styles', + 'MANAGE_STYLE' => 'Styles', + 'MANAGE_TEMPLATE' => 'Templates', + 'MANAGE_THEME' => 'Themes', + 'MANAGE_IMAGESET' => 'Imagesets', 'USER_CAT' => 'Users', 'BAN_EMAILS' => 'Ban Emails', @@ -893,14 +893,20 @@ $lang = array_merge($lang, array( 'Disallowed_already' => 'The name you entered could not be disallowed. It either already exists in the list, exists in the word censor list, or a matching username is present', + + 'MANAGE_STYLE_EXPLAIN' => 'Here you can manage the available styles on your board. A style consists off a template, theme and imageset.', + + + 'SELECT_TEMPLATE' => 'Select template', + 'THEMES' => 'Themes', 'THEMES_EXPLAIN' => 'From here you can add, edit, delete and export themes. A theme is the combination of colours and images that are applied to your templates to define the basic look of your forum. To manage templates, imagesets or styles please see the navigation menu.', - 'EDIT_THEME' => 'Edit Theme', 'EDIT_THEME_EXPLAIN' => 'Here you can edit the selected theme, changing colours, images, etc. You can switch between a simplified interface where you can set basic colours, etc. and a more advanced "raw CSS" mode. Using the raw mode you can style additional CSS elements such as borders, etc. You only need set the parameters you need, e.g. if you do not want a background image leave that parameter unset. You may also add additional "custom" classes should your template or style make use of them.', 'SELECT_CLASS' => 'Select class', 'SHOW_RAW_CSS' => 'Show CSS', 'HIDE_RAW_CSS' => 'Hide CSS', + 'SHOW_RAW_CSS_EXPLAIN' => 'Enter each element on a new line, ending with a ; Expand the data for each element, e.g. do not use font: use font-family:, font-weight:, etc.', 'style_cat_text' => 'Text Classes', 'style_body' => 'Body', @@ -914,13 +920,14 @@ $lang = array_merge($lang, array( 'style_topicauthor' => 'Topic Author', 'style_topicdetails' => 'Topic Details', 'style_postbody' => 'Post Text', - 'style_posthilit' => 'Post Highlight Text', + 'style_posthilit' => 'Post Highlight', 'style_postauthor' => 'Post Author', 'style_postdetails' => 'Post Details', - 'style_a' => 'General Anchor', - 'style_genmed' => 'General Text', - 'style_gensmall' => 'Small Text', - 'style_copyright' => 'Copyright Text', + 'style_mainmenu' => 'Main Menu', + 'style_nav' => 'Navigation', + 'style_genmed' => 'General Medium', + 'style_gensmall' => 'General Small', + 'style_copyright' => 'Copyright', 'style_cat_tables' => 'Tabular Classes', 'style_table' => 'Table', @@ -942,7 +949,7 @@ $lang = array_merge($lang, array( 'style_post' => 'Text Input', 'style_btnmain' => 'Primary Buttons', 'style_btnlite' => 'Secondary Buttons', - 'style_button' => 'BBCode Buttons', + 'style_btnbbcode' => 'BBCode Buttons', 'style_cat_bbcode' => 'BBCode Classes', 'style_b' => 'Bold', @@ -960,6 +967,8 @@ $lang = array_merge($lang, array( 'style_syntaxkeyword' => 'Syntax Keyword', 'style_syntaxstring' => 'Syntax String', + 'style_cat_custom' => 'Custom Classes', + 'STYLE_ANCHOR_LINK' => 'Link', 'STYLE_ANCHOR_ACTIVE' => 'Active', 'STYLE_ANCHOR_VISITED' => 'Visited',
Add Custom Class
CSS class name:CSS class name:
"> ">Recache | ">Delete | ">Export | ">Preview  ">Regenerate | ">Delete | ">Export | ">Preview