X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/9e77185fafaf4e60e2b73821e0e4b9b1a11fb85f..fcaa67f093b5c83deea7a361a8cf8c6ac4e832d3:/wp-admin/options.php?ds=sidebyside
diff --git a/wp-admin/options.php b/wp-admin/options.php
index 29a93446..0f149c95 100644
--- a/wp-admin/options.php
+++ b/wp-admin/options.php
@@ -45,7 +45,7 @@ if ( empty($option_page) ) {
}
if ( !current_user_can( $capability ) )
- wp_die(__('Cheatin’ uh?'));
+ wp_die( __( 'Cheatin’ uh?' ), 403 );
// Handle admin email change requests
if ( is_multisite() ) {
@@ -69,7 +69,7 @@ if ( is_multisite() ) {
}
if ( is_multisite() && !is_super_admin() && 'update' != $action )
- wp_die(__('Cheatin’ uh?'));
+ wp_die( __( 'Cheatin’ uh?' ), 403 );
$whitelist_options = array(
'general' => array( 'blogname', 'blogdescription', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'timezone_string', 'WPLANG' ),
@@ -151,8 +151,8 @@ if ( 'update' == $action ) {
$options = $whitelist_options[ $option_page ];
}
- // Handle custom date/time formats.
if ( 'general' == $option_page ) {
+ // Handle custom date/time formats.
if ( !empty($_POST['date_format']) && isset($_POST['date_format_custom']) && '\c\u\s\t\o\m' == wp_unslash( $_POST['date_format'] ) )
$_POST['date_format'] = $_POST['date_format_custom'];
if ( !empty($_POST['time_format']) && isset($_POST['time_format_custom']) && '\c\u\s\t\o\m' == wp_unslash( $_POST['time_format'] ) )
@@ -163,12 +163,24 @@ if ( 'update' == $action ) {
$_POST['gmt_offset'] = preg_replace('/UTC\+?/', '', $_POST['gmt_offset']);
$_POST['timezone_string'] = '';
}
+
+ // Handle translation install.
+ if ( ! empty( $_POST['WPLANG'] ) && ( ! is_multisite() || is_super_admin() ) ) { // @todo: Skip if already installed
+ require_once( ABSPATH . 'wp-admin/includes/translation-install.php' );
+
+ if ( wp_can_install_language_pack() ) {
+ $language = wp_download_language_pack( $_POST['WPLANG'] );
+ if ( $language ) {
+ $_POST['WPLANG'] = $language;
+ }
+ }
+ }
}
if ( $options ) {
foreach ( $options as $option ) {
if ( $unregistered )
- _deprecated_argument( 'options.php', '2.7', sprintf( __( 'The %1$s
setting is unregistered. Unregistered settings are deprecated. See http://codex.wordpress.org/Settings_API' ), $option, $option_page ) );
+ _deprecated_argument( 'options.php', '2.7', sprintf( __( 'The %1$s
setting is unregistered. Unregistered settings are deprecated. See https://codex.wordpress.org/Settings_API' ), $option, $option_page ) );
$option = trim( $option );
$value = null;