includes/common.php
author Dan Fuhry <dan@enanocms.org>
Thu, 01 Jul 2010 20:24:19 -0400
changeset 1259 49db7495f6b8
parent 1251 d543689ed2eb
child 1260 cd72bcd83401
permissions -rw-r--r--
First shot at switching to database revision numbers separate from release version number. There are probably bugs, especially related to migration.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     1
<?php
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     2
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     3
/*
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     4
 * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
1081
745200a9cc2a Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
parents: 956
diff changeset
     5
 * Copyright (C) 2006-2009 Dan Fuhry
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     6
 *
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     7
 * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     8
 * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     9
 *
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    10
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    11
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    12
 */
311
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
    13
 
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
    14
/**
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
    15
 * The main loader script that initializes everything about Enano in the proper order. Prepare to get
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
    16
 * redirected if you don't have $_GET['title'] or $_SERVER['PATH_INFO'] set up.
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
    17
 * @package Enano
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
    18
 * @subpackage Core
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
    19
 * @copyright See header block
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
    20
 */
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    21
311
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
    22
// Make sure we don't have an attempt to inject globals (register_globals on)
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
    23
if ( isset($_REQUEST['GLOBALS']) )
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    24
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
    25
	?>
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
    26
	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html><head><title>Hacking Attempt</title><meta http-equiv="Content-type" content="text/html; charset=utf-8" /></head><style type="text/css">body{background-color:#000;color:#CCC;font-family:trebuchet ms,sans-serif;font-size:9pt;}a{color:#FFF;}</style><body><p>Hacking attempt using <a href="http://www.hardened-php.net/index.76.html">PHP $GLOBALS overwrite vulnerability</a> detected, reported to admin</p><p>You're worse than this guy! Unless you are this guy...</p><p id="billp"><img alt=" " src="about:blank" id="billi" /></p><script type="text/javascript">// <![CDATA[
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
    27
	window.onload=function(){counter();setInterval('counter();', 1000);};var text=false;var cnt=10;function counter(){if(!text){text=document.createElement('span');text.id='billc';text.innerHTML=cnt;text.style.fontSize='96pt';text.style.color='#FF0000';p=document.getElementById('billp');p.appendChild(text);}else{if(cnt==1){document.getElementById('billi').src='http://upload.wikimedia.org/wikipedia/commons/7/7f/Bill_Gates_2004_cr.jpg';document.getElementById('billc').innerHTML='';return;}cnt--;document.getElementById('billc').innerHTML=cnt+' ';}}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
    28
	// ]]>
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
    29
	</script><p><span style="color:black;">You been f***ed by Enano | valid XHTML 1.1</span></p></body></html>
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
    30
	<?php
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
    31
	exit;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    32
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    33
544
81b4499a963e Added TinyMCE compression support and made some supporting modifications to common.php
Dan
parents: 541
diff changeset
    34
// only do this if it hasn't been done yet
81b4499a963e Added TinyMCE compression support and made some supporting modifications to common.php
Dan
parents: 541
diff changeset
    35
if ( !defined('ENANO_COMMON_ROOT_LOADED') )
81b4499a963e Added TinyMCE compression support and made some supporting modifications to common.php
Dan
parents: 541
diff changeset
    36
{
81b4499a963e Added TinyMCE compression support and made some supporting modifications to common.php
Dan
parents: 541
diff changeset
    37
81b4499a963e Added TinyMCE compression support and made some supporting modifications to common.php
Dan
parents: 541
diff changeset
    38
// log this
81b4499a963e Added TinyMCE compression support and made some supporting modifications to common.php
Dan
parents: 541
diff changeset
    39
define('ENANO_COMMON_ROOT_LOADED', 1);
81b4499a963e Added TinyMCE compression support and made some supporting modifications to common.php
Dan
parents: 541
diff changeset
    40
311
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
    41
// Our version number
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
    42
// This needs to match the version number in the database. This number should
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
    43
// be the expected output of enano_version(), which will always be in the
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
    44
// format of 1.0.2, 1.0.2a1, 1.0.2b1, 1.0.2RC1
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
    45
// You'll want to change this for custom distributions.
1195
449fdd113eb0 Version bump to 1.1.8
Dan
parents: 1186
diff changeset
    46
$version = '1.1.8';
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    47
1259
49db7495f6b8 First shot at switching to database revision numbers separate from release version number. There are probably bugs, especially related to migration.
Dan Fuhry <dan@enanocms.org>
parents: 1251
diff changeset
    48
// Database schema version
49db7495f6b8 First shot at switching to database revision numbers separate from release version number. There are probably bugs, especially related to migration.
Dan Fuhry <dan@enanocms.org>
parents: 1251
diff changeset
    49
// This is incremented each time a change to the database structure is made.
49db7495f6b8 First shot at switching to database revision numbers separate from release version number. There are probably bugs, especially related to migration.
Dan Fuhry <dan@enanocms.org>
parents: 1251
diff changeset
    50
// If it doesn't match the version in the DB, the user will be asked to upgrade.
49db7495f6b8 First shot at switching to database revision numbers separate from release version number. There are probably bugs, especially related to migration.
Dan Fuhry <dan@enanocms.org>
parents: 1251
diff changeset
    51
// This must match install/includes/common.php!
49db7495f6b8 First shot at switching to database revision numbers separate from release version number. There are probably bugs, especially related to migration.
Dan Fuhry <dan@enanocms.org>
parents: 1251
diff changeset
    52
$db_version = 1125;
49db7495f6b8 First shot at switching to database revision numbers separate from release version number. There are probably bugs, especially related to migration.
Dan Fuhry <dan@enanocms.org>
parents: 1251
diff changeset
    53
311
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
    54
/**
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
    55
 * Returns a floating-point number with the current UNIX timestamp in microseconds. Defined very early because we gotta call it
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
    56
 * from very early on in the script to measure the starting time of Enano.
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
    57
 * @return float
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
    58
 */
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
    59
442
4da2dfc28728 Installer works again now (for MySQL only)
Dan
parents: 440
diff changeset
    60
// First check to see if something already declared this function.... it happens often.
4da2dfc28728 Installer works again now (for MySQL only)
Dan
parents: 440
diff changeset
    61
if ( !function_exists('microtime_float') )
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    62
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
    63
	function microtime_float()
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
    64
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
    65
		list($usec, $sec) = explode(" ", microtime());
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
    66
		return ((float)$usec + (float)$sec);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
    67
	}
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    68
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    69
311
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
    70
// Determine starting time
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    71
global $_starttime;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    72
$_starttime = microtime_float();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    73
311
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
    74
// Verbose error reporting
443
a48b72312f6d Fix undefined E_STRICT under PHP 4; add PHP 4 deprecation notice in admin panel
Dan
parents: 442
diff changeset
    75
if ( defined('E_STRICT') )
a48b72312f6d Fix undefined E_STRICT under PHP 4; add PHP 4 deprecation notice in admin panel
Dan
parents: 442
diff changeset
    76
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
    77
	// PHP5, PHP6
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
    78
	error_reporting(E_ALL & ~E_STRICT);
443
a48b72312f6d Fix undefined E_STRICT under PHP 4; add PHP 4 deprecation notice in admin panel
Dan
parents: 442
diff changeset
    79
}
a48b72312f6d Fix undefined E_STRICT under PHP 4; add PHP 4 deprecation notice in admin panel
Dan
parents: 442
diff changeset
    80
