-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
27 lines (20 loc) · 975 Bytes
/
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
<?php
if (version_compare(phpversion(), '7.2', '<')) {
die("ERROR! The php version isn't high enough, you need at least 7.2 to run this application! But you have: " . phpversion());
}
# set the new path of config.php (must be in a safe location outside the `public_html`)
require_once '../../config.php';
# load php dependencies:
require_once './backend-libs/autoload.php';
require_once './user.php';
require_once './imap_client.php';
require_once './controller.php';
require_once './router.php';
$imapClient = new ImapClient($config['imap']['url'], $config['imap']['username'], $config['imap']['password']);
$router = new Router($_SERVER['REQUEST_METHOD'], $_GET['action'] ?? NULL, $_GET, $_POST, $_SERVER['QUERY_STRING'], $config);
$controller = $router->route();
$controller->setViewHandler(new ServerRenderViewHandler());
$controller->invoke($imapClient);
// delete after each request
$imapClient->delete_old_messages($config['delete_messages_older_than']);
?>