-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
executable file
·97 lines (55 loc) · 1.63 KB
/
Copy pathindex.php
File metadata and controls
executable file
·97 lines (55 loc) · 1.63 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
<?php
namespace Rest;
//if(Config::DEBUG_MODE)
// sleep(0.5);
//Allow AJAX Request
use MzQ\app;
use MzQ\Config;
use MzQ\Router;
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST');
header("Access-Control-Allow-Headers: X-Requested-With");
date_default_timezone_set('Asia/Kabul');
include_once 'functions.php';
include_once 'app.php';
include_once 'Config.php';
include_once 'MyPDO.php';
include_once 'Router.php';
include_once 'HttpStatusCode.php';
include_once 'api/v1/Parents/LoginRestricted.php';
function load_classphp($directory) {
if(is_dir($directory)) {
$scan = scandir($directory);
unset($scan[0], $scan[1]); //unset . and ..
foreach($scan as $file) {
if(is_dir($directory."/".$file)) {
load_classphp($directory."/".$file);
} else {
if(strpos($file, '.php') !== false) {
include_once($directory."/".$file);
}
}
}
}
}
load_classphp('api/v1/');
//Display Errors On OutPut
if(Config::DEBUG_MODE) {
ini_set('display_errors', 1);
error_reporting( E_ALL );
}
else {
ini_set('display_errors', 0);
}
require 'vendor/autoload.php';
/**
* age header client ya userAgent nabod ya chizi ke mikhaym nist mitonim request ro block konim
*/
if(!isset($_GET["ROUTE" ]) || !isset($_GET["ACTION"])) {
app::outApi("اطلاعات صحیحی دریافت نشد");
}
else {
$route = $_GET["ROUTE"];
$action = $_GET["ACTION"];
new Router($route , $action);
}