else
a48b72312f6d Fix undefined E_STRICT under PHP 4; add PHP 4 deprecation notice in admin panel
Dan
parents: 442
diff changeset
    81
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
    82
	// PHP4
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
    83
	error_reporting(E_ALL);
443
a48b72312f6d Fix undefined E_STRICT under PHP 4; add PHP 4 deprecation notice in admin panel
Dan
parents: 442
diff changeset
    84
}
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    85
311
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
    86
//
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
    87
// Determine the location of Enano as an absolute path.
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
    88
//
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
    89
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
    90
// We need to see if this is a specially marked Enano development server. You can create an Enano
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
    91
// development server by cloning the Mercurial repository into a directory named repo, and then
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
    92
// using symlinks to reference the original files so as to segregate unique files from non-unique
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
    93
// and distribution-standard ones. Enano will pivot its root directory accordingly if the file
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
    94
// .enanodev is found in the Enano root (not /repo/).
470
a044ad834691 [minor] fix version number on license block comment in common.php
Dan
parents: 468
diff changeset
    95
if ( strpos(__FILE__, '/repo/') && file_exists(dirname(__FILE__) . '/../../.enanodev') )
2
0931d60f5bdb Adding compatibility patch for Enano dev servers to common.php
dan@scribus.fuhry.local.fuhry.local
parents: 1
diff changeset
    96
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
    97
	// We have a development directory. Remove /repo/ from the picture.
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
    98
	$filename = str_replace('/repo/', '/', __FILE__);
2
0931d60f5bdb Adding compatibility patch for Enano dev servers to common.php
dan@scribus.fuhry.local.fuhry.local
parents: 1
diff changeset
    99
}
0931d60f5bdb Adding compatibility patch for Enano dev servers to common.php
dan@scribus.fuhry.local.fuhry.local
parents: 1
diff changeset
   100
else
0931d60f5bdb Adding compatibility patch for Enano dev servers to common.php
dan@scribus.fuhry.local.fuhry.local
parents: 1
diff changeset
   101
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   102
	// Standard Enano installation
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   103
	$filename = __FILE__;
2
0931d60f5bdb Adding compatibility patch for Enano dev servers to common.php
dan@scribus.fuhry.local.fuhry.local
parents: 1
diff changeset
   104
}
0931d60f5bdb Adding compatibility patch for Enano dev servers to common.php
dan@scribus.fuhry.local.fuhry.local
parents: 1
diff changeset
   105
311
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   106
// ENANO_ROOT is sometimes defined by plugins like AjIM that need the constant before the Enano API is initialized
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   107
if ( !defined('ENANO_ROOT') )
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   108
	define('ENANO_ROOT', dirname(dirname($filename)));
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   109
311
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   110
// We deprecated debugConsole in 1.0.2 because it was never used and there were a lot of unneeded debugging points in the code.
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   111
311
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   112
// _nightly.php is used to tag non-Mercurial-generated nightly builds
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   113
if ( file_exists( ENANO_ROOT . '/_nightly.php') )
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   114
	require(ENANO_ROOT.'/_nightly.php');
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   115
311
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   116
// List of scheduled tasks (don't change this manually, use register_cron_task())
191
3dbe848431b0 Added a cron framework. Currently tasks will not be run; will implement into templates in next commit
Dan
parents: 155
diff changeset
   117
$cron_tasks = array();
3dbe848431b0 Added a cron framework. Currently tasks will not be run; will implement into templates in next commit
Dan
parents: 155
diff changeset
   118
