More options work. Bug fixes for advanced_edit not being boolean type, clean up of options code and update feedback (still needs work there), first bit of miscellaneous screen.

git-svn-id: http://svn.automattic.com/wordpress/trunk@1058 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
saxmatt 2004-04-11 08:15:10 +00:00
parent fd44ffdc7a
commit 5a49a4d411
11 changed files with 143 additions and 164 deletions

View File

@ -3,7 +3,7 @@
3 categories.php Categories
5 link-manager.php Links
3 users.php Users
4 options-general.php Options
6 options-general.php Options
8 plugins.php Plugins
4 templates.php Templates
5 upload.php Upload

View File

@ -34,36 +34,11 @@ for ($i=0; $i<count($wpvarstoreset); $i += 1) {
}
}
require_once('optionhandler.php');
$standalone = 0;
include_once('admin-header.php');
if ($user_level <= 3) {
die("You have do not have sufficient permissions to edit the options for this blog.");
}
include('options-head.php');
?>
<ul id="adminmenu2">
<li><a href="options-general.php">General</a></li>
<li><a href="options-writing.php">Writing</a></li>
<li><a href="options-reading.php">Reading</a></li>
<li><a class="current">Discussion</a></li>
<?php
//we need to iterate through the available option groups.
$option_groups = $wpdb->get_results("SELECT group_id, group_name, group_desc, group_longdesc FROM $tableoptiongroups ORDER BY group_id");
foreach ($option_groups as $option_group) {
if ($option_group->group_id == $option_group_id) {
$current_desc=$option_group->group_desc;
$current_long_desc = $option_group->group_longdesc;
echo(" <li><a id=\"current2\" href=\"options.php?option_group_id={$option_group->group_id}\" title=\"{$option_group->group_desc}\">{$option_group->group_name}</a></li>\n");
} else {
echo(" <li><a href=\"options.php?option_group_id={$option_group->group_id}\" title=\"{$option_group->group_desc}\">{$option_group->group_name}</a></li>\n");
}
} // end for each group
?>
<li class="last"><a href="options-permalink.php">Permalinks</a></li>
</ul>
<br clear="all" />
<div class="wrap">
<h2>Discussion Options</h2>
<form name="form1" method="post" action="options.php">

View File

@ -34,36 +34,12 @@ for ($i=0; $i<count($wpvarstoreset); $i += 1) {
}
}
require_once('optionhandler.php');
$standalone = 0;
include_once('admin-header.php');
if ($user_level <= 3) {
die("You have do not have sufficient permissions to edit the options for this blog.");
}
include('options-head.php');
?>
<ul id="adminmenu2">
<li><a class="current">General</a></li>
<li><a href="options-writing.php">Writing</a></li>
<li><a href="options-reading.php">Reading</a></li>
<li><a href="options-discussion.php">Discussion</a></li>
<?php
//we need to iterate through the available option groups.
$option_groups = $wpdb->get_results("SELECT group_id, group_name, group_desc, group_longdesc FROM $tableoptiongroups ORDER BY group_id");
foreach ($option_groups as $option_group) {
if ($option_group->group_id == $option_group_id) {
$current_desc=$option_group->group_desc;
$current_long_desc = $option_group->group_longdesc;
echo(" <li><a id=\"current2\" href=\"options.php?option_group_id={$option_group->group_id}\" title=\"{$option_group->group_desc}\">{$option_group->group_name}</a></li>\n");
} else {
echo(" <li><a href=\"options.php?option_group_id={$option_group->group_id}\" title=\"{$option_group->group_desc}\">{$option_group->group_name}</a></li>\n");
}
} // end for each group
?>
<li class="last"><a href="options-permalink.php">Permalinks</a></li>
</ul>
<br clear="all" />
<div class="wrap">
<h2>General Options</h2>
<form name="form1" method="post" action="options.php">

49
wp-admin/options-head.php Normal file
View File

