<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[12828] trunk: Move blog deletion to ms-delete-site.php.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12828">12828</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-01-25 22:46:41 +0000 (Mon, 25 Jan 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Move blog deletion to ms-delete-site.php. see <a href="http://trac.wordpress.org/ticket/11644">#11644</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminmenuphp">trunk/wp-admin/menu.php</a></li>
<li><a href="#trunkwpincludesmsfunctionsphp">trunk/wp-includes/ms-functions.php</a></li>
<li><a href="#trunkwpincludespluggablephp">trunk/wp-includes/pluggable.php</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkwpadminmsdeletesitephp">trunk/wp-admin/ms-delete-site.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminmenuphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/menu.php (12827 => 12828)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/menu.php        2010-01-25 22:09:43 UTC (rev 12827)
+++ trunk/wp-admin/menu.php        2010-01-25 22:46:41 UTC (rev 12828)
</span><span class="lines">@@ -136,6 +136,8 @@
</span><span class="cx">         $submenu['tools.php'][15] = array( __('Export'), 'import', 'export.php' );
</span><span class="cx">         if ( is_super_admin() )
</span><span class="cx">                 $submenu['tools.php'][20] = array( __('Upgrade'), 'install_plugins', 'update-core.php');
</span><ins>+        if ( is_multisite() && ($current_blog->domain . $current_blog->path != $current_site->domain . $current_site->path) )
+                $submenu['tools.php'][25] = array( __('Delete Blog'), 'manage_options', 'ms-delete-site.php' );
</ins><span class="cx">
</span><span class="cx"> $menu[80] = array( __('Settings'), 'manage_options', 'options-general.php', '', 'menu-top', 'menu-settings', 'div' );
</span><span class="cx">         $submenu['options-general.php'][10] = array(_x('General', 'settings screen'), 'manage_options', 'options-general.php');
</span><span class="lines">@@ -147,9 +149,8 @@
</span><span class="cx">         $submenu['options-general.php'][40] = array(__('Permalinks'), 'manage_options', 'options-permalink.php');
</span><span class="cx">         if ( is_super_admin() )
</span><span class="cx">                 $submenu['options-general.php'][45] = array(__('Miscellaneous'), 'manage_options', 'options-misc.php');
</span><del>-        if ( !is_multisite() && is_super_admin() ) {
</del><ins>+        if ( !is_multisite() && is_super_admin() )
</ins><span class="cx">                 $submenu['options-general.php'][50] = array(__('Network'), 'manage_options', 'options-network.php');
</span><del>-        }
</del><span class="cx">
</span><span class="cx"> $_wp_last_utility_menu = 80; // The index of the last top-level menu in the utility menu group
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwpadminmsdeletesitephp"></a>
<div class="addfile"><h4>Added: trunk/wp-admin/ms-delete-site.php (0 => 12828)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/ms-delete-site.php         (rev 0)
+++ trunk/wp-admin/ms-delete-site.php        2010-01-25 22:46:41 UTC (rev 12828)
</span><span class="lines">@@ -0,0 +1,63 @@
</span><ins>+<?php
+require_once('admin.php');
+
+if ( !is_multisite() )
+        wp_die( __('Multisite support is not enabled.') );
+
+$action = isset($_POST['action']) ? $_POST['action'] : 'splash';
+
+$title = __('Delete Blog');
+$parent_file = 'tools.php';
+require_once('admin-header.php');
+
+echo '<div class="wrap">';
+screen_icon();
+echo '<h2>'. esc_html($title) .'</h2>';
+
+if ( isset($_POST['action']) && $_POST['action'] == "deleteblog" && isset($_POST['confirmdelete']) && $_POST['confirmdelete'] == '1' ) {
+        $hash = wp_generate_password(20, false);
+        update_option( "delete_blog_hash", $hash );
+        $url_delete = admin_url('ms-delete-site.php?h=' . $hash);
+        $msg = __("Dear User,
+You recently clicked the 'Delete Blog' link on your blog and filled in a
+form on that page.
+If you really want to delete your blog, click the link below. You will not
+be asked to confirm again so only click this link if you are 100% certain:
+URL_DELETE
+
+If you delete your blog, please consider opening a new blog here
+some time in the future! (But remember your current blog and username
+are gone forever.)
+
+Thanks for using the site,
+Webmaster
+SITE_NAME
+");
+        $msg = str_replace( "URL_DELETE", $url_delete, $msg );
+        $msg = str_replace( "SITE_NAME", $current_site->site_name, $msg );
+        wp_mail( get_option( "admin_email" ), "[ " . get_option( "blogname" ) . " ] ".__("Delete My Blog"), $msg );
+        ?>
+        <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>
+        <?php
+} elseif ( isset( $_GET['h'] ) && $_GET['h'] != '' && get_option('delete_blog_hash') != false ) {
+        if ( get_option('delete_blog_hash') == $_GET['h'] ) {
+                wpmu_delete_blog( $wpdb->blogid );
+                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>";
+        } else {
+                echo "<p>" . __("I'm sorry, the link you clicked is stale. Please select another option.") . "</p>";
+        }
+} else {
+?>
+<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>
+<p><?php _e('Remember, once deleted your blog cannot be restored.') ?></p>
+<form method='post' name='deletedirect'>
+<input type='hidden' name='action' value='deleteblog' />
+<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>
+<p class="submit"><input type='submit' value='<?php esc_attr_e('Delete My Blog Permanently') ?>' /></p>
+</form>
+<?php
+}
+echo '</div>';
+
+include('admin-footer.php');
+?>
</ins><span class="cx">\ No newline at end of file
</span><span class="cx">Property changes on: trunk/wp-admin/ms-delete-site.php
</span><span class="cx">___________________________________________________________________
</span><span class="cx">Name: svn:eol-style
</span><span class="cx"> + native
</span></span></pre></div>
<a id="trunkwpincludesmsfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/ms-functions.php (12827 => 12828)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/ms-functions.php        2010-01-25 22:09:43 UTC (rev 12827)
+++ trunk/wp-includes/ms-functions.php        2010-01-25 22:46:41 UTC (rev 12828)
</span><span class="lines">@@ -598,13 +598,13 @@
</span><span class="cx">         $wpdb->update( $wpdb->blogs, array($pref => $value, 'last_updated' => current_time('mysql', true)), array('blog_id' => $blog_id) );
</span><span class="cx">
</span><span class="cx">         if ( $refresh )
</span><del>-                refresh_blog_details($id);
</del><ins>+                refresh_blog_details($blog_id);
</ins><span class="cx">
</span><span class="cx">         if ( $pref == 'spam' ) {
</span><span class="cx">                 if ( $value == 1 )
</span><del>-                        do_action( "make_spam_blog", $id );
</del><ins>+                        do_action( "make_spam_blog", $blog_id );
</ins><span class="cx">                 else
</span><del>-                        do_action( "make_ham_blog", $id );
</del><ins>+                        do_action( "make_ham_blog", $blog_id );
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         return $value;
</span><span class="lines">@@ -1766,83 +1766,6 @@
</span><span class="cx">                 return $size; // default
</span><span class="cx"> }
</span><span class="cx">
</span><del>-/* Delete blog */
-class delete_blog {
-        function delete_blog() {
-                $this->reallydeleteblog = false;
-                add_action('admin_menu', array(&$this, 'admin_menu'));
-                add_action('admin_footer', array(&$this, 'admin_footer'));
-        }
-
-        function admin_footer() {
-                global $wpdb, $current_blog, $current_site;
-                if ( $current_blog->domain . $current_blog->path == $current_site->domain . $current_site->path )
-                        return false;
-
-                if ( $this->reallydeleteblog == true )
-                        wpmu_delete_blog( $wpdb->blogid );
-        }
-
-        function admin_menu() {
-                global $current_blog, $current_site;
-                if ( $current_blog->domain . $current_blog->path != $current_site->domain . $current_site->path )
-                        add_submenu_page('options-general.php', __('Delete Blog'), __('Delete Blog'), 'manage_options', 'delete-blog', array(&$this, 'plugin_content'));
-        }
-
-        function plugin_content() {
-                global $current_blog, $current_site;
-                $this->delete_blog_hash = get_settings('delete_blog_hash');
-                echo '<div class="wrap"><h2>' . __('Delete Blog') . '</h2>';
-                if ( $_POST['action'] == "deleteblog" && $_POST['confirmdelete'] == '1' ) {
-                        $hash = substr( md5( $_SERVER['REQUEST_URI'] . time() ), 0, 6 );
-                        update_option( "delete_blog_hash", $hash );
-                        $url_delete = get_option( "siteurl" ) . "/wp-admin/options-general.php?page=delete-blog&h=" . $hash;
-                        $msg = __("Dear User,
-You recently clicked the 'Delete Blog' link on your blog and filled in a
-form on that page.
-If you really want to delete your blog, click the link below. You will not
-be asked to confirm again so only click this link if you are 100% certain:
-URL_DELETE
-
-If you delete your blog, please consider opening a new blog here
-some time in the future! (But remember your current blog and username
-are gone forever.)
-
-Thanks for using the site,
-Webmaster
-SITE_NAME
-");
-                        $msg = str_replace( "URL_DELETE", $url_delete, $msg );
-                        $msg = str_replace( "SITE_NAME", $current_site->site_name, $msg );
-                        wp_mail( get_option( "admin_email" ), "[ " . get_option( "blogname" ) . " ] ".__("Delete My Blog"), $msg );
-                        ?>
-                        <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>
-                        <?php
-                } elseif ( isset( $_GET['h'] ) && $_GET['h'] != '' && get_option('delete_blog_hash') != false ) {
-                        if ( get_option('delete_blog_hash') == $_GET['h'] ) {
-                                $this->reallydeleteblog = true;
-                                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>";
-                        } else {
-                                $this->reallydeleteblog = false;
-                                echo "<p>" . __("I'm sorry, the link you clicked is stale. Please select another option.") . "</p>";
-                        }
-                } else {
-?>
-                        <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>
-                        <p><?php _e('Remember, once deleted your blog cannot be restored.') ?></p>
-                        <form method='post' name='deletedirect'>
-                        <input type="hidden" name="page" value="<?php echo esc_attr($_GET['page']) ?>" />
-                        <input type='hidden' name='action' value='deleteblog' />
-                        <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>
-                        <p class="submit"><input type='submit' value='<?php esc_attr_e('Delete My Blog Permanently') ?>' /></p>
-                        </form>
-<?php
-                }
-                echo "</div>";
-        }
-}
-$delete_blog_obj = new delete_blog();
-
</del><span class="cx"> /* Global Categories */
</span><span class="cx"> function global_terms( $term_id, $deprecated = '' ) {
</span><span class="cx">         global $wpdb;
</span></span></pre></div>
<a id="trunkwpincludespluggablephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/pluggable.php (12827 => 12828)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/pluggable.php        2010-01-25 22:09:43 UTC (rev 12827)
+++ trunk/wp-includes/pluggable.php        2010-01-25 22:46:41 UTC (rev 12828)
</span><span class="lines">@@ -1791,4 +1791,3 @@
</span><span class="cx">         return $r;
</span><span class="cx"> }
</span><span class="cx"> endif;
</span><del>-
</del></span></pre>
</div>
</div>
</body>
</html>