blob: f8ef30284b622409fff165df0bf6c36ea8e230b8 (
plain) (
blame)
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
|
<?php
declare(strict_types=1);
namespace AugustOffensive;
// Borrowed and modified from PSR-4 Closure Example
spl_autoload_register(
function ($class) {
$prefix = 'AugustOffensive\\';
$relative_class = substr($class, strlen($prefix));
// find file in /private/ in respective namespace path
$file = __DIR__ . '/private/' . str_replace('\\', '/', $relative_class) . '.php';
// if the file exists, require it
if (file_exists($file)) {
require $file;
}
}
);
use AugustOffensive\View;
use AugustOffensive\Controller;
try {
// initiate connection and build front-end
$connection = Controller\Controller::initiateConnection();
$view = new View\Main($connection);
// get results of query from front-end
$result = $view->generateResult();
echo $result;
} catch (\Exception $err) {
// catch all exceptions and let the controller generate the error
$error = Controller\Controller::errorResult($err);
// pass generated error result to output
echo View\Main::generateOutput($error);
}
|