Option fixes.

git-svn-id: https://develop.svn.wordpress.org/trunk@939 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Matt Mullenweg 2004-02-26 14:37:15 +00:00
parent d7a322fe18
commit 84b26cfde9
3 changed files with 17 additions and 10 deletions

View File

@ -66,6 +66,7 @@ if ($user_level <= 3) {
<h2>General 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="'blogname','blogdescription','siteurl','admin_email','users_can_register','new_users_can_blog','time_difference'" />
<table width="100%" cellspacing="2" cellpadding="5" class="editform">
<tr valign="top">
<th width="33%" scope="row">Weblog title: </th>
@ -106,7 +107,7 @@ This address is used only for admin purposes. </td>
<td><code><?php echo gmdate('Y-m-d g:i:s a'); ?></code></td>
</tr>
<tr>
<th scope="row"> Times in the weblog should differ by: </th>
<th scope="row">Times in the weblog should differ by: </th>
<td><input name="time_difference" type="text" id="time_difference" size="2" value="<?php echo get_settings('time_difference'); ?>" />
hours </td>
</tr>

View File

@ -65,11 +65,12 @@ if ($user_level <= 3) {
<div class="wrap">
<h2>Writing 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="'default_post_edit_rows','blog_charset','use_smilies','use_balanceTags'" />
<table width="100%" cellspacing="2" cellpadding="5" class="editform">
<tr valign="top">
<th width="33%" scope="row"> Size of the writing box, in lines:</th>
<td><input name="default_post_edit_rows" type="text" id="default_post_edit_rows" value="<?php echo get_settings('default_post_edit_rows'); ?>" size="3" /></td>
<th width="33%" scope="row"> Size of the writing box:</th>
<td><input name="default_post_edit_rows" type="text" id="default_post_edit_rows" value="<?php echo get_settings('default_post_edit_rows'); ?>" size="2" style="width: 1.5em; " />
lines </td>
</tr>
<tr valign="top">
<th scope="row">Character Setting: </th>

View File

@ -44,7 +44,7 @@ if ($option_group_id == '') {
switch($action) {
case "update":
case 'update':
$standalone = 1;
include_once("./admin-header.php");
$any_changed = 0;
@ -53,19 +53,24 @@ case "update":
// pull the vars from the post
// validate ranges etc.
// update the values
foreach ($_POST as $key => $value) {
$option_names[] = "'$key'";
if (!$_POST['page_options']) {
foreach ($_POST as $key => $value) {
$option_names[] = "'$key'";
}
$option_names = implode(',', $option_names);
} else {
$option_names = stripslashes($_POST['page_options']);
}
$option_names = implode(',', $option_names);
$options = $wpdb->get_results("SELECT $tableoptions.option_id, option_name, option_type, option_value, option_admin_level FROM $tableoptions WHERE option_name IN ($option_names)");
// die(var_dump($options));
if ($options) {
foreach ($options as $option) {
// should we even bother checking?
if ($user_level >= $option->option_admin_level) {
$this_name = $option->option_name;
$old_val = stripslashes($option->option_value);
$new_val = $_POST[$this_name];
$new_val = $_POST[$option->option_name];
if (!$new_val) $new_val = 0;
if ($new_val != $old_val) {
// get type and validate