@ -0,0 +1,49 @@
<?php
if ($user_level <= 6) {
die("You have do not have sufficient permissions to edit the options for this blog.");
}
//we need to iterate through the available option groups.
$option_groups = $wpdb->get_results("SELECT group_id, group_name, group_desc, group_longdesc FROM $tableoptiongroups ORDER BY group_id");
foreach ($option_groups as $option_group) {
if ($option_group->group_id == $option_group_id) {
$current_desc = $option_group->group_desc;
$current_long_desc = $option_group->group_longdesc;
$groups .= "<li><a class='current' title='{$option_group->group_desc}'>{$option_group->group_name}</a></li>\n";
} else {
$groups .= "<li><a href='options.php?option_group_id={$option_group->group_id}' title='{$option_group->group_desc}'>{$option_group->group_name}</a></li>\n";
}
}
$submenu = <<<END
<ul id="adminmenu2">
<li><a href="options-general.php">General</a></li>
<li><a href="options-writing.php">Writing</a></li>
<li><a href="options-reading.php">Reading</a></li>
<li><a href="options-discussion.php">Discussion</a></li>
<li><a href="options-misc.php">Miscellaneous</a></li>
$groups
<li class="last"><a href="options-permalink.php">Permalinks</a></li>
</ul>
END;
$sublines = split("\n", $submenu);
foreach ($sublines as $subline) {
preg_match('/href="([^"]+)"/', $subline, $url);
if (substr($_SERVER['REQUEST_URI'], -8) == substr($url[1], -8)) {
$subline = str_replace('a hr', 'a class="current" hr', $subline);
if ($_SERVER["REQUEST_URI"] == $url[1]) {
$subline = preg_replace('|href=".*?"|', '', $subline);
}
}
echo $subline."\n";
}
?>
<br clear="all" />
<?php if ($updated) : ?>
<div class="updated"><p><strong>Options saved.</strong></p></div>
<?php endif; ?>

58
wp-admin/options-misc.php Normal file
View File

@ -0,0 +1,58 @@
<?php
$title = 'Miscellaneous Options';
function add_magic_quotes($array) {
foreach ($array as $k => $v) {
if (is_array($v)) {
$array[$k] = add_magic_quotes($v);
} else {
$array[$k] = addslashes($v);
}
}
return $array;
}
if (!get_magic_quotes_gpc()) {
$HTTP_GET_VARS = add_magic_quotes($HTTP_GET_VARS);
$HTTP_POST_VARS = add_magic_quotes($HTTP_POST_VARS);
$HTTP_COOKIE_VARS = add_magic_quotes($HTTP_COOKIE_VARS);
}
$wpvarstoreset = array('action','standalone', 'option_group_id');
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
$wpvar = $wpvarstoreset[$i];
if (!isset($$wpvar)) {
if (empty($HTTP_POST_VARS["$wpvar"])) {
if (empty($HTTP_GET_VARS["$wpvar"])) {
$$wpvar = '';
} else {
$$wpvar = $HTTP_GET_VARS["$wpvar"];
}
} else {
$$wpvar = $HTTP_POST_VARS["$wpvar"];
}
}
}
$standalone = 0;
include_once('admin-header.php');
include('options-head.php');
?>
<div class="wrap">
<h2>Miscellaneous Options</h2>
<form name="form1" method="post" action="options.php">
<input type="hidden" name="action" value="update" />
<input type="hidden" name="action" value="update" /> <input type="hidden" name="page_options" value="'hack_file' " />
<p>
<label>
<input type="checkbox" name="hack_file" value="1" <?php checked('1', get_settings('hack_file')); ?> />
Use legacy <code>my-hacks.php</code> file support</label>
</p>
<p style="text-align: right;">
<input type="submit" name="Submit" value="Update Options" />
</p>
</form>
</div>
<?php include("admin-footer.php") ?>

View File

