From 8bb5de9861e30160bac90ae8ba78497fe2c207de Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Thu, 13 Mar 2003 12:14:48 +0000 Subject: New directory name git-svn-id: file:///svn/phpbb/trunk@3646 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/admin_styles.php | 361 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 361 insertions(+) create mode 100644 phpBB/adm/admin_styles.php (limited to 'phpBB/adm/admin_styles.php') diff --git a/phpBB/adm/admin_styles.php b/phpBB/adm/admin_styles.php new file mode 100644 index 0000000000..0035c9f7fe --- /dev/null +++ b/phpBB/adm/admin_styles.php @@ -0,0 +1,361 @@ +acl_get('a_styles') ) + { + return; + } + + $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"; + + 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']); +} + +/* +$dp = opendir($phpbb_root_path . 'templates/cache/'); +while ($file = readdir($dp)) +{ + if (!is_file($phpbb_root_path . 'templates/cache/' . $file) && !is_link($phpbb_root_path . 'templates/cache/' . $file) && $file != '.' && $file != '..') + { + $selected = ($tplroot == $file) ? ' selected="selected"' : ''; + $tplroot_options .= ''; + } +} +closedir($dp); +*/ + +// +$mode = (isset($_GET['mode'])) ? $_GET['mode'] : $_POST['mode']; + +switch ($mode) +{ + case 'editimageset': + $imgroot = (isset($_POST['imgroot'])) ? $_POST['imgroot'] : $config['default_style']; + + if (isset($_POST['img_addconfig'])) + { + } + else if (isset($_POST['img_addlocal'])) + { + } + + $imageset = array('imageset_path', 'post_new', 'post_locked', 'post_pm', 'reply_new', 'reply_pm', 'reply_locked', 'icon_profile', 'icon_pm', 'icon_delete', 'icon_ip', 'icon_quote', 'icon_search', 'icon_edit', 'icon_email', 'icon_www', 'icon_icq', 'icon_aim', 'icon_yim', 'icon_msnm', 'icon_no_email', 'icon_no_www', 'icon_no_icq', 'icon_no_aim', 'icon_no_yim', 'icon_no_msnm', 'goto_post', 'goto_post_new', 'goto_post_latest', 'goto_post_newest', 'forum', 'forum_new', 'forum_locked', 'sub_forum', 'sub_forum_new', 'folder', 'folder_new', 'folder_hot', 'folder_hot_new', 'folder_locked', 'folder_locked_new', 'folder_sticky', 'folder_sticky_new', 'folder_announce', 'folder_announce_new', 'topic_watch', 'topic_unwatch', 'poll_left', 'poll_center', 'poll_right', 'rating'); + + $sql = "SELECT imageset_name, imageset_path + FROM " . STYLES_IMAGE_TABLE . " + ORDER BY imageset_name"; + $result = $db->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 + 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 
 
+ +compile(stripslashes($_POST['decompile'])) . "\n?".">"; + + $fp = fopen($phpbb_root_path . 'templates/cache/' . $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 . 'templates/cache/' . $tplroot . '/' . $tplname . '.html.' . $phpEx, 'r'); + while (!feof($fp)) + { + $str .= fread($fp, 4096); + } + @fclose($fp); + + $template->decompile($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 . 'templates/cache/' . $tplroot . '/'); + while ($file = readdir($dp)) + { + if (strstr($file, '.html.' . $phpEx) && is_file($phpbb_root_path . 'templates/cache/' . $tplroot . '/' . $file)) + { + $tpl = substr($file, 0, strpos($file, '.')); + $selected = ($tplname == $tpl) ? ' selected="selected"' : ''; + $tplname_options .= ''; + } + } + closedir($dp); + + // + page_header($user->lang['Edit_template']); + +?> + +

lang['Edit_template']; ?>

+ +

lang['Edit_template_explain']; ?>

+ +
"> + +

lang['Select_template']; ?>:  

+ + + + + + + + + + + +
+ + + + + +
 Template:   Columns:  Rows:    
   
+ +sql_query($sql); + + 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'] : ''; + + $sql = "UPDATE " > STYLES_CSS_TABLE . " + SET css_data = '$css_data', css_external = '$css_external' + WHERE theme_id = $theme_id"; + $db->sql_query($sql); + + add_log('admin', 'log_theme_edit', $theme_name); + + message_die(MESSAGE, $user->lang['Success_theme_update']); + } + } + + 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']; + } + } + +?> + +
"> + +

lang['Edit_theme']; ?>

+ +

lang['Edit_theme_explain']; ?>

+ + + + + + + + + + + + + + + + +
lang['Select_theme']; ?>:  
lang['CSS_data']; ?>:
lang['CSS_data_explain']; ?>
lang['CSS_sheet']; ?>:
  
+ +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