2003-05-23 13:07:05 +02:00
< ? php
2003-06-16 01:18:33 +02:00
$_wp_installing = 1 ;
2004-05-18 22:05:40 +02:00
if ( ! file_exists ( '../wp-config.php' ))
die ( " There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='http://wordpress.org/docs/faq/#wp-config'>We got it</a>. You can <a href='wp-admin/setup-config.php'>create a <code>wp-config.php</code> file through a web interface</a>, but this doesn't work for all server setups. The safest way is to manually create the file. " );
2004-07-23 10:45:55 +02:00
2003-06-13 00:50:20 +02:00
require_once ( '../wp-config.php' );
2004-09-05 03:22:17 +02:00
require ( './upgrade-functions.php' );
2003-05-23 13:07:05 +02:00
2004-07-23 10:45:55 +02:00
$guessurl = str_replace ( '/wp-admin/install.php?step=2' , '' , 'http://' . $HTTP_HOST . $REQUEST_URI );
2004-05-09 07:47:02 +02:00
if ( isset ( $_GET [ 'step' ]))
$step = $_GET [ 'step' ];
else
$step = 0 ;
2003-05-23 13:07:05 +02:00
?>
<! 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 " >
2004-06-11 18:09:18 +02:00
< head >
2003-12-30 10:31:13 +01:00
< title > WordPress & rsaquo ; Installation </ title >
2004-07-23 10:45:55 +02:00
< meta http - equiv = " Content-Type " content = " text/html; charset=utf-8 " />
2003-05-23 13:07:05 +02:00
< style media = " screen " type = " text/css " >
2004-07-23 10:45:55 +02:00
<!--
html {
background : #eee;
}
2003-05-23 13:07:05 +02:00
body {
2004-07-23 10:45:55 +02:00
background : #fff;
color : #000;
2003-05-23 13:07:05 +02:00
font - family : Georgia , " Times New Roman " , Times , serif ;
2004-07-23 10:45:55 +02:00
margin - left : 20 % ;
margin - right : 20 % ;
padding : . 2 em 2 em ;
2003-05-23 13:07:05 +02:00
}
2004-07-23 10:45:55 +02:00
h1 {
color : #006;
font - size : 18 px ;
font - weight : lighter ;
2003-05-23 13:07:05 +02:00
}
2004-07-23 10:45:55 +02:00
h2 {
font - size : 16 px ;
2003-05-23 13:07:05 +02:00
}
2004-07-23 10:45:55 +02:00
p , li , dt {
2003-05-23 13:07:05 +02:00
line - height : 140 % ;
2004-07-23 10:45:55 +02:00
padding - bottom : 2 px ;
2003-05-23 13:07:05 +02:00
}
2004-06-11 18:09:18 +02:00
2004-07-23 10:45:55 +02:00
ul , ol {
padding : 5 px 5 px 5 px 20 px ;
}
#logo {
margin - bottom : 2 em ;
}
. step a , . step input {
font - size : 2 em ;
}
. step , th {
text - align : right ;
}
#footer {
text - align : center ; border - top : 1 px solid #ccc; padding-top: 1em; font-style: italic;
}
-->
2003-05-23 13:07:05 +02:00
</ style >
</ head >
< body >
2004-07-23 10:45:55 +02:00
< h1 id = " logo " >< img alt = " WordPress " src = " http://static.wordpress.org/logo.png " /></ h1 >
2003-05-23 13:07:05 +02:00
< ? php
2004-07-23 10:45:55 +02:00
// Let's check to make sure WP isn't already installed.
2003-10-07 19:28:40 +02:00
$wpdb -> hide_errors ();
2004-05-24 10:22:18 +02:00
$installed = $wpdb -> get_results ( " SELECT * FROM $wpdb->users " );
2004-07-23 10:45:55 +02:00
if ( $installed ) die ( __ ( '<h1>Already Installed</h1><p>You appear to have already installed WordPress. To reinstall please clear your old database tables first.</p></body></html>' ));
2003-10-07 19:28:40 +02:00
$wpdb -> show_errors ();
2004-07-23 10:45:55 +02:00
2003-05-23 13:07:05 +02:00
switch ( $step ) {
case 0 :
?>
2004-07-23 10:45:55 +02:00
< p > Welcome to WordPress installation . We & #8217;re now going to go through a few steps to get you up and running with the latest in personal publishing platforms. You may want to peruse the <a href="../readme.html">ReadMe documentation</a> at your leisure.</p>
< h2 class = " step " >< a href = " install.php?step=1 " > First Step & raquo ; </ a ></ h2 >
2003-05-23 13:07:05 +02:00
< ? php
break ;
2003-08-04 01:46:20 +02:00
2003-05-23 13:07:05 +02:00
case 1 :
?>
2004-07-23 10:45:55 +02:00
< h1 > First Step </ h1 >
< p > Before we begin we need a little bit of information . Don ' t worry , you can always change these later . </ p >
2004-09-05 03:22:17 +02:00
< form name = " setup " id = " setup " method = " post " action = " install.php?step=2 " >
2004-07-23 10:45:55 +02:00
< table width = " 100% " >
< tr >
< th width = " 33% " > Weblog title :</ th >
< td >< input name = " weblog_title " type = " text " id = " weblog_title " size = " 25 " /></ td >
</ tr >
< tr >
< th > Your e - mail :</ th >
< td >< input name = " admin_email " type = " text " id = " admin_email " size = " 25 " /></ td >
</ tr >
</ table >
2004-08-21 22:48:32 +02:00
< p >< em > Double - check that email address before continuing .</ em ></ p >
2004-07-23 10:45:55 +02:00
< h2 class = " step " >
< input type = " submit " name = " Submit " value = " Continue to Second Step » " />
</ h2 >
</ form >
< ? php
break ;
case 2 :
?>
< h1 > Second Step </ h1 >
< p > Now we & #8217;re going to create the database tables and fill them with some default data.</p>
2003-05-23 13:07:05 +02:00
< ? php
2004-09-05 03:22:17 +02:00
flush ();
2003-05-23 13:07:05 +02:00
2004-09-05 03:22:17 +02:00
// Set everything up
make_db_current_silent ();
populate_options ();
2003-05-23 13:07:05 +02:00
2004-09-05 03:22:17 +02:00
// Fill in the data we gathered
$weblog_title = addslashes ( stripslashes ( stripslashes ( $_POST [ 'weblog_title' ])));
$admin_email = addslashes ( stripslashes ( stripslashes ( $_POST [ 'admin_email' ])));
2003-05-23 13:07:05 +02:00
2004-09-05 03:22:17 +02:00
$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' " );
2003-05-23 13:07:05 +02:00
2004-09-05 03:22:17 +02:00
// Now drop in some default links
$wpdb -> query ( " INSERT INTO $wpdb->linkcategories (cat_id, cat_name) VALUES (1, 'Blogroll') " );
$wpdb -> query ( " INSERT INTO $wpdb->links (link_url, link_name, link_category) VALUES ('http://photomatt.net/', 'Matt', 1); " );
$wpdb -> query ( " INSERT INTO $wpdb->links (link_url, link_name, link_category) VALUES ('http://zed1.com/journalized/', 'Mike', 1); " );
$wpdb -> query ( " INSERT INTO $wpdb->links (link_url, link_name, link_category) VALUES ('http://www.alexking.org/', 'Alex', 1); " );
$wpdb -> query ( " INSERT INTO $wpdb->links (link_url, link_name, link_category) VALUES ('http://dougal.gunters.org/', 'Dougal', 1); " );
2003-05-23 13:07:05 +02:00
2004-09-05 03:22:17 +02:00
// Default category
$wpdb -> query ( " INSERT INTO $wpdb->categories (cat_ID, cat_name) VALUES ('0', 'Uncategorized') " );
2003-05-23 13:07:05 +02:00
2004-09-05 03:22:17 +02:00
// First post
2003-05-23 13:07:05 +02:00
$now = date ( 'Y-m-d H:i:s' );
2004-04-02 03:21:29 +02:00
$now_gmt = gmdate ( 'Y-m-d H:i:s' );
2004-09-05 03:22:17 +02:00
$wpdb -> query ( " INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_title, post_modified, post_modified_gmt) VALUES ('1', ' $now ', ' $now_gmt ', 'Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!', 'Hello world!', ' $now ', ' $now_gmt ') " );
2004-02-26 23:21:33 +01:00
2004-09-05 03:22:17 +02:00
// 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', 'Mr WordPress', 'mr@wordpress.org', 'http://wordpress.org', '127.0.0.1', ' $now ', ' $now_gmt ', '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.') " );
2004-02-26 23:21:33 +01:00
2004-09-05 03:22:17 +02:00
// Set up admin user
$random_password = substr ( md5 ( uniqid ( microtime ())), 0 , 6 );
$wpdb -> query ( " INSERT INTO $wpdb->users (ID, user_login, user_pass, user_nickname, user_email, user_level, user_idmode) VALUES ( '1', 'admin', MD5(' $random_password '), 'Administrator', ' $admin_email ', '10', 'nickname') " );
2004-08-21 22:48:32 +02:00
2004-09-23 13:42:40 +02:00
$from = 'From: ' . $_POST [ 'weblog_title' ] . ' <wordpress@' . $_SERVER [ 'SERVER_NAME' ] . '>' ;
$message_headers = " $from " ;
mail ( $admin_email , 'New WordPress Blog' , " Your new WordPress blog has been successfully set up at:
2004-08-21 22:48:32 +02:00
$guessurl
You can log in to the administrator account with the following information :
Username : admin
Password : $random_password
We hope you enjoy your new weblog . Thanks !
-- The WordPress Team
http :// wordpress . org /
2004-09-23 13:42:40 +02:00
" , $message_headers );
2004-09-05 03:22:17 +02:00
upgrade_all ();
2003-05-23 13:07:05 +02:00
?>
2004-09-05 03:22:17 +02:00
< p >< em > Finished !</ em ></ p >
2003-05-23 13:07:05 +02:00
2003-12-11 01:22:36 +01:00
< p > Now you can < a href = " ../wp-login.php " > log in </ a > with the < strong > login </ strong >
2004-02-17 05:08:03 +01:00
" <code>admin</code> " and < strong > password </ strong > " <code><?php echo $random_password ; ?></code> " .</ p >
2003-08-04 01:46:20 +02:00
< p >< strong >< em > Note that password </ em ></ strong > carefully ! It is a < em > random </ em >
password that was generated just for you . If you lose it , you
2004-07-23 10:45:55 +02:00
will have to delete the tables from the database yourself , and re - install WordPress . So to review :
2003-05-23 13:07:05 +02:00
</ p >
2004-07-23 10:45:55 +02:00
< dl >
< dt > Login </ dt >
< dd >< code > admin </ code ></ dd >
< dt > Password </ dt >
< dd >< code >< ? php echo $random_password ; ?> </code></dd>
2004-09-05 03:22:17 +02:00
< dt > Login address </ dt >
< dd >< a href = " ../wp-login.php " > wp - login . php </ a ></ dd >
2004-07-23 10:45:55 +02:00
</ dl >
2004-09-05 03:22:17 +02:00
< p > Were you expecting more steps ? Sorry to disappoint . All done ! : ) </ p >
2003-05-23 13:07:05 +02:00
< ? php
break ;
}
?>
2004-07-23 10:45:55 +02:00
< p id = " footer " >< a href = " http://wordpress.org/ " > WordPress </ a > , personal publishing platform .</ p >
2003-05-23 13:07:05 +02:00
</ body >
</ html >