WordPress.org

Make WordPress Core


Ignore:
Timestamp:
04/01/2010 09:21:27 PM (10 years ago)
Author:
markjaquith
Message:

Huge MS refactoring and code cleanup. see #12460. props ocean90.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/ms-delete-site.php

    r13022 r13918  
    11<?php
    2 require_once('admin.php');
     2require_once( './admin.php' );
    33
    44if ( !is_multisite() )
    5     wp_die( __('Multisite support is not enabled.') );
     5    wp_die( __( 'Multisite support is not enabled.' ) );
    66
    77// @todo Create a delete blog cap.
    8 if ( ! current_user_can('manage_options') )
    9     wp_die(__('You do not have sufficient permissions to delete this blog.'));
     8if ( ! current_user_can( 'manage_options' ) )
     9    wp_die(__( 'You do not have sufficient permissions to delete this site.'));
     10   
     11if ( isset( $_GET['h'] ) && $_GET['h'] != '' && get_option( 'delete_blog_hash' ) != false ) {
     12    if ( get_option( 'delete_blog_hash' ) == $_GET['h'] ) {
     13        wpmu_delete_blog( $wpdb->blogid );
     14        wp_die( sprintf( __( 'Thank you for using %s, your site has been deleted. Happy trails to you until we meet again.' ), $current_site->site_name ) );
     15    } else {
     16        wp_die( __( "I'm sorry, the link you clicked is stale. Please select another option." ) );
     17    }
     18}
    1019
    11 $action = isset($_POST['action']) ? $_POST['action'] : 'splash';
     20$action = isset( $_POST['action'] ) ? $_POST['action'] : 'splash';
    1221
    13 $title = __('Delete Blog');
     22$title = __( 'Delete Site' );
    1423$parent_file = 'tools.php';
    15 require_once('admin-header.php');
     24require_once( './admin-header.php' );
    1625
    1726echo '<div class="wrap">';
    1827screen_icon();
    19 echo '<h2>'. esc_html($title) .'</h2>';
     28echo '<h2>' . esc_html( $title ) . '</h2>';
    2029
    21 if ( isset($_POST['action']) && $_POST['action'] == "deleteblog" && isset($_POST['confirmdelete']) && $_POST['confirmdelete'] == '1' ) {
    22     $hash = wp_generate_password(20, false);
    23     update_option( "delete_blog_hash", $hash );
    24     $url_delete = admin_url('ms-delete-site.php?h=' . $hash);
    25     $msg = __("Dear User,
    26 You recently clicked the 'Delete Blog' link on your blog and filled in a
     30if ( isset( $_POST['action'] ) && $_POST['action'] == 'deleteblog' && isset( $_POST['confirmdelete'] ) && $_POST['confirmdelete'] == '1' ) {
     31    $hash = wp_generate_password( 20, false );
     32    update_option( 'delete_blog_hash', $hash );
     33
     34    $url_delete = esc_url( admin_url( 'ms-delete-site.php?h=' . $hash ) );
     35
     36    $content = apply_filters( 'delete_site_email_content', __( "Dear User,
     37You recently clicked the 'Delete Site' link on your site and filled in a
    2738form on that page.
    28 If you really want to delete your blog, click the link below. You will not
     39If you really want to delete your site, click the link below. You will not
    2940be asked to confirm again so only click this link if you are absolutely certain:
    30 URL_DELETE
     41###URL_DELETE###
    3142
    32 If you delete your blog, please consider opening a new blog here
    33 some time in the future! (But remember your current blog and username
     43If you delete your site, please consider opening a new site here
     44some time in the future! (But remember your current site and username
    3445are gone forever.)
    3546
    3647Thanks for using the site,
    3748Webmaster
    38 SITE_NAME
    39 ");
    40     $msg = str_replace( "URL_DELETE", $url_delete, $msg );
    41     $msg = str_replace( "SITE_NAME", $current_site->site_name, $msg );
    42     wp_mail( get_option( "admin_email" ), "[ " . get_option( "blogname" ) . " ] ".__("Delete My Blog"), $msg );
     49###SITE_NAME###" ) );
     50
     51    $content = str_replace( '###URL_DELETE###', $url_delete, $content );
     52    $content = str_replace( '###SITE_NAME###', $current_site->site_name, $content );
     53
     54    wp_mail( get_option( 'admin_email' ), "[ " . get_option( 'blogname' ) . " ] ".__( 'Delete My Site' ), $content );
    4355    ?>
    44     <p><?php _e('Thank you. Please check your email for a link to confirm your action. Your blog will not be deleted until this link is clicked.') ?></p>
     56
     57    <p><?php _e( 'Thank you. Please check your email for a link to confirm your action. Your site will not be deleted until this link is clicked. ') ?></p>
     58
     59<?php } else {
     60    ?>
     61    <p><?php printf( __( 'If you do not want to use your %s site any more, you can delete it using the form below. When you click <strong>Delete My Site Permanently</strong> you will be sent an email with a link in it. Click on this link to delete your site.'), $current_site->site_name); ?></p>
     62    <p><?php _e( 'Remember, once deleted your site cannot be restored.' ) ?></p>
     63
     64    <form method="post" name="deletedirect">
     65        <input type="hidden" name="action" value="deleteblog" />
     66        <p><input id="confirmdelete" type="checkbox" name="confirmdelete" value="1" /> <label for="confirmdelete"><strong><?php printf( __( "I'm sure I want to permanently disable my site, and I am aware I can never get it back or use %s again." ), is_subdomain_install() ? $current_blog->domain : $current_site->domain . $current_site->path ); ?></strong></label></p>
     67        <p class="submit"><input type="submit" value="<?php esc_attr_e( 'Delete My Site Permanently' ) ?>" /></p>
     68    </form>
    4569    <?php
    46 } elseif ( isset( $_GET['h'] ) && $_GET['h'] != '' && get_option('delete_blog_hash') != false ) {
    47     if ( get_option('delete_blog_hash') == $_GET['h'] ) {
    48         wpmu_delete_blog( $wpdb->blogid );
    49         echo "<p>" . sprintf(__('Thank you for using %s, your blog has been deleted. Happy trails to you until we meet again.'), $current_site->site_name) . "</p>";
    50     } else {
    51         echo "<p>" . __("I'm sorry, the link you clicked is stale. Please select another option.") . "</p>";
    52     }
    53 } else {
    54 ?>
    55 <p><?php printf(__('If you do not want to use your %s blog any more, you can delete it using the form below. When you click <strong>Delete My Blog</strong> you will be sent an email with a link in it. Click on this link to delete your blog.'), $current_site->site_name); ?></p>
    56 <p><?php _e('Remember, once deleted your blog cannot be restored.') ?></p>
    57 <form method='post' name='deletedirect'>
    58 <input type='hidden' name='action' value='deleteblog' />
    59 <p><input id='confirmdelete' type='checkbox' name='confirmdelete' value='1' /> <label for='confirmdelete'><strong><?php printf( __("I'm sure I want to permanently disable my blog, and I am aware I can never get it back or use %s again."), $current_blog->domain); ?></strong></label></p>
    60 <p class="submit"><input type='submit' value='<?php esc_attr_e('Delete My Blog Permanently') ?>' /></p>
    61 </form>
    62 <?php
    6370}
    6471echo '</div>';
    6572
    66 include('admin-footer.php');
     73include( './admin-footer.php' );
    6774?>
Note: See TracChangeset for help on using the changeset viewer.