544
81b4499a963e Added TinyMCE compression support and made some supporting modifications to common.php
Dan
parents: 541
diff changeset
   119
} // check for ENANO_COMMON_ROOT_LOADED
81b4499a963e Added TinyMCE compression support and made some supporting modifications to common.php
Dan
parents: 541
diff changeset
   120
else
81b4499a963e Added TinyMCE compression support and made some supporting modifications to common.php
Dan
parents: 541
diff changeset
   121
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   122
	// loading a second time
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   123
	if ( !defined('ENANO_COMMON_ROOT_LOADED_MULTI') )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   124
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   125
		define('ENANO_COMMON_ROOT_LOADED_MULTI', 1);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   126
	}
544
81b4499a963e Added TinyMCE compression support and made some supporting modifications to common.php
Dan
parents: 541
diff changeset
   127
}
81b4499a963e Added TinyMCE compression support and made some supporting modifications to common.php
Dan
parents: 541
diff changeset
   128
81b4499a963e Added TinyMCE compression support and made some supporting modifications to common.php
Dan
parents: 541
diff changeset
   129
// If all we really need is the root directory, just leave now
81b4499a963e Added TinyMCE compression support and made some supporting modifications to common.php
Dan
parents: 541
diff changeset
   130
// checking for ENANO_COMMON_ROOT_LOADED_MULTI here means that if common
81b4499a963e Added TinyMCE compression support and made some supporting modifications to common.php
Dan
parents: 541
diff changeset
   131
// is included a second time, the rest of Enano will load.
81b4499a963e Added TinyMCE compression support and made some supporting modifications to common.php
Dan
parents: 541
diff changeset
   132
if ( defined('ENANO_COMMON_ROOTONLY') && !defined('ENANO_COMMON_ROOT_LOADED_MULTI') )
81b4499a963e Added TinyMCE compression support and made some supporting modifications to common.php
Dan
parents: 541
diff changeset
   133
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   134
	return true;
544
81b4499a963e Added TinyMCE compression support and made some supporting modifications to common.php
Dan
parents: 541
diff changeset
   135
}
81b4499a963e Added TinyMCE compression support and made some supporting modifications to common.php
Dan
parents: 541
diff changeset
   136
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   137
// Start including files. LOTS of files. Yeah!
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   138
require_once(ENANO_ROOT.'/includes/constants.php');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   139
require_once(ENANO_ROOT.'/includes/functions.php');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   140
require_once(ENANO_ROOT.'/includes/dbal.php');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   141
require_once(ENANO_ROOT.'/includes/paths.php');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   142
require_once(ENANO_ROOT.'/includes/sessions.php');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   143
require_once(ENANO_ROOT.'/includes/template.php');
800
9cdfe82c56cd Major underlying changes to namespace handling. Each namespace is handled by its own class which extends Namespace_Default. Much greater customization/pluggability potential, at the possible expense of some code reusing (though code reusing has been avoided thus far). Also a bit better handling of page passwords [SECURITY].
Dan
parents: 719
diff changeset
   144
require_once(ENANO_ROOT.'/includes/output.php');
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   145
require_once(ENANO_ROOT.'/includes/plugins.php');
607
935f3799b654 First stab at cache management backend. Everything seems to have been tested and working so far, but a number of things require a more specialized cache and can't go through the framework (e.g. user ranks which use references to map usernames to user IDs)
Dan
parents: 593
diff changeset
   146
require_once(ENANO_ROOT.'/includes/cache.php');
205
c4542792db2b Localization low-level framework added
Dan
parents: 193
diff changeset
   147
require_once(ENANO_ROOT.'/includes/lang.php');
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   148
require_once(ENANO_ROOT.'/includes/render.php');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   149
require_once(ENANO_ROOT.'/includes/rijndael.php');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   150
require_once(ENANO_ROOT.'/includes/email.php');
334
c72b545f1304 More localization work. Resolved major issue with JSON parser not parsing files over ~50KB. Switched JSON parser to the one from the Zend Framework (BSD licensed). Forced to split enano.json into five different files.
Dan
parents: 331
diff changeset
   151
require_once(ENANO_ROOT.'/includes/json2.php');
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   152
require_once(ENANO_ROOT.'/includes/pageprocess.php');
800
9cdfe82c56cd Major underlying changes to namespace handling. Each namespace is handled by its own class which extends Namespace_Default. Much greater customization/pluggability potential, at the possible expense of some code reusing (though code reusing has been avoided thus far). Also a bit better handling of page passwords [SECURITY].
Dan
parents: 719
diff changeset
   153
require_once(ENANO_ROOT.'/includes/namespaces/default.php');
80
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 76
diff changeset
   154
require_once(ENANO_ROOT.'/includes/tagcloud.php');
801
eb8b23f11744 Two big commits in one day I know, but redid password storage to use HMAC-SHA1. Consolidated much AES processing to three core methods in session that should handle everything automagically. Installation works; upgrades should. Rebranded as 1.1.6.
Dan
parents: 800
diff changeset
   155
require_once(ENANO_ROOT.'/includes/hmac.php');
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   156
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   157
strip_magic_quotes_gpc();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   158
372
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 371
diff changeset
   159
profiler_log('Files included and magic_quotes_gpc reversed if applicable');
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 371
diff changeset
   160
