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