[ Index ]

PHP Cross Reference of GlotPress

title

Body

[close]

/ -> gp-load.php (source)

   1  <?php
   2  /**
   3   * Finds and loads the config file and the bootstrapping code
   4   */
   5  
   6  // Die if PHP is not new enough
   7  if ( version_compare( PHP_VERSION, '5.2', '<' ) ) {
   8      die( sprintf( "Your server is running PHP version %s but GlotPress requires at least 5.2.\n", PHP_VERSION ) );
   9  }
  10  
  11  // Fix empty PHP_SELF
  12  $PHP_SELF = $_SERVER['PHP_SELF'];
  13  if ( empty($PHP_SELF) )
  14      $_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace("/(\?.*)?$/",'',$_SERVER["REQUEST_URI"]);
  15  
  16  /**
  17   * Define GP_PATH as this file's parent directory
  18   */
  19  define( 'GP_PATH', dirname( __FILE__ ) . '/' );
  20  
  21  define( 'GP_INC', 'gp-includes/' );
  22  
  23  if ( defined( 'GP_CONFIG_FILE' ) && GP_CONFIG_FILE ) {
  24      require_once GP_CONFIG_FILE;
  25      require_once ( GP_PATH . 'gp-settings.php' );
  26  } elseif ( file_exists( GP_PATH . 'gp-config.php') ) {
  27  
  28      require_once( GP_PATH . 'gp-config.php');
  29      require_once ( GP_PATH . 'gp-settings.php' );
  30  
  31  } elseif ( file_exists( dirname( GP_PATH ) . '/gp-config.php') ) {
  32  
  33      require_once( dirname( GP_PATH ) . '/gp-config.php' );
  34      require_once ( GP_PATH . 'gp-settings.php' );
  35  
  36  } elseif ( !defined( 'GP_INSTALLING' ) || !GP_INSTALLING ) {
  37  
  38      $install_uri = preg_replace( '|/[^/]+?$|', '/', $_SERVER['PHP_SELF'] ) . 'install.php';
  39      header( 'Location: ' . $install_uri );
  40      die();
  41  
  42  } else {
  43      die("gp-config.php doesn't exist! Please create one on top of gp-config-sample.php");
  44  }


Generated: Sun May 26 04:00:17 2013 Hosted by follow the white rabbit.