-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathload.php
162 lines (134 loc) · 6.21 KB
/
load.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
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
<?php
use AST\View;
use AST\Fields;
use Whoops\Run;
use AST\Download;
use AST\Database;
use AST\Cache;
use AST\Helper\Minification;
use Phroute\Phroute\Dispatcher;
use PHPMailer\PHPMailer\PHPMailer;
use Phroute\Phroute\RouteCollector;
use Whoops\Handler\PrettyPageHandler;
use Phroute\Phroute\Exception\HttpRouteNotFoundException;
/*=====================================================
SESSION START
*=====================================================*/
session_start();
/*=====================================================
CONFIGURATION FILE
*=====================================================*/
require_once realpath(__DIR__) . '/config.php';
date_default_timezone_set( TIMEZONE );
/*=====================================================
DIRECTORY CONSTANTS
*=====================================================*/
define( "APP_PATH", ASTROOTPATH . "app/");
define( "PLUGINS_PATH", ASTROOTPATH . "plugins/");
define( "THEME_PATH", ASTROOTPATH . "themes/");
define( "UPLOADS_PATH", ASTROOTPATH . "uploads/");
define( "LANG_PATH", ASTROOTPATH . "language/");
define( "TOOLS_PATH", ASTROOTPATH . "tools/");
define( "INCLUDE_PATH", APP_PATH . "includes/");
define( "HELPER_PATH", APP_PATH . "helper/");
define( "TEMP_PATH", APP_PATH . "temp/");
define( "ADMIN_PATH", ASTROOTPATH . "admin_file/");
define( "PACKAGES_PATH", ADMIN_PATH . "packages/");
define( "MODULE_PATH", ADMIN_PATH . "assets/modules/");
/*=====================================================
OTHERS CONSTANTS
*=====================================================*/
define( "AST_UA", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36");
define( "AST_UA_IOS", "Mozilla/5.0 (iPhone; CPU iPhone OS 16_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.3 Mobile/15E148 Safari/604.1");
/*=====================================================
GLOBAL VARIABLES
*=====================================================*/
global $db, $router, $settings, $phpmailer, $post, $colors, $scripts, $minification, $websiteinfo, $extraparams;
/*=====================================================
INCLUDING LIBRRAIES
*=====================================================*/
require_once ASTROOTPATH . '/vendor/autoload.php';
/*=====================================================
HANDLING ERRORS
*=====================================================*/
if( AST_DEBUG ){
$ASTError = new Run();
$ASTError->pushHandler(new PrettyPageHandler());
$ASTError->register();
}else{
error_reporting(0);
ini_set('display_errors', 0);
}
/*=====================================================
ROUTER SETUP
*=====================================================*/
$router = new RouteCollector();
/*=====================================================
PHP MAILER
*=====================================================*/
$phpmailer = new PHPMailer( true );
/*=====================================================
DATABASE CONNECTION
*=====================================================*/
$db = Database::getInstance();
/*=====================================================
INPUT FIELDS GENERATOR
*=====================================================*/
$fields = Fields::instance();
/*=====================================================
INCLUDE FUNCTIONS AND HOOKS
*=====================================================*/
require_once INCLUDE_PATH . "Plugin.php";
require_once INCLUDE_PATH . "functions.php";
$minification = new Minification();
$colors = get_color_pallate("colors");
$websiteinfo = get_settings("basic");
require_once INCLUDE_PATH . "ajax.php";
require_once APP_PATH . "helper/ColumnHelper.php";
/*=====================================================
INCLUDE ALL PLUGIN MAIN FILES
*=====================================================*/
$activePlugins = get_settings("active_plugins", array());
foreach ($activePlugins as $folderName => $info){
if( isset($info['status']) && $info['status'] == 'active' ){
$filename = PLUGINS_PATH . $folderName;
if( is_dir( $filename ) && file_exists( $filename . "/functions.php" ) )
require_once $filename . "/functions.php";
}
}
/*=====================================================
INCLUDE ALL TOOLS IMPORTANT FILES
*=====================================================*/
foreach (glob(TOOLS_PATH . "*") as $filename){
if( is_dir( $filename ) && file_exists( $filename . "/important.php" ) )
require_once $filename . "/important.php";
}
/*=====================================================
SETUP VIEW CONTROLLER
*=====================================================*/
$routerLinks = @include( ASTROOTPATH . "app/routes/config.php" );
$routerLinks = apply_filters("ast/routers/config", $routerLinks);
View::parse_controller();
View::include_admin_functions();
if( has_system_installed() )
Download::setup();
if( View::is_api() )
require_once INCLUDE_PATH . "ApiHandlers.php";
/*=====================================================
INCLUDE ADMIN, FRONT, AUTH, API ROUTES
*=====================================================*/
$router->group(["prefix" => get_site_path_only()], function(RouteCollector $router){
$viewType = View::view_type();
require_once ASTROOTPATH . "app/routes/global.php";
require_once ASTROOTPATH . "app/routes/$viewType.php";
});
/*=====================================================
INCLUDE ACTIVE THEME FUNCTIONS FILE
*=====================================================*/
if( View::is_front() || View::is_cron() ){
View::include_theme_functions();
}
/*=====================================================
HOOK hANDLER
*=====================================================*/
require_once INCLUDE_PATH . "HookHander.php";