forked from tayyebi/php-mvc-blog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
executable file
·83 lines (63 loc) · 1.41 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
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
76
77
78
79
80
81
82
83
<?php
// Read configuration
include('Core/Config.php');
// CORS
header('Access-Control-Allow-Origin: *');
// Allowed methods
header('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, HEAD, VIEW');
// Debuf mode
if (_Debug)
{
// Report all PHP errors
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);
}
else
// Turn off all error reporting
error_reporting(0);
// Exception handler
include('Core/Exceptions.php');
// Cryptography
include('Libs/Cryptography.php');
// Cryptography
include('Libs/APR1.php');
// Random
include('Libs/Random.php');
// Strings
include('Libs/Strings.php');
// Models core
include('Core/Model.php');
// Middleware
include('Core/Middleware.php');
// Jalali Date
include('Libs/jdf.php');
// Routing
include('Core/Route.php');
// Security
include('Core/Auth.php');
// Check if it's an MVC API request
if (count((new Route)::GetPathInfo()) > 0 &&
(new Route)::GetPathInfo()[0] == 'api')
{
// New JSON library to handle large arrays
include('Libs/JSON.php');
// Controllers core
include('Core/ApiController.php');
// Router
include('Core/ApiApp.php');
// Initialize
new ApiApp;
}
// If was a MVC request
else
{
// Markdown
include('Libs/Parsedown.php');
// Controllers core
include('Core/Controller.php');
// Router
include('Core/App.php');
// Initialize
new App;
}