Changeset 13918 for trunk/wp-admin/ms-delete-site.php
- Timestamp:
- 04/01/2010 09:21:27 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/ms-delete-site.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/ms-delete-site.php
r13022 r13918 1 1 <?php 2 require_once( 'admin.php');2 require_once( './admin.php' ); 3 3 4 4 if ( !is_multisite() ) 5 wp_die( __( 'Multisite support is not enabled.') );5 wp_die( __( 'Multisite support is not enabled.' ) ); 6 6 7 7 // @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.')); 8 if ( ! current_user_can( 'manage_options' ) ) 9 wp_die(__( 'You do not have sufficient permissions to delete this site.')); 10 11 if ( 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 } 10 19 11 $action = isset( $_POST['action']) ? $_POST['action'] : 'splash';20 $action = isset( $_POST['action'] ) ? $_POST['action'] : 'splash'; 12 21 13 $title = __( 'Delete Blog');22 $title = __( 'Delete Site' ); 14 23 $parent_file = 'tools.php'; 15 require_once( 'admin-header.php');24 require_once( './admin-header.php' ); 16 25 17 26 echo '<div class="wrap">'; 18 27 screen_icon(); 19 echo '<h2>' . esc_html($title) .'</h2>';28 echo '<h2>' . esc_html( $title ) . '</h2>'; 20 29 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 30 if ( 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, 37 You recently clicked the 'Delete Site' link on your site and filled in a 27 38 form on that page. 28 If you really want to delete your blog, click the link below. You will not39 If you really want to delete your site, click the link below. You will not 29 40 be asked to confirm again so only click this link if you are absolutely certain: 30 URL_DELETE 41 ###URL_DELETE### 31 42 32 If you delete your blog, please consider opening a new bloghere33 some time in the future! (But remember your current blogand username43 If you delete your site, please consider opening a new site here 44 some time in the future! (But remember your current site and username 34 45 are gone forever.) 35 46 36 47 Thanks for using the site, 37 48 Webmaster 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 ); 43 55 ?> 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> 45 69 <?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 <?php63 70 } 64 71 echo '</div>'; 65 72 66 include( 'admin-footer.php');73 include( './admin-footer.php' ); 67 74 ?>
Note: See TracChangeset
for help on using the changeset viewer.