b2evolution PHP Cross Reference Blogging Systems

Source: /conf/_config.php - 159 lines - 6055 bytes - Summary - Text - Print

Description: This is b2evolution's main config file, which just includes all the other config files. This file should not be edited. You should edit the sub files instead.

   1  <?php
   2  /**
   3   * This is b2evolution's main config file, which just includes all the other
   4   * config files.
   5   *
   6   * This file should not be edited. You should edit the sub files instead.
   7   *
   8   * See {@link _basic_config.php} for the basic settings.
   9   *
  10   * @package conf
  11   */
  12  
  13  if( defined('EVO_CONFIG_LOADED') )
  14  {
  15      return;
  16  }
  17  
  18  // HARD MAINTENANCE !
  19  if( file_exists(dirname(__FILE__).'/maintenance.html') )
  20  { // Stop execution as soon as possible. This is useful while uploading new app files via FTP.
  21      header('HTTP/1.0 503 Service Unavailable');
  22      readfile(dirname(__FILE__).'/maintenance.html');
  23      die();
  24  }
  25  elseif( file_exists(dirname(__FILE__).'/umaintenance.html') )
  26  { // Maintenance mode with a file - "umaintenance.html" with an "u" prevents access to the site but NOT to upgrade
  27      $get_ctrl = isset( $_GET['ctrl'] ) ? $_GET['ctrl'] : ( isset( $_POST['ctrl'] ) ? $_POST['ctrl'] : '' );
  28      // Check if the request is to the upgrade controller or it is an upgrade action request from the upgrade ctrl
  29      $is_upgrade = ( ( $get_ctrl == 'upgrade' ) || ( ( substr( $_SERVER['PHP_SELF'], -17 ) == 'install/index.php' )
  30                  && isset( $_GET['action'] ) && ( $_GET['action'] == 'svn_upgrade' || $_GET['action'] == 'auto_upgrade' ) ) ); // The request action is 'svn_upgrade' or 'auto_upgrade'
  31      if( ! $is_upgrade )
  32      { // NOT an upgrade
  33          header('HTTP/1.0 503 Service Unavailable');
  34          readfile(dirname(__FILE__).'/umaintenance.html');
  35          die();
  36      }
  37  }
  38  
  39  /**
  40   * This makes sure the config does not get loaded twice in Windows
  41   * (when the /conf file is in a path containing uppercase letters as in /Blog/conf).
  42   */
  43  define( 'EVO_CONFIG_LOADED', true );
  44  
  45  // basic settings
  46  if( file_exists(dirname(__FILE__).'/_basic_config.php') )
  47  {    // Use configured base config:
  48      require_once  dirname(__FILE__).'/_basic_config.php';
  49  }
  50  else
  51  {    // Use default template:
  52      require_once  dirname(__FILE__).'/_basic_config.template.php';
  53  }
  54  
  55  // DEPRECATED -- You can now have a _basic_config.php file that will not be overwritten by new releases
  56  if( file_exists(dirname(__FILE__).'/_config_TEST.php') )
  57  { // Put testing conf in there (For testing, you can also set $install_password here):
  58      include_once dirname(__FILE__).'/_config_TEST.php';       // FOR TESTING / DEVELOPMENT OVERRIDES
  59  }
  60  
  61  require_once  dirname(__FILE__).'/_advanced.php';           // advanced settings
  62  require_once  dirname(__FILE__).'/_locales.php';            // locale settings
  63  require_once  dirname(__FILE__).'/_formatting.php';         // formatting settings
  64  require_once  dirname(__FILE__).'/_admin.php';              // admin settings
  65  require_once  dirname(__FILE__).'/_stats.php';              // stats/hitlogging settings
  66  require_once  dirname(__FILE__).'/_application.php';        // application settings
  67  if( file_exists(dirname(__FILE__).'/_overrides_TEST.php') )
  68  { // Override for testing in there:
  69      include_once dirname(__FILE__).'/_overrides_TEST.php';    // FOR TESTING / DEVELOPMENT OVERRIDES
  70  }
  71  
  72  // Handle debug cookie:
  73  if( $debug == 'pwd' )
  74  {    // Debug *can* be enabled/disabled by cookie:
  75  
  76      // Disabled until we find a reason to enable:
  77      $debug = 0;
  78  
  79      if( !empty( $debug_pwd ) )
  80      {    // We have configured a password that could enable debug mode:
  81          if( isset( $_GET['debug'] ) )
  82          {    // We have submitted a ?debug=password
  83              if( $_GET['debug'] == $debug_pwd )
  84              {    // Password matches
  85                  $debug = 1;
  86                  setcookie( 'debug', $debug_pwd, 0, $cookie_path, $cookie_domain );
  87              }
  88              else
  89              {    // Password doesn't match: turn off debug mode:
  90                  setcookie( 'debug', '', $cookie_expired, $cookie_path, $cookie_domain );
  91              }
  92          }
  93          elseif( !empty( $_COOKIE['debug'] ) && $_COOKIE['debug'] == $debug_pwd )
  94          {    // We have a cookie with the correct debug password:
  95              $debug = 1;
  96          }
  97      }
  98  }
  99  
 100  // Handle debug jslog cookie:
 101  if( $debug_jslog == 'pwd' )
 102  {    // Debug *can* be enabled/disabled by cookie:
 103  
 104      // Disabled until we find a reason to enable:
 105      $debug_jslog = 0;
 106  
 107      if( !empty( $debug_pwd ) )
 108      {    // We have configured a password that could enable debug mode:
 109          if( isset( $_GET['jslog'] ) )
 110          {    // We have submitted a ?jslog=password
 111              if( $_GET['jslog'] == $debug_pwd )
 112              {    // Password matches
 113                  $debug_jslog = 1;
 114                  setcookie( 'jslog', $debug_pwd, 0, '/' );
 115              }
 116              else
 117              {    // Password doesn't match: turn off debug mode:
 118                  setcookie( 'jslog', '', $cookie_expired, '/' );
 119                  if( !empty( $_COOKIE['jslog_style'] ) )
 120                  {    // Change the saved styles to hide jslog
 121                      $_COOKIE['jslog_style'] = str_replace( 'display: block', 'display: none', $_COOKIE['jslog_style'] );
 122                      setcookie( 'jslog_style', $_COOKIE['jslog_style'], 0, '/' );
 123                  }
 124              }
 125          }
 126          elseif( !empty( $_COOKIE['jslog'] ) && $_COOKIE['jslog'] == $debug_pwd )
 127          {    // We have a cookie with the correct debug password:
 128              $debug_jslog = 1;
 129              if( !empty( $_COOKIE['jslog_style'] ) )
 130              {    // Change the saved styles to show jslog
 131                  $_COOKIE['jslog_style'] = str_replace( 'display: none', 'display: block', $_COOKIE['jslog_style'] );
 132                  setcookie( 'jslog_style', $_COOKIE['jslog_style'], 0, '/' );
 133              }
 134          }
 135      }
 136  }
 137  
 138  // Check compatibility. Server PHP version can't be lower then the application required PHP version.
 139  $php_version = phpversion();
 140  if( version_compare( $php_version, $required_php_version[ 'application' ], '<' ) )
 141  {
 142      $compat = sprintf( 'You cannot use %1$s %2$s on this server because it requires PHP version %3$s or higher. You are running version %4$s.',
 143                  $app_name, $app_version, $required_php_version[ 'application' ], $php_version );
 144  
 145      die('<h1>Insufficient Requirements</h1><p>'.$compat.'</p>');
 146  }
 147  
 148  // Check timezone setting:
 149  $date_timezone = ini_get( "date.timezone" );
 150  if( version_compare( $php_version, '5.1', '>=' ) && ( !empty( $date_default_timezone ) || empty( $date_timezone ) ) )
 151  { // Set default timezone in php versions >= 5.1 but only if $date_default_timezone is set or php.ini 'date.timezone' setting was not set
 152      date_default_timezone_set( empty( $date_default_timezone ) ? 'Europe/Paris' : $date_default_timezone );
 153  }
 154  
 155  // STUFF THAT SHOULD BE INITIALIZED (to avoid param injection on badly configured PHP)
 156  $use_db = true;
 157  $use_session = true;
 158  
 159  ?>

title

Description

title

Description

title

Description

title

title

Body