X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/38ca813a0e312e2768e5b9519f0415cd0aa84781..6c8f14c09105d0afa4c1574215c59b5021040e76:/wp-admin/network/themes.php diff --git a/wp-admin/network/themes.php b/wp-admin/network/themes.php index a5196a88..04840ee1 100644 --- a/wp-admin/network/themes.php +++ b/wp-admin/network/themes.php @@ -13,11 +13,6 @@ require_once( './admin.php' ); if ( ! is_multisite() ) wp_die( __( 'Multisite support is not enabled.' ) ); -$menu_perms = get_site_option( 'menu_items', array() ); - -if ( empty( $menu_perms['themes'] ) && ! is_super_admin() ) - wp_die( __( 'Cheatin’ uh?' ) ); - if ( !current_user_can('manage_network_themes') ) wp_die( __( 'You do not have sufficient permissions to manage network themes.' ) ); @@ -34,46 +29,76 @@ $_SERVER['REQUEST_URI'] = remove_query_arg( $temp_args, $_SERVER['REQUEST_URI'] $referer = remove_query_arg( $temp_args, wp_get_referer() ); if ( $action ) { - $allowed_themes = get_site_option( 'allowedthemes' ); + $allowed_themes = get_site_option( 'allowedthemes' ); switch ( $action ) { case 'enable': check_admin_referer('enable-theme_' . $_GET['theme']); $allowed_themes[ $_GET['theme'] ] = true; update_site_option( 'allowedthemes', $allowed_themes ); - wp_redirect( add_query_arg( 'enabled', '1', $referer ) ); + if ( false === strpos( $referer, '/network/themes.php' ) ) + wp_redirect( network_admin_url( 'themes.php?enabled=1' ) ); + else + wp_safe_redirect( add_query_arg( 'enabled', 1, $referer ) ); exit; break; case 'disable': check_admin_referer('disable-theme_' . $_GET['theme']); unset( $allowed_themes[ $_GET['theme'] ] ); update_site_option( 'allowedthemes', $allowed_themes ); - wp_redirect( add_query_arg( 'disabled', '1', $referer ) ); + wp_safe_redirect( add_query_arg( 'disabled', '1', $referer ) ); exit; break; case 'enable-selected': check_admin_referer('bulk-themes'); $themes = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); if ( empty($themes) ) { - wp_redirect( add_query_arg( 'error', 'none', $referer ) ); + wp_safe_redirect( add_query_arg( 'error', 'none', $referer ) ); exit; } foreach( (array) $themes as $theme ) $allowed_themes[ $theme ] = true; update_site_option( 'allowedthemes', $allowed_themes ); - wp_redirect( add_query_arg( 'enabled', count( $themes ), $referer ) ); + wp_safe_redirect( add_query_arg( 'enabled', count( $themes ), $referer ) ); exit; break; case 'disable-selected': check_admin_referer('bulk-themes'); $themes = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); if ( empty($themes) ) { - wp_redirect( add_query_arg( 'error', 'none', $referer ) ); + wp_safe_redirect( add_query_arg( 'error', 'none', $referer ) ); exit; } foreach( (array) $themes as $theme ) unset( $allowed_themes[ $theme ] ); update_site_option( 'allowedthemes', $allowed_themes ); - wp_redirect( add_query_arg( 'disabled', count( $themes ), $referer ) ); + wp_safe_redirect( add_query_arg( 'disabled', count( $themes ), $referer ) ); + exit; + break; + case 'update-selected' : + check_admin_referer( 'bulk-themes' ); + + if ( isset( $_GET['themes'] ) ) + $themes = explode( ',', $_GET['themes'] ); + elseif ( isset( $_POST['checked'] ) ) + $themes = (array) $_POST['checked']; + else + $themes = array(); + + $title = __( 'Update Themes' ); + $parent_file = 'themes.php'; + + require_once(ABSPATH . 'wp-admin/admin-header.php'); + + echo '