score-style index
This commit is contained in:
parent
7f90fdbf97
commit
0c628f2c10
2 changed files with 69 additions and 46 deletions
|
@ -70,9 +70,9 @@ class GenericPage {
|
|||
|
||||
// ==============================================
|
||||
|
||||
public function display() {
|
||||
public function display($context) {
|
||||
header("Content-type: {$this->type}");
|
||||
header("X-Powered-By: Shimmie-".VERSION);
|
||||
header("X-Powered-By: SCore-".SCORE_VERSION);
|
||||
|
||||
switch($this->mode) {
|
||||
case "page":
|
||||
|
|
29
index.php
29
index.php
|
@ -1,14 +1,20 @@
|
|||
<?php
|
||||
// set up and purify the environment
|
||||
define("DEBUG", true);
|
||||
define("SCORE_VERSION", 's2hack');
|
||||
define("VERSION", 'trunk');
|
||||
|
||||
require_once "core/util.inc.php";
|
||||
if(!file_exists("config.php")) {
|
||||
header("Location: install.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once "core/util.inc.php";
|
||||
version_check();
|
||||
sanitise_environment();
|
||||
|
||||
|
||||
try {
|
||||
// load base files
|
||||
$files = array_merge(glob("core/*.php"), glob("ext/*/main.php"));
|
||||
foreach($files as $filename) {
|
||||
|
@ -16,7 +22,7 @@ foreach($files as $filename) {
|
|||
}
|
||||
|
||||
|
||||
// connect to database
|
||||
// connect to the database
|
||||
$database = new Database();
|
||||
$database->db->fnExecute = '_count_execs';
|
||||
$config = new DatabaseConfig($database);
|
||||
|
@ -56,9 +62,26 @@ $context->database = $database;
|
|||
$context->config = $config;
|
||||
send_event(new InitExtEvent($context));
|
||||
send_event(_get_page_request($context));
|
||||
$page->display();
|
||||
$context->page->display($context);
|
||||
|
||||
|
||||
// for databases which support transactions
|
||||
$database->db->CommitTrans(true);
|
||||
}
|
||||
catch(Exception $e) {
|
||||
$version = VERSION;
|
||||
$message = $e->getMessage();
|
||||
header("HTTP/1.0 500 Internal Error");
|
||||
print <<<EOD
|
||||
<html>
|
||||
<head>
|
||||
<title>Internal error - SCore-$version</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Internal Error</h1>
|
||||
<p>$message
|
||||
</body>
|
||||
</html>
|
||||
EOD;
|
||||
}
|
||||
?>
|
||||
|
|
Reference in a new issue