-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathroutes.php
More file actions
executable file
·99 lines (80 loc) · 2.98 KB
/
routes.php
File metadata and controls
executable file
·99 lines (80 loc) · 2.98 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?php
// ==============================================================
// Copyright (C) 2014 Mark Vejvoda
// Under GNU GPL v3.0
// ==============================================================
namespace riprunner;
ini_set('display_errors', 'On');
error_reporting(E_ALL);
//
// This file manages routing of requests
//
if(defined('INCLUSION_PERMITTED') === false) {
define( 'INCLUSION_PERMITTED', true);
}
require_once 'config_constants.php';
require_once 'functions.php';
try {
if (!file_exists('config.php' )) {
throw new \Exception('Config script does not exist!');
}
else {
require_once 'config.php';
}
}
catch(\Exception $e) {
echo '<!DOCTYPE html>'.PHP_EOL.
'<html>'.PHP_EOL.
'<head>'.PHP_EOL.
'<meta charset="UTF-8">'.PHP_EOL.
'<title>Error Detected</title>'.PHP_EOL.
'<link rel="stylesheet" href="styles/main.css" />'.PHP_EOL.
'</head>'.PHP_EOL.
'<body>'.PHP_EOL.
'<p style="font-size:40px; color: white">'.
'<hr></p>'.PHP_EOL.
'<p style="font-size:35px; color: red">'.PHP_EOL.
'Error detected, message : ' . $e->getMessage().', '.'Code : ' . $e->getCode().PHP_EOL.
'trace : ' . $e-> getTraceAsString().PHP_EOL.
'<br><span style="font-size:35px; color: black">Please create a config.php script in the root installation path</span>'.PHP_EOL.
'</p><hr>'.PHP_EOL.
'</body>'.PHP_EOL.
'</html>';
return;
}
require_once __RIPRUNNER_ROOT__ . '/functions.php';
require __DIR__ . '/vendor/autoload.php';
// The main index URL
\Flight::route('GET|POST /', function () {
global $SITECONFIGS;
global $log;
$root_url = getRootURLFromRequest(\Flight::request()->url, $SITECONFIGS);
$log->trace("Route got / request url [".\Flight::request()->url . "] root url [".$root_url."]");
\Flight::redirect($root_url .'/controllers/membership-controller.php');
});
// The membership URL
\Flight::route('GET|POST /membership-route', function () {
global $SITECONFIGS;
global $log;
$root_url = getRootURLFromRequest(\Flight::request()->url, $SITECONFIGS);
$log->trace("Route got /membership-route request url [".\Flight::request()->url . "] root url [".$root_url."]");
\Flight::redirect($root_url .'/controllers/membership-controller.php?route_action=membership');
});
// The membership waiver URL
\Flight::route('GET|POST /waiver-route', function () {
global $SITECONFIGS;
global $log;
$root_url = getRootURLFromRequest(\Flight::request()->url, $SITECONFIGS);
$log->trace("Route got /waiver-route request url [".\Flight::request()->url . "] root url [".$root_url."]");
\Flight::redirect($root_url .'/controllers/membership-controller.php?route_action=waiver');
});
\Flight::route('GET|POST /test/(@params)', function ($params) {
global $log;
$log->trace("Route got TEST message: ".$params);
});
\Flight::map('notFound', function () {
// Handle not found
echo "route NOT FOUND!" . PHP_EOL;
});
\Flight::set('flight.log_errors', true);
\Flight::start();