X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/a6444c710cf37d7732aea76e752e43322b5036ca..e9d988989fe37ab8c5f903e47fbe36e6e00dc51f:/wp-admin/update-core.php diff --git a/wp-admin/update-core.php b/wp-admin/update-core.php index 81472f23..3671915d 100644 --- a/wp-admin/update-core.php +++ b/wp-admin/update-core.php @@ -9,8 +9,13 @@ /** WordPress Administration Bootstrap */ require_once('./admin.php'); -if ( ! current_user_can('update_plugins') ) - wp_die(__('You do not have sufficient permissions to update plugins for this site.')); +if ( is_multisite() && ! is_network_admin() ) { + wp_redirect( network_admin_url( 'update-core.php' ) ); + exit(); +} + +if ( ! current_user_can( 'update_core' ) ) + wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); function list_core_update( $update ) { global $wp_local_package, $wpdb; @@ -58,19 +63,19 @@ function list_core_update( $update ) { echo ''; echo ''; if ( $show_buttons ) { - echo ' '; - echo '' . $download . ' '; + submit_button( $submit, 'button', 'upgrade', false ); + echo ' ' . $download . ' '; } if ( 'en_US' != $update->locale ) if ( !isset( $update->dismissed ) || !$update->dismissed ) - echo ''; + submit_button( __('Hide this update'), 'button', 'dismiss', false ); else - echo ''; + submit_button( __('Bring back this update'), 'button', 'undismiss', false ); echo '

'; if ( 'en_US' != $update->locale && ( !isset($wp_local_package) || $wp_local_package != $update->locale ) ) echo '

'.__('This localized version contains both the translation and various other localization fixes. You can skip upgrading if you want to keep your current translation.').'

'; else if ( 'en_US' == $update->locale && get_locale() != 'en_US' ) { - echo '

'.sprintf( __('You are about to install WordPress %s in English. There is a chance this upgrade will break your translation. You may prefer to wait for the localized version to be released.'), $update->current ).'

'; + echo '

'.sprintf( __('You are about to install WordPress %s in English (US). There is a chance this update will break your translation. You may prefer to wait for the localized version to be released.'), $update->current ).'

'; } echo ''; @@ -121,17 +126,26 @@ function core_upgrade_preamble() {

'; - _e('Please select one or more plugins to upgrade.'); + if ( $upgrade_error == 'themes' ) + _e('Please select one or more themes to update.'); + else + _e('Please select one or more plugins to update.'); echo '

'; } + echo '

'; + /* translators: %1 date, %2 time. */ + printf( __('Last checked on %1$s at %2$s.'), date_i18n( get_option( 'date_format' ) ), date_i18n( get_option( 'time_format' ) ) ); + echo '   ' . __( 'Check Again' ) . ''; + echo '

'; + if ( !isset($updates[0]->response) || 'latest' == $updates[0]->response ) { echo '

'; _e('You have the latest version of WordPress.'); echo '

'; } else { - echo '

'; - _e('Important: before updating, please backup your database and files. For help with updates, visit the Updating WordPress Codex page.'); + echo '

'; + _e('Important: before updating, please back up your database and files. For help with updates, visit the Updating WordPress Codex page.'); echo '

'; echo '

'; @@ -142,9 +156,7 @@ function core_upgrade_preamble() { echo '

'; } @@ -228,7 +242,7 @@ function list_plugin_updates() { echo " - {$plugin_data->Name}" . sprintf(__('You have version %1$s installed. Update to %2$s.'), $plugin_data->Version, $plugin_data->update->new_version) . $compat . $upgrade_notice . " + {$plugin_data->Name}
" . sprintf(__('You have version %1$s installed. Update to %2$s.'), $plugin_data->Version, $plugin_data->update->new_version) . $compat . $upgrade_notice . " "; } ?> @@ -252,7 +266,7 @@ function list_theme_updates() { ?>

-

Please Note: Any customizations you have made to the Themes files will be lost. Please consider using child themes for modifications.'), _x('http://codex.wordpress.org/Child_Themes', 'Link used in suggestion to use child themes in GUU') ); ?>

+

Please Note: Any customizations you have made to theme files will be lost. Please consider using child themes for modifications.'), _x('http://codex.wordpress.org/Child_Themes', 'Link used in suggestion to use child themes in GUU') ); ?>

@@ -320,7 +334,7 @@ function do_core_upgrade( $reinstall = false ) { } ?>
- +

errors->get_error_code() ) { @@ -341,7 +355,7 @@ function do_core_upgrade( $reinstall = false ) { show_message( __('Installation Failed') ); } else { show_message( __('WordPress updated successfully') ); - show_message( '' . __('Actions:') . ' ' . __('Go to Dashboard') . '' ); + show_message( '' . __('Go to Dashboard') . '' ); } echo '
'; } @@ -354,6 +368,7 @@ function do_dismiss_core_update() { return; dismiss_core_update( $update ); wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') ); + exit; } function do_undismiss_core_update() { @@ -364,6 +379,7 @@ function do_undismiss_core_update() { return; undismiss_core_update( $version, $locale ); wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') ); + exit; } function no_update_actions($actions) { @@ -373,8 +389,9 @@ function no_update_actions($actions) { $action = isset($_GET['action']) ? $_GET['action'] : 'upgrade-core'; $upgrade_error = false; -if ( 'do-plugin-upgrade' == $action && !isset($_GET['plugins']) && !isset($_POST['checked']) ) { - $upgrade_error = true; +if ( ( 'do-theme-upgrade' == $action || ( 'do-plugin-upgrade' == $action && ! isset( $_GET['plugins'] ) ) ) + && ! isset( $_POST['checked'] ) ) { + $upgrade_error = $action == 'do-theme-upgrade' ? 'themes' : 'plugins'; $action = 'upgrade-core'; } @@ -384,16 +401,18 @@ $parent_file = 'tools.php'; add_contextual_help($current_screen, '

' . __('This screen lets you update to the latest version of WordPress as well as update your themes and plugins from the WordPress.org repository. When updates are available, the number of available updates will appear in a bubble on the left hand menu as a notification. It is very important to keep your WordPress installation up to date for security reasons, so when you see a number appear, make sure you take the time to update, which is an easy process.') . '

' . '

' . __('Updating your WordPress installation is a simple one-click procedure; just click on the Update button when it says a new version is available.') . '

' . - '

' . __('To upgrade themes or plugins from this screen, use the checkboxes to make your selection and click on the appropriate Update button. Check the box at the top of the Themes or Plugins section to select all and update them all at once.') . '

' . + '

' . __('To update themes or plugins from this screen, use the checkboxes to make your selection and click on the appropriate Update button. Check the box at the top of the Themes or Plugins section to select all and update them all at once.') . '

' . '

' . __('For more information:') . '

' . '

' . __('Documentation on Updating WordPress') . '

' . '

' . __('Support Forums') . '

' ); if ( 'upgrade-core' == $action ) { + wp_version_check(); - require_once('./admin-header.php'); + require_once(ABSPATH . 'wp-admin/admin-header.php'); core_upgrade_preamble(); + } elseif ( 'do-core-upgrade' == $action || 'do-core-reinstall' == $action ) { check_admin_referer('upgrade-core'); @@ -404,7 +423,7 @@ if ( 'upgrade-core' == $action ) { elseif ( isset( $_POST['undismiss'] ) ) do_undismiss_core_update(); - require_once('./admin-header.php'); + require_once(ABSPATH . 'wp-admin/admin-header.php'); if ( 'do-core-reinstall' == $action ) $reinstall = true; else @@ -414,6 +433,10 @@ if ( 'upgrade-core' == $action ) { do_core_upgrade($reinstall); } elseif ( 'do-plugin-upgrade' == $action ) { + + if ( ! current_user_can( 'update_plugins' ) ) + wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); + check_admin_referer('upgrade-core'); if ( isset( $_GET['plugins'] ) ) { @@ -421,7 +444,7 @@ if ( 'upgrade-core' == $action ) { } elseif ( isset( $_POST['checked'] ) ) { $plugins = (array) $_POST['checked']; } else { - wp_redirect('update-core.php'); + wp_redirect( admin_url('update-core.php') ); exit; } @@ -430,13 +453,18 @@ if ( 'upgrade-core' == $action ) { $title = __('Update Plugins'); - require_once('./admin-header.php'); + require_once(ABSPATH . 'wp-admin/admin-header.php'); echo '
'; screen_icon('plugins'); echo '

' . esc_html__('Update Plugins') . '

'; echo ""; echo '
'; + } elseif ( 'do-theme-upgrade' == $action ) { + + if ( ! current_user_can( 'update_themes' ) ) + wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); + check_admin_referer('upgrade-core'); if ( isset( $_GET['themes'] ) ) { @@ -444,7 +472,7 @@ if ( 'upgrade-core' == $action ) { } elseif ( isset( $_POST['checked'] ) ) { $themes = (array) $_POST['checked']; } else { - wp_redirect('update-core.php'); + wp_redirect( admin_url('update-core.php') ); exit; } @@ -453,7 +481,7 @@ if ( 'upgrade-core' == $action ) { $title = __('Update Themes'); - require_once('./admin-header.php'); + require_once(ABSPATH . 'wp-admin/admin-header.php'); echo '
'; screen_icon('themes'); echo '

' . esc_html__('Update Themes') . '

'; @@ -461,4 +489,4 @@ if ( 'upgrade-core' == $action ) { echo '
'; } -include('./admin-footer.php'); +include(ABSPATH . 'wp-admin/admin-footer.php');