54 lines
1.3 KiB
PHP
54 lines
1.3 KiB
PHP
<?php
|
|
|
|
// --- Load Config ---
|
|
if (file_exists(\BASEPATH . '/App/config.php')) {
|
|
require_once \BASEPATH . '/App/config.php';
|
|
} else {
|
|
require_once \FRAMEWORKPATH . '/skeleton/novaconium/App/config.php';
|
|
}
|
|
|
|
require_once \FRAMEWORKPATH . '/src/functions.php';
|
|
require_once \FRAMEWORKPATH . '/src/twig.php';
|
|
|
|
// --- Logging ---
|
|
use Novaconium\Logger;
|
|
$log = new Logger(\BASEPATH . $config['logfile'], $config['loglevel']);
|
|
|
|
// --- Twig Data Array ---
|
|
$data = [];
|
|
$data['fonts'] = $config['fonts'] ?? [];
|
|
|
|
// --- Session ---
|
|
use Novaconium\Session;
|
|
$session = new Session();
|
|
$data['token'] = $session->get('token');
|
|
$data['username'] = $session->get('username');
|
|
|
|
// --- Messages ---
|
|
use Novaconium\MessageHandler;
|
|
$messages = new MessageHandler($session->flash('messages'));
|
|
foreach (['error', 'notice'] as $key) {
|
|
$data[$key] = $messages->showMessages($key);
|
|
}
|
|
|
|
// --- Database ---
|
|
use Novaconium\Database;
|
|
if (!empty($config['database']['host'])) {
|
|
$db = new Database($config['database']);
|
|
}
|
|
|
|
// --- POST Wrapper ---
|
|
use Novaconium\Post;
|
|
if (!empty($_POST)) {
|
|
$post = new Post($_POST);
|
|
}
|
|
|
|
// --- Redirect Handler ---
|
|
use Novaconium\Redirect;
|
|
$redirect = new Redirect();
|
|
|
|
// --- Router ---
|
|
use Novaconium\Router;
|
|
$router = new Router();
|
|
require_once $router->controllerPath;
|