-
Notifications
You must be signed in to change notification settings - Fork 49
/
Copy pathoc-load.php
executable file
·157 lines (133 loc) · 6.25 KB
/
oc-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
<?php
/*
* Osclass - software for creating and publishing online classified advertising platforms
* Maintained and supported by Mindstellar Community
* https://github.com/mindstellar/Osclass
* Copyright (c) 2021. Mindstellar
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* GNU GENERAL PUBLIC LICENSE
* Version 3, 29 June 2007
*
* Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
* Everyone is permitted to copy and distribute verbatim copies
* of this license document, but changing it is not allowed.
*
* You should have received a copy of the GNU Affero General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
use mindstellar\Csrf;
use mindstellar\logger\OsclassErrors;
if (!defined('ABS_PATH')) {
define('ABS_PATH', __DIR__ . '/');
}
define('LIB_PATH', ABS_PATH . 'oc-includes/');
if (!file_exists(ABS_PATH . 'config.php')) {
require_once LIB_PATH . 'osclass/helpers/hErrors.php';
$title = 'Osclass » Error';
$message =
'There doesn\'t seem to be a <code>config.php</code> file. Osclass isn\'t installed. '
. '<a href="https://github.com/mindstellar/Osclass/discussions">Need more help?</a></p>';
$message .= '<p><a class="btn btn-primary" href="' . osc_get_absolute_url()
. 'oc-includes/osclass/install.php">'
. 'Install</a></p>';
osc_die($title, $message);
}
// load osclass configuration
require_once ABS_PATH . 'config.php';
// load default constants
require_once LIB_PATH . 'osclass/default-constants.php';
//Load Autoloader
require_once LIB_PATH . 'vendor/autoload.php';
//Register error handler
OsclassErrors::newInstance()->register();
require_once LIB_PATH . 'osclass/helpers/hDatabaseInfo.php';
require_once LIB_PATH . 'osclass/helpers/hPreference.php';
// check if Osclass is installed
if (!Preference::newInstance()->get('osclass_installed')) {
require_once LIB_PATH . 'osclass/helpers/hErrors.php';
$title = 'Osclass » Error';
$message =
'Osclass isn\'t installed. <a href="https://github.com/mindstellar/Osclass/discussions">Need more help?</a></p>';
$message .= '<p><a class="button" href="' . osc_get_absolute_url()
. 'oc-includes/osclass/install.php">Install</a></p>';
osc_die($title, $message);
}
require_once LIB_PATH . 'osclass/helpers/hDefines.php';
require_once LIB_PATH . 'osclass/helpers/hLocale.php';
require_once LIB_PATH . 'osclass/helpers/hMessages.php';
require_once LIB_PATH . 'osclass/helpers/hUsers.php';
require_once LIB_PATH . 'osclass/helpers/hItems.php';
require_once LIB_PATH . 'osclass/helpers/hSearch.php';
require_once LIB_PATH . 'osclass/helpers/hUtils.php';
require_once LIB_PATH . 'osclass/helpers/hCategories.php';
require_once LIB_PATH . 'osclass/helpers/hTranslations.php';
require_once LIB_PATH . 'osclass/helpers/hSecurity.php';
require_once LIB_PATH . 'osclass/helpers/hSanitize.php';
require_once LIB_PATH . 'osclass/helpers/hValidate.php';
require_once LIB_PATH . 'osclass/helpers/hPage.php';
require_once LIB_PATH . 'osclass/helpers/hPagination.php';
require_once LIB_PATH . 'osclass/helpers/hPremium.php';
require_once LIB_PATH . 'osclass/helpers/hTheme.php';
require_once LIB_PATH . 'osclass/helpers/hLocation.php';
require_once LIB_PATH . 'osclass/utils.php';
require_once LIB_PATH . 'osclass/formatting.php';
require_once LIB_PATH . 'osclass/locales.php';
require_once LIB_PATH . 'osclass/helpers/hPlugins.php';
require_once LIB_PATH . 'osclass/emails.php';
require_once LIB_PATH . 'osclass/alerts.php';
require_once LIB_PATH . 'osclass/functions.php';
require_once LIB_PATH . 'osclass/helpers/hAdminMenu.php';
require_once LIB_PATH . 'osclass/helpers/hCache.php';
require_once LIB_PATH . 'osclass/compatibility.php';
if (!defined('OSC_CRYPT_KEY')) {
define('OSC_CRYPT_KEY', osc_get_preference('crypt_key'));
}
osc_cache_init();
define('__OSC_LOADED__', true);
Params::init();
Session::newInstance()->session_start();
if (osc_timezone()) {
date_default_timezone_set(osc_timezone());
}
Scripts::init();
Styles::init();
// register scripts
osc_register_script('jquery', osc_assets_url('jquery/jquery.min.js'));
osc_register_script('jquery-migrate', osc_assets_url('jquery-migrate/jquery-migrate.min.js'), 'jquery');
osc_register_script('jquery-ui', osc_assets_url('jquery-ui/jquery-ui.min.js'), 'jquery');
//osc_register_script('jquery-json', osc_assets_url('js/jquery.json.js'), 'jquery');
//Not used in osclass core, removed.
//osc_register_script('fancybox', osc_assets_url('js/fancybox/jquery.fancybox.pack.js'), array('jquery'));
osc_register_script('jquery-treeview', osc_assets_url('jquery-treeview/jquery.treeview.js'), 'jquery');
osc_register_script('jquery-nested', osc_assets_url('jquery-ui-nested/jquery-ui-nested.js'), 'jquery-ui');
osc_register_script('jquery-validate', osc_assets_url('jquery-validation/jquery.validate.min.js'), 'jquery');
osc_register_script('jquery-validate-additional', osc_assets_url('jquery-validation/additional-methods.min.js'), 'jquery-validate');
osc_register_script('tiny_mce', osc_assets_url('tinymce/tinymce.min.js'));
//Legacy js libraries
osc_register_script('tabber', osc_assets_url('osclass-legacy/js/tabber-minimized.js'), 'jquery');
osc_register_script('colorpicker', osc_assets_url('osclass-legacy/js/colorpicker/js/colorpicker.js'));
osc_register_script('php-date', osc_assets_url('osclass-legacy/js/date.js'));
osc_register_script('jquery-fineuploader', osc_assets_url('osclass-legacy/js/fineuploader/jquery.fineuploader.min.js'), 'jquery');
Plugins::init();
if (defined('OC_ADMIN') && OC_ADMIN) {
// init admin menu
AdminMenu::newInstance()->init();
$functions_path = AdminThemes::newInstance()->getCurrentThemePath() . 'functions.php';
if (file_exists($functions_path)) {
require_once $functions_path;
}
}
WebThemes::init();
Translation::init();
Csrf::init();
Rewrite::newInstance()->init();