Textpattern | PHP Cross Reference | Content Management Systems |
1 <?php 2 3 /* 4 * Textpattern Content Management System 5 * http://textpattern.com 6 * 7 * Copyright (C) 2016 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 <http://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 (@ini_get('register_globals')) { 29 if (isset($_REQUEST['GLOBALS']) || isset($_FILES['GLOBALS'])) { 30 die('GLOBALS overwrite attempt detected. Please consider turning register_globals off.'); 31 } 32 33 // Collect and unset all registered variables from globals. 34 $_txpg = array_merge( 35 isset($_SESSION) ? (array) $_SESSION : array(), 36 (array) $_ENV, 37 (array) $_GET, 38 (array) $_POST, 39 (array) $_COOKIE, 40 (array) $_FILES, 41 (array) $_SERVER); 42 43 // As the deliberate awkwardly-named local variable $_txpfoo MUST NOT be 44 // unset to avoid notices further down, we must remove any potential 45 // identically-named global from the list of global names here. 46 unset($_txpg['_txpfoo']); 47 48 foreach ($_txpg as $_txpfoo => $value) { 49 if (!in_array($_txpfoo, array( 50 'GLOBALS', 51 '_SERVER', 52 '_GET', 53 '_POST', 54 '_FILES', 55 '_COOKIE', 56 '_SESSION', 57 '_REQUEST', 58 '_ENV', 59 ))) { 60 unset($GLOBALS[$_txpfoo], $$_txpfoo); 61 } 62 } 63 } 64 65 define("txpinterface", "public"); 66 67 if (!defined('txpath')) { 68 define("txpath", dirname(__FILE__).'/textpattern'); 69 } 70 71 // Save server path to site root. 72 if (!isset($here)) { 73 $here = dirname(__FILE__); 74 } 75 76 // Pull in config unless configuration data has already been provided 77 // (multi-headed use). 78 if (!isset($txpcfg['table_prefix'])) { 79 // Use buffering to ensure bogus whitespace in config.php is ignored. 80 ob_start(null, 2048); 81 include txpath.'/config.php'; 82 ob_end_clean(); 83 } 84 85 include txpath.'/lib/class.trace.php'; 86 $trace = new Trace(); 87 $trace->start('[PHP includes, stage 1]'); 88 include txpath.'/lib/constants.php'; 89 include txpath.'/lib/txplib_misc.php'; 90 $trace->stop(); 91 92 if (!isset($txpcfg['table_prefix'])) { 93 txp_status_header('503 Service Unavailable'); 94 exit('config.php is missing or corrupt. To install Textpattern, visit <a href="./textpattern/setup/">textpattern/setup/</a>'); 95 } 96 97 // Custom caches, etc? 98 if (!empty($txpcfg['pre_publish_script'])) { 99 $trace->start("[Pre Publish Script: '{$txpcfg['pre_publish_script']}']"); 100 require $txpcfg['pre_publish_script']; 101 $trace->stop(); 102 } 103 104 include txpath.'/publish.php'; 105 textpattern(); 106 107 if ($production_status !== 'live') { 108 echo $trace->summary(); 109 110 if ($production_status === 'debug') { 111 echo $trace->result(); 112 } 113 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
title