-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
45 lines (34 loc) · 1.04 KB
/
index.php
File metadata and controls
45 lines (34 loc) · 1.04 KB
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
<?php
/*
+--------------------------------------------------------------------------
| Basic Micro Framework v0.1
| ========================================
| Copyright (c), 2014 Cazacu Dan
+--------------------------------------------------------------------------
*/
// security measure for included files
define("IN_ENGINE", true);
// build a basic router
// include router
require_once dirname(__FILE__)."/libs/class.Router.php";
// init router
$router = new Router();
// generate routes
$route = $router->parse();
// index route exception
$route[0] = $route[0] == '/index' ? $router->redirect('/') : $route[0];
$route[0] = $route[0] == '/' ? $route[0] = 'index' : trim($route[0], '/');
if (file_exists(dirname(__FILE__)."/templates/".$route[0].".html") && $route[0] != 'header' && $route[0] != 'footer')
{
// include header
require_once dirname(__FILE__)."/header.php";
// include content
require_once dirname(__FILE__)."/content.php";
// include footer
require_once dirname(__FILE__)."/footer.php";
}
else
{
$router->error(404);
}
?>