Ticket #15920: 15920-take2.patch
File 15920-take2.patch, 2.8 KB (added by , 15 years ago) |
---|
-
wp-admin/network/themes.php
37 37 check_admin_referer('enable-theme_' . $_GET['theme']); 38 38 $allowed_themes[ $_GET['theme'] ] = true; 39 39 update_site_option( 'allowedthemes', $allowed_themes ); 40 wp_redirect( wp_get_referer() ); // @todo add_query_arg for update message41 exit; 40 wp_redirect( add_query_arg( 'update', 'enabled', wp_get_referer() ) ); 41 exit; 42 42 break; 43 43 case 'disable': 44 44 check_admin_referer('disable-theme_' . $_GET['theme']); 45 45 unset( $allowed_themes[ $_GET['theme'] ] ); 46 46 update_site_option( 'allowedthemes', $allowed_themes ); 47 wp_redirect( wp_get_referer() ); // @todo add_query_arg for update message47 wp_redirect( add_query_arg( 'update', 'disabled', wp_get_referer() ) ); 48 48 exit; 49 49 break; 50 50 case 'enable-selected': 51 51 check_admin_referer('bulk-themes'); 52 52 $themes = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); 53 53 if ( empty($themes) ) { 54 wp_redirect( wp_get_referer() );54 wp_redirect( add_query_arg( 'update', 'error', wp_get_referer() ) ); 55 55 exit; 56 } 56 } 57 57 foreach( (array) $themes as $theme ) 58 58 $allowed_themes[ $theme ] = true; 59 59 update_site_option( 'allowedthemes', $allowed_themes ); … … 62 62 check_admin_referer('bulk-themes'); 63 63 $themes = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); 64 64 if ( empty($themes) ) { 65 wp_redirect( wp_get_referer() );65 wp_redirect( add_query_arg( 'update', 'error', wp_get_referer() ) ); 66 66 exit; 67 } 67 } 68 68 foreach( (array) $themes as $theme ) 69 69 unset( $allowed_themes[ $theme ] ); 70 70 update_site_option( 'allowedthemes', $allowed_themes ); … … 83 83 84 84 $themes = isset( $_REQUEST['checked'] ) ? (array) $_REQUEST['checked'] : array(); 85 85 if ( empty( $themes ) ) { 86 wp_redirect( wp_get_referer() );86 wp_redirect( add_query_arg( 'update', 'error', wp_get_referer() ) ); 87 87 exit; 88 88 } 89 89 … … 195 195 printf( '<span class="subtitle">' . __('Search results for “%s”') . '</span>', esc_html( $s ) ); ?> 196 196 </h2> 197 197 198 <?php 199 if ( isset( $_GET['update'] ) ) { 200 switch ( $_GET['update'] ) { 201 case 'enabled': 202 echo '<div id="message" class="updated"><p>' . __( 'Theme enabled.' ) . '</p></div>'; 203 break; 204 case 'disabled': 205 echo '<div id="message" class="updated"><p>' . __( 'Theme disabled.' ) . '</p></div>'; 206 break; 207 case 'error': 208 echo '<div id="message" class="error"><p>' . __( 'No theme selected.' ) . '</p></div>'; 209 break; 210 } 211 } 212 ?> 213 198 214 <form method="get" action=""> 199 215 <?php $wp_list_table->search_box( __( 'Search Installed Themes' ), 'theme' ); ?> 200 216 </form>