311
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   161
// Enano has five main components: the database abstraction layer (DBAL), the session manager,
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   162
// the path/URL manager, the template engine, and the plugin manager.
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   163
// Each part has its own class and a global object; nearly all Enano functions are handled by one of these five components.
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   164
// All of these classes are singletons and are designed to carry as much data as possible within the object
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   165
// to make data access and function calling easy.
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   166
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   167
global $db, $session, $paths, $template, $plugins; // Common objects
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   168
global $enano_config; // A global used to cache config information without making loads of queries ;-)
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   169
											// In addition, $enano_config is used to fetch config information if die_semicritical() is called.
311
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   170
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   171
// Jim Tucek's e-mail encryption code                      
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   172
global $email;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   173
313
854eecfada20 Merging in changes from stable
Dan
parents: 304 311
diff changeset
   174
// Language object
209
8a00247d1dee Login page mostly localized
Dan
parents: 205
diff changeset
   175
global $lang;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   176
406
7468a663315f Added some basic timezone support; DST support is still to come.
Dan
parents: 378
diff changeset
   177
// Timezone offset
7468a663315f Added some basic timezone support; DST support is still to come.
Dan
parents: 378
diff changeset
   178
global $timezone;
7468a663315f Added some basic timezone support; DST support is still to come.
Dan
parents: 378
diff changeset
   179
$timezone = 0;
7468a663315f Added some basic timezone support; DST support is still to come.
Dan
parents: 378
diff changeset
   180
711
f70d764aab33 Added initial support for DST. Rules are defined in constants.php and are extensible.
Dan
parents: 702
diff changeset
   181
// DST settings
f70d764aab33 Added initial support for DST. Rules are defined in constants.php and are extensible.
Dan
parents: 702
diff changeset
   182
global $dst_params;
f70d764aab33 Added initial support for DST. Rules are defined in constants.php and are extensible.
Dan
parents: 702
diff changeset
   183
$dst_params = array(0, 0, 0, 0, 60);
f70d764aab33 Added initial support for DST. Rules are defined in constants.php and are extensible.
Dan
parents: 702
diff changeset
   184
832
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 812
diff changeset
   185
// Establish HTTPS
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 812
diff changeset
   186
$is_https = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off';
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 812
diff changeset
   187
500
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents: 470
diff changeset
   188
// Divert to CLI loader if running from CLI
812
68060328e9c6 Added CLI installer. Supports interactive, command-line, and internal-call installation. Fixed a few bugs related to anti-SQL injection parser and plugin installation.
Dan
parents: 801
diff changeset
   189
if ( defined('ENANO_CLI') || ( isset($argc) && isset($argv) ) )
500
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents: 470
diff changeset
   190
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   191
	if ( defined('ENANO_CLI') || ( is_int($argc) && is_array($argv) && !isset($_SERVER['REQUEST_URI']) ) )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   192
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   193
		require(ENANO_ROOT . '/includes/common_cli.php');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   194
		return;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   195
	}
500
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents: 470
diff changeset
   196
}
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents: 470
diff changeset
   197
311
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   198
// Because Enano sends out complete URLs in several occasions, we need to know what hostname the user is requesting the page from.
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   199
// In future versions we may include a fallback "safety" host to use, but that's too much to worry about now
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   200
if ( !isset($_SERVER['HTTP_HOST']) )
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   201
	grinding_halt('Cannot get hostname', '<p>Your web browser did not provide the HTTP Host: field. This site requires a modern browser that supports the HTTP 1.1 standard.</p>');
311
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   202
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   203
//
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   204
// END BACKGROUND AND ENVIRONMENT CHECKS
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   205
//
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   206
592
27377179fe58 Another sweep from the optimization monster.
Dan
parents: 590
diff changeset
   207
profiler_log('Background/environment checks done');
27377179fe58 Another sweep from the optimization monster.
Dan
parents: 590
diff changeset
   208
311
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   209
//
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   210
// MAIN API INITIALIZATION
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   211
//
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   212
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   213
// The first thing we need to do is start the database connection. At this point, for all we know, Enano might not
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   214
// even be installed. If this connection attempt fails and it's because of a missing or corrupt config file, the
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   215
// user will be redirected (intelligently) to install.php.
320
112debff64bd SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents: 317
diff changeset
   216
1186
774ae986fded Backout from 1.1.7 due to upgrade issue, fixed and retagging
Dan
parents: 1109
diff changeset
   217
$config_file = ( defined('IN_ENANO_INSTALL') && !defined('IN_ENANO_UPGRADE') ) ? '/config.new.php' : '/config.php';
371
dc6026376919 Improved compatibility with PostgreSQL and fixed a number of installer bugs; fixed missing "meta" category declaration in language files
Dan
parents: 354
diff changeset
   218
@include(ENANO_ROOT . $config_file);
320
112debff64bd SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents: 317
diff changeset
   219
unset($dbuser, $dbpasswd);
112debff64bd SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents: 317
diff changeset
   220
if ( !isset($dbdriver) )
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   221
	$dbdriver = 'mysql';
320
112debff64bd SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents: 317
diff changeset
   222
112debff64bd SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents: 317
diff changeset
   223
$db = new $dbdriver();
311
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   224
$db->connect();
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   225
372
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 371
diff changeset
   226
profiler_log('Database connected');
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 371
diff changeset
   227
311
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   228
// The URL separator is the character appended to contentPath + url_title type strings.
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   229
// If the contentPath has a ? in it, this should be an ampersand; else, it should be a
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   230
// question mark.
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   231
$sep = ( strstr(contentPath, '?') ) ? '&' : '?';
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   232
define('urlSeparator', $sep);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   233
unset($sep); // save 10 bytes of memory...
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   234
719
f82da241eaf8 Fixed system table list; added safeguard against twice prefixing the tables in $system_table_list
Dan
parents: 711
diff changeset
   235
