16 */ |
16 */ |
17 |
17 |
18 /** WordPress Administration Bootstrap */ |
18 /** WordPress Administration Bootstrap */ |
19 require_once __DIR__ . '/admin.php'; |
19 require_once __DIR__ . '/admin.php'; |
20 |
20 |
|
21 // Used in the HTML title tag. |
21 $title = __( 'Settings' ); |
22 $title = __( 'Settings' ); |
22 $this_file = 'options.php'; |
23 $this_file = 'options.php'; |
23 $parent_file = 'options-general.php'; |
24 $parent_file = 'options-general.php'; |
24 |
25 |
25 wp_reset_vars( array( 'action', 'option_page' ) ); |
26 wp_reset_vars( array( 'action', 'option_page' ) ); |
54 |
55 |
55 // Handle admin email change requests. |
56 // Handle admin email change requests. |
56 if ( ! empty( $_GET['adminhash'] ) ) { |
57 if ( ! empty( $_GET['adminhash'] ) ) { |
57 $new_admin_details = get_option( 'adminhash' ); |
58 $new_admin_details = get_option( 'adminhash' ); |
58 $redirect = 'options-general.php?updated=false'; |
59 $redirect = 'options-general.php?updated=false'; |
59 if ( is_array( $new_admin_details ) && hash_equals( $new_admin_details['hash'], $_GET['adminhash'] ) && ! empty( $new_admin_details['newemail'] ) ) { |
60 |
|
61 if ( is_array( $new_admin_details ) |
|
62 && hash_equals( $new_admin_details['hash'], $_GET['adminhash'] ) |
|
63 && ! empty( $new_admin_details['newemail'] ) |
|
64 ) { |
60 update_option( 'admin_email', $new_admin_details['newemail'] ); |
65 update_option( 'admin_email', $new_admin_details['newemail'] ); |
61 delete_option( 'adminhash' ); |
66 delete_option( 'adminhash' ); |
62 delete_option( 'new_admin_email' ); |
67 delete_option( 'new_admin_email' ); |
63 $redirect = 'options-general.php?updated=true'; |
68 $redirect = 'options-general.php?updated=true'; |
64 } |
69 } |
|
70 |
65 wp_redirect( admin_url( $redirect ) ); |
71 wp_redirect( admin_url( $redirect ) ); |
66 exit; |
72 exit; |
67 } elseif ( ! empty( $_GET['dismiss'] ) && 'new_admin_email' === $_GET['dismiss'] ) { |
73 } elseif ( ! empty( $_GET['dismiss'] ) && 'new_admin_email' === $_GET['dismiss'] ) { |
68 check_admin_referer( 'dismiss-' . get_current_blog_id() . '-new_admin_email' ); |
74 check_admin_referer( 'dismiss-' . get_current_blog_id() . '-new_admin_email' ); |
69 delete_option( 'adminhash' ); |
75 delete_option( 'adminhash' ); |
70 delete_option( 'new_admin_email' ); |
76 delete_option( 'new_admin_email' ); |
71 wp_redirect( admin_url( 'options-general.php?updated=true' ) ); |
77 wp_redirect( admin_url( 'options-general.php?updated=true' ) ); |
72 exit; |
78 exit; |
73 } |
79 } |
74 |
80 |
75 if ( is_multisite() && ! current_user_can( 'manage_network_options' ) && 'update' != $action ) { |
81 if ( is_multisite() && ! current_user_can( 'manage_network_options' ) && 'update' !== $action ) { |
76 wp_die( |
82 wp_die( |
77 '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' . |
83 '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' . |
78 '<p>' . __( 'Sorry, you are not allowed to delete these items.' ) . '</p>', |
84 '<p>' . __( 'Sorry, you are not allowed to delete these items.' ) . '</p>', |
79 403 |
85 403 |
80 ); |
86 ); |
180 /* |
186 /* |
181 * If upload_url_path is not the default (empty), |
187 * If upload_url_path is not the default (empty), |
182 * or upload_path is not the default ('wp-content/uploads' or empty), |
188 * or upload_path is not the default ('wp-content/uploads' or empty), |
183 * they can be edited, otherwise they're locked. |
189 * they can be edited, otherwise they're locked. |
184 */ |
190 */ |
185 if ( get_option( 'upload_url_path' ) || ( get_option( 'upload_path' ) != 'wp-content/uploads' && get_option( 'upload_path' ) ) ) { |
191 if ( get_option( 'upload_url_path' ) |
|
192 || get_option( 'upload_path' ) && 'wp-content/uploads' !== get_option( 'upload_path' ) |
|
193 ) { |
186 $allowed_options['media'][] = 'upload_path'; |
194 $allowed_options['media'][] = 'upload_path'; |
187 $allowed_options['media'][] = 'upload_url_path'; |
195 $allowed_options['media'][] = 'upload_url_path'; |
188 } |
196 } |
189 } else { |
197 } else { |
190 /** |
198 /** |
245 |
253 |
246 if ( 'options' === $option_page ) { |
254 if ( 'options' === $option_page ) { |
247 if ( is_multisite() && ! current_user_can( 'manage_network_options' ) ) { |
255 if ( is_multisite() && ! current_user_can( 'manage_network_options' ) ) { |
248 wp_die( __( 'Sorry, you are not allowed to modify unregistered settings for this site.' ) ); |
256 wp_die( __( 'Sorry, you are not allowed to modify unregistered settings for this site.' ) ); |
249 } |
257 } |
250 $options = explode( ',', wp_unslash( $_POST['page_options'] ) ); |
258 $options = isset( $_POST['page_options'] ) ? explode( ',', wp_unslash( $_POST['page_options'] ) ) : null; |
251 } else { |
259 } else { |
252 $options = $allowed_options[ $option_page ]; |
260 $options = $allowed_options[ $option_page ]; |
253 } |
261 } |
254 |
262 |
255 if ( 'general' === $option_page ) { |
263 if ( 'general' === $option_page ) { |
322 unset( $GLOBALS['locale'] ); |
330 unset( $GLOBALS['locale'] ); |
323 $user_language_new = get_user_locale(); |
331 $user_language_new = get_user_locale(); |
324 if ( $user_language_old !== $user_language_new ) { |
332 if ( $user_language_old !== $user_language_new ) { |
325 load_default_textdomain( $user_language_new ); |
333 load_default_textdomain( $user_language_new ); |
326 } |
334 } |
|
335 } else { |
|
336 add_settings_error( 'general', 'settings_updated', __( 'Settings save failed.' ), 'error' ); |
327 } |
337 } |
328 |
338 |
329 /* |
339 /* |
330 * Handle settings errors and return to options page. |
340 * Handle settings errors and return to options page. |
331 */ |
341 */ |