acl_get('a_styles')) { return; } $filename = basename(__FILE__); $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; } define('IN_PHPBB', 1); // Include files $phpbb_root_path = '../'; require($phpbb_root_path . 'extension.inc'); require('pagestart.' . $phpEx); // Do we have styles admin permissions? if (!$auth->acl_get('a_styles')) { trigger_error($user->lang['NO_ADMIN']); } // Get and set some vars $mode = (isset($_REQUEST['mode'])) ? htmlspecialchars($_REQUEST['mode']) : ''; if (isset($_REQUEST['action'])) { $action = htmlspecialchars($_REQUEST['action']); } else { if (isset($_POST['add'])) { $action = 'add'; } else if (isset($_POST['preview'])) { $action = 'preview'; } else { $action = ''; } } $error = array(); // What shall we do today then? switch ($mode) { case 'styles': $style_id = (isset($_REQUEST['id'])) ? intval($_REQUEST['id']) : ''; switch ($action) { case 'activate': case 'deactivate': // TODO ... reset user_styles if their style is deactivated $sql = 'UPDATE ' . STYLES_TABLE . ' SET style_active = ' . (($action == 'activate') ? 1 : 0) . ' WHERE style_id = ' . $style_id; $db->sql_query($sql); break; case 'delete': break; case 'export': break; case 'add': case 'edit': if (isset($_POST['update'])) { $style_name = (isset($_POST['style_name'])) ? stripslashes(htmlspecialchars($_POST['style_name'])) : ''; $style_copyright = (isset($_POST['style_copyright'])) ? stripslashes(htmlspecialchars($_POST['style_copyright'])) : ''; $style_active = (!empty($_POST['style_active'])) ? 1 : 0; $template_id = (!empty($_POST['template_id'])) ? intval($_POST['template_id']) : 0; $theme_id = (!empty($_POST['theme_id'])) ? intval($_POST['theme_id']) : 0; $imageset_id = (!empty($_POST['imageset_id'])) ? intval($_POST['imageset_id']) : 0; if (empty($style_name)) { $error[] = $user->lang['STYLE_ERR_STYLE_NAME']; } if (strlen($style_name) > 30) { $error[] = $user->lang['STYLE_ERR_NAME_LONG']; } if (strlen($style_copyright) > 60) { $error[] = $user->lang['STYLE_ERR_COPY_LONG']; } if (!$template_id || !$theme_id || !$imageset_id) { $error[] = $user->lang['STYLE_ERR_NO_IDS']; } if ($action == 'add') { $sql = 'SELECT style_name FROM ' . STYLES_TABLE . " WHERE style_name = '" . $db->sql_escape($style_name) . "'"; $result = $db->sql_query($sql); if ($row = $db->sql_fetchrow($result)) { $error[] = $user->lang['STYLE_ERR_NAME_EXIST']; } $db->sql_freeresult($result); } if (!sizeof($error)) { $sql_ary = array( 'style_name' => $style_name, 'style_copyright' => $style_copyright, 'template_id' => $template_id, 'theme_id' => $theme_id, 'imageset_id' => $imageset_id, ); $sql = ($action == 'add') ? 'INSERT INTO ' . STYLES_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary) : 'UPDATE ' . STYLES_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " WHERE style_id = $style_id"; $db->sql_query($sql); $log = ($action == 'add') ? 'LOG_ADD_STYLE' : 'LOG_EDIT_STYLE'; add_log('admin', $log, addslashes($style_name)); $message = ($action == 'add') ? 'STYLED_ADDED' : 'STYLE_EDITED'; trigger_error($user->lang[$message]); } } if (!sizeof($error)) { if ($style_id) { $sql = 'SELECT * FROM ' . STYLES_TABLE . " WHERE style_id = $style_id"; $result = $db->sql_query($sql); if (!extract($db->sql_fetchrow($result))) { die("ERROR"); } $db->sql_freeresult($result); } else { $style_name = (isset($_POST['style_name'])) ? stripslashes(htmlspecialchars($_POST['style_name'])) : ''; $style_copyright = ''; $style_active = 1; $template_id = $theme_id = $imageset_id = 0; } } $style_options = array(); $field_ary = array(STYLES_CSS_TABLE => 'theme', STYLES_TPL_TABLE => 'template', STYLES_IMAGE_TABLE => 'imageset'); foreach ($field_ary as $table => $field) { $sql = "SELECT {$field}_id, {$field}_name FROM $table ORDER BY {$field}_id"; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { $selected = ($row[$field . '_id'] == ${$field . '_id'}) ? ' selected="selected"' : ''; ${$field . '_options'} .= ''; } $db->sql_freeresult($result); } // Output the page adm_page_header($user->lang['EDIT_STYLE']); ?>

