-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.php
More file actions
69 lines (55 loc) · 1.93 KB
/
init.php
File metadata and controls
69 lines (55 loc) · 1.93 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
<?php
/////////////////
// Definitions //
/////////////////
define("__ROOT__", __DIR__);
define("__PILOT__", __ROOT__ . "/pilot");
define("__COMPOSER__", __ROOT__ . "/vendor");
define("__LOCALES__", __ROOT__ . "/locales");
define("__VIEWS__", __ROOT__ . "/views");
//////////////////
// Requirements //
//////////////////
require_once __COMPOSER__ . "/autoload.php";
require_once __PILOT__ . "/loader.php";
///////////////
// Variables //
///////////////
// Redirects
$redirects = New \Pilot\Redirects;
include_once __ROOT__ . "/redirects.php";
$redirects->go();
// Configs
$databaseConfigs = array(
"database" => array(
"host" => "localhost",
"port" => "3306",
"name" => "dbname",
"prefix" => "pilot_",
"user" => "root",
"password" => "root"
)
);
$configs = New \Pilot\Configs(); // Use $databaseConfigs for an override of your /configs.json.database sending the array to the Class
$lang = __LOCALES__ . "/" . $configs->get()["options"]["locale"];
// Database
$database = New \STDCLASS();
if (!$configs->get()["installation"]["required"]) {
$database = New \Pilot\Database($configs->get()["database"]); // Don't use $databaseConfigs if not using in $configs too
try { $database->connect(); } catch(\MeekroDBException $error) {
$response = New \Pilot\API\Response;
$response->setCode(500);
$response->setError("Unable to connect to MySQL server!");
$response->echo();
}
}
// Router
$router = New \Pilot\Router(__VIEWS__);
// Params
$params = New \Pilot\Params;
/////////////////////////
// SANITIZE POST/PATCH //
/////////////////////////
$_PATCH = null; $_POST = null;
(New \Pilot\API\Requests\Sanitizer)->sanitize($_SERVER["REQUEST_METHOD"]);
?>