// Build the list of system tables (this is mostly done in constants.php, but that's before table_prefix is known)
f82da241eaf8 Fixed system table list; added safeguard against twice prefixing the tables in $system_table_list
Dan
parents: 711
diff changeset
   236
if ( defined('table_prefix') && !defined('ENANO_TABLELIST_PREFIXED') )
f82da241eaf8 Fixed system table list; added safeguard against twice prefixing the tables in $system_table_list
Dan
parents: 711
diff changeset
   237
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   238
	define('ENANO_TABLELIST_PREFIXED', 1);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   239
	foreach ( $system_table_list as $i => $_ )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   240
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   241
		$system_table_list[$i] = table_prefix . $system_table_list[$i];
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   242
	}
719
f82da241eaf8 Fixed system table list; added safeguard against twice prefixing the tables in $system_table_list
Dan
parents: 711
diff changeset
   243
}
f82da241eaf8 Fixed system table list; added safeguard against twice prefixing the tables in $system_table_list
Dan
parents: 711
diff changeset
   244
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   245
// Select and fetch the site configuration
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   246
$e = $db->sql_query('SELECT config_name, config_value FROM '.table_prefix.'config;');
311
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   247
if ( !$e )
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   248
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   249
	$db->_die('Some critical configuration information could not be selected.');
311
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   250
}
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   251
// Used in die_semicritical to figure out whether to call getConfig() or not
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   252
define('ENANO_CONFIG_FETCHED', '');
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   253
311
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   254
// Initialize and fetch the site configuration array, which is used to cache the config
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   255
$enano_config = Array();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   256
while($r = $db->fetchrow())
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   257
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   258
	$enano_config[$r['config_name']] = $r['config_value'];
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   259
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   260
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   261
$db->free_result();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   262
372
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 371
diff changeset
   263
profiler_log('Config fetched');
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 371
diff changeset
   264
1251
d543689ed2eb Added the ability to trust XFF (X-Forwarded-For) headers.
Dan
parents: 1227
diff changeset
   265
do_xff_check();
d543689ed2eb Added the ability to trust XFF (X-Forwarded-For) headers.
Dan
parents: 1227
diff changeset
   266
613
c08670a77871 Completed work (we hope) on CacheManager admin page
Dan
parents: 607
diff changeset
   267
if ( defined('ENANO_EXIT_AFTER_CONFIG') )
c08670a77871 Completed work (we hope) on CacheManager admin page
Dan
parents: 607
diff changeset
   268
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   269
	return true;
613
c08670a77871 Completed work (we hope) on CacheManager admin page
Dan
parents: 607
diff changeset
   270
}
c08670a77871 Completed work (we hope) on CacheManager admin page
Dan
parents: 607
diff changeset
   271
1259
49db7495f6b8 First shot at switching to database revision numbers separate from release version number. There are probably bugs, especially related to migration.
Dan Fuhry <dan@enanocms.org>
parents: 1251
diff changeset
   272
// Now that we have the config, check the database version.
49db7495f6b8 First shot at switching to database revision numbers separate from release version number. There are probably bugs, especially related to migration.
Dan Fuhry <dan@enanocms.org>
parents: 1251
diff changeset
   273
// ...We do have a database version, right? This was only added in 1.1.8, so assign
49db7495f6b8 First shot at switching to database revision numbers separate from release version number. There are probably bugs, especially related to migration.
Dan Fuhry <dan@enanocms.org>
parents: 1251
diff changeset
   274
// a database revision number if there isn't one in the config already.
49db7495f6b8 First shot at switching to database revision numbers separate from release version number. There are probably bugs, especially related to migration.
Dan Fuhry <dan@enanocms.org>
parents: 1251
diff changeset
   275
if ( getConfig('db_version') === false )
49db7495f6b8 First shot at switching to database revision numbers separate from release version number. There are probably bugs, especially related to migration.
Dan Fuhry <dan@enanocms.org>
parents: 1251
diff changeset
   276
{
49db7495f6b8 First shot at switching to database revision numbers separate from release version number. There are probably bugs, especially related to migration.
Dan Fuhry <dan@enanocms.org>
parents: 1251
diff changeset
   277
	generate_db_version();
49db7495f6b8 First shot at switching to database revision numbers separate from release version number. There are probably bugs, especially related to migration.
Dan Fuhry <dan@enanocms.org>
parents: 1251
diff changeset
   278
}
49db7495f6b8 First shot at switching to database revision numbers separate from release version number. There are probably bugs, especially related to migration.
Dan Fuhry <dan@enanocms.org>
parents: 1251
diff changeset
   279
if ( ($current_db_revision = getConfig('db_version', 0)) < $db_version && !defined('IN_ENANO_UPGRADE') )
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   280
{
1259
49db7495f6b8 First shot at switching to database revision numbers separate from release version number. There are probably bugs, especially related to migration.
Dan Fuhry <dan@enanocms.org>
parents: 1251
diff changeset
   281
	grinding_halt('Database out of date', '<p>Your Enano database is out of date and needs to be upgraded. To do this, use the <a href="'.scriptPath.'/install/index.php">upgrade script</a>.</p>'
49db7495f6b8 First shot at switching to database revision numbers separate from release version number. There are probably bugs, especially related to migration.
Dan Fuhry <dan@enanocms.org>
parents: 1251
diff changeset
   282
		. "<p>Your database version: $current_db_revision<br />Latest version: $db_version</p>");
49db7495f6b8 First shot at switching to database revision numbers separate from release version number. There are probably bugs, especially related to migration.
Dan Fuhry <dan@enanocms.org>
parents: 1251
diff changeset
   283
}
49db7495f6b8 First shot at switching to database revision numbers separate from release version number. There are probably bugs, especially related to migration.
Dan Fuhry <dan@enanocms.org>
parents: 1251
diff changeset
   284
