Ticket #994: install-i18n-and-email-check.diff
| File install-i18n-and-email-check.diff, 5.5 KB (added by SteveAgl, 7 years ago) |
|---|
-
install.php
5 5 6 6 require_once('../wp-config.php'); 7 7 require_once('./upgrade-functions.php'); 8 require_once('../wp-includes/functions-formatting.php'); 8 9 9 10 $guessurl = str_replace('/wp-admin/install.php?step=2', '', 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) ); 10 11 … … 90 91 break; 91 92 92 93 case 1: 94 93 95 ?> 94 96 <h1><?php _e('First Step'); ?></h1> 95 97 <p><?php _e("Before we begin we need a little bit of information. Don't worry, you can always change these later."); ?></p> … … 114 116 <?php 115 117 break; 116 118 case 2: 119 120 // Fill in the data we gathered 121 $weblog_title = addslashes(stripslashes(stripslashes($_POST['weblog_title']))); 122 $admin_email = stripslashes(stripslashes($_POST['admin_email'])); 123 // check e-mail address 124 if (empty($admin_email)) { 125 die (__("<strong>ERROR</strong>: please type your e-mail address")); 126 } else if (!is_email($admin_email)) { 127 die (__("<strong>ERROR</strong>: the e-mail address isn't correct")); 128 } 129 $admin_email = addslashes($admin_email); 130 117 131 ?> 118 132 <h1><?php _e('Second Step'); ?></h1> 119 133 <p><?php _e('Now we’re going to create the database tables and fill them with some default data.'); ?></p> … … 126 140 make_db_current_silent(); 127 141 populate_options(); 128 142 129 // Fill in the data we gathered130 $weblog_title = addslashes(stripslashes(stripslashes($_POST['weblog_title'])));131 $admin_email = addslashes(stripslashes(stripslashes($_POST['admin_email'])));132 133 143 $wpdb->query("UPDATE $wpdb->options SET option_value = '$weblog_title' WHERE option_name = 'blogname'"); 134 144 $wpdb->query("UPDATE $wpdb->options SET option_value = '$admin_email' WHERE option_name = 'admin_email'"); 135 145 136 146 // Now drop in some default links 137 $wpdb->query("INSERT INTO $wpdb->linkcategories (cat_id, cat_name) VALUES (1, ' Blogroll')");147 $wpdb->query("INSERT INTO $wpdb->linkcategories (cat_id, cat_name) VALUES (1, '".addslashes(__('Blogroll'))."')"); 138 148 $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/');"); 139 149 $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/');"); 140 150 $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/');"); … … 145 155 $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/');"); 146 156 147 157 // Default category 148 $wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name) VALUES ('0', ' Uncategorized')");158 $wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name) VALUES ('0', '".addslashes(__('Uncategorized'))."')"); 149 159 150 160 // First post 151 161 $now = date('Y-m-d H:i:s'); 152 162 $now_gmt = gmdate('Y-m-d H:i:s'); 153 $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 ('1', '$now', '$now_gmt', ' Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!', 'Hello world!', '0', 'hello-world', '$now', '$now_gmt')");163 $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 ('1', '$now', '$now_gmt', '".addslashes(__('Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!'))."', '".addslashes(__('Hello world!'))."', '0', '".addslashes(__('hello-world'))."', '$now', '$now_gmt')"); 154 164 155 165 $wpdb->query( "INSERT INTO $wpdb->post2cat (`rel_id`, `post_id`, `category_id`) VALUES (1, 1, 1)" ); 156 166 157 167 // Default comment 158 $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', '', '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.')");168 $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.'))."')"); 159 169 160 170 // Set up admin user 161 171 $random_password = substr(md5(uniqid(microtime())), 0, 6); 162 $wpdb->query("INSERT INTO $wpdb->users (ID, user_login, user_pass, user_nickname, user_email, user_level, user_idmode, user_registered) VALUES ( '1', 'admin', MD5('$random_password'), ' Administrator', '$admin_email', '10', 'nickname', NOW() )");172 $wpdb->query("INSERT INTO $wpdb->users (ID, user_login, user_pass, user_nickname, user_email, user_level, user_idmode, user_registered) VALUES ( '1', 'admin', MD5('$random_password'), '".addslashes(__('Administrator'))."', '$admin_email', '10', 'nickname', NOW() )"); 163 173 164 174 $from = 'From: '.$_POST['weblog_title'].' <wordpress@'.$_SERVER['SERVER_NAME'].'>'; 165 175 $message_headers = "$from";
