<!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>[12830] trunk/wp-admin: Move network screen to the tools menu, See #12027</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12830">12830</a></dd>
<dt>Author</dt> <dd>wpmuguru</dd>
<dt>Date</dt> <dd>2010-01-25 23:07:49 +0000 (Mon, 25 Jan 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Move network screen to the tools menu, See <a href="http://trac.wordpress.org/ticket/12027">#12027</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminmenuphp">trunk/wp-admin/menu.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkwpadminnetworkphp">trunk/wp-admin/network.php</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkwpadminoptionsnetworkphp">trunk/wp-admin/options-network.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 (12829 => 12830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/menu.php        2010-01-25 22:50:36 UTC (rev 12829)
+++ trunk/wp-admin/menu.php        2010-01-25 23:07:49 UTC (rev 12830)
</span><span class="lines">@@ -138,6 +138,8 @@
</span><span class="cx">                 $submenu['tools.php'][20] = array( __('Upgrade'), 'install_plugins',  'update-core.php');
</span><span class="cx">         if ( is_multisite() &amp;&amp; ($current_blog-&gt;domain . $current_blog-&gt;path != $current_site-&gt;domain . $current_site-&gt;path) )
</span><span class="cx">                 $submenu['tools.php'][25] = array( __('Delete Blog'), 'manage_options', 'ms-delete-site.php' );
</span><ins>+        if ( !is_multisite() &amp;&amp; is_super_admin() )
+                $submenu['tools.php'][50] = array(__('Network'), 'manage_options', 'network.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">@@ -149,8 +151,6 @@
</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() &amp;&amp; is_super_admin() )
-                $submenu['options-general.php'][50] = array(__('Network'), 'manage_options', 'options-network.php');
</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="trunkwpadminnetworkphpfromrev12829trunkwpadminoptionsnetworkphp"></a>
<div class="copfile"><h4>Copied: trunk/wp-admin/network.php (from rev 12829, trunk/wp-admin/options-network.php) (0 => 12830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/network.php                                (rev 0)
+++ trunk/wp-admin/network.php        2010-01-25 23:07:49 UTC (rev 12830)
</span><span class="lines">@@ -0,0 +1,306 @@
</span><ins>+&lt;?php
+/**
+ * Network settings administration panel.
+ *
+ * @since 3.0
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
+require_once('./admin.php');
+
+if ( ! is_super_admin() )
+        wp_die(__('You do not have sufficient permissions to manage options for this blog.'));
+
+$title = __('Network Settings');
+$parent_file = 'tools.php';
+
+add_contextual_help($current_screen, __('&lt;a href=&quot;http://codex.wordpress.org/Settings_Network_SubPanel&quot; target=&quot;_blank&quot;&gt;Network Settings&lt;/a&gt;'));
+
+include('./admin-header.php');
+/*
+This option panel does not save data to the options table.
+It contains a multi-step process allowing the user to enable a network of WordPress sites.
+*/
+
+$dirs = array( substr( ABSPATH, 0, -1), ABSPATH . &quot;wp-content&quot; );
+?&gt;
+&lt;div class=&quot;wrap&quot;&gt;
+&lt;?php screen_icon(); ?&gt;
+&lt;h2&gt;&lt;?php echo esc_html( $title ); ?&gt;&lt;/h2&gt;
+
+&lt;form method=&quot;post&quot; action=&quot;network.php&quot;&gt;
+&lt;?php
+function filestats( $err ) {
+?&gt;
+        &lt;h2&gt;&lt;?php esc_html_e('Server Summary'); ?&gt;&lt;/h2&gt;
+        &lt;p&gt;&lt;?php _e('If you post a message to the WordPress support forum at &lt;a target=&quot;_blank&quot; href=&quot;http://wordpress.org/support/&quot;&gt;http://wordpress.org/support/&lt;/a&gt; then copy and paste the following information into your message:'); ?&gt;&lt;/p&gt;
+        &lt;blockquote style=&quot;background: #eee; border: 1px solid #333; padding: 5px;&quot;&gt;
+        &lt;br /&gt;&lt;strong&gt;&lt;?php echo __('ERROR:') . &quot; $err&quot;; ?&gt;&lt;/strong&gt;&lt;br /&gt;
+&lt;?php
+        clearstatcache();
+        $files = array( &quot;htaccess.dist&quot;, &quot;.htaccess&quot; );
+        
+        $indent = '&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;';
+        foreach ( (array) $files as $val ) {
+                $stats = @stat( $val );
+                if( $stats ) {
+?&gt;
+                        &lt;h2&gt;&lt;?php echo esc_html( $val ); ?&gt;&lt;/h2&gt;
+                        &lt;?php echo $indent . sprintf( __('uid/gid: %1$s/%2$s'), $stats[ 'uid' ], $stats[ 'gid' ] ); ?&gt;&lt;br /&gt;
+                        &lt;?php echo $indent . sprintf( __('size: %s'), $stats['size'] ); ?&gt;&lt;br/&gt;
+                        &lt;?php echo $indent . sprintf( __('perms: %s'), substr( sprintf('%o', fileperms( $val ) ), -4 ) ); ?&gt;&lt;br/&gt;
+                        &lt;?php echo $indent . sprintf( __('readable: %s'), is_readable( $val ) ? __('yes') : __('no') ); ?&gt;&lt;br/&gt;
+                        &lt;?php echo $indent . sprintf( __('writeable: %s'), is_writeable( $val ) ? __('yes') : __('no') ); ?&gt;&lt;br/&gt;
+&lt;?php
+                } elseif( ! file_exists( $val ) ) {
+?&gt;
+                        &lt;h2&gt;&lt;?php echo esc_html( $val ); ?&gt;&lt;/h2&gt;
+                        &lt;?php echo $indent . sprintf( __('FILE NOT FOUND: %s'), $val ); ?&gt;&lt;br/&gt;
+&lt;?php
+                }
+        }
+        echo &quot;&lt;/blockquote&gt;&quot;;
+}
+
+function step2_htaccess() {
+        global $base;
+
+        // remove ending slash from $base and $url
+        $htaccess = '';
+        if( substr($base, -1 ) == '/') {
+                $base = substr($base, 0, -1);
+        }
+        $htaccess_sample = ABSPATH . 'wp-admin/includes/htaccess.ms';
+        if ( !file_exists( $htaccess_sample ) )
+                wp_die( sprintf( __('Sorry, I need a %s to work from. Please re-upload this file to your WordPress installation.'), $htaccess_sample ) );
+
+        $htaccess_file = file( $htaccess_sample );
+        $fp = @fopen( $htaccess_sample, &quot;r&quot; );
+        if( $fp ) {
+                while( !feof( $fp ) ) {
+                        $htaccess .= fgets( $fp, 4096 );
+                }
+                fclose( $fp );
+                $htaccess_file = str_replace( &quot;BASE&quot;, $base, $htaccess );
+        } else {
+                wp_die( sprintf( __('Sorry, I need to be able to read %s. Please check the permissions on this file.'), $htaccess_sample ) );
+        }
+
+        //@todo: check for super-cache in use
+?&gt;
+                        &lt;li&gt;&lt;p&gt;&lt;?php _e('Replace the contents of your &lt;code&gt;.htaccess&lt;/code&gt; with the following:'); ?&gt;&lt;/p&gt;
+                                &lt;textarea name=&quot;htaccess&quot; cols=&quot;120&quot; rows=&quot;20&quot;&gt;
+&lt;?php echo $htaccess_file; ?&gt;
+                                &lt;/textarea&gt;
+                        &lt;/li&gt;
+&lt;?php
+}
+
+function step1() {
+        $rewrite_enabled = false;
+        ?&gt;
+        &lt;h2&gt;&lt;?php esc_html_e('Installing Network of WordPress Sites'); ?&gt;&lt;/h2&gt;
+        &lt;p&gt;&lt;?php _e('I will help you enable the features for creating a network of sites by asking you a few questions so that you can create configuration files and make a directory to store all your uploaded files.'); ?&gt;&lt;/p&gt;
+        
+        &lt;h2&gt;&lt;?php esc_html_e('What do I need?'); ?&gt;&lt;/h2&gt;
+        &lt;ul&gt;
+                &lt;li&gt;&lt;?php _e( 'Access to your server to change directory permissions. This can be done through ssh or ftp for example.' ); ?&gt;&lt;/li&gt;
+                &lt;li&gt;&lt;?php _e( 'A valid email where your password and administrative emails will be sent.' ); ?&gt;&lt;/li&gt;
+                &lt;li&gt;&lt;?php _e( &quot;Wildcard dns records if you're going to use the virtual host (sub-domain) functionality. Check the &lt;a href='http://trac.mu.wordpress.org/browser/trunk/README.txt'&gt;README&lt;/a&gt; for further details.&quot;); ?&gt;&lt;/li&gt;
+        &lt;/ul&gt;
+        &lt;?php
+        $mod_rewrite_msg = &quot;\n&lt;p&gt;&quot; . __( &quot;If the &lt;code&gt;mod_rewrite&lt;/code&gt; module is disabled ask your administrator to enable that module, or look at the &lt;a href='http://httpd.apache.org/docs/mod/mod_rewrite.html'&gt;Apache documentation&lt;/a&gt; or &lt;a href='http://www.google.com/search?q=apache+mod_rewrite'&gt;elsewhere&lt;/a&gt; for help setting it up.&quot; ) . '&lt;/p&gt;';
+        
+        if ( function_exists( 'apache_get_modules' ) ) {
+                $modules = apache_get_modules();
+                if ( ! in_array( 'mod_rewrite', $modules ) )
+                        echo '&lt;p&gt;' . __('&lt;strong&gt;Warning!&lt;/strong&gt; It looks like mod_rewrite is not installed.') . '&lt;/p&gt;' . $mod_rewrite_msg;
+                else
+                        $rewrite_enabled = true;
+        } else {
+                echo '&lt;p&gt;' . __( 'Please make sure &lt;code&gt;mod_rewrite&lt;/code&gt; is installed as it will be activated at the end of this install.' ) . '&lt;/p&gt;' . $mod_rewrite_msg;
+        }
+        return $rewrite_enabled;
+}
+
+function printstep1form( $rewrite_enabled = false ) {
+        $weblog_title = sprintf( __('%s Sites'), ucfirst( get_option( 'blogname' ) ) );
+        $email = get_option( 'admin_email' );
+        $hostname = get_clean_basedomain();
+        if( substr( $hostname, 0, 4 ) == 'www.' )
+                $nowww = substr( $hostname, 4 );
+
+        wp_nonce_field( 'install-network-1' );
+        ?&gt;
+                &lt;input type='hidden' name='action' value='step2' /&gt;
+                &lt;h2&gt;&lt;?php esc_html_e( 'Site Addresses' ); ?&gt;&lt;/h2&gt;
+                &lt;p&gt;&lt;?php _e( 'Please choose whether you would like sites in your WordPress install to use sub-domains or sub-directories. You cannot change this later.' ); ?&gt;&lt;/p&gt;
+                &lt;?php if ( !$rewrite_enabled ) { ?&gt;
+                &lt;p&gt;&lt;?php _e( '&lt;strong&gt;Note&lt;/strong&gt; It looks like &lt;code&gt;mod_rewrite&lt;/code&gt; is not installed.'); ?&gt;&lt;/p&gt;
+                &lt;?php } ?&gt;
+                &lt;p class=&quot;blog-address&quot;&gt;
+                        &lt;label&gt;&lt;input type='radio' name='vhost' value='yes'&lt;?php if( $rewrite_enabled ) echo ' checked=&quot;checked&quot;'; ?&gt; /&gt; &lt;?php _e( 'Sub-domains (like &lt;code&gt;blog1.example.com&lt;/code&gt;)' ); ?&gt;&lt;/label&gt;&lt;br /&gt;
+                        &lt;label&gt;&lt;input type='radio' name='vhost' value='no'&lt;?php if( !$rewrite_enabled ) echo ' checked=&quot;checked&quot;'; ?&gt; /&gt; &lt;?php _e( 'Sub-directories (like &lt;code&gt;example.com/blog1&lt;/code&gt;) '); ?&gt;&lt;/label&gt;
+                &lt;/p&gt;
+
+                &lt;h2&gt;&lt;?php esc_html_e( 'Server Address' ); ?&gt;&lt;/h2&gt;
+                &lt;?php if ( isset( $nowww ) ) { ?&gt;
+                &lt;h3&gt;&lt;?php printf( __( 'We recommend you change your siteurl to &lt;code&gt;%1$s&lt;/code&gt; before enabling the network feature. It will still be possible to visit your site using the &quot;www&quot; prefix with an address like &lt;code&gt;%2$s&lt;/code&gt; but any links will not have the &quot;www&quot; prefix.' ), $nowww, $hostname ); ?&gt;&lt;/h3&gt;
+                &lt;?php } ?&gt;
+                &lt;table class=&quot;form-table&quot;&gt;  
+                        &lt;tr&gt; 
+                                &lt;th scope='row'&gt;&lt;?php esc_html_e( 'Server Address' ); ?&gt;&lt;/th&gt; 
+                                &lt;td&gt;
+                                        &lt;p&gt;&lt;?php printf( __( 'This will be the Internet address of your site: &lt;strong&gt;&lt;em&gt;%s&lt;/em&gt;&lt;/strong&gt;.' ), $hostname ); ?&gt;&lt;/p&gt;
+                                        &lt;input type='hidden' name='basedomain' value='&lt;?php echo esc_attr( $hostname ); ?&gt;' /&gt;
+                                        &lt;p&gt;&lt;?php _e( 'Do not use an IP address (like 127.0.0.1) or a single word hostname like &lt;q&gt;localhost&lt;/q&gt; as your server address.' ); ?&gt;&lt;/p&gt;
+                                &lt;/td&gt; 
+                        &lt;/tr&gt;
+                &lt;/table&gt;
+
+                &lt;h2&gt;&lt;?php esc_html_e( 'Site Details' ); ?&gt;&lt;/h2&gt;
+                &lt;table class=&quot;form-table&quot;&gt;  
+                        &lt;tr&gt; 
+                                &lt;th scope='row'&gt;&lt;?php esc_html_e( 'Site&amp;nbsp;Title' ); ?&gt;&lt;/th&gt; 
+                                &lt;td&gt;
+                                        &lt;input name='weblog_title' type='text' size='45' value='&lt;?php echo esc_attr( $weblog_title ); ?&gt;' /&gt;
+                                        &lt;br /&gt;&lt;?php _e( 'What would you like to call your site?' ); ?&gt;
+                                &lt;/td&gt; 
+                        &lt;/tr&gt; 
+                        &lt;tr&gt; 
+                                &lt;th scope='row'&gt;&lt;?php esc_html_e( 'Email' ); ?&gt;&lt;/th&gt; 
+                                &lt;td&gt;
+                                        &lt;input name='email' type='text' size='45' value='&lt;?php echo esc_attr( $email ); ?&gt;' /&gt; 
+                                        &lt;br /&gt;&lt;?php _e( 'Your email address.' ); ?&gt;
+                                &lt;/td&gt; 
+                        &lt;/tr&gt; 
+                &lt;/table&gt; 
+                &lt;p class='submit'&gt;&lt;input class=&quot;button&quot; name='submit' type='submit' value='&lt;?php esc_attr_e( 'Proceed' ); ?&gt;' /&gt;&lt;/p&gt;
+        &lt;?php
+}
+
+function step2() {
+?&gt;
+                &lt;h2&gt;&lt;?php esc_html_e( 'Enabling WordPress Sites' ); ?&gt;&lt;/h2&gt;
+                &lt;p&gt;&lt;?php _e( 'Complete the following steps to enable the features for creating a network of sites. &lt;strong&gt;Note:&lt;/strong&gt; We recommend you make a backup copy of your existing &lt;code&gt;wp-config.php&lt;/code&gt; and &lt;code&gt;.htaccess&lt;/code&gt; files.' ); ?&gt;&lt;/p&gt;
+                &lt;ol&gt;
+                        &lt;li&gt;&lt;?php _e( 'Create a &lt;code&gt;blogs.dir&lt;/code&gt; directory in your &lt;code&gt;wp-content&lt;/code&gt; directory. This directory is used to stored uploaded media for your additional sites and must be writeable by the web server.' ); ?&gt;&lt;/li&gt;
+&lt;?php step2_config(); ?&gt;
+&lt;?php step2_htaccess(); ?&gt;
+                &lt;/ol&gt;
+&lt;?php
+}
+
+function step2_config() {
+        global $base, $wpdb, $vhost;
+
+        $vhost   = stripslashes($_POST['vhost' ]);
+        $prefix  = $wpdb-&gt;base_prefix;
+
+        $config_sample = ABSPATH . 'wp-admin/includes/wp-config.ms';
+        if ( !file_exists( $config_sample ) )
+                wp_die( sprintf( __( 'Sorry, I need a &lt;code&gt;%s&lt;/code&gt; to work from. Please re-upload this file to your WordPress installation.' ), $config_sample ) );
+
+        $wp_config_file = file( $config_sample );
+?&gt;
+                        &lt;li&gt;&lt;p&gt;&lt;?php _e( 'Replace the contents of your &lt;code&gt;wp-config.php&lt;/code&gt; with the following:' ); ?&gt;&lt;/p&gt;
+                                &lt;textarea name=&quot;wp-config&quot; cols=&quot;120&quot; rows=&quot;20&quot;&gt;
+&lt;?php
+        foreach ($wp_config_file as $line) {
+                switch ( trim( substr($line,0,16) ) ) {
+                        case &quot;define('DB_NAME'&quot;:
+                                $output = str_replace(&quot;wordpress&quot;, DB_NAME, $line);
+                                break;
+                        case &quot;define('DB_USER'&quot;:
+                                $output = str_replace(&quot;username&quot;, DB_USER, $line);
+                                break;
+                        case &quot;define('DB_PASSW&quot;:
+                                $output = str_replace(&quot;password&quot;, DB_PASSWORD, $line);
+                                break;
+                        case &quot;define('DB_HOST'&quot;:
+                                $output = str_replace(&quot;localhost&quot;, DB_HOST, $line);
+                                break;
+                        case &quot;define('VHOST',&quot;:
+                                $output = str_replace(&quot;VHOSTSETTING&quot;, $vhost, $line);
+                                break;
+                        case '$table_prefix  =':
+                                $output = str_replace('wp_', $prefix, $line);
+                                break;
+                        case '$base = \'BASE\';':
+                                $output = str_replace('BASE', $base, $line);
+                                break;
+                        case &quot;define('DOMAIN_C&quot;:
+                                $domain = get_clean_basedomain();
+                                $output = str_replace(&quot;current_site_domain&quot;, $domain, $line);
+                                break;
+                        case &quot;define('PATH_CUR&quot;:
+                                $output = str_replace(&quot;current_site_path&quot;, $base, $line);
+                                break;
+                        case &quot;define('AUTH_KEY&quot;:
+                        case &quot;define('AUTH_SAL&quot;:
+                        case &quot;define('LOGGED_I&quot;:
+                        case &quot;define('SECURE_A&quot;:
+                        case &quot;define('NONCE_KE&quot;:
+                                $constant = substr( $line, 8, strpos( $line, &quot;'&quot;, 9 ) - 8 );
+                                if ( defined( $constant ) )
+                                        $hash = constant( $constant );
+                                else
+                                        $hash = md5( mt_rand() ) . md5( mt_rand() );
+                                $output = str_replace('put your unique phrase here', $hash, $line);
+                                break;
+                        default:
+                                $output = $line;
+                                break;
+                }
+                echo $output;
+        }
+?&gt;
+                                &lt;/textarea&gt;
+                        &lt;/li&gt;
+&lt;?php
+}
+
+function get_clean_basedomain() {
+        global $wpdb;
+        $domain = preg_replace( '|https?://|', '', get_option( 'siteurl') );
+        if( strpos( $domain, '/' ) )
+                $domain = substr( $domain, 0, strpos( $domain, '/' ) );
+        return $domain;
+}
+
+$action = isset($_POST[ 'action' ]) ? $_POST[ 'action' ] : null; 
+switch($action) {
+        case &quot;step2&quot;:
+                check_admin_referer( 'install-network-1' );
+                
+                // Install!
+                $base = stripslashes( dirname( dirname($_SERVER[&quot;SCRIPT_NAME&quot;]) ) );
+                if( $base != &quot;/&quot;)
+                        $base .= &quot;/&quot;;
+
+                require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
+                // create network tables
+                $domain = get_clean_basedomain();
+                install_network();
+                populate_network( 1, $domain, sanitize_email( $_POST[ 'email' ] ), $_POST[ 'weblog_title' ], $base, $_POST[ 'vhost' ] );
+                // create wp-config.php / htaccess
+                step2();
+        break;
+        default:
+                //@todo: give an informative screen instead
+                if ( is_multisite() ) {
+                        _e('Network already enabled');
+                } else {
+                        $rewrite_enabled = step1();
+                        printstep1form($rewrite_enabled);
+                }
+        break;
+}
+?&gt;
+&lt;/form&gt;
+&lt;/div&gt;
+
+&lt;?php include('./admin-footer.php'); ?&gt;
</ins></span></pre></div>
<a id="trunkwpadminnetworkphp"></a>
<div class="propset"><h4>Property changes: trunk/wp-admin/network.php</h4>
<pre class="diff"><span>
<span class="cx">Name: svn:mergeinfo
</span><span class="cx">   + 
</span></span></pre></div>
<a id="trunkwpadminoptionsnetworkphp"></a>
<div class="delfile"><h4>Deleted: trunk/wp-admin/options-network.php (12829 => 12830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/options-network.php        2010-01-25 22:50:36 UTC (rev 12829)
+++ trunk/wp-admin/options-network.php        2010-01-25 23:07:49 UTC (rev 12830)
</span><span class="lines">@@ -1,306 +0,0 @@
</span><del>-&lt;?php
-/**
- * Network settings administration panel.
- *
- * @since 3.0
- *
- * @package WordPress
- * @subpackage Administration
- */
-
-/** WordPress Administration Bootstrap */
-require_once('./admin.php');
-
-if ( ! is_super_admin() )
-        wp_die(__('You do not have sufficient permissions to manage options for this blog.'));
-
-$title = __('Network Settings');
-$parent_file = 'options-network.php';
-
-add_contextual_help($current_screen, __('&lt;a href=&quot;http://codex.wordpress.org/Settings_Network_SubPanel&quot; target=&quot;_blank&quot;&gt;Network Settings&lt;/a&gt;'));
-
-include('./admin-header.php');
-/*
-This option panel does not save data to the options table.
-It contains a multi-step process allowing the user to enable a network of WordPress sites.
-*/
-
-$dirs = array( substr( ABSPATH, 0, -1), ABSPATH . &quot;wp-content&quot; );
-?&gt;
-&lt;div class=&quot;wrap&quot;&gt;
-&lt;?php screen_icon(); ?&gt;
-&lt;h2&gt;&lt;?php echo esc_html( $title ); ?&gt;&lt;/h2&gt;
-
-&lt;form method=&quot;post&quot; action=&quot;options-network.php&quot;&gt;
-&lt;?php
-function filestats( $err ) {
-?&gt;
-        &lt;h2&gt;&lt;?php esc_html_e('Server Summary'); ?&gt;&lt;/h2&gt;
-        &lt;p&gt;&lt;?php _e('If you post a message to the WordPress support forum at &lt;a target=&quot;_blank&quot; href=&quot;http://wordpress.org/support/&quot;&gt;http://wordpress.org/support/&lt;/a&gt; then copy and paste the following information into your message:'); ?&gt;&lt;/p&gt;
-        &lt;blockquote style=&quot;background: #eee; border: 1px solid #333; padding: 5px;&quot;&gt;
-        &lt;br /&gt;&lt;strong&gt;&lt;?php echo __('ERROR:') . &quot; $err&quot;; ?&gt;&lt;/strong&gt;&lt;br /&gt;
-&lt;?php
-        clearstatcache();
-        $files = array( &quot;htaccess.dist&quot;, &quot;.htaccess&quot; );
-        
-        $indent = '&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;';
-        foreach ( (array) $files as $val ) {
-                $stats = @stat( $val );
-                if( $stats ) {
-?&gt;
-                        &lt;h2&gt;&lt;?php echo esc_html( $val ); ?&gt;&lt;/h2&gt;
-                        &lt;?php echo $indent . sprintf( __('uid/gid: %1$s/%2$s'), $stats[ 'uid' ], $stats[ 'gid' ] ); ?&gt;&lt;br /&gt;
-                        &lt;?php echo $indent . sprintf( __('size: %s'), $stats['size'] ); ?&gt;&lt;br/&gt;
-                        &lt;?php echo $indent . sprintf( __('perms: %s'), substr( sprintf('%o', fileperms( $val ) ), -4 ) ); ?&gt;&lt;br/&gt;
-                        &lt;?php echo $indent . sprintf( __('readable: %s'), is_readable( $val ) ? __('yes') : __('no') ); ?&gt;&lt;br/&gt;
-                        &lt;?php echo $indent . sprintf( __('writeable: %s'), is_writeable( $val ) ? __('yes') : __('no') ); ?&gt;&lt;br/&gt;
-&lt;?php
-                } elseif( ! file_exists( $val ) ) {
-?&gt;
-                        &lt;h2&gt;&lt;?php echo esc_html( $val ); ?&gt;&lt;/h2&gt;
-                        &lt;?php echo $indent . sprintf( __('FILE NOT FOUND: %s'), $val ); ?&gt;&lt;br/&gt;
-&lt;?php
-                }
-        }
-        echo &quot;&lt;/blockquote&gt;&quot;;
-}
-
-function step2_htaccess() {
-        global $base;
-
-        // remove ending slash from $base and $url
-        $htaccess = '';
-        if( substr($base, -1 ) == '/') {
-                $base = substr($base, 0, -1);
-        }
-        $htaccess_sample = ABSPATH . 'wp-admin/includes/htaccess.ms';
-        if ( !file_exists( $htaccess_sample ) )
-                wp_die( sprintf( __('Sorry, I need a %s to work from. Please re-upload this file to your WordPress installation.'), $htaccess_sample ) );
-
-        $htaccess_file = file( $htaccess_sample );
-        $fp = @fopen( $htaccess_sample, &quot;r&quot; );
-        if( $fp ) {
-                while( !feof( $fp ) ) {
-                        $htaccess .= fgets( $fp, 4096 );
-                }
-                fclose( $fp );
-                $htaccess_file = str_replace( &quot;BASE&quot;, $base, $htaccess );
-        } else {
-                wp_die( sprintf( __('Sorry, I need to be able to read %s. Please check the permissions on this file.'), $htaccess_sample ) );
-        }
-
-        //@todo: check for super-cache in use
-?&gt;
-                        &lt;li&gt;&lt;p&gt;&lt;?php _e('Replace the contents of your &lt;code&gt;.htaccess&lt;/code&gt; with the following:'); ?&gt;&lt;/p&gt;
-                                &lt;textarea name=&quot;htaccess&quot; cols=&quot;120&quot; rows=&quot;20&quot;&gt;
-&lt;?php echo $htaccess_file; ?&gt;
-                                &lt;/textarea&gt;
-                        &lt;/li&gt;
-&lt;?php
-}
-
-function step1() {
-        $rewrite_enabled = false;
-        ?&gt;
-        &lt;h2&gt;&lt;?php esc_html_e('Installing Network of WordPress Sites'); ?&gt;&lt;/h2&gt;
-        &lt;p&gt;&lt;?php _e('I will help you enable the features for creating a network of sites by asking you a few questions so that you can create configuration files and make a directory to store all your uploaded files.'); ?&gt;&lt;/p&gt;
-        
-        &lt;h2&gt;&lt;?php esc_html_e('What do I need?'); ?&gt;&lt;/h2&gt;
-        &lt;ul&gt;
-                &lt;li&gt;&lt;?php _e( 'Access to your server to change directory permissions. This can be done through ssh or ftp for example.' ); ?&gt;&lt;/li&gt;
-                &lt;li&gt;&lt;?php _e( 'A valid email where your password and administrative emails will be sent.' ); ?&gt;&lt;/li&gt;
-                &lt;li&gt;&lt;?php _e( &quot;Wildcard dns records if you're going to use the virtual host (sub-domain) functionality. Check the &lt;a href='http://trac.mu.wordpress.org/browser/trunk/README.txt'&gt;README&lt;/a&gt; for further details.&quot;); ?&gt;&lt;/li&gt;
-        &lt;/ul&gt;
-        &lt;?php
-        $mod_rewrite_msg = &quot;\n&lt;p&gt;&quot; . __( &quot;If the &lt;code&gt;mod_rewrite&lt;/code&gt; module is disabled ask your administrator to enable that module, or look at the &lt;a href='http://httpd.apache.org/docs/mod/mod_rewrite.html'&gt;Apache documentation&lt;/a&gt; or &lt;a href='http://www.google.com/search?q=apache+mod_rewrite'&gt;elsewhere&lt;/a&gt; for help setting it up.&quot; ) . '&lt;/p&gt;';
-        
-        if ( function_exists( 'apache_get_modules' ) ) {
-                $modules = apache_get_modules();
-                if ( ! in_array( 'mod_rewrite', $modules ) )
-                        echo '&lt;p&gt;' . __('&lt;strong&gt;Warning!&lt;/strong&gt; It looks like mod_rewrite is not installed.') . '&lt;/p&gt;' . $mod_rewrite_msg;
-                else
-                        $rewrite_enabled = true;
-        } else {
-                echo '&lt;p&gt;' . __( 'Please make sure &lt;code&gt;mod_rewrite&lt;/code&gt; is installed as it will be activated at the end of this install.' ) . '&lt;/p&gt;' . $mod_rewrite_msg;
-        }
-        return $rewrite_enabled;
-}
-
-function printstep1form( $rewrite_enabled = false ) {
-        $weblog_title = sprintf( __('%s Sites'), ucfirst( get_option( 'blogname' ) ) );
-        $email = get_option( 'admin_email' );
-        $hostname = get_clean_basedomain();
-        if( substr( $hostname, 0, 4 ) == 'www.' )
-                $nowww = substr( $hostname, 4 );
-
-        wp_nonce_field( 'install-network-1' );
-        ?&gt;
-                &lt;input type='hidden' name='action' value='step2' /&gt;
-                &lt;h2&gt;&lt;?php esc_html_e( 'Site Addresses' ); ?&gt;&lt;/h2&gt;
-                &lt;p&gt;&lt;?php _e( 'Please choose whether you would like sites in your WordPress install to use sub-domains or sub-directories. You cannot change this later.' ); ?&gt;&lt;/p&gt;
-                &lt;?php if ( !$rewrite_enabled ) { ?&gt;
-                &lt;p&gt;&lt;?php _e( '&lt;strong&gt;Note&lt;/strong&gt; It looks like &lt;code&gt;mod_rewrite&lt;/code&gt; is not installed.'); ?&gt;&lt;/p&gt;
-                &lt;?php } ?&gt;
-                &lt;p class=&quot;blog-address&quot;&gt;
-                        &lt;label&gt;&lt;input type='radio' name='vhost' value='yes'&lt;?php if( $rewrite_enabled ) echo ' checked=&quot;checked&quot;'; ?&gt; /&gt; &lt;?php _e( 'Sub-domains (like &lt;code&gt;blog1.example.com&lt;/code&gt;)' ); ?&gt;&lt;/label&gt;&lt;br /&gt;
-                        &lt;label&gt;&lt;input type='radio' name='vhost' value='no'&lt;?php if( !$rewrite_enabled ) echo ' checked=&quot;checked&quot;'; ?&gt; /&gt; &lt;?php _e( 'Sub-directories (like &lt;code&gt;example.com/blog1&lt;/code&gt;) '); ?&gt;&lt;/label&gt;
-                &lt;/p&gt;
-
-                &lt;h2&gt;&lt;?php esc_html_e( 'Server Address' ); ?&gt;&lt;/h2&gt;
-                &lt;?php if ( isset( $nowww ) ) { ?&gt;
-                &lt;h3&gt;&lt;?php printf( __( 'We recommend you change your siteurl to &lt;code&gt;%1$s&lt;/code&gt; before enabling the network feature. It will still be possible to visit your site using the &quot;www&quot; prefix with an address like &lt;code&gt;%2$s&lt;/code&gt; but any links will not have the &quot;www&quot; prefix.' ), $nowww, $hostname ); ?&gt;&lt;/h3&gt;
-                &lt;?php } ?&gt;
-                &lt;table class=&quot;form-table&quot;&gt;  
-                        &lt;tr&gt; 
-                                &lt;th scope='row'&gt;&lt;?php esc_html_e( 'Server Address' ); ?&gt;&lt;/th&gt; 
-                                &lt;td&gt;
-                                        &lt;p&gt;&lt;?php printf( __( 'This will be the Internet address of your site: &lt;strong&gt;&lt;em&gt;%s&lt;/em&gt;&lt;/strong&gt;.' ), $hostname ); ?&gt;&lt;/p&gt;
-                                        &lt;input type='hidden' name='basedomain' value='&lt;?php echo esc_attr( $hostname ); ?&gt;' /&gt;
-                                        &lt;p&gt;&lt;?php _e( 'Do not use an IP address (like 127.0.0.1) or a single word hostname like &lt;q&gt;localhost&lt;/q&gt; as your server address.' ); ?&gt;&lt;/p&gt;
-                                &lt;/td&gt; 
-                        &lt;/tr&gt;
-                &lt;/table&gt;
-
-                &lt;h2&gt;&lt;?php esc_html_e( 'Site Details' ); ?&gt;&lt;/h2&gt;
-                &lt;table class=&quot;form-table&quot;&gt;  
-                        &lt;tr&gt; 
-                                &lt;th scope='row'&gt;&lt;?php esc_html_e( 'Site&amp;nbsp;Title' ); ?&gt;&lt;/th&gt; 
-                                &lt;td&gt;
-                                        &lt;input name='weblog_title' type='text' size='45' value='&lt;?php echo esc_attr( $weblog_title ); ?&gt;' /&gt;
-                                        &lt;br /&gt;&lt;?php _e( 'What would you like to call your site?' ); ?&gt;
-                                &lt;/td&gt; 
-                        &lt;/tr&gt; 
-                        &lt;tr&gt; 
-                                &lt;th scope='row'&gt;&lt;?php esc_html_e( 'Email' ); ?&gt;&lt;/th&gt; 
-                                &lt;td&gt;
-                                        &lt;input name='email' type='text' size='45' value='&lt;?php echo esc_attr( $email ); ?&gt;' /&gt; 
-                                        &lt;br /&gt;&lt;?php _e( 'Your email address.' ); ?&gt;
-                                &lt;/td&gt; 
-                        &lt;/tr&gt; 
-                &lt;/table&gt; 
-                &lt;p class='submit'&gt;&lt;input class=&quot;button&quot; name='submit' type='submit' value='&lt;?php esc_attr_e( 'Proceed' ); ?&gt;' /&gt;&lt;/p&gt;
-        &lt;?php
-}
-
-function step2() {
-?&gt;
-                &lt;h2&gt;&lt;?php esc_html_e( 'Enabling WordPress Sites' ); ?&gt;&lt;/h2&gt;
-                &lt;p&gt;&lt;?php _e( 'Complete the following steps to enable the features for creating a network of sites. &lt;strong&gt;Note:&lt;/strong&gt; We recommend you make a backup copy of your existing &lt;code&gt;wp-config.php&lt;/code&gt; and &lt;code&gt;.htaccess&lt;/code&gt; files.' ); ?&gt;&lt;/p&gt;
-                &lt;ol&gt;
-                        &lt;li&gt;&lt;?php _e( 'Create a &lt;code&gt;blogs.dir&lt;/code&gt; directory in your &lt;code&gt;wp-content&lt;/code&gt; directory. This directory is used to stored uploaded media for your additional sites and must be writeable by the web server.' ); ?&gt;&lt;/li&gt;
-&lt;?php step2_config(); ?&gt;
-&lt;?php step2_htaccess(); ?&gt;
-                &lt;/ol&gt;
-&lt;?php
-}
-
-function step2_config() {
-        global $base, $wpdb, $vhost;
-
-        $vhost   = stripslashes($_POST['vhost' ]);
-        $prefix  = $wpdb-&gt;base_prefix;
-
-        $config_sample = ABSPATH . 'wp-admin/includes/wp-config.ms';
-        if ( !file_exists( $config_sample ) )
-                wp_die( sprintf( __( 'Sorry, I need a &lt;code&gt;%s&lt;/code&gt; to work from. Please re-upload this file to your WordPress installation.' ), $config_sample ) );
-
-        $wp_config_file = file( $config_sample );
-?&gt;
-                        &lt;li&gt;&lt;p&gt;&lt;?php _e( 'Replace the contents of your &lt;code&gt;wp-config.php&lt;/code&gt; with the following:' ); ?&gt;&lt;/p&gt;
-                                &lt;textarea name=&quot;wp-config&quot; cols=&quot;120&quot; rows=&quot;20&quot;&gt;
-&lt;?php
-        foreach ($wp_config_file as $line) {
-                switch ( trim( substr($line,0,16) ) ) {
-                        case &quot;define('DB_NAME'&quot;:
-                                $output = str_replace(&quot;wordpress&quot;, DB_NAME, $line);
-                                break;
-                        case &quot;define('DB_USER'&quot;:
-                                $output = str_replace(&quot;username&quot;, DB_USER, $line);
-                                break;
-                        case &quot;define('DB_PASSW&quot;:
-                                $output = str_replace(&quot;password&quot;, DB_PASSWORD, $line);
-                                break;
-                        case &quot;define('DB_HOST'&quot;:
-                                $output = str_replace(&quot;localhost&quot;, DB_HOST, $line);
-                                break;
-                        case &quot;define('VHOST',&quot;:
-                                $output = str_replace(&quot;VHOSTSETTING&quot;, $vhost, $line);
-                                break;
-                        case '$table_prefix  =':
-                                $output = str_replace('wp_', $prefix, $line);
-                                break;
-                        case '$base = \'BASE\';':
-                                $output = str_replace('BASE', $base, $line);
-                                break;
-                        case &quot;define('DOMAIN_C&quot;:
-                                $domain = get_clean_basedomain();
-                                $output = str_replace(&quot;current_site_domain&quot;, $domain, $line);
-                                break;
-                        case &quot;define('PATH_CUR&quot;:
-                                $output = str_replace(&quot;current_site_path&quot;, $base, $line);
-                                break;
-                        case &quot;define('AUTH_KEY&quot;:
-                        case &quot;define('AUTH_SAL&quot;:
-                        case &quot;define('LOGGED_I&quot;:
-                        case &quot;define('SECURE_A&quot;:
-                        case &quot;define('NONCE_KE&quot;:
-                                $constant = substr( $line, 8, strpos( $line, &quot;'&quot;, 9 ) - 8 );
-                                if ( defined( $constant ) )
-                                        $hash = constant( $constant );
-                                else
-                                        $hash = md5( mt_rand() ) . md5( mt_rand() );
-                                $output = str_replace('put your unique phrase here', $hash, $line);
-                                break;
-                        default:
-                                $output = $line;
-                                break;
-                }
-                echo $output;
-        }
-?&gt;
-                                &lt;/textarea&gt;
-                        &lt;/li&gt;
-&lt;?php
-}
-
-function get_clean_basedomain() {
-        global $wpdb;
-        $domain = preg_replace( '|https?://|', '', get_option( 'siteurl') );
-        if( strpos( $domain, '/' ) )
-                $domain = substr( $domain, 0, strpos( $domain, '/' ) );
-        return $domain;
-}
-
-$action = isset($_POST[ 'action' ]) ? $_POST[ 'action' ] : null; 
-switch($action) {
-        case &quot;step2&quot;:
-                check_admin_referer( 'install-network-1' );
-                
-                // Install!
-                $base = stripslashes( dirname( dirname($_SERVER[&quot;SCRIPT_NAME&quot;]) ) );
-                if( $base != &quot;/&quot;)
-                        $base .= &quot;/&quot;;
-
-                require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
-                // create network tables
-                $domain = get_clean_basedomain();
-                install_network();
-                populate_network( 1, $domain, sanitize_email( $_POST[ 'email' ] ), $_POST[ 'weblog_title' ], $base, $_POST[ 'vhost' ] );
-                // create wp-config.php / htaccess
-                step2();
-        break;
-        default:
-                //@todo: give an informative screen instead
-                if ( is_multisite() ) {
-                        _e('Network already enabled');
-                } else {
-                        $rewrite_enabled = step1();
-                        printstep1form($rewrite_enabled);
-                }
-        break;
-}
-?&gt;
-&lt;/form&gt;
-&lt;/div&gt;
-
-&lt;?php include('./admin-footer.php'); ?&gt;
</del></span></pre>
</div>
</div>

</body>
</html>