summaryrefslogtreecommitdiff
path: root/public/index.php
blob: c0b0b68f18c9d7120337e32a6a6b4776c6151241 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
/** anom
 * ANOther MVC framefork ///////////////////////////////////////////////////////
 * -----------------------------------------------------------------------------
 * 
 * This is where the whole thing stats.
 * Let's keep it simple and clear
 * 
 * anom is an(other) Object-Oriented MVC php-framework.
 * It is a super-light, fast and extensible.
 * 
 * Contains implementations of almost anything you need
 * to start and optimize a server-based web-application.
 * And as long as you write code using secure practices,
 * it shall be secure.
 * 
 * Copyleft: George Halkiadakis
 * Licence: BSD
 * 
 * \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
 * -----------------------------------------------------------------------------
 */

// Define the Base Paths
// -----------------------------------------------------------------------------
$dir = explode('/', __DIR__);
$pub = array_pop($dir);

define('APP_ROOT', implode('/',$dir));  // App's root directory
define('WEB_ROOT', APP_ROOT.'/'.$pub);  // the public directory


// Load parametres:
// paths, contants and central arrays
// -----------------------------------------------------------------------------
require_once WEB_ROOT.'/app/config/setup_framework.php';        // application constants



// Enable Autoloader 
// -----------------------------------------------------------------------------
require_once AUTOLOADER;



// Enable sessions
// -----------------------------------------------------------------------------
$session = new (SESSION_DRIVER)();	                // Start a new session



// prepare output control and benchmarking
// -----------------------------------------------------------------------------
ob_start();                                         // handle output
if (!PRODUCTION)   Benchmark::add_spot('start');    // benchmark request's life



// Initialize Application
// finalize framework; handle credentials; setup app-engine; insert routes
// -----------------------------------------------------------------------------
require_once APPLICATION_BOOTSTRAP;



// Application is ready!
// -----------------------------------------------------------------------------

Route::run(Registry::get('REQUEST'));               // Run baby, run!



if (!PRODUCTION)   Benchmark::add_spot('end');      // request ended
if (!PRODUCTION)   Benchmark::render_report();      // echo benchmark report
ob_flush();                                         // flush output