Completed
Pull Request — develop (#656)
by
unknown
05:29
created
manager/actions/welcome.static.php 1 patch
Indentation   +226 added lines, -226 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 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.');
3
+    die('<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.');
4 4
 }
5 5
 
6 6
 unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes
7 7
 
8 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>');
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 11
 }
12 12
 
13 13
 // set placeholders
@@ -17,70 +17,70 @@  discard block
 block discarded – undo
17 17
 
18 18
 // setup message info
19 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">&nbsp;<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);
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">&nbsp;<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 32
 }
33 33
 
34 34
 // setup icons
35 35
 if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
36
-	$icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]';
37
-	$ph['SecurityIcon'] = wrapIcon($icon, 75);
36
+    $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]';
37
+    $ph['SecurityIcon'] = wrapIcon($icon, 75);
38 38
 }
39 39
 if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
40
-	$icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]';
41
-	$ph['WebUserIcon'] = wrapIcon($icon, 99);
40
+    $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]';
41
+    $ph['WebUserIcon'] = wrapIcon($icon, 99);
42 42
 }
43 43
 if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
44
-	$icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]';
45
-	$ph['ModulesIcon'] = wrapIcon($icon, 106);
44
+    $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]';
45
+    $ph['ModulesIcon'] = wrapIcon($icon, 106);
46 46
 }
47 47
 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')) {
48
-	$icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]';
49
-	$ph['ResourcesIcon'] = wrapIcon($icon, 76);
48
+    $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]';
49
+    $ph['ResourcesIcon'] = wrapIcon($icon, 76);
50 50
 }
51 51
 if($modx->hasPermission('bk_manager')) {
52
-	$icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]';
53
-	$ph['BackupIcon'] = wrapIcon($icon, 93);
52
+    $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]';
53
+    $ph['BackupIcon'] = wrapIcon($icon, 93);
54 54
 }
55 55
 if($modx->hasPermission('help')) {
56
-	$icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]';
57
-	$ph['HelpIcon'] = wrapIcon($icon, 9);
56
+    $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]';
57
+    $ph['HelpIcon'] = wrapIcon($icon, 9);
58 58
 }
59 59
 // do some config checks
60 60
 if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
61
-	include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php');
62
-	if($config_check_results != $_lang['configcheck_ok']) {
63
-		$ph['config_check_results'] = $config_check_results;
64
-		$ph['config_display'] = 'block';
65
-	} else {
66
-		$ph['config_display'] = 'none';
67
-	}
61
+    include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php');
62
+    if($config_check_results != $_lang['configcheck_ok']) {
63
+        $ph['config_check_results'] = $config_check_results;
64
+        $ph['config_display'] = 'block';
65
+    } else {
66
+        $ph['config_display'] = 'none';
67
+    }
68 68
 } else {
69
-	$ph['config_display'] = 'none';
69
+    $ph['config_display'] = 'none';
70 70
 }
71 71
 
72 72
 // Check logout-reminder
73 73
 if(isset($_SESSION['show_logout_reminder'])) {
74
-	switch($_SESSION['show_logout_reminder']['type']) {
75
-		case 'logout_reminder':
76
-			$date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly');
77
-			$ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
78
-			break;
79
-	}
80
-	$ph['show_logout_reminder'] = 'block';
81
-	unset($_SESSION['show_logout_reminder']);
74
+    switch($_SESSION['show_logout_reminder']['type']) {
75
+        case 'logout_reminder':
76
+            $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly');
77
+            $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
78
+            break;
79
+    }
80
+    $ph['show_logout_reminder'] = 'block';
81
+    unset($_SESSION['show_logout_reminder']);
82 82
 } else {
83
-	$ph['show_logout_reminder'] = 'none';
83
+    $ph['show_logout_reminder'] = 'none';
84 84
 }
85 85
 
86 86
 // Check multiple sessions
@@ -128,11 +128,11 @@  discard block
 block discarded – undo
128 128
 $nrnewmessages = '<span class="text-danger">' . $_SESSION['nrnewmessages'] . '</span>';
