summaryrefslogtreecommitdiff
path: root/app/common.php
blob: 1ace3d81bbb63e52a6e2787554ef10c051ae065f (plain)
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
<?php

// Common file between cli and web interface

require __DIR__.'/Core/Loader.php';
require __DIR__.'/helpers.php';
require __DIR__.'/functions.php';

use Core\Loader;
use Core\Registry;

// Include password_compat for PHP < 5.5
if (version_compare(PHP_VERSION, '5.5.0', '<')) {
    require __DIR__.'/../vendor/password.php';
}

// Include custom config file
if (file_exists('config.php')) {
    require 'config.php';
}

require __DIR__.'/constants.php';

$loader = new Loader;
$loader->setPath('app');
$loader->setPath('vendor');
$loader->execute();

$registry = new Registry;
$registry->db = setup_db();
$registry->event = setup_events();
$registry->mailer = function() { return setup_mailer(); };