WordPress.org

Make WordPress Core

Ticket #4997: 4997.2.diff

File 4997.2.diff, 4.2 KB (added by DD32, 7 years ago)
  • wp-admin/install.php

     
    11<?php 
    22define('WP_INSTALLING', true); 
    33if (!file_exists('../wp-config.php')) { 
     4  require_once('../wp-includes/compat.php'); 
    45  require_once('../wp-includes/functions.php'); 
    56  wp_die("There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='http://codex.wordpress.org/Editing_wp-config.php'>We got it</a>. You can <a href='setup-config.php'>create a <code>wp-config.php</code> file through a web interface</a>, but this doesn't work for all server setups. The safest way is to manually create the file.", "WordPress &rsaquo; Error"); 
    67} 
  • wp-admin/setup-config.php

     
    11<?php 
    22define('WP_INSTALLING', true); 
    33 
     4require_once('../wp-includes/compat.php'); 
     5require_once('../wp-includes/functions.php'); 
     6 
    47if (!file_exists('../wp-config-sample.php')) 
    5         die('Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.'); 
     8        wp_die('Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.'); 
    69 
    710$configFile = file('../wp-config-sample.php'); 
    811 
    9 if (!is_writable('../')) die("Sorry, I can't write to the directory. You'll have to either change the permissions on your WordPress directory or create your wp-config.php manually."); 
     12if ( !is_writable('../'))  
     13        wp_die("Sorry, I can't write to the directory. You'll have to either change the permissions on your WordPress directory or create your wp-config.php manually."); 
    1014 
     15// Check if wp-config.php has been created 
     16if (file_exists('../wp-config.php')) 
     17        wp_die("<p>The file 'wp-config.php' already exists. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='install.php'>installing now</a>.</p>"); 
    1118 
    1219if (isset($_GET['step'])) 
    1320        $step = $_GET['step']; 
    1421else 
    1522        $step = 0; 
    16 header( 'Content-Type: text/html; charset=utf-8' ); 
     23 
     24function display_header(){ 
     25        header( 'Content-Type: text/html; charset=utf-8' ); 
    1726?> 
    1827<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    1928<html xmlns="http://www.w3.org/1999/xhtml"> 
     
    7685<body> 
    7786<h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1> 
    7887<?php 
    79 // Check if wp-config.php has been created 
    80 if (file_exists('../wp-config.php')) 
    81         die("<p>The file 'wp-config.php' already exists. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='install.php'>installing now</a>.</p></body></html>"); 
     88}//end function display_header(); 
    8289 
    8390switch($step) { 
    8491        case 0: 
     92                display_header(); 
    8593?> 
    8694 
    8795<p>Welcome to WordPress. Before getting started, we need some information on the database. You will need to know the following items before proceeding.</p> 
     
    98106        break; 
    99107 
    100108        case 1: 
     109                display_header(); 
    101110        ?> 
    102111</p> 
    103112<form method="post" action="setup-config.php?step=2"> 
     
    177186        } 
    178187        fclose($handle); 
    179188        chmod('../wp-config.php', 0666); 
     189         
     190        display_header(); 
    180191?> 
    181192<p>All right sparky! You've made it through this part of the installation. WordPress can now communicate with your database. If you are ready, time now to <a href="install.php">run the install!</a></p> 
    182193<?php 
  • wp-includes/functions.php

     
    12411241                $admin_dir = 'wp-admin/'; 
    12421242 
    12431243        if ( !function_exists('did_action') || !did_action('admin_head') ) : 
    1244         status_header(500); 
    1245         nocache_headers(); 
    1246         header('Content-Type: text/html; charset=utf-8'); 
     1244        if( !headers_sent() ){ 
     1245                status_header(500); 
     1246                nocache_headers(); 
     1247                header('Content-Type: text/html; charset=utf-8'); 
     1248        } 
    12471249 
    12481250        if ( empty($title) ){ 
    12491251                if( function_exists('__') )