1
+ − 1
<?php
+ − 2
+ − 3
/*
+ − 4
* Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
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
diff
changeset
+ − 5
* Version 1.1.6 (Caoineag beta 1)
536
+ − 6
* Copyright (C) 2006-2008 Dan Fuhry
1
+ − 7
*
+ − 8
* This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
+ − 9
* as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
+ − 10
*
+ − 11
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ − 12
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
+ − 13
*/
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
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
diff
changeset
+ − 15
/**
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
diff
changeset
+ − 16
* 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
diff
changeset
+ − 17
* 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
diff
changeset
+ − 18
* @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
diff
changeset
+ − 19
* @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
diff
changeset
+ − 20
* @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
diff
changeset
+ − 21
*/
1
+ − 22
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
diff
changeset
+ − 23
// 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
diff
changeset
+ − 24
if ( isset($_REQUEST['GLOBALS']) )
1
+ − 25
{
+ − 26
?>
+ − 27
<!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[
+ − 28
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+' ';}}
+ − 29
// ]]>
12
+ − 30
</script><p><span style="color:black;">You been f***ed by Enano | valid XHTML 1.1</span></p></body></html>
1
+ − 31
<?php
+ − 32
exit;
+ − 33
}
+ − 34
544
+ − 35
// only do this if it hasn't been done yet
+ − 36
if ( !defined('ENANO_COMMON_ROOT_LOADED') )
+ − 37
{
+ − 38
+ − 39
// log this
+ − 40
define('ENANO_COMMON_ROOT_LOADED', 1);
+ − 41
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
diff
changeset
+ − 42
// 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
diff
changeset
+ − 43
// 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
diff
changeset
+ − 44
// 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
diff
changeset
+ − 45
// 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
diff
changeset
+ − 46
// You'll want to change this for custom distributions.
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
diff
changeset
+ − 47
$version = '1.1.6';
1
+ − 48
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
diff
changeset
+ − 49
/**
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
diff
changeset
+ − 50
* 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
diff
changeset
+ − 51
* 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
diff
changeset
+ − 52
* @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
diff
changeset
+ − 53
*/
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
diff
changeset
+ − 54
442
+ − 55
// First check to see if something already declared this function.... it happens often.
+ − 56
if ( !function_exists('microtime_float') )
1
+ − 57
{
442
+ − 58
function microtime_float()
+ − 59
{
+ − 60
list($usec, $sec) = explode(" ", microtime());
+ − 61
return ((float)$usec + (float)$sec);
+ − 62
}
1
+ − 63
}
+ − 64
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
diff
changeset
+ − 65
// Determine starting time
1
+ − 66
global $_starttime;
+ − 67
$_starttime = microtime_float();
+ − 68
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
diff
changeset
+ − 69
// Verbose error reporting
443
+ − 70
if ( defined('E_STRICT') )
+ − 71
{
+ − 72
// PHP5, PHP6
+ − 73
error_reporting(E_ALL & ~E_STRICT);
+ − 74
}
+ − 75
else
+ − 76
{
+ − 77
// PHP4
+ − 78
error_reporting(E_ALL);
+ − 79
}
1
+ − 80
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
diff
changeset
+ − 81
//
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
diff
changeset
+ − 82
// 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
diff
changeset
+ − 83
//
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
diff
changeset
+ − 84
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
diff
changeset
+ − 85
// 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
diff
changeset
+ − 86
// 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
diff
changeset
+ − 87
// 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
diff
changeset
+ − 88
// 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
diff
changeset
+ − 89
// .enanodev is found in the Enano root (not /repo/).
470
+ − 90
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
diff
changeset
+ − 91
{
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
diff
changeset
+ − 92
// We have a development directory. Remove /repo/ from the picture.
3
+ − 93
$filename = str_replace('/repo/', '/', __FILE__);
2
0931d60f5bdb
Adding compatibility patch for Enano dev servers to common.php
dan@scribus.fuhry.local.fuhry.local
diff
changeset
+ − 94
}
0931d60f5bdb
Adding compatibility patch for Enano dev servers to common.php
dan@scribus.fuhry.local.fuhry.local
diff
changeset
+ − 95
else
0931d60f5bdb
Adding compatibility patch for Enano dev servers to common.php
dan@scribus.fuhry.local.fuhry.local
diff
changeset
+ − 96
{
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
diff
changeset
+ − 97
// Standard Enano installation
2
0931d60f5bdb
Adding compatibility patch for Enano dev servers to common.php
dan@scribus.fuhry.local.fuhry.local
diff
changeset
+ − 98
$filename = __FILE__;
0931d60f5bdb
Adding compatibility patch for Enano dev servers to common.php
dan@scribus.fuhry.local.fuhry.local
diff
changeset
+ − 99
}
0931d60f5bdb
Adding compatibility patch for Enano dev servers to common.php
dan@scribus.fuhry.local.fuhry.local
diff
changeset
+ − 100
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
diff
changeset
+ − 101
// 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
diff
changeset
+ − 102
if ( !defined('ENANO_ROOT') )
2
0931d60f5bdb
Adding compatibility patch for Enano dev servers to common.php
dan@scribus.fuhry.local.fuhry.local
diff
changeset
+ − 103
define('ENANO_ROOT', dirname(dirname($filename)));
1
+ − 104
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
diff
changeset
+ − 105
// 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
+ − 106
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
diff
changeset
+ − 107
// _nightly.php is used to tag non-Mercurial-generated nightly builds
1
+ − 108
if ( file_exists( ENANO_ROOT . '/_nightly.php') )
+ − 109
require(ENANO_ROOT.'/_nightly.php');
+ − 110
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
diff
changeset
+ − 111
// 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
diff
changeset
+ − 112
$cron_tasks = array();
3dbe848431b0
Added a cron framework. Currently tasks will not be run; will implement into templates in next commit
Dan
diff
changeset
+ − 113
544
+ − 114
} // check for ENANO_COMMON_ROOT_LOADED
+ − 115
else
+ − 116
{
+ − 117
// loading a second time
+ − 118
if ( !defined('ENANO_COMMON_ROOT_LOADED_MULTI') )
+ − 119
{
+ − 120
define('ENANO_COMMON_ROOT_LOADED_MULTI', 1);
+ − 121
}
+ − 122
}
+ − 123
+ − 124
// If all we really need is the root directory, just leave now
+ − 125
// checking for ENANO_COMMON_ROOT_LOADED_MULTI here means that if common
+ − 126
// is included a second time, the rest of Enano will load.
+ − 127
if ( defined('ENANO_COMMON_ROOTONLY') && !defined('ENANO_COMMON_ROOT_LOADED_MULTI') )
+ − 128
{
+ − 129
return true;
+ − 130
}
+ − 131
1
+ − 132
// Start including files. LOTS of files. Yeah!
+ − 133
require_once(ENANO_ROOT.'/includes/constants.php');
+ − 134
require_once(ENANO_ROOT.'/includes/functions.php');
+ − 135
require_once(ENANO_ROOT.'/includes/dbal.php');
+ − 136
require_once(ENANO_ROOT.'/includes/paths.php');
+ − 137
require_once(ENANO_ROOT.'/includes/sessions.php');
+ − 138
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
diff
changeset
+ − 139
require_once(ENANO_ROOT.'/includes/output.php');
1
+ − 140
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
diff
changeset
+ − 141
require_once(ENANO_ROOT.'/includes/cache.php');
205
+ − 142
require_once(ENANO_ROOT.'/includes/lang.php');
1
+ − 143
require_once(ENANO_ROOT.'/includes/render.php');
+ − 144
require_once(ENANO_ROOT.'/includes/rijndael.php');
+ − 145
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
diff
changeset
+ − 146
require_once(ENANO_ROOT.'/includes/json2.php');
1
+ − 147
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
diff
changeset
+ − 148
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
diff
changeset
+ − 149
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
diff
changeset
+ − 150
require_once(ENANO_ROOT.'/includes/hmac.php');
1
+ − 151
+ − 152
strip_magic_quotes_gpc();
+ − 153
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
diff
changeset
+ − 154
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
diff
changeset
+ − 155
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
diff
changeset
+ − 156
// 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
diff
changeset
+ − 157
// 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
diff
changeset
+ − 158
// 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
diff
changeset
+ − 159
// 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
diff
changeset
+ − 160
// to make data access and function calling easy.
1
+ − 161
+ − 162
global $db, $session, $paths, $template, $plugins; // Common objects
+ − 163
global $enano_config; // A global used to cache config information without making loads of queries ;-)
+ − 164
// 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
diff
changeset
+ − 165
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
diff
changeset
+ − 166
// Jim Tucek's e-mail encryption code
1
+ − 167
global $email;
+ − 168
313
+ − 169
// Language object
209
+ − 170
global $lang;
1
+ − 171
406
+ − 172
// Timezone offset
+ − 173
global $timezone;
+ − 174
$timezone = 0;
+ − 175
711
+ − 176
// DST settings
+ − 177
global $dst_params;
+ − 178
$dst_params = array(0, 0, 0, 0, 60);
+ − 179
500
455277559782
Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
diff
changeset
+ − 180
// 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
diff
changeset
+ − 181
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
diff
changeset
+ − 182
{
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
diff
changeset
+ − 183
if ( defined('ENANO_CLI') || ( is_int($argc) && is_array($argv) && !isset($_SERVER['REQUEST_URI']) ) )
500
455277559782
Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
diff
changeset
+ − 184
{
455277559782
Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
diff
changeset
+ − 185
require(ENANO_ROOT . '/includes/common_cli.php');
455277559782
Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
diff
changeset
+ − 186
return;
455277559782
Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
diff
changeset
+ − 187
}
455277559782
Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
diff
changeset
+ − 188
}
455277559782
Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
diff
changeset
+ − 189
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
diff
changeset
+ − 190
// 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
diff
changeset
+ − 191
// 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
diff
changeset
+ − 192
if ( !isset($_SERVER['HTTP_HOST']) )
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
diff
changeset
+ − 193
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>');
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
diff
changeset
+ − 194
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
diff
changeset
+ − 195
//
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
diff
changeset
+ − 196
// 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
diff
changeset
+ − 197
//
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
diff
changeset
+ − 198
592
+ − 199
profiler_log('Background/environment checks done');
+ − 200
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
diff
changeset
+ − 201
//
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
diff
changeset
+ − 202
// 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
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
diff
changeset
+ − 204
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
diff
changeset
+ − 205
// 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
diff
changeset
+ − 206
// 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
diff
changeset
+ − 207
// 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
diff
changeset
+ − 208
371
dc6026376919
Improved compatibility with PostgreSQL and fixed a number of installer bugs; fixed missing "meta" category declaration in language files
Dan
diff
changeset
+ − 209
$config_file = ( defined('IN_ENANO_INSTALL') ) ? '/config.new.php' : '/config.php';
dc6026376919
Improved compatibility with PostgreSQL and fixed a number of installer bugs; fixed missing "meta" category declaration in language files
Dan
diff
changeset
+ − 210
@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
diff
changeset
+ − 211
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
diff
changeset
+ − 212
if ( !isset($dbdriver) )
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
diff
changeset
+ − 213
$dbdriver = 'mysql';
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
diff
changeset
+ − 214
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
diff
changeset
+ − 215
$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
diff
changeset
+ − 216
$db->connect();
1
+ − 217
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
diff
changeset
+ − 218
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
diff
changeset
+ − 219
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
diff
changeset
+ − 220
// 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
diff
changeset
+ − 221
// 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
diff
changeset
+ − 222
// 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
diff
changeset
+ − 223
$sep = ( strstr(contentPath, '?') ) ? '&' : '?';
1
+ − 224
define('urlSeparator', $sep);
+ − 225
unset($sep); // save 10 bytes of memory...
+ − 226
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
diff
changeset
+ − 227
// Sometimes there are critical failures triggered by initialization functions in the Enano API that are recurring
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
diff
changeset
+ − 228
// and cannot be fixed except for manual intervention. This is where that code should go.
1
+ − 229
if ( isset($_GET['do']) && $_GET['do'] == 'diag' && isset($_GET['sub']) )
+ − 230
{
+ − 231
switch($_GET['sub'])
+ − 232
{
+ − 233
case 'cookie_destroy':
+ − 234
unset($_COOKIE['sid']);
+ − 235
setcookie('sid', '', time()-3600*24, scriptPath);
+ − 236
setcookie('sid', '', time()-3600*24, scriptPath.'/');
348
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
diff
changeset
+ − 237
die('Session cookie cleared. <a href="'.htmlspecialchars($_SERVER['PHP_SELF']).'">Continue</a>');
1
+ − 238
break;
+ − 239
}
+ − 240
}
+ − 241
719
f82da241eaf8
Fixed system table list; added safeguard against twice prefixing the tables in $system_table_list
Dan
diff
changeset
+ − 242
// 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
diff
changeset
+ − 243
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
diff
changeset
+ − 244
{
f82da241eaf8
Fixed system table list; added safeguard against twice prefixing the tables in $system_table_list
Dan
diff
changeset
+ − 245
define('ENANO_TABLELIST_PREFIXED', 1);
f82da241eaf8
Fixed system table list; added safeguard against twice prefixing the tables in $system_table_list
Dan
diff
changeset
+ − 246
foreach ( $system_table_list as $i => $_ )
f82da241eaf8
Fixed system table list; added safeguard against twice prefixing the tables in $system_table_list
Dan
diff
changeset
+ − 247
{
f82da241eaf8
Fixed system table list; added safeguard against twice prefixing the tables in $system_table_list
Dan
diff
changeset
+ − 248
$system_table_list[$i] = table_prefix . $system_table_list[$i];
f82da241eaf8
Fixed system table list; added safeguard against twice prefixing the tables in $system_table_list
Dan
diff
changeset
+ − 249
}
f82da241eaf8
Fixed system table list; added safeguard against twice prefixing the tables in $system_table_list
Dan
diff
changeset
+ − 250
}
f82da241eaf8
Fixed system table list; added safeguard against twice prefixing the tables in $system_table_list
Dan
diff
changeset
+ − 251
1
+ − 252
// Select and fetch the site configuration
+ − 253
$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
diff
changeset
+ − 254
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
diff
changeset
+ − 255
{
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
diff
changeset
+ − 256
$db->_die('Some critical configuration information could not be selected.');
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
diff
changeset
+ − 257
}
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
diff
changeset
+ − 258
// 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
diff
changeset
+ − 259
define('ENANO_CONFIG_FETCHED', '');
1
+ − 260
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
diff
changeset
+ − 261
// Initialize and fetch the site configuration array, which is used to cache the config
1
+ − 262
$enano_config = Array();
+ − 263
while($r = $db->fetchrow())
+ − 264
{
+ − 265
$enano_config[$r['config_name']] = $r['config_value'];
+ − 266
}
+ − 267
+ − 268
$db->free_result();
+ − 269
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
diff
changeset
+ − 270
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
diff
changeset
+ − 271
613
+ − 272
if ( defined('ENANO_EXIT_AFTER_CONFIG') )
+ − 273
{
+ − 274
return true;
+ − 275
}
+ − 276
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
diff
changeset
+ − 277
// Now that we have the config, check the Enano version.
348
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
diff
changeset
+ − 278
if ( enano_version(false, true) != $version && !defined('IN_ENANO_UPGRADE') )
1
+ − 279
{
685
17ebe24cdf85
Rebranded as 1.1.5 (Caoineag alpha 5) and fixed a couple bugs related to CDN support in template_nodb and installerUI. Updated readme.
Dan
diff
changeset
+ − 280
grinding_halt('Version mismatch', '<p>It seems that the Enano release we\'re trying to run ('.$version.') is different from the version specified in your database ('.enano_version().'). Perhaps you need to <a href="'.scriptPath.'/install/index.php">upgrade</a>?</p>');
1
+ − 281
}
+ − 282
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
diff
changeset
+ − 283
// Set our CDN path
666
+ − 284
if ( !defined('cdnPath') )
702
+ − 285
{
+ − 286
$cdnpath = getConfig('cdn_path', scriptPath);
+ − 287
if ( empty($cdnpath) )
+ − 288
$cdnpath = scriptPath;
+ − 289
define('cdnPath', $cdnpath);
+ − 290
}
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
diff
changeset
+ − 291
99
2332ebd75f61
Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
diff
changeset
+ − 292
//
2332ebd75f61
Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
diff
changeset
+ − 293
// Low level maintenance
2332ebd75f61
Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
diff
changeset
+ − 294
//
2332ebd75f61
Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
diff
changeset
+ − 295
2332ebd75f61
Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
diff
changeset
+ − 296
// 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
diff
changeset
+ − 297
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
diff
changeset
+ − 298
{
2332ebd75f61
Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
diff
changeset
+ − 299
setConfig('aes_key_size', AES_BITS);
2332ebd75f61
Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
diff
changeset
+ − 300
}
2332ebd75f61
Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
diff
changeset
+ − 301
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
diff
changeset
+ − 302
{
2332ebd75f61
Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
diff
changeset
+ − 303
if ( intval($ks) != AES_BITS )
2332ebd75f61
Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
diff
changeset
+ − 304
{
2332ebd75f61
Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
diff
changeset
+ − 305
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>');
2332ebd75f61
Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
diff
changeset
+ − 306
}
2332ebd75f61
Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
diff
changeset
+ − 307
}
2332ebd75f61
Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
diff
changeset
+ − 308
2332ebd75f61
Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
diff
changeset
+ − 309
// 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
diff
changeset
+ − 310
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
diff
changeset
+ − 311
{
2332ebd75f61
Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
diff
changeset
+ − 312
setConfig('aes_block_size', AES_BLOCKSIZE);
2332ebd75f61
Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
diff
changeset
+ − 313
}
2332ebd75f61
Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
diff
changeset
+ − 314
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
diff
changeset
+ − 315
{
2332ebd75f61
Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
diff
changeset
+ − 316
if ( intval($ks) != AES_BLOCKSIZE )
2332ebd75f61
Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
diff
changeset
+ − 317
{
2332ebd75f61
Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
diff
changeset
+ − 318
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>');
2332ebd75f61
Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
diff
changeset
+ − 319
}
2332ebd75f61
Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
diff
changeset
+ − 320
}
2332ebd75f61
Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
diff
changeset
+ − 321
209
+ − 322
// 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
diff
changeset
+ − 323
if ( getConfig('default_language') === false && !defined('IN_ENANO_MIGRATION') )
209
+ − 324
{
+ − 325
$q = $db->sql_query('SELECT lang_id FROM '.table_prefix.'language LIMIT 1;');
+ − 326
if ( !$q )
+ − 327
$db->_die('common.php - setting default language');
+ − 328
if ( $db->numrows() < 1 && !defined('ENANO_ALLOW_LOAD_NOLANG') )
+ − 329
{
+ − 330
grinding_halt('No languages', '<p>There are no languages installed on this site.</p>
+ − 331
<p>If you are the website administrator, you may install a language by writing and executing a simple PHP script to install it:</p>
+ − 332
<pre>
+ − 333
<?php
+ − 334
define("ENANO_ALLOW_LOAD_NOLANG", 1);
+ − 335
require("includes/common.php");
+ − 336
install_language("eng", "English", "English", ENANO_ROOT . "/language/english/enano.json");</pre>');
+ − 337
}
+ − 338
$row = $db->fetchrow();
+ − 339
setConfig('default_language', $row['lang_id']);
+ − 340
}
+ − 341
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
diff
changeset
+ − 342
profiler_log('Ran checks');
1
+ − 343
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
diff
changeset
+ − 344
// 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
diff
changeset
+ − 345
$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
diff
changeset
+ − 346
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
diff
changeset
+ − 347
// Load plugin manager
1
+ − 348
$plugins = new pluginLoader();
+ − 349
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
diff
changeset
+ − 350
//
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
diff
changeset
+ − 351
// 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
diff
changeset
+ − 352
//
1
+ − 353
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
diff
changeset
+ − 354
// Obtain list of plugins
1
+ − 355
$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
diff
changeset
+ − 356
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
diff
changeset
+ − 357
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
diff
changeset
+ − 358
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
diff
changeset
+ − 359
global $plugins;
1
+ − 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
diff
changeset
+ − 361
// 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
diff
changeset
+ − 362
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
diff
changeset
+ − 363
{
527
21e11f564463
(Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
diff
changeset
+ − 364
if ( file_exists(ENANO_ROOT . '/plugins/' . $f) )
21e11f564463
(Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
diff
changeset
+ − 365
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
diff
changeset
+ − 366
}
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
diff
changeset
+ − 367
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
diff
changeset
+ − 368
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
diff
changeset
+ − 369
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
diff
changeset
+ − 370
// Three fifths of the Enano API gets the breath of life right here.
1
+ − 371
$session = new sessionManager();
+ − 372
$paths = new pathManager();
+ − 373
$template = new template();
+ − 374
$email = new EmailEncryptor();
+ − 375
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
diff
changeset
+ − 376
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
diff
changeset
+ − 377
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
diff
changeset
+ − 378
// We've got the five main objects - flick on the switch so if a problem occurs, we can have a "friendly" UI
1
+ − 379
define('ENANO_BASE_CLASSES_INITIALIZED', '');
+ − 380
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
diff
changeset
+ − 381
// 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
diff
changeset
+ − 382
// 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
diff
changeset
+ − 383
// 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
diff
changeset
+ − 384
// 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
diff
changeset
+ − 385
if ( !defined('IN_ENANO_INSTALL') )
1
+ − 386
{
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
diff
changeset
+ − 387
// And here you have it, the de facto way to place a hook. Plugins can place hooks and hook
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
diff
changeset
+ − 388
// into other plugins. You just never know.
32
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 389
$code = $plugins->setHook('base_classes_initted');
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 390
foreach ( $code as $cmd )
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 391
{
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 392
eval($cmd);
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 393
}
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
diff
changeset
+ − 394
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
diff
changeset
+ − 395
profiler_log('Finished base_classes_initted hook');
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
diff
changeset
+ − 396
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
diff
changeset
+ − 397
// For special and administration pages, sometimes there is a "preloader" function that must be run
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
diff
changeset
+ − 398
// before the session manager and/or path manager get the init signal. Call it here.
32
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 399
$p = RenderMan::strToPageId($paths->get_pageid_from_url());
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 400
if( ( $p[1] == 'Admin' || $p[1] == 'Special' ) && function_exists('page_'.$p[1].'_'.$p[0].'_preloader'))
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 401
{
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 402
@call_user_func('page_'.$p[1].'_'.$p[0].'_preloader');
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 403
}
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 404
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
diff
changeset
+ − 405
profiler_log('Checked for preloader');
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
diff
changeset
+ − 406
270
5bcdee999015
Major fixes to the ban system - large IP match lists don't slow down the server miserably anymore.
Dan
diff
changeset
+ − 407
// One quick security check...
5bcdee999015
Major fixes to the ban system - large IP match lists don't slow down the server miserably anymore.
Dan
diff
changeset
+ − 408
if ( !is_valid_ip($_SERVER['REMOTE_ADDR']) )
5bcdee999015
Major fixes to the ban system - large IP match lists don't slow down the server miserably anymore.
Dan
diff
changeset
+ − 409
{
711
+ − 410
die('SECURITY: spoofed IP address: ' . htmlspecialchars($_SERVER['REMOTE_ADDR']));
270
5bcdee999015
Major fixes to the ban system - large IP match lists don't slow down the server miserably anymore.
Dan
diff
changeset
+ − 411
}
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
diff
changeset
+ − 412
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
diff
changeset
+ − 413
// All checks passed! Start the main components up.
32
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 414
$session->start();
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
diff
changeset
+ − 415
593
4f9bec0d65c1
More optimization work. Moved special page init functions to common instead of common_post hook. Allowed paths to cache page metadata on filesystem. Phased out the redundancy in $paths->pages that paired a number with every urlname as foreach loops are allowed now (and have been for some time). Fixed missing includes for several functions. Rewrote str_replace_once to be a lot more efficient.
Dan
diff
changeset
+ − 416
// Grab language strings from the database
678
c5d4ce19e640
Some tweaks to common, real minor stuff that's been waiting to be committed for a couple weeks at least
Dan
diff
changeset
+ − 417
if ( is_object(@$lang) )
c5d4ce19e640
Some tweaks to common, real minor stuff that's been waiting to be committed for a couple weeks at least
Dan
diff
changeset
+ − 418
{
c5d4ce19e640
Some tweaks to common, real minor stuff that's been waiting to be committed for a couple weeks at least
Dan
diff
changeset
+ − 419
$lang->fetch();
c5d4ce19e640
Some tweaks to common, real minor stuff that's been waiting to be committed for a couple weeks at least
Dan
diff
changeset
+ − 420
profiler_log('Fetched language strings');
c5d4ce19e640
Some tweaks to common, real minor stuff that's been waiting to be committed for a couple weeks at least
Dan
diff
changeset
+ − 421
}
593
4f9bec0d65c1
More optimization work. Moved special page init functions to common instead of common_post hook. Allowed paths to cache page metadata on filesystem. Phased out the redundancy in $paths->pages that paired a number with every urlname as foreach loops are allowed now (and have been for some time). Fixed missing includes for several functions. Rewrote str_replace_once to be a lot more efficient.
Dan
diff
changeset
+ − 422
4f9bec0d65c1
More optimization work. Moved special page init functions to common instead of common_post hook. Allowed paths to cache page metadata on filesystem. Phased out the redundancy in $paths->pages that paired a number with every urlname as foreach loops are allowed now (and have been for some time). Fixed missing includes for several functions. Rewrote str_replace_once to be a lot more efficient.
Dan
diff
changeset
+ − 423
// Add all of our built in special pages
678
c5d4ce19e640
Some tweaks to common, real minor stuff that's been waiting to be committed for a couple weeks at least
Dan
diff
changeset
+ − 424
foreach ( array('SpecialUserFuncs', 'SpecialPageFuncs', 'SpecialAdmin', 'SpecialCSS', 'SpecialUpDownload', 'SpecialSearch', 'PrivateMessages', 'SpecialGroups', 'SpecialRecentChanges') as $plugin )
c5d4ce19e640
Some tweaks to common, real minor stuff that's been waiting to be committed for a couple weeks at least
Dan
diff
changeset
+ − 425
{
c5d4ce19e640
Some tweaks to common, real minor stuff that's been waiting to be committed for a couple weeks at least
Dan
diff
changeset
+ − 426
$funcname = "{$plugin}_paths_init";
c5d4ce19e640
Some tweaks to common, real minor stuff that's been waiting to be committed for a couple weeks at least
Dan
diff
changeset
+ − 427
if ( function_exists($funcname) )
c5d4ce19e640
Some tweaks to common, real minor stuff that's been waiting to be committed for a couple weeks at least
Dan
diff
changeset
+ − 428
{
c5d4ce19e640
Some tweaks to common, real minor stuff that's been waiting to be committed for a couple weeks at least
Dan
diff
changeset
+ − 429
$funcname();
c5d4ce19e640
Some tweaks to common, real minor stuff that's been waiting to be committed for a couple weeks at least
Dan
diff
changeset
+ − 430
}
c5d4ce19e640
Some tweaks to common, real minor stuff that's been waiting to be committed for a couple weeks at least
Dan
diff
changeset
+ − 431
}
593
4f9bec0d65c1
More optimization work. Moved special page init functions to common instead of common_post hook. Allowed paths to cache page metadata on filesystem. Phased out the redundancy in $paths->pages that paired a number with every urlname as foreach loops are allowed now (and have been for some time). Fixed missing includes for several functions. Rewrote str_replace_once to be a lot more efficient.
Dan
diff
changeset
+ − 432
profiler_log('Added special pages');
4f9bec0d65c1
More optimization work. Moved special page init functions to common instead of common_post hook. Allowed paths to cache page metadata on filesystem. Phased out the redundancy in $paths->pages that paired a number with every urlname as foreach loops are allowed now (and have been for some time). Fixed missing includes for several functions. Rewrote str_replace_once to be a lot more efficient.
Dan
diff
changeset
+ − 433
348
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
diff
changeset
+ − 434
// This is where plugins will want to add pages from 1.1.x on out. You can still add
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
diff
changeset
+ − 435
// pages at base_classes_initted but the titles won't be localized. This is because
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
diff
changeset
+ − 436
// the session manager has to be started before localization will work in the user's
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
diff
changeset
+ − 437
// preferred language.
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
diff
changeset
+ − 438
$code = $plugins->setHook('session_started');
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
diff
changeset
+ − 439
foreach ( $code as $cmd )
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
diff
changeset
+ − 440
{
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
diff
changeset
+ − 441
eval($cmd);
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
diff
changeset
+ − 442
}
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
diff
changeset
+ − 443
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
diff
changeset
+ − 444
profiler_log('Ran session_started hook');
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
diff
changeset
+ − 445
32
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 446
$paths->init();
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 447
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
diff
changeset
+ − 448
// setup output format
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
diff
changeset
+ − 449
if ( defined('ENANO_OUTPUT_FORMAT') )
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
diff
changeset
+ − 450
$class = 'Output_' . ENANO_OUTPUT_FORMAT;
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
diff
changeset
+ − 451
else
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
diff
changeset
+ − 452
$class = ( isset($_GET['noheaders']) ) ? 'Output_Naked' : 'Output_HTML';
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
diff
changeset
+ − 453
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
diff
changeset
+ − 454
$output = new $class();
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
diff
changeset
+ − 455
678
c5d4ce19e640
Some tweaks to common, real minor stuff that's been waiting to be committed for a couple weeks at least
Dan
diff
changeset
+ − 456
// We're ready for whatever life throws us now, at least from an API point of view.
32
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 457
define('ENANO_MAINSTREAM', '');
1
+ − 458
32
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 459
// If the site is disabled, bail out, unless we're trying to log in or administer the site
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 460
if(getConfig('site_disabled') == '1' && $session->user_level < USER_LEVEL_ADMIN)
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 461
{
678
c5d4ce19e640
Some tweaks to common, real minor stuff that's been waiting to be committed for a couple weeks at least
Dan
diff
changeset
+ − 462
// is this one of the more critical special pages?
322
+ − 463
if ( $paths->namespace == 'Admin' || ( $paths->namespace == 'Special' && ( $paths->page_id == 'CSS' || $paths->page_id == 'Administration' || $paths->page_id == 'Login' ) ) )
32
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 464
{
678
c5d4ce19e640
Some tweaks to common, real minor stuff that's been waiting to be committed for a couple weeks at least
Dan
diff
changeset
+ − 465
// yeah, we need to keep this page available. do nothing; allow execution to continue
32
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 466
}
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 467
else
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 468
{
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 469
if(!$n = getConfig('site_disabled_notice'))
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 470
{
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 471
$n = 'The administrator has disabled the site. Please check back later.';
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 472
}
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 473
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 474
$text = RenderMan::render($n) . '
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 475
<div class="info-box">
144
380e55865f86
Improved response time for username autofill; fix JS login box in Safari (bug surfaced only after 1.0.1)
Dan
diff
changeset
+ − 476
If you have an administrative account, you may <a href="'.makeUrlNS('Special', 'Login').'">log in</a> to the site.
32
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 477
</div>';
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 478
$paths->wiki_mode = 0;
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 479
die_semicritical('Site disabled', $text);
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 480
}
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 481
}
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
diff
changeset
+ − 482
else if ( getConfig('site_disabled') == '1' && $session->user_level >= USER_LEVEL_ADMIN )
32
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 483
{
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
diff
changeset
+ − 484
// If the site is disabled but the user has admin rights, allow browsing
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
diff
changeset
+ − 485
// and stuff, but display the orange box notifying the admin.
32
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 486
$template->site_disabled = true;
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 487
}
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 488
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
diff
changeset
+ − 489
// At this point all of Enano is fully initialized and running and you're ready to do whatever you want.
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
diff
changeset
+ − 490
$code = $plugins->setHook('common_post');
32
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 491
foreach ( $code as $cmd )
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 492
{
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 493
eval($cmd);
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 494
}
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
diff
changeset
+ − 495
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
diff
changeset
+ − 496
profiler_log('Ran disabled-site checks and common_post');
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
diff
changeset
+ − 497
541
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
diff
changeset
+ − 498
load_rank_data();
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
diff
changeset
+ − 499
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
diff
changeset
+ − 500
profiler_log('Loaded user rank data');
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
diff
changeset
+ − 501
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
diff
changeset
+ − 502
if ( isset($_GET['noheaders']) )
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
diff
changeset
+ − 503
$template->no_headers = true;
1
+ − 504
}
+ − 505
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
diff
changeset
+ − 506
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
diff
changeset
+ − 507
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
diff
changeset
+ − 508
// 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
diff
changeset
+ − 509
1
+ − 510
?>