129 129
 
130 130
 $ph['UserInfo'] = $modx->parseText($tpl, array(
131
-	'username' => $modx->getLoginUserName(),
132
-	'role' => $_SESSION['mgrPermissions']['name'],
133
-	'lastlogin' => $modx->toDateFormat($_SESSION['mgrLastlogin'] + $server_offset_time),
134
-	'logincount' => $_SESSION['mgrLogincount'] + 1,
135
-	'msginfo' => sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages)
131
+    'username' => $modx->getLoginUserName(),
132
+    'role' => $_SESSION['mgrPermissions']['name'],
133
+    'lastlogin' => $modx->toDateFormat($_SESSION['mgrLastlogin'] + $server_offset_time),
134
+    'logincount' => $_SESSION['mgrLogincount'] + 1,
135
+    'msginfo' => sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages)
136 136
 ));
137 137
 
138 138
 $from = array();
@@ -141,13 +141,13 @@  discard block
 block discarded – undo
141 141
 $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC');
142 142
 
143 143
 if($modx->db->getRecordCount($rs) < 1) {
144
-	$html = '<p>[%no_active_users_found%]</p>';
144
+    $html = '<p>[%no_active_users_found%]</p>';
145 145
 } else {
146
-	include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
147
-	$now = $_SERVER['REQUEST_TIME'] + $server_offset_time;
148
-	$ph['now'] = strftime('%H:%M:%S', $now);
149
-	$timetocheck = ($now - (60 * 20)); //+$server_offset_time;
150
-	$html = '
146
+    include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
147
+    $now = $_SERVER['REQUEST_TIME'] + $server_offset_time;
148
+    $ph['now'] = strftime('%H:%M:%S', $now);
149
+    $timetocheck = ($now - (60 * 20)); //+$server_offset_time;
150
+    $html = '
151 151
 	<div class="card-body">
152 152
 		[%onlineusers_message%] 
153 153
 		<b>[+now+]</b>):
@@ -165,33 +165,33 @@  discard block
 block discarded – undo
165 165
 	</thead>
166 166
 	<tbody>';
167 167
 
168
-	$userList = array();
169
-	$userCount = array();
170
-	// Create userlist with session-count first before output
171
-	while($activeusers = $modx->db->getRow($rs)) {
172
-		$userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1;
173
-
174
-		$idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : '';
175
-		$webicon = $activeusers['internalKey'] < 0 ? '<img src="[&tree_globe&]" alt="Web user" />&nbsp;' : '';
176
-		$ip = $activeusers['ip'] === '::1' ? '127.0.0.1' : $activeusers['ip'];
177
-		$currentaction = getAction($activeusers['action'], $activeusers['id']);
178
-		$userList[] = array(
179
-			$idle,
180
-			'',
181
-			$activeusers['username'],
182
-			$webicon,
183
-			abs($activeusers['internalKey']),
184
-			$ip,
185
-			strftime('%H:%M:%S', $activeusers['lasthit'] + $server_offset_time),
186
-			$currentaction
187
-		);
188
-	}
189
-	foreach($userList as $params) {
190
-		$params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : '';
191
-		$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);
192
-	}
193
-
194
-	$html .= '
168
+    $userList = array();
169
+    $userCount = array();
170
+    // Create userlist with session-count first before output
171
+    while($activeusers = $modx->db->getRow($rs)) {
172
+        $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1;
173
+
174
+        $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : '';
175
+        $webicon = $activeusers['internalKey'] < 0 ? '<img src="[&tree_globe&]" alt="Web user" />&nbsp;' : '';
176
+        $ip = $activeusers['ip'] === '::1' ? '127.0.0.1' : $activeusers['ip'];
177
+        $currentaction = getAction($activeusers['action'], $activeusers['id']);
178
+        $userList[] = array(
179
+            $idle,
180
+            '',
181
+            $activeusers['username'],
182
+            $webicon,
183
+            abs($activeusers['internalKey']),
184
+            $ip,
185
+            strftime('%H:%M:%S', $activeusers['lasthit'] + $server_offset_time),
186
+            $currentaction
187
+        );
188
+    }
189
+    foreach($userList as $params) {
190
+        $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : '';
191
+        $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);
192
+    }
193
+
194
+    $html .= '
195 195
 	</tbody>