else if ( $current_db_revision > $db_version )
49db7495f6b8 First shot at switching to database revision numbers separate from release version number. There are probably bugs, especially related to migration.
Dan Fuhry <dan@enanocms.org>
parents: 1251
diff changeset
   285
{
49db7495f6b8 First shot at switching to database revision numbers separate from release version number. There are probably bugs, especially related to migration.
Dan Fuhry <dan@enanocms.org>
parents: 1251
diff changeset
   286
	grinding_halt('Database newer than Enano', '<p>Your Enano database is a newer revision than what this Enano release calls for. Please upgrade your Enano files.</p>'
49db7495f6b8 First shot at switching to database revision numbers separate from release version number. There are probably bugs, especially related to migration.
Dan Fuhry <dan@enanocms.org>
parents: 1251
diff changeset
   287
		. "<p>Your database version: $current_db_revision<br />Latest version: $db_version</p>");
49db7495f6b8 First shot at switching to database revision numbers separate from release version number. There are probably bugs, especially related to migration.
Dan Fuhry <dan@enanocms.org>
parents: 1251
diff changeset
   288
}
49db7495f6b8 First shot at switching to database revision numbers separate from release version number. There are probably bugs, especially related to migration.
Dan Fuhry <dan@enanocms.org>
parents: 1251
diff changeset
   289
49db7495f6b8 First shot at switching to database revision numbers separate from release version number. There are probably bugs, especially related to migration.
Dan Fuhry <dan@enanocms.org>
parents: 1251
diff changeset
   290
// If we made it here, DB is up to date.
49db7495f6b8 First shot at switching to database revision numbers separate from release version number. There are probably bugs, especially related to migration.
Dan Fuhry <dan@enanocms.org>
parents: 1251
diff changeset
   291
if ( getConfig('enano_version') !== $version && !preg_match('/^upg-/', getConfig('enano_version')) )
49db7495f6b8 First shot at switching to database revision numbers separate from release version number. There are probably bugs, especially related to migration.
Dan Fuhry <dan@enanocms.org>
parents: 1251
diff changeset
   292
{
49db7495f6b8 First shot at switching to database revision numbers separate from release version number. There are probably bugs, especially related to migration.
Dan Fuhry <dan@enanocms.org>
parents: 1251
diff changeset
   293
	setConfig('enano_version', $version);
49db7495f6b8 First shot at switching to database revision numbers separate from release version number. There are probably bugs, especially related to migration.
Dan Fuhry <dan@enanocms.org>
parents: 1251
diff changeset
   294
	setConfig('newly_upgraded', 1);
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   295
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   296
650
e45183014778 Added CDN support: a URL to a CDN can now be specified and Enano will load all images, CSS, and javascript (except TinyMCE) from that server
Dan
parents: 613
diff changeset
   297
// Set our CDN path
666
402adf8ea719 Made cdnPath define conditionally; fixed common_cli not properly loading plugins
Dan
parents: 650
diff changeset
   298
if ( !defined('cdnPath') )
702
15cd41fd8a05 Fixed cdnPath being set even if config entry is blank
Dan
parents: 685
diff changeset
   299
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   300
	$cdnpath = getConfig('cdn_path', scriptPath);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   301
	if ( empty($cdnpath) )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   302
		$cdnpath = scriptPath;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   303
	define('cdnPath', $cdnpath);
702
15cd41fd8a05 Fixed cdnPath being set even if config entry is blank
Dan
parents: 685
diff changeset
   304
}
650
e45183014778 Added CDN support: a URL to a CDN can now be specified and Enano will load all images, CSS, and javascript (except TinyMCE) from that server
Dan
parents: 613
diff changeset
   305
99
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   306
//
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   307
// Low level maintenance
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   308
//
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   309
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   310
// If the AES key size has been changed, bail out and fast
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   311
if ( !getConfig('aes_key_size') )
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   312
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   313
	setConfig('aes_key_size', AES_BITS);
99
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   314
}
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   315
else if ( $ks = getConfig('aes_key_size') )
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   316
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   317
	if ( intval($ks) != AES_BITS )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   318
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   319
		grinding_halt('AES key size changed', '<p>Enano has detected that the AES key size in constants.php has been changed. This change cannot be performed after installation, otherwise the private key would have to be re-generated and all passwords would have to be re-encrypted.</p><p>Please change the key size back to ' . $ks . ' bits and reload this page.</p>');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   320
	}
99
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   321
}
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   322
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   323
// Same for AES block size
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   324
if ( !getConfig('aes_block_size') )
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   325
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   326
	setConfig('aes_block_size', AES_BLOCKSIZE);
99
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   327
}
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   328
else if ( $ks = getConfig('aes_block_size') )
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   329
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   330
	if ( intval($ks) != AES_BLOCKSIZE )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   331
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   332
		grinding_halt('AES block size changed', '<p>Enano has detected that the AES block size in constants.php has been changed. This change cannot be performed after installation, otherwise all passwords would have to be re-encrypted.</p><p>Please change the block size back to ' . $ks . ' bits and reload this page.</p>');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   333
	}
