X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/9e77185fafaf4e60e2b73821e0e4b9b1a11fb85f..caeaf8dc94b5e3f75dc98ec92dc7b76049cdddb6:/wp-admin/options.php diff --git a/wp-admin/options.php b/wp-admin/options.php index 29a93446..6cf58235 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,6 +163,18 @@ 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 ) {