mirror of
https://github.com/phpbb/phpbb.git
synced 2025-10-20 11:20:42 +02:00
Updates to admin_styles, initial theme edit implementation
git-svn-id: file:///svn/phpbb/trunk@2807 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -8,10 +8,10 @@ if ( !empty($setmodules) )
|
||||
}
|
||||
|
||||
$filename = basename(__FILE__);
|
||||
$module['Styles']['Edit_Styles'] = $filename . "$SID&mode=newstyle";
|
||||
$module['Styles']['Edit_Templates'] = $filename . "$SID&mode=edittemplate";
|
||||
$module['Styles']['Edit_Themes'] = $filename . "$SID&mode=newstyle";
|
||||
$module['Styles']['Edit_Imagesets'] = $filename . "$SID&mode=editimageset";
|
||||
$module['Styles']['Edit_Style'] = $filename . "$SID&mode=newstyle";
|
||||
$module['Styles']['Edit_Template'] = $filename . "$SID&mode=edittemplate";
|
||||
$module['Styles']['Edit_Theme'] = $filename . "$SID&mode=edittheme";
|
||||
$module['Styles']['Edit_Imageset'] = $filename . "$SID&mode=editimageset";
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -50,187 +50,298 @@ closedir($dp);
|
||||
//
|
||||
$mode = ( isset($HTTP_GET_VARS['mode']) ) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode'];
|
||||
|
||||
if ( $mode == 'editimageset' )
|
||||
switch ( $mode )
|
||||
{
|
||||
$imgroot = ( isset($HTTP_POST_VARS['imgroot']) ) ? $HTTP_POST_VARS['imgroot'] : 'subSilver';
|
||||
case 'editimageset':
|
||||
$imgroot = ( isset($HTTP_POST_VARS['imgroot']) ) ? $HTTP_POST_VARS['imgroot'] : 'subSilver';
|
||||
|
||||
if ( isset($HTTP_POST_VARS['img_root']) )
|
||||
{
|
||||
$sql = "SELECT *
|
||||
if ( isset($HTTP_POST_VARS['img_root']) )
|
||||
{
|
||||
$sql = "SELECT *
|
||||
FROM " . STYLES_IMAGE_TABLE . "
|
||||
WHERE imageset_path LIKE '" . $HTTP_POST_VARS['imgroot'] . "'";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$images = $db->sql_fetchrow($result);
|
||||
}
|
||||
if ( isset($HTTP_POST_VARS['img_addconfig']) )
|
||||
{
|
||||
}
|
||||
else if ( isset($HTTP_POST_VARS['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', '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 . "
|
||||
WHERE imageset_path LIKE '" . $HTTP_POST_VARS['imgroot'] . "'";
|
||||
ORDER BY imageset_name";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$images = $db->sql_fetchrow($result);
|
||||
}
|
||||
if ( isset($HTTP_POST_VARS['img_addconfig']) )
|
||||
{
|
||||
}
|
||||
else if ( isset($HTTP_POST_VARS['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', '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 .= '<option name="' . $row['imageset_path'] . '"' . $selected . '>' . $row['imageset_path'] . '</option>';
|
||||
}
|
||||
|
||||
$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) )
|
||||
$imgroot_options = '';
|
||||
while ( $row = $db->sql_fetchrow($result) )
|
||||
{
|
||||
$selected = ( $imgname == $file ) ? ' selected="selected"' : '';
|
||||
$imgname_options .= '<option value="' . $file . '"' . $selected . '>' . $file . '</option>';
|
||||
$selected = ( $imgroot == $row['imageset_path'] ) ? ' selected="selected"' : '';
|
||||
$imgroot_options .= '<option name="' . $row['imageset_path'] . '"' . $selected . '>' . $row['imageset_path'] . '</option>';
|
||||
}
|
||||
}
|
||||
closedir($dp);
|
||||
|
||||
//
|
||||
// Output page
|
||||
//
|
||||
page_header($lang['Styles']);
|
||||
$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 .= '<option value="' . $file . '"' . $selected . '>' . $file . '</option>';
|
||||
}
|
||||
}
|
||||
closedir($dp);
|
||||
|
||||
echo '<form method="post" action="admin_styles.' . $phpEx . '?mode=editimageset">';
|
||||
//
|
||||
// Output page
|
||||
//
|
||||
page_header($lang['Styles']);
|
||||
|
||||
echo '<h2>Edit Imageset</h2>';
|
||||
echo '<form method="post" action="admin_styles.' . $phpEx . '?mode=editimageset">';
|
||||
|
||||
echo '<p>Template set: <select name="imgroot">' . $imgroot_options . '</select> <input class="liteoption" type="submit" name="img_root" value="Select" /></p>';
|
||||
echo '<h2>Edit Imageset</h2>';
|
||||
|
||||
echo '<p>Use this panel to edit or remove imagesets from the database.</p>';
|
||||
echo '<p>Template set: <select name="imgroot">' . $imgroot_options . '</select> <input class="liteoption" type="submit" name="img_root" value="Select" /></p>';
|
||||
|
||||
echo '<table cellspacing="1" cellpadding="2" border="0" align="center" bgcolor="#98AAB1">';
|
||||
echo '<tr>';
|
||||
echo '<td class="cat" colspan="6" height="28" align="center"><span class="gen">Available images: <select name="imageset">' . $imgname_options . '</select></span></td>';
|
||||
echo '</tr>';
|
||||
echo '<tr>';
|
||||
echo '<th height="25">Image</th><th>Source</th><th>Width</th><th>Height</th><th>Border</th><th> </th>';
|
||||
echo '</tr>';
|
||||
|
||||
for($i = 0; $i < count($imageset); $i++)
|
||||
{
|
||||
$class = ( !($i%2) ) ? 'row1' : 'row2';
|
||||
echo '<p>Use this panel to edit or remove imagesets from the database.</p>';
|
||||
|
||||
echo '<table cellspacing="1" cellpadding="2" border="0" align="center" bgcolor="#98AAB1">';
|
||||
echo '<tr>';
|
||||
echo '<td class="' . $class . '" height="25"><span class="gen">' . ucfirst(str_replace('_', ' ', $imageset[$i])) . '</span></td>';
|
||||
echo '<td class="' . $class . '"><input class="text" type="text" name="src[' . $imageset[$i] . ']" value="' . ( ( !empty($images[$imageset[$i]]) ) ? $images[$imageset[$i]] : '' ) . '" size="20" maxsize="30" /></td>';
|
||||
echo '<td class="' . $class . '"><input class="text" type="text" name="width[' . $imageset[$i] . ']" size="3" maxsize="3" /></td>';
|
||||
echo '<td class="' . $class . '"><input class="text" type="text" name="height[' . $imageset[$i] . ']" size="3" maxsize="3" /></td>';
|
||||
echo '<td class="' . $class . '"><input class="text" type="text" name="border[' . $imageset[$i] . ']" size="2" maxsize="2" /></td>';
|
||||
echo '<td class="' . $class . '"><input class="liteoption" type="submit" value="Update" onclick="this.form.' . $imageset[$i] . '.value=this.form.imageset.options[this.form.imageset.selectedIndex].value;return false" /> <input class="liteoption" type="submit" value="Clear" onclick="this.form.' . $imageset[$i] . '.value=\'\';return false" /> </td>';
|
||||
echo '<td class="cat" colspan="6" height="28" align="center"><span class="gen">Available images: <select name="imageset">' . $imgname_options . '</select></span></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
echo '<td class="cat" colspan="6" height="28" align="center"><input class="liteoption" type="submit" name="img_update" value="Update set" /> <input class="liteoption" type="submit" name="img_delete" value="Delete set" /> <input class="liteoption" type="reset" value="Undo" /></td>';
|
||||
echo '</tr>';
|
||||
echo '</table>';
|
||||
echo '</form>';
|
||||
|
||||
}
|
||||
else if ( $mode == 'edittemplate' )
|
||||
{
|
||||
$tplcols = ( isset($HTTP_POST_VARS['tplcols']) ) ? max(60, intval($HTTP_POST_VARS['tplcols'])) : 76;
|
||||
$tplrows = ( isset($HTTP_POST_VARS['tplrows']) ) ? max(4, intval($HTTP_POST_VARS['tplrows'])) : 30;
|
||||
$tplname = ( isset($HTTP_POST_VARS['tplname']) ) ? $HTTP_POST_VARS['tplname'] : '';
|
||||
$tplroot = ( isset($HTTP_POST_VARS['tplroot']) ) ? $HTTP_POST_VARS['tplroot'] : 'subSilver';
|
||||
|
||||
$str = '';
|
||||
if ( isset($HTTP_POST_VARS['tpl_compile']) && !empty($HTTP_POST_VARS['decompile']) )
|
||||
{
|
||||
$str = "<?php\n" . $template->compile(stripslashes($HTTP_POST_VARS['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_admin_log('log_template_edit', $tplname, $tplroot);
|
||||
|
||||
exit;
|
||||
}
|
||||
else if ( !empty($tplname) && isset($HTTP_POST_VARS['tpl_name']) )
|
||||
{
|
||||
$fp = fopen($phpbb_root_path . 'templates/cache/' . $tplroot . '/' . $tplname . '.html.' . $phpEx, 'r');
|
||||
while ( !feof($fp) )
|
||||
echo '<tr>';
|
||||
echo '<th height="25">Image</th><th>Source</th><th>Width</th><th>Height</th><th>Border</th><th> </th>';
|
||||
echo '</tr>';
|
||||
|
||||
for($i = 0; $i < count($imageset); $i++)
|
||||
{
|
||||
$str .= fread($fp, 4096);
|
||||
$class = ( !($i%2) ) ? 'row1' : 'row2';
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td class="' . $class . '" height="25"><span class="gen">' . ucfirst(str_replace('_', ' ', $imageset[$i])) . '</span></td>';
|
||||
echo '<td class="' . $class . '"><input class="text" type="text" name="src[' . $imageset[$i] . ']" value="' . ( ( !empty($images[$imageset[$i]]) ) ? $images[$imageset[$i]] : '' ) . '" size="20" maxsize="30" /></td>';
|
||||
echo '<td class="' . $class . '"><input class="text" type="text" name="width[' . $imageset[$i] . ']" size="3" maxsize="3" /></td>';
|
||||
echo '<td class="' . $class . '"><input class="text" type="text" name="height[' . $imageset[$i] . ']" size="3" maxsize="3" /></td>';
|
||||
echo '<td class="' . $class . '"><input class="text" type="text" name="border[' . $imageset[$i] . ']" size="2" maxsize="2" /></td>';
|
||||
echo '<td class="' . $class . '"><input class="liteoption" type="submit" value="Update" onclick="this.form.' . $imageset[$i] . '.value=this.form.imageset.options[this.form.imageset.selectedIndex].value;return false" /> <input class="liteoption" type="submit" value="Clear" onclick="this.form.' . $imageset[$i] . '.value=\'\';return false" /> </td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
@fclose($fp);
|
||||
|
||||
$template->decompile($str);
|
||||
}
|
||||
else
|
||||
{
|
||||
$str = ( !empty($HTTP_POST_VARS['decompile']) ) ? stripslashes($HTTP_POST_VARS['decompile']) : '';
|
||||
}
|
||||
echo '<td class="cat" colspan="6" height="28" align="center"><input class="liteoption" type="submit" name="img_update" value="Update set" /> <input class="liteoption" type="submit" name="img_delete" value="Delete set" /> <input class="liteoption" type="reset" value="Undo" /></td>';
|
||||
echo '</tr>';
|
||||
echo '</table>';
|
||||
echo '</form>';
|
||||
page_footer();
|
||||
|
||||
if ( isset($HTTP_POST_VARS['tpl_download']) )
|
||||
{
|
||||
header("Content-Type: text/html; name=\"" . $tplname . ".html\"");
|
||||
header("Content-disposition: attachment; filename=" . $tplname . ".html");
|
||||
echo $str;
|
||||
exit;
|
||||
break;
|
||||
|
||||
}
|
||||
case 'edittemplate':
|
||||
|
||||
$tplroot_options = get_templates($tplroot);
|
||||
$tplcols = ( isset($HTTP_POST_VARS['tplcols']) ) ? max(60, intval($HTTP_POST_VARS['tplcols'])) : 90;
|
||||
$tplrows = ( isset($HTTP_POST_VARS['tplrows']) ) ? max(4, intval($HTTP_POST_VARS['tplrows'])) : 30;
|
||||
$tplname = ( isset($HTTP_POST_VARS['tplname']) ) ? $HTTP_POST_VARS['tplname'] : '';
|
||||
$tplroot = ( isset($HTTP_POST_VARS['tplroot']) ) ? $HTTP_POST_VARS['tplroot'] : 'subSilver';
|
||||
|
||||
$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) )
|
||||
$str = '';
|
||||
if ( isset($HTTP_POST_VARS['tpl_compile']) && !empty($HTTP_POST_VARS['decompile']) )
|
||||
{
|
||||
$tpl = substr($file, 0, strpos($file, '.'));
|
||||
$selected = ( $tplname == $tpl ) ? ' selected="selected"' : '';
|
||||
$tplname_options .= '<option name="' . $tpl . '"' . $selected . '>' . $tpl . '</option>';
|
||||
$str = "<?php\n" . $template->compile(stripslashes($HTTP_POST_VARS['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_admin_log('log_template_edit', $tplname, $tplroot);
|
||||
|
||||
exit;
|
||||
}
|
||||
}
|
||||
closedir($dp);
|
||||
else if ( !empty($tplname) && isset($HTTP_POST_VARS['tpl_name']) )
|
||||
{
|
||||
$fp = fopen($phpbb_root_path . 'templates/cache/' . $tplroot . '/' . $tplname . '.html.' . $phpEx, 'r');
|
||||
while ( !feof($fp) )
|
||||
{
|
||||
$str .= fread($fp, 4096);
|
||||
}
|
||||
@fclose($fp);
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
page_header($lang['Styles']);
|
||||
$template->decompile($str);
|
||||
}
|
||||
else
|
||||
{
|
||||
$str = ( !empty($HTTP_POST_VARS['decompile']) ) ? stripslashes($HTTP_POST_VARS['decompile']) : '';
|
||||
}
|
||||
|
||||
echo '<form method="post" action="admin_styles.' . $phpEx . '?mode=edittemplate">';
|
||||
if ( isset($HTTP_POST_VARS['tpl_download']) )
|
||||
{
|
||||
header("Content-Type: text/html; name=\"" . $tplname . ".html\"");
|
||||
header("Content-disposition: attachment; filename=" . $tplname . ".html");
|
||||
echo $str;
|
||||
exit;
|
||||
|
||||
echo '<h2>Edit Template</h2>';
|
||||
}
|
||||
|
||||
echo '<p>Use this panel to edit an existing compiled template set. When you have made the required changes you can recompile the template and (or) download it. Please remember that the existing HTML templates are <b>not</b> altered, only the compiled versions are affected. Therefore you should download any altered files if you wish to keep them for future use and for archival purposes.</p>';
|
||||
$tplroot_options = get_templates($tplroot);
|
||||
|
||||
echo '<p>Template set: <select name="tplroot">' . $tplroot_options . '</select> <input class="liteoption" type="submit" name="tpl_root" value="Select" /></p>';
|
||||
$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 .= '<option name="' . $tpl . '"' . $selected . '>' . $tpl . '</option>';
|
||||
}
|
||||
}
|
||||
closedir($dp);
|
||||
|
||||
echo '<table cellspacing="1" cellpadding="0" border="0" align="center" bgcolor="#98AAB1">';
|
||||
echo '<tr>';
|
||||
echo '<td class="cat"><table width="100%" cellspacing="0" cellpadding="0" border="0">';
|
||||
echo '<tr>';
|
||||
echo '<td> Template: <select name="tplname">' . $tplname_options . '</select> <input class="liteoption" type="submit" name="tpl_name" value="Select" /></td>';
|
||||
echo '<td align="right">Columns: <input type="text" name="tplcols" size="3" maxlength="3" value="' . $tplcols . '" /> Rows: <input type="text" name="tplrows" size="3" maxlength="3" value="' . $tplrows . '" /> <input class="liteoption" type="submit" name="tpl_layout" value="Update" /> </td>';
|
||||
echo '</tr>';
|
||||
echo '</table></td>';
|
||||
echo '</tr>';
|
||||
echo '<tr>';
|
||||
echo '<td colspan="2" align="center"><textarea style="background-color:#DEE3E7;font-size:9pt;font-family:Courier;line-height:125%" cols="' .$tplcols . '" rows="' .$tplrows . '" name="decompile">' . htmlentities($str) . '</textarea></td>';
|
||||
echo '</tr>';
|
||||
echo '<tr>';
|
||||
echo '<td class="cat" colspan="2" height="28" align="center"><input class="liteoption" type="submit" name="tpl_compile" value="Recompile" /> <input class="liteoption" type="submit" name="tpl_download" value="Download" /> <input class="liteoption" type="reset" value="Undo" /></td>';
|
||||
echo '</tr>';
|
||||
echo '</table>';
|
||||
echo '</form>';
|
||||
//
|
||||
//
|
||||
//
|
||||
page_header($lang['Edit_template']);
|
||||
|
||||
page_footer();
|
||||
?>
|
||||
|
||||
<h2><?php echo $lang['Edit_template']; ?></h2>
|
||||
|
||||
<p><?php echo $lang['Edit_template_explain']; ?></p>
|
||||
|
||||
<form method="post" action="<?php echo "admin_styles.$phpEx$SID&mode=edittemplate"; ?>">
|
||||
|
||||
<p><?php echo $lang['Select_template']; ?>: <select name="tplroot"><?php echo $tplroot_options; ?></select> <input class="liteoption" type="submit" name="tpl_root" value="Select" /></p>
|
||||
|
||||
<table class="bg" cellspacing="1" cellpadding="0" border="0" align="center"><!-- bgcolor="#98AAB1" -->
|
||||
<tr>
|
||||
<td class="cat"><table width="100%" cellspacing="0" cellpadding="0" border="0">
|
||||
<tr>
|
||||
<td> Template: <select name="tplname"><?php echo $tplname_options; ?></select> <input class="liteoption" type="submit" name="tpl_name" value="Select" /></td>
|
||||
|
||||
<td align="right">Columns: <input type="text" name="tplcols" size="3" maxlength="3" value="<?php echo $tplcols; ?>" /> Rows: <input type="text" name="tplrows" size="3" maxlength="3" value="<?php echo $tplrows; ?>" /> <input class="liteoption" type="submit" name="tpl_layout" value="Update" /> </td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="center"><textarea class="edit" style="background-color:#DEE3E7" cols="<?php echo $tplcols; ?>" rows="<?php echo $tplrows; ?>" name="decompile"><?php echo htmlentities($str); ?></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cat" colspan="2" height="28" align="center"><input class="liteoption" type="submit" name="tpl_compile" value="Recompile" /> <input class="liteoption" type="submit" name="tpl_download" value="Download" /> <input class="liteoption" type="reset" value="Undo" /></td>
|
||||
</tr>
|
||||
</table></form>
|
||||
|
||||
<?php
|
||||
|
||||
page_footer();
|
||||
break;
|
||||
|
||||
case 'edittheme':
|
||||
|
||||
$theme_id = ( isset($HTTP_POST_VARS['theme_id']) ) ? $HTTP_POST_VARS['theme_id'] : '';
|
||||
|
||||
if ( isset($HTTP_POST_VARS['update']) )
|
||||
{
|
||||
$sql = "SELECT theme_id, theme_name
|
||||
FROM " . STYLES_CSS_TABLE . "
|
||||
WHERE theme_id = $theme_id";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
if ( $row = $db->sql_fetchrow($result) )
|
||||
{
|
||||
$theme_name = $row['theme_name'];
|
||||
|
||||
$css_data = ( !empty($HTTP_POST_VARS['css_data']) ) ? htmlentities($HTTP_POST_VARS['css_data']) : '';
|
||||
$css_external = ( !empty($HTTP_POST_VARS['css_external']) ) ? $HTTP_POST_VARS['css_external'] : '';
|
||||
|
||||
$sql = "UPDATE " . STYLES_CSS_TABLE . "
|
||||
SET css_data = '$css_data', css_external = '$css_external'
|
||||
WHERE theme_id = $theme_id";
|
||||
$db->sql_query($sql);
|
||||
|
||||
add_admin_log('log_theme_edit', $theme_name);
|
||||
|
||||
message_die(MESSAGE, $lang['Success_theme_update']);
|
||||
}
|
||||
}
|
||||
|
||||
page_header($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 != '' ) ? ', ' : '' ) . '<option value="' . $row['theme_id'] . '">' . $row['theme_name'] . '</option>';
|
||||
}
|
||||
while ( $row = $db->sql_fetchrow($result) );
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
?>
|
||||
|
||||
<form method="post" action="<?php echo "admin_styles.$phpEx$SID&mode=$mode"; ?>">
|
||||
|
||||
<h2><?php echo $lang['Edit_theme']; ?></h2>
|
||||
|
||||
<p><?php echo $lang['Edit_theme_explain']; ?></p>
|
||||
|
||||
<table class="bg" width="95%" cellspacing="1" cellpadding="4" border="0" align="center">
|
||||
<tr>
|
||||
<th colspan="2"><?php echo $lang['Edit_theme']; ?></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cat" colspan="2" align="center"><?php echo $lang['Select_theme']; ?>: <select name="theme_id"><?php echo $theme_options; ?></select> <input class="liteoption" type="submit" name="tpl_root" value="<?php echo $lang['Select']; ?>" /></td>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
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'];
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td class="row1"><?php echo $lang['CSS_data']; ?>: <br /><span class="gensmall"><?php echo $lang['CSS_data_explain']; ?></td>
|
||||
<td class="row2"><textarea class="edit" cols="65" rows="15" name="css_data"><?php echo htmlentities($css_data); ?></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1"><?php echo $lang['CSS_sheet']; ?>: </td>
|
||||
<td class="row2"><input type="text" name="css_external" maxlength="60" size="60" value="<?php echo $css_external; ?>" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cat" colspan="2" align="center"><input class="liteoption" type="submit" name="update" value="<?php echo $lang['Update']; ?>" /> <input class="liteoption" type="reset" value="<?php echo $lang['Reset']; ?>" /></td>
|
||||
</tr>
|
||||
</table></form>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</form>
|
||||
<?php
|
||||
|
||||
page_footer();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user