-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
192 lines (176 loc) · 5.97 KB
/
Copy pathindex.php
File metadata and controls
192 lines (176 loc) · 5.97 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
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<?php
/**
* Project SDF
* devsimsek software development framework.
* Copyright devsimsek
* @package SDF
* @file index.php
* @version v2.3.4
* @author devsimsek
* @copyright Copyright (c) 2022 - 2026, smskSoft, devsimsek
* @license https://opensource.org/licenses/MIT MIT License
* @url https://github.com/devsimsek/project-sdf/
* @since v1.0
* @filesource
*/
const SDF = true;
// -----------------------------------------------
/**
* ------- ~ ------- ~ ------- ~ ------- ~ -------
* Fuse View Engine
* ------- ~ ------- ~ ------- ~ ------- ~ -------
* Project SDF has its own view engine like its
* competitors laravel, codeigniter.
* You can check the details from our
* webpage later.
* Source: https://sdf.smsk.dev/docs/fuse
*/
const USE_FUSE = true;
// -----------------------------------------------
/**
* ------- ~ ------- ~ ------- ~ ------- ~ -------
* Directory Setup
* ------- ~ ------- ~ ------- ~ ------- ~ -------
* Sdf has a nice setup for your application but
* if you want to change your folder structure
* you can change these lines bellow.
* Note: NO Trailing Slash!
* ------- ~ ------- ~ ------- ~ ------- ~ -------
* SDF_DIR: directory of sdf framework. if empty
* sdf will search for 'sdf' directory
* ------- ~ ------- ~ ------- ~ ------- ~ -------
* SDF_APP: the directory of application which
* includes views, third-party libraries, helpers,
* middlewares and models.
* ------- ~ ------- ~ ------- ~ ------- ~ -------
* SDF_APP_CONF: the configuration directory for
* sdf application.
* ------- ~ ------- ~ ------- ~ ------- ~ -------
* SDF_APP_CONT: the controllers directory for
* your sdf application.
* ------- ~ ------- ~ ------- ~ ------- ~ -------
* SDF_APP_VIEW: the views directory for your sdf
* application.
* ------- ~ ------- ~ ------- ~ ------- ~ -------
* SDF_APP_HELP: the helpers directory for your
* sdf application.
* ------- ~ ------- ~ ------- ~ ------- ~ -------
* SDF_APP_LIB: the libraries directory for your
* sdf application.
* ------- ~ ------- ~ ------- ~ ------- ~ -------
* SDF_APP_MODL: the models directory for your sdf
* application.
* ------- ~ ------- ~ ------- ~ ------- ~ -------
* SDF_APP_MIDD: the middlewares directory for
* your sdf application.
* ------- ~ ------- ~ ------- ~ ------- ~ -------
* SDF_APP_CACHE: the cache directory for
* your sdf application.
*/
$SDF_DIR = "";
$SDF_APP = "app";
$SDF_APP_CONF = "config";
$SDF_APP_CONT = "controllers";
$SDF_APP_VIEW = "views";
$SDF_APP_HELP = "helpers";
$SDF_APP_LIB = "libraries";
$SDF_APP_MODL = "models";
$SDF_APP_MIDD = "middlewares";
$SDF_APP_CACHE = "cache";
// -----------------------------------------------
/**
* ------- ~ ------- ~ ------- ~ ------- ~ -------
* Environment
* ------- ~ ------- ~ ------- ~ ------- ~ -------
*/
define('SDF_ENV', getenv('SDF_ENV') ?: 'development');
// -----------------------------------------------
/**
* ------- ~ ------- ~ ------- ~ ------- ~ -------
* Error Handlers
* ------- ~ ------- ~ ------- ~ ------- ~ -------
* SDF has a really nice feature which helps
* developer choose his error handler function
* or built-in handler function.
* Such as 404, method not allowed, server side
* error (500) and furthermore.
* All Handlers Must Locate At
* app/handlers/errors.php file.
* ------- ~ ------- ~ ------- ~ ------- ~ -------
* SDF_EH_404: Handles 404 (path not found) error.
* SDF_EH_405: Handles 405 (method not allowed).
*/
const SDF_EH_404 = "eh_pathNotFound";
const SDF_EH_405 = "eh_methodNotAllowed";
// -----------------------------------------------
/**
* ------- ~ ------- ~ ------- ~ ------- ~ -------
* Benchmarking
* ------- ~ ------- ~ ------- ~ ------- ~ -------
* Do you want to test you application's speed?
* If you do please set the line true.
* To view benchmarking open browser's developer
* console.
*/
const SDF_BENCHMARK = true;
// -----------------------------------------------
/**
* ------- ~ ------- ~ ------- ~ ------- ~ -------
* Allowed Static Files
* ------- ~ ------- ~ ------- ~ ------- ~ -------
* SDF gives strict access to local files.
* Set your extensions and your mime types to
* allow browser read files.
* Notice: Static serving works only when
* application environment is set to development
* mode.
* For example;
* '.css' => 'text/css'
*/
const SDF_STATIC_MIMES = [
".ttf" => "font/ttf",
".woff" => "font/woff",
".woff2" => "font/woff2",
".svg" => "image/svg+xml",
".png" => "image/png",
".jpg" => "image/jpg",
".jpeg" => "image/jpeg",
".css" => "text/css",
".js" => "text/javascript",
];
// -----------------------------------------------
// End Of The User Options, Please Don't Touch
// Bellow If You Don't Now What You're Doing.
// -----------------------------------------------
/**
* ------- ~ ------- ~ ------- ~ ------- ~ -------
* Initialize SDF
* ------- ~ ------- ~ ------- ~ ------- ~ -------
*/
define("SDF_ROOT", pathinfo(__FILE__, PATHINFO_DIRNAME));
define(
"SDF_APP",
SDF_ROOT . DIRECTORY_SEPARATOR . $SDF_APP . DIRECTORY_SEPARATOR
);
define("SDF_APP_CONF", SDF_APP . $SDF_APP_CONF . DIRECTORY_SEPARATOR);
define("SDF_APP_CONT", SDF_APP . $SDF_APP_CONT . DIRECTORY_SEPARATOR);
define("SDF_APP_VIEW", SDF_APP . $SDF_APP_VIEW . DIRECTORY_SEPARATOR);
define("SDF_APP_HELP", SDF_APP . $SDF_APP_HELP . DIRECTORY_SEPARATOR);
define("SDF_APP_LIB", SDF_APP . $SDF_APP_LIB . DIRECTORY_SEPARATOR);
define("SDF_APP_MODL", SDF_APP . $SDF_APP_MODL . DIRECTORY_SEPARATOR);
define("SDF_APP_MIDD", SDF_APP . $SDF_APP_MIDD . DIRECTORY_SEPARATOR);
define("SDF_APP_CACHE", SDF_APP . $SDF_APP_CACHE . DIRECTORY_SEPARATOR);
if (!file_exists($SDF_DIR)) {
if (file_exists(SDF_ROOT . "/sdf/")) {
define("SDF_DIR", SDF_ROOT . "/sdf/");
} else {
print_r("Sdf directory not found.");
exit(1);
}
} else {
define("SDF_DIR", $SDF_DIR);
}
// And pass the flag :)
// Please do not forget to configure your
// application in config directory.
require SDF_DIR . "__init.php";