1
|
|
|
<?php
|
2
|
|
|
if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
|
3
|
|
|
die('<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.');
|
4
|
|
|
}
|
5
|
|
|
|
6
|
|
|
unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes
|
7
|
|
|
|
8
|
|
|
if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
|
9
|
|
|
// seems to be a new install - send the user to the configuration page
|
10
|
|
|
exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
|
11
|
|
|
}
|
12
|
|
|
|
13
|
|
|
// set placeholders
|
14
|
|
|
$ph = $_lang;
|
15
|
|
|
$_SESSION['nrtotalmessages'] = 0;
|
16
|
|
|
$_SESSION['nrnewmessages'] = 0;
|
17
|
|
|
|
18
|
|
|
// setup message info
|
19
|
|
|
if($modx->hasPermission('messages')) {
|
20
|
|
|
include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php');
|
21
|
|
|
$_SESSION['nrtotalmessages'] = $nrtotalmessages;
|
22
|
|
|
$_SESSION['nrnewmessages'] = $nrnewmessages;
|
23
|
|
|
|
24
|
|
|
$msg = array();
|
25
|
|
|
$msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']);
|
26
|
|
|
$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : '';
|
27
|
|
|
$msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold"> <a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages);
|
28
|
|
|
$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0';
|
29
|
|
|
$welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages);
|
30
|
|
|
$msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages);
|
31
|
|
|
$ph['MessageInfo'] = implode("\n", $msg);
|
32
|
|
|
}
|
33
|
|
|
|
34
|
|
|
$iconTpl = $managerTheme->getChunk('welcome/WrapIcon');
|
35
|
|
|
// setup icons
|
36
|
|
|
if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
|
37
|
|
|
$icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]';
|
38
|
|
|
$ph['SecurityIcon'] = sprintf($iconTpl,$icon, 75);
|
39
|
|
|
}
|
40
|
|
|
if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
|
41
|
|
|
$icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]';
|
42
|
|
|
$ph['WebUserIcon'] = sprintf($iconTpl,$icon, 99);
|
43
|
|
|
}
|
44
|
|
|
if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
|
45
|
|
|
$icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]';
|
46
|
|
|
$ph['ModulesIcon'] = sprintf($iconTpl,$icon, 106);
|
47
|
|
|
}
|
48
|
|
View Code Duplication |
if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
|
49
|
|
|
$icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]';
|
50
|
|
|
$ph['ResourcesIcon'] = sprintf($iconTpl,$icon, 76);
|
51
|
|
|
}
|
52
|
|
|
if($modx->hasPermission('bk_manager')) {
|
53
|
|
|
$icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]';
|
54
|
|
|
$ph['BackupIcon'] = sprintf($iconTpl,$icon, 93);
|
55
|
|
|
}
|
56
|
|
|
if($modx->hasPermission('help')) {
|
57
|
|
|
$icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]';
|
58
|
|
|
$ph['HelpIcon'] = sprintf($iconTpl,$icon, 9);
|
59
|
|
|
}
|
60
|
|
|
|
61
|
|
|
if($modx->hasPermission('new_document')) {
|
62
|
|
|
$icon = '<i class="[&icons_resource_large&]"></i>[%add_resource%]';
|
63
|
|
|
$ph['ResourceIcon'] = sprintf($iconTpl,$icon, 4);
|
64
|
|
|
$icon = '<i class="[&icons_weblink_large&]"></i>[%add_weblink%]';
|
65
|
|
|
$ph['WeblinkIcon'] = sprintf($iconTpl,$icon, 72);
|
66
|
|
|
}
|
67
|
|
|
if($modx->hasPermission('assets_images')) {
|
68
|
|
|
$icon = '<i class="[&icons_images_large&]"></i>[%images_management%]';
|
69
|
|
|
$ph['ImagesIcon'] = sprintf($iconTpl,$icon, 72);
|
70
|
|
|
}
|
71
|
|
|
if($modx->hasPermission('assets_files')) {
|
72
|
|
|
$icon = '<i class="[&icons_files_large&]"></i>[%files_management%]';
|
73
|
|
|
$ph['FilesIcon'] = sprintf($iconTpl,$icon, 72);
|
74
|
|
|
}
|
75
|
|
|
if($modx->hasPermission('change_password')) {
|
76
|
|
|
$icon = '<i class="[&icons_password_large&]"></i>[%change_password%]';
|
77
|
|
|
$ph['PasswordIcon'] = sprintf($iconTpl,$icon, 28);
|
78
|
|
|
}
|
79
|
|
|
$icon = '<i class="[&icons_logout_large&]"></i>[%logout%]';
|
80
|
|
|
$ph['LogoutIcon'] = sprintf($iconTpl,$icon, 8);
|
81
|
|
|
|
82
|
|
|
// do some config checks
|
83
|
|
|
if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
|
84
|
|
|
include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php');
|
85
|
|
|
if($config_check_results != $_lang['configcheck_ok']) {
|
86
|
|
|
$ph['config_check_results'] = $config_check_results;
|
87
|
|
|
$ph['config_display'] = 'block';
|
88
|
|
|
} else {
|
89
|
|
|
$ph['config_display'] = 'none';
|
90
|
|
|
}
|
91
|
|
|
} else {
|
92
|
|
|
$ph['config_display'] = 'none';
|
93
|
|
|
}
|
94
|
|
|
|
95
|
|
|
// Check logout-reminder
|
96
|
|
|
if(isset($_SESSION['show_logout_reminder'])) {
|
97
|
|
|
switch($_SESSION['show_logout_reminder']['type']) {
|
98
|
|
|
case 'logout_reminder':
|
99
|
|
|
$date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly');
|
100
|
|
|
$ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
|
101
|
|
|
break;
|
102
|
|
|
}
|
103
|
|
|
$ph['show_logout_reminder'] = 'block';
|
104
|
|
|
unset($_SESSION['show_logout_reminder']);
|
105
|
|
|
} else {
|
106
|
|
|
$ph['show_logout_reminder'] = 'none';
|
107
|
|
|
}
|
108
|
|
|
|
109
|
|
|
// Check multiple sessions
|
|
|
|
|
110
|
|
|
//$where = sprintf("internalKey='%s'", $modx->db->escape($_SESSION['mgrInternalKey']));
|
111
|
|
|
//$rs = $modx->db->select('count(*) AS count', '[+prefix+]active_user_sessions', $where);
|
112
|
|
|
//$count = $modx->db->getValue($rs);
|
113
|
|
|
/*
|
114
|
|
|
if($count > 1) {
|
115
|
|
|
$ph['multiple_sessions_msg'] = $modx->parseText($_lang['multiple_sessions_msg'], array(
|
116
|
|
|
'username' => $_SESSION['mgrShortname'],
|
117
|
|
|
'total' => $count
|
118
|
|
|
));
|
119
|
|
|
$ph['show_multiple_sessions'] = 'block';
|
120
|
|
|
} else {
|
121
|
|
|
$ph['show_multiple_sessions'] = 'none';
|
122
|
|
|
}*/
|
123
|
|
|
$ph['show_multiple_sessions'] = 'none';
|
124
|
|
|
|
125
|
|
|
$ph['RecentInfo'] = $managerTheme->getChunk('welcome/RecentInfo');
|
126
|
|
|
|
127
|
|
|
$tpl = '
|
128
|
|
|
<table class="table data">
|
129
|
|
|
<tr>
|
130
|
|
|
<td width="150">[%yourinfo_username%]</td>
|
131
|
|
|
<td><b>[+username+]</b></td>
|
132
|
|
|
</tr>
|
133
|
|
|
<tr>
|
134
|
|
|
<td>[%yourinfo_role%]</td>
|
135
|
|
|
<td><b>[+role+]</b></td>
|
136
|
|
|
</tr>
|
137
|
|
|
<tr>
|
138
|
|
|
<td>[%yourinfo_previous_login%]</td>
|
139
|
|
|
<td><b>[+lastlogin+]</b></td>
|
140
|
|
|
</tr>
|
141
|
|
|
<tr>
|
142
|
|
|
<td>[%yourinfo_total_logins%]</td>
|
143
|
|
|
<td><b>[+logincount+]</b></td>
|
144
|
|
|
</tr>
|
145
|
|
|
<tr>
|
146
|
|
|
<td>[%inbox%]</td>
|
147
|
|
|
<td><a href="index.php?a=10" target="main"><b>[+msginfo+]</b></a></td>
|
148
|
|
|
</tr>
|
149
|
|
|
</table>';
|
150
|
|
|
|
151
|
|
|
$nrnewmessages = '<span class="text-danger">' . $_SESSION['nrnewmessages'] . '</span>';
|
152
|
|
|
|
153
|
|
|
$ph['UserInfo'] = $modx->parseText($tpl, array(
|
154
|
|
|
'username' => $modx->getLoginUserName(),
|
155
|
|
|
'role' => $_SESSION['mgrPermissions']['name'],
|
156
|
|
|
'lastlogin' => $modx->toDateFormat($_SESSION['mgrLastlogin'] + $server_offset_time),
|
157
|
|
|
'logincount' => $_SESSION['mgrLogincount'] + 1,
|
158
|
|
|
'msginfo' => sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages)
|
159
|
|
|
));
|
160
|
|
|
|
161
|
|
|
$from = array();
|
162
|
|
|
$from[] = '[+prefix+]active_user_sessions';
|
163
|
|
|
$from[] = " us LEFT JOIN [+prefix+]active_users au ON au.sid=us.sid WHERE au.action <> '8'";
|
164
|
|
|
$rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC');
|
165
|
|
|
|
166
|
|
|
if($modx->db->getRecordCount($rs) < 1) {
|
167
|
|
|
$html = '<p>[%no_active_users_found%]</p>';
|
168
|
|
|
} else {
|
169
|
|
|
include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
|
170
|
|
|
$now = $_SERVER['REQUEST_TIME'] + $server_offset_time;
|
171
|
|
|
$ph['now'] = strftime('%H:%M:%S', $now);
|
172
|
|
|
$timetocheck = ($now - (60 * 20)); //+$server_offset_time;
|
173
|
|
|
$html = '
|
174
|
|
|
<div class="card-body">
|
175
|
|
|
[%onlineusers_message%]
|
176
|
|
|
<b>[+now+]</b>):
|
177
|
|
|
</div>
|
178
|
|
|
<div class="table-responsive">
|
179
|
|
|
<table class="table data">
|
180
|
|
|
<thead>
|
181
|
|
|
<tr>
|
182
|
|
|
<th>[%onlineusers_user%]</th>
|
183
|
|
|
<th>ID</th>
|
184
|
|
|
<th>[%onlineusers_ipaddress%]</th>
|
185
|
|
|
<th>[%onlineusers_lasthit%]</th>
|
186
|
|
|
<th>[%onlineusers_action%] </th>
|
187
|
|
|
</tr>
|
188
|
|
|
</thead>
|
189
|
|
|
<tbody>';
|
190
|
|
|
|
191
|
|
|
$userList = array();
|
192
|
|
|
$userCount = array();
|
193
|
|
|
// Create userlist with session-count first before output
|
194
|
|
|
while($activeusers = $modx->db->getRow($rs)) {
|
195
|
|
|
$userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1;
|
196
|
|
|
|
197
|
|
|
$idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : '';
|
198
|
|
|
$webicon = $activeusers['internalKey'] < 0 ? '<img src="[&tree_globe&]" alt="Web user" /> ' : '';
|
199
|
|
|
$ip = $activeusers['ip'] === '::1' ? '127.0.0.1' : $activeusers['ip'];
|
200
|
|
|
$currentaction = getAction($activeusers['action'], $activeusers['id']);
|
201
|
|
|
$userList[] = array(
|
202
|
|
|
$idle,
|
203
|
|
|
'',
|
204
|
|
|
$activeusers['username'],
|
205
|
|
|
$webicon,
|
206
|
|
|
abs($activeusers['internalKey']),
|
207
|
|
|
$ip,
|
208
|
|
|
strftime('%H:%M:%S', $activeusers['lasthit'] + $server_offset_time),
|
209
|
|
|
$currentaction
|
210
|
|
|
);
|
211
|
|
|
}
|
212
|
|
|
foreach($userList as $params) {
|
213
|
|
|
$params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : '';
|
214
|
|
|
$html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
|
215
|
|
|
}
|
216
|
|
|
|
217
|
|
|
$html .= '
|
218
|
|
|
</tbody>
|
219
|
|
|
</table>
|
220
|
|
|
</div>
|
221
|
|
|
';
|
222
|
|
|
}
|
223
|
|
|
$ph['OnlineInfo'] = $html;
|
224
|
|
|
|
225
|
|
|
// include rss feeds for important forum topics
|
226
|
|
|
include_once(MODX_MANAGER_PATH . 'includes/rss.inc.php');
|
227
|
|
|
$ph['modx_security_notices_content'] = $feedData['modx_security_notices_content'];
|
228
|
|
|
$ph['modx_news_content'] = $feedData['modx_news_content'];
|
229
|
|
|
|
230
|
|
|
$ph['theme'] = $modx->config['manager_theme'];
|
231
|
|
|
$ph['site_name'] = $modx->config['site_name'];
|
232
|
|
|
$ph['home'] = $_lang['home'];
|
233
|
|
|
$ph['logo_slogan'] = $_lang['logo_slogan'];
|
234
|
|
|
$ph['welcome_title'] = $_lang['welcome_title'];
|
235
|
|
|
$ph['search'] = $_lang['search'];
|
236
|
|
|
$ph['settings_config'] = $_lang['settings_config'];
|
237
|
|
|
$ph['configcheck_title'] = $_lang['configcheck_title'];
|
238
|
|
|
$ph['online'] = $_lang['online'];
|
239
|
|
|
$ph['onlineusers_title'] = $_lang['onlineusers_title'];
|
240
|
|
|
$ph['recent_docs'] = $_lang['recent_docs'];
|
241
|
|
|
$ph['activity_title'] = $_lang['activity_title'];
|
242
|
|
|
$ph['info'] = $_lang['info'];
|
243
|
|
|
$ph['yourinfo_title'] = $_lang['yourinfo_title'];
|
244
|
|
|
|
245
|
|
|
$ph['modx_security_notices'] = $_lang['security_notices_tab'];
|
246
|
|
|
$ph['modx_security_notices_title'] = $_lang['security_notices_title'];
|
247
|
|
|
$ph['modx_news'] = $_lang['modx_news_tab'];
|
248
|
|
|
$ph['modx_news_title'] = $_lang['modx_news_title'];
|
249
|
|
|
|
250
|
|
|
$modx->toPlaceholders($ph);
|
251
|
|
|
|
252
|
|
|
$script = $managerTheme->getChunk('welcome/StartUpScript');
|
253
|
|
|
$modx->regClientScript($script);
|
254
|
|
|
|
255
|
|
|
// invoke event OnManagerWelcomePrerender
|
256
|
|
|
$evtOut = $modx->invokeEvent('OnManagerWelcomePrerender');
|
257
|
|
|
if(is_array($evtOut)) {
|
258
|
|
|
$output = implode('', $evtOut);
|
259
|
|
|
$ph['OnManagerWelcomePrerender'] = $output;
|
260
|
|
|
}
|
261
|
|
|
|
262
|
|
|
$widgets['welcome'] = array(
|
263
|
|
|
'menuindex' => '10',
|
264
|
|
|
'id' => 'welcome',
|
265
|
|
|
'cols' => 'col-lg-6',
|
266
|
|
|
'icon' => 'fa-home',
|
267
|
|
|
'title' => '[%welcome_title%]',
|
268
|
|
|
'body' => '
|
269
|
|
|
<div class="wm_buttons card-body">
|
270
|
|
|
<!--@IF:[[#hasPermission?key=new_document]]-->
|
271
|
|
|
<span class="wm_button">
|
272
|
|
|
<a target="main" href="index.php?a=4">
|
273
|
|
|
<i class="[&icons_resource_large&]"></i>
|
274
|
|
|
<span>[%add_resource%]</span>
|
275
|
|
|
</a>
|
276
|
|
|
</span>
|
277
|
|
|
<span class="wm_button">
|
278
|
|
|
<a target="main" href="index.php?a=72">
|
279
|
|
|
<i class="[&icons_weblink_large&]"></i>
|
280
|
|
|
<span>[%add_weblink%]</span>
|
281
|
|
|
</a>
|
282
|
|
|
</span>
|
283
|
|
|
<!--@ENDIF-->
|
284
|
|
|
<!--@IF:[[#hasPermission?key=assets_images]]-->
|
285
|
|
|
<span class="wm_button">
|
286
|
|
|
<a target="main" href="media/browser/mcpuk/browse.php?filemanager=media/browser/mcpuk/browse.php&type=images">
|
287
|
|
|
<i class="[&icons_images_large&]"></i>
|
288
|
|
|
<span>[%images_management%]</span>
|
289
|
|
|
</a>
|
290
|
|
|
</span>
|
291
|
|
|
<!--@ENDIF-->
|
292
|
|
|
<!--@IF:[[#hasPermission?key=assets_files]]-->
|
293
|
|
|
<span class="wm_button">
|
294
|
|
|
<a target="main" href="media/browser/mcpuk/browse.php?filemanager=media/browser/mcpuk/browse.php&type=files">
|
295
|
|
|
<i class="[&icons_files_large&]"></i>
|
296
|
|
|
<span>[%files_management%]</span>
|
297
|
|
|
</a>
|
298
|
|
|
</span>
|
299
|
|
|
<!--@ENDIF-->
|
300
|
|
|
<!--@IF:[[#hasPermission?key=change_password]]-->
|
301
|
|
|
<span class="wm_button">
|
302
|
|
|
<a target="main" href="index.php?a=28">
|
303
|
|
|
<i class="[&icons_password_large&]"></i>
|
304
|
|
|
<span>[%change_password%]</span>
|
305
|
|
|
</a>
|
306
|
|
|
</span>
|
307
|
|
|
<!--@ENDIF-->
|
308
|
|
|
<span class="wm_button">
|
309
|
|
|
<a target="_top" href="index.php?a=8">
|
310
|
|
|
<i class="[&icons_logout_large&]"></i>
|
311
|
|
|
<span>[%logout%]</span>
|
312
|
|
|
</a>
|
313
|
|
|
</span>
|
314
|
|
|
</div>
|
315
|
|
|
<div class="userprofiletable card-body">
|
316
|
|
|
<table>
|
317
|
|
|
<tr>
|
318
|
|
|
<td width="150">[%yourinfo_username%]</td>
|
319
|
|
|
<td><b>[[#getLoginUserName]]</b></td>
|
320
|
|
|
</tr>
|
321
|
|
|
<tr>
|
322
|
|
|
<td>[%yourinfo_role%]</td>
|
323
|
|
|
<td><b>[[$_SESSION[\'mgrPermissions\'][\'name\'] ]]</b></td>
|
324
|
|
|
</tr>
|
325
|
|
|
<tr>
|
326
|
|
|
<td>[%yourinfo_previous_login%]</td>
|
327
|
|
|
<td><b>[[$_SESSION[\'mgrLastlogin\']:math(\'%s+[(server_offset_time)]\'):dateFormat]]</b></td>
|
328
|
|
|
</tr>
|
329
|
|
|
<tr>
|
330
|
|
|
<td>[%yourinfo_total_logins%]</td>
|
331
|
|
|
<td><b>[[$_SESSION[\'mgrLogincount\']:math(\'%s+1\')]]</b></td>
|
332
|
|
|
</tr>
|
333
|
|
|
<!--@IF:[[#hasPermission?key=messages]]-->
|
334
|
|
|
<tr>
|
335
|
|
|
<td>[%inbox%]</td>
|
336
|
|
|
<td><a href="index.php?a=10" target="main"><b>[[#getMessageCount]]</b></a></td>
|
337
|
|
|
</tr>
|
338
|
|
|
<!--@ENDIF-->
|
339
|
|
|
</table>
|
340
|
|
|
</div>
|
341
|
|
|
',
|
342
|
|
|
'hide'=>'0'
|
343
|
|
|
);
|
344
|
|
|
$widgets['onlineinfo'] = array(
|
345
|
|
|
'menuindex' => '20',
|
346
|
|
|
'id' => 'onlineinfo',
|
347
|
|
|
'cols' => 'col-lg-6',
|
348
|
|
|
'icon' => 'fa-user',
|
349
|
|
|
'title' => '[%onlineusers_title%]',
|
350
|
|
|
'body' => '<div class="userstable">[+OnlineInfo+]</div>',
|
351
|
|
|
'hide'=>'0'
|
352
|
|
|
);
|
353
|
|
|
$widgets['recentinfo'] = array(
|
354
|
|
|
'menuindex' => '30',
|
355
|
|
|
'id' => 'modxrecent_widget',
|
356
|
|
|
'cols' => 'col-sm-12',
|
357
|
|
|
'icon' => 'fa-pencil-square-o',
|
358
|
|
|
'title' => '[%activity_title%]',
|
359
|
|
|
'body' => '<div class="widget-stage">[+RecentInfo+]</div>',
|
360
|
|
|
'hide'=>'0'
|
361
|
|
|
);
|
362
|
|
View Code Duplication |
if ($modx->config['rss_url_news']) {
|
363
|
|
|
$widgets['news'] = array(
|
364
|
|
|
'menuindex' => '40',
|
365
|
|
|
'id' => 'news',
|
366
|
|
|
'cols' => 'col-sm-6',
|
367
|
|
|
'icon' => 'fa-rss',
|
368
|
|
|
'title' => '[%modx_news_title%]',
|
369
|
|
|
'body' => '<div style="max-height:200px;overflow-y: scroll;padding: 1rem .5rem">[+modx_news_content+]</div>',
|
370
|
|
|
'hide'=>'0'
|
371
|
|
|
);
|
372
|
|
|
}
|
373
|
|
View Code Duplication |
if ($modx->config['rss_url_security']) {
|
374
|
|
|
$widgets['security'] = array(
|
375
|
|
|
'menuindex' => '50',
|
376
|
|
|
'id' => 'security',
|
377
|
|
|
'cols' => 'col-sm-6',
|
378
|
|
|
'icon' => 'fa-exclamation-triangle',
|
379
|
|
|
'title' => '[%security_notices_title%]',
|
380
|
|
|
'body' => '<div style="max-height:200px;overflow-y: scroll;padding: 1rem .5rem">[+modx_security_notices_content+]</div>',
|
381
|
|
|
'hide'=>'0'
|
382
|
|
|
);
|
383
|
|
|
}
|
384
|
|
|
|
385
|
|
|
// invoke OnManagerWelcomeHome event
|
386
|
|
|
$sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
|
387
|
|
|
if(is_array($sitewidgets)) {
|
388
|
|
|
$newwidgets = array();
|
389
|
|
|
foreach($sitewidgets as $widget){
|
390
|
|
|
$newwidgets = array_merge($newwidgets, unserialize($widget));
|
391
|
|
|
}
|
392
|
|
|
$widgets = (count($newwidgets) > 0) ? $newwidgets : $widgets;
|
393
|
|
|
}
|
394
|
|
|
|
395
|
|
|
usort($widgets, function ($a, $b) {
|
396
|
|
|
return $a['menuindex'] - $b['menuindex'];
|
397
|
|
|
});
|
398
|
|
|
|
399
|
|
|
$tpl = $managerTheme->getChunk('welcome/Widget');
|
400
|
|
|
$output = '';
|
401
|
|
|
foreach($widgets as $widget) {
|
402
|
|
|
if ($widget['hide'] != '1'){
|
403
|
|
|
$output .= $modx->parseText($tpl, $widget);
|
404
|
|
|
}
|
405
|
|
|
}
|
406
|
|
|
$ph['widgets'] = $output;
|
407
|
|
|
|
408
|
|
|
// load template
|
409
|
|
View Code Duplication |
if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
|
410
|
|
|
$modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl';
|
411
|
|
|
}
|
412
|
|
|
|
413
|
|
|
$target = $modx->config['manager_welcome_tpl'];
|
414
|
|
|
$target = str_replace('[+base_path+]', MODX_BASE_PATH, $target);
|
415
|
|
|
$target = $modx->mergeSettingsContent($target);
|
416
|
|
|
|
417
|
|
|
if(substr($target, 0, 1) === '@') {
|
418
|
|
|
if(substr($target, 0, 6) === '@CHUNK') {
|
419
|
|
|
$content = $modx->getChunk(trim(substr($target, 7)));
|
420
|
|
|
} elseif(substr($target, 0, 5) === '@FILE') {
|
421
|
|
|
$content = file_get_contents(trim(substr($target, 6)));
|
422
|
|
|
} else {
|
423
|
|
|
$content = '';
|
424
|
|
|
}
|
425
|
|
|
} else {
|
426
|
|
|
$chunk = $modx->getChunk($target);
|
427
|
|
|
if($chunk !== false && !empty($chunk)) {
|
428
|
|
|
$content = $chunk;
|
429
|
|
|
} elseif(is_file(MODX_BASE_PATH . $target)) {
|
430
|
|
|
$content = file_get_contents(MODX_BASE_PATH . $target);
|
431
|
|
|
} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
|
432
|
|
|
$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl');
|
433
|
|
|
} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible
|
434
|
|
|
{
|
435
|
|
|
$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
|
436
|
|
|
} else {
|
437
|
|
|
$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl');
|
438
|
|
|
}
|
439
|
|
|
}
|
440
|
|
|
|
441
|
|
|
// merge placeholders
|
442
|
|
|
$content = $modx->mergeConditionalTagsContent($content);
|
443
|
|
|
$content = $modx->mergeSettingsContent($content);
|
444
|
|
|
$content = $modx->parseText($content, $ph);
|
445
|
|
|
if(strpos($content, '[+') !== false) {
|
446
|
|
|
$modx->toPlaceholders($ph);
|
447
|
|
|
$content = $modx->mergePlaceholderContent($content);
|
448
|
|
|
}
|
449
|
|
|
$content = $modx->parseDocumentSource($content);
|
450
|
|
|
$content = $modx->parseText($content, $_lang, '[%', '%]');
|
451
|
|
|
$content = $modx->parseText($content, $_style, '[&', '&]');
|
452
|
|
|
$content = $modx->cleanUpMODXTags($content); //cleanup
|
453
|
|
|
|
454
|
|
|
if($js = $modx->getRegisteredClientScripts()) {
|
455
|
|
|
$content .= $js;
|
456
|
|
|
}
|
457
|
|
|
|
458
|
|
|
echo $content;
|
459
|
|
|
|
460
|
|
|
//<span class="conf">
|
461
|
|
|
// <a href="javascript:;" class="setting"><i class="fa fa-cog"></i></a>
|
462
|
|
|
// <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a>
|
463
|
|
|
//</span>
|
464
|
|
|
|
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.