-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
42 lines (33 loc) · 1.09 KB
/
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
/**
* ###INSTALL###
*
* Rename QuickConfig.dist.php to QuickConfig!
*/
require "config/QuickConfig.php";
// Load autoloader
require 'lib'.DIRECTORY_SEPARATOR.'QuickMVC'.DIRECTORY_SEPARATOR.'Autoloader.php';
// Set error mode
if (\QuickMVC\Config::DEVELOPMENT_MODE) {
error_reporting(E_ALL & ~E_NOTICE);
ini_set("display_errors", 1);
} else {
error_reporting(0);
}
// We will propably need a session
session_start();
// Prepare autoloader
\QuickMVC\Autoloader::addPath('lib');
\QuickMVC\Autoloader::addPath('app/models');
// Define constants
define('URL', substr($_SERVER['SCRIPT_NAME'], 0, -10));
define('PATH', __DIR__);
define('APP', PATH . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR);
define('VIEWS', APP . 'views' . DIRECTORY_SEPARATOR);
define('CONTROLLERS', APP . 'controllers' . DIRECTORY_SEPARATOR);
define('MODELS', APP . 'models' . DIRECTORY_SEPARATOR);
\QuickMVC\Migrator::migrate();
// Parse requested controller and ignore params
$controller = \QuickMVC\Controller::load($_REQUEST['_quickmvc']['route']);
// And here goes the output magic ;)
echo $controller->render();