--- 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. */
- __( '<strong>Error</strong>: Options page %s not found in the allowed options list.' ),
+ __( '<strong>Error:</strong> The %s options page is not in the allowed options list.' ),
'<code>' . esc_html( $option_page ) . '</code>'
)
);
@@ -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/' ),
- '<code>' . esc_html( $option ) . '</code>'
+ /* translators: 1: The option/setting, 2: Documentation URL. */
+ __( 'The %1$s setting is unregistered. Unregistered settings are deprecated. See <a href="%2$s">documentation on the Settings API</a>.' ),
+ '<code>' . esc_html( $option ) . '</code>',
+ __( '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';
+?>
<div class="wrap">
<h1><?php esc_html_e( 'All Settings' ); ?></h1>
- <div class="notice notice-warning">
- <p><strong><?php _e( 'Warning:' ); ?></strong> <?php _e( 'This page allows direct access to your site settings. You can break things here. Please be cautious!' ); ?></p>
- </div>
-
+ <?php
+ wp_admin_notice(
+ '<strong>' . __( 'Warning:' ) . '</strong> ' . __( 'This page allows direct access to your site settings. You can break things here. Please be cautious!' ),
+ array(
+ 'type' => 'warning',
+ )
+ );
+ ?>
<form name="form" action="options.php" method="post" id="all-options">
<?php wp_nonce_field( 'options-options' ); ?>
<input type="hidden" name="action" value="update" />
@@ -398,7 +426,7 @@
<tr>
<th scope="row"><label for="<?php echo $name; ?>"><?php echo esc_html( $option->option_name ); ?></label></th>
<td>
- <?php if ( strpos( $value, "\n" ) !== false ) : ?>
+ <?php if ( str_contains( $value, "\n" ) ) : ?>
<textarea class="<?php echo $class; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>" cols="30" rows="5"><?php echo esc_textarea( $value ); ?></textarea>
<?php else : ?>
<input class="regular-text <?php echo $class; ?>" type="text" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo esc_attr( $value ); ?>"<?php disabled( $disabled, true ); ?> />