Get your own blog"; if( is_array( $errormsg ) ) { print "

There was a problem, please correct the form below and try again.

"; } print '
'; if( isset( $errormsg[ 'weblog_id' ] ) == true ) { print ''; } else { print ''; } print ' '; if( $errormsg[ 'weblog_title' ] != '' ) { print ''; } else { print ''; } print ' '; if( $errormsg[ 'admin_email' ] != '' ) { print ''; } else { print ''; } print ' '; if( $form == 'adminform' ) { print ' '; } print ' '; do_action( "newblogform", "" ); print '
Username:
(This will also be your blog address. Letters and numbers only, please.)
Blog Name:
(Don\'t worry, you can change it later.)
Email Address:
(We\'ll send a password to this address, so double-check it.)
You have tried to setup a new domain. Please enter the administrator password for this site.
Admin Password:
 
'; } function displaySecondForm() { global $url; print "

You've got a new blog!

"; print "

Your new address is ".$url."

You should receive an email with the login details shortly.

"; print "

Visit: $url
"; print "Login: ".$url."wp-login.php

"; do_action( "newblogfinished", "" ); } /* Determines the directory path - using the current script */ function determineDirPath() { global $_SERVER; $result = dirname( $_SERVER["SCRIPT_NAME"] ); $result = str_replace("wp-inst","",$result); if( strlen( $result > 1 ) && substr($result, -1 ) == '/') { $result = substr($result, 0, -1); } return $result; } switch( $_POST[ 'stage' ] ) { case "1": $newBlogID = sanitize_title($_POST['weblog_id']); $weblog_title = stripslashes( $_POST[ 'weblog_title' ] ); $admin_email = $_POST[ 'admin_email' ]; if( is_email( $admin_email ) == false ) $errormsg[ 'admin_email' ] = true; if( empty( $newBlogID ) ) $errormsg[ 'weblog_id' ] = true; if( empty( $weblog_title ) ) $errormsg[ 'weblog_title' ] = true; if( is_array( $errormsg ) ) { displayInitialForm( $_POST[ 'weblog_id' ], $weblog_title, $_POST[ 'admin_email' ], $_POST[ 'admin_login' ], 'userform', $errormsg ); } elseif( isset($newBlogID) && ($newBlogID !='' )) { $scriptBaseName = determineDirPath(); $serverName = $_SERVER[ 'SERVER_NAME' ]; define( "WP_INSTALLING", true ); require_once('./wp-config.php'); // check if "main" being installed. ask for admin pw if not defined.. $setup = true; if( $newBlogID == 'main' && isset( $_POST[ 'admin_pw' ] ) == false ) { displayInitialForm( $_POST[ 'weblog_id' ], $weblog_title, $_POST[ 'admin_email' ], $_POST[ 'admin_login' ], 'adminform' ); $setup = false; } elseif( $newBlogID == 'main' && isset( $_POST[ 'admin_pw' ] ) == true ) { $query = "SELECT ID FROM ".$wpdb->users." WHERE user_pass = '".md5( $_POST[ 'admin_pw' ] )."' AND user_login = 'admin'"; $admin_id = $wpdb->get_var( $query ); if( $admin_id != 1 ) { displayInitialForm( $_POST[ 'weblog_id' ], $_POST[ 'weblog_title' ], $_POST[ 'admin_email' ], $_POST[ 'admin_login' ], 'adminform' ); $setup = false; } } if( substr( $domain, 0, 4 ) == 'www.' ) $domain = substr( $domain, 4 ); if( $setup == true ) { if( defined( "VHOST" ) && constant( "VHOST" ) == 'yes' ) { if( $newBlogID == 'main' ) { $url = 'http://www'.$domain.$scriptBaseName; } else { $url = 'http://'.$newBlogID.".".$domain.$scriptBaseName; } } else { $url = 'http://'.$serverName.$scriptBaseName.$newBlogID."/"; } $err = createBlog( $_SERVER[ 'HTTP_HOST' ], $domain, $scriptBaseName, $newBlogID, $weblog_title, $admin_email, $newBlogID ); if( $err == 'ok' ) { displaySecondForm(); } else { if( $err == 'error: username used' ) { $errormsg[ 'weblog_id' ] = "Sorry, that blog already exists!"; } else { $errormsg[ 'weblog_id' ] = "Sorry, that blog already exists!"; } displayInitialForm( $_POST[ 'weblog_id' ], $weblog_title, $_POST[ 'admin_email' ], $_POST[ 'admin_login' ], 'userform', $errormsg ); } } } else { $errormsg[ 'weblog_id' ] = "Sorry, your blog ID may only contain the characters a-z, A-Z, or 0-9!"; displayInitialForm( $_POST[ 'weblog_id' ], $weblog_title, $_POST[ 'admin_email' ], $_POST[ 'admin_login' ], 'userform', $errormsg ); } break; default: displayInitialForm(); break; } ?>