Textpattern PHP Cross Reference Content Management Systems

Source: /index.php - 83 lines - 2342 bytes - Summary - Text - Print

   1  <?php
   2  
   3  /*
   4   * Textpattern Content Management System
   5   * https://textpattern.com/
   6   *
   7   * Copyright (C) 2020 The Textpattern Development Team
   8   *
   9   * This file is part of Textpattern.
  10   *
  11   * Textpattern is free software; you can redistribute it and/or
  12   * modify it under the terms of the GNU General Public License
  13   * as published by the Free Software Foundation, version 2.
  14   *
  15   * Textpattern is distributed in the hope that it will be useful,
  16   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18   * GNU General Public License for more details.
  19   *
  20   * You should have received a copy of the GNU General Public License
  21   * along with Textpattern. If not, see <https://www.gnu.org/licenses/>.
  22   */
  23  
  24  // Make sure we display all errors that occur during initialisation.
  25  error_reporting(E_ALL | E_STRICT);
  26  @ini_set("display_errors", "1");
  27  
  28  if (!defined('txpinterface')) {
  29      define('txpinterface', 'public');
  30  }
  31  
  32  if (!defined('txpath')) {
  33      define("txpath", dirname(__FILE__).'/textpattern');
  34  }
  35  
  36  // Save server path to site root.
  37  if (!isset($here)) {
  38      $here = dirname(__FILE__);
  39  }
  40  
  41  // Pull in config unless configuration data has already been provided
  42  // (multi-headed use).
  43  if (!isset($txpcfg['table_prefix'])) {
  44      // Use buffering to ensure bogus whitespace in config.php is ignored.
  45      ob_start(null, 2048);
  46      include txpath.'/config.php';
  47      ob_end_clean();
  48  }
  49  
  50  include txpath.'/lib/class.trace.php';
  51  $trace = new Trace();
  52  $trace->start('[PHP includes, stage 1]');
  53  include txpath.'/lib/constants.php';
  54  include txpath.'/lib/txplib_misc.php';
  55  $trace->stop();
  56  
  57  if (!isset($txpcfg['table_prefix'])) {
  58      txp_status_header('503 Service Unavailable');
  59      exit('<p>config.php is missing or corrupt. To install Textpattern, visit <a href="./textpattern/setup/">textpattern/setup/</a>.</p>');
  60  }
  61  
  62  // Custom caches, etc?
  63  if (!empty($txpcfg['pre_publish_script'])) {
  64      $trace->start("[Pre Publish Script: '{$txpcfg['pre_publish_script']}']");
  65      require $txpcfg['pre_publish_script'];
  66      $trace->stop();
  67  }
  68  
  69  include txpath.'/publish.php';
  70  
  71  if (!empty($f)) {
  72      output_component($f);
  73  } else {
  74      textpattern();
  75  
  76      if ($production_status !== 'live') {
  77          echo $trace->summary();
  78      }
  79  
  80      if ($production_status === 'debug') {
  81          echo $trace->result();
  82      }
  83  }

title

Description

title

Description

title

Description

title

title

Body