diff options
| author | matt <matt@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2005-07-12 18:42:08 +0000 |
|---|---|---|
| committer | matt <matt@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2005-07-12 18:42:08 +0000 |
| commit | 2893a90fe1b0498d3a372b4cf4c0bea6ebd6582e (patch) | |
| tree | 6e07e0de6b0e028486a0c031ccc2be1f8d296cce | |
| parent | 756642f1c362d82303a63d116fbac79b871ac39e (diff) | |
| download | wordpress-mu-2893a90fe1b0498d3a372b4cf4c0bea6ebd6582e.tar.gz wordpress-mu-2893a90fe1b0498d3a372b4cf4c0bea6ebd6582e.tar.xz wordpress-mu-2893a90fe1b0498d3a372b4cf4c0bea6ebd6582e.zip | |
Changing how blogs are looked up
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@11 7be80a69-a1ef-0310-a953-fb0f7c49ff36
| -rw-r--r-- | index.php | 784 | ||||
| -rw-r--r-- | wp-inst/mm-newblog.php | 341 | ||||
| -rw-r--r-- | wp-inst/wp-admin/upgrade-schema.php | 749 | ||||
| -rw-r--r-- | wp-inst/wp-includes/wpmu-functions.php | 139 | ||||
| -rw-r--r-- | wp-inst/wp-settings.php | 438 |
5 files changed, 1291 insertions, 1160 deletions
@@ -1,393 +1,391 @@ -<?php -define('WP_INSTALLING', true); - -function printheader() { - print ' -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> - <title>WordPress › Installation</title> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <style media="screen" type="text/css"> - <!-- - html { - background: #eee; - } - body { - background: #fff; - color: #000; - font-family: Georgia, "Times New Roman", Times, serif; - margin-left: 20%; - margin-right: 20%; - padding: .2em 2em; - } - - h1 { - color: #006; - font-size: 18px; - font-weight: lighter; - } - - h2 { - font-size: 16px; - } - - p, li, dt { - line-height: 140%; - padding-bottom: 2px; - } - - ul, ol { - padding: 5px 5px 5px 20px; - } - #logo { - margin-bottom: 2em; - } -.step a, .step input { - font-size: 2em; -} -.step, th { - text-align: right; -} -#footer { -text-align: center; border-top: 1px solid #ccc; padding-top: 1em; font-style: italic; -} -.fakelink { - color: #00a; - text-decoration: underline; -} - --> - </style> -</head> -<body> - -<div align="center"><img src="wp-inst/wp-images/wordpress-mu.png"></div><br> -Welcome to WordPress MU, the Multi User Weblog System built on WordPress.<br><br> -'; -} - -function check_writeable_dir( $dir, $ret ) -{ - if( is_writeable( $dir ) == false ) - { - print $dir." : <b style='color: #f55'>FAILED</b><br>Quick Fix: <code>chmod 777 $dir</code><br>"; - return false; - } - else - { - if( $ret == true ) - { - return true; - } - else - { - return false; - } - } -} - -function do_htaccess( $oldfilename, $newfilename, $realpath, $base, $url ) -{ - // remove ending slash from $base and $url - $htaccess = ''; - if( substr($base, -1 ) == '/') { - $base = substr($base, 0, -1); - } - - if( substr($url, -1 ) == '/') { - $url = substr($url, 0, -1); - } - if( is_file( $oldfilename ) ) - { - $fp = fopen( $oldfilename, "r" ); - if( $fp ) - { - while( !feof( $fp ) ) - { - $htaccess .= fgets( $fp, 4096 ); - } - fclose( $fp ); - $htaccess = str_replace( "REALPATH", $realpath, $htaccess ); - $htaccess = str_replace( "BASE", $base, $htaccess ); - $htaccess = str_replace( "HOST", $url, $htaccess ); - $fp = fopen( $newfilename, "w" ); - fwrite( $fp, $htaccess ); - fclose( $fp ); - } - } -} - -function checkdirs() { - $ret = true; - $ret = check_writeable_dir( dirname(__FILE__), $ret ); - $ret = check_writeable_dir( dirname(__FILE__) . "/wp-inst", $ret ); - $ret = check_writeable_dir( dirname(__FILE__) . "/wp-inst/wp-content/", $ret ); - $ret = check_writeable_dir( dirname(__FILE__) . "/wp-inst/wp-content/smarty-templates", $ret ); - - if( $ret == false ) - { - print "<h2>Warning!</h2>"; - print "<div style='border: 1px solid #ccc'>"; - print "<p style='font-weight: bold; padding-left: 10px'>One or more of the above directories must be made writeable by the webserver.<br>"; - print "Please <code>chmod 777 <q>directory-name</q></code> or <code>chown</code> that directory to the user the web server runs as (usually nobody, apache, or www-data)<br>"; - print "Refresh this page when you're done!<br></p>"; - print "</div>"; - } - - return $ret; -} - -function step1() { - print "You're probably seeing this message because you're installing WPMU!<br><br>"; - print "If it's already installed, then <b>mod_rewrite</b> is disabled. Ask your administrator to enable that module, or look at the <a href='http://httpd.apache.org/docs/mod/mod_rewrite.html'>Apache documentation</a> or <a href='http://www.google.com/search?q=apache+mod_rewrite'>elsewhere</a> for help setting it up.<br><br>"; - if( checkdirs() == false ) { - return false; - } - - // Create default template cache dirs - @mkdir( dirname(__FILE__) . "/wp-inst/wp-content/smarty-cache" , 0777 ); - @mkdir( dirname(__FILE__) . "/wp-inst/wp-content/smarty-templates_c" , 0777 ); - - // Create Blogs living area. - @mkdir( dirname(__FILE__) . "/wp-inst/wp-content/blogs.dir", 0777 ); - - - $url = "http://".$_SERVER["SERVER_NAME"] . dirname( $_SERVER[ "SCRIPT_NAME" ] ); - if( substr( $url, -1 ) == '/' ) - $url = substr( $url, 0, -1 ); - $base = dirname( $_SERVER["SCRIPT_NAME"] ); - if( $base == "/") - { - $base = ""; - } - $realpath = dirname(__FILE__); - - if( is_file( dirname(__FILE__) . "./wp-inst/wpmu-settings.php" ) == false ) - { - $configfile = ''; - $fp = fopen( "./wp-inst/wpmu-settings.php.dist", "r" ); - if( $fp ) - { - while( !feof( $fp ) ) - { - $configfile .= fgets( $fp, 4096 ); - } - fclose( $fp ); - } - $configfile = str_replace( "BASE", $base."/", $configfile ); - $fp = fopen( "./wp-inst/wpmu-settings.php", "w" ); - fwrite( $fp, $configfile ); - fclose( $fp ); - } - return true; -} - -function printstep1form( $dbname = 'wordpress', $uname = 'username', $pwd = 'password', $dbhost = 'localhost', $prefix = 'wp_' ) { - print " - <form method='post' action='index.php'> - <input type='hidden' name='action' value='step2'> - <h1>Virtual Server Support</h1> - <p><strong>Do you want to enable virtual server support? Yes <input type='radio' name='vhost' value='yes'> No <input type='radio' name='vhost' value='no' checked></strong></p> - <p>If you do, your blog addresses will appear like <span class='fakelink'>http://joesblog.example.com/</span> instead of <span class='fakelink'>http://www.example.com/joesblog/</span> but you need to do a few more things to Apache and your DNS settings before it'll work.<br /> - If this is your first time installing WPMU then leave this at <em>No</em>.</p> - <br /> - <h1>Database</h1> -<p>We need some information on the database. You will need to know the following items before proceeding.</p> -<ol> - <li>Database name</li> - <li>Database username</li> - <li>Database password</li> - <li>Database host</li> - <li>Table prefix (if you want to run more than one WordPress in a single database) </li> -</ol> -<p><strong>If for any reason this automatic file creation doesn't work, don't worry. All this does is fill in the database information to a configuration file. You may also simply open <code>wp-config-sample.php</code> in a text editor, fill in your information, and save it as <code>wp-config.php</code>. </strong></p> - - <p>Below you should enter your database connection details. If you're not sure about these, contact your host. </p> - <table> - <tr> - <th scope='row'>Database Name</th> - <td><input name='dbname' type='text' size='45' value='".$dbname."' /></td> - <td>The name of the database you want to run WP in. </td> - </tr> - <tr> - <th scope='row'>User Name</th> - <td><input name='uname' type='text' size='45' value='".$uname."' /></td> - <td>Your MySQL username</td> - </tr> - <tr> - <th scope='row'>Password</th> - <td><input name='pwd' type='text' size='45' value='".$pwd."' /></td> - <td>...and MySQL password.</td> - </tr> - <tr> - <th scope='row'>Database Host</th> - <td><input name='dbhost' type='text' size='45' value='".$dbhost."' /></td> - <td>99% chance you won't need to change this value.</td> - </tr> - <tr> - <th scope='row'>Table Prefix</th> - <td><input name='prefix' type='text' id='prefix' value='".$prefix."' size='45' /></td> - <td>If you want to run multiple WordPress installations in a single database, change this.</td> - </tr> - </table> - <input name='submit' type='submit' value='Submit' /> -</form> "; -} - -function step2() { - $dbname = $_POST['dbname']; - $uname = $_POST['uname']; - $passwrd = $_POST['pwd']; - $dbhost = $_POST['dbhost']; - $vhost = $_POST['vhost' ]; - $prefix = $_POST['prefix']; - if (empty($prefix)) $prefix = 'wp_'; - - // Test the db connection. - define('DB_NAME', $dbname); - define('DB_USER', $uname); - define('DB_PASSWORD', $passwrd); - define('DB_HOST', $dbhost); - - if (!file_exists('wp-inst/wp-config-sample.php')) - die('Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.'); - - $configFile = file('wp-inst/wp-config-sample.php'); - // We'll fail here if the values are no good. - require_once('wp-inst/wp-includes/wp-db.php'); - printheader(); - - print "Creating Database Config File: "; - - $handle = fopen('wp-inst/wp-config.php', 'w'); - - foreach ($configFile as $line_num => $line) { - switch (substr($line,0,16)) { - case "define('DB_NAME'": - fwrite($handle, str_replace("wordpress", $dbname, $line)); - break; - case "define('DB_USER'": - fwrite($handle, str_replace("'username'", "'$uname'", $line)); - break; - case "define('DB_PASSW": - fwrite($handle, str_replace("'password'", "'$passwrd'", $line)); - break; - case "define('DB_HOST'": - fwrite($handle, str_replace("localhost", $dbhost, $line)); - break; - case "define('VHOST', ": - fwrite($handle, str_replace("VHOSTSETTING", $vhost, $line)); - break; - case '$table_prefix =': - fwrite($handle, str_replace('wp_', $prefix, $line)); - break; - default: - fwrite($handle, $line); - } - } - fclose($handle); - chmod('wp-inst/wp-config.php', 0666); - print "<b style='color: #00aa00; font-weight: bold'>DONE</b><br />"; -} - -function printuserdetailsform( $weblog_title = 'My new Blog', $username = '', $email = '' ) { - print " - <form method='post' action='index.php'> - <input type='hidden' name='action' value='step3'> - <p>To finish setting up your blog, please fill in the folling form and click <q>Submit</q>.</p> - <table width='100%'> - <tr> - <th scope='row'>Weblog Title</th> - <td><input name='weblog_title' type='text' size='45' value='".$weblog_title."' /></td> - <td>What would you like to call your weblog? </td> - </tr> - <tr> - <th scope='row'>Email</th> - <td><input name='email' type='text' size='45' value='".$email."' /></td> - <td>Your email address.</td> - </tr> - </table> - <input name='submit' type='submit' value='Submit' /> - </form> - <br /> - You will be sent an email with your password and login links and details."; -} - -function step3() { - global $wpdb; - $base = dirname( $_SERVER["SCRIPT_NAME"] ); - $domain = $_SERVER[ 'HTTP_HOST' ]; - if( substr_count( $_SERVER["HTTP_HOST"], '.' ) > 1 ) { - $domain = substr( $_SERVER["HTTP_HOST"], strpos( $_SERVER["HTTP_HOST"], '.' ) + 1 ); - } - - $hostname = $_SERVER["HTTP_HOST"]; - - $email = $wpdb->escape( $_POST[ 'email' ] ); - $weblog_title = $wpdb->escape( $_POST[ 'weblog_title' ] ); - - // set up site tables - $query = "INSERT INTO wp_sitemeta (meta_id, site_id, meta_key, meta_value) VALUES (1, 1, 'admin_email', '".$email."')"; - $wpdb->query( $query ); - $query = "INSERT INTO wp_sitemeta (meta_id, site_id, meta_key, meta_value) VALUES (2, 1, 'admin_user_id', '1')"; - $wpdb->query( $query ); - - $res = createBlog( $hostname, $domain, $base, 'main', $weblog_title, $email, 'admin' ); - if( $res == 'ok' ) { - if( $base == '/' ) { - $url = "http://".$_SERVER["HTTP_HOST"] . '/'; - } else { - $url = "http://".$_SERVER["HTTP_HOST"] . $base . '/'; - } - $realpath = dirname(__FILE__); - do_htaccess( "htaccess.dist", ".htaccess", $realpath, $base, $url ); - do_htaccess( "wp-inst/htaccess.dist", "wp-inst/.htaccess", $realpath, $base, $url ); - - print "<p>Well Done! Your blog has been set up and you have been sent details of your login and password in an email.</p>"; - print "<p>You may view your new blog by visiting <a href='".$url."'>".$url."</a>!</p>"; - } else { - if( $res == 'error: problem creating blog entry' ) { - print "The <q>main</q> blog has already been created. Edit your blogs table and delete the entry for this domain!"; - } elseif( $res == 'error: username used' ) { - print "The username you chose is already in use, please select another one."; - } - print "<br>result: $res<br>"; - printuserdetailsform( $_POST[ 'weblog_title' ], $_POST[ 'username' ], $_POST[ 'email' ] ); - } -} - -switch( $_POST[ 'action' ] ) { - case "step2": - // get blog username - // create wp-inst/wp-config.php - step2(); - printuserdetailsform(); - break; - case "step3": - // call createBlog(); - // create .htaccess - // print login info and links. - require_once('./wp-inst/wp-config.php'); - require_once('./wp-inst/wp-admin/upgrade-functions.php'); - make_db_current_silent(); - populate_options(); - printheader(); - step3(); - break; - default: - // check that directories are writeable. - // create wp-inst/wpmu-settings.php - // get db auth info. - printheader(); - if( step1() ) { - printstep1form(); - } - break; -} -?> -<br /><br /> -<div align='center'> -<a href="http://mu.wordpress.org/">WPMU</a> | <a href="http://mu.wordpress.org/forums/">Support Forums</a> -</div> -</body> -</html> +<?php
+define('WP_INSTALLING', true);
+
+function printheader() {
+ print '
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>WordPress › Installation</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <style media="screen" type="text/css">
+ <!--
+ html {
+ background: #eee;
+ }
+ body {
+ background: #fff;
+ color: #000;
+ font-family: Georgia, "Times New Roman", Times, serif;
+ margin-left: 20%;
+ margin-right: 20%;
+ padding: .2em 2em;
+ }
+
+ h1 {
+ color: #006;
+ font-size: 18px;
+ font-weight: lighter;
+ }
+
+ h2 {
+ font-size: 16px;
+ }
+
+ p, li, dt {
+ line-height: 140%;
+ padding-bottom: 2px;
+ }
+
+ ul, ol {
+ padding: 5px 5px 5px 20px;
+ }
+ #logo {
+ margin-bottom: 2em;
+ }
+.step a, .step input {
+ font-size: 2em;
+}
+.step, th {
+ text-align: right;
+}
+#footer {
+text-align: center; border-top: 1px solid #ccc; padding-top: 1em; font-style: italic;
+}
+.fakelink {
+ color: #00a;
+ text-decoration: underline;
+}
+ -->
+ </style>
+</head>
+<body>
+
+<div align="center"><img src="wp-inst/wp-images/wordpress-mu.png"></div><br>
+Welcome to WordPress MU, the Multi User Weblog System built on WordPress.<br><br>
+';
+}
+
+function check_writeable_dir( $dir, $ret )
+{
+ if( is_writeable( $dir ) == false )
+ {
+ print $dir." : <b style='color: #f55'>FAILED</b><br>Quick Fix: <code>chmod 777 $dir</code><br>";
+ return false;
+ }
+ else
+ {
+ if( $ret == true )
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+}
+
+function do_htaccess( $oldfilename, $newfilename, $realpath, $base, $url )
+{
+ // remove ending slash from $base and $url
+ $htaccess = '';
+ if( substr($base, -1 ) == '/') {
+ $base = substr($base, 0, -1);
+ }
+
+ if( substr($url, -1 ) == '/') {
+ $url = substr($url, 0, -1);
+ }
+ if( is_file( $oldfilename ) )
+ {
+ $fp = fopen( $oldfilename, "r" );
+ if( $fp )
+ {
+ while( !feof( $fp ) )
+ {
+ $htaccess .= fgets( $fp, 4096 );
+ }
+ fclose( $fp );
+ $htaccess = str_replace( "REALPATH", $realpath, $htaccess );
+ $htaccess = str_replace( "BASE", $base, $htaccess );
+ $htaccess = str_replace( "HOST", $url, $htaccess );
+ $fp = fopen( $newfilename, "w" );
+ fwrite( $fp, $htaccess );
+ fclose( $fp );
+ }
+ }
+}
+
+function checkdirs() {
+ $ret = true;
+ $ret = check_writeable_dir( dirname(__FILE__), $ret );
+ $ret = check_writeable_dir( dirname(__FILE__) . "/wp-inst", $ret );
+ $ret = check_writeable_dir( dirname(__FILE__) . "/wp-inst/wp-content/", $ret );
+ $ret = check_writeable_dir( dirname(__FILE__) . "/wp-inst/wp-content/smarty-templates", $ret );
+
+ if( $ret == false )
+ {
+ print "<h2>Warning!</h2>";
+ print "<div style='border: 1px solid #ccc'>";
+ print "<p style='font-weight: bold; padding-left: 10px'>One or more of the above directories must be made writeable by the webserver.<br>";
+ print "Please <code>chmod 777 <q>directory-name</q></code> or <code>chown</code> that directory to the user the web server runs as (usually nobody, apache, or www-data)<br>";
+ print "Refresh this page when you're done!<br></p>";
+ print "</div>";
+ }
+
+ return $ret;
+}
+
+function step1() {
+ print "You're probably seeing this message because you're installing WPMU!<br><br>";
+ print "If it's already installed, then <b>mod_rewrite</b> is disabled. Ask your administrator to enable that module, or look at the <a href='http://httpd.apache.org/docs/mod/mod_rewrite.html'>Apache documentation</a> or <a href='http://www.google.com/search?q=apache+mod_rewrite'>elsewhere</a> for help setting it up.<br><br>";
+ if( checkdirs() == false ) {
+ return false;
+ }
+
+ // Create default template cache dirs
+ @mkdir( dirname(__FILE__) . "/wp-inst/wp-content/smarty-cache" , 0777 );
+ @mkdir( dirname(__FILE__) . "/wp-inst/wp-content/smarty-templates_c" , 0777 );
+
+ // Create Blogs living area.
+ @mkdir( dirname(__FILE__) . "/wp-inst/wp-content/blogs.dir", 0777 );
+
+
+ $url = "http://".$_SERVER["SERVER_NAME"] . dirname( $_SERVER[ "SCRIPT_NAME" ] );
+ if( substr( $url, -1 ) == '/' )
+ $url = substr( $url, 0, -1 );
+ $base = dirname( $_SERVER["SCRIPT_NAME"] );
+ if( $base == "/")
+ {
+ $base = "";
+ }
+ $realpath = dirname(__FILE__);
+
+ if( is_file( dirname(__FILE__) . "./wp-inst/wpmu-settings.php" ) == false )
+ {
+ $configfile = '';
+ $fp = fopen( "./wp-inst/wpmu-settings.php.dist", "r" );
+ if( $fp )
+ {
+ while( !feof( $fp ) )
+ {
+ $configfile .= fgets( $fp, 4096 );
+ }
+ fclose( $fp );
+ }
+ $configfile = str_replace( "BASE", $base."/", $configfile );
+ $fp = fopen( "./wp-inst/wpmu-settings.php", "w" );
+ fwrite( $fp, $configfile );
+ fclose( $fp );
+ }
+ return true;
+}
+
+function printstep1form( $dbname = 'wordpress', $uname = 'username', $pwd = 'password', $dbhost = 'localhost', $prefix = 'wp_' ) {
+ print "
+ <form method='post' action='index.php'>
+ <input type='hidden' name='action' value='step2'>
+ <h1>Virtual Server Support</h1>
+ <p><strong>Do you want to enable virtual server support? Yes <input type='radio' name='vhost' value='yes'> No <input type='radio' name='vhost' value='no' checked></strong></p>
+ <p>If you do, your blog addresses will appear like <span class='fakelink'>http://joesblog.example.com/</span> instead of <span class='fakelink'>http://www.example.com/joesblog/</span> but you need to do a few more things to Apache and your DNS settings before it'll work.<br />
+ If this is your first time installing WPMU then leave this at <em>No</em>.</p>
+ <br />
+ <h1>Database</h1>
+<p>We need some information on the database. You will need to know the following items before proceeding.</p>
+<ol>
+ <li>Database name</li>
+ <li>Database username</li>
+ <li>Database password</li>
+ <li>Database host</li>
+ <li>Table prefix (if you want to run more than one WordPress in a single database) </li>
+</ol>
+<p><strong>If for any reason this automatic file creation doesn't work, don't worry. All this does is fill in the database information to a configuration file. You may also simply open <code>wp-config-sample.php</code> in a text editor, fill in your information, and save it as <code>wp-config.php</code>. </strong></p>
+
+ <p>Below you should enter your database connection details. If you're not sure about these, contact your host. </p>
+ <table>
+ <tr>
+ <th scope='row'>Database Name</th>
+ <td><input name='dbname' type='text' size='45' value='".$dbname."' /></td>
+ <td>The name of the database you want to run WP in. </td>
+ </tr>
+ <tr>
+ <th scope='row'>User Name</th>
+ <td><input name='uname' type='text' size='45' value='".$uname."' /></td>
+ <td>Your MySQL username</td>
+ </tr>
+ <tr>
+ <th scope='row'>Password</th>
+ <td><input name='pwd' type='text' size='45' value='".$pwd."' /></td>
+ <td>...and MySQL password.</td>
+ </tr>
+ <tr>
+ <th scope='row'>Database Host</th>
+ <td><input name='dbhost' type='text' size='45' value='".$dbhost."' /></td>
+ <td>99% chance you won't need to change this value.</td>
+ </tr>
+ <tr>
+ <th scope='row'>Table Prefix</th>
+ <td><input name='prefix' type='text' id='prefix' value='".$prefix."' size='45' /></td>
+ <td>If you want to run multiple WordPress installations in a single database, change this.</td>
+ </tr>
+ </table>
+ <input name='submit' type='submit' value='Submit' />
+</form> ";
+}
+
+function step2() {
+ $dbname = $_POST['dbname'];
+ $uname = $_POST['uname'];
+ $passwrd = $_POST['pwd'];
+ $dbhost = $_POST['dbhost'];
+ $vhost = $_POST['vhost' ];
+ $prefix = $_POST['prefix'];
+ if (empty($prefix)) $prefix = 'wp_';
+
+ // Test the db connection.
+ define('DB_NAME', $dbname);
+ define('DB_USER', $uname);
+ define('DB_PASSWORD', $passwrd);
+ define('DB_HOST', $dbhost);
+
+ if (!file_exists('wp-inst/wp-config-sample.php'))
+ die('Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.');
+
+ $configFile = file('wp-inst/wp-config-sample.php');
+ // We'll fail here if the values are no good.
+ require_once('wp-inst/wp-includes/wp-db.php');
+ printheader();
+
+ print "Creating Database Config File: ";
+
+ $handle = fopen('wp-inst/wp-config.php', 'w');
+
+ foreach ($configFile as $line_num => $line) {
+ switch (substr($line,0,16)) {
+ case "define('DB_NAME'":
+ fwrite($handle, str_replace("wordpress", $dbname, $line));
+ break;
+ case "define('DB_USER'":
+ fwrite($handle, str_replace("'username'", "'$uname'", $line));
+ break;
+ case "define('DB_PASSW":
+ fwrite($handle, str_replace("'password'", "'$passwrd'", $line));
+ break;
+ case "define('DB_HOST'":
+ fwrite($handle, str_replace("localhost", $dbhost, $line));
+ break;
+ case "define('VHOST', ":
+ fwrite($handle, str_replace("VHOSTSETTING", $vhost, $line));
+ break;
+ case '$table_prefix =':
+ fwrite($handle, str_replace('wp_', $prefix, $line));
+ break;
+ default:
+ fwrite($handle, $line);
+ }
+ }
+ fclose($handle);
+ chmod('wp-inst/wp-config.php', 0666);
+ print "<b style='color: #00aa00; font-weight: bold'>DONE</b><br />";
+}
+
+function printuserdetailsform( $weblog_title = 'My new Blog', $username = '', $email = '' ) {
+ print "
+ <form method='post' action='index.php'>
+ <input type='hidden' name='action' value='step3'>
+ <p>To finish setting up your blog, please fill in the folling form and click <q>Submit</q>.</p>
+ <table width='100%'>
+ <tr>
+ <th scope='row'>Weblog Title</th>
+ <td><input name='weblog_title' type='text' size='45' value='".$weblog_title."' /></td>
+ <td>What would you like to call your weblog? </td>
+ </tr>
+ <tr>
+ <th scope='row'>Email</th>
+ <td><input name='email' type='text' size='45' value='".$email."' /></td>
+ <td>Your email address.</td>
+ </tr>
+ </table>
+ <input name='submit' type='submit' value='Submit' />
+ </form>
+ <br />
+ You will be sent an email with your password and login links and details.";
+}
+
+function step3() {
+ global $wpdb;
+ $base = dirname( $_SERVER["SCRIPT_NAME"] );
+ $domain = $_SERVER[ 'HTTP_HOST' ];
+
+ $hostname = $_SERVER["HTTP_HOST"];
+
+ $email = $wpdb->escape( $_POST[ 'email' ] );
+ $weblog_title = $wpdb->escape( $_POST[ 'weblog_title' ] );
+
+ // set up site tables
+ $query = "INSERT INTO wp_sitemeta (meta_id, site_id, meta_key, meta_value) VALUES (1, 1, 'admin_email', '".$email."')";
+ $wpdb->query( $query );
+ $query = "INSERT INTO wp_sitemeta (meta_id, site_id, meta_key, meta_value) VALUES (2, 1, 'admin_user_id', '1')";
+ $wpdb->query( $query );
+
+
+ $res = create_blog( $domain, $base, 'admin', $weblog_title, $email);
+ if( $res == 'ok' ) {
+ if( $base == '/' ) {
+ $url = "http://".$_SERVER["HTTP_HOST"] . '/';
+ } else {
+ $url = "http://".$_SERVER["HTTP_HOST"] . $base . '/';
+ }
+ $realpath = dirname(__FILE__);
+ do_htaccess( "htaccess.dist", ".htaccess", $realpath, $base, $url );
+ do_htaccess( "wp-inst/htaccess.dist", "wp-inst/.htaccess", $realpath, $base, $url );
+
+ print "<p>Well Done! Your blog has been set up and you have been sent details of your login and password in an email.</p>";
+ print "<p>You may view your new blog by visiting <a href='".$url."'>".$url."</a>!</p>";
+ } else {
+ if( $res == 'error: problem creating blog entry' ) {
+ print "The <q>main</q> blog has already been created. Edit your blogs table and delete the entry for this domain!";
+ } elseif( $res == 'error: username used' ) {
+ print "The username you chose is already in use, please select another one.";
+ }
+ print "<br>result: $res<br>";
+ printuserdetailsform( $_POST[ 'weblog_title' ], $_POST[ 'username' ], $_POST[ 'email' ] );
+ }
+}
+
+switch( $_POST[ 'action' ] ) {
+ case "step2":
+ // get blog username
+ // create wp-inst/wp-config.php
+ step2();
+ printuserdetailsform();
+ break;
+ case "step3":
+ // call createBlog();
+ // create .htaccess
+ // print login info and links.
+ require_once('./wp-inst/wp-config.php');
+ require_once('./wp-inst/wp-admin/upgrade-functions.php');
+ make_db_current_silent();
+ populate_options();
+ printheader();
+ step3();
+ break;
+ default:
+ // check that directories are writeable.
+ // create wp-inst/wpmu-settings.php
+ // get db auth info.
+ printheader();
+ if( step1() ) {
+ printstep1form();
+ }
+ break;
+}
+?>
+<br /><br />
+<div align='center'>
+<a href="http://mu.wordpress.org/">WPMU</a> | <a href="http://mu.wordpress.org/forums/">Support Forums</a>
+</div>
+</body>
+</html>
diff --git a/wp-inst/mm-newblog.php b/wp-inst/mm-newblog.php index 5fcd2f6..11332d4 100644 --- a/wp-inst/mm-newblog.php +++ b/wp-inst/mm-newblog.php @@ -1,172 +1,171 @@ -<?php -require('wp-config.php'); - -get_header(); -?> -<div id="content" class="widecolumn"> -<style type="text/css"> -form { margin-top: 2em; } -td input { - width: 90%; - font-size: 24px; -} -.error { - background-color: #FF6666; -} -</style> -<?php - -if ($_POST) { - -$username = $_POST['username']; -$email = $_POST['email' ]; -$blogname = stripslashes($_POST['blogname']); - -$username = sanitize_title($username); - -$user_error = $email_error = $blog_error = false; - -if ( empty( $username ) ) - $user_error = true; -if ( $wpdb->get_row("SELECT * FROM $wpdb->users WHERE user_login = '$username'") ) - $user_error = true; - -if ( !is_email($email ) ) - $email_error = true; - -if ( empty( $blogname ) ) - $blog_error = true; - -if ( $user_error || $email_error || $blog_error ) { -?> -<h2>There was an error</h2> -<form method="post" action=""> -<?php if ( !$user_error || !$email_error || !$blog_error ) : ?> -<p>This info was fine:</p> -<ul> -<?php if ( !$user_error ) : ?> - <li><strong>Username:</strong> <?php echo $username; ?><input name="username" type="hidden" id="username" value="<?php echo $username; ?>" /></li> -<?php endif; ?> -<?php if ( !$blog_error ) : ?> - <li><strong>Blog Name:</strong> <?php echo $blogname; ?><input name="blogname" type="hidden" id="blogname" value="<?php echo wp_specialchars($blogname, 1); ?>" /></li> -<?php endif; ?> -<?php if ( !$email_error ) : ?> - <li><strong>Email Address:</strong> - <?php echo $email; ?><input name="email" type="hidden" value="<?php echo wp_specialchars($email, 1); ?>" /></li> -<?php endif; ?> -</ul> -<?php endif; ?> - -<p>There was a problem with the following, please correct it below and try again.</p> - - <table width="100%" > -<?php if ( $user_error ) : ?> - <tr class="error"> - <th valign="top" scope="row">Username: </th> - <td> - <input name="username" type="text" id="username" value="<?php echo $username; ?>" maxlength="50" /> - <br /> - (This will also be your blog address. Letters and numbers only, please.) - </td> - </tr> -<?php endif; ?> - -<?php if ( $blog_error ) : ?> - <tr class="error"> - <th valign="top" scope="row">Blog Name: </th> - <td><input name="blogname" type="text" id="blogname" value="<?php echo wp_specialchars($blogname, 1); ?>" /> - <br> - (Don't worry, you can change it later.) </td> - </tr> -<?php endif; ?> - -<?php if ( $email_error ) : ?> - <tr class="error"> - <th valign="top" scope="row">Email Address: </th> - <td><p> - <input name="email" type="text" maxlength="200" value="<?php echo wp_specialchars($email, 1); ?>" /> - <br /> - (Did you type in your address wrong?) - </p> - </td> - </tr> -<?php endif; ?> - <tr> - <th scope="row"> </th> - <td><input type="submit" class="submit" name="Submit" value="Try Again »" /></td> - </tr> - </table> -</form> -<?php -} else { - -$main_host = $_SERVER['HTTP_HOST']; -$main_host = str_replace('www.', '', $main_host); - -$base_path = dirname( $_SERVER['SCRIPT_NAME'] ); -$base_path = str_replace('wp-inst', '',$result); -if( strlen( $base_path > 1 ) && substr($base_path, -1 ) == '/') - $base_path = substr($base_path, 0, -1); - -define( 'WP_INSTALLING', true ); -require_once('./wp-config.php'); -$setup = true; - -if( defined( "VHOST" ) && constant( "VHOST" ) == 'yes' ) { - $host = $username . '.' . $main_host; - $path = '/'; -} else { - $host = $main_host; - $path = $base_path . '/' . $username; -} - - -$err = createBlog( $_SERVER[ 'HTTP_HOST' ], $host, $path, $username, $blogname, $email, $username ); - -?> -<h2>You've got a new blog</h2> -<h3>Your new address is <a href="http://<?php echo $domain . $path; ?>"><?php echo $domain . $path; ?></a></h3> -<p>You should receive an email with the login details shortly.</p> -<?php -} // if error -} else { -?> - -<h2>Get your own blog</h2> - -<form method="post" action=""> - <table width="100%" > - <tr> - <th valign="top" scope="row">Username: </th> - <td> - <input name="username" type="text" id="username" maxlength="50" /> - <br /> - (This will also be your blog address. Letters and numbers only, please.) - </td> - </tr> - <tr> - <th valign="top" scope="row">Blog Name: </th> - <td><input name="blogname" type="text" id="blogname"> - <br> - (Don't worry, you can change it later.) </td> - </tr> - <tr> - <th valign="top" scope="row">Email Address: </th> - <td><p> - <input name="email" type="text" maxlength="200" /> - <br /> - (We'll send a password to this address, so double-check it.) - </p> - </td> - </tr> - <tr> - <th scope="row"> </th> - <td><input type="submit" name="Submit" class="submit" value="Sign Up »" /></td> - </tr> - </table> -</form> -<?php -} // if post -?> -</div> +<?php
+require('wp-config.php');
+
+get_header();
+?>
+<div id="content" class="widecolumn">
+<style type="text/css">
+form { margin-top: 2em; }
+td input {
+ width: 90%;
+ font-size: 24px;
+}
+.error {
+ background-color: #FF6666;
+}
+</style>
+<?php
+
+if ($_POST) {
+
+$username = $_POST['username'];
+$email = $_POST['email' ];
+$blogname = stripslashes($_POST['blogname']);
+
+$username = sanitize_title($username);
+
+$user_error = $email_error = $blog_error = false;
+
+if ( empty( $username ) )
+ $user_error = true;
+if ( $wpdb->get_row("SELECT * FROM $wpdb->users WHERE user_login = '$username'") )
+ $user_error = true;
+
+if ( !is_email($email ) )
+ $email_error = true;
+
+if ( empty( $blogname ) )
+ $blog_error = true;
+
+if ( $user_error || $email_error || $blog_error ) {
+?>
+<h2>There was an error</h2>
+<form method="post" action="">
+<?php if ( !$user_error || !$email_error || !$blog_error ) : ?>
+<p>This info was fine:</p>
+<ul>
+<?php if ( !$user_error ) : ?>
+ <li><strong>Username:</strong> <?php echo $username; ?><input name="username" type="hidden" id="username" value="<?php echo $username; ?>" /></li>
+<?php endif; ?>
+<?php if ( !$blog_error ) : ?>
+ <li><strong>Blog Name:</strong> <?php echo $blogname; ?><input name="blogname" type="hidden" id="blogname" value="<?php echo wp_specialchars($blogname, 1); ?>" /></li>
+<?php endif; ?>
+<?php if ( !$email_error ) : ?>
+ <li><strong>Email Address:</strong>
+ <?php echo $email; ?><input name="email" type="hidden" value="<?php echo wp_specialchars($email, 1); ?>" /></li>
+<?php endif; ?>
+</ul>
+<?php endif; ?>
+
+<p>There was a problem with the following, please correct it below and try again.</p>
+
+ <table width="100%" >
+<?php if ( $user_error ) : ?>
+ <tr class="error">
+ <th valign="top" scope="row">Username: </th>
+ <td>
+ <input name="username" type="text" id="username" value="<?php echo $username; ?>" maxlength="50" />
+ <br />
+ (This will also be your blog address. Letters and numbers only, please.)
+ </td>
+ </tr>
+<?php endif; ?>
+
+<?php if ( $blog_error ) : ?>
+ <tr class="error">
+ <th valign="top" scope="row">Blog Name: </th>
+ <td><input name="blogname" type="text" id="blogname" value="<?php echo wp_specialchars($blogname, 1); ?>" />
+ <br>
+ (Don't worry, you can change it later.) </td>
+ </tr>
+<?php endif; ?>
+
+<?php if ( $email_error ) : ?>
+ <tr class="error">
+ <th valign="top" scope="row">Email Address: </th>
+ <td><p>
+ <input name="email" type="text" maxlength="200" value="<?php echo wp_specialchars($email, 1); ?>" />
+ <br />
+ (Did you type in your address wrong?)
+ </p>
+ </td>
+ </tr>
+<?php endif; ?>
+ <tr>
+ <th scope="row"> </th>
+ <td><input type="submit" class="submit" name="Submit" value="Try Again »" /></td>
+ </tr>
+ </table>
+</form>
+<?php
+} else {
+
+$main_host = $_SERVER['HTTP_HOST'];
+$main_host = str_replace('www.', '', $main_host);
+
+$base_path = dirname( $_SERVER['SCRIPT_NAME'] );
+$base_path = str_replace('wp-inst', '',$result);
+if( strlen( $base_path > 1 ) && substr($base_path, -1 ) == '/')
+ $base_path = substr($base_path, 0, -1);
+
+define( 'WP_INSTALLING', true );
+require_once('./wp-config.php');
+$setup = true;
+
+if( defined( "VHOST" ) && constant( "VHOST" ) == 'yes' ) {
+ $host = $username . '.' . $main_host;
+ $path = '/';
+} else {
+ $host = $main_host;
+ $path = $base_path . '/' . $username;
+}
+
+$err = create_blog( $host, $path, $username, $blogname, $email );
+
+?>
+<h2>You've got a new blog</h2>
+<h3>Your new address is <a href="http://<?php echo $host . $path; ?>"><?php echo $host . $path; ?></a></h3>
+<p>You should receive an email with the login details shortly.</p>
+<?php
+} // if error
+} else {
+?>
+
+<h2>Get your own blog</h2>
+
+<form method="post" action="">
+ <table width="100%" >
+ <tr>
+ <th valign="top" scope="row">Username: </th>
+ <td>
+ <input name="username" type="text" id="username" maxlength="50" />
+ <br />
+ (This will also be your blog address. Letters and numbers only, please.)
+ </td>
+ </tr>
+ <tr>
+ <th valign="top" scope="row">Blog Name: </th>
+ <td><input name="blogname" type="text" id="blogname">
+ <br>
+ (Don't worry, you can change it later.) </td>
+ </tr>
+ <tr>
+ <th valign="top" scope="row">Email Address: </th>
+ <td><p>
+ <input name="email" type="text" maxlength="200" />
+ <br />
+ (We'll send a password to this address, so double-check it.)
+ </p>
+ </td>
+ </tr>
+ <tr>
+ <th scope="row"> </th>
+ <td><input type="submit" name="Submit" class="submit" value="Sign Up »" /></td>
+ </tr>
+ </table>
+</form>
+<?php
+} // if post
+?>
+</div>
<?php get_footer(); ?>
\ No newline at end of file diff --git a/wp-inst/wp-admin/upgrade-schema.php b/wp-inst/wp-admin/upgrade-schema.php index 2c3fa61..bf0e80b 100644 --- a/wp-inst/wp-admin/upgrade-schema.php +++ b/wp-inst/wp-admin/upgrade-schema.php @@ -1,373 +1,376 @@ -<?php -// Here we keep the DB structure and option values - -$wp_queries="CREATE TABLE $wpdb->categories ( - cat_ID bigint(20) NOT NULL auto_increment, - cat_name varchar(55) NOT NULL default '', - category_nicename varchar(200) NOT NULL default '', - category_description longtext NOT NULL, - category_parent bigint(20) NOT NULL default '0', - category_count bigint(20) NOT NULL default '0', - PRIMARY KEY (cat_ID), - KEY category_nicename (category_nicename) -); -CREATE TABLE $wpdb->comments ( - comment_ID bigint(20) unsigned NOT NULL auto_increment, - comment_post_ID int(11) NOT NULL default '0', - comment_author tinytext NOT NULL, - comment_author_email varchar(100) NOT NULL default '', - comment_author_url varchar(200) NOT NULL default '', - comment_author_IP varchar(100) NOT NULL default '', - comment_date datetime NOT NULL default '0000-00-00 00:00:00', - comment_date_gmt datetime NOT NULL default '0000-00-00 00:00:00', - comment_content text NOT NULL, - comment_karma int(11) NOT NULL default '0', - comment_approved enum('0','1','spam') NOT NULL default '1', - comment_agent varchar(255) NOT NULL default '', - comment_type varchar(20) NOT NULL default '', - comment_parent bigint(20) NOT NULL default '0', - user_id bigint(20) NOT NULL default '0', - PRIMARY KEY (comment_ID), - KEY comment_approved (comment_approved), - KEY comment_post_ID (comment_post_ID) -); -CREATE TABLE $wpdb->linkcategories ( - cat_id bigint(20) NOT NULL auto_increment, - cat_name tinytext NOT NULL, - auto_toggle enum('Y','N') NOT NULL default 'N', - show_images enum('Y','N') NOT NULL default 'Y', - show_description enum('Y','N') NOT NULL default 'N', - show_rating enum('Y','N') NOT NULL default 'Y', - show_updated enum('Y','N') NOT NULL default 'Y', - sort_order varchar(64) NOT NULL default 'rand', - sort_desc enum('Y','N') NOT NULL default 'N', - text_before_link varchar(128) NOT NULL default '<li>', - text_after_link varchar(128) NOT NULL default '<br />', - text_after_all varchar(128) NOT NULL default '</li>', - list_limit int(11) NOT NULL default '-1', - PRIMARY KEY (cat_id) -); -CREATE TABLE $wpdb->links ( - link_id bigint(20) NOT NULL auto_increment, - link_url varchar(255) NOT NULL default '', - link_name varchar(255) NOT NULL default '', - link_image varchar(255) NOT NULL default '', - link_target varchar(25) NOT NULL default '', - link_category int(11) NOT NULL default '0', - link_description varchar(255) NOT NULL default '', - link_visible enum('Y','N') NOT NULL default 'Y', - link_owner int(11) NOT NULL default '1', - link_rating int(11) NOT NULL default '0', - link_updated datetime NOT NULL default '0000-00-00 00:00:00', - link_rel varchar(255) NOT NULL default '', - link_notes mediumtext NOT NULL, - link_rss varchar(255) NOT NULL default '', - PRIMARY KEY (link_id), - KEY link_category (link_category), - KEY link_visible (link_visible) -); -CREATE TABLE $wpdb->options ( - option_id bigint(20) NOT NULL auto_increment, - blog_id int(11) NOT NULL default '0', - option_name varchar(64) NOT NULL default '', - option_can_override enum('Y','N') NOT NULL default 'Y', - option_type int(11) NOT NULL default '1', - option_value longtext NOT NULL, - option_width int(11) NOT NULL default '20', - option_height int(11) NOT NULL default '8', - option_description tinytext NOT NULL, - option_admin_level int(11) NOT NULL default '1', - autoload enum('yes','no') NOT NULL default 'yes', - PRIMARY KEY (option_id,blog_id,option_name), - KEY option_name (option_name) -); -CREATE TABLE $wpdb->post2cat ( - rel_id bigint(20) NOT NULL auto_increment, - post_id bigint(20) NOT NULL default '0', - category_id bigint(20) NOT NULL default '0', - PRIMARY KEY (rel_id), - KEY post_id (post_id,category_id) -); -CREATE TABLE $wpdb->postmeta ( - meta_id bigint(20) NOT NULL auto_increment, - post_id bigint(20) NOT NULL default '0', - meta_key varchar(255) default NULL, - meta_value longtext, - PRIMARY KEY (meta_id), - KEY post_id (post_id), - KEY meta_key (meta_key) -); -CREATE TABLE $wpdb->posts ( - ID bigint(20) unsigned NOT NULL auto_increment, - post_author bigint(20) NOT NULL default '0', - post_date datetime NOT NULL default '0000-00-00 00:00:00', - post_date_gmt datetime NOT NULL default '0000-00-00 00:00:00', - post_content longtext NOT NULL, - post_title text NOT NULL, - post_category int(4) NOT NULL default '0', - post_excerpt text NOT NULL, - post_status enum('publish','draft','private','static','object') NOT NULL default 'publish', - comment_status enum('open','closed','registered_only') NOT NULL default 'open', - ping_status enum('open','closed') NOT NULL default 'open', - post_password varchar(20) NOT NULL default '', - post_name varchar(200) NOT NULL default '', - to_ping text NOT NULL, - pinged text NOT NULL, - post_modified datetime NOT NULL default '0000-00-00 00:00:00', - post_modified_gmt datetime NOT NULL default '0000-00-00 00:00:00', - post_content_filtered text NOT NULL, - post_parent bigint(20) NOT NULL default '0', - guid varchar(255) NOT NULL default '', - menu_order int(11) NOT NULL default '0', - PRIMARY KEY (ID), - KEY post_name (post_name) -); -CREATE TABLE $wpdb->users ( - ID bigint(20) unsigned NOT NULL auto_increment, - user_login varchar(60) NOT NULL default '', - user_pass varchar(64) NOT NULL default '', - user_nicename varchar(50) NOT NULL default '', - user_email varchar(100) NOT NULL default '', - user_url varchar(100) NOT NULL default '', - user_registered datetime NOT NULL default '0000-00-00 00:00:00', - user_activation_key varchar(60) NOT NULL default '', - user_status int(11) NOT NULL default '0', - display_name varchar(250) NOT NULL default '', - PRIMARY KEY (ID), - UNIQUE KEY user_login (user_login) -); -CREATE TABLE $wpdb->usermeta ( - umeta_id bigint(20) NOT NULL auto_increment, - user_id bigint(20) NOT NULL default '0', - meta_key varchar(255) default NULL, - meta_value longtext, - PRIMARY KEY (umeta_id), - KEY user_id (user_id), - KEY meta_key (meta_key) -); -CREATE TABLE $wpdb->blogs ( - blog_id bigint(20) NOT NULL auto_increment, - site_id bigint(20) NOT NULL default '0', - blogname varchar(50) NOT NULL default '', - registered datetime NOT NULL default '0000-00-00 00:00:00', - last_updated datetime NOT NULL default '0000-00-00 00:00:00', - is_public enum('yes','no') NOT NULL default 'yes', - PRIMARY KEY (blog_id), - KEY site_id (site_id), - KEY blogname (blogname) -); -CREATE TABLE $wpdb->site ( - id bigint(20) NOT NULL auto_increment, - domain varchar(255) NOT NULL default '', - path varchar(255) NOT NULL default '', - PRIMARY KEY (id), - KEY domain (domain), - KEY path (path) -); -CREATE TABLE $wpdb->sitemeta ( - meta_id bigint(20) NOT NULL auto_increment, - site_id bigint(20) NOT NULL default '0', - meta_key varchar(255) default NULL, - meta_value longtext, - PRIMARY KEY (meta_id), - KEY meta_key (meta_key), - KEY site_id (site_id) -); -CREATE TABLE `referer_blacklist` ( - `ID` int(11) NOT NULL auto_increment, - `blogID` varchar(32) NOT NULL default '', - `URL` varchar(250) NOT NULL default '', - `t` timestamp(14) NOT NULL, - PRIMARY KEY (`ID`), - KEY `blogID` (`blogID`,`URL`), - KEY `URL` (`URL`) -); -CREATE TABLE `referer_visitLog` ( -`blogID` char( 32 ) default NULL , -`visitID` int( 11 ) NOT NULL AUTO_INCREMENT , -`visitTime` timestamp( 14 ) NOT NULL , -`visitURL` char( 250 ) default NULL , -`referingURL` char( 250 ) default NULL , -`baseDomain` char( 250 ) default NULL , -`refpost` int( 11 ) NOT NULL default '0', -`visitTimes` int( 10 ) NOT NULL default '0', -`dayofmonth` smallint( 2 ) NOT NULL default '0', -PRIMARY KEY ( `visitID` ) , -KEY `blogID` ( `blogID` ) , -KEY `refpost` ( `refpost` ) , -KEY `dayofmonth` ( `dayofmonth` ) -); -CREATE TABLE `wp_linkclicks` ( - `blogID` varchar(11) default NULL, - `link_id` int(11) NOT NULL auto_increment, - `link_url` text NOT NULL, - `link_clicks` int(11) NOT NULL default '0', - `link_date` datetime NOT NULL default '0000-00-00 00:00:00', - `link_title` text NOT NULL, - UNIQUE KEY `link_id` (`link_id`), - KEY `blogID` (`blogID`) -); -"; - -function populate_options() { - global $wpdb, $wpblog; - - $guessurl = preg_replace('|/wp-admin/.*|i', '', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); - add_option('siteurl', $guessurl, __('WordPress web address')); - add_option('blogname', __('My Weblog'), __('Blog title')); - add_option('blogdescription', __('Just another WordPress weblog'), __('Short tagline')); - add_option('new_users_can_blog', 0); - add_option('users_can_register', 0); - add_option('admin_email', 'you@example.com'); - add_option('start_of_week', 1); - add_option('use_balanceTags', 1); - add_option('use_smilies', 1); - add_option('require_name_email', 1); - add_option('comments_notify', 1); - add_option('posts_per_rss', 10); - add_option('rss_excerpt_length', 50); - add_option('rss_use_excerpt', 0); - add_option('use_fileupload', 1); - add_option('fileupload_realpath', ABSPATH . 'wp-content/blogs.dir/'.$wpdb->blogid.'/files'); - add_option('fileupload_url', get_option('siteurl') . '/files'); - add_option('fileupload_allowedtypes', 'jpg jpeg gif png'); - add_option('fileupload_maxk', 300); - add_option('fileupload_minlevel', 6); - add_option('mailserver_url', 'mail.example.com'); - add_option('mailserver_login', 'login@example.com'); - add_option('mailserver_pass', 'password'); - add_option('mailserver_port', 110); - add_option('default_category', 1); - add_option('default_comment_status', 'open'); - add_option('default_ping_status', 'open'); - add_option('default_pingback_flag', 1); - add_option('default_post_edit_rows', 9); - add_option('posts_per_page', 10); - add_option('what_to_show', 'posts'); - add_option('date_format', __('F j, Y')); - add_option('time_format', __('g:i a')); - add_option('links_updated_date_format', __('F j, Y g:i a')); - add_option('links_recently_updated_prepend', '<em>'); - add_option('links_recently_updated_append', '</em>'); - add_option('links_recently_updated_time', 120); - add_option('comment_moderation', 1); - add_option('moderation_notify', 0); - add_option('permalink_structure', '/%year%/%monthnum%/%day%/%postname%/'); - add_option('gzipcompression', 0); - add_option('hack_file', 0); - add_option('blog_charset', 'UTF-8'); - add_option('moderation_keys'); - add_option('active_plugins'); - add_option('home'); - add_option('category_base'); - add_option('ping_sites', 'http://rpc.pingomatic.com/'); - add_option('advanced_edit', 0); - add_option('comment_max_links', 2); - // 1.5 - add_option('default_email_category', 1, __('Posts by email go to this category')); - add_option('recently_edited'); - add_option('use_linksupdate', 0); - add_option('template', 'default'); - add_option('stylesheet', 'default'); - add_option('comment_whitelist', 1); - add_option('page_uris'); - add_option('blacklist_keys'); - add_option('comment_registration', 0); - add_option('open_proxy_check', 1); - add_option('rss_language', 'en'); - add_option('html_type', 'text/html'); - // 1.5.1 - add_option('use_trackback', 0); - - populate_roles(); - - // Delete unused options - $unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url'); - foreach ($unusedoptions as $option) : - delete_option($option); - endforeach; - - // Set up a few options not to load by default - $fatoptions = array( 'moderation_keys', 'recently_edited', 'blacklist_keys' ); - foreach ($fatoptions as $fatoption) : - $wpdb->query("UPDATE $wpdb->options SET `autoload` = 'no' WHERE option_name = '$fatoption'"); - endforeach; -} - -function populate_roles() { - global $table_prefix; - - $roles = array ('administrator' => - array('name' => __('Administrator'), - 'capabilities' => array( - 'edit_posts' => true, - 'edit_others_posts' => true, - 'edit_published_posts' => true, - 'publish_posts' => true, - 'edit_pages' => true, - 'manage_categories' => true, - 'manage_links' => true, - 'upload_images' => true, - 'manage_options' => true, - 'switch_themes' => true, - 'edit_themes' => true, - 'activate_plugins' => true, - 'edit_plugins' => true, - 'edit_users' => true, - 'edit_files' => true, - 'read' => true, - 'level_10' => true, - 'level_9' => true, - 'level_8' => true - )), - - 'editor' => - array('name' => __('Editor'), - 'capabilities' => array( - 'edit_posts' => true, - 'edit_others_posts' => true, - 'edit_published_posts' => true, - 'publish_posts' => true, - 'edit_pages' => true, - 'manage_categories' => true, - 'manage_links' => true, - 'upload_images' => true, - 'read' => true, - 'level_7' => true, - 'level_6' => true, - 'level_5' => true - )), - - 'author' => - array('name' => __('Author'), - 'capabilities' => array( - 'edit_posts' => true, - 'publish_posts' => true, - 'upload_images' => true, - 'read' => true, - 'level_2' => true - )), - - 'contributor' => - array('name' => __('Contributor'), - 'capabilities' => array( - 'edit_posts' => true, - 'read' => true, - 'level_1' => true - )), - - 'subscriber' => - array('name' => __('Subscriber'), - 'capabilities' => array( - 'read' => true, - 'level_0' => true - )), - - 'inactive' => - array('name' => __('Inactive'), - 'capabilities' => array()) - ); - - add_option($table_prefix . 'user_roles', $roles); -} -?> +<?php
+// Here we keep the DB structure and option values
+
+$wp_queries="CREATE TABLE $wpdb->categories (
+ cat_ID bigint(20) NOT NULL auto_increment,
+ cat_name varchar(55) NOT NULL default '',
+ category_nicename varchar(200) NOT NULL default '',
+ category_description longtext NOT NULL,
+ category_parent bigint(20) NOT NULL default '0',
+ category_count bigint(20) NOT NULL default '0',
+ PRIMARY KEY (cat_ID),
+ KEY category_nicename (category_nicename)
+);
+CREATE TABLE $wpdb->comments (
+ comment_ID bigint(20) unsigned NOT NULL auto_increment,
+ comment_post_ID int(11) NOT NULL default '0',
+ comment_author tinytext NOT NULL,
+ comment_author_email varchar(100) NOT NULL default '',
+ comment_author_url varchar(200) NOT NULL default '',
+ comment_author_IP varchar(100) NOT NULL default '',
+ comment_date datetime NOT NULL default '0000-00-00 00:00:00',
+ comment_date_gmt datetime NOT NULL default '0000-00-00 00:00:00',
+ comment_content text NOT NULL,
+ comment_karma int(11) NOT NULL default '0',
+ comment_approved enum('0','1','spam') NOT NULL default '1',
+ comment_agent varchar(255) NOT NULL default '',
+ comment_type varchar(20) NOT NULL default '',
+ comment_parent bigint(20) NOT NULL default '0',
+ user_id bigint(20) NOT NULL default '0',
+ PRIMARY KEY (comment_ID),
+ KEY comment_approved (comment_approved),
+ KEY comment_post_ID (comment_post_ID)
+);
+CREATE TABLE $wpdb->linkcategories (
+ cat_id bigint(20) NOT NULL auto_increment,
+ cat_name tinytext NOT NULL,
+ auto_toggle enum('Y','N') NOT NULL default 'N',
+ show_images enum('Y','N') NOT NULL default 'Y',
+ show_description enum('Y','N') NOT NULL default 'N',
+ show_rating enum('Y','N') NOT NULL default 'Y',
+ show_updated enum('Y','N') NOT NULL default 'Y',
+ sort_order varchar(64) NOT NULL default 'rand',
+ sort_desc enum('Y','N') NOT NULL default 'N',
+ text_before_link varchar(128) NOT NULL default '<li>',
+ text_after_link varchar(128) NOT NULL default '<br />',
+ text_after_all varchar(128) NOT NULL default '</li>',
+ list_limit int(11) NOT NULL default '-1',
+ PRIMARY KEY (cat_id)
+);
+CREATE TABLE $wpdb->links (
+ link_id bigint(20) NOT NULL auto_increment,
+ link_url varchar(255) NOT NULL default '',
+ link_name varchar(255) NOT NULL default '',
+ link_image varchar(255) NOT NULL default '',
+ link_target varchar(25) NOT NULL default '',
+ link_category int(11) NOT NULL default '0',
+ link_description varchar(255) NOT NULL default '',
+ link_visible enum('Y','N') NOT NULL default 'Y',
+ link_owner int(11) NOT NULL default '1',
+ link_rating int(11) NOT NULL default '0',
+ link_updated datetime NOT NULL default '0000-00-00 00:00:00',
+ link_rel varchar(255) NOT NULL default '',
+ link_notes mediumtext NOT NULL,
+ link_rss varchar(255) NOT NULL default '',
+ PRIMARY KEY (link_id),
+ KEY link_category (link_category),
+ KEY link_visible (link_visible)
+);
+CREATE TABLE $wpdb->options (
+ option_id bigint(20) NOT NULL auto_increment,
+ blog_id int(11) NOT NULL default '0',
+ option_name varchar(64) NOT NULL default '',
+ option_can_override enum('Y','N') NOT NULL default 'Y',
+ option_type int(11) NOT NULL default '1',
+ option_value longtext NOT NULL,
+ option_width int(11) NOT NULL default '20',
+ option_height int(11) NOT NULL default '8',
+ option_description tinytext NOT NULL,
+ option_admin_level int(11) NOT NULL default '1',
+ autoload enum('yes','no') NOT NULL default 'yes',
+ PRIMARY KEY (option_id,blog_id,option_name),
+ KEY option_name (option_name)
+);
+CREATE TABLE $wpdb->post2cat (
+ rel_id bigint(20) NOT NULL auto_increment,
+ post_id bigint(20) NOT NULL default '0',
+ category_id bigint(20) NOT NULL default '0',
+ PRIMARY KEY (rel_id),
+ KEY post_id (post_id,category_id)
+);
+CREATE TABLE $wpdb->postmeta (
+ meta_id bigint(20) NOT NULL auto_increment,
+ post_id bigint(20) NOT NULL default '0',
+ meta_key varchar(255) default NULL,
+ meta_value longtext,
+ PRIMARY KEY (meta_id),
+ KEY post_id (post_id),
+ KEY meta_key (meta_key)
+);
+CREATE TABLE $wpdb->posts (
+ ID bigint(20) unsigned NOT NULL auto_increment,
+ post_author bigint(20) NOT NULL default '0',
+ post_date datetime NOT NULL default '0000-00-00 00:00:00',
+ post_date_gmt datetime NOT NULL default '0000-00-00 00:00:00',
+ post_content longtext NOT NULL,
+ post_title text NOT NULL,
+ post_category int(4) NOT NULL default '0',
+ post_excerpt text NOT NULL,
+ post_status enum('publish','draft','private','static','object') NOT NULL default 'publish',
+ comment_status enum('open','closed','registered_only') NOT NULL default 'open',
+ ping_status enum('open','closed') NOT NULL default 'open',
+ post_password varchar(20) NOT NULL default '',
+ post_name varchar(200) NOT NULL default '',
+ to_ping text NOT NULL,
+ pinged text NOT NULL,
+ post_modified datetime NOT NULL default '0000-00-00 00:00:00',
+ post_modified_gmt datetime NOT NULL default '0000-00-00 00:00:00',
+ post_content_filtered text NOT NULL,
+ post_parent bigint(20) NOT NULL default '0',
+ guid varchar(255) NOT NULL default '',
+ menu_order int(11) NOT NULL default '0',
+ PRIMARY KEY (ID),
+ KEY post_name (post_name)
+);
+CREATE TABLE $wpdb->users (
+ ID bigint(20) unsigned NOT NULL auto_increment,
+ user_login varchar(60) NOT NULL default '',
+ user_pass varchar(64) NOT NULL default '',
+ user_nicename varchar(50) NOT NULL default '',
+ user_email varchar(100) NOT NULL default '',
+ user_url varchar(100) NOT NULL default '',
+ user_registered datetime NOT NULL default '0000-00-00 00:00:00',
+ user_activation_key varchar(60) NOT NULL default '',
+ user_status int(11) NOT NULL default '0',
+ display_name varchar(250) NOT NULL default '',
+ PRIMARY KEY (ID),
+ UNIQUE KEY user_login (user_login)
+);
+CREATE TABLE $wpdb->usermeta (
+ umeta_id bigint(20) NOT NULL auto_increment,
+ user_id bigint(20) NOT NULL default '0',
+ meta_key varchar(255) default NULL,
+ meta_value longtext,
+ PRIMARY KEY (umeta_id),
+ KEY user_id (user_id),
+ KEY meta_key (meta_key)
+);
+CREATE TABLE $wpdb->blogs (
+ blog_id bigint(20) NOT NULL auto_increment,
+ site_id bigint(20) NOT NULL default '0',
+ blogname varchar(50) NOT NULL default '',
+ domain varchar(255) NOT NULL default '',
+ path varchar(255) NOT NULL default '',
+ registered datetime NOT NULL default '0000-00-00 00:00:00',
+ last_updated datetime NOT NULL default '0000-00-00 00:00:00',
+ is_public enum('yes','no') NOT NULL default 'yes',
+ blog_status enum('public', 'private', 'archived') NOT NULL default 'public',
+ PRIMARY KEY (blog_id),
+ KEY site_id (site_id),
+ KEY domain (domain)
+);
+CREATE TABLE $wpdb->site (
+ id bigint(20) NOT NULL auto_increment,
+ domain varchar(255) NOT NULL default '',
+ path varchar(255) NOT NULL default '',
+ PRIMARY KEY (id),
+ KEY domain (domain),
+ KEY path (path)
+);
+CREATE TABLE $wpdb->sitemeta (
+ meta_id bigint(20) NOT NULL auto_increment,
+ site_id bigint(20) NOT NULL default '0',
+ meta_key varchar(255) default NULL,
+ meta_value longtext,
+ PRIMARY KEY (meta_id),
+ KEY meta_key (meta_key),
+ KEY site_id (site_id)
+);
+CREATE TABLE `referer_blacklist` (
+ `ID` int(11) NOT NULL auto_increment,
+ `blogID` varchar(32) NOT NULL default '',
+ `URL` varchar(250) NOT NULL default '',
+ `t` timestamp(14) NOT NULL,
+ PRIMARY KEY (`ID`),
+ KEY `blogID` (`blogID`,`URL`),
+ KEY `URL` (`URL`)
+);
+CREATE TABLE `referer_visitLog` (
+`blogID` char( 32 ) default NULL ,
+`visitID` int( 11 ) NOT NULL AUTO_INCREMENT ,
+`visitTime` timestamp( 14 ) NOT NULL ,
+`visitURL` char( 250 ) default NULL ,
+`referingURL` char( 250 ) default NULL ,
+`baseDomain` char( 250 ) default NULL ,
+`refpost` int( 11 ) NOT NULL default '0',
+`visitTimes` int( 10 ) NOT NULL default '0',
+`dayofmonth` smallint( 2 ) NOT NULL default '0',
+PRIMARY KEY ( `visitID` ) ,
+KEY `blogID` ( `blogID` ) ,
+KEY `refpost` ( `refpost` ) ,
+KEY `dayofmonth` ( `dayofmonth` )
+);
+CREATE TABLE `wp_linkclicks` (
+ `blogID` varchar(11) default NULL,
+ `link_id` int(11) NOT NULL auto_increment,
+ `link_url` text NOT NULL,
+ `link_clicks` int(11) NOT NULL default '0',
+ `link_date` datetime NOT NULL default '0000-00-00 00:00:00',
+ `link_title` text NOT NULL,
+ UNIQUE KEY `link_id` (`link_id`),
+ KEY `blogID` (`blogID`)
+);
+";
+
+function populate_options() {
+ global $wpdb, $wpblog;
+
+ $guessurl = preg_replace('|/wp-admin/.*|i', '', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
+ add_option('siteurl', $guessurl, __('WordPress web address'));
+ add_option('blogname', __('My Weblog'), __('Blog title'));
+ add_option('blogdescription', __('Just another WordPress weblog'), __('Short tagline'));
+ add_option('new_users_can_blog', 0);
+ add_option('users_can_register', 0);
+ add_option('admin_email', 'you@example.com');
+ add_option('start_of_week', 1);
+ add_option('use_balanceTags', 1);
+ add_option('use_smilies', 1);
+ add_option('require_name_email', 1);
+ add_option('comments_notify', 1);
+ add_option('posts_per_rss', 10);
+ add_option('rss_excerpt_length', 50);
+ add_option('rss_use_excerpt', 0);
+ add_option('use_fileupload', 1);
+ add_option('fileupload_realpath', ABSPATH . 'wp-content/blogs.dir/'.$wpdb->blogid.'/files');
+ add_option('fileupload_url', get_option('siteurl') . '/files');
+ add_option('fileupload_allowedtypes', 'jpg jpeg gif png');
+ add_option('fileupload_maxk', 300);
+ add_option('fileupload_minlevel', 6);
+ add_option('mailserver_url', 'mail.example.com');
+ add_option('mailserver_login', 'login@example.com');
+ add_option('mailserver_pass', 'password');
+ add_option('mailserver_port', 110);
+ add_option('default_category', 1);
+ add_option('default_comment_status', 'open');
+ add_option('default_ping_status', 'open');
+ add_option('default_pingback_flag', 1);
+ add_option('default_post_edit_rows', 9);
+ add_option('posts_per_page', 10);
+ add_option('what_to_show', 'posts');
+ add_option('date_format', __('F j, Y'));
+ add_option('time_format', __('g:i a'));
+ add_option('links_updated_date_format', __('F j, Y g:i a'));
+ add_option('links_recently_updated_prepend', '<em>');
+ add_option('links_recently_updated_append', '</em>');
+ add_option('links_recently_updated_time', 120);
+ add_option('comment_moderation', 1);
+ add_option('moderation_notify', 0);
+ add_option('permalink_structure', '/%year%/%monthnum%/%day%/%postname%/');
+ add_option('gzipcompression', 0);
+ add_option('hack_file', 0);
+ add_option('blog_charset', 'UTF-8');
+ add_option('moderation_keys');
+ add_option('active_plugins');
+ add_option('home');
+ add_option('category_base');
+ add_option('ping_sites', 'http://rpc.pingomatic.com/');
+ add_option('advanced_edit', 0);
+ add_option('comment_max_links', 2);
+ // 1.5
+ add_option('default_email_category', 1, __('Posts by email go to this category'));
+ add_option('recently_edited');
+ add_option('use_linksupdate', 0);
+ add_option('template', 'default');
+ add_option('stylesheet', 'default');
+ add_option('comment_whitelist', 1);
+ add_option('page_uris');
+ add_option('blacklist_keys');
+ add_option('comment_registration', 0);
+ add_option('open_proxy_check', 1);
+ add_option('rss_language', 'en');
+ add_option('html_type', 'text/html');
+ // 1.5.1
+ add_option('use_trackback', 0);
+
+ populate_roles();
+
+ // Delete unused options
+ $unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url');
+ foreach ($unusedoptions as $option) :
+ delete_option($option);
+ endforeach;
+
+ // Set up a few options not to load by default
+ $fatoptions = array( 'moderation_keys', 'recently_edited', 'blacklist_keys' );
+ foreach ($fatoptions as $fatoption) :
+ $wpdb->query("UPDATE $wpdb->options SET `autoload` = 'no' WHERE option_name = '$fatoption'");
+ endforeach;
+}
+
+function populate_roles() {
+ global $table_prefix;
+
+ $roles = array ('administrator' =>
+ array('name' => __('Administrator'),
+ 'capabilities' => array(
+ 'edit_posts' => true,
+ 'edit_others_posts' => true,
+ 'edit_published_posts' => true,
+ 'publish_posts' => true,
+ 'edit_pages' => true,
+ 'manage_categories' => true,
+ 'manage_links' => true,
+ 'upload_images' => true,
+ 'manage_options' => true,
+ 'switch_themes' => true,
+ 'edit_themes' => true,
+ 'activate_plugins' => true,
+ 'edit_plugins' => true,
+ 'edit_users' => true,
+ 'edit_files' => true,
+ 'read' => true,
+ 'level_10' => true,
+ 'level_9' => true,
+ 'level_8' => true
+ )),
+
+ 'editor' =>
+ array('name' => __('Editor'),
+ 'capabilities' => array(
+ 'edit_posts' => true,
+ 'edit_others_posts' => true,
+ 'edit_published_posts' => true,
+ 'publish_posts' => true,
+ 'edit_pages' => true,
+ 'manage_categories' => true,
+ 'manage_links' => true,
+ 'upload_images' => true,
+ 'read' => true,
+ 'level_7' => true,
+ 'level_6' => true,
+ 'level_5' => true
+ )),
+
+ 'author' =>
+ array('name' => __('Author'),
+ 'capabilities' => array(
+ 'edit_posts' => true,
+ 'publish_posts' => true,
+ 'upload_images' => true,
+ 'read' => true,
+ 'level_2' => true
+ )),
+
+ 'contributor' =>
+ array('name' => __('Contributor'),
+ 'capabilities' => array(
+ 'edit_posts' => true,
+ 'read' => true,
+ 'level_1' => true
+ )),
+
+ 'subscriber' =>
+ array('name' => __('Subscriber'),
+ 'capabilities' => array(
+ 'read' => true,
+ 'level_0' => true
+ )),
+
+ 'inactive' =>
+ array('name' => __('Inactive'),
+ 'capabilities' => array())
+ );
+
+ add_option($table_prefix . 'user_roles', $roles);
+}
+?>
diff --git a/wp-inst/wp-includes/wpmu-functions.php b/wp-inst/wp-includes/wpmu-functions.php index b830610..fded787 100644 --- a/wp-inst/wp-includes/wpmu-functions.php +++ b/wp-inst/wp-includes/wpmu-functions.php @@ -598,7 +598,7 @@ function createBlog( $hostname, $domain, $path, $blogname, $weblog_title, $admin $wpdb->query("INSERT INTO $wpdb->comments (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_date_gmt, comment_content) VALUES ('1', '".addslashes(__('Mr WordPress'))."', '', 'http://wordpress.org', '127.0.0.1', '$now', '$now_gmt', '".addslashes(__('Hi, this is a comment.<br />To delete a comment, just log in, and view the posts\' comments, there you will have the option to edit or delete them.'))."')");
$message_headers = 'From: ' . stripslashes($weblog_title) . ' <wordpress@' . $_SERVER[ 'SERVER_NAME' ] . '>';
- $message = __("Dear User,\n\nYour new WordPressMU blog has been successfully set up at:\n".$url."\n\nYou can log in to the administrator account with the following information:\n Username: ".$adminname."\n Password: ".$random_password."\nLogin Here: ".$url."wp-login.php\n\nWe hope you enjoy your new weblog.\n Thanks!\n\n--The WordPressMU Team\nhttp://mu.wordpress.org/\n");
+ $message = __("Dear User,\n\nYour new WordPressMU blog has been successfully set up at:\n".$url."\n\nYou can log in to the administrator account with the following information:\n Username: ".$username."\n Password: ".$random_password."\nLogin Here: ".$url."wp-login.php\n\nWe hope you enjoy your new weblog.\n Thanks!\n\n--The WordPressMU Team\nhttp://mu.wordpress.org/\n");
@mail($admin_email, __('New WordPress MU Blog').": ".stripslashes( $weblog_title ), $message, $message_headers);
upgrade_all();
@@ -634,6 +634,143 @@ function createBlog( $hostname, $domain, $path, $blogname, $weblog_title, $admin return "ok";
}
+// New create blog
+
+function create_blog( $domain, $path, $username, $weblog_title, $admin_email, $site_id = 1 ) {
+ global $wpdb, $table_prefix, $wp_queries, $wpmuBaseTablePrefix;
+
+ $domain = addslashes( $domain );
+ $weblog_title = addslashes( $weblog_title );
+ $admin_email = addslashes( $admin_email );
+ $username = addslashes( $username );
+
+ if( empty($path) )
+ $path = '/';
+
+ // Check if the username has been used already. We should return an error message.
+ if( $wpdb->get_var("SELECT blog_id FROM $wpdb->blogs WHERE domain = '$domain' AND path = '$path'" ) )
+ return 'Blog URL already taken.';
+
+ // Need to backup wpdb table names, and create a new wp_blogs entry for new blog.
+ // Need to get blog_id from wp_blogs, and create new table names.
+ // Must restore table names at the end of function.
+
+ $wpdb->hide_errors();
+
+ $query = "INSERT INTO $wpdb->blogs ( site_id, domain, path, registered ) VALUES ( '$site_id', '$domain', '$path', NOW() )";
+ if( $wpdb->query( $query ) == false ) {
+ return "error: problem creating blog entry";
+ }
+ $blog_id = $wpdb->insert_id;
+
+ // backup
+ $tmp[ 'siteid' ] = $wpdb->siteid;
+ $tmp[ 'blogid' ] = $wpdb->blogid;
+ $tmp[ 'posts' ] = $wpdb->posts;
+ $tmp[ 'categories' ] = $wpdb->categories;
+ $tmp[ 'post2cat' ] = $wpdb->post2cat;
+ $tmp[ 'comments' ] = $wpdb->comments;
+ $tmp[ 'links' ] = $wpdb->links;
+ $tmp[ 'linkcategories' ] = $wpdb->linkcategories;
+ $tmp[ 'option' ] = $wpdb->option;
+ $tmp[ 'postmeta' ] = $wpdb->postmeta;
+ $tmptable_prefix = $table_prefix;
+
+ // fix the new prefix.
+ $table_prefix = $wpmuBaseTablePrefix . $blog_id . "_";
+ $wpdb->siteid = $site_id;
+ $wpdb->blogid = $blog_id;
+ $wpdb->posts = $table_prefix . 'posts';
+ $wpdb->categories = $table_prefix . 'categories';
+ $wpdb->post2cat = $table_prefix . 'post2cat';
+ $wpdb->comments = $table_prefix . 'comments';
+ $wpdb->links = $table_prefix . 'links';
+ $wpdb->linkcategories = $table_prefix . 'linkcategories';
+ $wpdb->options = $table_prefix . 'options';
+ $wpdb->postmeta = $table_prefix . 'postmeta';
+
+ @mkdir( ABSPATH . "wp-content/blogs.dir/".$blog_id, 0777 );
+ @mkdir( ABSPATH . "wp-content/blogs.dir/".$blog_id."/files", 0777 );
+
+ require_once( ABSPATH . 'wp-admin/upgrade-functions.php');
+ $wpdb->hide_errors();
+
+ flush();
+
+ $url = 'http://' . $domain . $path;
+
+ // Set everything up
+ make_db_current_silent();
+ populate_options();
+
+ // fix url.
+ update_option('siteurl', $url);
+
+ $wpdb->query("UPDATE $wpdb->options SET option_value = '$weblog_title' WHERE option_name = 'blogname'");
+ $wpdb->query("UPDATE $wpdb->options SET option_value = '$admin_email' WHERE option_name = 'admin_email'");
+
+ // Now drop in some default links
+ $wpdb->query("INSERT INTO $wpdb->linkcategories (cat_id, cat_name) VALUES (1, '".addslashes(__('Blogroll'))."')");
+ $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss) VALUES ('http://blog.carthik.net/index.php', 'Carthik', 1, 'http://blog.carthik.net/feed/');");
+ $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss) VALUES ('http://blogs.linux.ie/xeer/', 'Donncha', 1, 'http://blogs.linux.ie/xeer/feed/');");
+ $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss) VALUES ('http://zengun.org/weblog/', 'Michel', 1, 'http://zengun.org/weblog/feed/');");
+ $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss) VALUES ('http://boren.nu/', 'Ryan', 1, 'http://boren.nu/feed/');");
+ $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss) VALUES ('http://photomatt.net/', 'Matt', 1, 'http://xml.photomatt.net/feed/');");
+ $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss) VALUES ('http://zed1.com/journalized/', 'Mike', 1, 'http://zed1.com/journalized/feed/');");
+ $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss) VALUES ('http://www.alexking.org/', 'Alex', 1, 'http://www.alexking.org/blog/wp-rss2.php');");
+ $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss) VALUES ('http://dougal.gunters.org/', 'Dougal', 1, 'http://dougal.gunters.org/feed/');");
+
+ // Default category
+ $wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename) VALUES ('0', '".addslashes(__('Uncategorized'))."', '".sanitize_title(__('Uncategorized'))."')");
+
+ // Set up admin user
+ $random_password = substr(md5(uniqid(microtime())), 0, 6);
+
+ $wpdb->query("INSERT INTO $wpdb->users (user_login, user_pass, user_email, user_registered) VALUES ( '$username', MD5('$random_password'), '$admin_email', NOW() )");
+ $userID = $wpdb->insert_id;
+ $metavalues = array( "user_nickname" => addslashes(__('Administrator')), $table_prefix . "user_level" => 10, "source_domain" => $domain );
+ reset( $metavalues );
+ while( list( $key, $val ) = each ( $metavalues ) )
+ {
+ $query = "INSERT INTO ".$wpdb->usermeta." ( `umeta_id` , `user_id` , `meta_key` , `meta_value` )
+ VALUES ( NULL, '".$userID."', '".$key."' , '".$val."')";
+ $wpdb->query( $query );
+ }
+
+ // First post
+ $now = date('Y-m-d H:i:s');
+ $now_gmt = gmdate('Y-m-d H:i:s');
+ $wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_title, post_category, post_name, post_modified, post_modified_gmt) VALUES ('".$userID."', '$now', '$now_gmt', '".addslashes(__('Welcome to WordPress MU. This is your first post. Edit or delete it, then start blogging!'))."', '".addslashes(__('Hello world!'))."', '0', '".addslashes(__('hello-world'))."', '$now', '$now_gmt')");
+ $wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_title, post_category, post_name, post_modified, post_modified_gmt, post_status) VALUES ('".$userID."', '$now', '$now_gmt', '".addslashes(__('This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.'))."', '".addslashes(__('About'))."', '0', '".addslashes(__('about'))."', '$now', '$now_gmt', 'static')");
+
+ $wpdb->query( "INSERT INTO $wpdb->post2cat (`rel_id`, `post_id`, `category_id`) VALUES (1, 1, 1)" );
+ $wpdb->query( "INSERT INTO $wpdb->post2cat (`rel_id`, `post_id`, `category_id`) VALUES (2, 2, 1)" );
+
+ // Default comment
+ $wpdb->query("INSERT INTO $wpdb->comments (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_date_gmt, comment_content) VALUES ('1', '".addslashes(__('Mr WordPress'))."', '', 'http://wordpress.org', '127.0.0.1', '$now', '$now_gmt', '".addslashes(__('Hi, this is a comment.<br />To delete a comment, just log in, and view the posts\' comments, there you will have the option to edit or delete them.'))."')");
+
+ $message_headers = 'From: ' . stripslashes($weblog_title) . ' <wordpress@' . $_SERVER[ 'SERVER_NAME' ] . '>';
+ $message = __("Dear User,\n\nYour new WordPressMU blog has been successfully set up at:\n".$url."\n\nYou can log in to the administrator account with the following information:\n Username: ".$adminname."\n Password: ".$random_password."\nLogin Here: ".$url."wp-login.php\n\nWe hope you enjoy your new weblog.\n Thanks!\n\n--The WordPressMU Team\nhttp://mu.wordpress.org/\n");
+ @mail($admin_email, __('New WordPress MU Blog').": ".stripslashes( $weblog_title ), $message, $message_headers);
+
+ upgrade_all();
+ // remove all perms except for the login user.
+ $query = "DELETE FROM $wpdb->usermeta WHERE user_id != '$userID' AND meta_key = '".$table_prefix."user_level'";
+ $wpdb->query( $query );
+
+ // restore wpdb variables
+ reset( $tmp );
+ while( list( $key, $val ) = each( $tmp ) )
+ {
+ $wpdb->$key = $val;
+ }
+ $table_prefix = $tmptable_prefix;
+
+ $wpdb->show_errors();
+
+ return "ok";
+}
+
function get_blogaddress_by_id( $blog_id ) {
global $hostname, $domain, $base, $wpdb;
diff --git a/wp-inst/wp-settings.php b/wp-inst/wp-settings.php index b246db3..dc2a11a 100644 --- a/wp-inst/wp-settings.php +++ b/wp-inst/wp-settings.php @@ -1,222 +1,216 @@ -<?php -$HTTP_HOST = getenv('HTTP_HOST'); /* domain name */ -$REMOTE_ADDR = getenv('REMOTE_ADDR'); /* visitor's IP */ -$HTTP_USER_AGENT = getenv('HTTP_USER_AGENT'); /* visitor's browser */ - -// Fix for IIS, which doesn't set REQUEST_URI -if (! isset($_SERVER['REQUEST_URI'])) { - $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME']; - - // Append the query string if it exists and isn't null - if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) { - $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING']; - } -} - -if ( !(phpversion() >= '4.1') ) - die( 'Your server is running PHP version ' . phpversion() . ' but WordPress requires at least 4.1' ); - -if ( !extension_loaded('mysql') ) - die( 'Your PHP installation appears to be missing the MySQL which is required for WordPress.' ); - -function timer_start() { - global $timestart; - $mtime = explode(' ', microtime() ); - $mtime = $mtime[1] + $mtime[0]; - $timestart = $mtime; - return true; -} -timer_start(); - -// Change to E_ALL for development/debugging -error_reporting(E_ALL ^ E_NOTICE); - -// For an advanced caching plugin to use, static because you would only want one -if ( defined('WP_CACHE') ) - require (ABSPATH . 'wp-content/advanced-cache.php'); - -define('WPINC', 'wp-includes'); -require_once (ABSPATH . WPINC . '/wp-db.php'); - -$wpdb->blogs = $table_prefix . 'blogs'; -$wpdb->users = $table_prefix . 'users'; -$wpdb->usermeta = $table_prefix . 'usermeta'; -$wpdb->site = $table_prefix . 'site'; -$wpdb->sitemeta = $table_prefix . 'sitemeta'; - -// find out what tables to use from $wpblog -$wpdb->hide_errors(); -$query = "SELECT id - FROM ".$wpdb->site." - WHERE domain = '".$domain."' - AND path = '".$base."'"; -$site_id = $wpdb->get_var( $query ); - -$query = "SELECT blog_id, is_public - FROM ".$wpdb->blogs." - WHERE site_id = '".$site_id."' - AND blogname = '".$wpblog."'"; -$result = $wpdb->get_row( $query, ARRAY_A ); -$blog_id = $result[ 'blog_id' ]; -$is_public = $result[ 'is_public' ]; -if( $blog_id == false ) { - // no blog found, are we installing? Check if the table exists. - if ( defined('WP_INSTALLING') ) { - $query = "SELECT blog_id FROM ".$wpdb->blogs." limit 0,1"; - $blog_id = $wpdb->get_var( $query ); - if( $blog_id == false ) { - // table doesn't exist. This is the first blog - $blog_id = 1; - } else { - // table exists - // don't create record at this stage. we're obviously installing so it doesn't matter what the table vars below are like. - // default to using the "main" blog. - $blog_id = 1; - } - } else { - die( "No Blog by that name on this system." ); - } -} - -if( $is_public == 'no' ) { - // need to put checks in here? - // A hook? - die( "This blog is private." ); -} - -$wpdb->show_errors(); - -$table_prefix = $table_prefix.$blog_id."_"; - -// Table names -$wpdb->siteid = $site_id; -$wpdb->blogid = $blog_id; -$wpdb->posts = $table_prefix . 'posts'; -$wpdb->categories = $table_prefix . 'categories'; -$wpdb->post2cat = $table_prefix . 'post2cat'; -$wpdb->comments = $table_prefix . 'comments'; -$wpdb->links = $table_prefix . 'links'; -$wpdb->linkcategories = $table_prefix . 'linkcategories'; -$wpdb->options = $table_prefix . 'options'; -$wpdb->postmeta = $table_prefix . 'postmeta'; -$wpdb->prefix = $table_prefix; - -if ( defined('CUSTOM_USER_TABLE') ) - $wpdb->users = CUSTOM_USER_TABLE; -if ( defined('CUSTOM_USER_META_TABLE') ) - $wpdb->usermeta = CUSTOM_USER_META_TABLE; - -// We're going to need to keep this around for a few months even though we're not using it internally - -$tableposts = $wpdb->posts; -$tableusers = $wpdb->users; -$tablecategories = $wpdb->categories; -$tablepost2cat = $wpdb->post2cat; -$tablecomments = $wpdb->comments; -$tablelinks = $wpdb->links; -$tablelinkcategories = $wpdb->linkcategories; -$tableoptions = $wpdb->options; -$tablepostmeta = $wpdb->postmeta; - -require (ABSPATH . WPINC . '/functions.php'); -require (ABSPATH . WPINC . '/default-filters.php'); -require_once (ABSPATH . WPINC . '/wp-l10n.php'); - -$wpdb->hide_errors(); -if ( !update_category_cache() && (!strstr($_SERVER['PHP_SELF'], 'install.php') && !defined('WP_INSTALLING')) ) { - if ( strstr($_SERVER['PHP_SELF'], 'wp-admin') ) - $link = 'install.php'; - else - $link = 'wp-admin/install.php'; - die(sprintf(__("It doesn't look like you've installed WP yet. Try running <a href='%s'>install.php</a>."), $link)); -} -$wpdb->show_errors(); - -require (ABSPATH . WPINC . '/functions-formatting.php'); -require (ABSPATH . WPINC . '/functions-post.php'); -require (ABSPATH . WPINC . '/capabilities.php'); -require (ABSPATH . WPINC . '/classes.php'); -require (ABSPATH . WPINC . '/template-functions-general.php'); -require (ABSPATH . WPINC . '/template-functions-links.php'); -require (ABSPATH . WPINC . '/template-functions-author.php'); -require (ABSPATH . WPINC . '/template-functions-post.php'); -require (ABSPATH . WPINC . '/template-functions-category.php'); -require (ABSPATH . WPINC . '/comment-functions.php'); -require (ABSPATH . WPINC . '/feed-functions.php'); -require (ABSPATH . WPINC . '/links.php'); -require (ABSPATH . WPINC . '/kses.php'); -require (ABSPATH . WPINC . '/version.php'); - -$is_archived = get_settings( "is_archived" ); -if( $is_archived == 'yes' ) { - die( "This blog has been archived or suspended temporarily. Please check back later." ); -} - -if (!strstr($_SERVER['PHP_SELF'], 'install.php') && !strstr($_SERVER['PHP_SELF'], 'wp-admin/import')) : - // Used to guarantee unique hash cookies - $cookiehash = md5(get_settings('siteurl')); // Remove in 1.4 - define('COOKIEHASH', $cookiehash); -endif; - -require (ABSPATH . WPINC . '/vars.php'); - -do_action('core_files_loaded'); - -// Check for hacks file if the option is enabled -if (get_settings('hack_file')) { - if (file_exists(ABSPATH . '/my-hacks.php')) - require(ABSPATH . '/my-hacks.php'); -} - -if ( get_settings('active_plugins') ) { - $current_plugins = get_settings('active_plugins'); - if ( is_array($current_plugins) ) { - foreach ($current_plugins as $plugin) { - if ('' != $plugin && file_exists(ABSPATH . 'wp-content/plugins/' . $plugin)) - include_once(ABSPATH . 'wp-content/plugins/' . $plugin); - } - } -} - -require (ABSPATH . WPINC . '/pluggable-functions.php'); - -if ( defined('WP_CACHE') && function_exists('wp_cache_postload') ) - wp_cache_postload(); - -do_action('plugins_loaded'); - -define('TEMPLATEPATH', get_template_directory()); - -// Load the default text localization domain. -load_default_textdomain(); - -// Pull in locale data after loading text domain. -require_once(ABSPATH . WPINC . '/locale.php'); - -// If already slashed, strip. -if ( get_magic_quotes_gpc() ) { - $_GET = stripslashes_deep($_GET ); - $_POST = stripslashes_deep($_POST ); - $_COOKIE = stripslashes_deep($_COOKIE); - $_SERVER = stripslashes_deep($_SERVER); -} - -// Escape with wpdb. -$_GET = add_magic_quotes($_GET ); -$_POST = add_magic_quotes($_POST ); -$_COOKIE = add_magic_quotes($_COOKIE); -$_SERVER = add_magic_quotes($_SERVER); - -function shutdown_action_hook() { - do_action('shutdown'); -} -register_shutdown_function('shutdown_action_hook'); - -$wp_query = new WP_Query(); -$wp_rewrite = new WP_Rewrite(); -$wp = new WP(); -$wp_roles = new WP_Roles(); - -// Everything is loaded and initialized. -do_action('init'); -?> +<?php
+$HTTP_HOST = getenv('HTTP_HOST'); /* domain name */
+$REMOTE_ADDR = getenv('REMOTE_ADDR'); /* visitor's IP */
+$HTTP_USER_AGENT = getenv('HTTP_USER_AGENT'); /* visitor's browser */
+
+// Fix for IIS, which doesn't set REQUEST_URI
+if (! isset($_SERVER['REQUEST_URI'])) {
+ $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'];
+
+ // Append the query string if it exists and isn't null
+ if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
+ $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
+ }
+}
+
+if ( !(phpversion() >= '4.1') )
+ die( 'Your server is running PHP version ' . phpversion() . ' but WordPress requires at least 4.1' );
+
+if ( !extension_loaded('mysql') )
+ die( 'Your PHP installation appears to be missing the MySQL which is required for WordPress.' );
+
+function timer_start() {
+ global $timestart;
+ $mtime = explode(' ', microtime() );
+ $mtime = $mtime[1] + $mtime[0];
+ $timestart = $mtime;
+ return true;
+}
+timer_start();
+
+// Change to E_ALL for development/debugging
+error_reporting(E_ALL ^ E_NOTICE);
+
+// For an advanced caching plugin to use, static because you would only want one
+if ( defined('WP_CACHE') )
+ require (ABSPATH . 'wp-content/advanced-cache.php');
+
+define('WPINC', 'wp-includes');
+require_once (ABSPATH . WPINC . '/wp-db.php');
+
+$wpdb->blogs = $table_prefix . 'blogs';
+$wpdb->users = $table_prefix . 'users';
+$wpdb->usermeta = $table_prefix . 'usermeta';
+$wpdb->site = $table_prefix . 'site';
+$wpdb->sitemeta = $table_prefix . 'sitemeta';
+
+// find out what tables to use from $wpblog
+$wpdb->hide_errors();
+
+$domain = $_SERVER['HTTP_HOST'];
+
+$current_blog = $wpdb->get_row("SELECT * FROM $wpdb->blogs WHERE domain = '$domain' AND path = '/'");
+
+$blog_id = $current_blog->blog_id;
+$is_public = $current_blog->is_public;
+if( $blog_id == false ) {
+ // no blog found, are we installing? Check if the table exists.
+ if ( defined('WP_INSTALLING') ) {
+ $query = "SELECT blog_id FROM ".$wpdb->blogs." limit 0,1";
+ $blog_id = $wpdb->get_var( $query );
+ if( $blog_id == false ) {
+ // table doesn't exist. This is the first blog
+ $blog_id = 1;
+ } else {
+ // table exists
+ // don't create record at this stage. we're obviously installing so it doesn't matter what the table vars below are like.
+ // default to using the "main" blog.
+ $blog_id = 1;
+ }
+ } else {
+ die( "No Blog by that name on this system." );
+ }
+}
+
+if( $is_public == 'no' ) {
+ // need to put checks in here?
+ // A hook?
+ die( "This blog is private." );
+}
+
+$wpdb->show_errors();
+
+$table_prefix = $table_prefix.$blog_id."_";
+
+// Table names
+$wpdb->siteid = $site_id;
+$wpdb->blogid = $blog_id;
+$wpdb->posts = $table_prefix . 'posts';
+$wpdb->categories = $table_prefix . 'categories';
+$wpdb->post2cat = $table_prefix . 'post2cat';
+$wpdb->comments = $table_prefix . 'comments';
+$wpdb->links = $table_prefix . 'links';
+$wpdb->linkcategories = $table_prefix . 'linkcategories';
+$wpdb->options = $table_prefix . 'options';
+$wpdb->postmeta = $table_prefix . 'postmeta';
+$wpdb->prefix = $table_prefix;
+
+if ( defined('CUSTOM_USER_TABLE') )
+ $wpdb->users = CUSTOM_USER_TABLE;
+if ( defined('CUSTOM_USER_META_TABLE') )
+ $wpdb->usermeta = CUSTOM_USER_META_TABLE;
+
+// We're going to need to keep this around for a few months even though we're not using it internally
+
+$tableposts = $wpdb->posts;
+$tableusers = $wpdb->users;
+$tablecategories = $wpdb->categories;
+$tablepost2cat = $wpdb->post2cat;
+$tablecomments = $wpdb->comments;
+$tablelinks = $wpdb->links;
+$tablelinkcategories = $wpdb->linkcategories;
+$tableoptions = $wpdb->options;
+$tablepostmeta = $wpdb->postmeta;
+
+require (ABSPATH . WPINC . '/functions.php');
+require (ABSPATH . WPINC . '/default-filters.php');
+require_once (ABSPATH . WPINC . '/wp-l10n.php');
+
+$wpdb->hide_errors();
+if ( !update_category_cache() && (!strstr($_SERVER['PHP_SELF'], 'install.php') && !defined('WP_INSTALLING')) ) {
+ if ( strstr($_SERVER['PHP_SELF'], 'wp-admin') )
+ $link = 'install.php';
+ else
+ $link = 'wp-admin/install.php';
+ die(sprintf(__("It doesn't look like you've installed WP yet. Try running <a href='%s'>install.php</a>."), $link));
+}
+$wpdb->show_errors();
+
+require (ABSPATH . WPINC . '/functions-formatting.php');
+require (ABSPATH . WPINC . '/functions-post.php');
+require (ABSPATH . WPINC . '/capabilities.php');
+require (ABSPATH . WPINC . '/classes.php');
+require (ABSPATH . WPINC . '/template-functions-general.php');
+require (ABSPATH . WPINC . '/template-functions-links.php');
+require (ABSPATH . WPINC . '/template-functions-author.php');
+require (ABSPATH . WPINC . '/template-functions-post.php');
+require (ABSPATH . WPINC . '/template-functions-category.php');
+require (ABSPATH . WPINC . '/comment-functions.php');
+require (ABSPATH . WPINC . '/feed-functions.php');
+require (ABSPATH . WPINC . '/links.php');
+require (ABSPATH . WPINC . '/kses.php');
+require (ABSPATH . WPINC . '/version.php');
+
+$is_archived = get_settings( "is_archived" );
+if( $is_archived == 'yes' ) {
+ die( "This blog has been archived or suspended temporarily. Please check back later." );
+}
+
+if (!strstr($_SERVER['PHP_SELF'], 'install.php') && !strstr($_SERVER['PHP_SELF'], 'wp-admin/import')) :
+ // Used to guarantee unique hash cookies
+ $cookiehash = md5(get_settings('siteurl')); // Remove in 1.4
+ define('COOKIEHASH', $cookiehash);
+endif;
+
+require (ABSPATH . WPINC . '/vars.php');
+
+do_action('core_files_loaded');
+
+// Check for hacks file if the option is enabled
+if (get_settings('hack_file')) {
+ if (file_exists(ABSPATH . '/my-hacks.php'))
+ require(ABSPATH . '/my-hacks.php');
+}
+
+if ( get_settings('active_plugins') ) {
+ $current_plugins = get_settings('active_plugins');
+ if ( is_array($current_plugins) ) {
+ foreach ($current_plugins as $plugin) {
+ if ('' != $plugin && file_exists(ABSPATH . 'wp-content/plugins/' . $plugin))
+ include_once(ABSPATH . 'wp-content/plugins/' . $plugin);
+ }
+ }
+}
+
+require (ABSPATH . WPINC . '/pluggable-functions.php');
+
+if ( defined('WP_CACHE') && function_exists('wp_cache_postload') )
+ wp_cache_postload();
+
+do_action('plugins_loaded');
+
+define('TEMPLATEPATH', get_template_directory());
+
+// Load the default text localization domain.
+load_default_textdomain();
+
+// Pull in locale data after loading text domain.
+require_once(ABSPATH . WPINC . '/locale.php');
+
+// If already slashed, strip.
+if ( get_magic_quotes_gpc() ) {
+ $_GET = stripslashes_deep($_GET );
+ $_POST = stripslashes_deep($_POST );
+ $_COOKIE = stripslashes_deep($_COOKIE);
+ $_SERVER = stripslashes_deep($_SERVER);
+}
+
+// Escape with wpdb.
+$_GET = add_magic_quotes($_GET );
+$_POST = add_magic_quotes($_POST );
+$_COOKIE = add_magic_quotes($_COOKIE);
+$_SERVER = add_magic_quotes($_SERVER);
+
+function shutdown_action_hook() {
+ do_action('shutdown');
+}
+register_shutdown_function('shutdown_action_hook');
+
+$wp_query = new WP_Query();
+$wp_rewrite = new WP_Rewrite();
+$wp = new WP();
+$wp_roles = new WP_Roles();
+
+// Everything is loaded and initialized.
+do_action('init');
+?>
|
