1
|
|
|
<?php |
2
|
|
|
/* Copyright (C) NAVER <http://www.navercorp.com> */ |
3
|
|
|
|
4
|
|
|
/** |
5
|
|
|
* adminAdminView class |
6
|
|
|
* Admin view class of admin module |
7
|
|
|
* |
8
|
|
|
* @author NAVER ([email protected]) |
9
|
|
|
* @package /modules/admin |
10
|
|
|
* @version 0.1 |
11
|
|
|
*/ |
12
|
|
|
class adminAdminView extends admin |
13
|
|
|
{ |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* layout list |
17
|
|
|
* @var array |
18
|
|
|
*/ |
19
|
|
|
var $layout_list; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* easy install check file |
23
|
|
|
* @var array |
24
|
|
|
*/ |
25
|
|
|
var $easyinstallCheckFile = './files/env/easyinstall_last'; |
26
|
|
|
|
27
|
|
|
function __construct() |
28
|
|
|
{ |
29
|
|
|
$db_info = Context::getDBInfo(); |
30
|
|
|
|
31
|
|
View Code Duplication |
if(strpos($db_info->default_url, 'xn--') !== FALSE) |
32
|
|
|
{ |
33
|
|
|
$xe_default_url = Context::decodeIdna($db_info->default_url); |
34
|
|
|
} |
35
|
|
|
else |
36
|
|
|
{ |
37
|
|
|
$xe_default_url = $db_info->default_url; |
38
|
|
|
} |
39
|
|
|
Context::set('xe_default_url', $xe_default_url); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Initilization |
44
|
|
|
* @return void |
45
|
|
|
*/ |
46
|
|
|
function init() |
47
|
|
|
{ |
48
|
|
|
// forbit access if the user is not an administrator |
49
|
|
|
$oMemberModel = getModel('member'); |
50
|
|
|
$logged_info = $oMemberModel->getLoggedInfo(); |
51
|
|
|
if($logged_info->is_admin != 'Y') |
52
|
|
|
{ |
53
|
|
|
return $this->stop("msg_is_not_administrator"); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
// change into administration layout |
57
|
|
|
$this->setTemplatePath($this->module_path . 'tpl'); |
58
|
|
|
$this->setLayoutPath($this->getTemplatePath()); |
59
|
|
|
$this->setLayoutFile('layout.html'); |
60
|
|
|
|
61
|
|
|
$this->makeGnbUrl(); |
62
|
|
|
|
63
|
|
|
// Retrieve the list of installed modules |
64
|
|
|
|
65
|
|
|
$db_info = Context::getDBInfo(); |
66
|
|
|
|
67
|
|
|
Context::set('time_zone_list', $GLOBALS['time_zone']); |
68
|
|
|
Context::set('time_zone', $GLOBALS['_time_zone']); |
69
|
|
|
Context::set('use_rewrite', $db_info->use_rewrite == 'Y' ? 'Y' : 'N'); |
70
|
|
|
Context::set('use_sso', $db_info->use_sso == 'Y' ? 'Y' : 'N'); |
71
|
|
|
Context::set('use_html5', $db_info->use_html5 == 'Y' ? 'Y' : 'N'); |
72
|
|
|
Context::set('use_spaceremover', $db_info->use_spaceremover ? $db_info->use_spaceremover : 'Y'); //not use |
73
|
|
|
Context::set('qmail_compatibility', $db_info->qmail_compatibility == 'Y' ? 'Y' : 'N'); |
74
|
|
|
Context::set('use_db_session', $db_info->use_db_session == 'N' ? 'N' : 'Y'); |
75
|
|
|
Context::set('use_mobile_view', $db_info->use_mobile_view == 'Y' ? 'Y' : 'N'); |
76
|
|
|
Context::set('use_ssl', $db_info->use_ssl ? $db_info->use_ssl : "none"); |
77
|
|
|
if($db_info->http_port) |
78
|
|
|
{ |
79
|
|
|
Context::set('http_port', $db_info->http_port); |
80
|
|
|
} |
81
|
|
|
if($db_info->https_port) |
82
|
|
|
{ |
83
|
|
|
Context::set('https_port', $db_info->https_port); |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
$this->showSendEnv(); |
87
|
|
|
$this->checkEasyinstall(); |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* check easy install |
92
|
|
|
* @return void |
93
|
|
|
*/ |
94
|
|
|
function checkEasyinstall() |
95
|
|
|
{ |
96
|
|
|
$lastTime = (int) FileHandler::readFile($this->easyinstallCheckFile); |
|
|
|
|
97
|
|
|
if($lastTime > $_SERVER['REQUEST_TIME'] - 60 * 60 * 24 * 30) |
98
|
|
|
{ |
99
|
|
|
return; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
$oAutoinstallModel = getModel('autoinstall'); |
103
|
|
|
$params = array(); |
104
|
|
|
$params["act"] = "getResourceapiLastupdate"; |
105
|
|
|
$body = XmlGenerater::generate($params); |
106
|
|
|
$buff = FileHandler::getRemoteResource(_XE_DOWNLOAD_SERVER_, $body, 3, "POST", "application/xml"); |
107
|
|
|
$xml_lUpdate = new XmlParser(); |
108
|
|
|
$lUpdateDoc = $xml_lUpdate->parse($buff); |
109
|
|
|
$updateDate = $lUpdateDoc->response->updatedate->body; |
110
|
|
|
|
111
|
|
|
if(!$updateDate) |
112
|
|
|
{ |
113
|
|
|
$this->_markingCheckEasyinstall(); |
114
|
|
|
return; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
$item = $oAutoinstallModel->getLatestPackage(); |
118
|
|
|
if(!$item || $item->updatedate < $updateDate) |
119
|
|
|
{ |
120
|
|
|
$oController = getAdminController('autoinstall'); |
121
|
|
|
$oController->_updateinfo(); |
122
|
|
|
} |
123
|
|
|
$this->_markingCheckEasyinstall(); |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* update easy install file content |
128
|
|
|
* @return void |
129
|
|
|
*/ |
130
|
|
|
function _markingCheckEasyinstall() |
131
|
|
|
{ |
132
|
|
|
$currentTime = $_SERVER['REQUEST_TIME']; |
133
|
|
|
FileHandler::writeFile($this->easyinstallCheckFile, $currentTime); |
|
|
|
|
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* Include admin menu php file and make menu url |
138
|
|
|
* Setting admin logo, newest news setting |
139
|
|
|
* @return void |
140
|
|
|
*/ |
141
|
|
|
function makeGnbUrl($module = 'admin') |
142
|
|
|
{ |
143
|
|
|
global $lang; |
144
|
|
|
|
145
|
|
|
// Check is_shortcut column |
146
|
|
|
$oDB = DB::getInstance(); |
147
|
|
|
if(!$oDB->isColumnExists('menu_item', 'is_shortcut')) |
148
|
|
|
{ |
149
|
|
|
return; |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
$oAdminAdminModel = getAdminModel('admin'); |
153
|
|
|
$lang->menu_gnb_sub = $oAdminAdminModel->getAdminMenuLang(); |
154
|
|
|
|
155
|
|
|
$result = $oAdminAdminModel->checkAdminMenu(); |
156
|
|
|
include $result->php_file; |
157
|
|
|
|
158
|
|
|
$oModuleModel = getModel('module'); |
159
|
|
|
|
160
|
|
|
// get current menu's subMenuTitle |
161
|
|
|
$moduleActionInfo = $oModuleModel->getModuleActionXml($module); |
162
|
|
|
$currentAct = Context::get('act'); |
163
|
|
|
$subMenuTitle = ''; |
164
|
|
|
|
165
|
|
|
foreach((array) $moduleActionInfo->menu as $key => $value) |
166
|
|
|
{ |
167
|
|
|
if(isset($value->acts) && is_array($value->acts) && in_array($currentAct, $value->acts)) |
168
|
|
|
{ |
169
|
|
|
$subMenuTitle = $value->title; |
170
|
|
|
break; |
171
|
|
|
} |
172
|
|
|
} |
173
|
|
|
// get current menu's srl(=parentSrl) |
174
|
|
|
$parentSrl = 0; |
175
|
|
|
$oMenuAdminConroller = getAdminController('menu'); |
|
|
|
|
176
|
|
|
foreach((array) $menu->list as $parentKey => $parentMenu) |
177
|
|
|
{ |
178
|
|
|
if(!is_array($parentMenu['list']) || !count($parentMenu['list'])) |
179
|
|
|
{ |
180
|
|
|
continue; |
181
|
|
|
} |
182
|
|
|
if($parentMenu['href'] == '#' && count($parentMenu['list'])) |
183
|
|
|
{ |
184
|
|
|
$firstChild = current($parentMenu['list']); |
185
|
|
|
$menu->list[$parentKey]['href'] = $firstChild['href']; |
|
|
|
|
186
|
|
|
} |
187
|
|
|
|
188
|
|
|
foreach($parentMenu['list'] as $childKey => $childMenu) |
189
|
|
|
{ |
190
|
|
|
if($subMenuTitle == $childMenu['text'] && $parentSrl == 0) |
191
|
|
|
{ |
192
|
|
|
$parentSrl = $childMenu['parent_srl']; |
193
|
|
|
} |
194
|
|
|
} |
195
|
|
|
} |
196
|
|
|
|
197
|
|
|
// Admin logo, title setup |
198
|
|
|
$objConfig = $oModuleModel->getModuleConfig('admin'); |
199
|
|
|
$gnbTitleInfo = new stdClass(); |
200
|
|
|
$gnbTitleInfo->adminTitle = $objConfig->adminTitle ? $objConfig->adminTitle : 'XE Admin'; |
201
|
|
|
$gnbTitleInfo->adminLogo = $objConfig->adminLogo ? $objConfig->adminLogo : 'modules/admin/tpl/img/xe.h1.png'; |
202
|
|
|
|
203
|
|
|
$browserTitle = ($subMenuTitle ? $subMenuTitle : 'Dashboard') . ' - ' . $gnbTitleInfo->adminTitle; |
204
|
|
|
|
205
|
|
|
// Get list of favorite |
206
|
|
|
$oAdminAdminModel = getAdminModel('admin'); |
207
|
|
|
$output = $oAdminAdminModel->getFavoriteList(0, true); |
208
|
|
|
Context::set('favorite_list', $output->get('favoriteList')); |
209
|
|
|
|
210
|
|
|
// Retrieve recent news and set them into context, |
211
|
|
|
// move from index method, because use in admin footer |
212
|
|
|
$newest_news_url = sprintf("http://news.xpressengine.com/%s/news.php?version=%s&package=%s", _XE_LOCATION_, __XE_VERSION__, _XE_PACKAGE_); |
213
|
|
|
$cache_file = sprintf("%sfiles/cache/newest_news.%s.cache.php", _XE_PATH_, _XE_LOCATION_); |
214
|
|
|
if(!file_exists($cache_file) || filemtime($cache_file) + 60 * 60 < $_SERVER['REQUEST_TIME']) |
215
|
|
|
{ |
216
|
|
|
// Considering if data cannot be retrieved due to network problem, modify filemtime to prevent trying to reload again when refreshing administration page |
217
|
|
|
// Ensure to access the administration page even though news cannot be displayed |
218
|
|
|
FileHandler::writeFile($cache_file, ''); |
219
|
|
|
FileHandler::getRemoteFile($newest_news_url, $cache_file, null, 1, 'GET', 'text/html', array('REQUESTURL' => getFullUrl(''))); |
220
|
|
|
} |
221
|
|
|
|
222
|
|
|
if(file_exists($cache_file)) |
223
|
|
|
{ |
224
|
|
|
$oXml = new XmlParser(); |
225
|
|
|
$buff = $oXml->parse(FileHandler::readFile($cache_file)); |
226
|
|
|
|
227
|
|
|
$item = $buff->zbxe_news->item; |
228
|
|
|
if($item) |
229
|
|
|
{ |
230
|
|
|
if(!is_array($item)) |
231
|
|
|
{ |
232
|
|
|
$item = array($item); |
233
|
|
|
} |
234
|
|
|
|
235
|
|
|
foreach($item as $key => $val) |
236
|
|
|
{ |
237
|
|
|
$obj = new stdClass(); |
238
|
|
|
$obj->title = $val->body; |
239
|
|
|
$obj->date = $val->attrs->date; |
240
|
|
|
$obj->url = $val->attrs->url; |
241
|
|
|
$news[] = $obj; |
|
|
|
|
242
|
|
|
} |
243
|
|
|
Context::set('news', $news); |
|
|
|
|
244
|
|
|
if(isset($news) && is_array($news)) |
245
|
|
|
{ |
246
|
|
|
Context::set('latestVersion', array_shift($news)); |
247
|
|
|
} |
248
|
|
|
} |
249
|
|
|
Context::set('released_version', $buff->zbxe_news->attrs->released_version); |
250
|
|
|
Context::set('download_link', $buff->zbxe_news->attrs->download_link); |
251
|
|
|
} |
252
|
|
|
|
253
|
|
|
Context::set('subMenuTitle', $subMenuTitle); |
254
|
|
|
Context::set('gnbUrlList', $menu->list); |
255
|
|
|
Context::set('parentSrl', $parentSrl); |
256
|
|
|
Context::set('gnb_title_info', $gnbTitleInfo); |
|
|
|
|
257
|
|
|
Context::setBrowserTitle($browserTitle); |
258
|
|
|
} |
259
|
|
|
|
260
|
|
|
/** |
261
|
|
|
* Display Super Admin Dashboard |
262
|
|
|
* @return void |
263
|
|
|
*/ |
264
|
|
|
function dispAdminIndex() |
265
|
|
|
{ |
266
|
|
|
$db_info = Context::getDBInfo(); |
267
|
|
|
Context::set('db_info',$db_info); |
|
|
|
|
268
|
|
|
|
269
|
|
|
// Get statistics |
270
|
|
|
$args = new stdClass(); |
271
|
|
|
$args->date = date("Ymd000000", $_SERVER['REQUEST_TIME'] - 60 * 60 * 24); |
272
|
|
|
$today = date("Ymd"); |
273
|
|
|
|
274
|
|
|
// Member Status |
275
|
|
|
$oMemberAdminModel = getAdminModel('member'); |
276
|
|
|
$status = new stdClass(); |
277
|
|
|
$status->member = new stdClass(); |
278
|
|
|
$status->member->todayCount = $oMemberAdminModel->getMemberCountByDate($today); |
279
|
|
|
$status->member->totalCount = $oMemberAdminModel->getMemberCountByDate(); |
280
|
|
|
|
281
|
|
|
// Document Status |
282
|
|
|
$oDocumentAdminModel = getAdminModel('document'); |
283
|
|
|
$statusList = array('PUBLIC', 'SECRET'); |
284
|
|
|
$status->document = new stdClass(); |
285
|
|
|
$status->document->todayCount = $oDocumentAdminModel->getDocumentCountByDate($today, array(), $statusList); |
286
|
|
|
$status->document->totalCount = $oDocumentAdminModel->getDocumentCountByDate('', array(), $statusList); |
287
|
|
|
|
288
|
|
|
Context::set('status', $status); |
|
|
|
|
289
|
|
|
|
290
|
|
|
// Latest Document |
291
|
|
|
$oDocumentModel = getModel('document'); |
292
|
|
|
$columnList = array('document_srl', 'module_srl', 'category_srl', 'title', 'nick_name', 'member_srl'); |
293
|
|
|
$args->list_count = 5; |
294
|
|
|
$output = $oDocumentModel->getDocumentList($args, FALSE, FALSE, $columnList); |
295
|
|
|
Context::set('latestDocumentList', $output->data); |
296
|
|
|
unset($args, $output, $columnList); |
297
|
|
|
|
298
|
|
|
// Latest Comment |
299
|
|
|
$oCommentModel = getModel('comment'); |
300
|
|
|
$columnList = array('comment_srl', 'module_srl', 'document_srl', 'content', 'nick_name', 'member_srl'); |
301
|
|
|
$args = new stdClass(); |
302
|
|
|
$args->list_count = 5; |
303
|
|
|
$output = $oCommentModel->getNewestCommentList($args, $columnList); |
304
|
|
|
if(is_array($output)) |
305
|
|
|
{ |
306
|
|
|
foreach($output AS $key => $value) |
307
|
|
|
{ |
308
|
|
|
$value->content = strip_tags($value->content); |
309
|
|
|
} |
310
|
|
|
} |
311
|
|
|
Context::set('latestCommentList', $output); |
312
|
|
|
unset($args, $output, $columnList); |
313
|
|
|
|
314
|
|
|
// Get list of modules |
315
|
|
|
$oModuleModel = getModel('module'); |
316
|
|
|
$module_list = $oModuleModel->getModuleList(); |
317
|
|
|
if(is_array($module_list)) |
318
|
|
|
{ |
319
|
|
|
$needUpdate = FALSE; |
320
|
|
|
$addTables = FALSE; |
321
|
|
|
foreach($module_list AS $key => $value) |
322
|
|
|
{ |
323
|
|
|
if($value->need_install) |
324
|
|
|
{ |
325
|
|
|
$addTables = TRUE; |
326
|
|
|
} |
327
|
|
|
if($value->need_update) |
328
|
|
|
{ |
329
|
|
|
$needUpdate = TRUE; |
330
|
|
|
} |
331
|
|
|
} |
332
|
|
|
} |
333
|
|
|
|
334
|
|
|
// Get need update from easy install |
335
|
|
|
$oAutoinstallAdminModel = getAdminModel('autoinstall'); |
336
|
|
|
$needUpdateList = $oAutoinstallAdminModel->getNeedUpdateList(); |
337
|
|
|
|
338
|
|
|
if(is_array($needUpdateList)) |
339
|
|
|
{ |
340
|
|
|
foreach($needUpdateList AS $key => $value) |
341
|
|
|
{ |
342
|
|
|
$helpUrl = './admin/help/index.html#'; |
343
|
|
|
switch($value->type) |
344
|
|
|
{ |
345
|
|
|
case 'addon': |
346
|
|
|
$helpUrl .= 'UMAN_terminology_addon'; |
347
|
|
|
break; |
348
|
|
|
case 'layout': |
349
|
|
|
case 'm.layout': |
350
|
|
|
$helpUrl .= 'UMAN_terminology_layout'; |
351
|
|
|
break; |
352
|
|
|
case 'module': |
353
|
|
|
$helpUrl .= 'UMAN_terminology_module'; |
354
|
|
|
break; |
355
|
|
|
case 'widget': |
356
|
|
|
$helpUrl .= 'UMAN_terminology_widget'; |
357
|
|
|
break; |
358
|
|
|
case 'widgetstyle': |
359
|
|
|
$helpUrl .= 'UMAN_terminology_widgetstyle'; |
360
|
|
|
break; |
361
|
|
|
default: |
362
|
|
|
$helpUrl = ''; |
363
|
|
|
} |
364
|
|
|
$needUpdateList[$key]->helpUrl = $helpUrl; |
365
|
|
|
} |
366
|
|
|
} |
367
|
|
|
|
368
|
|
|
$site_module_info = Context::get('site_module_info'); |
369
|
|
|
$oAddonAdminModel = getAdminModel('addon'); |
370
|
|
|
$counterAddonActivated = $oAddonAdminModel->isActivatedAddon('counter', $site_module_info->site_srl ); |
371
|
|
|
if(!$counterAddonActivated) |
372
|
|
|
{ |
373
|
|
|
$columnList = array('member_srl', 'nick_name', 'user_name', 'user_id', 'email_address'); |
374
|
|
|
$args = new stdClass; |
375
|
|
|
$args->page = 1; |
376
|
|
|
$args->list_count = 5; |
377
|
|
|
$output = executeQuery('member.getMemberList', $args, $columnList); |
378
|
|
|
Context::set('latestMemberList', $output->data); |
379
|
|
|
unset($args, $output, $columnList); |
380
|
|
|
} |
381
|
|
|
|
382
|
|
|
Context::set('module_list', $module_list); |
383
|
|
|
Context::set('needUpdate', $isUpdated); |
|
|
|
|
384
|
|
|
Context::set('addTables', $addTables); |
|
|
|
|
385
|
|
|
Context::set('needUpdate', $needUpdate); |
|
|
|
|
386
|
|
|
Context::set('newVersionList', $needUpdateList); |
387
|
|
|
Context::set('counterAddonActivated', $counterAddonActivated); |
388
|
|
|
|
389
|
|
|
$oSecurity = new Security(); |
390
|
|
|
$oSecurity->encodeHTML('module_list..', 'module_list..author..', 'newVersionList..'); |
391
|
|
|
|
392
|
|
|
// gathering enviroment check |
393
|
|
|
$mainVersion = join('.', array_slice(explode('.', __XE_VERSION__), 0, 2)); |
394
|
|
|
$path = FileHandler::getRealPath('./files/env/' . $mainVersion); |
395
|
|
|
$isEnviromentGatheringAgreement = FALSE; |
396
|
|
|
if(file_exists($path)) |
397
|
|
|
{ |
398
|
|
|
$isEnviromentGatheringAgreement = TRUE; |
399
|
|
|
} |
400
|
|
|
Context::set('isEnviromentGatheringAgreement', $isEnviromentGatheringAgreement); |
|
|
|
|
401
|
|
|
|
402
|
|
|
// license agreement check |
403
|
|
|
$isLicenseAgreement = FALSE; |
|
|
|
|
404
|
|
|
$path = FileHandler::getRealPath('./files/env/license_agreement'); |
405
|
|
|
$isLicenseAgreement = FALSE; |
406
|
|
|
if(file_exists($path)) |
407
|
|
|
{ |
408
|
|
|
$isLicenseAgreement = TRUE; |
409
|
|
|
} |
410
|
|
|
Context::set('isLicenseAgreement', $isLicenseAgreement); |
|
|
|
|
411
|
|
|
Context::set('layout', 'none'); |
412
|
|
|
|
413
|
|
|
$this->setTemplateFile('index'); |
414
|
|
|
} |
415
|
|
|
|
416
|
|
|
/** |
417
|
|
|
* Display Configuration(settings) page |
418
|
|
|
* @return void |
419
|
|
|
*/ |
420
|
|
|
function dispAdminConfigGeneral() |
421
|
|
|
{ |
422
|
|
|
Context::loadLang('modules/install/lang'); |
423
|
|
|
|
424
|
|
|
$db_info = Context::getDBInfo(); |
425
|
|
|
|
426
|
|
|
Context::set('selected_lang', $db_info->lang_type); |
427
|
|
|
|
428
|
|
View Code Duplication |
if(strpos($db_info->default_url, 'xn--') !== FALSE) |
429
|
|
|
{ |
430
|
|
|
$db_info->default_url = Context::decodeIdna($db_info->default_url); |
431
|
|
|
} |
432
|
|
|
Context::set('default_url', $db_info->default_url); |
433
|
|
|
Context::set('langs', Context::loadLangSupported()); |
|
|
|
|
434
|
|
|
|
435
|
|
|
// site lock |
436
|
|
|
Context::set('IP', $_SERVER['REMOTE_ADDR']); |
437
|
|
|
if(!$db_info->sitelock_title) $db_info->sitelock_title = 'Maintenance in progress...'; |
438
|
|
|
if(!in_array('127.0.0.1', $db_info->sitelock_whitelist)) $db_info->sitelock_whitelist[] = '127.0.0.1'; |
439
|
|
|
if(!in_array($_SERVER['REMOTE_ADDR'], $db_info->sitelock_whitelist)) $db_info->sitelock_whitelist[] = $_SERVER['REMOTE_ADDR']; |
440
|
|
|
$db_info->sitelock_whitelist = array_unique($db_info->sitelock_whitelist); |
441
|
|
|
Context::set('remote_addr', $_SERVER['REMOTE_ADDR']); |
442
|
|
|
Context::set('use_sitelock', $db_info->use_sitelock); |
443
|
|
|
Context::set('sitelock_title', $db_info->sitelock_title); |
444
|
|
|
Context::set('sitelock_message', htmlspecialchars($db_info->sitelock_message, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
445
|
|
|
|
446
|
|
|
$whitelist = implode("\r\n", $db_info->sitelock_whitelist); |
447
|
|
|
Context::set('sitelock_whitelist', $whitelist); |
448
|
|
|
|
449
|
|
|
|
450
|
|
|
if($db_info->admin_ip_list) $admin_ip_list = implode("\r\n", $db_info->admin_ip_list); |
451
|
|
|
else $admin_ip_list = ''; |
452
|
|
|
Context::set('admin_ip_list', $admin_ip_list); |
453
|
|
|
|
454
|
|
|
Context::set('lang_selected', Context::loadLangSelected()); |
|
|
|
|
455
|
|
|
|
456
|
|
|
$oAdminModel = getAdminModel('admin'); |
457
|
|
|
$favicon_url = $oAdminModel->getFaviconUrl(); |
458
|
|
|
$mobicon_url = $oAdminModel->getMobileIconUrl(); |
459
|
|
|
Context::set('favicon_url', $favicon_url.'?'.$_SERVER['REQUEST_TIME']); |
460
|
|
|
Context::set('mobicon_url', $mobicon_url.'?'.$_SERVER['REQUEST_TIME']); |
461
|
|
|
|
462
|
|
|
$oDocumentModel = getModel('document'); |
463
|
|
|
$config = $oDocumentModel->getDocumentConfig(); |
464
|
|
|
Context::set('thumbnail_type', $config->thumbnail_type); |
465
|
|
|
|
466
|
|
|
|
467
|
|
|
$oModuleModel = getModel('module'); |
468
|
|
|
$config = $oModuleModel->getModuleConfig('module'); |
469
|
|
|
Context::set('siteTitle', $config->siteTitle); |
470
|
|
|
Context::set('htmlFooter', htmlspecialchars($config->htmlFooter)); |
471
|
|
|
|
472
|
|
|
// embed filter |
473
|
|
|
require_once(_XE_PATH_ . 'classes/security/EmbedFilter.class.php'); |
474
|
|
|
$oEmbedFilter = EmbedFilter::getInstance(); |
475
|
|
|
context::set('embed_white_object', implode(PHP_EOL, $oEmbedFilter->whiteUrlList)); |
476
|
|
|
context::set('embed_white_iframe', implode(PHP_EOL, $oEmbedFilter->whiteIframeUrlList)); |
477
|
|
|
|
478
|
|
|
$columnList = array('modules.mid', 'modules.browser_title', 'sites.index_module_srl'); |
479
|
|
|
$start_module = $oModuleModel->getSiteInfo(0, $columnList); |
480
|
|
|
Context::set('start_module', $start_module); |
481
|
|
|
|
482
|
|
|
Context::set('pwd', $pwd); |
|
|
|
|
483
|
|
|
$this->setTemplateFile('config_general'); |
484
|
|
|
|
485
|
|
|
$security = new Security(); |
486
|
|
|
$security->encodeHTML('news..', 'released_version', 'download_link', 'selected_lang', 'module_list..', 'module_list..author..', 'addon_list..', 'addon_list..author..', 'start_module.'); |
487
|
|
|
} |
488
|
|
|
|
489
|
|
|
/** |
490
|
|
|
* Display FTP Configuration(settings) page |
491
|
|
|
* @return void |
492
|
|
|
*/ |
493
|
|
|
function dispAdminConfigFtp() |
494
|
|
|
{ |
495
|
|
|
Context::loadLang('modules/install/lang'); |
496
|
|
|
|
497
|
|
|
$ftp_info = Context::getFTPInfo(); |
498
|
|
|
Context::set('ftp_info', $ftp_info); |
|
|
|
|
499
|
|
|
Context::set('sftp_support', function_exists(ssh2_sftp)); |
|
|
|
|
500
|
|
|
|
501
|
|
|
$this->setTemplateFile('config_ftp'); |
502
|
|
|
|
503
|
|
|
//$security = new Security(); |
504
|
|
|
//$security->encodeHTML('ftp_info..'); |
505
|
|
|
} |
506
|
|
|
|
507
|
|
|
/** |
508
|
|
|
* Display Admin Menu Configuration(settings) page |
509
|
|
|
* @return void |
510
|
|
|
*/ |
511
|
|
|
function dispAdminSetup() |
512
|
|
|
{ |
513
|
|
|
$oModuleModel = getModel('module'); |
514
|
|
|
$configObject = $oModuleModel->getModuleConfig('admin'); |
515
|
|
|
|
516
|
|
|
$oAdmin = getClass('admin'); |
517
|
|
|
$oMenuAdminModel = getAdminModel('menu'); |
518
|
|
|
$output = $oMenuAdminModel->getMenuByTitle($oAdmin->getAdminMenuName()); |
519
|
|
|
|
520
|
|
|
Context::set('menu_srl', $output->menu_srl); |
521
|
|
|
Context::set('menu_title', $output->title); |
522
|
|
|
Context::set('config_object', $configObject); |
523
|
|
|
$this->setTemplateFile('admin_setup'); |
524
|
|
|
} |
525
|
|
|
|
526
|
|
|
/** |
527
|
|
|
* Enviroment information send to XE collect server |
528
|
|
|
* @return void |
529
|
|
|
*/ |
530
|
|
|
function showSendEnv() |
531
|
|
|
{ |
532
|
|
|
if(Context::getResponseMethod() != 'HTML') |
533
|
|
|
{ |
534
|
|
|
return; |
535
|
|
|
} |
536
|
|
|
|
537
|
|
|
$server = 'http://collect.xpressengine.com/env/img.php?'; |
538
|
|
|
$path = './files/env/'; |
539
|
|
|
$install_env = $path . 'install'; |
540
|
|
|
$mainVersion = join('.', array_slice(explode('.', __XE_VERSION__), 0, 2)); |
541
|
|
|
|
542
|
|
|
if(file_exists(FileHandler::getRealPath($install_env))) |
543
|
|
|
{ |
544
|
|
|
$oAdminAdminModel = getAdminModel('admin'); |
545
|
|
|
$params = $oAdminAdminModel->getEnv('INSTALL'); |
546
|
|
|
$img = sprintf('<img src="%s" alt="" style="height:0px;width:0px" />', $server . $params); |
547
|
|
|
Context::addHtmlFooter($img); |
548
|
|
|
|
549
|
|
|
FileHandler::writeFile($path . $mainVersion, '1'); |
550
|
|
|
} |
551
|
|
|
else if(isset($_SESSION['enviroment_gather']) && !file_exists(FileHandler::getRealPath($path . $mainVersion))) |
552
|
|
|
{ |
553
|
|
|
if($_SESSION['enviroment_gather'] == 'Y') |
554
|
|
|
{ |
555
|
|
|
$oAdminAdminModel = getAdminModel('admin'); |
556
|
|
|
$params = $oAdminAdminModel->getEnv(); |
557
|
|
|
$img = sprintf('<img src="%s" alt="" style="height:0px;width:0px" />', $server . $params); |
558
|
|
|
Context::addHtmlFooter($img); |
559
|
|
|
} |
560
|
|
|
|
561
|
|
|
FileHandler::writeFile($path . $mainVersion, '1'); |
562
|
|
|
unset($_SESSION['enviroment_gather']); |
563
|
|
|
} |
564
|
|
|
} |
565
|
|
|
|
566
|
|
|
/** |
567
|
|
|
* Retrun server environment to XML string |
568
|
|
|
* @return object |
569
|
|
|
*/ |
570
|
|
|
function dispAdminViewServerEnv() |
571
|
|
|
{ |
572
|
|
|
$info = array(); |
573
|
|
|
|
574
|
|
|
$oAdminModel = getAdminModel('admin'); |
575
|
|
|
$envInfo = $oAdminModel->getEnv(); |
576
|
|
|
$tmp = explode("&", $envInfo); |
577
|
|
|
$arrInfo = array(); |
|
|
|
|
578
|
|
|
$xe_check_env = array(); |
579
|
|
|
foreach($tmp as $value) { |
580
|
|
|
$arr = explode("=", $value); |
581
|
|
|
if($arr[0]=="type") { |
582
|
|
|
continue; |
583
|
|
|
}elseif($arr[0]=="phpext" ) { |
584
|
|
|
$str = urldecode($arr[1]); |
585
|
|
|
$xe_check_env[$arr[0]]= str_replace("|", ", ", $str); |
586
|
|
View Code Duplication |
} elseif($arr[0]=="module" ) { |
587
|
|
|
$str = urldecode($arr[1]); |
588
|
|
|
$arrModuleName = explode("|", $str); |
589
|
|
|
$oModuleModel = getModel("module"); |
590
|
|
|
$mInfo = array(); |
591
|
|
|
foreach($arrModuleName as $moduleName) { |
592
|
|
|
$moduleInfo = $oModuleModel->getModuleInfoXml($moduleName); |
593
|
|
|
$mInfo[] = "{$moduleName}({$moduleInfo->version})"; |
594
|
|
|
} |
595
|
|
|
$xe_check_env[$arr[0]]= join(", ", $mInfo); |
596
|
|
|
} elseif($arr[0]=="addon") { |
597
|
|
|
$str = urldecode($arr[1]); |
598
|
|
|
$arrAddonName = explode("|", $str); |
599
|
|
|
$oAddonModel = getAdminModel("addon"); |
600
|
|
|
$mInfo = array(); |
601
|
|
|
foreach($arrAddonName as $addonName) { |
602
|
|
|
$addonInfo = $oAddonModel->getAddonInfoXml($addonName); |
603
|
|
|
$mInfo[] = "{$addonName}({$addonInfo->version})"; |
604
|
|
|
} |
605
|
|
|
$xe_check_env[$arr[0]]= join(", ", $mInfo); |
606
|
|
View Code Duplication |
} elseif($arr[0]=="widget") { |
607
|
|
|
$str = urldecode($arr[1]); |
608
|
|
|
$arrWidgetName = explode("|", $str); |
609
|
|
|
$oWidgetModel = getModel("widget"); |
610
|
|
|
$mInfo = array(); |
611
|
|
|
foreach($arrWidgetName as $widgetName) { |
612
|
|
|
$widgetInfo = $oWidgetModel->getWidgetInfo($widgetName); |
613
|
|
|
$mInfo[] = "{$widgetName}({$widgetInfo->version})"; |
614
|
|
|
} |
615
|
|
|
$xe_check_env[$arr[0]]= join(", ", $mInfo); |
616
|
|
|
} elseif($arr[0]=="widgetstyle") { |
617
|
|
|
$str = urldecode($arr[1]); |
618
|
|
|
$arrWidgetstyleName = explode("|", $str); |
619
|
|
|
$oWidgetModel = getModel("widget"); |
620
|
|
|
$mInfo = array(); |
621
|
|
|
foreach($arrWidgetstyleName as $widgetstyleName) { |
622
|
|
|
$widgetstyleInfo = $oWidgetModel->getWidgetStyleInfo($widgetstyleName); |
623
|
|
|
$mInfo[] = "{$widgetstyleName}({$widgetstyleInfo->version})"; |
624
|
|
|
} |
625
|
|
|
$xe_check_env[$arr[0]]= join(", ", $mInfo); |
626
|
|
|
|
627
|
|
View Code Duplication |
} elseif($arr[0]=="layout") { |
628
|
|
|
$str = urldecode($arr[1]); |
629
|
|
|
$arrLayoutName = explode("|", $str); |
630
|
|
|
$oLayoutModel = getModel("layout"); |
631
|
|
|
$mInfo = array(); |
632
|
|
|
foreach($arrLayoutName as $layoutName) { |
633
|
|
|
$layoutInfo = $oLayoutModel->getLayoutInfo($layoutName); |
634
|
|
|
$mInfo[] = "{$layoutName}({$layoutInfo->version})"; |
635
|
|
|
} |
636
|
|
|
$xe_check_env[$arr[0]]= join(", ", $mInfo); |
637
|
|
|
} else { |
638
|
|
|
$xe_check_env[$arr[0]] = urldecode($arr[1]); |
639
|
|
|
} |
640
|
|
|
} |
641
|
|
|
$info['XE_Check_Evn'] = $xe_check_env; |
642
|
|
|
|
643
|
|
|
$ini_info = ini_get_all(); |
644
|
|
|
$php_core = array(); |
645
|
|
|
$php_core['max_file_uploads'] = "{$ini_info['max_file_uploads']['local_value']}"; |
646
|
|
|
$php_core['post_max_size'] = "{$ini_info['post_max_size']['local_value']}"; |
647
|
|
|
$php_core['memory_limit'] = "{$ini_info['memory_limit']['local_value']}"; |
648
|
|
|
$info['PHP_Core'] = $php_core; |
649
|
|
|
|
650
|
|
|
$str_info = "[XE Server Environment " . date("Y-m-d") . "]\n\n"; |
651
|
|
|
$str_info .= "realpath : ".realpath('./')."\n"; |
652
|
|
|
foreach( $info as $key=>$value ) |
653
|
|
|
{ |
654
|
|
|
if( is_array( $value ) == false ) { |
|
|
|
|
655
|
|
|
$str_info .= "{$key} : {$value}\n"; |
656
|
|
|
} else { |
657
|
|
|
//$str_info .= "\n{$key} \n"; |
658
|
|
|
foreach( $value as $key2=>$value2 ) |
659
|
|
|
$str_info .= "{$key2} : {$value2}\n"; |
660
|
|
|
} |
661
|
|
|
} |
662
|
|
|
|
663
|
|
|
Context::set('str_info', $str_info); |
664
|
|
|
$this->setTemplateFile('server_env.html'); |
665
|
|
|
} |
666
|
|
|
|
667
|
|
View Code Duplication |
function dispAdminCheckServerEnv() |
|
|
|
|
668
|
|
|
{ |
669
|
|
|
$oInstallController = getController('install'); |
670
|
|
|
$useRewrite = $oInstallController->checkRewriteUsable() ? 'Y' : 'N'; |
671
|
|
|
$_SESSION['use_rewrite'] = $useRewrite; |
672
|
|
|
Context::set('use_rewrite', $useRewrite); |
673
|
|
|
|
674
|
|
|
// nginx 체크, rewrite 사용법 안내 |
675
|
|
|
if($useRewrite == 'N' && stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false) Context::set('use_nginx', 'Y'); |
676
|
|
|
|
677
|
|
|
Context::set('useable', $oInstallController->checkInstallEnv()); |
678
|
|
|
$this->setTemplateFile('check_env.html'); |
679
|
|
|
} |
680
|
|
|
|
681
|
|
|
} |
682
|
|
|
/* End of file admin.admin.view.php */ |
683
|
|
|
/* Location: ./modules/admin/admin.admin.view.php */ |
684
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: