Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 121 lines (100 sloc) 3.246 kb
ebd50d4 First pass at new options/settings system.
mikelittle authored
1 <?php
04786f2 Split admin-header.php into admin.php and admin-header.php. Split me…
rboren authored
2 require_once('admin.php');
25bdc07 Mark some strings for translation and improve string consistency. Fr…
rboren authored
3
4 $title = __('Options');
43e4a8a The great renaming.
saxmatt authored
5 $this_file = 'options.php';
5cc3f8d Massive admin tweak commit. Improved consistency, numerous bug fixes,…
saxmatt authored
6 $parent_file = 'options-general.php';
ebd50d4 First pass at new options/settings system.
mikelittle authored
7
04786f2 Split admin-header.php into admin.php and admin-header.php. Split me…
rboren authored
8 $wpvarstoreset = array('action');
99a7358 Renaming Reloaded.
saxmatt authored
9 for ($i=0; $i<count($wpvarstoreset); $i += 1) {
10 $wpvar = $wpvarstoreset[$i];
11 if (!isset($$wpvar)) {
10c6b7e Changed to superglobals, and eliminated $use_cache (since we always do).
saxmatt authored
12 if (empty($_POST["$wpvar"])) {
13 if (empty($_GET["$wpvar"])) {
99a7358 Renaming Reloaded.
saxmatt authored
14 $$wpvar = '';
ebd50d4 First pass at new options/settings system.
mikelittle authored
15 } else {
10c6b7e Changed to superglobals, and eliminated $use_cache (since we always do).
saxmatt authored
16 $$wpvar = $_GET["$wpvar"];
ebd50d4 First pass at new options/settings system.
mikelittle authored
17 }
18 } else {
10c6b7e Changed to superglobals, and eliminated $use_cache (since we always do).
saxmatt authored
19 $$wpvar = $_POST["$wpvar"];
ebd50d4 First pass at new options/settings system.
mikelittle authored
20 }
21 }
22 }
abfaf65 More options functionaily
mikelittle authored
23
508e55a More cap migration.
ryan authored
24 if ( !current_user_can('manage_options') )
efa798a Userlevel 6 on options page
saxmatt authored
25 die ( __('Cheatin&#8217; uh?') );
26
ebd50d4 First pass at new options/settings system.
mikelittle authored
27 switch($action) {
28
0174984 Option fixes.
saxmatt authored
29 case 'update':
122c114 wp_setcookie() and wp_clearcookie(). Set cookies for both siteurl an…
rboren authored
30 $any_changed = 0;
887422e Minor tweaks
matt authored
31
32 check_admin_referer();
e4a7471 Remove unnecessary quotes. Props technosailor. fixes #1990
ryan authored
33
0174984 Option fixes.
saxmatt authored
34 if (!$_POST['page_options']) {
35 foreach ($_POST as $key => $value) {
e4a7471 Remove unnecessary quotes. Props technosailor. fixes #1990
ryan authored
36 $options[] = $key;
0174984 Option fixes.
saxmatt authored
37 }
38 } else {
3f20184 Cleanup options save.
ryan authored
39 $options = explode(',', stripslashes($_POST['page_options']));
0a38396 Abstraction of a admin functions, new custom options page for general…
saxmatt authored
40 }
41
03cf86f Be nicer to alpha geeks - http://mosquito.wordpress.org/view.php?id=300
saxmatt authored
42 // Save for later.
43 $old_siteurl = get_settings('siteurl');
44 $old_home = get_settings('home');
122c114 wp_setcookie() and wp_clearcookie(). Set cookies for both siteurl an…
rboren authored
45
3f20184 Cleanup options save.
ryan authored
46 // HACK
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');
49 if ($options) {
88e32d3 Add upload folder options. Props David House. fixes #2206
ryan authored
50 foreach ($options as $option) {
51 $option = trim($option);
52 $value = trim(stripslashes($_POST[$option]));
53 if( in_array($option, $nonbools) && ( $value == '0' || $value == '') )
54 $value = 'closed';
55
56 if( $option == 'blogdescription' || $option == 'blogname' )
57 if (current_user_can('unfiltered_html') == false)
58 $value = wp_filter_post_kses( $value );
59
60 if (update_option($option, $value) ) {
61 $any_changed++;
62 }
63 }
64 }
abfaf65 More options functionaily
mikelittle authored
65
3f20184 Cleanup options save.
ryan authored
66 if ($any_changed) {
122c114 wp_setcookie() and wp_clearcookie(). Set cookies for both siteurl an…
rboren authored
67 // If siteurl or home changed, reset cookies.
68 if ( get_settings('siteurl') != $old_siteurl || get_settings('home') != $old_home ) {
f1ccc3d If home changes, write rewrite rules to new location. http://mosquit…
ryan authored
69 // If home changed, write rewrite rules to new location.
305a286 Cache rewrite rules. Add WP_Rewrite::flush_rules(). fixes #2155
ryan authored
70 $wp_rewrite->flush_rules();
122c114 wp_setcookie() and wp_clearcookie(). Set cookies for both siteurl an…
rboren authored
71 // Get currently logged in user and password.
72 get_currentuserinfo();
73 // Clear cookies for old paths.
74 wp_clearcookie();
75 // Set cookies for new paths.
76 wp_setcookie($user_login, $user_pass_md5, true, get_settings('home'), get_settings('siteurl'));
77 }
78
79 //$message = sprintf(__('%d setting(s) saved... '), $any_changed);
ebd50d4 First pass at new options/settings system.
mikelittle authored
80 }
abfaf65 More options functionaily
mikelittle authored
81
88e32d3 Add upload folder options. Props David House. fixes #2206
ryan authored
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);
85 wp_redirect($goback);
0a38396 Abstraction of a admin functions, new custom options page for general…
saxmatt authored
86 break;
ebd50d4 First pass at new options/settings system.
mikelittle authored
87
88 default:
04786f2 Split admin-header.php into admin.php and admin-header.php. Split me…
rboren authored
89 include('admin-header.php'); ?>
5a49a4d More options work. Bug fixes for advanced_edit not being boolean type…
saxmatt authored
90
ebd50d4 First pass at new options/settings system.
mikelittle authored
91 <div class="wrap">
5be251d Mark 'All options' for translation. http://mosquito.wordpress.org/vi…
ryan authored
92 <h2><?php _e('All options'); ?></h2>
c913685 Massive options cleanup and another step of cleaning up the upgrade/i…
saxmatt authored
93 <form name="form" action="options.php" method="post">
e79ab01 Default page if no group selected.
mikelittle authored
94 <input type="hidden" name="action" value="update" />
c913685 Massive options cleanup and another step of cleaning up the upgrade/i…
saxmatt authored
95 <table width="98%">
ebd50d4 First pass at new options/settings system.
mikelittle authored
96 <?php
009d89e Remove optiongroup_options table.
saxmatt authored
97 $options = $wpdb->get_results("SELECT * FROM $wpdb->options ORDER BY option_name");
c226bd7 Cleaned up unused options.
saxmatt authored
98
99 foreach ($options as $option) :
c3e1d51 Axing htmlspecialchars because it double-encodes-encodes. Better erro…
saxmatt authored
100 $value = wp_specialchars($option->option_value);
c913685 Massive options cleanup and another step of cleaning up the upgrade/i…
saxmatt authored
101 echo "
102 <tr>
103 <th scope='row'><label for='$option->option_name'>$option->option_name</label></th>
3505b71 Don't double encode options. http://mosquito.wordpress.org/view.php?…
ryan authored
104 <td><input type='text' name='$option->option_name' id='$option->option_name' size='30' value='" . $value . "' /></td>
c913685 Massive options cleanup and another step of cleaning up the upgrade/i…
saxmatt authored
105 <td>$option->option_description</td>
106 </tr>";
c226bd7 Cleaned up unused options.
saxmatt authored
107 endforeach;
ebd50d4 First pass at new options/settings system.
mikelittle authored
108 ?>
109 </table>
a77e717 Style the submit button on options group and add updated message to p…
saxmatt authored
110 <p class="submit"><input type="submit" name="Update" value="<?php _e('Update Settings &raquo;') ?>" /></p>
e79ab01 Default page if no group selected.
mikelittle authored
111 </form>
ebd50d4 First pass at new options/settings system.
mikelittle authored
112 </div>
113
c913685 Massive options cleanup and another step of cleaning up the upgrade/i…
saxmatt authored
114
ebd50d4 First pass at new options/settings system.
mikelittle authored
115 <?php
116 break;
e79ab01 Default page if no group selected.
mikelittle authored
117 } // end switch
ebd50d4 First pass at new options/settings system.
mikelittle authored
118
5a49a4d More options work. Bug fixes for advanced_edit not being boolean type…
saxmatt authored
119 include('admin-footer.php');
b28a9e3 The two flags "default_ping_status" and "default_comment_status" were…
donncha authored
120 ?>
Something went wrong with that request. Please try again.