2 require_once('admin.php');
4 $title = __('Options');
5 $this_file = 'options.php';
6 $parent_file = 'options-general.php';
8 $wpvarstoreset = array('action');
9 for ($i=0; $i<count($wpvarstoreset); $i += 1) {
10 $wpvar = $wpvarstoreset[$i];
11 if (!isset($$wpvar)) {
12 if (empty($_POST["$wpvar"])) {
13 if (empty($_GET["$wpvar"])) {
16 $$wpvar = $_GET["$wpvar"];
19 $$wpvar = $_POST["$wpvar"];
24 if ( !current_user_can('manage_options') )
25 die ( __('Cheatin’ uh?') );
32 check_admin_referer('update-options');
34 if (!$_POST['page_options']) {
35 foreach ($_POST as $key => $value) {
39 $options = explode(',', stripslashes($_POST['page_options']));
43 $old_siteurl = get_settings('siteurl');
44 $old_home = get_settings('home');
47 // Options that if not there have 0 value but need to be something like "closed"
48 $nonbools = array('default_ping_status', 'default_comment_status');
50 foreach ($options as $option) {
51 $option = trim($option);
52 $value = trim(stripslashes($_POST[$option]));
53 if( in_array($option, $nonbools) && ( $value == '0' || $value == '') )
56 if( $option == 'blogdescription' || $option == 'blogname' )
57 if (current_user_can('unfiltered_html') == false)
58 $value = wp_filter_post_kses( $value );
60 if (update_option($option, $value) ) {
67 // If siteurl or home changed, reset cookies.
68 if ( get_settings('siteurl') != $old_siteurl || get_settings('home') != $old_home ) {
69 // If home changed, write rewrite rules to new location.
70 $wp_rewrite->flush_rules();
71 // Clear cookies for old paths.
73 // Set cookies for new paths.
74 wp_setcookie($user_login, $user_pass_md5, true, get_settings('home'), get_settings('siteurl'));
77 //$message = sprintf(__('%d setting(s) saved... '), $any_changed);
80 $referred = remove_query_arg('updated' , wp_get_referer());
81 $goback = add_query_arg('updated', 'true', wp_get_referer());
82 $goback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $goback);
87 include('admin-header.php'); ?>
90 <h2><?php _e('All options'); ?></h2>
91 <form name="form" action="options.php" method="post">
92 <?php wp_nonce_field('update-options') ?>
93 <input type="hidden" name="action" value="update" />
96 $options = $wpdb->get_results("SELECT * FROM $wpdb->options ORDER BY option_name");
98 foreach ($options as $option) :
99 $value = wp_specialchars($option->option_value);
102 <th scope='row'><label for='$option->option_name'>$option->option_name</label></th>
103 <td><input type='text' name='$option->option_name' id='$option->option_name' size='30' value='" . $value . "' /></td>
104 <td>$option->option_description</td>
109 <p class="submit"><input type="submit" name="Update" value="<?php _e('Update Settings »') ?>" /></p>
118 include('admin-footer.php');