From e0ba13d56c3608ef1f366927f30cd5ae3ac8cf06 Mon Sep 17 00:00:00 2001
From: ryan
' . __( 'Try Again' ) . ''; + + if ( empty( $prefix ) ) + wp_die( __( 'ERROR: "Table Prefix" must not be empty.' . $tryagain_link ) ); + + // Validate $prefix: it can only contain letters, numbers and underscores. if ( preg_match( '|[^a-z0-9_]|i', $prefix ) ) - wp_die( __( 'ERROR: "Table Prefix" can only contain numbers, letters, and underscores.' ) ); + wp_die( __( 'ERROR: "Table Prefix" can only contain numbers, letters, and underscores.' . $tryagain_link ) ); // Test the db connection. /**#@+ @@ -178,16 +178,14 @@ switch($step) { */ define('DB_NAME', $dbname); define('DB_USER', $uname); - define('DB_PASSWORD', $passwrd); + define('DB_PASSWORD', $pwd); define('DB_HOST', $dbhost); /**#@-*/ // We'll fail here if the values are no good. require_wp_db(); - if ( ! empty( $wpdb->error ) ) { - $back = '
'; - wp_die( $wpdb->error->get_error_message() . $back ); - } + if ( ! empty( $wpdb->error ) ) + wp_die( $wpdb->error->get_error_message() . $tryagain_link ); // Fetch or generate keys and salts. $no_api = isset( $_POST['noapi'] ); @@ -221,7 +219,7 @@ switch($step) { $key = 0; foreach ( $config_file as &$line ) { if ( '$table_prefix =' == substr( $line, 0, 16 ) ) { - $line = '$table_prefix = \'' . $prefix . "';\r\n"; + $line = '$table_prefix = \'' . addcslashes( $prefix, "\\'" ) . "';\r\n"; continue; } @@ -236,7 +234,7 @@ switch($step) { case 'DB_USER' : case 'DB_PASSWORD' : case 'DB_HOST' : - $line = "define('" . $constant . "'," . $padding . "'" . constant( $constant ) . "');\r\n"; + $line = "define('" . $constant . "'," . $padding . "'" . addcslashes( constant( $constant ), "\\'" ) . "');\r\n"; break; case 'AUTH_KEY' : case 'SECURE_AUTH_KEY' :