lang['EDIT_STYLE']; ?>

lang['EDIT_STYLE_EXPLAIN']; ?>

">
Edit Style
', $error); ?>
Style Name
Style Copyright ' . $style_copyright . '' : ''; ?>
Template set:
Theme set:
Imageset:
Status: /> Inactive   /> Active
  
lang['MANAGE_STYLE']); ?>

lang['MANAGE_STYLE']; ?>

lang['MANAGE_STYLE_EXPLAIN']; ?>

">sql_query($sql); while ($row = $db->sql_fetchrow($result)) { $style_count[$row['user_style']] = $row['style_count']; } $db->sql_freeresult($result); $sql = 'SELECT style_id, style_name, style_active FROM ' . STYLES_TABLE; $result = $db->sql_query($sql); if ($row = $db->sql_fetchrow($result)) { do { $row_class = ($row_class != 'row1') ? 'row1' : 'row2'; $stylevis = (!$row['style_active']) ? 'activate' : 'deactivate'; ?> sql_fetchrow($result)); } else { } $db->sql_freeresult($result); ?>
Style name Used by  
">  ">lang['STYLE_' . strtoupper($stylevis)]; ?>   ">Delete   ">Export   Preview 
Create new style:
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  
">  ">Delete   ">Export 
 
sql_query($sql); $imgroot_options = ''; while ($row = $db->sql_fetchrow($result)) { $selected = ($imgroot == $row['imageset_path']) ? ' selected="selected"' : ''; $imgroot_options .= ''; } $imgname_options = ''; $dp = opendir($phpbb_root_path . 'imagesets/' . $imgroot . '/'); while ($file = readdir($dp)) { if (preg_match('#\.(gif|png|jpg|jpeg)$#', $file) && is_file($phpbb_root_path . 'imagesets/' . $imgroot . '/' . $file)) { $selected = ($imgname == $file) ? ' selected="selected"' : ''; $imgname_options .= ''; } } closedir($dp); // Output page adm_page_header($user->lang['Edit_Imageset']); ?>

Edit Imageset

Template set:    

Here you can create, edit, delete and download imagesets.