@ -50,31 +50,11 @@ switch($action) {
default:
$standalone = 0;
include_once('admin-header.php');
if ($user_level <= 3) {
if ($user_level <= 6) {
die("You have do not have sufficient permissions to edit the options for this blog.");
}
include('options-head.php');
?>
<ul id="adminmenu2">
<li><a href="options-general.php">General</a></li>
<li><a href="options-writing.php">Writing</a></li>
<li><a href="options-reading.php">Reading</a></li>
<li><a href="options-discussion.php">Discussion</a></li>
<?php
//we need to iterate through the available option groups.
$option_groups = $wpdb->get_results("SELECT group_id, group_name, group_desc, group_longdesc FROM $tableoptiongroups ORDER BY group_id");
foreach ($option_groups as $option_group) {
if ($option_group->group_id == $option_group_id) {
$current_desc=$option_group->group_desc;
$current_long_desc = $option_group->group_longdesc;
echo(" <li><a id=\"current2\" href=\"$this_file?option_group_id={$option_group->group_id}\" title=\"{$option_group->group_desc}\">{$option_group->group_name}</a></li>\n");
} else {
echo(" <li><a href=\"$this_file?option_group_id={$option_group->group_id}\" title=\"{$option_group->group_desc}\">{$option_group->group_name}</a></li>\n");
}
} // end for each group
?>
<li class="last"><a class="current">Permalinks</a></li>
</ul>
<br clear="all" />
<div class="wrap">
<h2>Edit Permalink Structure</h2>
<p>WordPress offers you the ability to create a custom URI structure for your permalinks and archives. The following &#8220;tags&#8221; are available:</p>
@ -130,4 +110,5 @@ echo "</div>\n";
break;
}
include("admin-footer.php") ?>
include("admin-footer.php")
?>

View File

@ -1,5 +1,5 @@
<?php
$title = 'Discussion Options';
$title = 'Reading Options';
function add_magic_quotes($array) {
foreach ($array as $k => $v) {
@ -34,36 +34,11 @@ for ($i=0; $i<count($wpvarstoreset); $i += 1) {
}
}
require_once('optionhandler.php');
$standalone = 0;
include_once('admin-header.php');
if ($user_level <= 3) {
die("You have do not have sufficient permissions to edit the options for this blog.");
}
include('options-head.php');
?>
<ul id="adminmenu2">
<li><a href="options-general.php">General</a></li>
<li><a href="options-writing.php">Writing</a></li>
<li><a class="current">Reading</a></li>
<li><a href="options-discussion.php">Discussion</a></li>
<?php
//we need to iterate through the available option groups.
$option_groups = $wpdb->get_results("SELECT group_id, group_name, group_desc, group_longdesc FROM $tableoptiongroups ORDER BY group_id");
foreach ($option_groups as $option_group) {
if ($option_group->group_id == $option_group_id) {
$current_desc=$option_group->group_desc;
$current_long_desc = $option_group->group_longdesc;
echo(" <li><a id=\"current2\" href=\"options.php?option_group_id={$option_group->group_id}\" title=\"{$option_group->group_desc}\">{$option_group->group_name}</a></li>\n");
} else {
echo(" <li><a href=\"options.php?option_group_id={$option_group->group_id}\" title=\"{$option_group->group_desc}\">{$option_group->group_name}</a></li>\n");
}
} // end for each group
?>
<li class="last"><a href="options-permalink.php">Permalinks</a></li>
</ul>
<br clear="all" />
<div class="wrap">
<h2>Reading Options</h2>
<form name="form1" method="post" action="options.php">

View File

@ -34,36 +34,13 @@ for ($i=0; $i<count($wpvarstoreset); $i += 1) {
}
}
require_once('optionhandler.php');
$standalone = 0;
include_once('admin-header.php');
if ($user_level <= 3) {
die("You have do not have sufficient permissions to edit the options for this blog.");
}
include('options-head.php');
?>
<ul id="adminmenu2">
<li><a href="options-general.php">General</a></li>
<li><a class="current">Writing</a></li>
<li><a href="options-reading.php">Reading</a></li>
<li><a href="options-discussion.php">Discussion</a></li>
<?php
//we need to iterate through the available option groups.
$option_groups = $wpdb->get_results("SELECT group_id, group_name, group_desc, group_longdesc FROM $tableoptiongroups ORDER BY group_id");
foreach ($option_groups as $option_group) {
if ($option_group->group_id == $option_group_id) {
$current_desc=$option_group->group_desc;
$current_long_desc = $option_group->group_longdesc;
echo(" <li><a id=\"current2\" href=\"options.php?option_group_id={$option_group->group_id}\" title=\"{$option_group->group_desc}\">{$option_group->group_name}</a></li>\n");
} else {
echo(" <li><a href=\"options.php?option_group_id={$option_group->group_id}\" title=\"{$option_group->group_desc}\">{$option_group->group_name}</a></li>\n");
}
} // end for each group
?>
<li class="last"><a href="options-permalink.php">Permalinks</a></li>
</ul>
<br clear="all" />
<div class="wrap">
<h2>Writing Options</h2>
<form name="form1" method="post" action="options.php">
@ -72,7 +49,7 @@ if ($user_level <= 3) {
<table width="100%" cellspacing="2" cellpadding="5" class="editform">
<tr valign="top">
<th scope="row"> When starting a post, show: </th>
<td><label>
<td><?php get_settings('advanced_edit') ?><label>
<input name="advanced_edit" type="radio" value="0" <?php checked('0', get_settings('advanced_edit')); ?> />
Simple controls</label>
<br />

View File

@ -107,13 +107,15 @@ $nonbools = array('default_ping_status', 'default_comment_status');
}
$message .= $dB_errors . '<br />' . $validation_message;
}
header('Location: ' . $_SERVER['HTTP_REFERER']);
$goback = str_replace('?updated=true', '', $_SERVER['HTTP_REFERER']) . '?updated=true';
header('Location: ' . $goback);
break;
default:
$standalone = 0;
include_once("./admin-header.php");
if ($user_level <= 3) {
if ($user_level <= 6) {
die("You have do not have sufficient permissions to edit the options for this blog.");
}
?>
@ -142,29 +144,9 @@ if ($non_was_selected) { // no group pre-selected, display opening page
<?php
} else { //there was a group selected.
include('options-head.php');
?>
?>
<ul id="adminmenu2">
<li><a href="options-general.php">General</a></li>
<li><a href="options-writing.php">Writing</a></li>
<li><a href="options-reading.php">Reading</a></li>
<li><a href="options-discussion.php">Discussion</a></li>
<?php
//Iterate through the available option groups.
$option_groups = $wpdb->get_results("SELECT group_id, group_name, group_desc, group_longdesc FROM $tableoptiongroups ORDER BY group_id");
foreach ($option_groups as $option_group) {
if ($option_group->group_id == $option_group_id) {
$current_desc=$option_group->group_desc;
$current_long_desc = $option_group->group_longdesc;
echo(" <li><a class=\"current\" href=\"$this_file?option_group_id={$option_group->group_id}\" title=\"{$option_group->group_desc}\">{$option_group->group_name}</a></li>\n");
} else {
echo(" <li><a href=\"$this_file?option_group_id={$option_group->group_id}\" title=\"{$option_group->group_desc}\">{$option_group->group_name}</a></li>\n");
}
} // end for each group
?>
<li class="last"><a href="options-permalink.php">Permalinks</a></li>
</ul>
<br clear="all" />
<div class="wrap">
<h2><?php echo $current_desc; ?></h2>
<form name="form" action="<?php echo $this_file; ?>" method="post">
@ -194,13 +176,9 @@ if ($non_was_selected) { // no group pre-selected, display opening page
<div class="wrap">
<?php
if ($current_long_desc != '') {
echo($current_long_desc);
} else {
?>
<p> No help for this group of options.</p>
<?php
}
if ($current_long_desc != '') {
echo $current_long_desc;
}
?>
</div>
<?php
@ -208,4 +186,5 @@ if ($non_was_selected) { // no group pre-selected, display opening page
break;
} // end switch
include("admin-footer.php") ?>
include('admin-footer.php');
?>

View File

@ -781,8 +781,10 @@ function upgrade_110() {
// Option for using the advanced edit screen by default
if(!$wpdb->get_var("SELECT option_id FROM $tableoptions WHERE option_name = 'advanced_edit'")) {
$wpdb->query("INSERT INTO $tableoptions (option_name, option_type, option_value, option_admin_level) VALUES ('advanced_edit', 3, '0', 8)");
$wpdb->query("INSERT INTO $tableoptions (option_name, option_type, option_value, option_admin_level) VALUES ('advanced_edit', 5, '0', 8)");
}
// Fix for CVS versions
$wpdb->query("UPDATE $tableoptions SET option_type = '5' WHERE option_name = 'advanced_edit'");
// Now an option for moderation words
if(!$wpdb->get_var("SELECT option_id FROM $tableoptions WHERE option_name = 'moderation_keys'")) {

View File

@ -147,6 +147,13 @@ textarea, input, select {
font: 12px Georgia, "Times New Roman", Times, serif;
}
.updated {
background-color: #f0f8ff;
border: 1px solid #69c;
margin: 5px 5% 10px;
padding: 0 1em 0 1em;
}
.unapproved {
color: #888;
}