[ Index ]

Source Code Reference for V1.00

title

Body

[close]

/ -> base.php (source)

   1  <?php /* $Id: base.php 132 2008-04-03 21:54:15Z pedroix $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/base.php $ */
   2  
   3  /* 

   4  Copyright (c) 2007-2008 The web2Project Development Team <w2p-developers@web2project.net>

   5  Copyright (c) 2003-2005 The dotProject Development Team <core-developers@dotproject.net>

   6  

   7  This file is part of web2Project.

   8  

   9  web2Project is free software; you can redistribute it and/or modify

  10  it under the terms of the GNU General Public License as published by

  11  the Free Software Foundation; either version 2 of the License, or

  12  (at your option) any later version.

  13  

  14  web2Project is distributed in the hope that it will be useful,

  15  but WITHOUT ANY WARRANTY; without even the implied warranty of

  16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

  17  GNU General Public License for more details.

  18  

  19  You should have received a copy of the GNU General Public License

  20  along with web2Project; if not, write to the Free Software

  21  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

  22  */
  23  
  24  ini_set('display_errors', 1);
  25  error_reporting(E_ALL & ~ E_NOTICE);
  26  define('W2P_PERFORMANCE_DEBUG', false);
  27  
  28  //Performance Debug Initialization

  29  if (W2P_PERFORMANCE_DEBUG) {
  30      global $w2p_performance_time, $w2p_performance_dbtime, $w2p_performance_old_dbqueries, $w2p_performance_dbqueries, $w2p_performance_acltime, $w2p_performance_aclchecks, $w2p_performance_memory_marker, $w2p_performance_setuptime;
  31      $w2p_performance_time = array_sum(explode(' ', microtime()));
  32      if (function_exists('memory_get_usage')) {
  33          $w2p_performance_memory_marker = memory_get_usage();
  34      }
  35      $w2p_performance_acltime = 0;
  36      $w2p_performance_aclchecks = 0;
  37      $w2p_performance_dbtime = 0;
  38      $w2p_performance_old_dbqueries = 0;
  39      $w2p_performance_dbqueries = 0;
  40  }
  41  
  42  $baseDir = dirname(__file__);
  43  
  44  // only rely on env variables if not using a apache handler

  45  function safe_get_env($name) {
  46      if (isset($_SERVER[$name])) {
  47          return $_SERVER[$name];
  48      } elseif (strpos(php_sapi_name(), 'apache') === false) {
  49          getenv($name);
  50      } else {
  51          return '';
  52      }
  53  }
  54  
  55  // automatically define the base url

  56  $baseUrl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') ? 'https://' : 'http://';
  57  $baseUrl .= safe_get_env('HTTP_HOST');
  58  $pathInfo = safe_get_env('PATH_INFO');
  59  if ($pathInfo) {
  60      $baseUrl .= str_replace('\\', '/', dirname($pathInfo));
  61  } else {
  62      $baseUrl .= str_replace('\\', '/', dirname(safe_get_env('SCRIPT_NAME')));
  63  }
  64  
  65  $baseUrl = preg_replace('#/$#D', '', $baseUrl);
  66  // Defines to deprecate the global baseUrl/baseDir

  67  define('W2P_BASE_DIR', $baseDir);
  68  define('W2P_BASE_URL', $baseUrl);
  69  
  70  // required includes for start-up

  71  global $w2Pconfig;
  72  $w2Pconfig = array();
  73  
  74  ?>


Generated: Fri Mar 12 03:00:03 2010 Cross-referenced by PHPXref 0.7