-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathadmin.php
228 lines (177 loc) · 6.58 KB
/
admin.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
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
<?php
/**
* Core file.
*
* @author Vince Wooll <sales@jomres.net>
*
* @version Jomres 10.7.2
*
* @copyright 2005-2023 Vince Wooll
* Jomres (tm) PHP, CSS & Javascript files are released under both MIT and GPL2 licenses. This means that you can choose the license that best suits your project, and use it accordingly
**/
//#################################################################
defined('_JOMRES_INITCHECK') or die('');
defined('_JOMRES_INITCHECK_ADMIN') or die('');
//#################################################################
/**
* Administrator area main script.
*
* Builds the administrator area page.
*
**/
ob_start('removeBOMadmin');
@ini_set('max_execution_time', '480');
require_once dirname(__FILE__).'/integration.php';
try {
//minicomponents object
$MiniComponents = jomres_singleton_abstract::getInstance('mcHandler');
//site config object
$siteConfig = jomres_singleton_abstract::getInstance('jomres_config_site_singleton');
$jrConfig = $siteConfig->get();
//request log
if ($jrConfig['development_production'] == 'development') {
request_log();
}
jr_import('jomres_api_capability_test');
$jomres_api_capability_test = new jomres_api_capability_test();
$jomres_api_capability_test->is_system_capable();
//get all properties in system.
$jomres_properties = jomres_singleton_abstract::getInstance('jomres_properties');
$jomres_properties->get_all_properties();
//trigger 07090 event (see README/md)
$MiniComponents->triggerEvent('07090');
//language object - load default language file for context
$jomres_language = jomres_singleton_abstract::getInstance('jomres_language');
$jomres_language->init();
$jomres_language->get_language();
//custom text object
$customTextObj = jomres_singleton_abstract::getInstance('custom_text');
//trigger 00001 event
$MiniComponents->triggerEvent('00001');
//trigger 00002 event
$MiniComponents->triggerEvent('00002');
//user object
$thisJRUser = jomres_singleton_abstract::getInstance('jr_user');
//input filtering
$MiniComponents->triggerEvent('00003');
//cron jobs
$cron = jomres_singleton_abstract::getInstance('jomres_cron');
if ($cron->method == 'Minicomponent' && !AJAXCALL) {
$cron->triggerJobs();
}
//session
$tmpBookingHandler = jomres_singleton_abstract::getInstance('jomres_temp_booking_handler');
$tmpBookingHandler->initBookingSession();
$jomressession = $tmpBookingHandler->getJomressession();
set_showtime('jomressession', $jomressession);
//set task showtime
$task = jomresGetParam($_REQUEST, 'task', 'cpanel');
$task = str_replace('<x>', '', $task);
set_showtime('task', $task);
//currency conversion object
$jomres_currency_exchange_rates = jomres_singleton_abstract::getInstance('jomres_currency_exchange_rates');
//set currency code to the appropriate one for the detected location
$jomres_geolocation = jomres_singleton_abstract::getInstance('jomres_geolocation');
$jomres_geolocation->auto_set_user_currency_code();
require_once JOMRES_FUNCTIONS_ABSPATH.'siteconfig.functions.php';
if (!AJAXCALL) {
//add javascript to head
$MiniComponents->triggerEvent('00004');
//core frontend menu items
$MiniComponents->specificEvent('09995', 'menu', array()); //Rod really needs them
//core admin menu items
$MiniComponents->specificEvent('19995', 'menu', array());
}
//00005 trigger point
$MiniComponents->triggerEvent('00005');
if (!AJAXCALL) {
$pageoutput = array();
$output = array();
//generate the cpanel menu
$MiniComponents->specificEvent('19997', 'menu', array());
$output[ 'CONTROL_PANEL_MENU' ] = $MiniComponents->miniComponentData[ '19997' ][ 'menu' ];
//frequently asked questions
$output['_JOMRES_FAQ'] = jr_gettext('_JOMRES_FAQ', '_JOMRES_FAQ', false);
//video tutorials
$jomres_video_tutorials = jomres_singleton_abstract::getInstance('jomres_video_tutorials');
$jomres_video_tutorials->property_uid = 0;
$output[ 'VIDEO_TUTORIALS' ] = $jomres_video_tutorials->build_modal();
//manage properties button
$output['HMANAGE_PROPERTIES'] = jr_gettext('_JOMRES_MANAGE_PROPERTIES', '_JOMRES_MANAGE_PROPERTIES', false);
//language dropdown
$output[ 'LANGDROPDOWN' ] = $jomres_language->get_languageselection_dropdown();
//bootstrap
$output[ 'USING_BOOTSTRAP' ] = 'true';
//output top area
$pageoutput[ ] = $output;
$tmpl = new patTemplate();
$tmpl->setRoot(JOMRES_TEMPLATEPATH_ADMINISTRATOR);
if (_JOMRES_DETECTED_CMS == 'joomla3') {
$tmpl->readTemplatesFromInput('administrator_content_area_top_vertical.html');
} else {
$tmpl->readTemplatesFromInput('administrator_content_area_top.html');
}
$tmpl->addRows('pageoutput', $pageoutput);
$tmpl->displayParsedTemplate();
}
if (!isset( $jrConfig['initial_setup_done'])) {
$jrConfig['initial_setup_done'] = 0;
}
//task
if ( $jrConfig['initial_setup_done'] == '0' && get_showtime('task') != 'save_initial_setup') {
$MiniComponents->specificEvent('16000','initial_setup'); // let's rock and roll
} else {
if ($MiniComponents->eventSpecificlyExistsCheck('16000', get_showtime('task'))) {
$MiniComponents->specificEvent('16000', get_showtime('task')); // task exists, execute it
} else {
$MiniComponents->triggerEvent('10001'); //task doesn`t exist, go to cpanel frontpage
}
}
//output bottom area
if (!AJAXCALL) {
// $pageoutput[] = $output;
$tmpl = new patTemplate();
$tmpl->setRoot(JOMRES_TEMPLATEPATH_ADMINISTRATOR);
if (_JOMRES_DETECTED_CMS == 'joomla3') {
$tmpl->readTemplatesFromInput('administrator_content_area_bottom_vertical.html');
} else {
$tmpl->readTemplatesFromInput('administrator_content_area_bottom.html');
}
$tmpl->addRows('pageoutput', array() );
$tmpl->displayParsedTemplate();
}
//trigger 99994 event for webhooks
$MiniComponents->triggerEvent('99994');
//trigger 99998 event - jomres feedback messages
if (!AJAXCALL) {
$MiniComponents->triggerEvent('99998');
}
$componentArgs = array();
$MiniComponents->triggerEvent('99999', $componentArgs);
//close/save jomres session
$tmpBookingHandler->close_jomres_session();
//done
endrun();
} catch (Exception $e) {
output_fatal_error($e);
}
if (defined('JOMRES_RETURNDATA')) {
$contents = ob_get_contents();
$contents = $head_contents.$contents;
define('JOMRES_RETURNDATA_CONTENT', $contents);
unset($contents);
ob_end_clean();
} else {
ob_end_flush();
}
// Jomres 4.7.8 strips BOM from all areas of the output, not just the beginning.
function removeBOMadmin($str = '')
{
$bom = pack('CCC', 0xef, 0xbb, 0xbf);
$str = str_replace($bom, '', $str);
// if(substr($str, 0,3) == pack("CCC",0xef,0xbb,0xbf))
// {
// $str=substr($str, 3);
// }
return $str;
}