X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/dc1231b7312fbdca99e9e887cc2bb35a28f85cdc..refs/tags/wordpress-4.4:/wp-admin/themes.php diff --git a/wp-admin/themes.php b/wp-admin/themes.php index 5c007df7..bf65884f 100644 --- a/wp-admin/themes.php +++ b/wp-admin/themes.php @@ -9,23 +9,50 @@ /** WordPress Administration Bootstrap */ require_once( dirname( __FILE__ ) . '/admin.php' ); -if ( !current_user_can('switch_themes') && !current_user_can('edit_theme_options') ) - wp_die( __( 'Cheatin’ uh?' ), 403 ); +if ( ! current_user_can( 'switch_themes' ) && ! current_user_can( 'edit_theme_options' ) ) { + wp_die( + '

' . __( 'Cheatin’ uh?' ) . '

' . + '

' . __( 'You are not allowed to edit theme options on this site.' ) . '

', + 403 + ); +} if ( current_user_can( 'switch_themes' ) && isset($_GET['action'] ) ) { if ( 'activate' == $_GET['action'] ) { check_admin_referer('switch-theme_' . $_GET['stylesheet']); $theme = wp_get_theme( $_GET['stylesheet'] ); - if ( ! $theme->exists() || ! $theme->is_allowed() ) - wp_die( __( 'Cheatin’ uh?' ), 403 ); + + if ( ! $theme->exists() || ! $theme->is_allowed() ) { + wp_die( + '

' . __( 'Cheatin’ uh?' ) . '

' . + '

' . __( 'The requested theme does not exist.' ) . '

', + 403 + ); + } + switch_theme( $theme->get_stylesheet() ); wp_redirect( admin_url('themes.php?activated=true') ); exit; } elseif ( 'delete' == $_GET['action'] ) { check_admin_referer('delete-theme_' . $_GET['stylesheet']); $theme = wp_get_theme( $_GET['stylesheet'] ); - if ( !current_user_can('delete_themes') || ! $theme->exists() ) - wp_die( __( 'Cheatin’ uh?' ), 403 ); + + if ( ! current_user_can( 'delete_themes' ) ) { + wp_die( + '

' . __( 'Cheatin’ uh?' ) . '

' . + '

' . __( 'You are not allowed to delete this item.' ) . '

', + 403 + ); + } + + if ( ! $theme->exists() ) { + wp_die( + '

' . __( 'Cheatin’ uh?' ) . '

' . + '

' . __( 'The requested theme does not exist.' ) . '

', + 403 + ); + } + $active = wp_get_theme(); if ( $active->get( 'Template' ) == $_GET['stylesheet'] ) { wp_redirect( admin_url( 'themes.php?delete-active-child=true' ) ); @@ -225,14 +252,14 @@ foreach ( $themes as $theme ) :
-

+

Active: %s' ), $theme['name'] ); ?> -

+ -

+

@@ -273,6 +300,7 @@ if ( ! is_multisite() && current_user_can('edit_themes') && $broken_themes = wp_ @@ -281,7 +309,9 @@ $can_delete = current_user_can( 'delete_themes' ); - + + + @@ -299,6 +329,22 @@ $can_delete = current_user_can( 'delete_themes' ); errors()->get_error_code() ) { + $parent_theme_name = $broken_theme->get( 'Template' ); + $parent_theme = themes_api( 'theme_information', array( 'slug' => urlencode( $parent_theme_name ) ) ); + + if ( ! is_wp_error( $parent_theme ) ) { + $install_url = add_query_arg( array( + 'action' => 'install-theme', + 'theme' => urlencode( $parent_theme_name ), + ), admin_url( 'update.php' ) ); + $install_url = wp_nonce_url( $install_url, 'install-theme_' . $parent_theme_name ); + ?> + + @@ -327,21 +373,21 @@ $can_delete = current_user_can( 'delete_themes' );
<# if ( data.active ) { #> -

+

Active: %s' ), '{{{ data.name }}}' ); ?> -

+ <# } else { #> -

{{{ data.name }}}

+

{{{ data.name }}}

<# } #>
<# if ( data.active ) { #> <# if ( data.actions.customize ) { #> - + <# } #> <# } else { #> @@ -376,12 +422,12 @@ $can_delete = current_user_can( 'delete_themes' ); <# if ( data.active ) { #> <# } #> -

{{{ data.name }}}

-

+

{{{ data.name }}}

+

<# if ( data.hasUpdate ) { #> -
-

+
+

{{{ data.update }}}
<# } #>