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();
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 // Get currently logged in user and password.
72 get_currentuserinfo();
73 // Clear cookies for old paths.
75 // Set cookies for new paths.
76 wp_setcookie($user_login, $user_pass_md5, true, get_settings('home'), get_settings('siteurl'));
79 //$message = sprintf(__('%d setting(s) saved... '), $any_changed);
82 $referred = remove_query_arg('updated' , $_SERVER['HTTP_REFERER']);
83 $goback = add_query_arg('updated', 'true', $_SERVER['HTTP_REFERER']);
84 $goback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $goback);
89 include('admin-header.php'); ?>
92 <h2><?php _e('All options'); ?></h2>
93 <form name="form" action="options.php" method="post">
94 <input type="hidden" name="action" value="update" />
97 $options = $wpdb->get_results("SELECT * FROM $wpdb->options ORDER BY option_name");
99 foreach ($options as $option) :
100 $value = wp_specialchars($option->option_value);
103 <th scope='row'><label for='$option->option_name'>$option->option_name</label></th>
104 <td><input type='text' name='$option->option_name' id='$option->option_name' size='30' value='" . $value . "' /></td>
105 <td>$option->option_description</td>
110 <p class="submit"><input type="submit" name="Update" value="<?php _e('Update Settings »') ?>" /></p>
119 include('admin-footer.php');