Skip to content

Commit

Permalink
Option fixes.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.automattic.com/wordpress/trunk@939 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
saxmatt committed Feb 26, 2004
1 parent d31e7bc commit 0174984
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
3 changes: 2 additions & 1 deletion wp-admin/options-general.php
Expand Up @@ -66,6 +66,7 @@ function add_magic_quotes($array) {
<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>
Expand Down Expand Up @@ -106,7 +107,7 @@ function add_magic_quotes($array) {
<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>
Expand Down
7 changes: 4 additions & 3 deletions wp-admin/options-writing.php
Expand Up @@ -65,11 +65,12 @@ function add_magic_quotes($array) {
<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>
Expand Down
17 changes: 11 additions & 6 deletions wp-admin/options.php
Expand Up @@ -44,7 +44,7 @@ function add_magic_quotes($array) {

switch($action) {

case "update":
case 'update':
$standalone = 1;
include_once("./admin-header.php");
$any_changed = 0;
Expand All @@ -53,19 +53,24 @@ function add_magic_quotes($array) {
// 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
Expand Down

0 comments on commit 0174984

Please sign in to comment.