2003-05-23 07:07:05 -04:00
< ? php
2005-03-17 18:34:06 -05:00
define ( 'WP_INSTALLING' , true );
2004-05-18 16:05:40 -04:00
if ( ! file_exists ( '../wp-config.php' ))
2004-11-27 23:41:48 -05:00
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='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 04:45:55 -04:00
2003-06-12 18:50:20 -04:00
require_once ( '../wp-config.php' );
2004-12-14 02:55:26 -05:00
require_once ( './upgrade-functions.php' );
2003-05-23 07:07:05 -04:00
2005-11-10 20:21:28 -05:00
$schema = ( isset ( $_SERVER [ 'HTTPS' ]) && strtolower ( $_SERVER [ 'HTTPS' ]) == 'on' ) ? 'https://' : 'http://' ;
$guessurl = str_replace ( '/wp-admin/install.php?step=2' , '' , $schema . $_SERVER [ 'HTTP_HOST' ] . dirname ( $_SERVER [ 'PHP_SELF' ]) );
2004-07-23 04:45:55 -04:00
2004-05-09 01:47:02 -04:00
if ( isset ( $_GET [ 'step' ]))
$step = $_GET [ 'step' ];
else
$step = 0 ;
2005-04-18 23:35:48 -04:00
header ( 'Content-Type: text/html; charset=utf-8' );
2003-05-23 07:07:05 -04: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 12:09:18 -04:00
< head >
2005-04-21 20:16:48 -04:00
< title >< ? php _e ( 'WordPress › Installation' ); ?> </title>
2004-07-23 04:45:55 -04:00
< meta http - equiv = " Content-Type " content = " text/html; charset=utf-8 " />
2003-05-23 07:07:05 -04:00
< style media = " screen " type = " text/css " >
2004-07-23 04:45:55 -04:00
<!--
html {
background : #eee;
}
2003-05-23 07:07:05 -04:00
body {
2004-07-23 04:45:55 -04:00
background : #fff;
color : #000;
2003-05-23 07:07:05 -04:00
font - family : Georgia , " Times New Roman " , Times , serif ;
2004-07-23 04:45:55 -04:00
margin - left : 20 % ;
margin - right : 20 % ;
padding : . 2 em 2 em ;
2003-05-23 07:07:05 -04:00
}
2006-02-12 02:53:23 -05:00
2004-07-23 04:45:55 -04:00
h1 {
color : #006;
font - size : 18 px ;
font - weight : lighter ;
2003-05-23 07:07:05 -04:00
}
2006-02-12 02:53:23 -05:00
2004-07-23 04:45:55 -04:00
h2 {
font - size : 16 px ;
2003-05-23 07:07:05 -04:00
}
2006-02-12 02:53:23 -05:00
2004-07-23 04:45:55 -04:00
p , li , dt {
2003-05-23 07:07:05 -04:00
line - height : 140 % ;
2004-07-23 04:45:55 -04:00
padding - bottom : 2 px ;
2003-05-23 07:07:05 -04:00
}
2004-06-11 12:09:18 -04:00
2004-07-23 04:45:55 -04:00
ul , ol {
padding : 5 px 5 px 5 px 20 px ;
}
#logo {
margin - bottom : 2 em ;
}
2005-01-24 02:44:38 -05:00
. step a , . step input {
font - size : 2 em ;
}
td input {
font - size : 1.5 em ;
}
. step , th {
text - align : right ;
}
#footer {
text - align : center ;
border - top : 1 px solid #ccc;
padding - top : 1 em ;
font - style : italic ;
}
2004-07-23 04:45:55 -04:00
-->
2003-05-23 07:07:05 -04:00
</ style >
</ head >
< body >
2005-11-17 04:55:53 -05:00
< h1 id = " logo " >< img alt = " WordPress " src = " images/wordpress-logo.png " /></ h1 >
2003-05-23 07:07:05 -04:00
< ? php
2004-07-23 04:45:55 -04:00
// Let's check to make sure WP isn't already installed.
2003-10-07 13:28:40 -04:00
$wpdb -> hide_errors ();
2004-05-24 04:22:18 -04:00
$installed = $wpdb -> get_results ( " SELECT * FROM $wpdb->users " );
2005-12-02 17:37:02 -05: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 13:28:40 -04:00
$wpdb -> show_errors ();
2004-07-23 04:45:55 -04:00
2003-05-23 07:07:05 -04:00
switch ( $step ) {
case 0 :
?>
2005-02-27 18:09:58 -05:00
< p >< ? php printf ( __ ( 'Welcome to WordPress installation. We’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="%s">ReadMe documentation</a> at your leisure.' ), '../readme.html' ); ?> </p>
< h2 class = " step " >< a href = " install.php?step=1 " >< ? php _e ( 'First Step »' ); ?> </a></h2>
2003-05-23 07:07:05 -04:00
< ? php
break ;
2003-08-03 19:46:20 -04:00
2003-05-23 07:07:05 -04:00
case 1 :
2005-03-04 21:27:08 -05:00
2003-05-23 07:07:05 -04:00
?>
2005-02-27 18:09:58 -05:00
< h1 >< ? php _e ( 'First Step' ); ?> </h1>
< p >< ? php _e ( " Before we begin we need a little bit of information. Don't worry, you can always change these later. " ); ?> </p>
2004-07-23 04:45:55 -04:00
2005-01-24 02:44:38 -05:00
< form id = " setup " method = " post " action = " install.php?step=2 " >
2004-07-23 04:45:55 -04:00
< table width = " 100% " >
< tr >
2005-02-27 18:09:58 -05:00
< th width = " 33% " >< ? php _e ( 'Weblog title:' ); ?> </th>
2004-07-23 04:45:55 -04:00
< td >< input name = " weblog_title " type = " text " id = " weblog_title " size = " 25 " /></ td >
</ tr >
< tr >
2005-02-27 18:09:58 -05:00
< th >< ? php _e ( 'Your e-mail:' ); ?> </th>
2004-07-23 04:45:55 -04:00
< td >< input name = " admin_email " type = " text " id = " admin_email " size = " 25 " /></ td >
</ tr >
2006-02-18 02:40:43 -05:00
< tr >
< th scope = " row " valign = " top " > < ? php __ ( 'Privacy:' ); ?> </th>
< td >< label >< input type = " checkbox " name = " blog_public " value = " 1 " checked = " checked " /> < ? php _e ( 'I would like my blog to appear in search engines like Google and Technorati.' ); ?> </label></td>
</ tr >
2004-07-23 04:45:55 -04:00
</ table >
2005-02-27 18:09:58 -05:00
< p >< em >< ? php _e ( 'Double-check that email address before continuing.' ); ?> </em></p>
2004-07-23 04:45:55 -04:00
< h2 class = " step " >
2005-02-27 18:09:58 -05:00
< input type = " submit " name = " Submit " value = " <?php _e('Continue to Second Step »'); ?> " />
2004-07-23 04:45:55 -04:00
</ h2 >
</ form >
< ? php
break ;
case 2 :
2005-03-04 21:27:08 -05:00
// Fill in the data we gathered
2005-11-20 02:40:17 -05:00
$weblog_title = stripslashes ( $_POST [ 'weblog_title' ]);
$admin_email = stripslashes ( $_POST [ 'admin_email' ]);
2006-02-18 02:40:43 -05:00
$public = ( int ) $_POST [ 'blog_public' ];
2005-03-04 21:27:08 -05:00
// check e-mail address
if ( empty ( $admin_email )) {
die ( __ ( " <strong>ERROR</strong>: please type your e-mail address " ));
} else if ( ! is_email ( $admin_email )) {
die ( __ ( " <strong>ERROR</strong>: the e-mail address isn't correct " ));
}
2006-02-12 02:53:23 -05:00
2004-07-23 04:45:55 -04:00
?>
2005-02-27 18:09:58 -05:00
< h1 >< ? php _e ( 'Second Step' ); ?> </h1>
< p >< ? php _e ( 'Now we’re going to create the database tables and fill them with some default data.' ); ?> </p>
2004-07-23 04:45:55 -04:00
2003-05-23 07:07:05 -04:00
< ? php
2004-09-04 21:22:17 -04:00
flush ();
2003-05-23 07:07:05 -04:00
2004-09-04 21:22:17 -04:00
// Set everything up
2005-11-14 17:32:03 -05:00
wp_cache_flush ();
2004-09-04 21:22:17 -04:00
make_db_current_silent ();
populate_options ();
2005-10-27 18:04:12 -04:00
populate_roles ();
2003-05-23 07:07:05 -04:00
2005-11-14 01:51:09 -05:00
update_option ( 'blogname' , $weblog_title );
update_option ( 'admin_email' , $admin_email );
2006-02-18 02:40:43 -05:00
update_option ( 'blog_public' , $public );
// If not a public blog, don't ping.
if ( ! $public )
update_option ( 'default_pingback_flag' , 0 );
2003-05-23 07:07:05 -04:00
2004-09-04 21:22:17 -04:00
// Default category
2005-12-10 18:22:47 -05:00
$wpdb -> query ( " INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename, category_count, category_description) VALUES ('0', ' " . $wpdb -> escape ( __ ( 'Uncategorized' )) . " ', ' " . sanitize_title ( __ ( 'Uncategorized' )) . " ', '1', '') " );
2003-05-23 07:07:05 -04:00
2006-02-26 23:57:30 -05:00
// Default link category
$wpdb -> query ( " INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename, link_count, category_description) VALUES ('0', ' " . $wpdb -> escape ( __ ( 'Blogroll' )) . " ', ' " . sanitize_title ( __ ( 'Blogroll' )) . " ', '7', '') " );
// Now drop in some default links
$wpdb -> query ( " INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://blogs.linux.ie/xeer/', 'Donncha', 0, 'http://blogs.linux.ie/xeer/feed/', ''); " );
$wpdb -> query ( " INSERT INTO $wpdb->link2cat (`link_id`, `category_id`) VALUES (1, 2) " );
$wpdb -> query ( " INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://zengun.org/weblog/', 'Michel', 0, 'http://zengun.org/weblog/feed/', ''); " );
$wpdb -> query ( " INSERT INTO $wpdb->link2cat (`link_id`, `category_id`) VALUES (2, 2) " );
$wpdb -> query ( " INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://boren.nu/', 'Ryan', 0, 'http://boren.nu/feed/', ''); " );
$wpdb -> query ( " INSERT INTO $wpdb->link2cat (`link_id`, `category_id`) VALUES (3, 2) " );
$wpdb -> query ( " INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://photomatt.net/', 'Matt', 0, 'http://xml.photomatt.net/feed/', ''); " );
$wpdb -> query ( " INSERT INTO $wpdb->link2cat (`link_id`, `category_id`) VALUES (4, 2) " );
$wpdb -> query ( " INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://zed1.com/journalized/', 'Mike', 0, 'http://zed1.com/journalized/feed/', ''); " );
$wpdb -> query ( " INSERT INTO $wpdb->link2cat (`link_id`, `category_id`) VALUES (5, 2) " );
$wpdb -> query ( " INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://www.alexking.org/', 'Alex', 0, 'http://www.alexking.org/blog/wp-rss2.php', ''); " );
$wpdb -> query ( " INSERT INTO $wpdb->link2cat (`link_id`, `category_id`) VALUES (6, 2) " );
$wpdb -> query ( " INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://dougal.gunters.org/', 'Dougal', 0, 'http://dougal.gunters.org/feed/', ''); " );
$wpdb -> query ( " INSERT INTO $wpdb->link2cat (`link_id`, `category_id`) VALUES (7, 2) " );
2004-09-04 21:22:17 -04:00
// First post
2003-05-23 07:07:05 -04:00
$now = date ( 'Y-m-d H:i:s' );
2004-04-01 20:21:29 -05:00
$now_gmt = gmdate ( 'Y-m-d H:i:s' );
2005-12-10 18:22:47 -05:00
$wpdb -> query ( " INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_excerpt, post_title, post_category, post_name, post_modified, post_modified_gmt, comment_count, to_ping, pinged, post_content_filtered) VALUES ('1', ' $now ', ' $now_gmt ', ' " . $wpdb -> escape ( __ ( 'Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!' )) . " ', '', ' " . $wpdb -> escape ( __ ( 'Hello world!' )) . " ', '0', ' " . $wpdb -> escape ( __ ( 'hello-world' )) . " ', ' $now ', ' $now_gmt ', '1', '', '', '') " );
2004-10-26 12:28:43 -04:00
2004-11-15 00:59:34 -05:00
$wpdb -> query ( " INSERT INTO $wpdb->post2cat (`rel_id`, `post_id`, `category_id`) VALUES (1, 1, 1) " );
2004-02-26 17:21:33 -05:00
2004-09-04 21:22:17 -04:00
// Default comment
2005-10-12 14:21:15 -04:00
$wpdb -> query ( " INSERT INTO $wpdb->comments (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_date, comment_date_gmt, comment_content) VALUES ('1', ' " . $wpdb -> escape ( __ ( 'Mr WordPress' )) . " ', '', 'http://wordpress.org/', ' $now ', ' $now_gmt ', ' " . $wpdb -> escape ( __ ( '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 17:21:33 -05:00
2005-06-16 05:05:06 -04:00
// First Page
2006-02-09 05:03:48 -05:00
$wpdb -> query ( " INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_excerpt, post_title, post_category, post_name, post_modified, post_modified_gmt, post_status, post_type, to_ping, pinged, post_content_filtered) VALUES ('1', ' $now ', ' $now_gmt ', ' " . $wpdb -> escape ( __ ( '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.' )) . " ', '', ' " . $wpdb -> escape ( __ ( 'About' )) . " ', '0', ' " . $wpdb -> escape ( __ ( 'about' )) . " ', ' $now ', ' $now_gmt ', 'publish', 'page', '', '', '') " );
2005-12-28 02:05:05 -05:00
$wp_rewrite -> flush_rules ();
2005-06-16 05:05:06 -04:00
2004-09-04 21:22:17 -04:00
// Set up admin user
$random_password = substr ( md5 ( uniqid ( microtime ())), 0 , 6 );
2005-08-19 21:43:43 -04:00
$display_name_array = explode ( '@' , $admin_email );
$display_name = $display_name_array [ 0 ];
2005-11-05 22:16:59 -05:00
$wpdb -> query ( " INSERT INTO $wpdb->users (ID, user_login, user_pass, user_email, user_registered, display_name, user_nicename) VALUES ( '1', 'admin', MD5(' $random_password '), ' $admin_email ', NOW(), ' $display_name ', 'admin') " );
2006-03-03 15:36:40 -05:00
$wpdb -> query ( " INSERT INTO $wpdb->usermeta (user_id, meta_key, meta_value) VALUES ( { $wpdb -> insert_id } , ' { $wpdb -> prefix } user_level', '10'); " );
2005-07-13 15:55:05 -04:00
$admin_caps = serialize ( array ( 'administrator' => true ));
2006-03-03 15:36:40 -05:00
$wpdb -> query ( " INSERT INTO $wpdb->usermeta (user_id, meta_key, meta_value) VALUES ( { $wpdb -> insert_id } , ' { $wpdb -> prefix } capabilities', ' { $admin_caps } '); " );
2004-08-21 16:48:32 -04:00
2005-11-20 02:40:17 -05:00
$message_headers = 'From: ' . $weblog_title . ' <wordpress@' . $_SERVER [ 'SERVER_NAME' ] . '>' ;
2005-02-27 18:09:58 -05:00
$message = sprintf ( __ ( " Your new WordPress blog has been successfully set up at:
2004-08-21 16:48:32 -04:00
2005-02-27 18:09:58 -05:00
% 1 \ $s
2004-08-21 16:48:32 -04:00
You can log in to the administrator account with the following information :
Username : admin
2005-02-27 18:09:58 -05:00
Password : % 2 \ $s
2004-08-21 16:48:32 -04:00
We hope you enjoy your new weblog . Thanks !
-- The WordPress Team
http :// wordpress . org /
2005-02-27 18:09:58 -05:00
" ), $guessurl , $random_password );
2005-02-10 20:31:23 -05:00
2005-09-02 13:12:58 -04:00
@ wp_mail ( $admin_email , __ ( 'New WordPress Blog' ), $message , $message_headers );
2004-09-04 21:22:17 -04:00
2005-11-14 17:32:03 -05:00
wp_cache_flush ();
2003-05-23 07:07:05 -04:00
?>
2005-02-27 18:09:58 -05:00
< p >< em >< ? php _e ( 'Finished!' ); ?> </em></p>
2003-05-23 07:07:05 -04:00
2005-03-13 12:06:18 -05:00
< p >< ? php printf ( __ ( 'Now you can <a href="%1$s">log in</a> with the <strong>username</strong> "<code>admin</code>" and <strong>password</strong> "<code>%2$s</code>".' ), '../wp-login.php' , $random_password ); ?> </p>
2005-03-02 10:42:59 -05:00
< p >< ? php _e ( '<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 will have to delete the tables from the database yourself, and re-install WordPress. So to review:' ); ?>
2003-05-23 07:07:05 -04:00
</ p >
2004-07-23 04:45:55 -04:00
< dl >
2005-03-13 12:06:18 -05:00
< dt >< ? php _e ( 'Username' ); ?> </dt>
2004-07-23 04:45:55 -04:00
< dd >< code > admin </ code ></ dd >
2005-02-27 18:09:58 -05:00
< dt >< ? php _e ( 'Password' ); ?> </dt>
2004-07-23 04:45:55 -04:00
< dd >< code >< ? php echo $random_password ; ?> </code></dd>
2005-02-27 18:09:58 -05:00
< dt >< ? php _e ( 'Login address' ); ?> </dt>
2004-09-04 21:22:17 -04:00
< dd >< a href = " ../wp-login.php " > wp - login . php </ a ></ dd >
2004-07-23 04:45:55 -04:00
</ dl >
2005-02-27 18:09:58 -05:00
< p >< ? php _e ( 'Were you expecting more steps? Sorry to disappoint. All done! :)' ); ?> </p>
2003-05-23 07:07:05 -04:00
< ? php
break ;
}
?>
2005-02-27 18:09:58 -05:00
< p id = " footer " >< ? php _e ( '<a href="http://wordpress.org/">WordPress</a>, personal publishing platform.' ); ?> </p>
2003-05-23 07:07:05 -04:00
</ body >
2004-10-26 12:28:43 -04:00
</ html >