99
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   334
}
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   335
209
8a00247d1dee Login page mostly localized
Dan
parents: 205
diff changeset
   336
// Is there no default language?
372
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 371
diff changeset
   337
if ( getConfig('default_language') === false && !defined('IN_ENANO_MIGRATION') )
209
8a00247d1dee Login page mostly localized
Dan
parents: 205
diff changeset
   338
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   339
	$q = $db->sql_query('SELECT lang_id FROM '.table_prefix.'language LIMIT 1;');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   340
	if ( !$q )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   341
		$db->_die('common.php - setting default language');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   342
	if ( $db->numrows() < 1 && !defined('ENANO_ALLOW_LOAD_NOLANG') )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   343
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   344
		grinding_halt('No languages', '<p>There are no languages installed on this site.</p>
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   345
				<p>If you are the website administrator, you may install a language by writing and executing a simple PHP script to install it:</p>
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   346
				<pre>
209
8a00247d1dee Login page mostly localized
Dan
parents: 205
diff changeset
   347
&lt;?php
8a00247d1dee Login page mostly localized
Dan
parents: 205
diff changeset
   348
define("ENANO_ALLOW_LOAD_NOLANG", 1);
8a00247d1dee Login page mostly localized
Dan
parents: 205
diff changeset
   349
require("includes/common.php");
8a00247d1dee Login page mostly localized
Dan
parents: 205
diff changeset
   350
install_language("eng", "English", "English", ENANO_ROOT . "/language/english/enano.json");</pre>');
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   351
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   352
	$row = $db->fetchrow();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   353
	setConfig('default_language', $row['lang_id']);
209
8a00247d1dee Login page mostly localized
Dan
parents: 205
diff changeset
   354
}
8a00247d1dee Login page mostly localized
Dan
parents: 205
diff changeset
   355
372
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 371
diff changeset
   356
profiler_log('Ran checks');
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   357
607
935f3799b654 First stab at cache management backend. Everything seems to have been tested and working so far, but a number of things require a more specialized cache and can't go through the framework (e.g. user ranks which use references to map usernames to user IDs)
Dan
parents: 593
diff changeset
   358
// Init cache
935f3799b654 First stab at cache management backend. Everything seems to have been tested and working so far, but a number of things require a more specialized cache and can't go through the framework (e.g. user ranks which use references to map usernames to user IDs)
Dan
parents: 593
diff changeset
   359
$cache = new CacheManager();
935f3799b654 First stab at cache management backend. Everything seems to have been tested and working so far, but a number of things require a more specialized cache and can't go through the framework (e.g. user ranks which use references to map usernames to user IDs)
Dan
parents: 593
diff changeset
   360
311
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   361
// Load plugin manager
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   362
$plugins = new pluginLoader();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   363
311
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   364
//
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   365
// Mainstream API boot-up
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   366
//
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   367
311
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   368
// Obtain list of plugins
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   369
$plugins->loadAll();
311
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   370
590
03a60844c7c5 Several optimization changes including getting rid of a few eval()s. Added placeholder functions for the theme manager, which should be working now
Dan
parents: 544
diff changeset
   371
profiler_log('Fetched plugin list');
03a60844c7c5 Several optimization changes including getting rid of a few eval()s. Added placeholder functions for the theme manager, which should be working now
Dan
parents: 544
diff changeset
   372
311
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   373
global $plugins;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   374
311
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   375
// Load plugins from common because we can't give plugins full abilities in object context
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   376
foreach ( $plugins->load_list as $f )
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   377
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   378
	if ( file_exists(ENANO_ROOT . '/plugins/' . $f) )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   379
		include_once ENANO_ROOT . '/plugins/' . $f;
311
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   380
}
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   381
372
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 371
diff changeset
   382
profiler_log('Loaded plugins');
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 371
diff changeset
   383
311
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   384
// Three fifths of the Enano API gets the breath of life right here.
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   385
$session = new sessionManager();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   386
$paths = new pathManager();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   387
$template = new template();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   388
$email = new EmailEncryptor();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   389
372
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 371
diff changeset
   390
profiler_log('Instanciated important singletons');
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 371
diff changeset
   391
