61 $body_classes .= 'rtl'; |
61 $body_classes .= 'rtl'; |
62 } |
62 } |
63 if ( $body_classes ) { |
63 if ( $body_classes ) { |
64 $body_classes = ' ' . $body_classes; |
64 $body_classes = ' ' . $body_classes; |
65 } |
65 } |
66 ?> |
66 ?> |
67 <!DOCTYPE html> |
67 <!DOCTYPE html> |
68 <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>> |
68 <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>> |
69 <head> |
69 <head> |
70 <meta name="viewport" content="width=device-width" /> |
70 <meta name="viewport" content="width=device-width" /> |
71 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
71 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
72 <meta name="robots" content="noindex,nofollow" /> |
72 <meta name="robots" content="noindex,nofollow" /> |
73 <title><?php _e( 'WordPress › Installation' ); ?></title> |
73 <title><?php _e( 'WordPress › Installation' ); ?></title> |
|
74 <?php wp_admin_css( 'install', true ); ?> |
|
75 </head> |
|
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> |
|
78 |
74 <?php |
79 <?php |
75 wp_admin_css( 'install', true ); |
|
76 wp_admin_css( 'dashicons', true ); |
|
77 ?> |
|
78 </head> |
|
79 <body class="wp-core-ui<?php echo $body_classes ?>"> |
|
80 <p id="logo"><a href="<?php echo esc_url( __( 'https://wordpress.org/' ) ); ?>" tabindex="-1"><?php _e( 'WordPress' ); ?></a></p> |
|
81 |
|
82 <?php |
|
83 } // end display_header() |
80 } // end display_header() |
84 |
81 |
85 /** |
82 /** |
86 * Display installer setup form. |
83 * Display installer setup form. |
87 * |
84 * |
92 * @param string|null $error |
89 * @param string|null $error |
93 */ |
90 */ |
94 function display_setup_form( $error = null ) { |
91 function display_setup_form( $error = null ) { |
95 global $wpdb; |
92 global $wpdb; |
96 |
93 |
97 $sql = $wpdb->prepare( "SHOW TABLES LIKE %s", $wpdb->esc_like( $wpdb->users ) ); |
94 $sql = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $wpdb->users ) ); |
98 $user_table = ( $wpdb->get_var( $sql ) != null ); |
95 $user_table = ( $wpdb->get_var( $sql ) != null ); |
99 |
96 |
100 // Ensure that Blogs appear in search engines by default. |
97 // Ensure that Blogs appear in search engines by default. |
101 $blog_public = 1; |
98 $blog_public = 1; |
102 if ( isset( $_POST['weblog_title'] ) ) { |
99 if ( isset( $_POST['weblog_title'] ) ) { |
103 $blog_public = isset( $_POST['blog_public'] ); |
100 $blog_public = isset( $_POST['blog_public'] ); |
104 } |
101 } |
105 |
102 |
106 $weblog_title = isset( $_POST['weblog_title'] ) ? trim( wp_unslash( $_POST['weblog_title'] ) ) : ''; |
103 $weblog_title = isset( $_POST['weblog_title'] ) ? trim( wp_unslash( $_POST['weblog_title'] ) ) : ''; |
107 $user_name = isset($_POST['user_name']) ? trim( wp_unslash( $_POST['user_name'] ) ) : ''; |
104 $user_name = isset( $_POST['user_name'] ) ? trim( wp_unslash( $_POST['user_name'] ) ) : ''; |
108 $admin_email = isset( $_POST['admin_email'] ) ? trim( wp_unslash( $_POST['admin_email'] ) ) : ''; |
105 $admin_email = isset( $_POST['admin_email'] ) ? trim( wp_unslash( $_POST['admin_email'] ) ) : ''; |
109 |
106 |
110 if ( ! is_null( $error ) ) { |
107 if ( ! is_null( $error ) ) { |
111 ?> |
108 ?> |
112 <h1><?php _ex( 'Welcome', 'Howdy' ); ?></h1> |
109 <h1><?php _ex( 'Welcome', 'Howdy' ); ?></h1> |
113 <p class="message"><?php echo $error; ?></p> |
110 <p class="message"><?php echo $error; ?></p> |
114 <?php } ?> |
111 <?php } ?> |
115 <form id="setup" method="post" action="install.php?step=2" novalidate="novalidate"> |
112 <form id="setup" method="post" action="install.php?step=2" novalidate="novalidate"> |
116 <table class="form-table"> |
113 <table class="form-table" role="presentation"> |
117 <tr> |
114 <tr> |
118 <th scope="row"><label for="weblog_title"><?php _e( 'Site Title' ); ?></label></th> |
115 <th scope="row"><label for="weblog_title"><?php _e( 'Site Title' ); ?></label></th> |
119 <td><input name="weblog_title" type="text" id="weblog_title" size="25" value="<?php echo esc_attr( $weblog_title ); ?>" /></td> |
116 <td><input name="weblog_title" type="text" id="weblog_title" size="25" value="<?php echo esc_attr( $weblog_title ); ?>" /></td> |
120 </tr> |
117 </tr> |
121 <tr> |
118 <tr> |
122 <th scope="row"><label for="user_login"><?php _e('Username'); ?></label></th> |
119 <th scope="row"><label for="user_login"><?php _e( 'Username' ); ?></label></th> |
123 <td> |
120 <td> |
124 <?php |
121 <?php |
125 if ( $user_table ) { |
122 if ( $user_table ) { |
126 _e('User(s) already exists.'); |
123 _e( 'User(s) already exists.' ); |
127 echo '<input name="user_name" type="hidden" value="admin" />'; |
124 echo '<input name="user_name" type="hidden" value="admin" />'; |
128 } else { |
125 } else { |
129 ?><input name="user_name" type="text" id="user_login" size="25" value="<?php echo esc_attr( sanitize_user( $user_name, true ) ); ?>" /> |
126 ?> |
|
127 <input name="user_name" type="text" id="user_login" size="25" value="<?php echo esc_attr( sanitize_user( $user_name, true ) ); ?>" /> |
130 <p><?php _e( 'Usernames can have only alphanumeric characters, spaces, underscores, hyphens, periods, and the @ symbol.' ); ?></p> |
128 <p><?php _e( 'Usernames can have only alphanumeric characters, spaces, underscores, hyphens, periods, and the @ symbol.' ); ?></p> |
131 <?php |
129 <?php |
132 } ?> |
130 } |
|
131 ?> |
133 </td> |
132 </td> |
134 </tr> |
133 </tr> |
135 <?php if ( ! $user_table ) : ?> |
134 <?php if ( ! $user_table ) : ?> |
136 <tr class="form-field form-required user-pass1-wrap"> |
135 <tr class="form-field form-required user-pass1-wrap"> |
137 <th scope="row"> |
136 <th scope="row"> |
138 <label for="pass1"> |
137 <label for="pass1"> |
139 <?php _e( 'Password' ); ?> |
138 <?php _e( 'Password' ); ?> |
140 </label> |
139 </label> |
141 </th> |
140 </th> |
142 <td> |
141 <td> |
143 <div class=""> |
142 <div class="wp-pwd"> |
144 <?php $initial_password = isset( $_POST['admin_password'] ) ? stripslashes( $_POST['admin_password'] ) : wp_generate_password( 18 ); ?> |
143 <?php $initial_password = isset( $_POST['admin_password'] ) ? stripslashes( $_POST['admin_password'] ) : wp_generate_password( 18 ); ?> |
145 <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" /> |
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" /> |
146 <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' ); ?>"> |
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' ); ?>"> |
147 <span class="dashicons dashicons-hidden"></span> |
146 <span class="dashicons dashicons-hidden"></span> |
148 <span class="text"><?php _e( 'Hide' ); ?></span> |
147 <span class="text"><?php _e( 'Hide' ); ?></span> |
184 <th scope="row"><?php has_action( 'blog_privacy_selector' ) ? _e( 'Site Visibility' ) : _e( 'Search Engine Visibility' ); ?></th> |
183 <th scope="row"><?php has_action( 'blog_privacy_selector' ) ? _e( 'Site Visibility' ) : _e( 'Search Engine Visibility' ); ?></th> |
185 <td> |
184 <td> |
186 <fieldset> |
185 <fieldset> |
187 <legend class="screen-reader-text"><span><?php has_action( 'blog_privacy_selector' ) ? _e( 'Site Visibility' ) : _e( 'Search Engine Visibility' ); ?> </span></legend> |
186 <legend class="screen-reader-text"><span><?php has_action( 'blog_privacy_selector' ) ? _e( 'Site Visibility' ) : _e( 'Search Engine Visibility' ); ?> </span></legend> |
188 <?php |
187 <?php |
189 if ( has_action( 'blog_privacy_selector' ) ) { ?> |
188 if ( has_action( 'blog_privacy_selector' ) ) { |
|
189 ?> |
190 <input id="blog-public" type="radio" name="blog_public" value="1" <?php checked( 1, $blog_public ); ?> /> |
190 <input id="blog-public" type="radio" name="blog_public" value="1" <?php checked( 1, $blog_public ); ?> /> |
191 <label for="blog-public"><?php _e( 'Allow search engines to index this site' );?></label><br/> |
191 <label for="blog-public"><?php _e( 'Allow search engines to index this site' ); ?></label><br/> |
192 <input id="blog-norobots" type="radio" name="blog_public" value="0" <?php checked( 0, $blog_public ); ?> /> |
192 <input id="blog-norobots" type="radio" name="blog_public" value="0" <?php checked( 0, $blog_public ); ?> /> |
193 <label for="blog-norobots"><?php _e( 'Discourage search engines from indexing this site' ); ?></label> |
193 <label for="blog-norobots"><?php _e( 'Discourage search engines from indexing this site' ); ?></label> |
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> |
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> |
195 <?php |
195 <?php |
196 /** This action is documented in wp-admin/options-reading.php */ |
196 /** This action is documented in wp-admin/options-reading.php */ |
197 do_action( 'blog_privacy_selector' ); |
197 do_action( 'blog_privacy_selector' ); |
198 } else { ?> |
198 } else { |
|
199 ?> |
199 <label for="blog_public"><input name="blog_public" type="checkbox" id="blog_public" value="0" <?php checked( 0, $blog_public ); ?> /> |
200 <label for="blog_public"><input name="blog_public" type="checkbox" id="blog_public" value="0" <?php checked( 0, $blog_public ); ?> /> |
200 <?php _e( 'Discourage search engines from indexing this site' ); ?></label> |
201 <?php _e( 'Discourage search engines from indexing this site' ); ?></label> |
201 <p class="description"><?php _e( 'It is up to search engines to honor this request.' ); ?></p> |
202 <p class="description"><?php _e( 'It is up to search engines to honor this request.' ); ?></p> |
202 <?php } ?> |
203 <?php } ?> |
203 </fieldset> |
204 </fieldset> |
223 |
224 |
224 /** |
225 /** |
225 * @global string $wp_version |
226 * @global string $wp_version |
226 * @global string $required_php_version |
227 * @global string $required_php_version |
227 * @global string $required_mysql_version |
228 * @global string $required_mysql_version |
228 * @global wpdb $wpdb |
|
229 */ |
229 */ |
230 global $wp_version, $required_php_version, $required_mysql_version; |
230 global $wp_version, $required_php_version, $required_mysql_version; |
231 |
231 |
232 $php_version = phpversion(); |
232 $php_version = phpversion(); |
233 $mysql_version = $wpdb->db_version(); |
233 $mysql_version = $wpdb->db_version(); |
234 $php_compat = version_compare( $php_version, $required_php_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' ); |
235 $mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' ) || file_exists( WP_CONTENT_DIR . '/db.php' ); |
236 |
236 |
237 if ( !$mysql_compat && !$php_compat ) { |
237 $version_url = sprintf( |
238 /* translators: 1: WordPress version number, 2: Minimum required PHP version number, 3: Minimum required MySQL version number, 4: Current PHP version number, 5: Current MySQL version number */ |
238 /* translators: %s: WordPress version */ |
239 $compat = sprintf( __( 'You cannot install because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.' ), $wp_version, $required_php_version, $required_mysql_version, $php_version, $mysql_version ); |
239 esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ), |
240 } elseif ( !$php_compat ) { |
240 sanitize_title( $wp_version ) |
241 /* translators: 1: WordPress version number, 2: Minimum required PHP version number, 3: Current PHP version number */ |
241 ); |
242 $compat = sprintf( __( 'You cannot install because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.' ), $wp_version, $required_php_version, $php_version ); |
242 |
243 } elseif ( !$mysql_compat ) { |
243 /* translators: %s: Update PHP page URL */ |
244 /* translators: 1: WordPress version number, 2: Minimum required MySQL version number, 3: Current MySQL version number */ |
244 $php_update_message = '</p><p>' . sprintf( __( '<a href="%s">Learn more about updating PHP</a>.' ), esc_url( wp_get_update_php_url() ) ); |
245 $compat = sprintf( __( 'You cannot install because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.' ), $wp_version, $required_mysql_version, $mysql_version ); |
245 |
246 } |
246 $annotation = wp_get_update_php_annotation(); |
247 |
247 if ( $annotation ) { |
248 if ( !$mysql_compat || !$php_compat ) { |
248 $php_update_message .= '</p><p><em>' . $annotation . '</em>'; |
|
249 } |
|
250 |
|
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 ) { |
249 display_header(); |
263 display_header(); |
250 die( '<h1>' . __( 'Insufficient Requirements' ) . '</h1><p>' . $compat . '</p></body></html>' ); |
264 die( '<h1>' . __( 'Insufficient Requirements' ) . '</h1><p>' . $compat . '</p></body></html>' ); |
251 } |
265 } |
252 |
266 |
253 if ( ! is_string( $wpdb->base_prefix ) || '' === $wpdb->base_prefix ) { |
267 if ( ! is_string( $wpdb->base_prefix ) || '' === $wpdb->base_prefix ) { |
311 } |
325 } |
312 |
326 |
313 $scripts_to_print[] = 'user-profile'; |
327 $scripts_to_print[] = 'user-profile'; |
314 |
328 |
315 display_header(); |
329 display_header(); |
316 ?> |
330 ?> |
317 <h1><?php _ex( 'Welcome', 'Howdy' ); ?></h1> |
331 <h1><?php _ex( 'Welcome', 'Howdy' ); ?></h1> |
318 <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> |
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> |
319 |
333 |
320 <h2><?php _e( 'Information needed' ); ?></h2> |
334 <h2><?php _e( 'Information needed' ); ?></h2> |
321 <p><?php _e( 'Please provide the following information. Don’t worry, you can always change these settings later.' ); ?></p> |
335 <p><?php _e( 'Please provide the following information. Don’t worry, you can always change these settings later.' ); ?></p> |
322 |
336 |
323 <?php |
337 <?php |
324 display_setup_form(); |
338 display_setup_form(); |
325 break; |
339 break; |
326 case 2: |
340 case 2: |
327 if ( ! empty( $language ) && load_default_textdomain( $language ) ) { |
341 if ( ! empty( $language ) && load_default_textdomain( $language ) ) { |
328 $loaded_language = $language; |
342 $loaded_language = $language; |
329 $GLOBALS['wp_locale'] = new WP_Locale(); |
343 $GLOBALS['wp_locale'] = new WP_Locale(); |
330 } else { |
344 } else { |
331 $loaded_language = 'en_US'; |
345 $loaded_language = 'en_US'; |
332 } |
346 } |
333 |
347 |
334 if ( ! empty( $wpdb->error ) ) |
348 if ( ! empty( $wpdb->error ) ) { |
335 wp_die( $wpdb->error->get_error_message() ); |
349 wp_die( $wpdb->error->get_error_message() ); |
|
350 } |
336 |
351 |
337 $scripts_to_print[] = 'user-profile'; |
352 $scripts_to_print[] = 'user-profile'; |
338 |
353 |
339 display_header(); |
354 display_header(); |
340 // Fill in the data we gathered |
355 // Fill in the data we gathered |
341 $weblog_title = isset( $_POST['weblog_title'] ) ? trim( wp_unslash( $_POST['weblog_title'] ) ) : ''; |
356 $weblog_title = isset( $_POST['weblog_title'] ) ? trim( wp_unslash( $_POST['weblog_title'] ) ) : ''; |
342 $user_name = isset($_POST['user_name']) ? trim( wp_unslash( $_POST['user_name'] ) ) : ''; |
357 $user_name = isset( $_POST['user_name'] ) ? trim( wp_unslash( $_POST['user_name'] ) ) : ''; |
343 $admin_password = isset($_POST['admin_password']) ? wp_unslash( $_POST['admin_password'] ) : ''; |
358 $admin_password = isset( $_POST['admin_password'] ) ? wp_unslash( $_POST['admin_password'] ) : ''; |
344 $admin_password_check = isset($_POST['admin_password2']) ? wp_unslash( $_POST['admin_password2'] ) : ''; |
359 $admin_password_check = isset( $_POST['admin_password2'] ) ? wp_unslash( $_POST['admin_password2'] ) : ''; |
345 $admin_email = isset( $_POST['admin_email'] ) ?trim( wp_unslash( $_POST['admin_email'] ) ) : ''; |
360 $admin_email = isset( $_POST['admin_email'] ) ? trim( wp_unslash( $_POST['admin_email'] ) ) : ''; |
346 $public = isset( $_POST['blog_public'] ) ? (int) $_POST['blog_public'] : 1; |
361 $public = isset( $_POST['blog_public'] ) ? (int) $_POST['blog_public'] : 1; |
347 |
362 |
348 // Check email address. |
363 // Check email address. |
349 $error = false; |
364 $error = false; |
350 if ( empty( $user_name ) ) { |
365 if ( empty( $user_name ) ) { |
351 // TODO: poka-yoke |
366 // TODO: poka-yoke |
382 <th><?php _e( 'Username' ); ?></th> |
397 <th><?php _e( 'Username' ); ?></th> |
383 <td><?php echo esc_html( sanitize_user( $user_name, true ) ); ?></td> |
398 <td><?php echo esc_html( sanitize_user( $user_name, true ) ); ?></td> |
384 </tr> |
399 </tr> |
385 <tr> |
400 <tr> |
386 <th><?php _e( 'Password' ); ?></th> |
401 <th><?php _e( 'Password' ); ?></th> |
387 <td><?php |
402 <td> |
388 if ( ! empty( $result['password'] ) && empty( $admin_password_check ) ): ?> |
403 <?php |
389 <code><?php echo esc_html( $result['password'] ) ?></code><br /> |
404 if ( ! empty( $result['password'] ) && empty( $admin_password_check ) ) : |
|
405 ?> |
|
406 <code><?php echo esc_html( $result['password'] ); ?></code><br /> |
390 <?php endif ?> |
407 <?php endif ?> |
391 <p><?php echo $result['password_message'] ?></p> |
408 <p><?php echo $result['password_message']; ?></p> |
392 </td> |
409 </td> |
393 </tr> |
410 </tr> |
394 </table> |
411 </table> |
395 |
412 |
396 <p class="step"><a href="<?php echo esc_url( wp_login_url() ); ?>" class="button button-large"><?php _e( 'Log In' ); ?></a></p> |
413 <p class="step"><a href="<?php echo esc_url( wp_login_url() ); ?>" class="button button-large"><?php _e( 'Log In' ); ?></a></p> |
397 |
414 |
398 <?php |
415 <?php |
399 } |
416 } |
400 break; |
417 break; |
401 } |
418 } |
402 |
419 |
403 if ( ! wp_is_mobile() ) { |
420 if ( ! wp_is_mobile() ) { |