WordPress.org

Make WordPress Core

Ticket #3471: 3471.500.2.diff

File 3471.500.2.diff, 3.1 KB (added by DD32, 10 years ago)

same as 3471.500.diff, but adds a pretty error message for bad table prefix rather than a plain one.

  • wp-includes/functions.php

     
    11931193        else 
    11941194                $admin_dir = 'wp-admin/'; 
    11951195 
    1196         if ( !did_action('admin_head') ) : 
     1196        if ( !function_exists('did_action') || !did_action('admin_head') ) : 
     1197        status_header(500); 
    11971198        header('Content-Type: text/html; charset=utf-8'); 
    11981199 
    1199         if ( empty($title) ) 
    1200                 $title = __('WordPress › Error'); 
     1200        if ( empty($title) ){ 
     1201                $title = 'WordPress › Error'; 
     1202                $title = function_exists('__') ? __($title) : $title; 
     1203        } 
    12011204 
    1202  
    1203  
    12041205?> 
    12051206<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    12061207<html xmlns="http://www.w3.org/1999/xhtml" <?php if ( function_exists('language_attributes') ) language_attributes(); ?>> 
  • wp-includes/wp-db.php

     
    401401        function bail($message) { // Just wraps errors in a nice header and footer 
    402402                if ( !$this->show_errors ) 
    403403                        return false; 
    404  
    405                 header('Content-Type: text/html; charset=utf-8'); 
    406  
    407                 if (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false) 
    408                         $admin_dir = ''; 
    409                 else 
    410                         $admin_dir = 'wp-admin/'; 
    411  
    412 ?> 
    413 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    414 <html xmlns="http://www.w3.org/1999/xhtml"> 
    415 <head> 
    416         <title>WordPress &rsaquo; Error</title> 
    417         <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    418         <link rel="stylesheet" href="<?php echo $admin_dir; ?>install.css" type="text/css" /> 
    419 </head> 
    420 <body> 
    421         <h1 id="logo"><img alt="WordPress" src="<?php echo $admin_dir; ?>images/wordpress-logo.png" /></h1> 
    422         <p><?php echo $message; ?></p> 
    423 </body> 
    424 </html> 
    425 <?php 
    426                 die(); 
     404                wp_die($message); 
    427405        } 
    428406} 
    429407 
  • wp-settings.php

     
    113113 
    114114if ( !defined('PLUGINDIR') ) 
    115115        define('PLUGINDIR', 'wp-content/plugins'); // no leading slash, no trailing slash 
     116 
     117require (ABSPATH . WPINC . '/functions.php'); 
     118 
    116119if ( file_exists(ABSPATH . 'wp-content/db.php') ) 
    117120        require_once (ABSPATH . 'wp-content/db.php'); 
    118121else 
     
    122125$wpdb->prefix = $table_prefix; 
    123126 
    124127if ( preg_match('|[^a-z0-9_]|i', $wpdb->prefix) && !file_exists(ABSPATH . 'wp-content/db.php') ) 
    125         die("<strong>ERROR</strong>: <code>$table_prefix</code> in <code>wp-config.php</code> can only contain numbers, letters, and underscores."); 
     128        wp_die("<strong>ERROR</strong>: <code>$table_prefix</code> in <code>wp-config.php</code> can only contain numbers, letters, and underscores."); 
    126129 
    127130// Table names 
    128131$wpdb->posts          = $wpdb->prefix . 'posts'; 
     
    151154 
    152155wp_cache_init(); 
    153156 
    154 require (ABSPATH . WPINC . '/functions.php'); 
    155157require (ABSPATH . WPINC . '/classes.php'); 
    156158require (ABSPATH . WPINC . '/plugin.php'); 
    157159require (ABSPATH . WPINC . '/default-filters.php');