author | ymh <ymh.work@gmail.com> |
Mon, 14 Oct 2019 18:28:13 +0200 | |
changeset 9 | 177826044cd9 |
parent 7 | cf61fcea0001 |
child 16 | a86126ab1dd4 |
permissions | -rw-r--r-- |
0 | 1 |
<?php |
2 |
/** |
|
3 |
* WordPress Installer |
|
4 |
* |
|
5 |
* @package WordPress |
|
6 |
* @subpackage Administration |
|
7 |
*/ |
|
8 |
||
9 |
// Sanity check. |
|
10 |
if ( false ) { |
|
9 | 11 |
?> |
0 | 12 |
<!DOCTYPE html> |
13 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
14 |
<head> |
|
15 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
|
16 |
<title>Error: PHP is not running</title> |
|
17 |
</head> |
|
18 |
<body class="wp-core-ui"> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
19 |
<p id="logo"><a href="https://wordpress.org/">WordPress</a></p> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
20 |
<h1>Error: PHP is not running</h1> |
0 | 21 |
<p>WordPress requires that your web server is running PHP. Your server does not have PHP installed, or PHP is turned off.</p> |
22 |
</body> |
|
23 |
</html> |
|
9 | 24 |
<?php |
0 | 25 |
} |
26 |
||
27 |
/** |
|
28 |
* We are installing WordPress. |
|
29 |
* |
|
30 |
* @since 1.5.1 |
|
31 |
* @var bool |
|
32 |
*/ |
|
33 |
define( 'WP_INSTALLING', true ); |
|
34 |
||
35 |
/** Load WordPress Bootstrap */ |
|
36 |
require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' ); |
|
37 |
||
38 |
/** Load WordPress Administration Upgrade API */ |
|
39 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
40 |
||
5 | 41 |
/** Load WordPress Translation Install API */ |
42 |
require_once( ABSPATH . 'wp-admin/includes/translation-install.php' ); |
|
43 |
||
0 | 44 |
/** Load wpdb */ |
5 | 45 |
require_once( ABSPATH . WPINC . '/wp-db.php' ); |
46 |
||
47 |
nocache_headers(); |
|
0 | 48 |
|
49 |
$step = isset( $_GET['step'] ) ? (int) $_GET['step'] : 0; |
|
50 |
||
51 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
52 |
* Display installation header. |
0 | 53 |
* |
54 |
* @since 2.5.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
55 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
56 |
* @param string $body_classes |
0 | 57 |
*/ |
5 | 58 |
function display_header( $body_classes = '' ) { |
0 | 59 |
header( 'Content-Type: text/html; charset=utf-8' ); |
5 | 60 |
if ( is_rtl() ) { |
61 |
$body_classes .= 'rtl'; |
|
62 |
} |
|
63 |
if ( $body_classes ) { |
|
64 |
$body_classes = ' ' . $body_classes; |
|
65 |
} |
|
9 | 66 |
?> |
0 | 67 |
<!DOCTYPE html> |
68 |
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>> |
|
69 |
<head> |
|
5 | 70 |
<meta name="viewport" content="width=device-width" /> |
0 | 71 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
72 |
<meta name="robots" content="noindex,nofollow" /> |
0 | 73 |
<title><?php _e( 'WordPress › Installation' ); ?></title> |
9 | 74 |
<?php wp_admin_css( 'install', true ); ?> |
0 | 75 |
</head> |
9 | 76 |
<body class="wp-core-ui<?php echo $body_classes; ?>"> |
77 |
<p id="logo"><a href="<?php echo esc_url( __( 'https://wordpress.org/' ) ); ?>"><?php _e( 'WordPress' ); ?></a></p> |
|
0 | 78 |
|
9 | 79 |
<?php |
0 | 80 |
} // end display_header() |
81 |
||
82 |
/** |
|
83 |
* Display installer setup form. |
|
84 |
* |
|
85 |
* @since 2.8.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
86 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
87 |
* @global wpdb $wpdb WordPress database abstraction object. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
88 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
89 |
* @param string|null $error |
0 | 90 |
*/ |
91 |
function display_setup_form( $error = null ) { |
|
92 |
global $wpdb; |
|
5 | 93 |
|
9 | 94 |
$sql = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $wpdb->users ) ); |
5 | 95 |
$user_table = ( $wpdb->get_var( $sql ) != null ); |
0 | 96 |
|
5 | 97 |
// Ensure that Blogs appear in search engines by default. |
0 | 98 |
$blog_public = 1; |
5 | 99 |
if ( isset( $_POST['weblog_title'] ) ) { |
0 | 100 |
$blog_public = isset( $_POST['blog_public'] ); |
5 | 101 |
} |
0 | 102 |
|
103 |
$weblog_title = isset( $_POST['weblog_title'] ) ? trim( wp_unslash( $_POST['weblog_title'] ) ) : ''; |
|
9 | 104 |
$user_name = isset( $_POST['user_name'] ) ? trim( wp_unslash( $_POST['user_name'] ) ) : ''; |
105 |
$admin_email = isset( $_POST['admin_email'] ) ? trim( wp_unslash( $_POST['admin_email'] ) ) : ''; |
|
0 | 106 |
|
107 |
if ( ! is_null( $error ) ) { |
|
9 | 108 |
?> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
109 |
<h1><?php _ex( 'Welcome', 'Howdy' ); ?></h1> |
0 | 110 |
<p class="message"><?php echo $error; ?></p> |
111 |
<?php } ?> |
|
5 | 112 |
<form id="setup" method="post" action="install.php?step=2" novalidate="novalidate"> |
9 | 113 |
<table class="form-table" role="presentation"> |
0 | 114 |
<tr> |
115 |
<th scope="row"><label for="weblog_title"><?php _e( 'Site Title' ); ?></label></th> |
|
116 |
<td><input name="weblog_title" type="text" id="weblog_title" size="25" value="<?php echo esc_attr( $weblog_title ); ?>" /></td> |
|
117 |
</tr> |
|
118 |
<tr> |
|
9 | 119 |
<th scope="row"><label for="user_login"><?php _e( 'Username' ); ?></label></th> |
0 | 120 |
<td> |
121 |
<?php |
|
122 |
if ( $user_table ) { |
|
9 | 123 |
_e( 'User(s) already exists.' ); |
5 | 124 |
echo '<input name="user_name" type="hidden" value="admin" />'; |
0 | 125 |
} else { |
9 | 126 |
?> |
127 |
<input name="user_name" type="text" id="user_login" size="25" value="<?php echo esc_attr( sanitize_user( $user_name, true ) ); ?>" /> |
|
5 | 128 |
<p><?php _e( 'Usernames can have only alphanumeric characters, spaces, underscores, hyphens, periods, and the @ symbol.' ); ?></p> |
9 | 129 |
<?php |
130 |
} |
|
131 |
?> |
|
0 | 132 |
</td> |
133 |
</tr> |
|
134 |
<?php if ( ! $user_table ) : ?> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
135 |
<tr class="form-field form-required user-pass1-wrap"> |
0 | 136 |
<th scope="row"> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
137 |
<label for="pass1"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
138 |
<?php _e( 'Password' ); ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
139 |
</label> |
0 | 140 |
</th> |
141 |
<td> |
|
9 | 142 |
<div class="wp-pwd"> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
143 |
<?php $initial_password = isset( $_POST['admin_password'] ) ? stripslashes( $_POST['admin_password'] ) : wp_generate_password( 18 ); ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
144 |
<input type="password" name="admin_password" id="pass1" class="regular-text" autocomplete="off" data-reveal="1" data-pw="<?php echo esc_attr( $initial_password ); ?>" aria-describedby="pass-strength-result" /> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
145 |
<button type="button" class="button wp-hide-pw hide-if-no-js" data-start-masked="<?php echo (int) isset( $_POST['admin_password'] ); ?>" data-toggle="0" aria-label="<?php esc_attr_e( 'Hide password' ); ?>"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
146 |
<span class="dashicons dashicons-hidden"></span> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
147 |
<span class="text"><?php _e( 'Hide' ); ?></span> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
148 |
</button> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
149 |
<div id="pass-strength-result" aria-live="polite"></div> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
150 |
</div> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
151 |
<p><span class="description important hide-if-no-js"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
152 |
<strong><?php _e( 'Important:' ); ?></strong> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
153 |
<?php /* translators: The non-breaking space prevents 1Password from thinking the text "log in" should trigger a password save prompt. */ ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
154 |
<?php _e( 'You will need this password to log in. Please store it in a secure location.' ); ?></span></p> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
155 |
</td> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
156 |
</tr> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
157 |
<tr class="form-field form-required user-pass2-wrap hide-if-js"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
158 |
<th scope="row"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
159 |
<label for="pass2"><?php _e( 'Repeat Password' ); ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
160 |
<span class="description"><?php _e( '(required)' ); ?></span> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
161 |
</label> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
162 |
</th> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
163 |
<td> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
164 |
<input name="admin_password2" type="password" id="pass2" autocomplete="off" /> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
165 |
</td> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
166 |
</tr> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
167 |
<tr class="pw-weak"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
168 |
<th scope="row"><?php _e( 'Confirm Password' ); ?></th> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
169 |
<td> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
170 |
<label> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
171 |
<input type="checkbox" name="pw_weak" class="pw-checkbox" /> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
172 |
<?php _e( 'Confirm use of weak password' ); ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
173 |
</label> |
0 | 174 |
</td> |
175 |
</tr> |
|
176 |
<?php endif; ?> |
|
177 |
<tr> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
178 |
<th scope="row"><label for="admin_email"><?php _e( 'Your Email' ); ?></label></th> |
5 | 179 |
<td><input name="admin_email" type="email" id="admin_email" size="25" value="<?php echo esc_attr( $admin_email ); ?>" /> |
0 | 180 |
<p><?php _e( 'Double-check your email address before continuing.' ); ?></p></td> |
181 |
</tr> |
|
182 |
<tr> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
183 |
<th scope="row"><?php has_action( 'blog_privacy_selector' ) ? _e( 'Site Visibility' ) : _e( 'Search Engine Visibility' ); ?></th> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
184 |
<td> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
185 |
<fieldset> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
186 |
<legend class="screen-reader-text"><span><?php has_action( 'blog_privacy_selector' ) ? _e( 'Site Visibility' ) : _e( 'Search Engine Visibility' ); ?> </span></legend> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
187 |
<?php |
9 | 188 |
if ( has_action( 'blog_privacy_selector' ) ) { |
189 |
?> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
190 |
<input id="blog-public" type="radio" name="blog_public" value="1" <?php checked( 1, $blog_public ); ?> /> |
9 | 191 |
<label for="blog-public"><?php _e( 'Allow search engines to index this site' ); ?></label><br/> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
192 |
<input id="blog-norobots" type="radio" name="blog_public" value="0" <?php checked( 0, $blog_public ); ?> /> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
193 |
<label for="blog-norobots"><?php _e( 'Discourage search engines from indexing this site' ); ?></label> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
194 |
<p class="description"><?php _e( 'Note: Neither of these options blocks access to your site — it is up to search engines to honor your request.' ); ?></p> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
195 |
<?php |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
196 |
/** This action is documented in wp-admin/options-reading.php */ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
197 |
do_action( 'blog_privacy_selector' ); |
9 | 198 |
} else { |
199 |
?> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
200 |
<label for="blog_public"><input name="blog_public" type="checkbox" id="blog_public" value="0" <?php checked( 0, $blog_public ); ?> /> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
201 |
<?php _e( 'Discourage search engines from indexing this site' ); ?></label> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
202 |
<p class="description"><?php _e( 'It is up to search engines to honor this request.' ); ?></p> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
203 |
<?php } ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
204 |
</fieldset> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
205 |
</td> |
0 | 206 |
</tr> |
207 |
</table> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
208 |
<p class="step"><?php submit_button( __( 'Install WordPress' ), 'large', 'Submit', false, array( 'id' => 'submit' ) ); ?></p> |
5 | 209 |
<input type="hidden" name="language" value="<?php echo isset( $_REQUEST['language'] ) ? esc_attr( $_REQUEST['language'] ) : ''; ?>" /> |
0 | 210 |
</form> |
9 | 211 |
<?php |
0 | 212 |
} // end display_setup_form() |
213 |
||
214 |
// Let's check to make sure WP isn't already installed. |
|
215 |
if ( is_blog_installed() ) { |
|
216 |
display_header(); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
217 |
die( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
218 |
'<h1>' . __( 'Already Installed' ) . '</h1>' . |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
219 |
'<p>' . __( 'You appear to have already installed WordPress. To reinstall please clear your old database tables first.' ) . '</p>' . |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
220 |
'<p class="step"><a href="' . esc_url( wp_login_url() ) . '" class="button button-large">' . __( 'Log In' ) . '</a></p>' . |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
221 |
'</body></html>' |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
222 |
); |
0 | 223 |
} |
224 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
225 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
226 |
* @global string $wp_version |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
227 |
* @global string $required_php_version |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
228 |
* @global string $required_mysql_version |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
229 |
*/ |
5 | 230 |
global $wp_version, $required_php_version, $required_mysql_version; |
231 |
||
9 | 232 |
$php_version = phpversion(); |
233 |
$mysql_version = $wpdb->db_version(); |
|
234 |
$php_compat = version_compare( $php_version, $required_php_version, '>=' ); |
|
235 |
$mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' ) || file_exists( WP_CONTENT_DIR . '/db.php' ); |
|
0 | 236 |
|
9 | 237 |
$version_url = sprintf( |
238 |
/* translators: %s: WordPress version */ |
|
239 |
esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ), |
|
240 |
sanitize_title( $wp_version ) |
|
241 |
); |
|
242 |
||
243 |
/* translators: %s: Update PHP page URL */ |
|
244 |
$php_update_message = '</p><p>' . sprintf( __( '<a href="%s">Learn more about updating PHP</a>.' ), esc_url( wp_get_update_php_url() ) ); |
|
245 |
||
246 |
$annotation = wp_get_update_php_annotation(); |
|
247 |
if ( $annotation ) { |
|
248 |
$php_update_message .= '</p><p><em>' . $annotation . '</em>'; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
249 |
} |
0 | 250 |
|
9 | 251 |
if ( ! $mysql_compat && ! $php_compat ) { |
252 |
/* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required PHP version number, 4: Minimum required MySQL version number, 5: Current PHP version number, 6: Current MySQL version number */ |
|
253 |
$compat = sprintf( __( 'You cannot install because <a href="%1$s">WordPress %2$s</a> requires PHP version %3$s or higher and MySQL version %4$s or higher. You are running PHP version %5$s and MySQL version %6$s.' ), $version_url, $wp_version, $required_php_version, $required_mysql_version, $php_version, $mysql_version ) . $php_update_message; |
|
254 |
} elseif ( ! $php_compat ) { |
|
255 |
/* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required PHP version number, 4: Current PHP version number */ |
|
256 |
$compat = sprintf( __( 'You cannot install because <a href="%1$s">WordPress %2$s</a> requires PHP version %3$s or higher. You are running version %4$s.' ), $version_url, $wp_version, $required_php_version, $php_version ) . $php_update_message; |
|
257 |
} elseif ( ! $mysql_compat ) { |
|
258 |
/* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required MySQL version number, 4: Current MySQL version number */ |
|
259 |
$compat = sprintf( __( 'You cannot install because <a href="%1$s">WordPress %2$s</a> requires MySQL version %3$s or higher. You are running version %4$s.' ), $version_url, $wp_version, $required_mysql_version, $mysql_version ); |
|
260 |
} |
|
261 |
||
262 |
if ( ! $mysql_compat || ! $php_compat ) { |
|
0 | 263 |
display_header(); |
264 |
die( '<h1>' . __( 'Insufficient Requirements' ) . '</h1><p>' . $compat . '</p></body></html>' ); |
|
265 |
} |
|
266 |
||
267 |
if ( ! is_string( $wpdb->base_prefix ) || '' === $wpdb->base_prefix ) { |
|
268 |
display_header(); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
269 |
die( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
270 |
'<h1>' . __( 'Configuration Error' ) . '</h1>' . |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
271 |
'<p>' . sprintf( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
272 |
/* translators: %s: wp-config.php */ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
273 |
__( 'Your %s file has an empty database table prefix, which is not supported.' ), |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
274 |
'<code>wp-config.php</code>' |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
275 |
) . '</p></body></html>' |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
276 |
); |
0 | 277 |
} |
278 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
279 |
// Set error message if DO_NOT_UPGRADE_GLOBAL_TABLES isn't set as it will break install. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
280 |
if ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
281 |
display_header(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
282 |
die( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
283 |
'<h1>' . __( 'Configuration Error' ) . '</h1>' . |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
284 |
'<p>' . sprintf( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
285 |
/* translators: %s: DO_NOT_UPGRADE_GLOBAL_TABLES */ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
286 |
__( 'The constant %s cannot be defined when installing WordPress.' ), |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
287 |
'<code>DO_NOT_UPGRADE_GLOBAL_TABLES</code>' |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
288 |
) . '</p></body></html>' |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
289 |
); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
290 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
291 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
292 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
293 |
* @global string $wp_local_package |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
294 |
* @global WP_Locale $wp_locale |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
295 |
*/ |
5 | 296 |
$language = ''; |
297 |
if ( ! empty( $_REQUEST['language'] ) ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
298 |
$language = preg_replace( '/[^a-zA-Z0-9_]/', '', $_REQUEST['language'] ); |
5 | 299 |
} elseif ( isset( $GLOBALS['wp_local_package'] ) ) { |
300 |
$language = $GLOBALS['wp_local_package']; |
|
301 |
} |
|
302 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
303 |
$scripts_to_print = array( 'jquery' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
304 |
|
9 | 305 |
switch ( $step ) { |
5 | 306 |
case 0: // Step 0 |
307 |
if ( wp_can_install_language_pack() && empty( $language ) && ( $languages = wp_get_available_translations() ) ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
308 |
$scripts_to_print[] = 'language-chooser'; |
5 | 309 |
display_header( 'language-chooser' ); |
310 |
echo '<form id="setup" method="post" action="?step=1">'; |
|
311 |
wp_install_language_form( $languages ); |
|
312 |
echo '</form>'; |
|
313 |
break; |
|
314 |
} |
|
315 |
||
316 |
// Deliberately fall through if we can't reach the translations API. |
|
317 |
||
318 |
case 1: // Step 1, direct link or from language chooser. |
|
319 |
if ( ! empty( $language ) ) { |
|
320 |
$loaded_language = wp_download_language_pack( $language ); |
|
321 |
if ( $loaded_language ) { |
|
322 |
load_default_textdomain( $loaded_language ); |
|
323 |
$GLOBALS['wp_locale'] = new WP_Locale(); |
|
324 |
} |
|
325 |
} |
|
326 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
327 |
$scripts_to_print[] = 'user-profile'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
328 |
|
5 | 329 |
display_header(); |
9 | 330 |
?> |
0 | 331 |
<h1><?php _ex( 'Welcome', 'Howdy' ); ?></h1> |
5 | 332 |
<p><?php _e( 'Welcome to the famous five-minute WordPress installation process! Just fill in the information below and you’ll be on your way to using the most extendable and powerful personal publishing platform in the world.' ); ?></p> |
0 | 333 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
334 |
<h2><?php _e( 'Information needed' ); ?></h2> |
0 | 335 |
<p><?php _e( 'Please provide the following information. Don’t worry, you can always change these settings later.' ); ?></p> |
336 |
||
9 | 337 |
<?php |
0 | 338 |
display_setup_form(); |
339 |
break; |
|
340 |
case 2: |
|
5 | 341 |
if ( ! empty( $language ) && load_default_textdomain( $language ) ) { |
9 | 342 |
$loaded_language = $language; |
5 | 343 |
$GLOBALS['wp_locale'] = new WP_Locale(); |
344 |
} else { |
|
345 |
$loaded_language = 'en_US'; |
|
346 |
} |
|
347 |
||
9 | 348 |
if ( ! empty( $wpdb->error ) ) { |
0 | 349 |
wp_die( $wpdb->error->get_error_message() ); |
9 | 350 |
} |
0 | 351 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
352 |
$scripts_to_print[] = 'user-profile'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
353 |
|
0 | 354 |
display_header(); |
355 |
// Fill in the data we gathered |
|
9 | 356 |
$weblog_title = isset( $_POST['weblog_title'] ) ? trim( wp_unslash( $_POST['weblog_title'] ) ) : ''; |
357 |
$user_name = isset( $_POST['user_name'] ) ? trim( wp_unslash( $_POST['user_name'] ) ) : ''; |
|
358 |
$admin_password = isset( $_POST['admin_password'] ) ? wp_unslash( $_POST['admin_password'] ) : ''; |
|
359 |
$admin_password_check = isset( $_POST['admin_password2'] ) ? wp_unslash( $_POST['admin_password2'] ) : ''; |
|
360 |
$admin_email = isset( $_POST['admin_email'] ) ? trim( wp_unslash( $_POST['admin_email'] ) ) : ''; |
|
361 |
$public = isset( $_POST['blog_public'] ) ? (int) $_POST['blog_public'] : 1; |
|
5 | 362 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
363 |
// Check email address. |
0 | 364 |
$error = false; |
365 |
if ( empty( $user_name ) ) { |
|
366 |
// TODO: poka-yoke |
|
367 |
display_setup_form( __( 'Please provide a valid username.' ) ); |
|
368 |
$error = true; |
|
369 |
} elseif ( $user_name != sanitize_user( $user_name, true ) ) { |
|
370 |
display_setup_form( __( 'The username you provided has invalid characters.' ) ); |
|
371 |
$error = true; |
|
372 |
} elseif ( $admin_password != $admin_password_check ) { |
|
373 |
// TODO: poka-yoke |
|
374 |
display_setup_form( __( 'Your passwords do not match. Please try again.' ) ); |
|
375 |
$error = true; |
|
5 | 376 |
} elseif ( empty( $admin_email ) ) { |
0 | 377 |
// TODO: poka-yoke |
378 |
display_setup_form( __( 'You must provide an email address.' ) ); |
|
379 |
$error = true; |
|
380 |
} elseif ( ! is_email( $admin_email ) ) { |
|
381 |
// TODO: poka-yoke |
|
382 |
display_setup_form( __( 'Sorry, that isn’t a valid email address. Email addresses look like <code>username@example.com</code>.' ) ); |
|
383 |
$error = true; |
|
384 |
} |
|
385 |
||
386 |
if ( $error === false ) { |
|
387 |
$wpdb->show_errors(); |
|
5 | 388 |
$result = wp_install( $weblog_title, $user_name, $admin_email, $public, '', wp_slash( $admin_password ), $loaded_language ); |
9 | 389 |
?> |
0 | 390 |
|
391 |
<h1><?php _e( 'Success!' ); ?></h1> |
|
392 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
393 |
<p><?php _e( 'WordPress has been installed. Thank you, and enjoy!' ); ?></p> |
0 | 394 |
|
395 |
<table class="form-table install-success"> |
|
396 |
<tr> |
|
397 |
<th><?php _e( 'Username' ); ?></th> |
|
398 |
<td><?php echo esc_html( sanitize_user( $user_name, true ) ); ?></td> |
|
399 |
</tr> |
|
400 |
<tr> |
|
401 |
<th><?php _e( 'Password' ); ?></th> |
|
9 | 402 |
<td> |
403 |
<?php |
|
404 |
if ( ! empty( $result['password'] ) && empty( $admin_password_check ) ) : |
|
405 |
?> |
|
406 |
<code><?php echo esc_html( $result['password'] ); ?></code><br /> |
|
5 | 407 |
<?php endif ?> |
9 | 408 |
<p><?php echo $result['password_message']; ?></p> |
0 | 409 |
</td> |
410 |
</tr> |
|
411 |
</table> |
|
412 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
413 |
<p class="step"><a href="<?php echo esc_url( wp_login_url() ); ?>" class="button button-large"><?php _e( 'Log In' ); ?></a></p> |
0 | 414 |
|
9 | 415 |
<?php |
0 | 416 |
} |
417 |
break; |
|
418 |
} |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
419 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
420 |
if ( ! wp_is_mobile() ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
421 |
?> |
0 | 422 |
<script type="text/javascript">var t = document.getElementById('weblog_title'); if (t){ t.focus(); }</script> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
423 |
<?php |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
424 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
425 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
426 |
wp_print_scripts( $scripts_to_print ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
427 |
?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
428 |
<script type="text/javascript"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
429 |
jQuery( function( $ ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
430 |
$( '.hide-if-no-js' ).removeClass( 'hide-if-no-js' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
431 |
} ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
432 |
</script> |
0 | 433 |
</body> |
434 |
</html> |