]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-admin/update-core.php
Wordpress 3.5.2
[autoinstalls/wordpress.git] / wp-admin / update-core.php
1 <?php
2 /**
3  * Update Core administration panel.
4  *
5  * @package WordPress
6  * @subpackage Administration
7  */
8
9 /** WordPress Administration Bootstrap */
10 require_once('./admin.php');
11
12 wp_enqueue_style( 'plugin-install' );
13 wp_enqueue_script( 'plugin-install' );
14 add_thickbox();
15
16 if ( is_multisite() && ! is_network_admin() ) {
17         wp_redirect( network_admin_url( 'update-core.php' ) );
18         exit();
19 }
20
21 if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_themes' ) && ! current_user_can( 'update_plugins' ) )
22         wp_die( __( 'You do not have sufficient permissions to update this site.' ) );
23
24 function list_core_update( $update ) {
25         global $wp_local_package, $wpdb;
26         static $first_pass = true;
27
28         $version_string = ('en_US' == $update->locale && 'en_US' == get_locale() ) ?
29                         $update->current : sprintf("%s&ndash;<strong>%s</strong>", $update->current, $update->locale);
30         $current = false;
31         if ( !isset($update->response) || 'latest' == $update->response )
32                 $current = true;
33         $submit = __('Update Now');
34         $form_action = 'update-core.php?action=do-core-upgrade';
35         $php_version    = phpversion();
36         $mysql_version  = $wpdb->db_version();
37         $show_buttons = true;
38         if ( 'development' == $update->response ) {
39                 $message = __('You are using a development version of WordPress. You can update to the latest nightly build automatically or download the nightly build and install it manually:');
40                 $download = __('Download nightly build');
41         } else {
42                 if ( $current ) {
43                         $message = sprintf(__('You have the latest version of WordPress. You do not need to update. However, if you want to re-install version %s, you can do so automatically or download the package and re-install manually:'), $version_string);
44                         $submit = __('Re-install Now');
45                         $form_action = 'update-core.php?action=do-core-reinstall';
46                 } else {
47                         $php_compat     = version_compare( $php_version, $update->php_version, '>=' );
48                         if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) )
49                                 $mysql_compat = true;
50                         else
51                                 $mysql_compat = version_compare( $mysql_version, $update->mysql_version, '>=' );
52
53                         if ( !$mysql_compat && !$php_compat )
54                                 $message = sprintf( __('You cannot update because <a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $update->current, $update->php_version, $update->mysql_version, $php_version, $mysql_version );
55                         elseif ( !$php_compat )
56                                 $message = sprintf( __('You cannot update because <a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.'), $update->current, $update->php_version, $php_version );
57                         elseif ( !$mysql_compat )
58                                 $message = sprintf( __('You cannot update because <a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $update->current, $update->mysql_version, $mysql_version );
59                         else
60                                 $message =      sprintf(__('You can update to <a href="http://codex.wordpress.org/Version_%1$s">WordPress %2$s</a> automatically or download the package and install it manually:'), $update->current, $version_string);
61                         if ( !$mysql_compat || !$php_compat )
62                                 $show_buttons = false;
63                 }
64                 $download = sprintf(__('Download %s'), $version_string);
65         }
66
67         echo '<p>';
68         echo $message;
69         echo '</p>';
70         echo '<form method="post" action="' . $form_action . '" name="upgrade" class="upgrade">';
71         wp_nonce_field('upgrade-core');
72         echo '<p>';
73         echo '<input name="version" value="'. esc_attr($update->current) .'" type="hidden"/>';
74         echo '<input name="locale" value="'. esc_attr($update->locale) .'" type="hidden"/>';
75         if ( $show_buttons ) {
76                 if ( $first_pass ) {
77                         submit_button( $submit, $current ? 'button' : 'primary regular', 'upgrade', false );
78                         $first_pass = false;
79                 } else {
80                         submit_button( $submit, 'button', 'upgrade', false );
81                 }
82                 echo '&nbsp;<a href="' . esc_url( $update->download ) . '" class="button">' . $download . '</a>&nbsp;';
83         }
84         if ( 'en_US' != $update->locale )
85                 if ( !isset( $update->dismissed ) || !$update->dismissed )
86                         submit_button( __('Hide this update'), 'button', 'dismiss', false );
87                 else
88                         submit_button( __('Bring back this update'), 'button', 'undismiss', false );
89         echo '</p>';
90         if ( 'en_US' != $update->locale && ( !isset($wp_local_package) || $wp_local_package != $update->locale ) )
91             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>';
92         else if ( 'en_US' == $update->locale && get_locale() != 'en_US' ) {
93             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->response != 'development' ? $update->current : '' ).'</p>';
94         }
95         echo '</form>';
96
97 }
98
99 function dismissed_updates() {
100         $dismissed = get_core_updates( array( 'dismissed' => true, 'available' => false ) );
101         if ( $dismissed ) {
102
103                 $show_text = esc_js(__('Show hidden updates'));
104                 $hide_text = esc_js(__('Hide hidden updates'));
105         ?>
106         <script type="text/javascript">
107
108                 jQuery(function($) {
109                         $('dismissed-updates').show();
110                         $('#show-dismissed').toggle(function(){$(this).text('<?php echo $hide_text; ?>');}, function() {$(this).text('<?php echo $show_text; ?>')});
111                         $('#show-dismissed').click(function() { $('#dismissed-updates').toggle('slow');});
112                 });
113         </script>
114         <?php
115                 echo '<p class="hide-if-no-js"><a id="show-dismissed" href="#">'.__('Show hidden updates').'</a></p>';
116                 echo '<ul id="dismissed-updates" class="core-updates dismissed">';
117                 foreach( (array) $dismissed as $update) {
118                         echo '<li>';
119                         list_core_update( $update );
120                         echo '</li>';
121                 }
122                 echo '</ul>';
123         }
124 }
125
126 /**
127  * Display upgrade WordPress for downloading latest or upgrading automatically form.
128  *
129  * @since 2.7
130  *
131  * @return null
132  */
133 function core_upgrade_preamble() {
134         global $wp_version;
135
136         $updates = get_core_updates();
137
138         if ( !isset($updates[0]->response) || 'latest' == $updates[0]->response ) {
139                 echo '<h3>';
140                 _e('You have the latest version of WordPress.');
141                 echo '</h3>';
142         } else {
143                 echo '<div class="updated inline"><p>';
144                 _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.');
145                 echo '</p></div>';
146
147                 echo '<h3 class="response">';
148                 _e( 'An updated version of WordPress is available.' );
149                 echo '</h3>';
150         }
151
152         echo '<ul class="core-updates">';
153         $alternate = true;
154         foreach( (array) $updates as $update ) {
155                 echo '<li>';
156                 list_core_update( $update );
157                 echo '</li>';
158         }
159         echo '</ul>';
160         if ( $updates ) {
161                 echo '<p>' . __( 'While your site is being updated, it will be in maintenance mode. As soon as your updates are complete, your site will return to normal.' ) . '</p>';
162         } else {
163                 list( $normalized_version ) = explode( '-', $wp_version );
164                 echo '<p>' . sprintf( __( '<a href="%s">Learn more about WordPress %s</a>.' ), esc_url( self_admin_url( 'about.php' ) ), $normalized_version ) . '</p>';
165         }
166         dismissed_updates();
167 }
168
169 function list_plugin_updates() {
170         global $wp_version;
171
172         $cur_wp_version = preg_replace('/-.*$/', '', $wp_version);
173
174         require_once(ABSPATH . 'wp-admin/includes/plugin-install.php');
175         $plugins = get_plugin_updates();
176         if ( empty( $plugins ) ) {
177                 echo '<h3>' . __( 'Plugins' ) . '</h3>';
178                 echo '<p>' . __( 'Your plugins are all up to date.' ) . '</p>';
179                 return;
180         }
181         $form_action = 'update-core.php?action=do-plugin-upgrade';
182
183         $core_updates = get_core_updates();
184         if ( !isset($core_updates[0]->response) || 'latest' == $core_updates[0]->response || 'development' == $core_updates[0]->response || version_compare( $core_updates[0]->current, $cur_wp_version, '=') )
185                 $core_update_version = false;
186         else
187                 $core_update_version = $core_updates[0]->current;
188         ?>
189 <h3><?php _e( 'Plugins' ); ?></h3>
190 <p><?php _e( 'The following plugins have new versions available. Check the ones you want to update and then click &#8220;Update Plugins&#8221;.' ); ?></p>
191 <form method="post" action="<?php echo $form_action; ?>" name="upgrade-plugins" class="upgrade">
192 <?php wp_nonce_field('upgrade-core'); ?>
193 <p><input id="upgrade-plugins" class="button" type="submit" value="<?php esc_attr_e('Update Plugins'); ?>" name="upgrade" /></p>
194 <table class="widefat" cellspacing="0" id="update-plugins-table">
195         <thead>
196         <tr>
197                 <th scope="col" class="manage-column check-column"><input type="checkbox" id="plugins-select-all" /></th>
198                 <th scope="col" class="manage-column"><label for="plugins-select-all"><?php _e('Select All'); ?></label></th>
199         </tr>
200         </thead>
201
202         <tfoot>
203         <tr>
204                 <th scope="col" class="manage-column check-column"><input type="checkbox" id="plugins-select-all-2" /></th>
205                 <th scope="col" class="manage-column"><label for="plugins-select-all-2"><?php _e('Select All'); ?></label></th>
206         </tr>
207         </tfoot>
208         <tbody class="plugins">
209 <?php
210         foreach ( (array) $plugins as $plugin_file => $plugin_data) {
211                 $info = plugins_api('plugin_information', array('slug' => $plugin_data->update->slug ));
212                 // Get plugin compat for running version of WordPress.
213                 if ( isset($info->tested) && version_compare($info->tested, $cur_wp_version, '>=') ) {
214                         $compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: 100%% (according to its author)'), $cur_wp_version);
215                 } elseif ( isset($info->compatibility[$cur_wp_version][$plugin_data->update->new_version]) ) {
216                         $compat = $info->compatibility[$cur_wp_version][$plugin_data->update->new_version];
217                         $compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $cur_wp_version, $compat[0], $compat[2], $compat[1]);
218                 } else {
219                         $compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: Unknown'), $cur_wp_version);
220                 }
221                 // Get plugin compat for updated version of WordPress.
222                 if ( $core_update_version ) {
223                         if ( isset($info->compatibility[$core_update_version][$plugin_data->update->new_version]) ) {
224                                 $update_compat = $info->compatibility[$core_update_version][$plugin_data->update->new_version];
225                                 $compat .= '<br />' . sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $core_update_version, $update_compat[0], $update_compat[2], $update_compat[1]);
226                         } else {
227                                 $compat .= '<br />' . sprintf(__('Compatibility with WordPress %1$s: Unknown'), $core_update_version);
228                         }
229                 }
230                 // Get the upgrade notice for the new plugin version.
231                 if ( isset($plugin_data->update->upgrade_notice) ) {
232                         $upgrade_notice = '<br />' . strip_tags($plugin_data->update->upgrade_notice);
233                 } else {
234                         $upgrade_notice = '';
235                 }
236
237                 $details_url = self_admin_url('plugin-install.php?tab=plugin-information&plugin=' . $plugin_data->update->slug . '&section=changelog&TB_iframe=true&width=640&height=662');
238                 $details_text = sprintf(__('View version %1$s details'), $plugin_data->update->new_version);
239                 $details = sprintf('<a href="%1$s" class="thickbox" title="%2$s">%3$s</a>.', esc_url($details_url), esc_attr($plugin_data->Name), $details_text);
240
241                 echo "
242         <tr class='active'>
243                 <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr($plugin_file) . "' /></th>
244                 <td><p><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) . ' ' . $details . $compat . $upgrade_notice . "</p></td>
245         </tr>";
246         }
247 ?>
248         </tbody>
249 </table>
250 <p><input id="upgrade-plugins-2" class="button" type="submit" value="<?php esc_attr_e('Update Plugins'); ?>" name="upgrade" /></p>
251 </form>
252 <?php
253 }
254
255 function list_theme_updates() {
256         $themes = get_theme_updates();
257         if ( empty( $themes ) ) {
258                 echo '<h3>' . __( 'Themes' ) . '</h3>';
259                 echo '<p>' . __( 'Your themes are all up to date.' ) . '</p>';
260                 return;
261         }
262
263         $form_action = 'update-core.php?action=do-theme-upgrade';
264
265 ?>
266 <h3><?php _e( 'Themes' ); ?></h3>
267 <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>
268 <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>
269 <form method="post" action="<?php echo $form_action; ?>" name="upgrade-themes" class="upgrade">
270 <?php wp_nonce_field('upgrade-core'); ?>
271 <p><input id="upgrade-themes" class="button" type="submit" value="<?php esc_attr_e('Update Themes'); ?>" name="upgrade" /></p>
272 <table class="widefat" cellspacing="0" id="update-themes-table">
273         <thead>
274         <tr>
275                 <th scope="col" class="manage-column check-column"><input type="checkbox" id="themes-select-all" /></th>
276                 <th scope="col" class="manage-column"><label for="themes-select-all"><?php _e('Select All'); ?></label></th>
277         </tr>
278         </thead>
279
280         <tfoot>
281         <tr>
282                 <th scope="col" class="manage-column check-column"><input type="checkbox" id="themes-select-all-2" /></th>
283                 <th scope="col" class="manage-column"><label for="themes-select-all-2"><?php _e('Select All'); ?></label></th>
284         </tr>
285         </tfoot>
286         <tbody class="plugins">
287 <?php
288         foreach ( $themes as $stylesheet => $theme ) {
289                 echo "
290         <tr class='active'>
291                 <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr( $stylesheet ) . "' /></th>
292                 <td class='plugin-title'><img src='" . esc_url( $theme->get_screenshot() ) . "' width='64' height='64' style='float:left; padding: 0 5px 5px' /><strong>" . $theme->display('Name') . '</strong> ' . sprintf( __( 'You have version %1$s installed. Update to %2$s.' ), $theme->display('Version'), $theme->update['new_version'] ) . "</td>
293         </tr>";
294         }
295 ?>
296         </tbody>
297 </table>
298 <p><input id="upgrade-themes-2" class="button" type="submit" value="<?php esc_attr_e('Update Themes'); ?>" name="upgrade" /></p>
299 </form>
300 <?php
301 }
302
303 /**
304  * Upgrade WordPress core display.
305  *
306  * @since 2.7
307  *
308  * @return null
309  */
310 function do_core_upgrade( $reinstall = false ) {
311         global $wp_filesystem;
312
313         if ( $reinstall )
314                 $url = 'update-core.php?action=do-core-reinstall';
315         else
316                 $url = 'update-core.php?action=do-core-upgrade';
317         $url = wp_nonce_url($url, 'upgrade-core');
318         if ( false === ($credentials = request_filesystem_credentials($url, '', false, ABSPATH)) )
319                 return;
320
321         $version = isset( $_POST['version'] )? $_POST['version'] : false;
322         $locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US';
323         $update = find_core_update( $version, $locale );
324         if ( !$update )
325                 return;
326
327         if ( ! WP_Filesystem($credentials, ABSPATH) ) {
328                 request_filesystem_credentials($url, '', true, ABSPATH); //Failed to connect, Error and request again
329                 return;
330         }
331 ?>
332         <div class="wrap">
333         <?php screen_icon('tools'); ?>
334         <h2><?php _e('Update WordPress'); ?></h2>
335 <?php
336         if ( $wp_filesystem->errors->get_error_code() ) {
337                 foreach ( $wp_filesystem->errors->get_error_messages() as $message )
338                         show_message($message);
339                 echo '</div>';
340                 return;
341         }
342
343         if ( $reinstall )
344                 $update->response = 'reinstall';
345
346         $result = wp_update_core($update, 'show_message');
347
348         if ( is_wp_error($result) ) {
349                 show_message($result);
350                 if ('up_to_date' != $result->get_error_code() )
351                         show_message( __('Installation Failed') );
352                 echo '</div>';
353                 return;
354         }
355
356         show_message( __('WordPress updated successfully') );
357         show_message( '<span class="hide-if-no-js">' . sprintf( __( 'Welcome to WordPress %1$s. You will be redirected to the About WordPress screen. If not, click <a href="%2$s">here</a>.' ), $result, esc_url( self_admin_url( 'about.php?updated' ) ) ) . '</span>' );
358         show_message( '<span class="hide-if-js">' . sprintf( __( 'Welcome to WordPress %1$s. <a href="%2$s">Learn more</a>.' ), $result, esc_url( self_admin_url( 'about.php?updated' ) ) ) . '</span>' );
359         ?>
360         </div>
361         <script type="text/javascript">
362         window.location = '<?php echo self_admin_url( 'about.php?updated' ); ?>';
363         </script>
364         <?php
365 }
366
367 function do_dismiss_core_update() {
368         $version = isset( $_POST['version'] )? $_POST['version'] : false;
369         $locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US';
370         $update = find_core_update( $version, $locale );
371         if ( !$update )
372                 return;
373         dismiss_core_update( $update );
374         wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') );
375         exit;
376 }
377
378 function do_undismiss_core_update() {
379         $version = isset( $_POST['version'] )? $_POST['version'] : false;
380         $locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US';
381         $update = find_core_update( $version, $locale );
382         if ( !$update )
383                 return;
384         undismiss_core_update( $version, $locale );
385         wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') );
386         exit;
387 }
388
389 function no_update_actions($actions) {
390         return '';
391 }
392
393 $action = isset($_GET['action']) ? $_GET['action'] : 'upgrade-core';
394
395 $upgrade_error = false;
396 if ( ( 'do-theme-upgrade' == $action || ( 'do-plugin-upgrade' == $action && ! isset( $_GET['plugins'] ) ) )
397         && ! isset( $_POST['checked'] ) ) {
398         $upgrade_error = $action == 'do-theme-upgrade' ? 'themes' : 'plugins';
399         $action = 'upgrade-core';
400 }
401
402 $title = __('WordPress Updates');
403 $parent_file = 'tools.php';
404
405 get_current_screen()->add_help_tab( array(
406 'id'            => 'overview',
407 'title'         => __('Overview'),
408 'content'       =>
409         '<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.') . '</p>' .
410         '<p>' . __('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>'
411 ) );
412
413 get_current_screen()->add_help_tab( array(
414 'id'            => 'how-to-update',
415 'title'         => __('How to Update'),
416 'content'       =>
417         '<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>' .
418         '<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>'
419 ) );
420
421 get_current_screen()->set_help_sidebar(
422         '<p><strong>' . __('For more information:') . '</strong></p>' .
423         '<p>' . __('<a href="http://codex.wordpress.org/Dashboard_Updates_Screen" target="_blank">Documentation on Updating WordPress</a>') . '</p>' .
424         '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
425 );
426
427 if ( 'upgrade-core' == $action ) {
428
429         wp_version_check();
430         require_once(ABSPATH . 'wp-admin/admin-header.php');
431         ?>
432         <div class="wrap">
433         <?php screen_icon('tools'); ?>
434         <h2><?php _e('WordPress Updates'); ?></h2>
435         <?php
436         if ( $upgrade_error ) {
437                 echo '<div class="error"><p>';
438                 if ( $upgrade_error == 'themes' )
439                         _e('Please select one or more themes to update.');
440                 else
441                         _e('Please select one or more plugins to update.');
442                 echo '</p></div>';
443         }
444
445         echo '<p>';
446         /* translators: %1 date, %2 time. */
447         printf( __('Last checked on %1$s at %2$s.'), date_i18n( get_option( 'date_format' ) ), date_i18n( get_option( 'time_format' ) ) );
448         echo ' &nbsp; <a class="button" href="' . esc_url( self_admin_url('update-core.php') ) . '">' . __( 'Check Again' ) . '</a>';
449         echo '</p>';
450
451         if ( current_user_can( 'update_core' ) )
452                 core_upgrade_preamble();
453         if ( current_user_can( 'update_plugins' ) )
454                 list_plugin_updates();
455         if ( current_user_can( 'update_themes' ) )
456                 list_theme_updates();
457         do_action('core_upgrade_preamble');
458         echo '</div>';
459         include(ABSPATH . 'wp-admin/admin-footer.php');
460
461 } elseif ( 'do-core-upgrade' == $action || 'do-core-reinstall' == $action ) {
462
463         if ( ! current_user_can( 'update_core' ) )
464                 wp_die( __( 'You do not have sufficient permissions to update this site.' ) );
465
466         check_admin_referer('upgrade-core');
467
468         // do the (un)dismiss actions before headers,
469         // so that they can redirect
470         if ( isset( $_POST['dismiss'] ) )
471                 do_dismiss_core_update();
472         elseif ( isset( $_POST['undismiss'] ) )
473                 do_undismiss_core_update();
474
475         require_once(ABSPATH . 'wp-admin/admin-header.php');
476         if ( 'do-core-reinstall' == $action )
477                 $reinstall = true;
478         else
479                 $reinstall = false;
480
481         if ( isset( $_POST['upgrade'] ) )
482                 do_core_upgrade($reinstall);
483
484         include(ABSPATH . 'wp-admin/admin-footer.php');
485
486 } elseif ( 'do-plugin-upgrade' == $action ) {
487
488         if ( ! current_user_can( 'update_plugins' ) )
489                 wp_die( __( 'You do not have sufficient permissions to update this site.' ) );
490
491         check_admin_referer('upgrade-core');
492
493         if ( isset( $_GET['plugins'] ) ) {
494                 $plugins = explode( ',', $_GET['plugins'] );
495         } elseif ( isset( $_POST['checked'] ) ) {
496                 $plugins = (array) $_POST['checked'];
497         } else {
498                 wp_redirect( admin_url('update-core.php') );
499                 exit;
500         }
501
502         $url = 'update.php?action=update-selected&plugins=' . urlencode(implode(',', $plugins));
503         $url = wp_nonce_url($url, 'bulk-update-plugins');
504
505         $title = __('Update Plugins');
506
507         require_once(ABSPATH . 'wp-admin/admin-header.php');
508         echo '<div class="wrap">';
509         screen_icon('plugins');
510         echo '<h2>' . esc_html__('Update Plugins') . '</h2>';
511         echo "<iframe src='$url' style='width: 100%; height: 100%; min-height: 750px;' frameborder='0'></iframe>";
512         echo '</div>';
513         include(ABSPATH . 'wp-admin/admin-footer.php');
514
515 } elseif ( 'do-theme-upgrade' == $action ) {
516
517         if ( ! current_user_can( 'update_themes' ) )
518                 wp_die( __( 'You do not have sufficient permissions to update this site.' ) );
519
520         check_admin_referer('upgrade-core');
521
522         if ( isset( $_GET['themes'] ) ) {
523                 $themes = explode( ',', $_GET['themes'] );
524         } elseif ( isset( $_POST['checked'] ) ) {
525                 $themes = (array) $_POST['checked'];
526         } else {
527                 wp_redirect( admin_url('update-core.php') );
528                 exit;
529         }
530
531         $url = 'update.php?action=update-selected-themes&themes=' . urlencode(implode(',', $themes));
532         $url = wp_nonce_url($url, 'bulk-update-themes');
533
534         $title = __('Update Themes');
535
536         require_once(ABSPATH . 'wp-admin/admin-header.php');
537         echo '<div class="wrap">';
538         screen_icon('themes');
539         echo '<h2>' . esc_html__('Update Themes') . '</h2>';
540         echo "<iframe src='$url' style='width: 100%; height: 100%; min-height: 750px;' frameborder='0'></iframe>";
541         echo '</div>';
542         include(ABSPATH . 'wp-admin/admin-footer.php');
543
544 } else {
545         do_action('update-core-custom_' . $action);
546 }