Ticket #14897: 14897.18.diff
| File 14897.18.diff, 2.6 KB (added by , 15 years ago) |
|---|
-
wp-admin/network/site-themes.php
43 43 switch ( $action ) { 44 44 case 'enable': 45 45 $theme = $_GET['theme']; 46 $update = 'enabled'; 46 47 if ( !$allowed_themes ) 47 48 $allowed_themes = array( $theme => true ); 48 49 else … … 50 51 break; 51 52 case 'disable': 52 53 $theme = $_GET['theme']; 54 $update = 'disabled'; 53 55 if ( !$allowed_themes ) 54 56 $allowed_themes = array(); 55 57 else 56 58 unset( $allowed_themes[$theme] ); 57 59 break; 58 60 case 'enable-selected': 59 $themes = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();60 if ( empty($themes) ) {61 restore_current_blog();62 wp_redirect( wp_get_referer() );63 exit;64 } 65 foreach( (array) $themes as $theme )66 $allowed_themes[ $theme ] = true;61 if ( isset( $_POST['checked'] ) ) { 62 $update = 'enable'; 63 $themes = (array) $_POST['checked']; 64 foreach( (array) $themes as $theme ) 65 $allowed_themes[ $theme ] = true; 66 } else { 67 $update = 'error'; 68 } 67 69 break; 68 70 case 'disable-selected': 69 $themes = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();70 if ( empty($themes) ) {71 restore_current_blog();72 wp_redirect( wp_get_referer() );73 exit;74 } 75 foreach( (array) $themes as $theme )76 unset( $allowed_themes[ $theme ] );71 if ( isset( $_POST['checked'] ) ) { 72 $update = 'disable'; 73 $themes = (array) $_POST['checked']; 74 foreach( (array) $themes as $theme ) 75 unset( $allowed_themes[ $theme ] ); 76 } else { 77 $update = 'error'; 78 } 77 79 break; 78 80 } 79 81 80 82 update_option( 'allowedthemes', $allowed_themes ); 81 83 restore_current_blog(); 82 84 83 wp_redirect( wp_get_referer() ); // @todo add_query_arg for update message85 wp_redirect( add_query_arg( 'update', $update, wp_get_referer() ) ); 84 86 exit; 85 87 } 86 88 … … 110 112 echo '<a href="' . $tab['url'] . '?id=' . $id .'" class="nav-tab' . $class . '">' . esc_html( $tab['label'] ) . '</a>'; 111 113 } 112 114 ?> 113 </h3> 115 </h3><?php 116 117 if ( isset( $_GET['update'] ) ) { 118 switch ( $_GET['update'] ) { 119 case 'enabled': 120 echo '<div id="message" class="updated"><p>' . __( 'Theme enabled.' ) . '</p></div>'; 121 break; 122 case 'disabled': 123 echo '<div id="message" class="updated"><p>' . __( 'Theme disabled.' ) . '</p></div>'; 124 break; 125 case 'error': 126 echo '<div id="message" class="error"><p>' . __( 'No theme selected.' ) . '</p></div>'; 127 break; 128 } 129 } ?> 130 114 131 <p><?php _e( 'Network enabled themes are not shown on this screen.' ) ?></p> 115 132 116 133 <form method="get" action="">