311
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   392
// We've got the five main objects - flick on the switch so if a problem occurs, we can have a "friendly" UI
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   393
define('ENANO_BASE_CLASSES_INITIALIZED', '');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   394
311
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   395
// From here on out, none of this functionality is needed during the installer stage.
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   396
// Once $paths->init() is called, we could be redirected to the main page, so we don't want
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   397
// that if the installer's running. Don't just go and define IN_ENANO_INSTALL from your
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   398
// script though, because that will make the DBAL look in the wrong place for the config file.
32
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   399
if ( !defined('IN_ENANO_INSTALL') )
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   400
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   401
	// And here you have it, the de facto way to place a hook. Plugins can place hooks and hook
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   402
	// into other plugins. You just never know.
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   403
	$code = $plugins->setHook('base_classes_initted');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   404
	foreach ( $code as $cmd )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   405
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   406
		eval($cmd);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   407
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   408
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   409
	profiler_log('Finished base_classes_initted hook');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   410
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   411
	// One quick security check...
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   412
	if ( !is_valid_ip($_SERVER['REMOTE_ADDR']) )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   413
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   414
		die('SECURITY: spoofed IP address: ' . htmlspecialchars($_SERVER['REMOTE_ADDR']));
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   415
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   416
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   417
	// For special and administration pages, sometimes there is a "preloader" function that must be run
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   418
	// before the session manager and/or path manager get the init signal. Call it here.
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   419
	$urlname = get_title(true);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   420
	list($page_id, $namespace) = RenderMan::strToPageID($urlname);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   421
	list($page_id_top) = explode('/', $page_id);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   422
	$fname = "page_{$namespace}_{$page_id_top}_preloader";
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   423
	if( ( $namespace == 'Admin' || $namespace == 'Special' ) && function_exists($fname))
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   424
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   425
		call_user_func($fname);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   426
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   427
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   428
	profiler_log('Checked for (and ran, if applicable) preloader');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   429
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   430
	// Add all of our built in special pages
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   431
	foreach ( array('SpecialUserFuncs', 'SpecialPageFuncs', 'SpecialAdmin', 'SpecialCSS', 'SpecialUpDownload', 'SpecialSearch', 'PrivateMessages', 'SpecialGroups', 'SpecialLog') as $plugin )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   432
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   433
		$funcname = "{$plugin}_paths_init";
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   434
		if ( function_exists($funcname) )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   435
		{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   436
			$funcname();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   437
		}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   438
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   439
	profiler_log('Added special pages');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   440
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   441
	// All checks passed! Start the main components up.  
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   442
	$session->start();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   443
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   444
	// This is where plugins will want to add pages from 1.1.x on out. You can still add
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   445
	// pages at base_classes_initted but the titles won't be localized. This is because
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   446
	// the session manager has to be started before localization will work in the user's
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   447
	// preferred language.
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   448
	$code = $plugins->setHook('session_started');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   449
	foreach ( $code as $cmd )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   450
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   451
		eval($cmd);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   452
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   453
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   454
	profiler_log('Ran session_started hook');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   455
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   456
	$paths->init($urlname);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   457
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   458
	// setup output format
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   459
	if ( defined('ENANO_OUTPUT_FORMAT') )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   460
		$class = 'Output_' . ENANO_OUTPUT_FORMAT;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   461
	else
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   462
		$class = ( isset($_GET['noheaders']) ) ? 'Output_Naked' : 'Output_HTML';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   463
		
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   464
	$output = new $class();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   465
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   466
	// Are we running from the API? If so, did the page set a title?
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   467
	if ( !defined('ENANO_INTERFACE_INDEX') && !defined('ENANO_INTERFACE_AJAX') && isset($title) )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   468
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   469
		$output->set_title($title);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   470
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   471
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   472
	// We're ready for whatever life throws us now, at least from an API point of view.
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   473
	define('ENANO_MAINSTREAM', '');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   474
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   475
	// If the site is disabled, bail out, unless we're trying to log in or administer the site
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   476
	if(getConfig('site_disabled') == '1' && $session->user_level < USER_LEVEL_ADMIN)
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   477
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   478
		// is this one of the more critical special pages?
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   479
		if ( $paths->namespace == 'Admin' || ( $paths->namespace == 'Special' && ( $paths->page_id == 'CSS' || $paths->page_id == 'Administration' || $paths->page_id == 'Login' ) ) )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   480
		{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   481
			// yeah, we need to keep this page available. do nothing; allow execution to continue
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   482
		}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   483
		else
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   484
		{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   485
			if(!$n = getConfig('site_disabled_notice')) 
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   486
			{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   487
				$n = 'The administrator has disabled the site. Please check back later.';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   488
			}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   489
			
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   490
			$text = RenderMan::render($n) . '
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   491
			<div class="info-box">
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   492
				If you have an administrative account, you may <a href="'.makeUrlNS('Special', 'Login').'">log in</a> to the site.
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   493
			</div>';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   494
			$paths->wiki_mode = 0;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   495
			die_semicritical('Site disabled', $text);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   496
		}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   497
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   498
	else if ( getConfig('site_disabled') == '1' && $session->user_level >= USER_LEVEL_ADMIN )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   499
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   500
		// If the site is disabled but the user has admin rights, allow browsing
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   501
		// and stuff, but display the orange box notifying the admin.
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   502
		$template->site_disabled = true;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   503
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   504
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   505
	// At this point all of Enano is fully initialized and running and you're ready to do whatever you want.
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   506
	$code = $plugins->setHook('common_post');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   507
	foreach ( $code as $cmd )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   508
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   509
		eval($cmd);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   510
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   511
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   512
	profiler_log('Ran disabled-site checks and common_post');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   513
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   514
	load_rank_data();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   515
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   516
	profiler_log('Loaded user rank data');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   517
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   518
	if ( isset($_GET['noheaders']) )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1206
diff changeset
   519
		$template->no_headers = true;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   520
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   521
372
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 371
diff changeset
   522
profiler_log('common finished');
5bd429428101 A number of scattered changes. Profiler added and only enabled in debug mode (currently on), but awfully useful for fixing performance in the future. Started work on Admin:LangManager
Dan
parents: 371
diff changeset
   523
311
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   524
// That's the end. Enano should be loaded now :-)
a007145a0ff6 Deprecated debugConsole and removed all calls to it. Added a lot of comments to common.php. Added support for "anonymous pages" that are created when the Enano API is loaded from an external script. Fixed missing border-bottom on Type 2 sidebar blocks in Oxygen.
Dan
parents: 286
diff changeset
   525
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   526
?>