[ Index ]

PHP Cross Reference of Eventum

title

Body

[close]

/ -> init.php (source)

   1  <?php
   2  /* vim: set expandtab tabstop=4 shiftwidth=4 encoding=utf-8: */
   3  // +----------------------------------------------------------------------+
   4  // | Eventum - Issue Tracking System                                      |
   5  // +----------------------------------------------------------------------+
   6  // | Copyright (c) 2003, 2004, 2005, 2006, 2007 MySQL AB                  |
   7  // |                                                                      |
   8  // | This program is free software; you can redistribute it and/or modify |
   9  // | it under the terms of the GNU General Public License as published by |
  10  // | the Free Software Foundation; either version 2 of the License, or    |
  11  // | (at your option) any later version.                                  |
  12  // |                                                                      |
  13  // | This program is distributed in the hope that it will be useful,      |
  14  // | but WITHOUT ANY WARRANTY; without even the implied warranty of       |
  15  // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        |
  16  // | GNU General Public License for more details.                         |
  17  // |                                                                      |
  18  // | You should have received a copy of the GNU General Public License    |
  19  // | along with this program; if not, write to:                           |
  20  // |                                                                      |
  21  // | Free Software Foundation, Inc.                                       |
  22  // | 59 Temple Place - Suite 330                                          |
  23  // | Boston, MA 02111-1307, USA.                                          |
  24  // +----------------------------------------------------------------------+
  25  // | Authors: Bryan Alsdorf <bryan@mysql.com>                             |
  26  // | Authors: Elan Ruusamäe <glen@delfi.ee>                               |
  27  // +----------------------------------------------------------------------+
  28  
  29  if (!file_exists(dirname(__FILE__) . '/config/config.php')) {
  30      Header('Location: setup/');
  31      exit;
  32  }
  33  
  34  // setup change some PHP settings
  35  ini_set('allow_url_fopen', 0);
  36  set_time_limit(0);
  37  set_magic_quotes_runtime(0);
  38  ini_set('memory_limit', '128M');
  39  
  40  // prevent session from messing up the browser cache
  41  ini_set('session.cache_limiter', 'nocache');
  42  
  43  define('APP_URL', 'http://www.mysql.com/products/eventum/');
  44  define('APP_VERSION', '2.1.1');
  45  
  46  // define base path
  47  define('APP_PATH', realpath(dirname(__FILE__)) . '/');
  48  define('APP_CONFIG_PATH', APP_PATH . 'config/');
  49  
  50  // include local site config
  51  require_once APP_CONFIG_PATH . 'config.php';
  52  
  53  // define other paths
  54  if (!defined('APP_INC_PATH')) {
  55      define('APP_INC_PATH', APP_PATH . 'include/');
  56  }
  57  
  58  if (!defined('APP_PEAR_PATH')) {
  59      define('APP_PEAR_PATH', APP_INC_PATH . 'pear/');
  60  }
  61  
  62  if (!defined('APP_TPL_PATH')) {
  63      define('APP_TPL_PATH', APP_PATH . 'templates/');
  64  }
  65  
  66  if (!defined('APP_TPL_COMPILE_PATH')) {
  67      define('APP_TPL_COMPILE_PATH', APP_PATH . 'templates_c');
  68  }
  69  
  70  if (!defined('APP_SMARTY_PATH')) {
  71      define('APP_SMARTY_PATH', APP_INC_PATH . 'Smarty/');
  72  }
  73  
  74  if (!defined('APP_JPGRAPH_PATH')) {
  75      define('APP_JPGRAPH_PATH', APP_INC_PATH . 'jpgraph/');
  76  }
  77  
  78  if (!defined('APP_LOCKS_PATH')) {
  79      define('APP_LOCKS_PATH', APP_PATH . 'locks/');
  80  }
  81  
  82  if (!defined('APP_SETUP_FILE')) {
  83      define('APP_SETUP_FILE', APP_CONFIG_PATH . 'setup.php');
  84  }
  85  
  86  if (!defined('APP_LOG_PATH')) {
  87      define('APP_LOG_PATH', APP_PATH . 'logs/');
  88  }
  89  
  90  if (!defined('APP_ROUTED_MAILS_SAVEDIR')) {
  91      define('APP_ROUTED_MAILS_SAVEDIR', APP_PATH . 'misc/');
  92  }
  93  
  94  if (!defined('APP_ERROR_LOG')) {
  95      define('APP_ERROR_LOG', APP_LOG_PATH . 'errors.log');
  96  }
  97  
  98  if (!defined('APP_CLI_LOG')) {
  99      define('APP_CLI_LOG', APP_LOG_PATH . 'cli.log');
 100  }
 101  
 102  if (!defined('APP_IRC_LOG')) {
 103      define('APP_IRC_LOG', APP_LOG_PATH . 'irc_bot.log');
 104  }
 105  
 106  if (!defined('APP_LOGIN_LOG')) {
 107      define('APP_LOGIN_LOG', APP_LOG_PATH . 'login_attempts.log');
 108  }
 109  
 110  // add pear to the include path
 111  set_include_path(APP_PEAR_PATH . PATH_SEPARATOR . get_include_path());
 112  
 113  // define the user_id of system user
 114  if (!defined('APP_SYSTEM_USER_ID')) {
 115      define('APP_SYSTEM_USER_ID', 1);
 116  }
 117  
 118  // if full text searching is enabled
 119  if (!defined('APP_ENABLE_FULLTEXT')) {
 120      define('APP_ENABLE_FULLTEXT', false);
 121  }
 122  
 123  if (!defined('APP_BENCHMARK')) {
 124      define('APP_BENCHMARK', false);
 125  }
 126  
 127  if (!defined('APP_DEFAULT_ASSIGNED_EMAILS')) {
 128      define('APP_DEFAULT_ASSIGNED_EMAILS', 1);
 129  }
 130  if (!defined('APP_DEFAULT_NEW_EMAILS')) {
 131      define('APP_DEFAULT_NEW_EMAILS', 0);
 132  }
 133  if (!defined('APP_COOKIE_URL')) {
 134      define('APP_COOKIE_URL', APP_RELATIVE_URL);
 135  }
 136  if (!defined('APP_COOKIE_DOMAIN')) {
 137      define('APP_COOKIE_DOMAIN', null);
 138  }
 139  if (!defined('APP_HASH_TYPE')) {
 140      define('APP_HASH_TYPE', 'MD5');
 141  }
 142  if (!defined('APP_DEFAULT_LOCALE')) {
 143      define('APP_DEFAULT_LOCALE', 'en_US');
 144  }
 145  if (!defined('APP_EMAIL_ENCODING')) {
 146      if (APP_CHARSET == 'UTF-8') {
 147          define('APP_EMAIL_ENCODING', '8bit');
 148      } else {
 149          define('APP_EMAIL_ENCODING', '7bit');
 150      }
 151  }
 152  
 153  define('APP_HIDE_CLOSED_STATS_COOKIE', 'eventum_hide_closed_stats');
 154  
 155  if (APP_BENCHMARK) {
 156      // always benchmark the scripts
 157      require_once 'Benchmark/Timer.php';
 158      $bench = new Benchmark_Timer;
 159      $bench->start();
 160  }
 161  
 162  include_once (APP_INC_PATH . 'class.language.php');
 163  include_once (APP_INC_PATH . 'db_access.php');
 164  include_once (APP_INC_PATH . 'class.auth.php');
 165  include_once (APP_INC_PATH . 'class.misc.php');
 166  
 167  // fix magic_quote_gpc'ed values
 168  if (get_magic_quotes_gpc()) {
 169      $_GET = Misc::dispelMagicQuotes($_GET);
 170      $_POST = Misc::dispelMagicQuotes($_POST);
 171      $_REQUEST = Misc::dispelMagicQuotes($_REQUEST);
 172  }
 173  
 174  Language::setup();
 175  
 176  // set charset
 177  Header('Content-Type: text/html; charset=' . APP_CHARSET);


Generated: Wed Dec 19 21:21:33 2007 Cross-referenced by PHPXref 0.7