|
1
|
|
|
<?php |
|
2
|
|
|
/* Copyright (C) NAVER <http://www.navercorp.com> */ |
|
3
|
|
|
|
|
4
|
|
|
/** |
|
5
|
|
|
* adminAdminModel class |
|
6
|
|
|
* admin model class of admin module |
|
7
|
|
|
* @author NAVER ([email protected]) |
|
8
|
|
|
* @package /modules/admin |
|
9
|
|
|
* @version 0.1 |
|
10
|
|
|
*/ |
|
11
|
|
|
class adminAdminModel extends admin |
|
12
|
|
|
{ |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* Ftp root path |
|
16
|
|
|
* @var string |
|
17
|
|
|
*/ |
|
18
|
|
|
var $pwd; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* Buffer for Admin GNB menu |
|
22
|
|
|
* @var string |
|
23
|
|
|
*/ |
|
24
|
|
|
var $gnbLangBuffer; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* Find XE installed path on sftp |
|
28
|
|
|
*/ |
|
29
|
|
|
function getSFTPPath() |
|
30
|
|
|
{ |
|
31
|
|
|
$ftp_info = Context::getRequestVars(); |
|
32
|
|
|
|
|
33
|
|
|
if(!$ftp_info->ftp_host) |
|
34
|
|
|
{ |
|
35
|
|
|
$ftp_info->ftp_host = "127.0.0.1"; |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
if(!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port)) |
|
39
|
|
|
{ |
|
40
|
|
|
$ftp_info->ftp_port = '22'; |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
$connection = ssh2_connect($ftp_info->ftp_host, $ftp_info->ftp_port); |
|
44
|
|
|
if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
45
|
|
|
{ |
|
46
|
|
|
return new Object(-1, 'msg_ftp_invalid_auth_info'); |
|
47
|
|
|
} |
|
48
|
|
|
$sftp = ssh2_sftp($connection); |
|
49
|
|
|
|
|
50
|
|
|
// create temp file |
|
51
|
|
|
$pin = $_SERVER['REQUEST_TIME']; |
|
52
|
|
|
FileHandler::writeFile('./files/cache/ftp_check', $pin); |
|
53
|
|
|
|
|
54
|
|
|
// create path candidate |
|
55
|
|
|
$xe_path = _XE_PATH_; |
|
|
|
|
|
|
56
|
|
|
$path_info = array_reverse(explode('/', _XE_PATH_)); |
|
57
|
|
|
array_pop($path_info); // remove last '/' |
|
58
|
|
|
$path_candidate = array(); |
|
59
|
|
|
|
|
60
|
|
|
$temp = ''; |
|
61
|
|
|
foreach($path_info as $path) |
|
62
|
|
|
{ |
|
63
|
|
|
$temp = '/' . $path . $temp; |
|
64
|
|
|
$path_candidate[] = $temp; |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
// try |
|
68
|
|
View Code Duplication |
foreach($path_candidate as $path) |
|
69
|
|
|
{ |
|
70
|
|
|
// upload check file |
|
71
|
|
|
if(!@ssh2_scp_send($connection, FileHandler::getRealPath('./files/cache/ftp_check'), $path . 'ftp_check.html')) |
|
72
|
|
|
{ |
|
73
|
|
|
continue; |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
// get check file |
|
77
|
|
|
$result = FileHandler::getRemoteResource(getNotencodedFullUrl() . 'ftp_check.html'); |
|
78
|
|
|
|
|
79
|
|
|
// delete temp check file |
|
80
|
|
|
@ssh2_sftp_unlink($sftp, $path . 'ftp_check.html'); |
|
|
|
|
|
|
81
|
|
|
|
|
82
|
|
|
// found |
|
83
|
|
|
if($result == $pin) |
|
84
|
|
|
{ |
|
85
|
|
|
$found_path = $path; |
|
86
|
|
|
break; |
|
87
|
|
|
} |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
FileHandler::removeFile('./files/cache/ftp_check', $pin); |
|
|
|
|
|
|
91
|
|
|
|
|
92
|
|
|
if($found_path) |
|
93
|
|
|
{ |
|
94
|
|
|
$this->add('found_path', $found_path); |
|
|
|
|
|
|
95
|
|
|
} |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
function getFTPPath() |
|
99
|
|
|
{ |
|
100
|
|
|
$ftp_info = Context::getRequestVars(); |
|
101
|
|
|
|
|
102
|
|
|
if(!$ftp_info->ftp_host) |
|
103
|
|
|
{ |
|
104
|
|
|
$ftp_info->ftp_host = "127.0.0.1"; |
|
105
|
|
|
} |
|
106
|
|
|
|
|
107
|
|
|
if(!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port)) |
|
108
|
|
|
{ |
|
109
|
|
|
$ftp_info->ftp_port = '22'; |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
$connection = ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port); |
|
113
|
|
|
if(!$connection) |
|
114
|
|
|
{ |
|
115
|
|
|
return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), $ftp_host)); |
|
|
|
|
|
|
116
|
|
|
} |
|
117
|
|
|
|
|
118
|
|
|
$login_result = @ftp_login($connection, $ftp_info->ftp_user, $ftp_info->ftp_password); |
|
119
|
|
|
if(!$login_result) |
|
120
|
|
|
{ |
|
121
|
|
|
ftp_close($connection); |
|
122
|
|
|
return new Object(-1, 'msg_ftp_invalid_auth_info'); |
|
123
|
|
|
} |
|
124
|
|
|
|
|
125
|
|
|
// create temp file |
|
126
|
|
|
$pin = $_SERVER['REQUEST_TIME']; |
|
127
|
|
|
FileHandler::writeFile('./files/cache/ftp_check', $pin); |
|
128
|
|
|
|
|
129
|
|
|
// create path candidate |
|
130
|
|
|
$xe_path = _XE_PATH_; |
|
|
|
|
|
|
131
|
|
|
$path_info = array_reverse(explode('/', _XE_PATH_)); |
|
132
|
|
|
array_pop($path_info); // remove last '/' |
|
133
|
|
|
$path_candidate = array(); |
|
134
|
|
|
|
|
135
|
|
|
$temp = ''; |
|
136
|
|
|
foreach($path_info as $path) |
|
137
|
|
|
{ |
|
138
|
|
|
$temp = '/' . $path . $temp; |
|
139
|
|
|
$path_candidate[] = $temp; |
|
140
|
|
|
} |
|
141
|
|
|
|
|
142
|
|
|
// try |
|
143
|
|
View Code Duplication |
foreach($path_candidate as $path) |
|
144
|
|
|
{ |
|
145
|
|
|
// upload check file |
|
146
|
|
|
if(!ftp_put($connection, $path . 'ftp_check.html', FileHandler::getRealPath('./files/cache/ftp_check'), FTP_BINARY)) |
|
147
|
|
|
{ |
|
148
|
|
|
continue; |
|
149
|
|
|
} |
|
150
|
|
|
|
|
151
|
|
|
// get check file |
|
152
|
|
|
$result = FileHandler::getRemoteResource(getNotencodedFullUrl() . 'ftp_check.html'); |
|
153
|
|
|
|
|
154
|
|
|
// delete temp check file |
|
155
|
|
|
ftp_delete($connection, $path . 'ftp_check.html'); |
|
156
|
|
|
|
|
157
|
|
|
// found |
|
158
|
|
|
if($result == $pin) |
|
159
|
|
|
{ |
|
160
|
|
|
$found_path = $path; |
|
161
|
|
|
break; |
|
162
|
|
|
} |
|
163
|
|
|
} |
|
164
|
|
|
|
|
165
|
|
|
FileHandler::removeFile('./files/cache/ftp_check', $pin); |
|
|
|
|
|
|
166
|
|
|
|
|
167
|
|
|
if($found_path) |
|
168
|
|
|
{ |
|
169
|
|
|
$this->add('found_path', $found_path); |
|
|
|
|
|
|
170
|
|
|
} |
|
171
|
|
|
} |
|
172
|
|
|
|
|
173
|
|
|
/** |
|
174
|
|
|
* Find XE installed path on ftp |
|
175
|
|
|
*/ |
|
176
|
|
|
function getAdminFTPPath() |
|
177
|
|
|
{ |
|
178
|
|
|
Context::loadLang(_XE_PATH_ . 'modules/autoinstall/lang'); |
|
179
|
|
|
@set_time_limit(5); |
|
|
|
|
|
|
180
|
|
|
require_once(_XE_PATH_ . 'libs/ftp.class.php'); |
|
181
|
|
|
|
|
182
|
|
|
$ftp_info = Context::getRequestVars(); |
|
183
|
|
|
|
|
184
|
|
|
if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) |
|
185
|
|
|
{ |
|
186
|
|
|
return new Object(1, 'msg_ftp_invalid_auth_info'); |
|
187
|
|
|
} |
|
188
|
|
|
|
|
189
|
|
|
if(!$ftp_info->ftp_host) |
|
190
|
|
|
{ |
|
191
|
|
|
$ftp_info->ftp_host = '127.0.0.1'; |
|
192
|
|
|
} |
|
193
|
|
|
|
|
194
|
|
|
if(!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port)) |
|
195
|
|
|
{ |
|
196
|
|
|
$ftp_info->ftp_port = '21'; |
|
197
|
|
|
} |
|
198
|
|
|
|
|
199
|
|
View Code Duplication |
if($ftp_info->sftp == 'Y') |
|
200
|
|
|
{ |
|
201
|
|
|
if(!function_exists('ssh2_sftp')) |
|
202
|
|
|
{ |
|
203
|
|
|
return new Object(-1, 'disable_sftp_support'); |
|
204
|
|
|
} |
|
205
|
|
|
return $this->getSFTPPath(); |
|
206
|
|
|
} |
|
207
|
|
|
|
|
208
|
|
|
if($ftp_info->ftp_pasv == 'N') |
|
209
|
|
|
{ |
|
210
|
|
|
if(function_exists('ftp_connect')) |
|
211
|
|
|
{ |
|
212
|
|
|
return $this->getFTPPath(); |
|
213
|
|
|
} |
|
214
|
|
|
$ftp_info->ftp_pasv = "Y"; |
|
215
|
|
|
} |
|
216
|
|
|
|
|
217
|
|
|
$oFTP = new ftp(); |
|
218
|
|
View Code Duplication |
if(!$oFTP->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) |
|
219
|
|
|
{ |
|
220
|
|
|
return new Object(1, sprintf(Context::getLang('msg_ftp_not_connected'), $ftp_info->ftp_host)); |
|
221
|
|
|
} |
|
222
|
|
|
|
|
223
|
|
|
if(!$oFTP->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
224
|
|
|
{ |
|
225
|
|
|
return new Object(1, 'msg_ftp_invalid_auth_info'); |
|
226
|
|
|
} |
|
227
|
|
|
|
|
228
|
|
|
// create temp file |
|
229
|
|
|
$pin = $_SERVER['REQUEST_TIME']; |
|
230
|
|
|
FileHandler::writeFile('./files/cache/ftp_check', $pin); |
|
231
|
|
|
|
|
232
|
|
|
// create path candidate |
|
233
|
|
|
$xe_path = _XE_PATH_; |
|
|
|
|
|
|
234
|
|
|
$path_info = array_reverse(explode('/', _XE_PATH_)); |
|
235
|
|
|
array_pop($path_info); // remove last '/' |
|
236
|
|
|
$path_candidate = array(); |
|
237
|
|
|
|
|
238
|
|
|
$temp = ''; |
|
239
|
|
|
foreach($path_info as $path) |
|
240
|
|
|
{ |
|
241
|
|
|
$temp = '/' . $path . $temp; |
|
242
|
|
|
$path_candidate[] = $temp; |
|
243
|
|
|
} |
|
244
|
|
|
|
|
245
|
|
|
// try |
|
246
|
|
|
foreach($path_candidate as $path) |
|
247
|
|
|
{ |
|
248
|
|
|
// upload check file |
|
249
|
|
|
if(!$oFTP->ftp_put($path . 'ftp_check.html', FileHandler::getRealPath('./files/cache/ftp_check'))) |
|
250
|
|
|
{ |
|
251
|
|
|
continue; |
|
252
|
|
|
} |
|
253
|
|
|
|
|
254
|
|
|
// get check file |
|
255
|
|
|
$result = FileHandler::getRemoteResource(getNotencodedFullUrl() . 'ftp_check.html'); |
|
256
|
|
|
|
|
257
|
|
|
// delete temp check file |
|
258
|
|
|
$oFTP->ftp_delete($path . 'ftp_check.html'); |
|
259
|
|
|
|
|
260
|
|
|
// found |
|
261
|
|
|
if($result == $pin) |
|
262
|
|
|
{ |
|
263
|
|
|
$found_path = $path; |
|
264
|
|
|
break; |
|
265
|
|
|
} |
|
266
|
|
|
} |
|
267
|
|
|
|
|
268
|
|
|
FileHandler::removeFile('./files/cache/ftp_check', $pin); |
|
|
|
|
|
|
269
|
|
|
|
|
270
|
|
|
if($found_path) |
|
271
|
|
|
{ |
|
272
|
|
|
$this->add('found_path', $found_path); |
|
|
|
|
|
|
273
|
|
|
} |
|
274
|
|
|
} |
|
275
|
|
|
|
|
276
|
|
|
/** |
|
277
|
|
|
* Add file list to Object after sftp connect |
|
278
|
|
|
* @return void|Object |
|
279
|
|
|
*/ |
|
280
|
|
View Code Duplication |
function getSFTPList() |
|
|
|
|
|
|
281
|
|
|
{ |
|
282
|
|
|
$ftp_info = Context::getRequestVars(); |
|
283
|
|
|
if(!$ftp_info->ftp_host) |
|
284
|
|
|
{ |
|
285
|
|
|
$ftp_info->ftp_host = "127.0.0.1"; |
|
286
|
|
|
} |
|
287
|
|
|
$connection = ssh2_connect($ftp_info->ftp_host, $ftp_info->ftp_port); |
|
288
|
|
|
if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
289
|
|
|
{ |
|
290
|
|
|
return new Object(-1, 'msg_ftp_invalid_auth_info'); |
|
291
|
|
|
} |
|
292
|
|
|
|
|
293
|
|
|
$sftp = ssh2_sftp($connection); |
|
294
|
|
|
$curpwd = "ssh2.sftp://$sftp" . $this->pwd; |
|
295
|
|
|
$dh = @opendir($curpwd); |
|
296
|
|
|
if(!$dh) |
|
297
|
|
|
{ |
|
298
|
|
|
return new Object(-1, 'msg_ftp_invalid_path'); |
|
299
|
|
|
} |
|
300
|
|
|
$list = array(); |
|
301
|
|
|
while(($file = readdir($dh)) !== FALSE) |
|
302
|
|
|
{ |
|
303
|
|
|
if(is_dir($curpwd . $file)) |
|
304
|
|
|
{ |
|
305
|
|
|
$file .= "/"; |
|
306
|
|
|
} |
|
307
|
|
|
else |
|
308
|
|
|
{ |
|
309
|
|
|
continue; |
|
310
|
|
|
} |
|
311
|
|
|
$list[] = $file; |
|
312
|
|
|
} |
|
313
|
|
|
closedir($dh); |
|
314
|
|
|
$this->add('list', $list); |
|
315
|
|
|
} |
|
316
|
|
|
|
|
317
|
|
|
/** |
|
318
|
|
|
* Add file list to Object after ftp connect |
|
319
|
|
|
* @return void|Object |
|
320
|
|
|
*/ |
|
321
|
|
|
function getAdminFTPList() |
|
322
|
|
|
{ |
|
323
|
|
|
Context::loadLang(_XE_PATH_ . 'modules/autoinstall/lang'); |
|
324
|
|
|
@set_time_limit(5); |
|
|
|
|
|
|
325
|
|
|
|
|
326
|
|
|
require_once(_XE_PATH_ . 'libs/ftp.class.php'); |
|
327
|
|
|
|
|
328
|
|
|
$ftp_info = Context::getRequestVars(); |
|
329
|
|
|
if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) |
|
330
|
|
|
{ |
|
331
|
|
|
return new Object(-1, 'msg_ftp_invalid_auth_info'); |
|
332
|
|
|
} |
|
333
|
|
|
|
|
334
|
|
|
$this->pwd = $ftp_info->ftp_root_path; |
|
335
|
|
|
|
|
336
|
|
|
if(!$ftp_info->ftp_host) |
|
337
|
|
|
{ |
|
338
|
|
|
$ftp_info->ftp_host = "127.0.0.1"; |
|
339
|
|
|
} |
|
340
|
|
|
|
|
341
|
|
|
if(!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port)) |
|
342
|
|
|
{ |
|
343
|
|
|
$ftp_info->ftp_port = "21"; |
|
344
|
|
|
} |
|
345
|
|
|
|
|
346
|
|
View Code Duplication |
if($ftp_info->sftp == 'Y') |
|
347
|
|
|
{ |
|
348
|
|
|
if(!function_exists('ssh2_sftp')) |
|
349
|
|
|
{ |
|
350
|
|
|
return new Object(-1, 'disable_sftp_support'); |
|
351
|
|
|
} |
|
352
|
|
|
return $this->getSFTPList(); |
|
353
|
|
|
} |
|
354
|
|
|
|
|
355
|
|
|
$oFtp = new ftp(); |
|
356
|
|
View Code Duplication |
if($oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) |
|
357
|
|
|
{ |
|
358
|
|
|
if($oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
359
|
|
|
{ |
|
360
|
|
|
$_list = $oFtp->ftp_rawlist($this->pwd); |
|
361
|
|
|
$oFtp->ftp_quit(); |
|
362
|
|
|
} |
|
363
|
|
|
else |
|
364
|
|
|
{ |
|
365
|
|
|
return new Object(-1, 'msg_ftp_invalid_auth_info'); |
|
366
|
|
|
} |
|
367
|
|
|
} |
|
368
|
|
|
$list = array(); |
|
369
|
|
|
|
|
370
|
|
View Code Duplication |
if($_list) |
|
371
|
|
|
{ |
|
372
|
|
|
foreach($_list as $k => $v) |
|
|
|
|
|
|
373
|
|
|
{ |
|
374
|
|
|
$src = new stdClass(); |
|
375
|
|
|
$src->data = $v; |
|
376
|
|
|
$res = Context::convertEncoding($src); |
|
377
|
|
|
$v = $res->data; |
|
378
|
|
|
if(strpos($v, 'd') === 0 || strpos($v, '<DIR>')) |
|
379
|
|
|
{ |
|
380
|
|
|
$list[] = substr(strrchr($v, ' '), 1) . '/'; |
|
381
|
|
|
} |
|
382
|
|
|
} |
|
383
|
|
|
} |
|
384
|
|
|
else |
|
385
|
|
|
{ |
|
386
|
|
|
return new Object(-1, 'msg_ftp_no_directory'); |
|
387
|
|
|
} |
|
388
|
|
|
$this->add('list', $list); |
|
389
|
|
|
} |
|
390
|
|
|
|
|
391
|
|
|
/** |
|
392
|
|
|
* Parameter arrange for send to XE collect server |
|
393
|
|
|
* @param string $type 'WORKING', 'INSTALL' |
|
394
|
|
|
* @return string |
|
395
|
|
|
*/ |
|
396
|
|
|
function getEnv($type = 'WORKING') |
|
397
|
|
|
{ |
|
398
|
|
|
$skip = array( |
|
399
|
|
|
'ext' => array('pcre', 'json', 'hash', 'dom', 'session', 'spl', 'standard', 'date', 'ctype', 'tokenizer', 'apache2handler', 'filter', 'posix', 'reflection', 'pdo') |
|
400
|
|
|
, 'module' => array('addon', 'admin', 'autoinstall', 'comment', 'communication', 'counter', 'document', 'editor', 'file', 'importer', 'install', 'integration_search', 'layout', 'member', 'menu', 'message', 'module', 'opage', 'page', 'point', 'poll', 'rss', 'session', 'spamfilter', 'tag', 'trackback', 'trash', 'widget') |
|
401
|
|
|
, 'addon' => array('autolink', 'blogapi', 'captcha', 'counter', 'member_communication', 'member_extra_info', 'mobile', 'openid_delegation_id', 'point_level_icon', 'resize_image') |
|
402
|
|
|
, 'layout' => array('default') |
|
403
|
|
|
, 'widget' => array('content', 'language_select', 'login_info','mcontent') |
|
404
|
|
|
, 'widgetstyle' => array(), |
|
405
|
|
|
); |
|
406
|
|
|
$info = array(); |
|
407
|
|
|
$db_info = Context::getDBInfo(); |
|
408
|
|
|
|
|
409
|
|
|
$info['type'] = ($type != 'INSTALL' ? 'WORKING' : 'INSTALL'); |
|
410
|
|
|
$info['location'] = _XE_LOCATION_; |
|
411
|
|
|
$info['package'] = _XE_PACKAGE_; |
|
412
|
|
|
$info['host'] = $db_type->default_url ? $db_type->default_url : getFullUrl(); |
|
|
|
|
|
|
413
|
|
|
$info['app'] = $_SERVER['SERVER_SOFTWARE']; |
|
414
|
|
|
$info['xe_version'] = __XE_VERSION__; |
|
415
|
|
|
$info['php'] = phpversion(); |
|
416
|
|
|
|
|
417
|
|
|
$info['db_type'] = Context::getDBType(); |
|
418
|
|
|
$info['use_rewrite'] = $db_info->use_rewrite; |
|
419
|
|
|
$info['use_db_session'] = $db_info->use_db_session == 'Y' ? 'Y' : 'N'; |
|
420
|
|
|
$info['use_ssl'] = $db_info->use_ssl; |
|
421
|
|
|
|
|
422
|
|
|
$info['phpext'] = ''; |
|
423
|
|
|
foreach(get_loaded_extensions() as $ext) |
|
424
|
|
|
{ |
|
425
|
|
|
$ext = strtolower($ext); |
|
426
|
|
|
if(in_array($ext, $skip['ext'])) |
|
427
|
|
|
{ |
|
428
|
|
|
continue; |
|
429
|
|
|
} |
|
430
|
|
|
$info['phpext'] .= '|' . $ext; |
|
431
|
|
|
} |
|
432
|
|
|
$info['phpext'] = substr($info['phpext'], 1); |
|
433
|
|
|
|
|
434
|
|
|
$info['module'] = ''; |
|
435
|
|
|
$oModuleModel = getModel('module'); |
|
436
|
|
|
$module_list = $oModuleModel->getModuleList(); |
|
437
|
|
|
if($module_list) foreach($module_list as $module) |
|
438
|
|
|
{ |
|
439
|
|
|
if(in_array($module->module, $skip['module'])) |
|
440
|
|
|
{ |
|
441
|
|
|
continue; |
|
442
|
|
|
} |
|
443
|
|
|
$info['module'] .= '|' . $module->module; |
|
444
|
|
|
} |
|
445
|
|
|
$info['module'] = substr($info['module'], 1); |
|
446
|
|
|
|
|
447
|
|
|
$info['addon'] = ''; |
|
448
|
|
|
$oAddonAdminModel = getAdminModel('addon'); |
|
449
|
|
|
$addon_list = $oAddonAdminModel->getAddonList(); |
|
450
|
|
|
if($addon_list) foreach($addon_list as $addon) |
|
451
|
|
|
{ |
|
452
|
|
|
if(in_array($addon->addon, $skip['addon'])) |
|
453
|
|
|
{ |
|
454
|
|
|
continue; |
|
455
|
|
|
} |
|
456
|
|
|
$info['addon'] .= '|' . $addon->addon; |
|
457
|
|
|
} |
|
458
|
|
|
$info['addon'] = substr($info['addon'], 1); |
|
459
|
|
|
|
|
460
|
|
|
$info['layout'] = ""; |
|
461
|
|
|
$oLayoutModel = getModel('layout'); |
|
462
|
|
|
$layout_list = $oLayoutModel->getDownloadedLayoutList(); |
|
463
|
|
|
if($layout_list) foreach($layout_list as $layout) |
|
464
|
|
|
{ |
|
465
|
|
|
if(in_array($layout->layout, $skip['layout'])) |
|
466
|
|
|
{ |
|
467
|
|
|
continue; |
|
468
|
|
|
} |
|
469
|
|
|
$info['layout'] .= '|' . $layout->layout; |
|
470
|
|
|
} |
|
471
|
|
|
$info['layout'] = substr($info['layout'], 1); |
|
472
|
|
|
|
|
473
|
|
|
$info['widget'] = ""; |
|
474
|
|
|
$oWidgetModel = getModel('widget'); |
|
475
|
|
|
$widget_list = $oWidgetModel->getDownloadedWidgetList(); |
|
476
|
|
|
if($widget_list) foreach($widget_list as $widget) |
|
477
|
|
|
{ |
|
478
|
|
|
if(in_array($widget->widget, $skip['widget'])) |
|
479
|
|
|
{ |
|
480
|
|
|
continue; |
|
481
|
|
|
} |
|
482
|
|
|
$info['widget'] .= '|' . $widget->widget; |
|
483
|
|
|
} |
|
484
|
|
|
$info['widget'] = substr($info['widget'], 1); |
|
485
|
|
|
|
|
486
|
|
|
$info['widgetstyle'] = ""; |
|
487
|
|
|
$oWidgetModel = getModel('widget'); |
|
488
|
|
|
$widgetstyle_list = $oWidgetModel->getDownloadedWidgetStyleList(); |
|
489
|
|
|
if($widgetstyle_list) foreach($widgetstyle_list as $widgetstyle) |
|
490
|
|
|
{ |
|
491
|
|
|
if(in_array($widgetstyle->widgetStyle, $skip['widgetstyle'])) |
|
492
|
|
|
{ |
|
493
|
|
|
continue; |
|
494
|
|
|
} |
|
495
|
|
|
$info['widgetstyle'] .= '|' . $widgetstyle->widgetStyle; |
|
496
|
|
|
} |
|
497
|
|
|
$info['widgetstyle'] = substr($info['widgetstyle'], 1); |
|
498
|
|
|
|
|
499
|
|
|
$param = ''; |
|
500
|
|
|
foreach($info as $k => $v) |
|
501
|
|
|
{ |
|
502
|
|
|
if($v) |
|
503
|
|
|
{ |
|
504
|
|
|
$param .= sprintf('&%s=%s', $k, urlencode($v)); |
|
505
|
|
|
} |
|
506
|
|
|
} |
|
507
|
|
|
$param = substr($param, 1); |
|
508
|
|
|
|
|
509
|
|
|
return $param; |
|
510
|
|
|
} |
|
511
|
|
|
|
|
512
|
|
|
/** |
|
513
|
|
|
* Return theme info list by theme directory list |
|
514
|
|
|
* @return array |
|
515
|
|
|
*/ |
|
516
|
|
|
function getThemeList() |
|
517
|
|
|
{ |
|
518
|
|
|
$path = _XE_PATH_ . 'themes'; |
|
519
|
|
|
$list = FileHandler::readDir($path); |
|
520
|
|
|
|
|
521
|
|
|
$theme_info = array(); |
|
522
|
|
|
if(count($list) > 0) |
|
523
|
|
|
{ |
|
524
|
|
|
foreach($list as $val) |
|
525
|
|
|
{ |
|
526
|
|
|
$theme_info[$val] = $this->getThemeInfo($val); |
|
527
|
|
|
} |
|
528
|
|
|
} |
|
529
|
|
|
|
|
530
|
|
|
return $theme_info; |
|
531
|
|
|
} |
|
532
|
|
|
|
|
533
|
|
|
/** |
|
534
|
|
|
* Return theme info |
|
535
|
|
|
* @param string $theme_name |
|
536
|
|
|
* @param array $layout_list |
|
537
|
|
|
* @return object |
|
538
|
|
|
*/ |
|
539
|
|
|
function getThemeInfo($theme_name, $layout_list = NULL) |
|
|
|
|
|
|
540
|
|
|
{ |
|
541
|
|
|
if($GLOBALS['__ThemeInfo__'][$theme_name]) |
|
542
|
|
|
{ |
|
543
|
|
|
return $GLOBALS['__ThemeInfo__'][$theme_name]; |
|
544
|
|
|
} |
|
545
|
|
|
|
|
546
|
|
|
$info_file = _XE_PATH_ . 'themes/' . $theme_name . '/conf/info.xml'; |
|
547
|
|
|
if(!file_exists($info_file)) |
|
548
|
|
|
{ |
|
549
|
|
|
return; |
|
550
|
|
|
} |
|
551
|
|
|
|
|
552
|
|
|
$oXmlParser = new XmlParser(); |
|
553
|
|
|
$_xml_obj = $oXmlParser->loadXmlFile($info_file); |
|
554
|
|
|
if(!$_xml_obj->theme) |
|
555
|
|
|
{ |
|
556
|
|
|
return; |
|
557
|
|
|
} |
|
558
|
|
|
|
|
559
|
|
|
$xml_obj = $_xml_obj->theme; |
|
560
|
|
|
|
|
561
|
|
|
// 스킨이름 |
|
562
|
|
|
$theme_info = new stdClass(); |
|
563
|
|
|
$theme_info->name = $theme_name; |
|
564
|
|
|
$theme_info->title = $xml_obj->title->body; |
|
565
|
|
|
$thumbnail = './themes/' . $theme_name . '/thumbnail.png'; |
|
566
|
|
|
$theme_info->thumbnail = (FileHandler::exists($thumbnail)) ? $thumbnail : NULL; |
|
567
|
|
|
$theme_info->version = $xml_obj->version->body; |
|
568
|
|
|
$date_obj = new stdClass(); |
|
569
|
|
|
sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); |
|
570
|
|
|
$theme_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d); |
|
571
|
|
|
$theme_info->description = $xml_obj->description->body; |
|
572
|
|
|
$theme_info->path = './themes/' . $theme_name . '/'; |
|
573
|
|
|
|
|
574
|
|
|
if(!is_array($xml_obj->publisher)) |
|
575
|
|
|
{ |
|
576
|
|
|
$publisher_list = array(); |
|
577
|
|
|
$publisher_list[] = $xml_obj->publisher; |
|
578
|
|
|
} |
|
579
|
|
|
else |
|
580
|
|
|
{ |
|
581
|
|
|
$publisher_list = $xml_obj->publisher; |
|
582
|
|
|
} |
|
583
|
|
|
|
|
584
|
|
|
$theme_info->publisher = array(); |
|
585
|
|
View Code Duplication |
foreach($publisher_list as $publisher) |
|
586
|
|
|
{ |
|
587
|
|
|
$publisher_obj = new stdClass(); |
|
588
|
|
|
$publisher_obj->name = $publisher->name->body; |
|
589
|
|
|
$publisher_obj->email_address = $publisher->attrs->email_address; |
|
590
|
|
|
$publisher_obj->homepage = $publisher->attrs->link; |
|
591
|
|
|
$theme_info->publisher[] = $publisher_obj; |
|
592
|
|
|
} |
|
593
|
|
|
|
|
594
|
|
|
$layout = $xml_obj->layout; |
|
595
|
|
|
$layout_path = $layout->directory->attrs->path; |
|
596
|
|
|
$layout_parse = explode('/', $layout_path); |
|
597
|
|
|
$layout_info = new stdClass(); |
|
598
|
|
|
switch($layout_parse[1]) |
|
599
|
|
|
{ |
|
600
|
|
|
case 'themes' : |
|
601
|
|
|
$layout_info->name = $theme_name . '|@|' . $layout_parse[count($layout_parse) - 1]; |
|
602
|
|
|
break; |
|
603
|
|
|
|
|
604
|
|
|
case 'layouts' : |
|
605
|
|
|
$layout_info->name = $layout_parse[count($layout_parse) - 1]; |
|
606
|
|
|
break; |
|
607
|
|
|
|
|
608
|
|
|
} |
|
609
|
|
|
$layout_info->title = $layout_parse[count($layout_parse) - 1]; |
|
610
|
|
|
$layout_info->path = $layout_path; |
|
611
|
|
|
|
|
612
|
|
|
$site_info = Context::get('site_module_info'); |
|
613
|
|
|
// check layout instance |
|
614
|
|
|
$is_new_layout = TRUE; |
|
615
|
|
|
$oLayoutModel = getModel('layout'); |
|
616
|
|
|
$layout_info_list = array(); |
|
|
|
|
|
|
617
|
|
|
$layout_list = $oLayoutModel->getLayoutList($site_info->site_srl); |
|
618
|
|
|
if($layout_list) |
|
619
|
|
|
{ |
|
620
|
|
|
foreach($layout_list as $val) |
|
621
|
|
|
{ |
|
622
|
|
|
if($val->layout == $layout_info->name) |
|
623
|
|
|
{ |
|
624
|
|
|
$is_new_layout = FALSE; |
|
625
|
|
|
$layout_info->layout_srl = $val->layout_srl; |
|
626
|
|
|
break; |
|
627
|
|
|
} |
|
628
|
|
|
} |
|
629
|
|
|
} |
|
630
|
|
|
|
|
631
|
|
|
if($is_new_layout) |
|
632
|
|
|
{ |
|
633
|
|
|
$site_module_info = Context::get('site_module_info'); |
|
634
|
|
|
$args = new stdClass(); |
|
635
|
|
|
$args->site_srl = (int) $site_module_info->site_srl; |
|
636
|
|
|
$args->layout_srl = getNextSequence(); |
|
637
|
|
|
$args->layout = $layout_info->name; |
|
638
|
|
|
$args->title = $layout_info->title; |
|
639
|
|
|
$args->layout_type = "P"; |
|
640
|
|
|
// Insert into the DB |
|
641
|
|
|
$oLayoutAdminController = getAdminController('layout'); |
|
642
|
|
|
$output = $oLayoutAdminController->insertLayout($args); |
|
|
|
|
|
|
643
|
|
|
$layout_info->layout_srl = $args->layout_srl; |
|
644
|
|
|
} |
|
645
|
|
|
|
|
646
|
|
|
$theme_info->layout_info = $layout_info; |
|
647
|
|
|
|
|
648
|
|
|
$skin_infos = $xml_obj->skininfos; |
|
649
|
|
|
if(is_array($skin_infos->skininfo)) |
|
650
|
|
|
{ |
|
651
|
|
|
$skin_list = $skin_infos->skininfo; |
|
652
|
|
|
} |
|
653
|
|
|
else |
|
654
|
|
|
{ |
|
655
|
|
|
$skin_list = array($skin_infos->skininfo); |
|
656
|
|
|
} |
|
657
|
|
|
|
|
658
|
|
|
$oModuleModel = getModel('module'); |
|
659
|
|
|
$skins = array(); |
|
660
|
|
|
foreach($skin_list as $val) |
|
661
|
|
|
{ |
|
662
|
|
|
$skin_info = new stdClass(); |
|
663
|
|
|
unset($skin_parse); |
|
664
|
|
|
$skin_parse = explode('/', $val->directory->attrs->path); |
|
665
|
|
|
switch($skin_parse[1]) |
|
666
|
|
|
{ |
|
667
|
|
View Code Duplication |
case 'themes' : |
|
668
|
|
|
$is_theme = TRUE; |
|
669
|
|
|
$module_name = $skin_parse[count($skin_parse) - 1]; |
|
670
|
|
|
$skin_info->name = $theme_name . '|@|' . $module_name; |
|
671
|
|
|
break; |
|
672
|
|
|
|
|
673
|
|
View Code Duplication |
case 'modules' : |
|
674
|
|
|
$is_theme = FALSE; |
|
675
|
|
|
$module_name = $skin_parse[2]; |
|
676
|
|
|
$skin_info->name = $skin_parse[count($skin_parse) - 1]; |
|
677
|
|
|
break; |
|
678
|
|
|
|
|
679
|
|
|
} |
|
680
|
|
|
$skin_info->path = $val->directory->attrs->path; |
|
681
|
|
|
$skin_info->is_theme = $is_theme; |
|
|
|
|
|
|
682
|
|
|
$skins[$module_name] = $skin_info; |
|
|
|
|
|
|
683
|
|
|
|
|
684
|
|
|
if($is_theme) |
|
685
|
|
|
{ |
|
686
|
|
View Code Duplication |
if(!$GLOBALS['__ThemeModuleSkin__'][$module_name]) |
|
687
|
|
|
{ |
|
688
|
|
|
$GLOBALS['__ThemeModuleSkin__'][$module_name] = array(); |
|
689
|
|
|
$GLOBALS['__ThemeModuleSkin__'][$module_name]['skins'] = array(); |
|
690
|
|
|
$moduleInfo = $oModuleModel->getModuleInfoXml($module_name); |
|
691
|
|
|
$GLOBALS['__ThemeModuleSkin__'][$module_name]['title'] = $moduleInfo->title; |
|
692
|
|
|
} |
|
693
|
|
|
$GLOBALS['__ThemeModuleSkin__'][$module_name]['skins'][$skin_info->name] = $oModuleModel->loadSkinInfo($skin_info->path, '', ''); |
|
694
|
|
|
} |
|
695
|
|
|
} |
|
696
|
|
|
$theme_info->skin_infos = $skins; |
|
697
|
|
|
|
|
698
|
|
|
$GLOBALS['__ThemeInfo__'][$theme_name] = $theme_info; |
|
699
|
|
|
return $theme_info; |
|
700
|
|
|
} |
|
701
|
|
|
|
|
702
|
|
|
/** |
|
703
|
|
|
* Return theme module skin list |
|
704
|
|
|
* @return array |
|
705
|
|
|
*/ |
|
706
|
|
|
function getModulesSkinList() |
|
707
|
|
|
{ |
|
708
|
|
|
if($GLOBALS['__ThemeModuleSkin__']['__IS_PARSE__']) |
|
709
|
|
|
{ |
|
710
|
|
|
return $GLOBALS['__ThemeModuleSkin__']; |
|
711
|
|
|
} |
|
712
|
|
|
$searched_list = FileHandler::readDir('./modules'); |
|
713
|
|
|
sort($searched_list); |
|
714
|
|
|
|
|
715
|
|
|
$searched_count = count($searched_list); |
|
716
|
|
|
if(!$searched_count) |
|
717
|
|
|
{ |
|
718
|
|
|
return; |
|
719
|
|
|
} |
|
720
|
|
|
|
|
721
|
|
|
$exceptionModule = array('editor', 'poll', 'homepage', 'textyle'); |
|
722
|
|
|
|
|
723
|
|
|
$oModuleModel = getModel('module'); |
|
724
|
|
|
foreach($searched_list as $val) |
|
725
|
|
|
{ |
|
726
|
|
|
$skin_list = $oModuleModel->getSkins(_XE_PATH_ . 'modules/' . $val); |
|
727
|
|
|
|
|
728
|
|
|
if(is_array($skin_list) && count($skin_list) > 0 && !in_array($val, $exceptionModule)) |
|
729
|
|
|
{ |
|
730
|
|
View Code Duplication |
if(!$GLOBALS['__ThemeModuleSkin__'][$val]) |
|
731
|
|
|
{ |
|
732
|
|
|
$GLOBALS['__ThemeModuleSkin__'][$val] = array(); |
|
733
|
|
|
$moduleInfo = $oModuleModel->getModuleInfoXml($val); |
|
734
|
|
|
$GLOBALS['__ThemeModuleSkin__'][$val]['title'] = $moduleInfo->title; |
|
735
|
|
|
$GLOBALS['__ThemeModuleSkin__'][$val]['skins'] = array(); |
|
736
|
|
|
} |
|
737
|
|
|
$GLOBALS['__ThemeModuleSkin__'][$val]['skins'] = array_merge($GLOBALS['__ThemeModuleSkin__'][$val]['skins'], $skin_list); |
|
738
|
|
|
} |
|
739
|
|
|
} |
|
740
|
|
|
$GLOBALS['__ThemeModuleSkin__']['__IS_PARSE__'] = TRUE; |
|
741
|
|
|
|
|
742
|
|
|
return $GLOBALS['__ThemeModuleSkin__']; |
|
743
|
|
|
} |
|
744
|
|
|
|
|
745
|
|
|
/** |
|
746
|
|
|
* Return admin menu language |
|
747
|
|
|
* @return array |
|
748
|
|
|
*/ |
|
749
|
|
|
function getAdminMenuLang() |
|
750
|
|
|
{ |
|
751
|
|
|
$currentLang = Context::getLangType(); |
|
752
|
|
|
$cacheFile = sprintf('./files/cache/menu/admin_lang/adminMenu.%s.lang.php', $currentLang); |
|
753
|
|
|
|
|
754
|
|
|
// Update if no cache file exists or it is older than xml file |
|
755
|
|
|
if(!is_readable($cacheFile)) |
|
756
|
|
|
{ |
|
757
|
|
|
$lang = new stdClass(); |
|
758
|
|
|
$oModuleModel = getModel('module'); |
|
759
|
|
|
$installed_module_list = $oModuleModel->getModulesXmlInfo(); |
|
760
|
|
|
|
|
761
|
|
|
$this->gnbLangBuffer = '<?php $lang = new stdClass();'; |
|
762
|
|
|
foreach($installed_module_list AS $key => $value) |
|
763
|
|
|
{ |
|
764
|
|
|
$moduleActionInfo = $oModuleModel->getModuleActionXml($value->module); |
|
765
|
|
|
if(is_object($moduleActionInfo->menu)) |
|
766
|
|
|
{ |
|
767
|
|
|
foreach($moduleActionInfo->menu AS $key2 => $value2) |
|
768
|
|
|
{ |
|
769
|
|
|
$lang->menu_gnb_sub[$key2] = $value2->title; |
|
770
|
|
|
$this->gnbLangBuffer .=sprintf('$lang->menu_gnb_sub[\'%s\'] = \'%s\';', $key2, $value2->title); |
|
771
|
|
|
} |
|
772
|
|
|
} |
|
773
|
|
|
} |
|
774
|
|
|
$this->gnbLangBuffer .= ' ?>'; |
|
775
|
|
|
FileHandler::writeFile($cacheFile, $this->gnbLangBuffer); |
|
776
|
|
|
} |
|
777
|
|
|
else |
|
778
|
|
|
{ |
|
779
|
|
|
include $cacheFile; |
|
780
|
|
|
} |
|
781
|
|
|
|
|
782
|
|
|
return $lang->menu_gnb_sub; |
|
|
|
|
|
|
783
|
|
|
} |
|
784
|
|
|
|
|
785
|
|
|
/** |
|
786
|
|
|
* Get admin favorite list |
|
787
|
|
|
* @param int $siteSrl if default site, siteSrl is zero |
|
788
|
|
|
* @param bool $isGetModuleInfo |
|
789
|
|
|
* @return object |
|
790
|
|
|
*/ |
|
791
|
|
|
function getFavoriteList($siteSrl = 0, $isGetModuleInfo = FALSE) |
|
792
|
|
|
{ |
|
793
|
|
|
$args = new stdClass(); |
|
794
|
|
|
$args->site_srl = $siteSrl; |
|
795
|
|
|
$output = executeQueryArray('admin.getFavoriteList', $args); |
|
796
|
|
|
if(!$output->toBool()) |
|
797
|
|
|
{ |
|
798
|
|
|
return $output; |
|
799
|
|
|
} |
|
800
|
|
|
if(!$output->data) |
|
801
|
|
|
{ |
|
802
|
|
|
return new Object(); |
|
803
|
|
|
} |
|
804
|
|
|
|
|
805
|
|
|
if($isGetModuleInfo && is_array($output->data)) |
|
806
|
|
|
{ |
|
807
|
|
|
$oModuleModel = getModel('module'); |
|
808
|
|
|
foreach($output->data AS $key => $value) |
|
809
|
|
|
{ |
|
810
|
|
|
$moduleInfo = $oModuleModel->getModuleInfoXml($value->module); |
|
811
|
|
|
$output->data[$key]->admin_index_act = $moduleInfo->admin_index_act; |
|
812
|
|
|
$output->data[$key]->title = $moduleInfo->title; |
|
813
|
|
|
} |
|
814
|
|
|
} |
|
815
|
|
|
|
|
816
|
|
|
$returnObject = new Object(); |
|
817
|
|
|
$returnObject->add('favoriteList', $output->data); |
|
818
|
|
|
return $returnObject; |
|
819
|
|
|
} |
|
820
|
|
|
|
|
821
|
|
|
/** |
|
822
|
|
|
* Check available insert favorite |
|
823
|
|
|
* @param int $siteSrl if default site, siteSrl is zero |
|
824
|
|
|
* @param string $module |
|
825
|
|
|
* @return object |
|
826
|
|
|
*/ |
|
827
|
|
|
function isExistsFavorite($siteSrl, $module) |
|
828
|
|
|
{ |
|
829
|
|
|
$args = new stdClass(); |
|
830
|
|
|
$args->site_srl = $siteSrl; |
|
831
|
|
|
$args->module = $module; |
|
832
|
|
|
$output = executeQuery('admin.getFavorite', $args); |
|
833
|
|
|
if(!$output->toBool()) |
|
834
|
|
|
{ |
|
835
|
|
|
return $output; |
|
836
|
|
|
} |
|
837
|
|
|
|
|
838
|
|
|
$returnObject = new Object(); |
|
839
|
|
|
if($output->data) |
|
840
|
|
|
{ |
|
841
|
|
|
$returnObject->add('result', TRUE); |
|
842
|
|
|
$returnObject->add('favoriteSrl', $output->data->admin_favorite_srl); |
|
843
|
|
|
} |
|
844
|
|
|
else |
|
845
|
|
|
{ |
|
846
|
|
|
$returnObject->add('result', FALSE); |
|
847
|
|
|
} |
|
848
|
|
|
|
|
849
|
|
|
return $returnObject; |
|
850
|
|
|
} |
|
851
|
|
|
|
|
852
|
|
|
/** |
|
853
|
|
|
* Return site list |
|
854
|
|
|
* @return void |
|
855
|
|
|
*/ |
|
856
|
|
|
function getSiteAllList() |
|
857
|
|
|
{ |
|
858
|
|
|
if(Context::get('domain')) |
|
859
|
|
|
{ |
|
860
|
|
|
$domain = Context::get('domain'); |
|
861
|
|
|
} |
|
862
|
|
|
$siteList = $this->getAllSitesThatHaveModules($domain); |
|
|
|
|
|
|
863
|
|
|
$this->add('site_list', $siteList); |
|
864
|
|
|
} |
|
865
|
|
|
|
|
866
|
|
|
/** |
|
867
|
|
|
* Returns a list of all sites that contain modules |
|
868
|
|
|
* For each site domain and site_srl are retrieved |
|
869
|
|
|
* |
|
870
|
|
|
* @return array |
|
871
|
|
|
*/ |
|
872
|
|
|
function getAllSitesThatHaveModules($domain = NULL) |
|
873
|
|
|
{ |
|
874
|
|
|
$args = new stdClass(); |
|
875
|
|
|
if($domain) |
|
876
|
|
|
{ |
|
877
|
|
|
$args->domain = $domain; |
|
878
|
|
|
} |
|
879
|
|
|
$columnList = array('domain', 'site_srl'); |
|
880
|
|
|
|
|
881
|
|
|
$siteList = array(); |
|
882
|
|
|
$output = executeQueryArray('admin.getSiteAllList', $args, $columnList); |
|
883
|
|
|
if($output->toBool()) |
|
884
|
|
|
{ |
|
885
|
|
|
$siteList = $output->data; |
|
886
|
|
|
} |
|
887
|
|
|
|
|
888
|
|
|
$oModuleModel = getModel('module'); |
|
889
|
|
|
foreach($siteList as $key => $value) |
|
890
|
|
|
{ |
|
891
|
|
|
$args->site_srl = $value->site_srl; |
|
892
|
|
|
$list = $oModuleModel->getModuleSrlList($args); |
|
893
|
|
|
|
|
894
|
|
|
if(!is_array($list)) |
|
895
|
|
|
{ |
|
896
|
|
|
$list = array($list); |
|
897
|
|
|
} |
|
898
|
|
|
|
|
899
|
|
|
foreach($list as $k => $v) |
|
900
|
|
|
{ |
|
901
|
|
|
if(!is_dir(_XE_PATH_ . 'modules/' . $v->module)) |
|
902
|
|
|
{ |
|
903
|
|
|
unset($list[$k]); |
|
904
|
|
|
} |
|
905
|
|
|
} |
|
906
|
|
|
|
|
907
|
|
|
if(!count($list)) |
|
908
|
|
|
{ |
|
909
|
|
|
unset($siteList[$key]); |
|
910
|
|
|
} |
|
911
|
|
|
} |
|
912
|
|
|
return $siteList; |
|
913
|
|
|
} |
|
914
|
|
|
|
|
915
|
|
|
/** |
|
916
|
|
|
* Return site count |
|
917
|
|
|
* @param string $date |
|
918
|
|
|
* @return int |
|
919
|
|
|
*/ |
|
920
|
|
View Code Duplication |
function getSiteCountByDate($date = '') |
|
|
|
|
|
|
921
|
|
|
{ |
|
922
|
|
|
$args = new stdClass(); |
|
923
|
|
|
|
|
924
|
|
|
if($date) |
|
925
|
|
|
{ |
|
926
|
|
|
$args->regDate = date('Ymd', strtotime($date)); |
|
927
|
|
|
} |
|
928
|
|
|
|
|
929
|
|
|
$output = executeQuery('admin.getSiteCountByDate', $args); |
|
930
|
|
|
if(!$output->toBool()) |
|
931
|
|
|
{ |
|
932
|
|
|
return 0; |
|
933
|
|
|
} |
|
934
|
|
|
|
|
935
|
|
|
return $output->data->count; |
|
936
|
|
|
} |
|
937
|
|
|
|
|
938
|
|
|
function getFaviconUrl($default = true) |
|
939
|
|
|
{ |
|
940
|
|
|
return $this->iconUrlCheck('favicon.ico', 'faviconSample.png', $default); |
|
941
|
|
|
} |
|
942
|
|
|
|
|
943
|
|
|
function getMobileIconUrl($default = true) |
|
944
|
|
|
{ |
|
945
|
|
|
return $this->iconUrlCheck('mobicon.png', 'mobiconSample.png', $default); |
|
946
|
|
|
} |
|
947
|
|
|
|
|
948
|
|
|
function iconUrlCheck($iconname, $default_icon_name, $default) |
|
949
|
|
|
{ |
|
950
|
|
|
$site_info = Context::get('site_module_info'); |
|
951
|
|
|
$virtual_site = ''; |
|
952
|
|
|
if($site_info->site_srl) |
|
953
|
|
|
{ |
|
954
|
|
|
$virtual_site = $site_info->site_srl . '/'; |
|
955
|
|
|
} |
|
956
|
|
|
|
|
957
|
|
|
$file_exsit = FileHandler::readFile(_XE_PATH_ . 'files/attach/xeicon/' . $virtual_site . $iconname); |
|
958
|
|
|
if(!$file_exsit && $default === true) |
|
959
|
|
|
{ |
|
960
|
|
|
$icon_url = './modules/admin/tpl/img/' . $default_icon_name; |
|
961
|
|
|
} |
|
962
|
|
|
elseif($file_exsit) |
|
963
|
|
|
{ |
|
964
|
|
|
$default_url = Context::getDefaultUrl(); |
|
965
|
|
|
$icon_url = $default_url . 'files/attach/xeicon/' . $virtual_site . $iconname; |
|
966
|
|
|
} |
|
967
|
|
|
return $icon_url; |
|
|
|
|
|
|
968
|
|
|
} |
|
969
|
|
|
|
|
970
|
|
|
} |
|
971
|
|
|
/* End of file admin.admin.model.php */ |
|
972
|
|
|
/* Location: ./modules/admin/admin.admin.model.php */ |
|
973
|
|
|
|
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.