WordPress.org

Make WordPress Core

Ticket #11881: 11881.diff

File 11881.diff, 17.4 KB (added by nacin, 4 years ago)

Shortens wp-settings by about 200 lines, creates new WPINC/init.php. Could probably be abstracted much further than this.

  • wp-settings.php

     
    99 * @package WordPress 
    1010 */ 
    1111 
    12  
    1312/** 
    14  * Whether Multisite support is enabled 
     13 * Stores the location of the WordPress directory of functions, classes, and core content. 
    1514 * 
    16  * @since 3.0 
    17  * 
    18  * @return bool True if multisite is enabled, false otherwise. 
     15 * @since 1.0.0 
    1916 */ 
    20 function is_multisite() { 
    21         if ( ( defined('MULTISITE') && MULTISITE ) || defined('VHOST') || defined('SUNRISE') ) 
    22                 return true; 
     17define('WPINC', 'wp-includes'); 
    2318 
    24         return false; 
    25 } 
     19// Load initialization functions 
     20require(ABSPATH . WPINC . '/init.php'); 
    2621 
    2722if ( !defined('WP_MEMORY_LIMIT') ) { 
    2823        if( is_multisite() ) { 
     
    4136if ( function_exists('date_default_timezone_set') ) 
    4237        date_default_timezone_set('UTC'); 
    4338 
    44 /** 
    45  * Turn register globals off. 
    46  * 
    47  * @access private 
    48  * @since 2.1.0 
    49  * @return null Will return null if register_globals PHP directive was disabled 
    50  */ 
    51 function wp_unregister_GLOBALS() { 
    52         if ( !ini_get('register_globals') ) 
    53                 return; 
    54  
    55         if ( isset($_REQUEST['GLOBALS']) ) 
    56                 die('GLOBALS overwrite attempt detected'); 
    57  
    58         // Variables that shouldn't be unset 
    59         $noUnset = array('GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix'); 
    60  
    61         $input = array_merge($_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset($_SESSION) && is_array($_SESSION) ? $_SESSION : array()); 
    62         foreach ( $input as $k => $v ) 
    63                 if ( !in_array($k, $noUnset) && isset($GLOBALS[$k]) ) { 
    64                         $GLOBALS[$k] = NULL; 
    65                         unset($GLOBALS[$k]); 
    66                 } 
    67 } 
    68  
    6939wp_unregister_GLOBALS(); 
    7040 
    7141unset( $wp_filter, $cache_lastcommentmodified, $cache_lastpostdate ); 
     
    8050if ( ! isset($blog_id) ) 
    8151        $blog_id = 1; 
    8252 
    83 // Fix for IIS when running with PHP ISAPI 
    84 if ( empty( $_SERVER['REQUEST_URI'] ) || ( php_sapi_name() != 'cgi-fcgi' && preg_match( '/^Microsoft-IIS\//', $_SERVER['SERVER_SOFTWARE'] ) ) ) { 
     53// Fix $_SERVER variables 
     54wp_fix_server_vars(); 
    8555 
    86         // IIS Mod-Rewrite 
    87         if (isset($_SERVER['HTTP_X_ORIGINAL_URL'])) { 
    88                 $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL']; 
    89         } 
    90         // IIS Isapi_Rewrite 
    91         else if (isset($_SERVER['HTTP_X_REWRITE_URL'])) { 
    92                 $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL']; 
    93         } 
    94         else 
    95         { 
    96                 // Use ORIG_PATH_INFO if there is no PATH_INFO 
    97                 if ( !isset($_SERVER['PATH_INFO']) && isset($_SERVER['ORIG_PATH_INFO']) ) 
    98                         $_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO']; 
     56require (ABSPATH . WPINC . '/version.php'); 
    9957 
    100                 // Some IIS + PHP configurations puts the script-name in the path-info (No need to append it twice) 
    101                 if ( isset($_SERVER['PATH_INFO']) ) { 
    102                         if ( $_SERVER['PATH_INFO'] == $_SERVER['SCRIPT_NAME'] ) 
    103                                 $_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO']; 
    104                         else 
    105                                 $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO']; 
    106                 } 
     58if ( version_compare( $required_php_version, phpversion(), '>' ) ) 
     59        die( sprintf( /*WP_I18N_OLD_PHP*/'Your server is running PHP version %s$1 but WordPress requires at least %1$2.'/*/WP_I18N_OLD_PHP*/, phpversion(), $required_php_version ) ); 
    10760 
    108                 // Append the query string if it exists and isn't null 
    109                 if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) { 
    110                         $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING']; 
    111                 } 
    112         } 
    113 } 
    114  
    115 // Fix for PHP as CGI hosts that set SCRIPT_FILENAME to something ending in php.cgi for all requests 
    116 if ( isset($_SERVER['SCRIPT_FILENAME']) && ( strpos($_SERVER['SCRIPT_FILENAME'], 'php.cgi') == strlen($_SERVER['SCRIPT_FILENAME']) - 7 ) ) 
    117         $_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED']; 
    118  
    119 // Fix for Dreamhost and other PHP as CGI hosts 
    120 if (strpos($_SERVER['SCRIPT_NAME'], 'php.cgi') !== false) 
    121         unset($_SERVER['PATH_INFO']); 
    122  
    123 // Fix empty PHP_SELF 
    124 $PHP_SELF = $_SERVER['PHP_SELF']; 
    125 if ( empty($PHP_SELF) ) 
    126         $_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace("/(\?.*)?$/",'',$_SERVER["REQUEST_URI"]); 
    127  
    128 if ( version_compare( '4.3', phpversion(), '>' ) ) { 
    129         die( sprintf( /*WP_I18N_OLD_PHP*/'Your server is running PHP version %s but WordPress requires at least 4.3.'/*/WP_I18N_OLD_PHP*/, phpversion() ) ); 
    130 } 
    131  
    13261if ( !defined('WP_CONTENT_DIR') ) 
    13362        define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); // no trailing slash, full paths only - WP_CONTENT_URL is defined further down 
    13463 
    135 if ( file_exists(ABSPATH . '.maintenance') && !defined('WP_INSTALLING') ) { 
    136         include(ABSPATH . '.maintenance'); 
    137         // If the $upgrading timestamp is older than 10 minutes, don't die. 
    138         if ( ( time() - $upgrading ) < 600 ) { 
    139                 if ( file_exists( WP_CONTENT_DIR . '/maintenance.php' ) ) { 
    140                         require_once( WP_CONTENT_DIR . '/maintenance.php' ); 
    141                         die(); 
    142                 } 
     64// Check if maintenance mode should be triggered. 
     65if ( file_exists(ABSPATH . '.maintenance') && !defined('WP_INSTALLING') ) 
     66        wp_maintenance(); 
    14367 
    144                 $protocol = $_SERVER["SERVER_PROTOCOL"]; 
    145                 if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol ) 
    146                         $protocol = 'HTTP/1.0'; 
    147                 header( "$protocol 503 Service Unavailable", true, 503 ); 
    148                 header( 'Content-Type: text/html; charset=utf-8' ); 
    149                 header( 'Retry-After: 600' ); 
    150 ?> 
    151 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    152 <html xmlns="http://www.w3.org/1999/xhtml"> 
    153 <head> 
    154 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    155         <title>Maintenance</title> 
    156  
    157 </head> 
    158 <body> 
    159         <h1>Briefly unavailable for scheduled maintenance. Check back in a minute.</h1> 
    160 </body> 
    161 </html> 
    162 <?php 
    163                 die(); 
    164         } 
    165 } 
    166  
    16768if ( !extension_loaded('mysql') && !file_exists(WP_CONTENT_DIR . '/db.php') ) 
    16869        die( /*WP_I18N_OLD_MYSQL*/'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.'/*/WP_I18N_OLD_MYSQL*/ ); 
    16970 
    170 /** 
    171  * PHP 4 standard microtime start capture. 
    172  * 
    173  * @access private 
    174  * @since 0.71 
    175  * @global int $timestart Seconds and Microseconds added together from when function is called. 
    176  * @return bool Always returns true. 
    177  */ 
    178 function timer_start() { 
    179         global $timestart; 
    180         $mtime = explode(' ', microtime() ); 
    181         $mtime = $mtime[1] + $mtime[0]; 
    182         $timestart = $mtime; 
    183         return true; 
    184 } 
    185  
    186 /** 
    187  * Return and/or display the time from the page start to when function is called. 
    188  * 
    189  * You can get the results and print them by doing: 
    190  * <code> 
    191  * $nTimePageTookToExecute = timer_stop(); 
    192  * echo $nTimePageTookToExecute; 
    193  * </code> 
    194  * 
    195  * Or instead, you can do: 
    196  * <code> 
    197  * timer_stop(1); 
    198  * </code> 
    199  * which will do what the above does. If you need the result, you can assign it to a variable, but 
    200  * most cases, you only need to echo it. 
    201  * 
    202  * @since 0.71 
    203  * @global int $timestart Seconds and Microseconds added together from when timer_start() is called 
    204  * @global int $timeend  Seconds and Microseconds added together from when function is called 
    205  * 
    206  * @param int $display Use '0' or null to not echo anything and 1 to echo the total time 
    207  * @param int $precision The amount of digits from the right of the decimal to display. Default is 3. 
    208  * @return float The "second.microsecond" finished time calculation 
    209  */ 
    210 function timer_stop($display = 0, $precision = 3) { //if called like timer_stop(1), will echo $timetotal 
    211         global $timestart, $timeend; 
    212         $mtime = microtime(); 
    213         $mtime = explode(' ',$mtime); 
    214         $mtime = $mtime[1] + $mtime[0]; 
    215         $timeend = $mtime; 
    216         $timetotal = $timeend-$timestart; 
    217         $r = ( function_exists('number_format_i18n') ) ? number_format_i18n($timetotal, $precision) : number_format($timetotal, $precision); 
    218         if ( $display ) 
    219                 echo $r; 
    220         return $r; 
    221 } 
     71// Start timer. 
    22272timer_start(); 
    22373 
    22474// Add define('WP_DEBUG', true); to wp-config.php to enable display of notices during development. 
     
    255105if ( !defined('MEDIA_TRASH') ) 
    256106        define('MEDIA_TRASH', false); 
    257107 
    258 /** 
    259  * Stores the location of the WordPress directory of functions, classes, and core content. 
    260  * 
    261  * @since 1.0.0 
    262  */ 
    263 define('WPINC', 'wp-includes'); 
    264  
    265108if ( !defined('WP_LANG_DIR') ) { 
    266109        /** 
    267110         * Stores the location of the language directory. First looks for language folder in WP_CONTENT_DIR 
     
    311154if ( is_wp_error($prefix) ) 
    312155        wp_die(/*WP_I18N_BAD_PREFIX*/'<strong>ERROR</strong>: <code>$table_prefix</code> in <code>wp-config.php</code> can only contain numbers, letters, and underscores.'/*/WP_I18N_BAD_PREFIX*/); 
    313156 
    314 /** 
    315  * Copy an object. 
    316  * 
    317  * Returns a cloned copy of an object. 
    318  * 
    319  * @since 2.7.0 
    320  * 
    321  * @param object $object The object to clone 
    322  * @return object The cloned object 
    323  */ 
    324 function wp_clone( $object ) { 
    325         static $can_clone; 
    326         if ( !isset( $can_clone ) ) { 
    327                 $can_clone = version_compare( phpversion(), '5.0', '>=' ); 
    328         } 
    329         return $can_clone ? clone( $object ) : $object; 
    330 } 
    331  
    332 /** 
    333  * Whether the current request is in WordPress admin Panel 
    334  * 
    335  * Does not inform on whether the user is an admin! Use capability checks to 
    336  * tell if the user should be accessing a section or not. 
    337  * 
    338  * @since 1.5.1 
    339  * 
    340  * @return bool True if inside WordPress administration pages. 
    341  */ 
    342 function is_admin() { 
    343         if ( defined('WP_ADMIN') ) 
    344                 return WP_ADMIN; 
    345         return false; 
    346 } 
    347  
    348157if ( file_exists(WP_CONTENT_DIR . '/object-cache.php') ) { 
    349158        require_once (WP_CONTENT_DIR . '/object-cache.php'); 
    350159        $_wp_using_ext_object_cache = true; 
     
    415224require (ABSPATH . WPINC . '/bookmark-template.php'); 
    416225require (ABSPATH . WPINC . '/kses.php'); 
    417226require (ABSPATH . WPINC . '/cron.php'); 
    418 require (ABSPATH . WPINC . '/version.php'); 
    419227require (ABSPATH . WPINC . '/deprecated.php'); 
    420228require (ABSPATH . WPINC . '/script-loader.php'); 
    421229require (ABSPATH . WPINC . '/taxonomy.php'); 
  • wp-admin/setup-config.php

     
    2424error_reporting(0); 
    2525 
    2626/**#@+ 
    27  * These three defines are required to allow us to use require_wp_db() to load 
     27 * These defines are required to allow us to use require_wp_db() to load 
    2828 * the database class while being wp-content/db.php aware. 
    2929 * @ignore 
    3030 */ 
    3131define('ABSPATH', dirname(dirname(__FILE__)).'/'); 
    3232define('WPINC', 'wp-includes'); 
    3333define('WP_CONTENT_DIR', ABSPATH . 'wp-content'); 
     34define('WP_DEBUG', false); 
    3435/**#@-*/ 
    3536 
     37require_once(ABSPATH . WPINC . '/init.php'); 
    3638require_once(ABSPATH . WPINC . '/compat.php'); 
    3739require_once(ABSPATH . WPINC . '/functions.php'); 
    3840require_once(ABSPATH . WPINC . '/classes.php'); 
  • wp-includes/init.php

     
     1<?php 
     2/** 
     3 * Functions needed to initialize WordPress. 
     4 * 
     5 * These functions are loaded before WordPress is initialized in wp-settings.php 
     6 * and in other locations. 
     7 * 
     8 * @package WordPress 
     9 */ 
     10 
     11/** 
     12 * Whether Multisite support is enabled 
     13 * 
     14 * @since 3.0 
     15 * 
     16 * @return bool True if multisite is enabled, false otherwise. 
     17 */ 
     18function is_multisite() { 
     19        if ( ( defined('MULTISITE') && MULTISITE ) || defined('VHOST') || defined('SUNRISE') ) 
     20                return true; 
     21 
     22        return false; 
     23} 
     24 
     25/** 
     26 * Turn register globals off. 
     27 * 
     28 * @access private 
     29 * @since 2.1.0 
     30 * @return null Will return null if register_globals PHP directive was disabled 
     31 */ 
     32function wp_unregister_GLOBALS() { 
     33        if ( !ini_get('register_globals') ) 
     34                return; 
     35 
     36        if ( isset($_REQUEST['GLOBALS']) ) 
     37                die('GLOBALS overwrite attempt detected'); 
     38 
     39        // Variables that shouldn't be unset 
     40        $noUnset = array('GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix'); 
     41 
     42        $input = array_merge($_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset($_SESSION) && is_array($_SESSION) ? $_SESSION : array()); 
     43        foreach ( $input as $k => $v ) 
     44                if ( !in_array($k, $noUnset) && isset($GLOBALS[$k]) ) { 
     45                        $GLOBALS[$k] = NULL; 
     46                        unset($GLOBALS[$k]); 
     47                } 
     48} 
     49 
     50/** 
     51 * PHP 4 standard microtime start capture. 
     52 * 
     53 * @access private 
     54 * @since 0.71 
     55 * @global int $timestart Seconds and Microseconds added together from when function is called. 
     56 * @return bool Always returns true. 
     57 */ 
     58function timer_start() { 
     59        global $timestart; 
     60        $mtime = explode(' ', microtime() ); 
     61        $mtime = $mtime[1] + $mtime[0]; 
     62        $timestart = $mtime; 
     63        return true; 
     64} 
     65 
     66/** 
     67 * Return and/or display the time from the page start to when function is called. 
     68 * 
     69 * You can get the results and print them by doing: 
     70 * <code> 
     71 * $nTimePageTookToExecute = timer_stop(); 
     72 * echo $nTimePageTookToExecute; 
     73 * </code> 
     74 * 
     75 * Or instead, you can do: 
     76 * <code> 
     77 * timer_stop(1); 
     78 * </code> 
     79 * which will do what the above does. If you need the result, you can assign it to a variable, but 
     80 * most cases, you only need to echo it. 
     81 * 
     82 * @since 0.71 
     83 * @global int $timestart Seconds and Microseconds added together from when timer_start() is called 
     84 * @global int $timeend  Seconds and Microseconds added together from when function is called 
     85 * 
     86 * @param int $display Use '0' or null to not echo anything and 1 to echo the total time 
     87 * @param int $precision The amount of digits from the right of the decimal to display. Default is 3. 
     88 * @return float The "second.microsecond" finished time calculation 
     89 */ 
     90function timer_stop($display = 0, $precision = 3) { //if called like timer_stop(1), will echo $timetotal 
     91        global $timestart, $timeend; 
     92        $mtime = microtime(); 
     93        $mtime = explode(' ',$mtime); 
     94        $mtime = $mtime[1] + $mtime[0]; 
     95        $timeend = $mtime; 
     96        $timetotal = $timeend-$timestart; 
     97        $r = ( function_exists('number_format_i18n') ) ? number_format_i18n($timetotal, $precision) : number_format($timetotal, $precision); 
     98        if ( $display ) 
     99                echo $r; 
     100        return $r; 
     101} 
     102 
     103/** 
     104 * Copy an object. 
     105 * 
     106 * Returns a cloned copy of an object. 
     107 * 
     108 * @since 2.7.0 
     109 * 
     110 * @param object $object The object to clone 
     111 * @return object The cloned object 
     112 */ 
     113function wp_clone( $object ) { 
     114        static $can_clone; 
     115        if ( !isset( $can_clone ) ) { 
     116                $can_clone = version_compare( phpversion(), '5.0', '>=' ); 
     117        } 
     118        return $can_clone ? clone( $object ) : $object; 
     119} 
     120 
     121/** 
     122 * Whether the current request is in WordPress admin Panel 
     123 * 
     124 * Does not inform on whether the user is an admin! Use capability checks to 
     125 * tell if the user should be accessing a section or not. 
     126 * 
     127 * @since 1.5.1 
     128 * 
     129 * @return bool True if inside WordPress administration pages. 
     130 */ 
     131function is_admin() { 
     132        if ( defined('WP_ADMIN') ) 
     133                return WP_ADMIN; 
     134        return false; 
     135} 
     136 
     137/** 
     138 * Displays maintenance message.  
     139 * 
     140 * @access private 
     141 * @since 3.0.0 
     142 */ 
     143function wp_maintenance() { 
     144        include(ABSPATH . '.maintenance'); 
     145        // If the $upgrading timestamp is older than 10 minutes, don't die. 
     146        if ( ( time() - $upgrading ) < 600 ) { 
     147                if ( file_exists( WP_CONTENT_DIR . '/maintenance.php' ) ) { 
     148                        require_once( WP_CONTENT_DIR . '/maintenance.php' ); 
     149                        die(); 
     150                } 
     151 
     152                $protocol = $_SERVER["SERVER_PROTOCOL"]; 
     153                if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol ) 
     154                        $protocol = 'HTTP/1.0'; 
     155                header( "$protocol 503 Service Unavailable", true, 503 ); 
     156                header( 'Content-Type: text/html; charset=utf-8' ); 
     157                header( 'Retry-After: 600' ); 
     158?> 
     159<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
     160<html xmlns="http://www.w3.org/1999/xhtml"> 
     161<head> 
     162<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
     163        <title>Maintenance</title> 
     164 
     165</head> 
     166<body> 
     167        <h1>Briefly unavailable for scheduled maintenance. Check back in a minute.</h1> 
     168</body> 
     169</html> 
     170<?php 
     171                die(); 
     172        } 
     173} 
     174 
     175/** 
     176 * Fix $_SERVER variables. 
     177 * 
     178 * @access private 
     179 * @since 3.0.0 
     180 */ 
     181function wp_fix_server_vars() { 
     182        // Fix for IIS when running with PHP ISAPI 
     183        if ( empty( $_SERVER['REQUEST_URI'] ) || ( php_sapi_name() != 'cgi-fcgi' && preg_match( '/^Microsoft-IIS\//', $_SERVER['SERVER_SOFTWARE'] ) ) ) { 
     184         
     185                // IIS Mod-Rewrite 
     186                if (isset($_SERVER['HTTP_X_ORIGINAL_URL'])) { 
     187                        $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL']; 
     188                } 
     189                // IIS Isapi_Rewrite 
     190                else if (isset($_SERVER['HTTP_X_REWRITE_URL'])) { 
     191                        $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL']; 
     192                } 
     193                else 
     194                { 
     195                        // Use ORIG_PATH_INFO if there is no PATH_INFO 
     196                        if ( !isset($_SERVER['PATH_INFO']) && isset($_SERVER['ORIG_PATH_INFO']) ) 
     197                                $_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO']; 
     198         
     199                        // Some IIS + PHP configurations puts the script-name in the path-info (No need to append it twice) 
     200                        if ( isset($_SERVER['PATH_INFO']) ) { 
     201                                if ( $_SERVER['PATH_INFO'] == $_SERVER['SCRIPT_NAME'] ) 
     202                                        $_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO']; 
     203                                else 
     204                                        $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO']; 
     205                        } 
     206         
     207                        // Append the query string if it exists and isn't null 
     208                        if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) { 
     209                                $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING']; 
     210                        } 
     211                } 
     212        } 
     213         
     214        // Fix for PHP as CGI hosts that set SCRIPT_FILENAME to something ending in php.cgi for all requests 
     215        if ( isset($_SERVER['SCRIPT_FILENAME']) && ( strpos($_SERVER['SCRIPT_FILENAME'], 'php.cgi') == strlen($_SERVER['SCRIPT_FILENAME']) - 7 ) ) 
     216                $_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED']; 
     217         
     218        // Fix for Dreamhost and other PHP as CGI hosts 
     219        if (strpos($_SERVER['SCRIPT_NAME'], 'php.cgi') !== false) 
     220                unset($_SERVER['PATH_INFO']); 
     221         
     222        // Fix empty PHP_SELF 
     223        $PHP_SELF = $_SERVER['PHP_SELF']; 
     224        if ( empty($PHP_SELF) ) 
     225                $_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace("/(\?.*)?$/",'',$_SERVER["REQUEST_URI"]); 
     226} 
     227 No newline at end of file