Advertisement
Guest User

hquadrat

a guest
Nov 29th, 2009
3,260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.93 KB | None | 0 0
  1. <?php
  2. /*
  3.  * MODx Revolution
  4.  *
  5.  * Copyright 2006, 2007, 2008, 2009 by the MODx Team.
  6.  * All rights reserved.
  7.  *
  8.  * This program is free software; you can redistribute it and/or modify it under
  9.  * the terms of the GNU General Public License as published by the Free Software
  10.  * Foundation; either version 2 of the License, or (at your option) any later
  11.  * version.
  12.  *
  13.  * This program is distributed in the hope that it will be useful, but WITHOUT
  14.  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  15.  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  16.  * details.
  17.  *
  18.  * You should have received a copy of the GNU General Public License along with
  19.  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
  20.  * Place, Suite 330, Boston, MA 02111-1307 USA
  21.  *
  22.  */
  23. $mtime= microtime();
  24. $mtime= explode(" ", $mtime);
  25. $mtime= $mtime[1] + $mtime[0];
  26. $tstart= $mtime;
  27.  
  28. error_reporting(E_ALL & ~E_NOTICE);
  29.  
  30. /**
  31.  * @deprecated 2.0.0
  32.  * For backward compatibility with MODx 0.9.x
  33.  */
  34. define("IN_PARSER_MODE", "true");
  35. /**
  36.  * @deprecated 2.0.0
  37.  * For backward compatibility with MODx 0.9.x
  38.  */
  39. define("IN_MANAGER_MODE", false);
  40.  
  41. /* define this as true in another entry file, then include this file to simply access the API
  42.  * without executing the MODx request handler */
  43. if (!defined('MODX_API_MODE')) {
  44.     define('MODX_API_MODE', false);
  45. }
  46.  
  47. /* this can be used to disable caching in MODx absolutely */
  48. $modx_cache_disabled= false;
  49.  
  50. /* include custom core config and define core path */
  51. @include(dirname(__FILE__) . '/config.core.php');
  52. if (!defined('MODX_CORE_PATH')) define('MODX_CORE_PATH', dirname(__FILE__) . '/core/');
  53.  
  54. /* include the modX class */
  55. if (!@include_once (MODX_CORE_PATH . "model/modx/modx.class.php")) {
  56.     $errorMessage = 'Site temporarily unavailable';
  57.     @include(MODX_CORE_PATH . 'error/unavailable.include.php');
  58.     header('HTTP/1.1 503 Service Unavailable');
  59.     echo "<html><title>Error 503: Site temporarily unavailable</title><body><h1>Error 503</h1><p>{$errorMessage}</p></body></html>";
  60.     exit();
  61. }
  62.  
  63. /* start output buffering */
  64. ob_start();
  65.  
  66. /* Create an instance of the modX class */
  67. if (empty($options) || !is_array($options)) $options = array();
  68. $modx= new modX('', $options);
  69. if (!is_object($modx) || !($modx instanceof modX)) {
  70.     @ob_end_flush();
  71.     $errorMessage = '<a href="setup/">MODx not installed. Install now?</a>';
  72.     @include(MODX_CORE_PATH . 'error/unavailable.include.php');
  73.     header('HTTP/1.1 503 Service Unavailable');
  74.     echo "<html><title>Error 503: Site temporarily unavailable</title><body><h1>Error 503</h1><p>{$errorMessage}</p></body></html>";
  75.     exit();
  76. }
  77.  
  78. /* Set the actual start time */
  79. $modx->startTime= $tstart;
  80.  
  81. /* Set additional logging options including level and target: */
  82. $modx->setLogLevel(modX::LOG_LEVEL_ERROR);
  83. $modx->setLogTarget('FILE');
  84.  
  85. /* Set debugging mode (i.e. error_reporting): */
  86. $modx->setDebug(E_ALL & ~E_NOTICE);
  87.  
  88. /* Initialize the default 'web' context */
  89. //$modx->initialize('web');
  90.  
  91. /* setup for multiple domains */
  92. switch(strtolower(MODX_HTTP_HOST)) {
  93.    case 'www.modx-templates.com:80':
  94.    case 'www.modx-templates.com':
  95.       // if the http_host is modx-templates.com, load the web context
  96.       $modx->initialize('web');
  97.       break;
  98.    case 'www.ffmwireless.de:80':
  99.    case 'www.ffmwireless.de':
  100.       // if the http_host is ffmwireless.de, load the ffmwireless context
  101.       $modx->initialize('ffmwireless');
  102.       break;
  103.    case 'www.thesearchgoeson.com:80':
  104.    case 'www.thesearchgoeson.com':
  105.       // if the http_host is thesearchgoeson.com, load the thesearch context
  106.       $modx->initialize('thesearch');
  107.       break;
  108.    default:
  109.       // by default / if no other rule can be applied, load web context
  110.       $modx->initialize('web');
  111.       break;
  112. }
  113.  
  114. /* execute the request handler */
  115. if (!MODX_API_MODE) {
  116.     $modx->handleRequest();
  117. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement