Skip to content
Snippets Groups Projects
Forked from IF3110 / TugasBesar2_2017
18 commits ahead of the upstream repository.
index.php 868 B
<?php
    session_start();
    define("MOTAFW", true);
    define("APPDIR", __DIR__ . '/app/');
    define("PUBLICDIR", '/public/');
    define("CSS", PUBLICDIR . 'css/');
    define("JS", PUBLICDIR . 'js/');
    define("IMG", PUBLICDIR . 'img/');

    require_once __DIR__ . '/vendor/autoload.php';

    use \MotaRaido\Core\Config;
    use \MotaRaido\Core\Database\Connector;
    use \MotaRaido\Core\Database\Query;

    $query = new Query(new Connector(Config::get('database')));
    
    // include all routes
    $dir = new RecursiveDirectoryIterator(APPDIR);
    $iter = new RecursiveIteratorIterator($dir);
    $files = new RegexIterator($iter, '/^.+\.routes\.php$/', RecursiveRegexIterator::GET_MATCH); // an Iterator, not an array

    foreach ( $files as $file ) {
        foreach($file as $route_file) {
            require_once $route_file;
        }
    }