Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/update-core.php

    r15282 r17048  
    1010require_once('./admin.php');
    1111
    12 if ( ! current_user_can('update_plugins') )
    13     wp_die(__('You do not have sufficient permissions to update plugins for this site.'));
     12if ( is_multisite() && ! is_network_admin() ) {
     13    wp_redirect( network_admin_url( 'update-core.php' ) );
     14    exit();
     15}
     16
     17if ( ! current_user_can( 'update_core' ) )
     18    wp_die( __( 'You do not have sufficient permissions to update this site.' ) );
    1419
    1520function list_core_update( $update ) {
     
    5964    echo '<input name="locale" value="'. esc_attr($update->locale) .'" type="hidden"/>';
    6065    if ( $show_buttons ) {
    61         echo '<input id="upgrade" class="button" type="submit" value="' . esc_attr($submit) . '" name="upgrade" />&nbsp;';
    62         echo '<a href="' . esc_url($update->package) . '" class="button">' . $download . '</a>&nbsp;';
     66        submit_button( $submit, 'button', 'upgrade', false );
     67        echo '&nbsp;<a href="' . esc_url($update->package) . '" class="button">' . $download . '</a>&nbsp;';
    6368    }
    6469    if ( 'en_US' != $update->locale )
    6570        if ( !isset( $update->dismissed ) || !$update->dismissed )
    66             echo '<input id="dismiss" class="button" type="submit" value="' . esc_attr__('Hide this update') . '" name="dismiss" />';
     71            submit_button( __('Hide this update'), 'button', 'dismiss', false );
    6772        else
    68             echo '<input id="undismiss" class="button" type="submit" value="' . esc_attr__('Bring back this update') . '" name="undismiss" />';
     73            submit_button( __('Bring back this update'), 'button', 'undismiss', false );
    6974    echo '</p>';
    7075    if ( 'en_US' != $update->locale && ( !isset($wp_local_package) || $wp_local_package != $update->locale ) )
    7176        echo '<p class="hint">'.__('This localized version contains both the translation and various other localization fixes. You can skip upgrading if you want to keep your current translation.').'</p>';
    7277    else if ( 'en_US' == $update->locale && get_locale() != 'en_US' ) {
    73         echo '<p class="hint">'.sprintf( __('You are about to install WordPress %s <strong>in English.</strong> There is a chance this upgrade will break your translation. You may prefer to wait for the localized version to be released.'), $update->current ).'</p>';
     78        echo '<p class="hint">'.sprintf( __('You are about to install WordPress %s <strong>in English (US).</strong> There is a chance this update will break your translation. You may prefer to wait for the localized version to be released.'), $update->current ).'</p>';
    7479    }
    7580    echo '</form>';
     
    122127    if ( $upgrade_error ) {
    123128        echo '<div class="error"><p>';
    124         _e('Please select one or more plugins to upgrade.');
     129        if ( $upgrade_error == 'themes' )
     130            _e('Please select one or more themes to update.');
     131        else
     132            _e('Please select one or more plugins to update.');
    125133        echo '</p></div>';
    126134    }
     135
     136    echo '<p>';
     137    /* translators: %1 date, %2 time. */
     138    printf( __('Last checked on %1$s at %2$s.'), date_i18n( get_option( 'date_format' ) ), date_i18n( get_option( 'time_format' ) ) );
     139    echo ' &nbsp; <a class="button" href="' . esc_url( self_admin_url('update-core.php') ) . '">' . __( 'Check Again' ) . '</a>';
     140    echo '</p>';
    127141
    128142    if ( !isset($updates[0]->response) || 'latest' == $updates[0]->response ) {
     
    131145        echo '</h3>';
    132146    } else {
    133         echo '<div class="updated"><p>';
    134         _e('<strong>Important:</strong> before updating, please <a href="http://codex.wordpress.org/WordPress_Backups">backup your database and files</a>. For help with updates, visit the <a href="http://codex.wordpress.org/Updating_WordPress">Updating WordPress</a> Codex page.');
     147        echo '<div class="updated inline"><p>';
     148        _e('<strong>Important:</strong> before updating, please <a href="http://codex.wordpress.org/WordPress_Backups">back up your database and files</a>. For help with updates, visit the <a href="http://codex.wordpress.org/Updating_WordPress">Updating WordPress</a> Codex page.');
    135149        echo '</p></div>';
    136150
     
    143157    $alternate = true;
    144158    foreach( (array) $updates as $update ) {
    145         $class = $alternate? ' class="alternate"' : '';
    146         $alternate = !$alternate;
    147         echo "<li $class>";
     159        echo '<li>';
    148160        list_core_update( $update );
    149161        echo '</li>';
     
    153165    dismissed_updates();
    154166
    155     list_plugin_updates();
    156     list_theme_updates();
     167    if ( current_user_can( 'update_plugins' ) )
     168        list_plugin_updates();
     169    if ( current_user_can( 'update_themes' ) )
     170        list_theme_updates();
    157171    do_action('core_upgrade_preamble');
    158172    echo '</div>';
     
    229243    <tr class='active'>
    230244        <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr($plugin_file) . "' /></th>
    231         <td class='plugin-title'><strong>{$plugin_data->Name}</strong>" . sprintf(__('You have version %1$s installed. Update to %2$s.'), $plugin_data->Version, $plugin_data->update->new_version) . $compat . $upgrade_notice . "</td>
     245        <td><strong>{$plugin_data->Name}</strong><br />" . sprintf(__('You have version %1$s installed. Update to %2$s.'), $plugin_data->Version, $plugin_data->update->new_version) . $compat . $upgrade_notice . "</td>
    232246    </tr>";
    233247    }
     
    253267<h3><?php _e( 'Themes' ); ?></h3>
    254268<p><?php _e( 'The following themes have new versions available. Check the ones you want to update and then click &#8220;Update Themes&#8221;.' ); ?></p>
    255 <p><?php printf( __('<strong>Please Note:</strong> Any customizations you have made to the Themes files will be lost. Please consider using <a href="%s">child themes</a> for modifications.'), _x('http://codex.wordpress.org/Child_Themes', 'Link used in suggestion to use child themes in GUU') ); ?></p>
     269<p><?php printf( __('<strong>Please Note:</strong> Any customizations you have made to theme files will be lost. Please consider using <a href="%s">child themes</a> for modifications.'), _x('http://codex.wordpress.org/Child_Themes', 'Link used in suggestion to use child themes in GUU') ); ?></p>
    256270<form method="post" action="<?php echo $form_action; ?>" name="upgrade-themes" class="upgrade">
    257271<?php wp_nonce_field('upgrade-core'); ?>
     
    321335?>
    322336    <div class="wrap">
    323     <?php screen_icon(); ?>
     337    <?php screen_icon('tools'); ?>
    324338    <h2><?php _e('Update WordPress'); ?></h2>
    325339<?php
     
    342356    } else {
    343357        show_message( __('WordPress updated successfully') );
    344         show_message( '<strong>' . __('Actions:') . '</strong> <a href="' . esc_url( admin_url() ) . '">' . __('Go to Dashboard') . '</a>' );
     358        show_message( '<a href="' . esc_url( self_admin_url() ) . '">' . __('Go to Dashboard') . '</a>' );
    345359    }
    346360    echo '</div>';
     
    355369    dismiss_core_update( $update );
    356370    wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') );
     371    exit;
    357372}
    358373
     
    365380    undismiss_core_update( $version, $locale );
    366381    wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') );
     382    exit;
    367383}
    368384
     
    374390
    375391$upgrade_error = false;
    376 if ( 'do-plugin-upgrade' == $action && !isset($_GET['plugins']) && !isset($_POST['checked']) ) {
    377     $upgrade_error = true;
     392if ( ( 'do-theme-upgrade' == $action || ( 'do-plugin-upgrade' == $action && ! isset( $_GET['plugins'] ) ) )
     393    && ! isset( $_POST['checked'] ) ) {
     394    $upgrade_error = $action == 'do-theme-upgrade' ? 'themes' : 'plugins';
    378395    $action = 'upgrade-core';
    379396}
     
    385402    '<p>' . __('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.') . '</p>' .
    386403    '<p>' . __('Updating your WordPress installation is a simple one-click procedure; just click on the Update button when it says a new version is available.') . '</p>' .
    387     '<p>' . __('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.') . '</p>' .
     404    '<p>' . __('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.') . '</p>' .
    388405    '<p><strong>' . __('For more information:') . '</strong></p>' .
    389406    '<p>' . __('<a href="http://codex.wordpress.org/Dashboard_Updates_SubPanel" target="_blank">Documentation on Updating WordPress</a>') . '</p>' .
     
    392409
    393410if ( 'upgrade-core' == $action ) {
     411
    394412    wp_version_check();
    395     require_once('./admin-header.php');
     413    require_once(ABSPATH . 'wp-admin/admin-header.php');
    396414    core_upgrade_preamble();
     415
    397416} elseif ( 'do-core-upgrade' == $action || 'do-core-reinstall' == $action ) {
    398417    check_admin_referer('upgrade-core');
     
    405424        do_undismiss_core_update();
    406425
    407     require_once('./admin-header.php');
     426    require_once(ABSPATH . 'wp-admin/admin-header.php');
    408427    if ( 'do-core-reinstall' == $action )
    409428        $reinstall = true;
     
    415434
    416435} elseif ( 'do-plugin-upgrade' == $action ) {
     436
     437    if ( ! current_user_can( 'update_plugins' ) )
     438        wp_die( __( 'You do not have sufficient permissions to update this site.' ) );
     439
    417440    check_admin_referer('upgrade-core');
    418441
     
    422445        $plugins = (array) $_POST['checked'];
    423446    } else {
    424         wp_redirect('update-core.php');
     447        wp_redirect( admin_url('update-core.php') );
    425448        exit;
    426449    }
     
    431454    $title = __('Update Plugins');
    432455
    433     require_once('./admin-header.php');
     456    require_once(ABSPATH . 'wp-admin/admin-header.php');
    434457    echo '<div class="wrap">';
    435458    screen_icon('plugins');
     
    437460    echo "<iframe src='$url' style='width: 100%; height: 100%; min-height: 750px;' frameborder='0'></iframe>";
    438461    echo '</div>';
     462
    439463} elseif ( 'do-theme-upgrade' == $action ) {
     464
     465    if ( ! current_user_can( 'update_themes' ) )
     466        wp_die( __( 'You do not have sufficient permissions to update this site.' ) );
     467
    440468    check_admin_referer('upgrade-core');
    441469
     
    445473        $themes = (array) $_POST['checked'];
    446474    } else {
    447         wp_redirect('update-core.php');
     475        wp_redirect( admin_url('update-core.php') );
    448476        exit;
    449477    }
     
    454482    $title = __('Update Themes');
    455483
    456     require_once('./admin-header.php');
     484    require_once(ABSPATH . 'wp-admin/admin-header.php');
    457485    echo '<div class="wrap">';
    458486    screen_icon('themes');
     
    462490}
    463491
    464 include('./admin-footer.php');
     492include(ABSPATH . 'wp-admin/admin-footer.php');
Note: See TracChangeset for help on using the changeset viewer.