[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package Joomla.Administrator 5 * 6 * @copyright (C) 2005 Open Source Matters, Inc. <https://www.joomla.org> 7 * @license GNU General Public License version 2 or later; see LICENSE.txt 8 */ 9 10 defined('_JEXEC') or die; 11 12 use Joomla\CMS\Version; 13 use Joomla\Utilities\IpHelper; 14 15 // System includes 16 require_once JPATH_LIBRARIES . '/bootstrap.php'; 17 18 // Installation check, and check on removal of the install directory. 19 if ( 20 !file_exists(JPATH_CONFIGURATION . '/configuration.php') 21 || (filesize(JPATH_CONFIGURATION . '/configuration.php') < 10) 22 || (file_exists(JPATH_INSTALLATION . '/index.php') && (false === (new Version())->isInDevelopmentState())) 23 ) { 24 if (file_exists(JPATH_INSTALLATION . '/index.php')) { 25 header('Location: ../installation/index.php'); 26 27 exit(); 28 } else { 29 echo 'No configuration file found and no installation code available. Exiting...'; 30 31 exit; 32 } 33 } 34 35 // Pre-Load configuration. Don't remove the Output Buffering due to BOM issues, see JCode 26026 36 ob_start(); 37 require_once JPATH_CONFIGURATION . '/configuration.php'; 38 ob_end_clean(); 39 40 // System configuration. 41 $config = new JConfig(); 42 43 // Set the error_reporting, and adjust a global Error Handler 44 switch ($config->error_reporting) { 45 case 'default': 46 case '-1': 47 break; 48 49 case 'none': 50 case '0': 51 error_reporting(0); 52 53 break; 54 55 case 'simple': 56 error_reporting(E_ERROR | E_WARNING | E_PARSE); 57 ini_set('display_errors', 1); 58 59 break; 60 61 case 'maximum': 62 case 'development': // <= Stays for backward compatibility, @TODO: can be removed in 5.0 63 error_reporting(E_ALL); 64 ini_set('display_errors', 1); 65 66 break; 67 68 default: 69 error_reporting($config->error_reporting); 70 ini_set('display_errors', 1); 71 72 break; 73 } 74 75 define('JDEBUG', $config->debug); 76 77 // Check deprecation logging 78 if (empty($config->log_deprecated)) { 79 // Reset handler for E_USER_DEPRECATED 80 set_error_handler(null, E_USER_DEPRECATED); 81 } else { 82 // Make sure handler for E_USER_DEPRECATED is registered 83 set_error_handler(['Joomla\CMS\Exception\ExceptionHandler', 'handleUserDeprecatedErrors'], E_USER_DEPRECATED); 84 } 85 86 if (JDEBUG || $config->error_reporting === 'maximum') { 87 // Set new Exception handler with debug enabled 88 $errorHandler->setExceptionHandler( 89 [ 90 new \Symfony\Component\ErrorHandler\ErrorHandler(null, true), 91 'renderException' 92 ] 93 ); 94 } 95 96 /** 97 * Correctly set the allowing of IP Overrides if behind a trusted proxy/load balancer. 98 * 99 * We need to do this as high up the stack as we can, as the default in \Joomla\Utilities\IpHelper is to 100 * $allowIpOverride = true which is the wrong default for a generic site NOT behind a trusted proxy/load balancer. 101 */ 102 if (property_exists($config, 'behind_loadbalancer') && $config->behind_loadbalancer == 1) { 103 // If Joomla is configured to be behind a trusted proxy/load balancer, allow HTTP Headers to override the REMOTE_ADDR 104 IpHelper::setAllowIpOverrides(true); 105 } else { 106 // We disable the allowing of IP overriding using headers by default. 107 IpHelper::setAllowIpOverrides(false); 108 } 109 110 unset($config);
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |