Ticket #33677: 33677.diff
File 33677.diff, 2.1 KB (added by , 10 years ago) |
---|
-
src/wp-admin/themes.php
9 9 /** WordPress Administration Bootstrap */ 10 10 require_once( dirname( __FILE__ ) . '/admin.php' ); 11 11 12 if ( !current_user_can('switch_themes') && !current_user_can('edit_theme_options') ) 13 wp_die( __( 'Cheatin’ uh?' ), 403 ); 12 if ( ! current_user_can('switch_themes') && ! current_user_can('edit_theme_options') ) { 13 wp_die( 14 '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . 15 '<p>' . __( 'You are not allowed to manage these items.' ) . '</p>', 16 403 ); 17 } 14 18 15 19 if ( current_user_can( 'switch_themes' ) && isset($_GET['action'] ) ) { 16 20 if ( 'activate' == $_GET['action'] ) { 17 21 check_admin_referer('switch-theme_' . $_GET['stylesheet']); 18 22 $theme = wp_get_theme( $_GET['stylesheet'] ); 19 if ( ! $theme->exists() || ! $theme->is_allowed() ) 20 wp_die( __( 'Cheatin’ uh?' ), 403 ); 23 if ( ! $theme->exists() || ! $theme->is_allowed() ) { 24 wp_die( 25 '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . 26 '<p>' . __( 'The requested theme does not exist.' ) . '</p>', 27 403 ); 28 } 21 29 switch_theme( $theme->get_stylesheet() ); 22 30 wp_redirect( admin_url('themes.php?activated=true') ); 23 31 exit; … … 24 32 } elseif ( 'delete' == $_GET['action'] ) { 25 33 check_admin_referer('delete-theme_' . $_GET['stylesheet']); 26 34 $theme = wp_get_theme( $_GET['stylesheet'] ); 27 if ( !current_user_can('delete_themes') || ! $theme->exists() ) 28 wp_die( __( 'Cheatin’ uh?' ), 403 ); 35 if ( ! current_user_can('delete_themes') ) { 36 wp_die( 37 '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . 38 '<p>' . __( 'You are not allowed to delete this item.' ) . '</p>', 39 403 ); 40 } 41 if ( ! $theme->exists() ) { 42 wp_die( 43 '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . 44 '<p>' . __( 'The requested theme does not exist.' ) . '</p>', 45 403 ); 46 } 29 47 $active = wp_get_theme(); 30 48 if ( $active->get( 'Template' ) == $_GET['stylesheet'] ) { 31 49 wp_redirect( admin_url( 'themes.php?delete-active-child=true' ) );