/
index.php
executable file
·118 lines (102 loc) · 4.25 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php
if(file_exists('vendor/autoload.php')){
require 'vendor/autoload.php';
} else {
echo "<h1>Please install via composer.json</h1>";
echo "<p>Install Composer instructions: <a href='https://getcomposer.org/doc/00-intro.md#globally'>https://getcomposer.org/doc/00-intro.md#globally</a></p>";
echo "<p>Once composer is installed navigate to the working directory in your terminal/command promt and enter 'composer install'</p>";
exit;
}
if (!is_readable('app/core/config.php')) {
die('No config.php found, configure and rename config.example.php to config.php in app/core.');
}
/*
*---------------------------------------------------------------
* APPLICATION ENVIRONMENT
*---------------------------------------------------------------
*
* You can load different configurations depending on your
* current environment. Setting the environment also influences
* things like logging and error reporting.
*
* This can be set to anything, but default usage is:
*
* development
* production
*
* NOTE: If you change these, also change the error_reporting() code below
*
*/
define('ENVIRONMENT', 'development');
/*
*---------------------------------------------------------------
* ERROR REPORTING
*---------------------------------------------------------------
*
* Different environments will require different levels of error reporting.
* By default development will show errors but production will hide them.
*/
if (defined('ENVIRONMENT')){
switch (ENVIRONMENT){
case 'development':
error_reporting(E_ALL);
break;
case 'production':
error_reporting(0);
break;
default:
exit('The application environment is not set correctly.');
}
}
//initiate config
new \core\config();
//create alias for Router
use \core\router,
\helpers\url;
//define routes
//define routes
Router::any('', '\controllers\login@index');
Router::any('login', '\controllers\login@login');
Router::any('welcome', '\controllers\welcome@index');
Router::any('logout', '\controllers\auth@logout');
Router::any('registerSiteLeader', '\controllers\registerSiteLeader@create');
Router::any('trip', '\controllers\trip@create');
Router::any('draft', '\controllers\draft@create');
Router::any('wishlist', '\controllers\wishlist@create');
Router::any('validateAppId', '\controllers\wishlist@validateAppId');
Router::any('exec', '\controllers\exec@create');
Router::any('board', '\controllers\board@create');
Router::any('siteLeader', '\controllers\siteLeader@create');
Router::any('registerTrip', '\controllers\registerTrip@create');
Router::any('tripBoard', '\controllers\tripBoard@create');
Router::any('applications', '\controllers\applications@create');
Router::any('locations', '\controllers\locations@create');
Router::any('apply', '\controllers\apply@index');
Router::any('apply_submit', '\controllers\apply@submit');
Router::any('changepassword', '\controllers\changepassword@index');
Router::any('changepassword_submit', '\controllers\changepassword@submit');
Router::any('registerBoardMember', '\controllers\registerAdmin@index');
Router::any('registerBoardMember_submit', '\controllers\registerAdmin@submit');
Router::any('draftBoard', '\controllers\draftBoard@index');
Router::any('draftBoard_wishlist', '\controllers\draftBoard@wishlist');
Router::any('draftBoard_search', '\controllers\draftBoard@search');
Router::any('draftBoard_main', '\controllers\draftBoard@draftBoard');
Router::any('trip_analytics', '\controllers\trip_analytics@create');
Router::any('application_analytics', '\controllers\application_analytics@create');
//ajax routes
Router::any('ajax/applicantSearch', '\controllers\ajax@applicantSearch');
Router::any('ajax/applicantAnswers', '\controllers\ajax@applicantAnswers');
Router::any('ajax/checkTurn', '\controllers\ajax@checkTurn');
Router::any('ajax/draft', '\controllers\ajax@draft');
Router::any('ajax/updateTurn', '\controllers\ajax@updateTurn');
Router::any('ajax/getDrafted', '\controllers\ajax@getDrafted');
Router::any('ajax/startDraft', '\controllers\ajax@beginDraft');
Router::any('ajax/finalizeDraft', '\controllers\ajax@finalizeDraft');
Router::any('ajax/getDraftOrder', '\controllers\ajax@getDraftOrder');
//if no route found
Router::error('\core\error@index');
//turn on old style routing
Router::$fallback = false;
//execute matched routes
Router::dispatch();
// debugger