196 196
 	</table>
197 197
 </div>
@@ -232,17 +232,17 @@  discard block
 block discarded – undo
232 232
 // invoke event OnManagerWelcomePrerender
233 233
 $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender');
234 234
 if(is_array($evtOut)) {
235
-	$output = implode('', $evtOut);
236
-	$ph['OnManagerWelcomePrerender'] = $output;
235
+    $output = implode('', $evtOut);
236
+    $ph['OnManagerWelcomePrerender'] = $output;
237 237
 }
238 238
 
239 239
 $widgets['welcome'] = array(
240
-	'menuindex' => '10',
241
-	'id' => 'welcome',
242
-	'cols' => 'col-lg-6',
243
-	'icon' => 'fa-home',
244
-	'title' => '[%welcome_title%]',
245
-	'body' => '
240
+    'menuindex' => '10',
241
+    'id' => 'welcome',
242
+    'cols' => 'col-lg-6',
243
+    'icon' => 'fa-home',
244
+    'title' => '[%welcome_title%]',
245
+    'body' => '
246 246
 				<div class="wm_buttons card-body"> 
247 247
 					<!--@IF:[[#hasPermission?key=new_user]] OR [[#hasPermission?key=edit_user]]--> 
248 248
 					<span class="wm_button">
@@ -320,25 +320,25 @@  discard block
 block discarded – undo
320 320
 					</table>
321 321
 				</div>
322 322
 		',
323
-	'hide'=>'0'
323
+    'hide'=>'0'
324 324
 );
325 325
 $widgets['onlineinfo'] = array(
326
-	'menuindex' => '20',
327
-	'id' => 'onlineinfo',
328
-	'cols' => 'col-lg-6',
329
-	'icon' => 'fa-user',
330
-	'title' => '[%onlineusers_title%]',
331
-	'body' => '<div class="userstable">[+OnlineInfo+]</div>',
332
-	'hide'=>'0'
326
+    'menuindex' => '20',
327
+    'id' => 'onlineinfo',
328
+    'cols' => 'col-lg-6',
329
+    'icon' => 'fa-user',
330
+    'title' => '[%onlineusers_title%]',
331
+    'body' => '<div class="userstable">[+OnlineInfo+]</div>',
332
+    'hide'=>'0'
333 333
 );
334 334
 $widgets['recentinfo'] = array(
335
-	'menuindex' => '30',
336
-	'id' => 'modxrecent_widget',
337
-	'cols' => 'col-sm-12',
338
-	'icon' => 'fa-pencil-square-o',
339
-	'title' => '[%activity_title%]',
340
-	'body' => '<div class="widget-stage">[+RecentInfo+]</div>',
341
-	'hide'=>'0'
335
+    'menuindex' => '30',
336
+    'id' => 'modxrecent_widget',
337
+    'cols' => 'col-sm-12',
338
+    'icon' => 'fa-pencil-square-o',
339
+    'title' => '[%activity_title%]',
340
+    'body' => '<div class="widget-stage">[+RecentInfo+]</div>',
341
+    'hide'=>'0'
342 342
 );
343 343
 if ($modx->config['rss_url_news']) {
344 344
     $widgets['news'] = array(
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 // invoke OnManagerWelcomeHome event
367 367
 $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
368 368
 if(is_array($sitewidgets)) {
369
-	$newwidgets = array();
369
+    $newwidgets = array();
370 370
     foreach($sitewidgets as $widget){
371 371
         $newwidgets = array_merge($newwidgets, unserialize($widget));
372 372
     }
@@ -374,21 +374,21 @@  discard block
 block discarded – undo
374 374
 }
375 375
 
376 376
 usort($widgets, function ($a, $b) {
377
-	return $a['menuindex'] - $b['menuindex'];
377
+    return $a['menuindex'] - $b['menuindex'];
378 378
 });
379 379
 
380 380
 $tpl = getTplWidget();
381 381
 $output = '';
382 382
 foreach($widgets as $widget) {
383
-	if ($widget['hide'] != '1'){
384
-		$output .= $modx->parseText($tpl, $widget);
385
-	}
383
+    if ($widget['hide'] != '1'){
384
+        $output .= $modx->parseText($tpl, $widget);
385
+    }
386 386
 }
387 387
 $ph['widgets'] = $output;
388 388
 
389 389
 // load template
390 390
 if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
391
-	$modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl';
391
+    $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl';
392 392
 }
393 393
 
394 394
 $target = $modx->config['manager_welcome_tpl'];
@@ -396,27 +396,27 @@  discard block
 block discarded – undo
396 396
 $target = $modx->mergeSettingsContent($target);
397 397
 
398 398
 if(substr($target, 0, 1) === '@') {
399
-	if(substr($target, 0, 6) === '@CHUNK') {
400
-		$content = $modx->getChunk(trim(substr($target, 7)));
401
-	} elseif(substr($target, 0, 5) === '@FILE') {
402
-		$content = file_get_contents(trim(substr($target, 6)));
403
-	} else {
404
-		$content = '';
405
-	}
399
+    if(substr($target, 0, 6) === '@CHUNK') {
400
+        $content = $modx->getChunk(trim(substr($target, 7)));
401
+    } elseif(substr($target, 0, 5) === '@FILE') {
402
+        $content = file_get_contents(trim(substr($target, 6)));
403
+    } else {
404
+        $content = '';
405
+    }
406 406
 } else {
407
-	$chunk = $modx->getChunk($target);
408
-	if($chunk !== false && !empty($chunk)) {
409
-		$content = $chunk;
410
-	} elseif(is_file(MODX_BASE_PATH . $target)) {
411
-		$content = file_get_contents(MODX_BASE_PATH . $target);
412
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
413
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl');
414
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible
415
-	{
416
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
417
-	} else {
418
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl');
419
-	}
407
+    $chunk = $modx->getChunk($target);
408
+    if($chunk !== false && !empty($chunk)) {
409
+        $content = $chunk;
410
+    } elseif(is_file(MODX_BASE_PATH . $target)) {
411
+        $content = file_get_contents(MODX_BASE_PATH . $target);
412
+    } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
413
+        $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl');
414
+    } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible
415
+    {
416
+        $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
417
+    } else {
418
+        $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl');
419
+    }
420 420
 }
421 421
 
422 422
 // merge placeholders
@@ -424,8 +424,8 @@  discard block
 block discarded – undo
424 424
 $content = $modx->mergeSettingsContent($content);
425 425
 $content = $modx->parseText($content, $ph);
426 426
 if(strpos($content, '[+') !== false) {
427
-	$modx->toPlaceholders($ph);
428
-	$content = $modx->mergePlaceholderContent($content);
427
+    $modx->toPlaceholders($ph);
428
+    $content = $modx->mergePlaceholderContent($content);
429 429
 }
430 430
 $content = $modx->parseDocumentSource($content);
431 431
 $content = $modx->parseText($content, $_lang, '[%', '%]');
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 $content = $modx->cleanUpMODXTags($content); //cleanup
434 434
 
435 435
 if($js = $modx->getRegisteredClientScripts()) {
436
-	$content .= $js;
436
+    $content .= $js;
437 437
 }
438 438
 
439 439
 echo $content;
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
 //  <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a>
444 444
 //</span>
445 445
 function getTplWidget() { // recent document info
446
-	return '
446
+    return '
447 447
 		<div class="[+cols+]" id="[+id+]">
448 448
 			<div class="card"[+cardAttr+]>
449 449
 				<div class="card-header"[+headAttr+]> <i class="fa [+icon+]"></i> [+title+] </div>
@@ -454,11 +454,11 @@  discard block
 block discarded – undo
454 454
 }
455 455
 
456 456
 function getRecentInfo() { // recent document info
457
-	global $modx;
457
+    global $modx;
458 458
 
459
-	$modx->addSnippet('recentInfoList', 'getRecentInfoList');
459
+    $modx->addSnippet('recentInfoList', 'getRecentInfoList');
460 460
 
461
-	$html = '
461
+    $html = '
462 462
 			<div class="table-responsive">
463 463
 				<table class="table data">
464 464
 					<thead>
@@ -476,96 +476,96 @@  discard block
 block discarded – undo
476 476
 				</table>
477 477
 			</div>
478 478
 ';
479
-	return $html;
479
+    return $html;
480 480
 }
481 481
 
482 482
 function getRecentInfoList() {
483
-	global $modx;
484
-
485
-	$rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
486
-
487
-	if($modx->db->getRecordCount($rs) < 1) {
488
-		return '<tr><td>[%no_activity_message%]</td></tr>';
489
-	}
490
-
491
-	$tpl = getRecentInfoRowTpl();
492
-
493
-	$btntpl['edit'] = '<a title="[%edit_resource%]" href="index.php?a=27&amp;id=[+id+]" target="main"><i class="fa fa-edit fa-fw"></i></a> ';
494
-	$btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&amp;id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> ';
495
-
496
-	$output = array();
497
-	while($ph = $modx->db->getRow($rs)) {
498
-		$docid = $ph['id'];
499
-		$_ = $modx->getUserInfo($ph['editedby']);
500
-		$ph['username'] = $_['username'];
501
-
502
-		if($ph['deleted'] == 1) {
503
-			$ph['status'] = 'deleted text-danger';
504
-		} elseif($ph['published'] == 0) {
505
-			$ph['status'] = 'unpublished font-italic text-muted';
506
-		} else {
507
-			$ph['status'] = 'published';
508
-		}
509
-
510
-		if($modx->hasPermission('edit_document')) {
511
-			$ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
512
-		} else {
513
-			$ph['edit_btn'] = '';
514
-		}
515
-
516
-		$preview_disabled = ($ph['deleted'] == 1) ? 'disabled' : '';
517
-		$ph['preview_btn'] = str_replace(array(
518
-			'[+id+]',
519
-			'[+preview_disabled+]'
520
-		), array(
521
-			$docid,
522
-			$preview_disabled
523
-		), $btntpl['preview_btn']);
524
-
525
-		if($modx->hasPermission('delete_document')) {
526
-			if($ph['deleted'] == 0) {
527
-				$delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&amp;id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> ';
528
-			} else {
529
-				$delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&amp;id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> ';
530
-			}
531
-			$ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn);
532
-		} else {
533
-			$ph['delete_btn'] = '';
534
-		}
535
-
536
-		if($ph['deleted'] == 1 && $ph['published'] == 0) {
537
-			$publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> ';
538
-		} elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
539
-			$publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> ';
540
-		} elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
541
-			$publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> ';
542
-		} else {
543
-			$publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&amp;id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> ';
544
-		}
545
-		$ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn);
546
-
547
-		$ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>');
548
-
549
-		if($ph['longtitle'] == '') {
550
-			$ph['longtitle'] = '(<i>[%not_set%]</i>)';
551
-		}
552
-		if($ph['description'] == '') {
553
-			$ph['description'] = '(<i>[%not_set%]</i>)';
554
-		}
555
-		if($ph['introtext'] == '') {
556
-			$ph['introtext'] = '(<i>[%not_set%]</i>)';
557
-		}
558
-		if($ph['alias'] == '') {
559
-			$ph['alias'] = '(<i>[%not_set%]</i>)';
560
-		}
561
-
562
-		$output[] = $modx->parseText($tpl, $ph);
563
-	}
564
-	return implode("\n", $output);
483
+    global $modx;
484
+
485
+    $rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
486
+
487
+    if($modx->db->getRecordCount($rs) < 1) {
488
+        return '<tr><td>[%no_activity_message%]</td></tr>';
489
+    }
490
+
491
+    $tpl = getRecentInfoRowTpl();
492
+
493
+    $btntpl['edit'] = '<a title="[%edit_resource%]" href="index.php?a=27&amp;id=[+id+]" target="main"><i class="fa fa-edit fa-fw"></i></a> ';
494
+    $btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&amp;id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> ';
495
+
496
+    $output = array();
497
+    while($ph = $modx->db->getRow($rs)) {
498
+        $docid = $ph['id'];
499
+        $_ = $modx->getUserInfo($ph['editedby']);
500
+        $ph['username'] = $_['username'];
501
+
502
+        if($ph['deleted'] == 1) {
503
+            $ph['status'] = 'deleted text-danger';
504
+        } elseif($ph['published'] == 0) {
505
+            $ph['status'] = 'unpublished font-italic text-muted';
506
+        } else {
507
+            $ph['status'] = 'published';
508
+        }
509
+
510
+        if($modx->hasPermission('edit_document')) {
511
+            $ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
512
+        } else {
513
+            $ph['edit_btn'] = '';
514
+        }
515
+
516
+        $preview_disabled = ($ph['deleted'] == 1) ? 'disabled' : '';
517
+        $ph['preview_btn'] = str_replace(array(
518
+            '[+id+]',
519
+            '[+preview_disabled+]'
520
+        ), array(
521
+            $docid,
522
+            $preview_disabled
523
+        ), $btntpl['preview_btn']);
524
+
525
+        if($modx->hasPermission('delete_document')) {
526
+            if($ph['deleted'] == 0) {
527
+                $delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&amp;id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> ';
528
+            } else {
529
+                $delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&amp;id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> ';
530
+            }
531
+            $ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn);
532
+        } else {
533
+            $ph['delete_btn'] = '';
534
+        }
535
+
536
+        if($ph['deleted'] == 1 && $ph['published'] == 0) {
537
+            $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> ';
538
+        } elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
539
+            $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> ';
540
+        } elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
541
+            $publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> ';
542
+        } else {
543
+            $publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&amp;id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> ';
544
+        }
545
+        $ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn);
546
+
547
+        $ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>');
548
+
549
+        if($ph['longtitle'] == '') {
550
+            $ph['longtitle'] = '(<i>[%not_set%]</i>)';
551
+        }
552
+        if($ph['description'] == '') {
553
+            $ph['description'] = '(<i>[%not_set%]</i>)';
554
+        }
555
+        if($ph['introtext'] == '') {
556
+            $ph['introtext'] = '(<i>[%not_set%]</i>)';
557
+        }
558
+        if($ph['alias'] == '') {
559
+            $ph['alias'] = '(<i>[%not_set%]</i>)';
560
+        }
561
+
562
+        $output[] = $modx->parseText($tpl, $ph);
563
+    }
564
+    return implode("\n", $output);
565 565
 }
