[ Index ] |
|
Code source de Mantis 1.1.0rc3 |
1 <?php 2 # Mantis - a php based bugtracking system 3 4 # Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org 5 # Copyright (C) 2002 - 2007 Mantis Team - mantisbt-dev@lists.sourceforge.net 6 7 # Mantis is free software: you can redistribute it and/or modify 8 # it under the terms of the GNU General Public License as published by 9 # the Free Software Foundation, either version 2 of the License, or 10 # (at your option) any later version. 11 # 12 # Mantis is distributed in the hope that it will be useful, 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 # GNU General Public License for more details. 16 # 17 # You should have received a copy of the GNU General Public License 18 # along with Mantis. If not, see <http://www.gnu.org/licenses/>. 19 20 # -------------------------------------------------------- 21 # $Id: core.php,v 1.52.2.1 2007-10-13 22:33:13 giallu Exp $ 22 # -------------------------------------------------------- 23 24 ########################################################################### 25 # INCLUDES 26 ########################################################################### 27 28 # -------------------- 29 # timer analysis 30 function microtime_float() { 31 list( $usec, $sec ) = explode( " ", microtime() ); 32 return ( (float)$usec + (float)$sec ); 33 } 34 35 $g_request_time = microtime_float(); 36 37 # Before doing anything else, start output buffering so we don't prevent 38 # headers from being sent if there's a blank line in an included file 39 ob_start( 'compress_handler' ); 40 41 # Include compatibility file before anything else 42 require_once( dirname( __FILE__ ).DIRECTORY_SEPARATOR.'core'.DIRECTORY_SEPARATOR.'php_api.php' ); 43 44 # Check if Mantis is down for maintenance 45 # 46 # To make Mantis 'offline' simply create a file called 47 # 'mantis_offline.php' in the mantis root directory. 48 # Users are redirected to that file if it exists. 49 # If you have to test Mantis while it's offline, add the 50 # parameter 'mbadmin=1' to the URL. 51 # 52 $t_mantis_offline = 'mantis_offline.php'; 53 if ( file_exists( $t_mantis_offline ) && !isset( $_GET['mbadmin'] ) ) { 54 include( $t_mantis_offline ); 55 exit; 56 } 57 58 59 # Load constants and configuration files 60 require_once( dirname( __FILE__ ).DIRECTORY_SEPARATOR.'core'.DIRECTORY_SEPARATOR.'constant_inc.php' ); 61 if ( file_exists( dirname( __FILE__ ).DIRECTORY_SEPARATOR.'custom_constant_inc.php' ) ) { 62 require_once( dirname( __FILE__ ).DIRECTORY_SEPARATOR.'custom_constant_inc.php' ); 63 } 64 65 $t_config_inc_found = false; 66 67 require_once( dirname( __FILE__ ).DIRECTORY_SEPARATOR.'config_defaults_inc.php' ); 68 # config_inc may not be present if this is a new install 69 if ( file_exists( dirname( __FILE__ ).DIRECTORY_SEPARATOR.'config_inc.php' ) ) { 70 require_once( dirname( __FILE__ ).DIRECTORY_SEPARATOR.'config_inc.php' ); 71 $t_config_inc_found = true; 72 } 73 74 # Allow an environment variable (defined in an Apache vhost for example) 75 # to specify a config file to load to override other local settings 76 $t_local_config = getenv( 'MANTIS_CONFIG' ); 77 if ( $t_local_config && file_exists( $t_local_config ) ){ 78 require_once( $t_local_config ); 79 $t_config_inc_found = true; 80 } 81 82 if ( false === $t_config_inc_found ) { 83 # if not found, redirect to the admin page to install the system 84 # this needs to be long form and not replaced by is_page_name as that function isn't loaded yet 85 if ( ! ( isset( $_SERVER['PHP_SELF'] ) && ( 0 < strpos( $_SERVER['PHP_SELF'], 'admin' ) ) ) ) { 86 if ( OFF == $g_use_iis ) { 87 header( 'Status: 302' ); 88 } 89 header( 'Content-Type: text/html' ); 90 91 if ( ON == $g_use_iis ) { 92 header( "Refresh: 0;url=admin/install.php" ); 93 } else { 94 header( "Location: admin/install.php" ); 95 } 96 97 exit; # additional output can cause problems so let's just stop output here 98 } 99 } 100 101 # Attempt to find the location of the core files. 102 $t_core_path = dirname(__FILE__).DIRECTORY_SEPARATOR.'core'.DIRECTORY_SEPARATOR; 103 if (isset($GLOBALS['g_core_path']) && !isset( $HTTP_GET_VARS['g_core_path'] ) && !isset( $HTTP_POST_VARS['g_core_path'] ) && !isset( $HTTP_COOKIE_VARS['g_core_path'] ) ) { 104 $t_core_path = $g_core_path; 105 } 106 107 # Load rest of core in separate directory. 108 109 require_once( $t_core_path.'config_api.php' ); 110 require_once( $t_core_path.'timer_api.php' ); 111 require_once( $t_core_path.'logging_api.php' ); 112 113 # load utility functions used by everything else 114 require_once( $t_core_path.'utility_api.php' ); 115 require_once( $t_core_path.'compress_api.php' ); 116 117 # Load internationalization functions (needed before database_api, in case database connection fails) 118 require_once( $t_core_path.'lang_api.php' ); 119 120 # error functions should be loaded to allow database to print errors 121 require_once( $t_core_path.'authentication_api.php' ); 122 require_once( $t_core_path.'html_api.php' ); 123 require_once( $t_core_path.'error_api.php' ); 124 require_once( $t_core_path.'gpc_api.php' ); 125 126 # custom functions (in main directory) 127 # @@@ Move all such files to core/ 128 require_once( $t_core_path . 'custom_function_api.php' ); 129 $t_overrides = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'custom_functions_inc.php'; 130 if ( file_exists( $t_overrides ) ) { 131 require_once( $t_overrides ); 132 } 133 134 # initialize our timer 135 $g_timer = new BC_Timer; 136 137 # seed random number generator 138 list( $usec, $sec ) = explode( ' ', microtime() ); 139 mt_srand( $sec*$usec ); 140 141 # DATABASE WILL BE OPENED HERE!! THE DATABASE SHOULDN'T BE EXPLICITLY 142 # OPENED ANYWHERE ELSE. 143 require_once( $t_core_path.'database_api.php' ); 144 145 # Headers to prevent caching 146 # with option to bypass if running from script 147 global $g_bypass_headers, $g_allow_browser_cache; 148 if ( !isset( $g_bypass_headers ) && !headers_sent() ) { 149 if ( ! isset( $g_allow_browser_cache ) ) { 150 header( 'Pragma: no-cache' ); 151 header( 'Cache-Control: no-store, no-cache, must-revalidate' ); 152 header( 'Cache-Control: post-check=0, pre-check=0', false ); 153 } 154 header( 'Expires: ' . gmdate( 'D, d M Y H:i:s \G\M\T', time() ) ); 155 156 # SEND USER-DEFINED HEADERS 157 foreach( config_get( 'custom_headers' ) as $t_header ) { 158 header( $t_header ); 159 } 160 } 161 162 require_once( $t_core_path.'project_api.php' ); 163 require_once( $t_core_path.'project_hierarchy_api.php' ); 164 require_once( $t_core_path.'access_api.php' ); 165 require_once( $t_core_path.'print_api.php' ); 166 require_once( $t_core_path.'helper_api.php' ); 167 require_once( $t_core_path.'user_api.php' ); 168 169 # push push default language to speed calls to lang_get 170 lang_push( lang_get_default() ); 171 172 if ( !isset( $g_bypass_headers ) && !headers_sent() ) { 173 header( 'Content-type: text/html;charset=' . lang_get( 'charset' ) ); 174 } 175 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Nov 29 09:42:17 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |