Ticket #13839: 13839.2.diff
File 13839.2.diff, 2.4 KB (added by , 14 years ago) |
---|
-
wp-admin/setup-config.php
155 155 $passwrd = trim($_POST['pwd']); 156 156 $dbhost = trim($_POST['dbhost']); 157 157 $prefix = trim($_POST['prefix']); 158 159 $tryagain_link = '</p><p class="step"><a href="setup-config.php?step=1" onclick="javascript:history.go(-1);return false;" class="button">' . /*WP_I18N_ERROR_TRYAGAIN*/'Try Again'/*/WP_I18N_ERROR_TRYAGAIN*/ . '</a>'; 160 161 // Validate $prefix: it can only contain letters, numbers and underscores 158 162 if ( empty($prefix) ) 159 $prefix = 'wp_';163 wp_die( /*WP_I18N_EMPTY_PREFIX*/'<strong>ERROR</strong>: "Table Prefix" must not be empty.'/*/WP_I18N_EMPTY_PREFIX*/ . $tryagain_link ); 160 164 161 // Validate $prefix: it can only contain letters, numbers and underscores162 165 if ( preg_match( '|[^a-z0-9_]|i', $prefix ) ) 163 wp_die( /*WP_I18N_BAD_PREFIX*/'<strong>ERROR</strong>: "Table Prefix" can only contain numbers, letters, and underscores.'/*/WP_I18N_BAD_PREFIX*/ );166 wp_die( /*WP_I18N_BAD_PREFIX*/'<strong>ERROR</strong>: "Table Prefix" can only contain numbers, letters, and underscores.'/*/WP_I18N_BAD_PREFIX*/ . $tryagain_link ); 164 167 165 168 // Test the db connection. 166 169 /**#@+ … … 174 177 175 178 // We'll fail here if the values are no good. 176 179 require_wp_db(); 177 if ( ! empty( $wpdb->error ) ) { 178 $back = '<p class="step"><a href="setup-config.php?step=1" onclick="javascript:history.go(-1);return false;" class="button">Try Again</a></p>'; 179 wp_die( $wpdb->error->get_error_message() . $back ); 180 } 180 if ( ! empty( $wpdb->error ) ) 181 wp_die( $wpdb->error->get_error_message() . $tryagain_link ); 181 182 182 183 // Fetch or generate keys and salts. 183 184 $no_api = isset( $_POST['noapi'] ); … … 215 216 foreach ($configFile as $line_num => $line) { 216 217 switch (substr($line,0,16)) { 217 218 case "define('DB_NAME'": 219 $dbname = addcslashes($dbname, "\\'"); 218 220 $configFile[$line_num] = str_replace("database_name_here", $dbname, $line); 219 221 break; 220 222 case "define('DB_USER'": 223 $uname = addcslashes($uname, "\\'"); 221 224 $configFile[$line_num] = str_replace("'username_here'", "'$uname'", $line); 222 225 break; 223 226 case "define('DB_PASSW": 227 $passwrd = addcslashes($passwrd, "\\'"); 224 228 $configFile[$line_num] = str_replace("'password_here'", "'$passwrd'", $line); 225 229 break; 226 230 case "define('DB_HOST'":