-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
112 lines (90 loc) · 2.96 KB
/
Copy pathindex.php
File metadata and controls
112 lines (90 loc) · 2.96 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
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
/**
* Manomite framework - Entry Point
* Industrial and enterprise designed framework for PHP 8.4+
*
* @version 4.0.0
* @author Manomite Limited
*
* @copyright 2025 Manomite Limited
*/
use Manomite\Exception\ManomiteException as ex;
use Manomite\{
Controller\Auth,
Controller\Views
};
use Predis\Client;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Server\RequestHandlerInterface as RequestHandler;
use Slim\Factory\AppFactory;use Slim\Psr7\Factory\ResponseFactory;
use Slim\Routing\RouteCollectorProxy;
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
include __DIR__ . '/autoload.php';
error_reporting(E_ALL);
ini_set('display_errors', false);
ini_set('log_errors', true);
ini_set('error_log', SYSTEM_DIR . '/log/entry.log');
ini_set('log_errors_max_len', 1024);
$_SERVER['REQUEST_URI'] = substr($_SERVER['REQUEST_URI'], (strlen('/zorah')));
$app = AppFactory::create();
$responseFactory = new ResponseFactory();
$view = new Views();
// Rate Limiting Middleware
$redisClient = new Client([
'scheme' => 'tcp',
'host' => 'localhost',
'port' => 6379,
]);
function pretty_print($array)
{
echo "<pre>";
print_r($array);
echo "</pre>";
}
try {
$app->get('/sitemap', function (Request $request, Response $response) use($view) {
$html = $view->sitemap();
$response->getBody()->write($html);
return $response->withHeader('Content-Type', 'application/xml');
});
$app->get('/', function (Request $request, Response $response) use($view) {
$html = $view->index();
$response->getBody()->write($html);
return $response;
});
$app->get('/index', function (Request $request, Response $response) use($view) {
$html = $view->index();
$response->getBody()->write($html);
return $response;
});
$app->get('/register', function (Request $request, Response $response) use($view) {
$html = $view->register();
$response->getBody()->write($html);
return $response;
});
$app->get('/email/verify/{id}', function (Request $request, Response $response, $args) use($view) {
$html = $view->verifyEmail($args);
$response->getBody()->write($html);
return $response;
});
//Auntenticated area
$app->group('/home', function (RouteCollectorProxy $group) use ($app, $view) {
//Protected resource
$group->get('', function (Request $request, Response $response) use($view) {
$html = $view->home();
$response->getBody()->write($html);
return $response;
});
$group->get('/', function (Request $request, Response $response) use($view) {
$html = $view->home();
$response->getBody()->write($html);
return $response;
});
});
$app->run();
} catch (\Throwable $e) {
echo $e->getMessage();
}