-
Notifications
You must be signed in to change notification settings - Fork 7
/
index.php
62 lines (49 loc) · 1.7 KB
/
index.php
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
<?php
// PiVMUGc - Version 2.2
// Load 3rd party dependencies
require('vendor/autoload.php');
// Kickstart the framework
$f3= Base::instance();
$f3->set('baseurl',$f3->get('BASE'));
$f3->set('DEBUG',1);
if ((float)PCRE_VERSION<7.9) {
trigger_error('PCRE version is out of date');
}
// load configuration
$f3->config('config.ini');
$f3->set('AUTOLOAD','app/');
$f3->set('db', new DB\SQL('sqlite:'.$f3->DB_PATH));
// base index landing page
$f3->route('GET /','Index->DefaultDisplay');
// checkin
$f3->route('GET /checkin','Checkin->DefaultDisplay');
$f3->route('POST /checkin','Checkin->ProcessPOST');
// register
$f3->route('GET /register','Register->DefaultDisplay');
$f3->route('POST /register','Register->ProcessPOST');
// reprint
$f3->route('GET /reprint','Reprint->DefaultDisplay');
$f3->route('POST /reprint','Reprint->ProcessPOST');
// report
// admin
$f3->route('GET /admin','Admin->DefaultDisplay');
$f3->route('GET /admin/report','Report->DefaultDisplay');
$f3->route('POST /admin/database/import','Admin->ImportDatabase');
$f3->route('POST /admin/database/export','Admin->ExportDatabase');
$f3->route('POST /admin/random/name','Admin->RandomName');
$f3->route('POST /admin/database/truncate','Admin->TruncateDatabase');
$f3->route('POST /admin/shutdown','Admin->Shutdown');
$f3->route('POST /admin/print/test','Admin->PrintTestLabel');
// set error pages
$f3->set('ONERROR',function($f3){
if ($f3->get('ERROR.code') == '404') {
echo \Template::instance()->render('layout-error-404.htm');
} else {
echo \Template::instance()->render('layout-error.htm');
}
// clear just in case for any stale messages
$f3->clear('SESSION.message_type');
$f3->clear('SESSION.message');
});
// run this shit!
$f3->run();