diff -r 7b1b88e27a20 -r 48c4eec2b7e6 wp/wp-admin/options.php
--- a/wp/wp-admin/options.php Thu Sep 29 08:06:27 2022 +0200
+++ b/wp/wp-admin/options.php Fri Sep 05 18:40:08 2025 +0200
@@ -23,7 +23,8 @@
$this_file = 'options.php';
$parent_file = 'options-general.php';
-wp_reset_vars( array( 'action', 'option_page' ) );
+$action = ! empty( $_REQUEST['action'] ) ? sanitize_text_field( $_REQUEST['action'] ) : '';
+$option_page = ! empty( $_REQUEST['option_page'] ) ? sanitize_text_field( $_REQUEST['option_page'] ) : '';
$capability = 'manage_options';
@@ -90,6 +91,7 @@
'general' => array(
'blogname',
'blogdescription',
+ 'site_icon',
'gmt_offset',
'date_format',
'time_format',
@@ -158,7 +160,7 @@
$mail_options = array( 'mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass' );
-if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ), true ) ) {
+if ( ! is_utf8_charset() ) {
$allowed_options['reading'][] = 'blog_charset';
}
@@ -179,7 +181,9 @@
$allowed_options['general'][] = 'default_role';
$allowed_options['writing'] = array_merge( $allowed_options['writing'], $mail_options );
- $allowed_options['writing'][] = 'ping_sites';
+ if ( '1' === get_option( 'blog_public' ) ) {
+ $allowed_options['writing'][] = 'ping_sites';
+ }
$allowed_options['media'][] = 'uploads_use_yearmonth_folders';
@@ -245,7 +249,7 @@
wp_die(
sprintf(
/* translators: %s: The options page name. */
- __( 'Error: Options page %s not found in the allowed options list.' ),
+ __( 'Error: The %s options page is not in the allowed options list.' ),
'' . esc_html( $option_page ) . '
'
)
);
@@ -279,6 +283,23 @@
$_POST['gmt_offset'] = $_POST['timezone_string'];
$_POST['gmt_offset'] = preg_replace( '/UTC\+?/', '', $_POST['gmt_offset'] );
$_POST['timezone_string'] = '';
+ } elseif ( isset( $_POST['timezone_string'] ) && ! in_array( $_POST['timezone_string'], timezone_identifiers_list( DateTimeZone::ALL_WITH_BC ), true ) ) {
+ // Reset to the current value.
+ $current_timezone_string = get_option( 'timezone_string' );
+
+ if ( ! empty( $current_timezone_string ) ) {
+ $_POST['timezone_string'] = $current_timezone_string;
+ } else {
+ $_POST['gmt_offset'] = get_option( 'gmt_offset' );
+ $_POST['timezone_string'] = '';
+ }
+
+ add_settings_error(
+ 'general',
+ 'settings_updated',
+ __( 'The timezone you have entered is not valid. Please select a valid timezone.' ),
+ 'error'
+ );
}
// Handle translation installation.
@@ -303,9 +324,10 @@
'options.php',
'2.7.0',
sprintf(
- /* translators: %s: The option/setting. */
- __( 'The %s setting is unregistered. Unregistered settings are deprecated. See https://developer.wordpress.org/plugins/settings/settings-api/' ),
- '' . esc_html( $option ) . '
'
+ /* translators: 1: The option/setting, 2: Documentation URL. */
+ __( 'The %1$s setting is unregistered. Unregistered settings are deprecated. See documentation on the Settings API.' ),
+ '' . esc_html( $option ) . '
',
+ __( 'https://developer.wordpress.org/plugins/settings/settings-api/' )
)
);
}
@@ -344,7 +366,8 @@
if ( ! count( get_settings_errors() ) ) {
add_settings_error( 'general', 'settings_updated', __( 'Settings saved.' ), 'success' );
}
- set_transient( 'settings_errors', get_settings_errors(), 30 );
+
+ set_transient( 'settings_errors', get_settings_errors(), 30 ); // 30 seconds.
// Redirect back to the settings page that was submitted.
$goback = add_query_arg( 'settings-updated', 'true', wp_get_referer() );
@@ -352,15 +375,20 @@
exit;
}
-require_once ABSPATH . 'wp-admin/admin-header.php'; ?>
+require_once ABSPATH . 'wp-admin/admin-header.php';
+?>
-