2007-04-16 11:58:25 +00:00
|
|
|
<?php
|
2007-10-27 19:38:13 +00:00
|
|
|
// set up and purify the environment
|
2008-02-06 17:24:08 +00:00
|
|
|
define("DEBUG", true);
|
2007-10-28 18:02:22 +00:00
|
|
|
define("VERSION", 'trunk');
|
2007-07-06 17:02:52 +00:00
|
|
|
|
2008-06-08 15:04:57 +00:00
|
|
|
require_once "core/util.inc.php";
|
2007-04-16 11:58:25 +00:00
|
|
|
|
2008-06-08 15:04:57 +00:00
|
|
|
version_check();
|
|
|
|
sanitise_environment();
|
2007-04-16 11:58:25 +00:00
|
|
|
|
2007-10-27 19:38:13 +00:00
|
|
|
|
2007-04-16 11:58:25 +00:00
|
|
|
|
2007-10-27 19:38:13 +00:00
|
|
|
// load base files
|
2007-12-06 11:16:59 +00:00
|
|
|
$files = array_merge(glob("core/*.php"), glob("ext/*/main.php"));
|
2007-04-16 11:58:25 +00:00
|
|
|
foreach($files as $filename) {
|
|
|
|
require_once $filename;
|
|
|
|
}
|
|
|
|
|
2007-10-27 19:38:13 +00:00
|
|
|
|
|
|
|
// connect to database
|
2007-04-16 11:58:25 +00:00
|
|
|
$database = new Database();
|
2007-07-12 07:26:50 +00:00
|
|
|
$database->db->fnExecute = '_count_execs';
|
2007-07-28 13:53:31 +00:00
|
|
|
$config = new Config($database);
|
2007-10-27 19:38:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
// load the theme parts
|
2007-06-30 01:19:11 +00:00
|
|
|
$_theme = $config->get_string("theme", "default");
|
2007-10-22 00:33:00 +00:00
|
|
|
if(!file_exists("themes/$_theme")) $_theme = "default";
|
2007-06-30 01:19:11 +00:00
|
|
|
require_once "themes/$_theme/page.class.php";
|
|
|
|
require_once "themes/$_theme/layout.class.php";
|
|
|
|
require_once "themes/$_theme/themelet.class.php";
|
2007-12-19 10:56:08 +00:00
|
|
|
|
|
|
|
$themelets = glob("ext/*/theme.php");
|
2007-08-23 11:14:03 +00:00
|
|
|
foreach($themelets as $filename) {
|
|
|
|
require_once $filename;
|
|
|
|
}
|
2007-10-27 19:38:13 +00:00
|
|
|
|
2008-02-17 09:25:49 +00:00
|
|
|
$custom_themelets = glob("themes/$_theme/*.theme.php");
|
|
|
|
if($custom_themelets) {
|
2008-04-08 15:35:08 +00:00
|
|
|
$m = array();
|
2008-02-17 09:25:49 +00:00
|
|
|
foreach($custom_themelets as $filename) {
|
2008-04-08 15:35:08 +00:00
|
|
|
if(preg_match("/themes\/$_theme\/(.*)\.theme\.php/",$filename,$m)
|
|
|
|
&& array_contains($themelets, "ext/{$m[1]}/theme.php"))
|
|
|
|
{
|
2008-02-17 09:25:49 +00:00
|
|
|
require_once $filename;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-10-27 19:38:13 +00:00
|
|
|
|
|
|
|
// start the page generation waterfall
|
2007-04-16 11:58:25 +00:00
|
|
|
$page = new Page();
|
2007-07-12 07:33:53 +00:00
|
|
|
$user = _get_user();
|
2008-04-04 12:07:38 +00:00
|
|
|
$context = new RequestContext();
|
|
|
|
$context->page = $page;
|
|
|
|
$context->user = $user;
|
|
|
|
$context->database = $database;
|
|
|
|
$context->config = $config;
|
|
|
|
send_event(new InitExtEvent($context));
|
|
|
|
send_event(_get_page_request($context));
|
2007-04-16 11:58:25 +00:00
|
|
|
$page->display();
|
2008-01-02 21:49:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
// for databases which support transactions
|
|
|
|
$database->db->CommitTrans(true);
|
2007-04-16 11:58:25 +00:00
|
|
|
?>
|