sql_query($sql); $images = $db->sql_fetchrow($result); ?> ' : ''; $img = str_replace('"imagesets/', '"../imagesets/', $img); $img = str_replace('{LANG}', $user->img_lang, $img); $img = str_replace('{RATE}', 3, $img); ?>
ImageGraphic 
 
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) { $sql = 'SELECT * FROM ' . STYLES_TPL_TABLE . " WHERE template_id = $template_id"; $result = $db->sql_query($sql); if (!(extract($db->sql_fetchrow($result)))) { trigger_error($user->lang['NO_TEMPLATE']); } $db->sql_freeresult($result); $test_ary = array(); foreach ($tpllist as $category => $tpl_ary) { $test_ary = array_merge($test_ary, $tpl_ary); } $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); preg_match_all('##', $tpldata, $included_tpls); $included_tpls = $included_tpls[1]; } } /* if (isset($_POST['tpl_download'])) { header("Content-Type: text/html; name=\"" . $tplname . ".html\""); header("Content-disposition: attachment; filename=" . $tplname . ".html"); echo $str; 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 .= ''; } } } $tplname_options = ''; $dp = @opendir($phpbb_root_path . 'styles/templates/' . $template_path); while ($file = readdir($dp)) { 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"' : ''; $tplname_options .= ''; } } closedir($dp); // adm_page_header($user->lang['EDIT_TEMPLATE']); ?>

lang['EDIT_TEMPLATE']; ?>

lang['EDIT_TEMPLATE_EXPLAIN']; ?>

">
lang['SELECT_TEMPLATE']; ?>:  
Columns:  Rows:  
Raw HTML
  
lang['MANAGE_TEMPLATE']); ?>

lang['MANAGE_TEMPLATE']; ?>

lang['MANAGE_TEMPLATE_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); ?>
Template name  
">  ">BBCode   ">Delete   ">Export   ">Preview 
 
array( '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', ), 'forms' => array( 'form', 'input', 'select', '.textarea', '.post', '.btnlite', '.btnmain', '.btnbbcode', ), 'bbcode' => array( '.b', '.u', '.i', '.color', '.size', '.code', '.quote', 'flash', '.syntaxbg', '.syntaxcomment', '.syntaxdefault', '.syntaxhtml', '.syntaxkeyword', '.syntaxstring', ), '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',), ); // 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) { $sql = 'SELECT * FROM ' . STYLES_CSS_TABLE . " WHERE theme_id = $theme_id"; $result = $db->sql_query($sql); if (!(extract($db->sql_fetchrow($result)))) { trigger_error($user->lang['NO_THEME']); } $db->sql_freeresult($result); // Grab template data if (!($fp = fopen("{$phpbb_root_path}styles/themes/$theme_path/$theme_name.css", 'rb'))) { die("ERROR"); } $stylesheet = fread($fp, filesize("{$phpbb_root_path}styles/themes/$theme_path/$theme_name.css")); fclose($fp); // Pull out list of "custom" tags if (preg_match_all('#([a-z\.:]+?) {.*?}#si', $stylesheet, $matches)) { $test_ary = array(); foreach ($base_classes as $category => $class_ary) { $test_ary = array_merge($test_ary, $class_ary); } $matches = preg_replace('#^\.#', '', $matches[1]); foreach ($matches as $value) { if (!in_array($value, $test_ary)) { $base_classes['custom'][] = $value; } } unset($matches); unset($test_ary); } } // Do we have a class set? If so, we need to extract and set the relevant data if (!empty($class)) { // 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']) && (!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']) || !empty($_POST['update'])) { if (!empty($_POST['cssother'])) { $css_element = explode('; ', stripslashes($_POST['cssother'])); } foreach ($match_elements as $type => $match_ary) { foreach ($match_ary as $match) { $var = str_replace('-', '_', $match); if (!empty($_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(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']; add_log('admin', 'LOG_EDIT_THEME', $theme_name); } // 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'; ?>

h1

h2

h3

mainmenu
 
titles
th
cattitle / cat catdiv
topictitle / row1 topicauthor / row2 topicdetails / row1
row3
spacer
postdetails / row2 postbody / row1 posthilit


gen genmed gensmall
copyright phpBB




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

$match_ary) { foreach ($match_ary as $match) { $var = str_replace('-', '_', $match); $$var = ''; if (sizeof($css_element)) { foreach ($css_element as $key => $element) { if (preg_match('#^' . preg_quote($match, '#') . ': (.*?)$#', $element, $matches)) { switch ($type) { 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; 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) { $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 . 'styles/themes'); $bg_imglist = ''; foreach ($imglist as $img) { $img = substr($img['path'], 1) . (($img['path'] != '') ? '/' : '') . $img['file']; $selected = (preg_match('#' . preg_quote($img) . '$#', $background_image)) ? ' selected="selected"' : ''; $bg_imglist .= ''; } $bg_imglist = '' . $bg_imglist; unset($imglist); // Output the page adm_page_header($user->lang['EDIT_THEME']); ?>

lang['EDIT_THEME']; ?>

lang['EDIT_THEME_EXPLAIN']; ?>

Note

lang['SHOW_RAW_CSS_EXPLAIN']; ?>

" onsubmit="return csspreview()">
lang['SELECT_CLASS']; ?>:  
'; } ?> '; } ?>
Raw CSS
' . implode('
', $error) . '
Parameter Value
' . implode('
', $error) . '
Background
Color:
This is a hex-triplet of the form RRGGBB
Web-safe Colour Swatch
 
Image:
Repeat background:
Foreground
Color:
This is a hex-triplet of the form RRGGBB
Web-safe Colour Swatch
 
Font:
You can specify multiple fonts seperated by commas
Size:
Bold: /> lang['YES']; ?>   /> lang['NO']; ?>   /> lang['UNSET']; ?>
Italic: /> lang['YES']; ?>   /> lang['NO']; ?>   /> lang['UNSET']; ?>
Underline: /> lang['YES']; ?>   /> lang['NO']; ?>   /> lang['UNSET']; ?>
Line spacing:
      

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.

Add Custom Class
CSS class name:
  
lang['THEMES']); ?>

lang['THEMES']; ?>

lang['THEMES_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); ?>
Theme name  
', $row['theme_name'], '') : $row['theme_name']; echo sprintf('%s%s%s', "', $row['theme_name'], ''); ?>  ">Delete   ">Export   ">Preview 
Create new theme:
cache_root); while ($dir = readdir($dp)) { $template_dir = $phpbb_root_path . $this->cache_root . $dir; if (!is_file($template_dir) && !is_link($template_dir) && $dir != '.' && $dir != '..') { array_push($template_list, $dir); } } closedir($dp); } else { array_push($template_list, $template); } foreach ($template_list as $template) { $dp = opendir($phpbb_root_path . $this->cache_root . $template); while ($file = readdir($dp)) { unlink($phpbb_root_path . $this->cache_root . $file); } closedir($dp); } return; } function compile_cache_show($template) { global $phpbb_root_path; $template_cache = array(); $template_dir = $phpbb_root_path . $this->cache_root . $template; $dp = opendir($template_dir); while ($file = readdir($dp)) { if (preg_match('#\.html$#i', $file) && is_file($template_dir . '/' . $file)) { array_push($template_cache, $file); } } closedir($dp); return; } } // // FUNCTIONS // --------- ?>