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
|
|
|
|
|
|
|
if(DEBUG) {
|
|
|
|
error_reporting(E_ALL);
|
|
|
|
assert_options(ASSERT_ACTIVE, 1);
|
|
|
|
assert_options(ASSERT_BAIL, 1);
|
|
|
|
}
|
2007-04-16 11:58:25 +00:00
|
|
|
|
|
|
|
if(version_compare(PHP_VERSION, "5.0.0") == -1) {
|
|
|
|
print <<<EOD
|
|
|
|
Currently Shimmie 2 doesn't support versions of PHP lower than 5.0.0. Please
|
|
|
|
either upgrade your PHP, or tell Shish that PHP 4 support is a big deal for
|
|
|
|
you...
|
|
|
|
EOD;
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2007-10-27 19:38:13 +00:00
|
|
|
function stripslashes_r($arr) {
|
|
|
|
return is_array($arr) ? array_map('stripslashes_r', $arr) : stripslashes($arr);
|
|
|
|
}
|
2007-10-28 00:07:33 +00:00
|
|
|
if(get_magic_quotes_gpc()) {
|
|
|
|
$_GET = stripslashes_r($_GET);
|
|
|
|
$_POST = stripslashes_r($_POST);
|
|
|
|
$_COOKIE = stripslashes_r($_COOKIE);
|
|
|
|
}
|
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");
|
|
|
|
$custom_themelets = glob("themes/$_theme/*.theme.php");
|
|
|
|
if($custom_themelets) $themelets = array_merge($themelets, $custom_themelets);
|
2007-08-23 11:14:03 +00:00
|
|
|
foreach($themelets as $filename) {
|
|
|
|
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();
|
2007-04-16 11:58:25 +00:00
|
|
|
send_event(new InitExtEvent());
|
2007-08-24 22:29:34 +00:00
|
|
|
send_event(_get_page_request($page, $user));
|
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
|
|
|
?>
|