Make WordPress Core

Ticket #14385: 14385.patch

File 14385.patch, 4.6 KB (added by Viper007Bond, 15 years ago)

Add mature/unmature actions and do some minor formatting cleanup

  • wp-admin/ms-edit.php

     
    143143                        wp_die( __( 'You do not have permission to access this page.' ) );
    144144
    145145                if ( is_array( $_POST['blog'] ) == false )
    146                         wp_die(  __( 'Can’t create an empty site.' ) );
     146                        wp_die( __( 'Can’t create an empty site.' ) );
    147147                $blog = $_POST['blog'];
    148148                $domain = '';
    149149                if ( ! preg_match( '/(--)/', $blog['domain'] ) && preg_match( '|^([a-zA-Z0-9-])+$|', $blog['domain'] ) )
     
    193193                        if ( !is_super_admin( $user_id ) && get_user_option( 'primary_blog', $user_id ) == $dashboard_blog->blog_id )
    194194                                update_user_option( $user_id, 'primary_blog', $id, true );
    195195                        $content_mail = sprintf( __( "New site created by %1s\n\nAddress: http://%2s\nName: %3s"), $current_user->user_login , $newdomain . $path, stripslashes( $title ) );
    196                         wp_mail( get_site_option('admin_email'),  sprintf( __( '[%s] New Site Created' ), $current_site->site_name ), $content_mail, 'From: "Site Admin" <' . get_site_option( 'admin_email' ) . '>' );
     196                        wp_mail( get_site_option('admin_email'), sprintf( __( '[%s] New Site Created' ), $current_site->site_name ), $content_mail, 'From: "Site Admin" <' . get_site_option( 'admin_email' ) . '>' );
    197197                        wpmu_welcome_notification( $id, $user_id, $password, $title, array( 'public' => 1 ) );
    198198                        wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'add-blog' ), wp_get_referer() ) );
    199199                        exit();
     
    220220                                        $allowedthemes[$theme] = true;
    221221                        }
    222222                }
    223                 update_option( 'allowedthemes',  $allowedthemes );
     223                update_option( 'allowedthemes', $allowedthemes );
    224224
    225225                // options
    226226                if ( is_array( $_POST['option'] ) ) {
     
    241241                // home and siteurl
    242242                if ( isset( $_POST['update_home_url'] ) && $_POST['update_home_url'] == 'update' ) {
    243243                        $blog_address = get_blogaddress_by_domain( $_POST['blog']['domain'], $_POST['blog']['path'] );
    244                         if ( get_option( 'siteurl' ) !=  $blog_address )
     244                        if ( get_option( 'siteurl' ) != $blog_address )
    245245                                update_option( 'siteurl', $blog_address );
    246246
    247247                        if ( get_option( 'home' ) != $blog_address )
     
    435435                exit();
    436436        break;
    437437
     438        case 'unmatureblog':
     439                check_admin_referer( 'unmatureblog' );
     440                if ( ! current_user_can( 'manage_sites' ) )
     441                        wp_die( __( 'You do not have permission to access this page.' ) );
     442
     443                update_blog_status( $id, 'mature', '0' );
     444                wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'unmature' ), wp_get_referer() ) );
     445                exit();
     446        break;
     447
     448        case 'matureblog':
     449                check_admin_referer( 'matureblog' );
     450                if ( ! current_user_can( 'manage_sites' ) )
     451                        wp_die( __( 'You do not have permission to access this page.' ) );
     452
     453                update_blog_status( $id, 'mature', '1' );
     454                wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'mature' ), wp_get_referer() ) );
     455                exit();
     456        break;
     457
    438458        // Themes
    439     case 'updatethemes':
     459        case 'updatethemes':
    440460        if ( ! current_user_can( 'manage_network_themes' ) )
    441461                wp_die( __( 'You do not have permission to access this page.' ) );
    442462
    443         if ( is_array( $_POST['theme'] ) ) {
     463                if ( is_array( $_POST['theme'] ) ) {
    444464                        $themes = get_themes();
    445465                        reset( $themes );
    446466                        $allowed_themes = array();
     
    450470                        }
    451471                        update_site_option( 'allowedthemes', $allowed_themes );
    452472                }
    453                 wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'themes' ),  wp_get_referer() ) );
     473                wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'themes' ), wp_get_referer() ) );
    454474                exit();
    455475        break;
    456476
     
    504524                        echo '<div class="wrap">';
    505525                        confirm_delete_users( $_POST['allusers'] );
    506526                        echo '</div>';
    507             require_once( 'admin-footer.php' );
    508             exit();
     527                        require_once( 'admin-footer.php' );
     528                        exit();
    509529                } else {
    510530                        wp_redirect( admin_url( 'ms-users.php' ) );
    511531                }
     
    531551                                                        echo '<div class="wrap">';
    532552                                                        confirm_delete_users( $_POST['allusers'] );
    533553                                                        echo '</div>';
    534                                             require_once( 'admin-footer.php' );
    535                                             exit();
    536                                         break;
     554                                                        require_once( 'admin-footer.php' );
     555                                                        exit();
     556                                                break;
    537557
    538558                                                case 'spam':
    539559                                                        $user = new WP_User( $val );
     
    617637                $user_id = wpmu_create_user( esc_html( strtolower( $user['username'] ) ), $password, esc_html( $user['email'] ) );
    618638
    619639                if ( false == $user_id )
    620                         wp_die( __( 'Duplicated username or email address.' ) );
     640                        wp_die( __( 'Duplicated username or email address.' ) );
    621641                else
    622642                        wp_new_user_notification( $user_id, $password );
    623643