index.php
2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
//===============================================
// Debug
//===============================================
ini_set('display_errors','On');
error_reporting(E_ALL);
//ini_set('display_errors','Off');
//error_reporting(E_NONE);
//===============================================
// Madatory KISSMVC Settings (please configure)
//===============================================
define('APP_PATH','app/'); //with trailing slash pls
define('WEB_FOLDER',''); //with trailing slash pls
//===============================================
// Other Settings
//===============================================
$GLOBALS['sitename']='RealOps Sydney 2014 - VATSIM Australia Pacific';
//===============================================
// Includes
//===============================================
require('kissmvc.php');
require(APP_PATH . 'route.php');
//===============================================
// Session
//===============================================
session_start();
//===============================================
// Uncaught Exception Handling
//===============================================s
/*
set_exception_handler('uncaught_exception_handler');
function uncaught_exception_handler($e) {
ob_end_clean(); //dump out remaining buffered text
$vars['message']=$e;
die(View::do_fetch(APP_PATH.'errors/exception_uncaught.php',$vars));
}
function custom_error($msg='') {
$vars['msg']=$msg;
die(View::do_fetch(APP_PATH.'errors/custom_error.php',$vars));
}
*/
//===============================================
// Database
//===============================================
function getdbh() {
if (!isset($GLOBALS['dbh']))
try {
$GLOBALS['dbh'] = new PDO('mysql:host=localhost;dbname=realops', 'root', '');
} catch (PDOException $e) {
die('Connection failed: '.$e->getMessage());
}
return $GLOBALS['dbh'];
}
//===============================================
// Autoloading for Business Classes
//===============================================
// Assumes Model Classes start with capital letters and Helpers start with lower case letters
function __autoload($classname) {
$a=$classname[0];
if ($a >= 'A' && $a <='Z')
require_once(APP_PATH.'models/'.$classname.'.php');
else
require_once(APP_PATH.'helpers/'.$classname.'.php');
}
//===============================================
// Start the controller
//===============================================
$controller = new Controller(APP_PATH.'controllers/',WEB_FOLDER);