566 566
 
567 567
 function getRecentInfoRowTpl() {
568
-	$tpl = '
568
+    $tpl = '
569 569
 						<tr>
570 570
 							<td data-toggle="collapse" data-target=".collapse[+id+]" class="text-right"><span class="label label-info">[+id+]</span></td>
571 571
 							<td data-toggle="collapse" data-target=".collapse[+id+]"><a class="[+status+]" title="[%edit_resource%]" href="index.php?a=3&amp;id=[+id+]" target="main">[+pagetitle+]</a></td>
@@ -589,16 +589,16 @@  discard block
 block discarded – undo
589 589
 								</div>
590 590
 							</td>
591 591
 						</tr>';
592
-	return $tpl;
592
+    return $tpl;
593 593
 }
594 594
 
595 595
 // setup icons
596 596
 function wrapIcon($i, $action) {
597
-	return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i);
597
+    return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i);
598 598
 }
599 599
 
600 600
 function getStartUpScript() {
601
-	$script = '
601
+    $script = '
602 602
         <script type="text/javascript">
603 603
         function hideConfigCheckWarning(key) {
604 604
         	var xhr = new XMLHttpRequest();
@@ -622,5 +622,5 @@  discard block
 block discarded – undo
622 622
 		})(jQuery);        
623 623
         </script>
624 624
 ';
625
-	return $script;
625
+    return $script;
626 626
 }
Please login to merge, or discard this patch.