Edit File by line
/home/barbar84/www/wp-admin
File: setup-config.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Retrieves and creates the wp-config.php file.
[2] Fix | Delete
*
[3] Fix | Delete
* The permissions for the base directory must allow for writing files in order
[4] Fix | Delete
* for the wp-config.php to be created using this page.
[5] Fix | Delete
*
[6] Fix | Delete
* @package WordPress
[7] Fix | Delete
* @subpackage Administration
[8] Fix | Delete
*/
[9] Fix | Delete
[10] Fix | Delete
/**
[11] Fix | Delete
* We are installing.
[12] Fix | Delete
*/
[13] Fix | Delete
define( 'WP_INSTALLING', true );
[14] Fix | Delete
[15] Fix | Delete
/**
[16] Fix | Delete
* We are blissfully unaware of anything.
[17] Fix | Delete
*/
[18] Fix | Delete
define( 'WP_SETUP_CONFIG', true );
[19] Fix | Delete
[20] Fix | Delete
/**
[21] Fix | Delete
* Disable error reporting
[22] Fix | Delete
*
[23] Fix | Delete
* Set this to error_reporting( -1 ) for debugging
[24] Fix | Delete
*/
[25] Fix | Delete
error_reporting( 0 );
[26] Fix | Delete
[27] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[28] Fix | Delete
define( 'ABSPATH', dirname( __DIR__ ) . '/' );
[29] Fix | Delete
}
[30] Fix | Delete
[31] Fix | Delete
require ABSPATH . 'wp-settings.php';
[32] Fix | Delete
[33] Fix | Delete
/** Load WordPress Administration Upgrade API */
[34] Fix | Delete
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
[35] Fix | Delete
[36] Fix | Delete
/** Load WordPress Translation Installation API */
[37] Fix | Delete
require_once ABSPATH . 'wp-admin/includes/translation-install.php';
[38] Fix | Delete
[39] Fix | Delete
nocache_headers();
[40] Fix | Delete
[41] Fix | Delete
// Support wp-config-sample.php one level up, for the develop repo.
[42] Fix | Delete
if ( file_exists( ABSPATH . 'wp-config-sample.php' ) ) {
[43] Fix | Delete
$config_file = file( ABSPATH . 'wp-config-sample.php' );
[44] Fix | Delete
} elseif ( file_exists( dirname( ABSPATH ) . '/wp-config-sample.php' ) ) {
[45] Fix | Delete
$config_file = file( dirname( ABSPATH ) . '/wp-config-sample.php' );
[46] Fix | Delete
} else {
[47] Fix | Delete
wp_die(
[48] Fix | Delete
sprintf(
[49] Fix | Delete
/* translators: %s: wp-config-sample.php */
[50] Fix | Delete
__( 'Sorry, I need a %s file to work from. Please re-upload this file to your WordPress installation.' ),
[51] Fix | Delete
'<code>wp-config-sample.php</code>'
[52] Fix | Delete
)
[53] Fix | Delete
);
[54] Fix | Delete
}
[55] Fix | Delete
[56] Fix | Delete
// Check if wp-config.php has been created.
[57] Fix | Delete
if ( file_exists( ABSPATH . 'wp-config.php' ) ) {
[58] Fix | Delete
wp_die(
[59] Fix | Delete
'<p>' . sprintf(
[60] Fix | Delete
/* translators: 1: wp-config.php, 2: install.php */
[61] Fix | Delete
__( 'The file %1$s already exists. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href="%2$s">installing now</a>.' ),
[62] Fix | Delete
'<code>wp-config.php</code>',
[63] Fix | Delete
'install.php'
[64] Fix | Delete
) . '</p>',
[65] Fix | Delete
409
[66] Fix | Delete
);
[67] Fix | Delete
}
[68] Fix | Delete
[69] Fix | Delete
// Check if wp-config.php exists above the root directory but is not part of another installation.
[70] Fix | Delete
if ( @file_exists( ABSPATH . '../wp-config.php' ) && ! @file_exists( ABSPATH . '../wp-settings.php' ) ) {
[71] Fix | Delete
wp_die(
[72] Fix | Delete
'<p>' . sprintf(
[73] Fix | Delete
/* translators: 1: wp-config.php, 2: install.php */
[74] Fix | Delete
__( 'The file %1$s already exists one level above your WordPress installation. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href="%2$s">installing now</a>.' ),
[75] Fix | Delete
'<code>wp-config.php</code>',
[76] Fix | Delete
'install.php'
[77] Fix | Delete
) . '</p>',
[78] Fix | Delete
409
[79] Fix | Delete
);
[80] Fix | Delete
}
[81] Fix | Delete
[82] Fix | Delete
$step = isset( $_GET['step'] ) ? (int) $_GET['step'] : -1;
[83] Fix | Delete
[84] Fix | Delete
/**
[85] Fix | Delete
* Display setup wp-config.php file header.
[86] Fix | Delete
*
[87] Fix | Delete
* @ignore
[88] Fix | Delete
* @since 2.3.0
[89] Fix | Delete
*
[90] Fix | Delete
* @global string $wp_local_package Locale code of the package.
[91] Fix | Delete
* @global WP_Locale $wp_locale WordPress date and time locale object.
[92] Fix | Delete
*
[93] Fix | Delete
* @param string|string[] $body_classes Class attribute values for the body tag.
[94] Fix | Delete
*/
[95] Fix | Delete
function setup_config_display_header( $body_classes = array() ) {
[96] Fix | Delete
$body_classes = (array) $body_classes;
[97] Fix | Delete
$body_classes[] = 'wp-core-ui';
[98] Fix | Delete
$dir_attr = '';
[99] Fix | Delete
if ( is_rtl() ) {
[100] Fix | Delete
$body_classes[] = 'rtl';
[101] Fix | Delete
$dir_attr = ' dir="rtl"';
[102] Fix | Delete
}
[103] Fix | Delete
[104] Fix | Delete
header( 'Content-Type: text/html; charset=utf-8' );
[105] Fix | Delete
?>
[106] Fix | Delete
<!DOCTYPE html>
[107] Fix | Delete
<html<?php echo $dir_attr; ?>>
[108] Fix | Delete
<head>
[109] Fix | Delete
<meta name="viewport" content="width=device-width" />
[110] Fix | Delete
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
[111] Fix | Delete
<meta name="robots" content="noindex,nofollow" />
[112] Fix | Delete
<title><?php _e( 'WordPress &rsaquo; Setup Configuration File' ); ?></title>
[113] Fix | Delete
<?php wp_admin_css( 'install', true ); ?>
[114] Fix | Delete
</head>
[115] Fix | Delete
<body class="<?php echo implode( ' ', $body_classes ); ?>">
[116] Fix | Delete
<p id="logo"><?php _e( 'WordPress' ); ?></p>
[117] Fix | Delete
<?php
[118] Fix | Delete
} // End function setup_config_display_header();
[119] Fix | Delete
[120] Fix | Delete
$language = '';
[121] Fix | Delete
if ( ! empty( $_REQUEST['language'] ) ) {
[122] Fix | Delete
$language = preg_replace( '/[^a-zA-Z0-9_]/', '', $_REQUEST['language'] );
[123] Fix | Delete
} elseif ( isset( $GLOBALS['wp_local_package'] ) ) {
[124] Fix | Delete
$language = $GLOBALS['wp_local_package'];
[125] Fix | Delete
}
[126] Fix | Delete
[127] Fix | Delete
switch ( $step ) {
[128] Fix | Delete
case -1:
[129] Fix | Delete
if ( wp_can_install_language_pack() && empty( $language ) ) {
[130] Fix | Delete
$languages = wp_get_available_translations();
[131] Fix | Delete
if ( $languages ) {
[132] Fix | Delete
setup_config_display_header( 'language-chooser' );
[133] Fix | Delete
echo '<h1 class="screen-reader-text">Select a default language</h1>';
[134] Fix | Delete
echo '<form id="setup" method="post" action="?step=0">';
[135] Fix | Delete
wp_install_language_form( $languages );
[136] Fix | Delete
echo '</form>';
[137] Fix | Delete
break;
[138] Fix | Delete
}
[139] Fix | Delete
}
[140] Fix | Delete
[141] Fix | Delete
// Deliberately fall through if we can't reach the translations API.
[142] Fix | Delete
[143] Fix | Delete
case 0:
[144] Fix | Delete
if ( ! empty( $language ) ) {
[145] Fix | Delete
$loaded_language = wp_download_language_pack( $language );
[146] Fix | Delete
if ( $loaded_language ) {
[147] Fix | Delete
load_default_textdomain( $loaded_language );
[148] Fix | Delete
$GLOBALS['wp_locale'] = new WP_Locale();
[149] Fix | Delete
}
[150] Fix | Delete
}
[151] Fix | Delete
[152] Fix | Delete
setup_config_display_header();
[153] Fix | Delete
$step_1 = 'setup-config.php?step=1';
[154] Fix | Delete
if ( isset( $_REQUEST['noapi'] ) ) {
[155] Fix | Delete
$step_1 .= '&amp;noapi';
[156] Fix | Delete
}
[157] Fix | Delete
if ( ! empty( $loaded_language ) ) {
[158] Fix | Delete
$step_1 .= '&amp;language=' . $loaded_language;
[159] Fix | Delete
}
[160] Fix | Delete
?>
[161] Fix | Delete
<h1 class="screen-reader-text"><?php _e( 'Before getting started' ); ?></h1>
[162] Fix | Delete
<p><?php _e( 'Welcome to WordPress. Before getting started, we need some information on the database. You will need to know the following items before proceeding.' ); ?></p>
[163] Fix | Delete
<ol>
[164] Fix | Delete
<li><?php _e( 'Database name' ); ?></li>
[165] Fix | Delete
<li><?php _e( 'Database username' ); ?></li>
[166] Fix | Delete
<li><?php _e( 'Database password' ); ?></li>
[167] Fix | Delete
<li><?php _e( 'Database host' ); ?></li>
[168] Fix | Delete
<li><?php _e( 'Table prefix (if you want to run more than one WordPress in a single database)' ); ?></li>
[169] Fix | Delete
</ol>
[170] Fix | Delete
<p>
[171] Fix | Delete
<?php
[172] Fix | Delete
printf(
[173] Fix | Delete
/* translators: %s: wp-config.php */
[174] Fix | Delete
__( 'We&#8217;re going to use this information to create a %s file.' ),
[175] Fix | Delete
'<code>wp-config.php</code>'
[176] Fix | Delete
);
[177] Fix | Delete
?>
[178] Fix | Delete
<strong>
[179] Fix | Delete
<?php
[180] Fix | Delete
printf(
[181] Fix | Delete
/* translators: 1: wp-config-sample.php, 2: wp-config.php */
[182] Fix | Delete
__( 'If for any reason this automatic file creation doesn&#8217;t work, don&#8217;t worry. All this does is fill in the database information to a configuration file. You may also simply open %1$s in a text editor, fill in your information, and save it as %2$s.' ),
[183] Fix | Delete
'<code>wp-config-sample.php</code>',
[184] Fix | Delete
'<code>wp-config.php</code>'
[185] Fix | Delete
);
[186] Fix | Delete
?>
[187] Fix | Delete
</strong>
[188] Fix | Delete
<?php
[189] Fix | Delete
printf(
[190] Fix | Delete
/* translators: %s: Documentation URL. */
[191] Fix | Delete
__( 'Need more help? <a href="%s">We got it</a>.' ),
[192] Fix | Delete
__( 'https://wordpress.org/support/article/editing-wp-config-php/' )
[193] Fix | Delete
);
[194] Fix | Delete
?>
[195] Fix | Delete
</p>
[196] Fix | Delete
<p><?php _e( 'In all likelihood, these items were supplied to you by your Web Host. If you don&#8217;t have this information, then you will need to contact them before you can continue. If you&#8217;re all ready&hellip;' ); ?></p>
[197] Fix | Delete
[198] Fix | Delete
<p class="step"><a href="<?php echo $step_1; ?>" class="button button-large"><?php _e( 'Let&#8217;s go!' ); ?></a></p>
[199] Fix | Delete
<?php
[200] Fix | Delete
break;
[201] Fix | Delete
[202] Fix | Delete
case 1:
[203] Fix | Delete
load_default_textdomain( $language );
[204] Fix | Delete
$GLOBALS['wp_locale'] = new WP_Locale();
[205] Fix | Delete
[206] Fix | Delete
setup_config_display_header();
[207] Fix | Delete
[208] Fix | Delete
$autofocus = wp_is_mobile() ? '' : ' autofocus';
[209] Fix | Delete
?>
[210] Fix | Delete
<h1 class="screen-reader-text"><?php _e( 'Set up your database connection' ); ?></h1>
[211] Fix | Delete
<form method="post" action="setup-config.php?step=2">
[212] Fix | Delete
<p><?php _e( 'Below you should enter your database connection details. If you&#8217;re not sure about these, contact your host.' ); ?></p>
[213] Fix | Delete
<table class="form-table" role="presentation">
[214] Fix | Delete
<tr>
[215] Fix | Delete
<th scope="row"><label for="dbname"><?php _e( 'Database Name' ); ?></label></th>
[216] Fix | Delete
<td><input name="dbname" id="dbname" type="text" aria-describedby="dbname-desc" size="25" value="wordpress"<?php echo $autofocus; ?>/></td>
[217] Fix | Delete
<td id="dbname-desc"><?php _e( 'The name of the database you want to use with WordPress.' ); ?></td>
[218] Fix | Delete
</tr>
[219] Fix | Delete
<tr>
[220] Fix | Delete
<th scope="row"><label for="uname"><?php _e( 'Username' ); ?></label></th>
[221] Fix | Delete
<td><input name="uname" id="uname" type="text" aria-describedby="uname-desc" size="25" value="<?php echo htmlspecialchars( _x( 'username', 'example username' ), ENT_QUOTES ); ?>" /></td>
[222] Fix | Delete
<td id="uname-desc"><?php _e( 'Your database username.' ); ?></td>
[223] Fix | Delete
</tr>
[224] Fix | Delete
<tr>
[225] Fix | Delete
<th scope="row"><label for="pwd"><?php _e( 'Password' ); ?></label></th>
[226] Fix | Delete
<td><input name="pwd" id="pwd" type="text" aria-describedby="pwd-desc" size="25" value="<?php echo htmlspecialchars( _x( 'password', 'example password' ), ENT_QUOTES ); ?>" autocomplete="off" /></td>
[227] Fix | Delete
<td id="pwd-desc"><?php _e( 'Your database password.' ); ?></td>
[228] Fix | Delete
</tr>
[229] Fix | Delete
<tr>
[230] Fix | Delete
<th scope="row"><label for="dbhost"><?php _e( 'Database Host' ); ?></label></th>
[231] Fix | Delete
<td><input name="dbhost" id="dbhost" type="text" aria-describedby="dbhost-desc" size="25" value="localhost" /></td>
[232] Fix | Delete
<td id="dbhost-desc">
[233] Fix | Delete
<?php
[234] Fix | Delete
/* translators: %s: localhost */
[235] Fix | Delete
printf( __( 'You should be able to get this info from your web host, if %s doesn&#8217;t work.' ), '<code>localhost</code>' );
[236] Fix | Delete
?>
[237] Fix | Delete
</td>
[238] Fix | Delete
</tr>
[239] Fix | Delete
<tr>
[240] Fix | Delete
<th scope="row"><label for="prefix"><?php _e( 'Table Prefix' ); ?></label></th>
[241] Fix | Delete
<td><input name="prefix" id="prefix" type="text" aria-describedby="prefix-desc" value="wp_" size="25" /></td>
[242] Fix | Delete
<td id="prefix-desc"><?php _e( 'If you want to run multiple WordPress installations in a single database, change this.' ); ?></td>
[243] Fix | Delete
</tr>
[244] Fix | Delete
</table>
[245] Fix | Delete
<?php
[246] Fix | Delete
if ( isset( $_GET['noapi'] ) ) {
[247] Fix | Delete
?>
[248] Fix | Delete
<input name="noapi" type="hidden" value="1" /><?php } ?>
[249] Fix | Delete
<input type="hidden" name="language" value="<?php echo esc_attr( $language ); ?>" />
[250] Fix | Delete
<p class="step"><input name="submit" type="submit" value="<?php echo htmlspecialchars( __( 'Submit' ), ENT_QUOTES ); ?>" class="button button-large" /></p>
[251] Fix | Delete
</form>
[252] Fix | Delete
<?php
[253] Fix | Delete
break;
[254] Fix | Delete
[255] Fix | Delete
case 2:
[256] Fix | Delete
load_default_textdomain( $language );
[257] Fix | Delete
$GLOBALS['wp_locale'] = new WP_Locale();
[258] Fix | Delete
[259] Fix | Delete
$dbname = trim( wp_unslash( $_POST['dbname'] ) );
[260] Fix | Delete
$uname = trim( wp_unslash( $_POST['uname'] ) );
[261] Fix | Delete
$pwd = trim( wp_unslash( $_POST['pwd'] ) );
[262] Fix | Delete
$dbhost = trim( wp_unslash( $_POST['dbhost'] ) );
[263] Fix | Delete
$prefix = trim( wp_unslash( $_POST['prefix'] ) );
[264] Fix | Delete
[265] Fix | Delete
$step_1 = 'setup-config.php?step=1';
[266] Fix | Delete
$install = 'install.php';
[267] Fix | Delete
if ( isset( $_REQUEST['noapi'] ) ) {
[268] Fix | Delete
$step_1 .= '&amp;noapi';
[269] Fix | Delete
}
[270] Fix | Delete
[271] Fix | Delete
if ( ! empty( $language ) ) {
[272] Fix | Delete
$step_1 .= '&amp;language=' . $language;
[273] Fix | Delete
$install .= '?language=' . $language;
[274] Fix | Delete
} else {
[275] Fix | Delete
$install .= '?language=en_US';
[276] Fix | Delete
}
[277] Fix | Delete
[278] Fix | Delete
$tryagain_link = '</p><p class="step"><a href="' . $step_1 . '" onclick="javascript:history.go(-1);return false;" class="button button-large">' . __( 'Try Again' ) . '</a>';
[279] Fix | Delete
[280] Fix | Delete
if ( empty( $prefix ) ) {
[281] Fix | Delete
wp_die( __( '<strong>Error</strong>: "Table Prefix" must not be empty.' ) . $tryagain_link );
[282] Fix | Delete
}
[283] Fix | Delete
[284] Fix | Delete
// Validate $prefix: it can only contain letters, numbers and underscores.
[285] Fix | Delete
if ( preg_match( '|[^a-z0-9_]|i', $prefix ) ) {
[286] Fix | Delete
wp_die( __( '<strong>Error</strong>: "Table Prefix" can only contain numbers, letters, and underscores.' ) . $tryagain_link );
[287] Fix | Delete
}
[288] Fix | Delete
[289] Fix | Delete
// Test the DB connection.
[290] Fix | Delete
/**#@+
[291] Fix | Delete
*
[292] Fix | Delete
* @ignore
[293] Fix | Delete
*/
[294] Fix | Delete
define( 'DB_NAME', $dbname );
[295] Fix | Delete
define( 'DB_USER', $uname );
[296] Fix | Delete
define( 'DB_PASSWORD', $pwd );
[297] Fix | Delete
define( 'DB_HOST', $dbhost );
[298] Fix | Delete
/**#@-*/
[299] Fix | Delete
[300] Fix | Delete
// Re-construct $wpdb with these new values.
[301] Fix | Delete
unset( $wpdb );
[302] Fix | Delete
require_wp_db();
[303] Fix | Delete
[304] Fix | Delete
/*
[305] Fix | Delete
* The wpdb constructor bails when WP_SETUP_CONFIG is set, so we must
[306] Fix | Delete
* fire this manually. We'll fail here if the values are no good.
[307] Fix | Delete
*/
[308] Fix | Delete
$wpdb->db_connect();
[309] Fix | Delete
[310] Fix | Delete
if ( ! empty( $wpdb->error ) ) {
[311] Fix | Delete
wp_die( $wpdb->error->get_error_message() . $tryagain_link );
[312] Fix | Delete
}
[313] Fix | Delete
[314] Fix | Delete
$errors = $wpdb->hide_errors();
[315] Fix | Delete
$wpdb->query( "SELECT $prefix" );
[316] Fix | Delete
$wpdb->show_errors( $errors );
[317] Fix | Delete
if ( ! $wpdb->last_error ) {
[318] Fix | Delete
// MySQL was able to parse the prefix as a value, which we don't want. Bail.
[319] Fix | Delete
wp_die( __( '<strong>Error</strong>: "Table Prefix" is invalid.' ) );
[320] Fix | Delete
}
[321] Fix | Delete
[322] Fix | Delete
// Generate keys and salts using secure CSPRNG; fallback to API if enabled; further fallback to original wp_generate_password().
[323] Fix | Delete
try {
[324] Fix | Delete
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_ []{}<>~`+=,.;:/?|';
[325] Fix | Delete
$max = strlen( $chars ) - 1;
[326] Fix | Delete
for ( $i = 0; $i < 8; $i++ ) {
[327] Fix | Delete
$key = '';
[328] Fix | Delete
for ( $j = 0; $j < 64; $j++ ) {
[329] Fix | Delete
$key .= substr( $chars, random_int( 0, $max ), 1 );
[330] Fix | Delete
}
[331] Fix | Delete
$secret_keys[] = $key;
[332] Fix | Delete
}
[333] Fix | Delete
} catch ( Exception $ex ) {
[334] Fix | Delete
$no_api = isset( $_POST['noapi'] );
[335] Fix | Delete
[336] Fix | Delete
if ( ! $no_api ) {
[337] Fix | Delete
$secret_keys = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' );
[338] Fix | Delete
}
[339] Fix | Delete
[340] Fix | Delete
if ( $no_api || is_wp_error( $secret_keys ) ) {
[341] Fix | Delete
$secret_keys = array();
[342] Fix | Delete
for ( $i = 0; $i < 8; $i++ ) {
[343] Fix | Delete
$secret_keys[] = wp_generate_password( 64, true, true );
[344] Fix | Delete
}
[345] Fix | Delete
} else {
[346] Fix | Delete
$secret_keys = explode( "\n", wp_remote_retrieve_body( $secret_keys ) );
[347] Fix | Delete
foreach ( $secret_keys as $k => $v ) {
[348] Fix | Delete
$secret_keys[ $k ] = substr( $v, 28, 64 );
[349] Fix | Delete
}
[350] Fix | Delete
}
[351] Fix | Delete
}
[352] Fix | Delete
[353] Fix | Delete
$key = 0;
[354] Fix | Delete
foreach ( $config_file as $line_num => $line ) {
[355] Fix | Delete
if ( '$table_prefix =' === substr( $line, 0, 15 ) ) {
[356] Fix | Delete
$config_file[ $line_num ] = '$table_prefix = \'' . addcslashes( $prefix, "\\'" ) . "';\r\n";
[357] Fix | Delete
continue;
[358] Fix | Delete
}
[359] Fix | Delete
[360] Fix | Delete
if ( ! preg_match( '/^define\(\s*\'([A-Z_]+)\',([ ]+)/', $line, $match ) ) {
[361] Fix | Delete
continue;
[362] Fix | Delete
}
[363] Fix | Delete
[364] Fix | Delete
$constant = $match[1];
[365] Fix | Delete
$padding = $match[2];
[366] Fix | Delete
[367] Fix | Delete
switch ( $constant ) {
[368] Fix | Delete
case 'DB_NAME':
[369] Fix | Delete
case 'DB_USER':
[370] Fix | Delete
case 'DB_PASSWORD':
[371] Fix | Delete
case 'DB_HOST':
[372] Fix | Delete
$config_file[ $line_num ] = "define( '" . $constant . "'," . $padding . "'" . addcslashes( constant( $constant ), "\\'" ) . "' );\r\n";
[373] Fix | Delete
break;
[374] Fix | Delete
case 'DB_CHARSET':
[375] Fix | Delete
if ( 'utf8mb4' === $wpdb->charset || ( ! $wpdb->charset && $wpdb->has_cap( 'utf8mb4' ) ) ) {
[376] Fix | Delete
$config_file[ $line_num ] = "define( '" . $constant . "'," . $padding . "'utf8mb4' );\r\n";
[377] Fix | Delete
}
[378] Fix | Delete
break;
[379] Fix | Delete
case 'AUTH_KEY':
[380] Fix | Delete
case 'SECURE_AUTH_KEY':
[381] Fix | Delete
case 'LOGGED_IN_KEY':
[382] Fix | Delete
case 'NONCE_KEY':
[383] Fix | Delete
case 'AUTH_SALT':
[384] Fix | Delete
case 'SECURE_AUTH_SALT':
[385] Fix | Delete
case 'LOGGED_IN_SALT':
[386] Fix | Delete
case 'NONCE_SALT':
[387] Fix | Delete
$config_file[ $line_num ] = "define( '" . $constant . "'," . $padding . "'" . $secret_keys[ $key++ ] . "' );\r\n";
[388] Fix | Delete
break;
[389] Fix | Delete
}
[390] Fix | Delete
}
[391] Fix | Delete
unset( $line );
[392] Fix | Delete
[393] Fix | Delete
if ( ! is_writable( ABSPATH ) ) :
[394] Fix | Delete
setup_config_display_header();
[395] Fix | Delete
?>
[396] Fix | Delete
<p>
[397] Fix | Delete
<?php
[398] Fix | Delete
/* translators: %s: wp-config.php */
[399] Fix | Delete
printf( __( 'Unable to write to %s file.' ), '<code>wp-config.php</code>' );
[400] Fix | Delete
?>
[401] Fix | Delete
</p>
[402] Fix | Delete
<p>
[403] Fix | Delete
<?php
[404] Fix | Delete
/* translators: %s: wp-config.php */
[405] Fix | Delete
printf( __( 'You can create the %s file manually and paste the following text into it.' ), '<code>wp-config.php</code>' );
[406] Fix | Delete
[407] Fix | Delete
$config_text = '';
[408] Fix | Delete
[409] Fix | Delete
foreach ( $config_file as $line ) {
[410] Fix | Delete
$config_text .= htmlentities( $line, ENT_COMPAT, 'UTF-8' );
[411] Fix | Delete
}
[412] Fix | Delete
?>
[413] Fix | Delete
</p>
[414] Fix | Delete
<textarea id="wp-config" cols="98" rows="15" class="code" readonly="readonly"><?php echo $config_text; ?></textarea>
[415] Fix | Delete
<p><?php _e( 'After you&#8217;ve done that, click &#8220;Run the installation&#8221;.' ); ?></p>
[416] Fix | Delete
<p class="step"><a href="<?php echo $install; ?>" class="button button-large"><?php _e( 'Run the installation' ); ?></a></p>
[417] Fix | Delete
<script>
[418] Fix | Delete
(function(){
[419] Fix | Delete
if ( ! /iPad|iPod|iPhone/.test( navigator.userAgent ) ) {
[420] Fix | Delete
var el = document.getElementById('wp-config');
[421] Fix | Delete
el.focus();
[422] Fix | Delete
el.select();
[423] Fix | Delete
}
[424] Fix | Delete
})();
[425] Fix | Delete
</script>
[426] Fix | Delete
<?php
[427] Fix | Delete
else :
[428] Fix | Delete
/*
[429] Fix | Delete
* If this file doesn't exist, then we are using the wp-config-sample.php
[430] Fix | Delete
* file one level up, which is for the develop repo.
[431] Fix | Delete
*/
[432] Fix | Delete
if ( file_exists( ABSPATH . 'wp-config-sample.php' ) ) {
[433] Fix | Delete
$path_to_wp_config = ABSPATH . 'wp-config.php';
[434] Fix | Delete
} else {
[435] Fix | Delete
$path_to_wp_config = dirname( ABSPATH ) . '/wp-config.php';
[436] Fix | Delete
}
[437] Fix | Delete
[438] Fix | Delete
$handle = fopen( $path_to_wp_config, 'w' );
[439] Fix | Delete
foreach ( $config_file as $line ) {
[440] Fix | Delete
fwrite( $handle, $line );
[441] Fix | Delete
}
[442] Fix | Delete
fclose( $handle );
[443] Fix | Delete
chmod( $path_to_wp_config, 0666 );
[444] Fix | Delete
setup_config_display_header();
[445] Fix | Delete
?>
[446] Fix | Delete
<h1 class="screen-reader-text"><?php _e( 'Successful database connection' ); ?></h1>
[447] Fix | Delete
<p><?php _e( 'All right, sparky! You&#8217;ve made it through this part of the installation. WordPress can now communicate with your database. If you are ready, time now to&hellip;' ); ?></p>
[448] Fix | Delete
[449] Fix | Delete
<p class="step"><a href="<?php echo $install; ?>" class="button button-large"><?php _e( 'Run the installation' ); ?></a></p>
[450] Fix | Delete
<?php
[451] Fix | Delete
endif;
[452] Fix | Delete
break;
[453] Fix | Delete
}
[454] Fix | Delete
?>
[455] Fix | Delete
<?php wp_print_scripts( 'language-chooser' ); ?>
[456] Fix | Delete
</body>
[457] Fix | Delete
</html>
[458] Fix | Delete
[459] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function