From 0a383968336bed506d1c62a187b9c309b91f26e5 Mon Sep 17 00:00:00 2001 From: saxmatt Date: Fri, 13 Feb 2004 09:59:47 +0000 Subject: [PATCH] Abstraction of a admin functions, new custom options page for general options, improved style. git-svn-id: http://svn.automattic.com/wordpress/trunk@869 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/admin-functions.php | 8 +++ wp-admin/edit-form-advanced.php | 9 --- wp-admin/edit-form.php | 8 --- wp-admin/menu.txt | 2 +- wp-admin/options-general.php | 122 ++++++++++++++++++++++++++++++++ wp-admin/options.php | 18 ++--- wp-admin/upgrade-functions.php | 4 +- wp-admin/wp-admin.css | 8 +++ 8 files changed, 152 insertions(+), 27 deletions(-) create mode 100644 wp-admin/options-general.php diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index 8f0b6d511..a2f8f9748 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -1,5 +1,13 @@ $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; $iAsk for a promotion to your blog admin :)"); +} +?> + +
+
+

General Options

+
+ + + + + + + + + + + + + + + + + + + + + + +
Weblog title:
Tagline: +
+In a few words, explain what this weblog is about.
Web address (URI):
E-mail address: +
+This address is used only for admin purposes.
Membership: +
+
+
+ Time + + + + + + + + + +
The servers current time is:
Times in the weblog should differ by: + hours
+
+

+ +

+
+
+ diff --git a/wp-admin/options.php b/wp-admin/options.php index 83639ec76..fd30c70c7 100644 --- a/wp-admin/options.php +++ b/wp-admin/options.php @@ -53,18 +53,19 @@ case "update": // pull the vars from the post // validate ranges etc. // update the values - $options = $wpdb->get_results("SELECT $tableoptions.option_id, option_name, option_type, option_value, option_admin_level " - . "FROM $tableoptions " - . "LEFT JOIN $tableoptiongroup_options ON $tableoptions.option_id = $tableoptiongroup_options.option_id " - . "WHERE group_id = $option_group_id " - . "ORDER BY seq"); + foreach ($_POST as $key => $value) { + $option_names[] = "'$key'"; + } + $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)"); 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 = $HTTP_POST_VARS[$this_name]; + $new_val = $_POST[$this_name]; if ($new_val != $old_val) { // get type and validate @@ -97,8 +98,8 @@ case "update": } $message .= $dB_errors . '
' . $validation_message; } - - //break; //fall through + header('Location: ' . $_SERVER['HTTP_REFERER']); + break; default: $standalone = 0; @@ -135,6 +136,7 @@ if ($non_was_selected) { // no group pre-selected, display opening page ?>