Completed
Pull Request — develop (#534)
by Agel_Nash
06:46 queued 01:24
created
manager/actions/welcome.static.php 3 patches
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-sm-6',
243
-	'icon' => 'fa-home',
244
-	'title' => '[%welcome_title%]',
245
-	'body' => '
240
+    'menuindex' => '10',
241
+    'id' => 'welcome',
242
+    'cols' => 'col-sm-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-sm-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-sm-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.
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 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
-if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
8
+if ($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
9 9
 	// seems to be a new install - send the user to the configuration page
10 10
 	exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
11 11
 }
@@ -16,50 +16,50 @@  discard block
 block discarded – undo
16 16
 $_SESSION['nrnewmessages'] = 0;
17 17
 
18 18
 // setup message info
19
-if($modx->hasPermission('messages')) {
20
-	include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php');
19
+if ($modx->hasPermission('messages')) {
20
+	include_once(MODX_MANAGER_PATH.'includes/messageCount.inc.php');
21 21
 	$_SESSION['nrtotalmessages'] = $nrtotalmessages;
22 22
 	$_SESSION['nrnewmessages'] = $nrnewmessages;
23 23
 
24 24
 	$msg = array();
25 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>)' : '';
26
+	$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">'.$_SESSION['nrnewmessages'].'</span>)' : '';
27 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';
28
+	$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">'.$_SESSION['nrnewmessages'].'</span>' : '0';
29 29
 	$welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages);
30 30
 	$msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages);
31 31
 	$ph['MessageInfo'] = implode("\n", $msg);
32 32
 }
33 33
 
34 34
 // setup icons
35
-if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
35
+if ($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
36 36
 	$icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]';
37 37
 	$ph['SecurityIcon'] = wrapIcon($icon, 75);
38 38
 }
39
-if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
39
+if ($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
40 40
 	$icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]';
41 41
 	$ph['WebUserIcon'] = wrapIcon($icon, 99);
42 42
 }
43
-if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
43
+if ($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
44 44
 	$icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]';
45 45
 	$ph['ModulesIcon'] = wrapIcon($icon, 106);
46 46
 }
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')) {
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 48
 	$icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]';
49 49
 	$ph['ResourcesIcon'] = wrapIcon($icon, 76);
50 50
 }
51
-if($modx->hasPermission('bk_manager')) {
51
+if ($modx->hasPermission('bk_manager')) {
52 52
 	$icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]';
53 53
 	$ph['BackupIcon'] = wrapIcon($icon, 93);
54 54
 }
55
-if($modx->hasPermission('help')) {
55
+if ($modx->hasPermission('help')) {
56 56
 	$icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]';
57 57
 	$ph['HelpIcon'] = wrapIcon($icon, 9);
58 58
 }
59 59
 // do some config checks
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']) {
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 63
 		$ph['config_check_results'] = $config_check_results;
64 64
 		$ph['config_display'] = 'block';
65 65
 	} else {
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
 }
71 71
 
72 72
 // Check logout-reminder
73
-if(isset($_SESSION['show_logout_reminder'])) {
74
-	switch($_SESSION['show_logout_reminder']['type']) {
73
+if (isset($_SESSION['show_logout_reminder'])) {
74
+	switch ($_SESSION['show_logout_reminder']['type']) {
75 75
 		case 'logout_reminder':
76 76
 			$date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly');
77 77
 			$ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	</tr>
126 126
 </table>';
127 127
 
128
-$nrnewmessages = '<span class="text-danger">' . $_SESSION['nrnewmessages'] . '</span>';
128
+$nrnewmessages = '<span class="text-danger">'.$_SESSION['nrnewmessages'].'</span>';
129 129
 
130 130
 $ph['UserInfo'] = $modx->parseText($tpl, array(
131 131
 	'username' => $modx->getLoginUserName(),
@@ -140,10 +140,10 @@  discard block
 block discarded – undo
140 140
 $from[] = " us LEFT JOIN [+prefix+]active_users au ON au.sid=us.sid WHERE au.action <> '8'";
141 141
 $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC');
142 142
 
143
-if($modx->db->getRecordCount($rs) < 1) {
143
+if ($modx->db->getRecordCount($rs) < 1) {
144 144
 	$html = '<p>[%no_active_users_found%]</p>';
145 145
 } else {
146
-	include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
146
+	include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php');
147 147
 	$now = $_SERVER['REQUEST_TIME'] + $server_offset_time;
148 148
 	$ph['now'] = strftime('%H:%M:%S', $now);
149 149
 	$timetocheck = ($now - (60 * 20)); //+$server_offset_time;
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	$userList = array();
169 169
 	$userCount = array();
170 170
 	// Create userlist with session-count first before output
171
-	while($activeusers = $modx->db->getRow($rs)) {
171
+	while ($activeusers = $modx->db->getRow($rs)) {
172 172
 		$userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1;
173 173
 
174 174
 		$idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : '';
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
 			$currentaction
187 187
 		);
188 188
 	}
189
-	foreach($userList as $params) {
189
+	foreach ($userList as $params) {
190 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);
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 192
 	}
193 193
 
194 194
 	$html .= '
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 $ph['OnlineInfo'] = $html;
201 201
 
202 202
 // include rss feeds for important forum topics
203
-include_once(MODX_MANAGER_PATH . 'includes/rss.inc.php');
203
+include_once(MODX_MANAGER_PATH.'includes/rss.inc.php');
204 204
 $ph['modx_security_notices_content'] = $feedData['modx_security_notices_content'];
205 205
 $ph['modx_news_content'] = $feedData['modx_news_content'];
206 206
 
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 
232 232
 // invoke event OnManagerWelcomePrerender
233 233
 $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender');
234
-if(is_array($evtOut)) {
234
+if (is_array($evtOut)) {
235 235
 	$output = implode('', $evtOut);
236 236
 	$ph['OnManagerWelcomePrerender'] = $output;
237 237
 }
@@ -365,57 +365,57 @@  discard block
 block discarded – undo
365 365
 
366 366
 // invoke OnManagerWelcomeHome event
367 367
 $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
368
-if(is_array($sitewidgets)) {
368
+if (is_array($sitewidgets)) {
369 369
 	$newwidgets = array();
370
-    foreach($sitewidgets as $widget){
370
+    foreach ($sitewidgets as $widget) {
371 371
         $newwidgets = array_merge($newwidgets, unserialize($widget));
372 372
     }
373 373
     $widgets = (count($newwidgets) > 0) ? $newwidgets : $widgets;
374 374
 }
375 375
 
376
-usort($widgets, function ($a, $b) {
376
+usort($widgets, function($a, $b){
377 377
 	return $a['menuindex'] - $b['menuindex'];
378 378
 });
379 379
 
380 380
 $tpl = getTplWidget();
381 381
 $output = '';
382
-foreach($widgets as $widget) {
383
-	if ($widget['hide'] != '1'){
382
+foreach ($widgets as $widget) {
383
+	if ($widget['hide'] != '1') {
384 384
 		$output .= $modx->parseText($tpl, $widget);
385 385
 	}
386 386
 }
387 387
 $ph['widgets'] = $output;
388 388
 
389 389
 // load template
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';
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';
392 392
 }
393 393
 
394 394
 $target = $modx->config['manager_welcome_tpl'];
395 395
 $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target);
396 396
 $target = $modx->mergeSettingsContent($target);
397 397
 
398
-if(substr($target, 0, 1) === '@') {
399
-	if(substr($target, 0, 6) === '@CHUNK') {
398
+if (substr($target, 0, 1) === '@') {
399
+	if (substr($target, 0, 6) === '@CHUNK') {
400 400
 		$content = $modx->getChunk(trim(substr($target, 7)));
401
-	} elseif(substr($target, 0, 5) === '@FILE') {
401
+	} elseif (substr($target, 0, 5) === '@FILE') {
402 402
 		$content = file_get_contents(trim(substr($target, 6)));
403 403
 	} else {
404 404
 		$content = '';
405 405
 	}
406 406
 } else {
407 407
 	$chunk = $modx->getChunk($target);
408
-	if($chunk !== false && !empty($chunk)) {
408
+	if ($chunk !== false && !empty($chunk)) {
409 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
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 415
 	{
416
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
416
+		$content = file_get_contents(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/html/welcome.html');
417 417
 	} else {
418
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl');
418
+		$content = file_get_contents(MODX_MANAGER_PATH.'media/style/common/welcome.tpl');
419 419
 	}
420 420
 }
421 421
 
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
 $content = $modx->mergeConditionalTagsContent($content);
424 424
 $content = $modx->mergeSettingsContent($content);
425 425
 $content = $modx->parseText($content, $ph);
426
-if(strpos($content, '[+') !== false) {
426
+if (strpos($content, '[+') !== false) {
427 427
 	$modx->toPlaceholders($ph);
428 428
 	$content = $modx->mergePlaceholderContent($content);
429 429
 }
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 $content = $modx->parseText($content, $_style, '[&', '&]');
433 433
 $content = $modx->cleanUpMODXTags($content); //cleanup
434 434
 
435
-if($js = $modx->getRegisteredClientScripts()) {
435
+if ($js = $modx->getRegisteredClientScripts()) {
436 436
 	$content .= $js;
437 437
 }
438 438
 
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 //	<a href="javascript:;" class="setting"><i class="fa fa-cog"></i></a>
443 443
 //  <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a>
444 444
 //</span>
445
-function getTplWidget() { // recent document info
445
+function getTplWidget(){ // recent document info
446 446
 	return '
447 447
 		<div class="[+cols+]" id="[+id+]">
448 448
 			<div class="card"[+cardAttr+]>
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 ';
454 454
 }
455 455
 
456
-function getRecentInfo() { // recent document info
456
+function getRecentInfo(){ // recent document info
457 457
 	global $modx;
458 458
 
459 459
 	$modx->addSnippet('recentInfoList', 'getRecentInfoList');
@@ -479,12 +479,12 @@  discard block
 block discarded – undo
479 479
 	return $html;
480 480
 }
481 481
 
482
-function getRecentInfoList() {
482
+function getRecentInfoList(){
483 483
 	global $modx;
484 484
 
485 485
 	$rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
486 486
 
487
-	if($modx->db->getRecordCount($rs) < 1) {
487
+	if ($modx->db->getRecordCount($rs) < 1) {
488 488
 		return '<tr><td>[%no_activity_message%]</td></tr>';
489 489
 	}
490 490
 
@@ -494,20 +494,20 @@  discard block
 block discarded – undo
494 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 495
 
496 496
 	$output = array();
497
-	while($ph = $modx->db->getRow($rs)) {
497
+	while ($ph = $modx->db->getRow($rs)) {
498 498
 		$docid = $ph['id'];
499 499
 		$_ = $modx->getUserInfo($ph['editedby']);
500 500
 		$ph['username'] = $_['username'];
501 501
 
502
-		if($ph['deleted'] == 1) {
502
+		if ($ph['deleted'] == 1) {
503 503
 			$ph['status'] = 'deleted text-danger';
504
-		} elseif($ph['published'] == 0) {
504
+		} elseif ($ph['published'] == 0) {
505 505
 			$ph['status'] = 'unpublished font-italic text-muted';
506 506
 		} else {
507 507
 			$ph['status'] = 'published';
508 508
 		}
509 509
 
510
-		if($modx->hasPermission('edit_document')) {
510
+		if ($modx->hasPermission('edit_document')) {
511 511
 			$ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
512 512
 		} else {
513 513
 			$ph['edit_btn'] = '';
@@ -522,8 +522,8 @@  discard block
 block discarded – undo
522 522
 			$preview_disabled
523 523
 		), $btntpl['preview_btn']);
524 524
 
525
-		if($modx->hasPermission('delete_document')) {
526
-			if($ph['deleted'] == 0) {
525
+		if ($modx->hasPermission('delete_document')) {
526
+			if ($ph['deleted'] == 0) {
527 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 528
 			} else {
529 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> ';
@@ -533,11 +533,11 @@  discard block
 block discarded – undo
533 533
 			$ph['delete_btn'] = '';
534 534
 		}
535 535
 
536
-		if($ph['deleted'] == 1 && $ph['published'] == 0) {
536
+		if ($ph['deleted'] == 1 && $ph['published'] == 0) {
537 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) {
538
+		} elseif ($ph['deleted'] == 1 && $ph['published'] == 1) {
539 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) {
540
+		} elseif ($ph['deleted'] == 0 && $ph['published'] == 0) {
541 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 542
 		} else {
543 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> ';
@@ -546,16 +546,16 @@  discard block
 block discarded – undo
546 546
 
547 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 548
 
549
-		if($ph['longtitle'] == '') {
549
+		if ($ph['longtitle'] == '') {
550 550
 			$ph['longtitle'] = '(<i>[%not_set%]</i>)';
551 551
 		}
552
-		if($ph['description'] == '') {
552
+		if ($ph['description'] == '') {
553 553
 			$ph['description'] = '(<i>[%not_set%]</i>)';
554 554
 		}
555
-		if($ph['introtext'] == '') {
555
+		if ($ph['introtext'] == '') {
556 556
 			$ph['introtext'] = '(<i>[%not_set%]</i>)';
557 557
 		}
558
-		if($ph['alias'] == '') {
558
+		if ($ph['alias'] == '') {
559 559
 			$ph['alias'] = '(<i>[%not_set%]</i>)';
560 560
 		}
561 561
 
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
 	return implode("\n", $output);
565 565
 }
566 566
 
567
-function getRecentInfoRowTpl() {
567
+function getRecentInfoRowTpl(){
568 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>
@@ -593,11 +593,11 @@  discard block
 block discarded – undo
593 593
 }
594 594
 
595 595
 // setup icons
596
-function wrapIcon($i, $action) {
596
+function wrapIcon($i, $action){
597 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
-function getStartUpScript() {
600
+function getStartUpScript(){
601 601
 	$script = '
602 602
         <script type="text/javascript">
603 603
         function hideConfigCheckWarning(key) {
Please login to merge, or discard this patch.
Braces   +77 added lines, -67 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 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
-if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
8
+if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
9 9
 	// seems to be a new install - send the user to the configuration page
10 10
 	exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
11 11
 }
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 $_SESSION['nrnewmessages'] = 0;
17 17
 
18 18
 // setup message info
19
-if($modx->hasPermission('messages')) {
19
+if($modx->hasPermission('messages')) {
20 20
 	include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php');
21 21
 	$_SESSION['nrtotalmessages'] = $nrtotalmessages;
22 22
 	$_SESSION['nrnewmessages'] = $nrnewmessages;
@@ -32,46 +32,46 @@  discard block
 block discarded – undo
32 32
 }
33 33
 
34 34
 // setup icons
35
-if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
35
+if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
36 36
 	$icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]';
37 37
 	$ph['SecurityIcon'] = wrapIcon($icon, 75);
38 38
 }
39
-if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
39
+if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
40 40
 	$icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]';
41 41
 	$ph['WebUserIcon'] = wrapIcon($icon, 99);
42 42
 }
43
-if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
43
+if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
44 44
 	$icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]';
45 45
 	$ph['ModulesIcon'] = wrapIcon($icon, 106);
46 46
 }
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')) {
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 48
 	$icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]';
49 49
 	$ph['ResourcesIcon'] = wrapIcon($icon, 76);
50 50
 }
51
-if($modx->hasPermission('bk_manager')) {
51
+if($modx->hasPermission('bk_manager')) {
52 52
 	$icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]';
53 53
 	$ph['BackupIcon'] = wrapIcon($icon, 93);
54 54
 }
55
-if($modx->hasPermission('help')) {
55
+if($modx->hasPermission('help')) {
56 56
 	$icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]';
57 57
 	$ph['HelpIcon'] = wrapIcon($icon, 9);
58 58
 }
59 59
 // do some config checks
60
-if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
60
+if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
61 61
 	include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php');
62
-	if($config_check_results != $_lang['configcheck_ok']) {
62
+	if($config_check_results != $_lang['configcheck_ok']) {
63 63
 		$ph['config_check_results'] = $config_check_results;
64 64
 		$ph['config_display'] = 'block';
65
-	} else {
65
+	} else {
66 66
 		$ph['config_display'] = 'none';
67 67
 	}
68
-} else {
68
+} else {
69 69
 	$ph['config_display'] = 'none';
70 70
 }
71 71
 
72 72
 // Check logout-reminder
73
-if(isset($_SESSION['show_logout_reminder'])) {
74
-	switch($_SESSION['show_logout_reminder']['type']) {
73
+if(isset($_SESSION['show_logout_reminder'])) {
74
+	switch($_SESSION['show_logout_reminder']['type']) {
75 75
 		case 'logout_reminder':
76 76
 			$date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly');
77 77
 			$ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	}
80 80
 	$ph['show_logout_reminder'] = 'block';
81 81
 	unset($_SESSION['show_logout_reminder']);
82
-} else {
82
+} else {
83 83
 	$ph['show_logout_reminder'] = 'none';
84 84
 }
85 85
 
@@ -140,9 +140,9 @@  discard block
 block discarded – undo
140 140
 $from[] = " us LEFT JOIN [+prefix+]active_users au ON au.sid=us.sid WHERE au.action <> '8'";
141 141
 $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC');
142 142
 
143
-if($modx->db->getRecordCount($rs) < 1) {
143
+if($modx->db->getRecordCount($rs) < 1) {
144 144
 	$html = '<p>[%no_active_users_found%]</p>';
145
-} else {
145
+} else {
146 146
 	include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
147 147
 	$now = $_SERVER['REQUEST_TIME'] + $server_offset_time;
148 148
 	$ph['now'] = strftime('%H:%M:%S', $now);
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	$userList = array();
169 169
 	$userCount = array();
170 170
 	// Create userlist with session-count first before output
171
-	while($activeusers = $modx->db->getRow($rs)) {
171
+	while($activeusers = $modx->db->getRow($rs)) {
172 172
 		$userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1;
173 173
 
174 174
 		$idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : '';
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 			$currentaction
187 187
 		);
188 188
 	}
189
-	foreach($userList as $params) {
189
+	foreach($userList as $params) {
190 190
 		$params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : '';
191 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 192
 	}
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 
232 232
 // invoke event OnManagerWelcomePrerender
233 233
 $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender');
234
-if(is_array($evtOut)) {
234
+if(is_array($evtOut)) {
235 235
 	$output = implode('', $evtOut);
236 236
 	$ph['OnManagerWelcomePrerender'] = $output;
237 237
 }
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 	'body' => '<div class="widget-stage">[+RecentInfo+]</div>',
341 341
 	'hide'=>'0'
342 342
 );
343
-if ($modx->config['rss_url_news']) {
343
+if ($modx->config['rss_url_news']) {
344 344
     $widgets['news'] = array(
345 345
         'menuindex' => '40',
346 346
         'id' => 'news',
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
         'hide'=>'0'
352 352
     );
353 353
 }
354
-if ($modx->config['rss_url_security']) {
354
+if ($modx->config['rss_url_security']) {
355 355
     $widgets['security'] = array(
356 356
         'menuindex' => '50',
357 357
         'id' => 'security',
@@ -365,29 +365,29 @@  discard block
 block discarded – undo
365 365
 
366 366
 // invoke OnManagerWelcomeHome event
367 367
 $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
368
-if(is_array($sitewidgets)) {
368
+if(is_array($sitewidgets)) {
369 369
 	$newwidgets = array();
370
-    foreach($sitewidgets as $widget){
370
+    foreach($sitewidgets as $widget) {
371 371
         $newwidgets = array_merge($newwidgets, unserialize($widget));
372 372
     }
373 373
     $widgets = (count($newwidgets) > 0) ? $newwidgets : $widgets;
374 374
 }
375 375
 
376
-usort($widgets, function ($a, $b) {
376
+usort($widgets, function ($a, $b){
377 377
 	return $a['menuindex'] - $b['menuindex'];
378 378
 });
379 379
 
380 380
 $tpl = getTplWidget();
381 381
 $output = '';
382
-foreach($widgets as $widget) {
383
-	if ($widget['hide'] != '1'){
382
+foreach($widgets as $widget) {
383
+	if ($widget['hide'] != '1') {
384 384
 		$output .= $modx->parseText($tpl, $widget);
385 385
 	}
386 386
 }
387 387
 $ph['widgets'] = $output;
388 388
 
389 389
 // load template
390
-if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
390
+if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
391 391
 	$modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl';
392 392
 }
393 393
 
@@ -395,26 +395,28 @@  discard block
 block discarded – undo
395 395
 $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target);
396 396
 $target = $modx->mergeSettingsContent($target);
397 397
 
398
-if(substr($target, 0, 1) === '@') {
399
-	if(substr($target, 0, 6) === '@CHUNK') {
398
+if(substr($target, 0, 1) === '@') {
399
+	if(substr($target, 0, 6) === '@CHUNK') {
400 400
 		$content = $modx->getChunk(trim(substr($target, 7)));
401
-	} elseif(substr($target, 0, 5) === '@FILE') {
401
+	} elseif(substr($target, 0, 5) === '@FILE') {
402 402
 		$content = file_get_contents(trim(substr($target, 6)));
403
-	} else {
403
+	} else {
404 404
 		$content = '';
405 405
 	}
406
-} else {
406
+} else {
407 407
 	$chunk = $modx->getChunk($target);
408
-	if($chunk !== false && !empty($chunk)) {
408
+	if($chunk !== false && !empty($chunk)) {
409 409
 		$content = $chunk;
410
-	} elseif(is_file(MODX_BASE_PATH . $target)) {
410
+	} elseif(is_file(MODX_BASE_PATH . $target)) {
411 411
 		$content = file_get_contents(MODX_BASE_PATH . $target);
412
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
412
+	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
413 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
414
+	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) {
415
+	    // ClipperCMS compatible
415 416
 	{
416
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
417
-	} else {
417
+		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
418
+	}
419
+	} else {
418 420
 		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl');
419 421
 	}
420 422
 }
@@ -423,7 +425,7 @@  discard block
 block discarded – undo
423 425
 $content = $modx->mergeConditionalTagsContent($content);
424 426
 $content = $modx->mergeSettingsContent($content);
425 427
 $content = $modx->parseText($content, $ph);
426
-if(strpos($content, '[+') !== false) {
428
+if(strpos($content, '[+') !== false) {
427 429
 	$modx->toPlaceholders($ph);
428 430
 	$content = $modx->mergePlaceholderContent($content);
429 431
 }
@@ -432,7 +434,7 @@  discard block
 block discarded – undo
432 434
 $content = $modx->parseText($content, $_style, '[&', '&]');
433 435
 $content = $modx->cleanUpMODXTags($content); //cleanup
434 436
 
435
-if($js = $modx->getRegisteredClientScripts()) {
437
+if($js = $modx->getRegisteredClientScripts()) {
436 438
 	$content .= $js;
437 439
 }
438 440
 
@@ -442,7 +444,9 @@  discard block
 block discarded – undo
442 444
 //	<a href="javascript:;" class="setting"><i class="fa fa-cog"></i></a>
443 445
 //  <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a>
444 446
 //</span>
445
-function getTplWidget() { // recent document info
447
+function getTplWidget()
448
+{
449
+// recent document info
446 450
 	return '
447 451
 		<div class="[+cols+]" id="[+id+]">
448 452
 			<div class="card"[+cardAttr+]>
@@ -453,7 +457,9 @@  discard block
 block discarded – undo
453 457
 ';
454 458
 }
455 459
 
456
-function getRecentInfo() { // recent document info
460
+function getRecentInfo()
461
+{
462
+// recent document info
457 463
 	global $modx;
458 464
 
459 465
 	$modx->addSnippet('recentInfoList', 'getRecentInfoList');
@@ -479,12 +485,13 @@  discard block
 block discarded – undo
479 485
 	return $html;
480 486
 }
481 487
 
482
-function getRecentInfoList() {
488
+function getRecentInfoList()
489
+{
483 490
 	global $modx;
484 491
 
485 492
 	$rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
486 493
 
487
-	if($modx->db->getRecordCount($rs) < 1) {
494
+	if($modx->db->getRecordCount($rs) < 1) {
488 495
 		return '<tr><td>[%no_activity_message%]</td></tr>';
489 496
 	}
490 497
 
@@ -494,22 +501,22 @@  discard block
 block discarded – undo
494 501
 	$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 502
 
496 503
 	$output = array();
497
-	while($ph = $modx->db->getRow($rs)) {
504
+	while($ph = $modx->db->getRow($rs)) {
498 505
 		$docid = $ph['id'];
499 506
 		$_ = $modx->getUserInfo($ph['editedby']);
500 507
 		$ph['username'] = $_['username'];
501 508
 
502
-		if($ph['deleted'] == 1) {
509
+		if($ph['deleted'] == 1) {
503 510
 			$ph['status'] = 'deleted text-danger';
504
-		} elseif($ph['published'] == 0) {
511
+		} elseif($ph['published'] == 0) {
505 512
 			$ph['status'] = 'unpublished font-italic text-muted';
506
-		} else {
513
+		} else {
507 514
 			$ph['status'] = 'published';
508 515
 		}
509 516
 
510
-		if($modx->hasPermission('edit_document')) {
517
+		if($modx->hasPermission('edit_document')) {
511 518
 			$ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
512
-		} else {
519
+		} else {
513 520
 			$ph['edit_btn'] = '';
514 521
 		}
515 522
 
@@ -522,40 +529,40 @@  discard block
 block discarded – undo
522 529
 			$preview_disabled
523 530
 		), $btntpl['preview_btn']);
524 531
 
525
-		if($modx->hasPermission('delete_document')) {
526
-			if($ph['deleted'] == 0) {
532
+		if($modx->hasPermission('delete_document')) {
533
+			if($ph['deleted'] == 0) {
527 534
 				$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 {
535
+			} else {
529 536
 				$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 537
 			}
531 538
 			$ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn);
532
-		} else {
539
+		} else {
533 540
 			$ph['delete_btn'] = '';
534 541
 		}
535 542
 
536
-		if($ph['deleted'] == 1 && $ph['published'] == 0) {
543
+		if($ph['deleted'] == 1 && $ph['published'] == 0) {
537 544
 			$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) {
545
+		} elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
539 546
 			$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) {
547
+		} elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
541 548
 			$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 {
549
+		} else {
543 550
 			$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 551
 		}
545 552
 		$ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn);
546 553
 
547 554
 		$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 555
 
549
-		if($ph['longtitle'] == '') {
556
+		if($ph['longtitle'] == '') {
550 557
 			$ph['longtitle'] = '(<i>[%not_set%]</i>)';
551 558
 		}
552
-		if($ph['description'] == '') {
559
+		if($ph['description'] == '') {
553 560
 			$ph['description'] = '(<i>[%not_set%]</i>)';
554 561
 		}
555
-		if($ph['introtext'] == '') {
562
+		if($ph['introtext'] == '') {
556 563
 			$ph['introtext'] = '(<i>[%not_set%]</i>)';
557 564
 		}
558
-		if($ph['alias'] == '') {
565
+		if($ph['alias'] == '') {
559 566
 			$ph['alias'] = '(<i>[%not_set%]</i>)';
560 567
 		}
561 568
 
@@ -564,7 +571,8 @@  discard block
 block discarded – undo
564 571
 	return implode("\n", $output);
565 572
 }
566 573
 
567
-function getRecentInfoRowTpl() {
574
+function getRecentInfoRowTpl()
575
+{
568 576
 	$tpl = '
569 577
 						<tr>
570 578
 							<td data-toggle="collapse" data-target=".collapse[+id+]" class="text-right"><span class="label label-info">[+id+]</span></td>
@@ -593,11 +601,13 @@  discard block
 block discarded – undo
593 601
 }
594 602
 
595 603
 // setup icons
596
-function wrapIcon($i, $action) {
604
+function wrapIcon($i, $action)
605
+{
597 606
 	return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i);
598 607
 }
599 608
 
600
-function getStartUpScript() {
609
+function getStartUpScript()
610
+{
601 611
 	$script = '
602 612
         <script type="text/javascript">
603 613
         function hideConfigCheckWarning(key) {
Please login to merge, or discard this patch.
manager/includes/charsets.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -65,26 +65,26 @@
 block discarded – undo
65 65
 $_['macintosh']         = 'Western European (Mac) - macintosh';
66 66
 $_['Windows-1252']      = 'Western European (Windows) - Windows-1252';
67 67
 
68
-if($modx_charset     == 'euc-jp')      $_['euc-jp']      = 'Japanese (EUC) - euc-jp';
69
-elseif($modx_charset == 'shift_jis')   $_['shift_jis']   = 'Japanese (Shift-JIS) - shift_jis';
70
-elseif($modx_charset == 'iso-2022-jp') $_['iso-2022-jp'] = 'Japanese (JIS-Allow 1 byte Kana - SO/SI) - iso-2022-jp';
71
-elseif($modx_charset == 'csISO2022JP') $_['csISO2022JP'] = 'Japanese (JIS-Allow 1 byte Kana) - csISO2022JP';
72
-elseif($modx_charset == 'EUC-CN')            $_['EUC-CN']            = 'Chinese Simplified (EUC) - EUC-CN';
73
-elseif($modx_charset == 'hz-gb-2312')        $_['hz-gb-2312']        = 'Chinese Simplified (HZ) - hz-gb-2312';
74
-elseif($modx_charset == 'x-mac-chinesesimp') $_['x-mac-chinesesimp'] = 'Chinese Simplified (Mac) - x-mac-chinesesimp';
75
-elseif($modx_charset == 'x-Chinese-CNS')     $_['x-Chinese-CNS']     = 'Chinese Traditional (CNS) - x-Chinese-CNS';
76
-elseif($modx_charset == 'x-Chinese-Eten')    $_['x-Chinese-Eten']    = 'Chinese Traditional (Eten) - x-Chinese-Eten';
77
-elseif($modx_charset == 'x-mac-chinesetrad') $_['x-mac-chinesetrad'] = 'Chinese Traditional (Mac) - x-mac-chinesetrad';
78
-elseif($modx_charset == 'ks_c_5601-1987') $_['ks_c_5601-1987'] = 'Korean - ks_c_5601-1987';
79
-elseif($modx_charset == 'euc-kr')         $_['euc-kr']         = 'Korean (EUC) - euc-kr';
80
-elseif($modx_charset == 'iso-2022-kr')    $_['iso-2022-kr']    = 'Korean (ISO) - iso-2022-kr';
81
-elseif($modx_charset == 'Johab')          $_['Johab']          = 'Korean (Johab) - Johab';
82
-elseif($modx_charset == 'x-mac-korean')   $_['x-mac-korean']   = 'Korean (Mac) - x-mac-korean';
68
+if ($modx_charset == 'euc-jp')      $_['euc-jp']      = 'Japanese (EUC) - euc-jp';
69
+elseif ($modx_charset == 'shift_jis')   $_['shift_jis']   = 'Japanese (Shift-JIS) - shift_jis';
70
+elseif ($modx_charset == 'iso-2022-jp') $_['iso-2022-jp'] = 'Japanese (JIS-Allow 1 byte Kana - SO/SI) - iso-2022-jp';
71
+elseif ($modx_charset == 'csISO2022JP') $_['csISO2022JP'] = 'Japanese (JIS-Allow 1 byte Kana) - csISO2022JP';
72
+elseif ($modx_charset == 'EUC-CN')            $_['EUC-CN']            = 'Chinese Simplified (EUC) - EUC-CN';
73
+elseif ($modx_charset == 'hz-gb-2312')        $_['hz-gb-2312']        = 'Chinese Simplified (HZ) - hz-gb-2312';
74
+elseif ($modx_charset == 'x-mac-chinesesimp') $_['x-mac-chinesesimp'] = 'Chinese Simplified (Mac) - x-mac-chinesesimp';
75
+elseif ($modx_charset == 'x-Chinese-CNS')     $_['x-Chinese-CNS']     = 'Chinese Traditional (CNS) - x-Chinese-CNS';
76
+elseif ($modx_charset == 'x-Chinese-Eten')    $_['x-Chinese-Eten']    = 'Chinese Traditional (Eten) - x-Chinese-Eten';
77
+elseif ($modx_charset == 'x-mac-chinesetrad') $_['x-mac-chinesetrad'] = 'Chinese Traditional (Mac) - x-mac-chinesetrad';
78
+elseif ($modx_charset == 'ks_c_5601-1987') $_['ks_c_5601-1987'] = 'Korean - ks_c_5601-1987';
79
+elseif ($modx_charset == 'euc-kr')         $_['euc-kr']         = 'Korean (EUC) - euc-kr';
80
+elseif ($modx_charset == 'iso-2022-kr')    $_['iso-2022-kr']    = 'Korean (ISO) - iso-2022-kr';
81
+elseif ($modx_charset == 'Johab')          $_['Johab']          = 'Korean (Johab) - Johab';
82
+elseif ($modx_charset == 'x-mac-korean')   $_['x-mac-korean']   = 'Korean (Mac) - x-mac-korean';
83 83
 
84 84
 $tpl = '<option value="%s" %s>%s</option>';
85 85
 $options = array();
86
-foreach($_ as $value=>$label) {
87
-    $selected = $value===$modx_charset ? 'selected' : '';
86
+foreach ($_ as $value=>$label) {
87
+    $selected = $value === $modx_charset ? 'selected' : '';
88 88
     $options[] = sprintf($tpl, $value, $selected, $label);
89 89
 }
90 90
 echo implode("\n", $options);
Please login to merge, or discard this patch.
manager/includes/config_check.inc.php 3 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -5,14 +5,14 @@  discard block
 block discarded – undo
5 5
 
6 6
 // PROCESSOR FIRST
7 7
 if($_SESSION['mgrRole'] == 1) {
8
-	if($_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) {
9
-		$current = $modx->manager->getSystemChecksum($modx->config['check_files_onlogin']);
10
-		if(!empty($current)) {
11
-			$modx->manager->setSystemChecksum($current);
12
-			$modx->clearCache('full');
13
-			$modx->config['sys_files_checksum'] = $current;
14
-		};
15
-	}
8
+    if($_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) {
9
+        $current = $modx->manager->getSystemChecksum($modx->config['check_files_onlogin']);
10
+        if(!empty($current)) {
11
+            $modx->manager->setSystemChecksum($current);
12
+            $modx->clearCache('full');
13
+            $modx->config['sys_files_checksum'] = $current;
14
+        };
15
+    }
16 16
 }
17 17
 
18 18
 // NOW CHECK CONFIG
@@ -20,15 +20,15 @@  discard block
 block discarded – undo
20 20
 
21 21
 $sysfiles_check = $modx->manager->checkSystemChecksum();
22 22
 if ($sysfiles_check!=='0'){
23
-      $warningspresent = 1;
24
-      $warnings[] = array($_lang['configcheck_sysfiles_mod']);
23
+        $warningspresent = 1;
24
+        $warnings[] = array($_lang['configcheck_sysfiles_mod']);
25 25
 }
26 26
 
27 27
 if (is_writable("includes/config.inc.php")){
28 28
     // Warn if world writable
29 29
     if(@fileperms('includes/config.inc.php') & 0x0002) {
30
-      $warningspresent = 1;
31
-      $warnings[] = array($_lang['configcheck_configinc']);
30
+        $warningspresent = 1;
31
+        $warnings[] = array($_lang['configcheck_configinc']);
32 32
     }
33 33
 }
34 34
 
@@ -179,10 +179,10 @@  discard block
 block discarded – undo
179 179
             break;
180 180
         case $_lang['configcheck_sysfiles_mod']:
181 181
             $warnings[$i][1] = $_lang["configcheck_sysfiles_mod_msg"];
182
-			$warnings[$i][2] = '<ul><li>'. implode('</li><li>', $sysfiles_check) .'</li></ul>';
183
-			if($modx->hasPermission('settings')) {
184
-				$warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\'' . $_lang["reset_sysfiles_checksum_alert"] . '\')">' . $_lang["reset_sysfiles_checksum_button"] . '</a></li></ul>';
185
-			}
182
+            $warnings[$i][2] = '<ul><li>'. implode('</li><li>', $sysfiles_check) .'</li></ul>';
183
+            if($modx->hasPermission('settings')) {
184
+                $warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\'' . $_lang["reset_sysfiles_checksum_alert"] . '\')">' . $_lang["reset_sysfiles_checksum_button"] . '</a></li></ul>';
185
+            }
186 186
             if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1]." ".implode(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']);
187 187
             break;
188 188
         case $_lang['configcheck_lang_difference'] :
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 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
 // PROCESSOR FIRST
7
-if($_SESSION['mgrRole'] == 1) {
8
-	if($_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) {
7
+if ($_SESSION['mgrRole'] == 1) {
8
+	if ($_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) {
9 9
 		$current = $modx->manager->getSystemChecksum($modx->config['check_files_onlogin']);
10
-		if(!empty($current)) {
10
+		if (!empty($current)) {
11 11
 			$modx->manager->setSystemChecksum($current);
12 12
 			$modx->clearCache('full');
13 13
 			$modx->config['sys_files_checksum'] = $current;
@@ -19,14 +19,14 @@  discard block
 block discarded – undo
19 19
 $warningspresent = 0;
20 20
 
21 21
 $sysfiles_check = $modx->manager->checkSystemChecksum();
22
-if ($sysfiles_check!=='0'){
22
+if ($sysfiles_check !== '0') {
23 23
       $warningspresent = 1;
24 24
       $warnings[] = array($_lang['configcheck_sysfiles_mod']);
25 25
 }
26 26
 
27
-if (is_writable("includes/config.inc.php")){
27
+if (is_writable("includes/config.inc.php")) {
28 28
     // Warn if world writable
29
-    if(@fileperms('includes/config.inc.php') & 0x0002) {
29
+    if (@fileperms('includes/config.inc.php') & 0x0002) {
30 30
       $warningspresent = 1;
31 31
       $warnings[] = array($_lang['configcheck_configinc']);
32 32
     }
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
     $warnings[] = array($_lang['configcheck_php_gdzip']);
43 43
 }
44 44
 
45
-if(!isset($modx->config['_hide_configcheck_validate_referer']) || $modx->config['_hide_configcheck_validate_referer'] !== '1') {
46
-    if(isset($_SESSION['mgrPermissions']['settings']) && $_SESSION['mgrPermissions']['settings'] == '1') {
45
+if (!isset($modx->config['_hide_configcheck_validate_referer']) || $modx->config['_hide_configcheck_validate_referer'] !== '1') {
46
+    if (isset($_SESSION['mgrPermissions']['settings']) && $_SESSION['mgrPermissions']['settings'] == '1') {
47 47
         if ($modx->db->getValue($modx->db->select('COUNT(setting_value)', $modx->getFullTableName('system_settings'), "setting_name='validate_referer' AND setting_value='0'"))) {
48 48
             $warningspresent = 1;
49 49
             $warnings[] = array($_lang['configcheck_validate_referer']);
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
 }
53 53
 
54 54
 // check for Template Switcher plugin
55
-if(!isset($modx->config['_hide_configcheck_templateswitcher_present']) || $modx->config['_hide_configcheck_templateswitcher_present'] !== '1') {
56
-    if(isset($_SESSION['mgrPermissions']['edit_plugin']) && $_SESSION['mgrPermissions']['edit_plugin'] == '1') {
55
+if (!isset($modx->config['_hide_configcheck_templateswitcher_present']) || $modx->config['_hide_configcheck_templateswitcher_present'] !== '1') {
56
+    if (isset($_SESSION['mgrPermissions']['edit_plugin']) && $_SESSION['mgrPermissions']['edit_plugin'] == '1') {
57 57
         $rs = $modx->db->select('name, disabled', $modx->getFullTableName('site_plugins'), "name IN ('TemplateSwitcher', 'Template Switcher', 'templateswitcher', 'template_switcher', 'template switcher') OR plugincode LIKE '%TemplateSwitcher%'");
58 58
         $row = $modx->db->getRow($rs);
59
-        if($row && $row['disabled'] == 0) {
59
+        if ($row && $row['disabled'] == 0) {
60 60
             $warningspresent = 1;
61 61
             $warnings[] = array($_lang['configcheck_templateswitcher_present']);
62 62
             $tplName = $row['name'];
@@ -117,36 +117,36 @@  discard block
 block discarded – undo
117 117
 }
118 118
 
119 119
 if (!function_exists('checkSiteCache')) {
120
-    function checkSiteCache() {
120
+    function checkSiteCache(){
121 121
         global $modx;
122
-        $checked= true;
123
-        if (file_exists($modx->config['base_path'] . 'assets/cache/siteCache.idx.php')) {
124
-            $checked= @include_once ($modx->config['base_path'] . 'assets/cache/siteCache.idx.php');
122
+        $checked = true;
123
+        if (file_exists($modx->config['base_path'].'assets/cache/siteCache.idx.php')) {
124
+            $checked = @include_once ($modx->config['base_path'].'assets/cache/siteCache.idx.php');
125 125
         }
126 126
         return $checked;
127 127
     }
128 128
 }
129 129
 
130
-if (!is_writable(MODX_BASE_PATH . "assets/cache/")) {
130
+if (!is_writable(MODX_BASE_PATH."assets/cache/")) {
131 131
     $warningspresent = 1;
132 132
     $warnings[] = array($_lang['configcheck_cache']);
133 133
 }
134 134
 
135 135
 if (!checkSiteCache()) {
136 136
     $warningspresent = 1;
137
-    $warnings[]= array($lang['configcheck_sitecache_integrity']);
137
+    $warnings[] = array($lang['configcheck_sitecache_integrity']);
138 138
 }
139 139
 
140
-if (!is_writable(MODX_BASE_PATH . "assets/images/")) {
140
+if (!is_writable(MODX_BASE_PATH."assets/images/")) {
141 141
     $warningspresent = 1;
142 142
     $warnings[] = array($_lang['configcheck_images']);
143 143
 }
144 144
 
145
-if(strpos($modx->config['rb_base_dir'],MODX_BASE_PATH)!==0) {
145
+if (strpos($modx->config['rb_base_dir'], MODX_BASE_PATH) !== 0) {
146 146
     $warningspresent = 1;
147 147
     $warnings[] = array($_lang['configcheck_rb_base_dir']);
148 148
 }
149
-if(strpos($modx->config['filemanager_path'],MODX_BASE_PATH)!==0) {
149
+if (strpos($modx->config['filemanager_path'], MODX_BASE_PATH) !== 0) {
150 150
     $warningspresent = 1;
151 151
     $warnings[] = array($_lang['configcheck_filemanager_path']);
152 152
 }
@@ -154,36 +154,36 @@  discard block
 block discarded – undo
154 154
 // clear file info cache
155 155
 clearstatcache();
156 156
 
157
-if ($warningspresent==1) {
157
+if ($warningspresent == 1) {
158 158
 
159
-if(!isset($modx->config['send_errormail'])) $modx->config['send_errormail']='3';
159
+if (!isset($modx->config['send_errormail'])) $modx->config['send_errormail'] = '3';
160 160
 $config_check_results = "<h3>".$_lang['configcheck_notok']."</h3>";
161 161
 
162
-for ($i=0;$i<count($warnings);$i++) {
162
+for ($i = 0; $i < count($warnings); $i++) {
163 163
     switch ($warnings[$i][0]) {
164 164
         case $_lang['configcheck_configinc'];
165 165
             $warnings[$i][1] = $_lang['configcheck_configinc_msg'];
166
-            if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_configinc']);
166
+            if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 3, $warnings[$i][1], $_lang['configcheck_configinc']);
167 167
             break;
168 168
         case $_lang['configcheck_installer'] :
169 169
             $warnings[$i][1] = $_lang['configcheck_installer_msg'];
170
-            if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_installer']);
170
+            if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 3, $warnings[$i][1], $_lang['configcheck_installer']);
171 171
             break;
172 172
         case $_lang['configcheck_cache'] :
173 173
             $warnings[$i][1] = $_lang['configcheck_cache_msg'];
174
-            if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_cache']);
174
+            if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 2, $warnings[$i][1], $_lang['configcheck_cache']);
175 175
             break;
176 176
         case $_lang['configcheck_images'] :
177 177
             $warnings[$i][1] = $_lang['configcheck_images_msg'];
178
-            if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_images']);
178
+            if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 2, $warnings[$i][1], $_lang['configcheck_images']);
179 179
             break;
180 180
         case $_lang['configcheck_sysfiles_mod']:
181 181
             $warnings[$i][1] = $_lang["configcheck_sysfiles_mod_msg"];
182
-			$warnings[$i][2] = '<ul><li>'. implode('</li><li>', $sysfiles_check) .'</li></ul>';
183
-			if($modx->hasPermission('settings')) {
184
-				$warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\'' . $_lang["reset_sysfiles_checksum_alert"] . '\')">' . $_lang["reset_sysfiles_checksum_button"] . '</a></li></ul>';
182
+			$warnings[$i][2] = '<ul><li>'.implode('</li><li>', $sysfiles_check).'</li></ul>';
183
+			if ($modx->hasPermission('settings')) {
184
+				$warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\''.$_lang["reset_sysfiles_checksum_alert"].'\')">'.$_lang["reset_sysfiles_checksum_button"].'</a></li></ul>';
185 185
 			}
186
-            if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1]." ".implode(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']);
186
+            if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 3, $warnings[$i][1]." ".implode(', ', $sysfiles_check), $_lang['configcheck_sysfiles_mod']);
187 187
             break;
188 188
         case $_lang['configcheck_lang_difference'] :
189 189
             $warnings[$i][1] = $_lang['configcheck_lang_difference_msg'];
@@ -205,18 +205,18 @@  discard block
 block discarded – undo
205 205
             break;
206 206
         case $_lang['configcheck_validate_referer'] :
207 207
             $msg = $_lang['configcheck_validate_referer_msg'];
208
-            $msg .= '<br />' . sprintf($_lang["configcheck_hide_warning"], 'validate_referer');
208
+            $msg .= '<br />'.sprintf($_lang["configcheck_hide_warning"], 'validate_referer');
209 209
             $warnings[$i][1] = "<span id=\"validate_referer_warning_wrapper\">{$msg}</span>\n";
210 210
             break;
211 211
         case $_lang['configcheck_templateswitcher_present'] :
212 212
             $msg = $_lang["configcheck_templateswitcher_present_msg"];
213
-            if(isset($_SESSION['mgrPermissions']['save_plugin']) && $_SESSION['mgrPermissions']['save_plugin'] == '1') {
214
-                $msg .= '<br />' . $_lang["configcheck_templateswitcher_present_disable"];
213
+            if (isset($_SESSION['mgrPermissions']['save_plugin']) && $_SESSION['mgrPermissions']['save_plugin'] == '1') {
214
+                $msg .= '<br />'.$_lang["configcheck_templateswitcher_present_disable"];
215 215
             }
216
-            if(isset($_SESSION['mgrPermissions']['delete_plugin']) && $_SESSION['mgrPermissions']['delete_plugin'] == '1') {
217
-                $msg .= '<br />' . $_lang["configcheck_templateswitcher_present_delete"];
216
+            if (isset($_SESSION['mgrPermissions']['delete_plugin']) && $_SESSION['mgrPermissions']['delete_plugin'] == '1') {
217
+                $msg .= '<br />'.$_lang["configcheck_templateswitcher_present_delete"];
218 218
             }
219
-            $msg .= '<br />' . sprintf($_lang["configcheck_hide_warning"], 'templateswitcher_present');
219
+            $msg .= '<br />'.sprintf($_lang["configcheck_hide_warning"], 'templateswitcher_present');
220 220
             $warnings[$i][1] = "<span id=\"templateswitcher_present_warning_wrapper\">{$msg}</span>\n";
221 221
             break;
222 222
         case $_lang['configcheck_rb_base_dir'] :
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
             $warnings[$i][1] = $_lang['configcheck_default_msg'];
230 230
     }
231 231
 
232
-    $admin_warning = $_SESSION['mgrRole']!=1 ? $_lang['configcheck_admin'] : "" ;
232
+    $admin_warning = $_SESSION['mgrRole'] != 1 ? $_lang['configcheck_admin'] : "";
233 233
     $config_check_results .= "
234 234
             <fieldset>
235 235
             <p><strong>".$_lang['configcheck_warning']."</strong> '".$warnings[$i][0]."'</p>
@@ -238,11 +238,11 @@  discard block
 block discarded – undo
238 238
             ".(isset($warnings[$i][2]) ? '<div style="padding-left:1em">'.$warnings[$i][2].'</div>' : '')."
239 239
             </fieldset>
240 240
 ";
241
-        if ($i!=count($warnings)-1) {
241
+        if ($i != count($warnings) - 1) {
242 242
             $config_check_results .= "<br />";
243 243
         }
244 244
     }
245
-    $_SESSION["mgrConfigCheck"]=true;
245
+    $_SESSION["mgrConfigCheck"] = true;
246 246
 } else {
247 247
     $config_check_results = $_lang['configcheck_ok'];
248 248
 }
Please login to merge, or discard this patch.
Braces   +22 added lines, -9 removed lines patch added patch discarded remove patch
@@ -19,12 +19,12 @@  discard block
 block discarded – undo
19 19
 $warningspresent = 0;
20 20
 
21 21
 $sysfiles_check = $modx->manager->checkSystemChecksum();
22
-if ($sysfiles_check!=='0'){
22
+if ($sysfiles_check!=='0') {
23 23
       $warningspresent = 1;
24 24
       $warnings[] = array($_lang['configcheck_sysfiles_mod']);
25 25
 }
26 26
 
27
-if (is_writable("includes/config.inc.php")){
27
+if (is_writable("includes/config.inc.php")) {
28 28
     // Warn if world writable
29 29
     if(@fileperms('includes/config.inc.php') & 0x0002) {
30 30
       $warningspresent = 1;
@@ -117,7 +117,8 @@  discard block
 block discarded – undo
117 117
 }
118 118
 
119 119
 if (!function_exists('checkSiteCache')) {
120
-    function checkSiteCache() {
120
+    function checkSiteCache()
121
+    {
121 122
         global $modx;
122 123
         $checked= true;
123 124
         if (file_exists($modx->config['base_path'] . 'assets/cache/siteCache.idx.php')) {
@@ -156,26 +157,36 @@  discard block
 block discarded – undo
156 157
 
157 158
 if ($warningspresent==1) {
158 159
 
159
-if(!isset($modx->config['send_errormail'])) $modx->config['send_errormail']='3';
160
+if(!isset($modx->config['send_errormail'])) {
161
+    $modx->config['send_errormail']='3';
162
+}
160 163
 $config_check_results = "<h3>".$_lang['configcheck_notok']."</h3>";
161 164
 
162 165
 for ($i=0;$i<count($warnings);$i++) {
163 166
     switch ($warnings[$i][0]) {
164 167
         case $_lang['configcheck_configinc'];
165 168
             $warnings[$i][1] = $_lang['configcheck_configinc_msg'];
166
-            if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_configinc']);
169
+            if(!$_SESSION["mgrConfigCheck"]) {
170
+                $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_configinc']);
171
+            }
167 172
             break;
168 173
         case $_lang['configcheck_installer'] :
169 174
             $warnings[$i][1] = $_lang['configcheck_installer_msg'];
170
-            if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_installer']);
175
+            if(!$_SESSION["mgrConfigCheck"]) {
176
+                $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_installer']);
177
+            }
171 178
             break;
172 179
         case $_lang['configcheck_cache'] :
173 180
             $warnings[$i][1] = $_lang['configcheck_cache_msg'];
174
-            if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_cache']);
181
+            if(!$_SESSION["mgrConfigCheck"]) {
182
+                $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_cache']);
183
+            }
175 184
             break;
176 185
         case $_lang['configcheck_images'] :
177 186
             $warnings[$i][1] = $_lang['configcheck_images_msg'];
178
-            if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_images']);
187
+            if(!$_SESSION["mgrConfigCheck"]) {
188
+                $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_images']);
189
+            }
179 190
             break;
180 191
         case $_lang['configcheck_sysfiles_mod']:
181 192
             $warnings[$i][1] = $_lang["configcheck_sysfiles_mod_msg"];
@@ -183,7 +194,9 @@  discard block
 block discarded – undo
183 194
 			if($modx->hasPermission('settings')) {
184 195
 				$warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\'' . $_lang["reset_sysfiles_checksum_alert"] . '\')">' . $_lang["reset_sysfiles_checksum_button"] . '</a></li></ul>';
185 196
 			}
186
-            if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1]." ".implode(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']);
197
+            if(!$_SESSION["mgrConfigCheck"]) {
198
+                $modx->logEvent(0,3,$warnings[$i][1]." ".implode(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']);
199
+            }
187 200
             break;
188 201
         case $_lang['configcheck_lang_difference'] :
189 202
             $warnings[$i][1] = $_lang['configcheck_lang_difference_msg'];
Please login to merge, or discard this patch.
manager/includes/tmplvars.inc.php 1 patch
Indentation   +250 added lines, -250 removed lines patch added patch discarded remove patch
@@ -1,159 +1,159 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // DISPLAY FORM ELEMENTS
3 3
 function renderFormElement($field_type, $field_id, $default_text = '', $field_elements = '', $field_value = '', $field_style = '', $row = array(), $tvsArray = array()) {
4
-	global $modx;
5
-	global $_style;
6
-	global $_lang;
7
-	global $content;
8
-	global $which_browser;
4
+    global $modx;
5
+    global $_style;
6
+    global $_lang;
7
+    global $content;
8
+    global $which_browser;
9 9
 
10
-	if(substr($default_text, 0, 6) === '@@EVAL' && $field_value === $default_text) {
11
-		$eval_str = trim(substr($default_text, 7));
12
-		$default_text = eval($eval_str);
13
-		$field_value = $default_text;
14
-	}
10
+    if(substr($default_text, 0, 6) === '@@EVAL' && $field_value === $default_text) {
11
+        $eval_str = trim(substr($default_text, 7));
12
+        $default_text = eval($eval_str);
13
+        $field_value = $default_text;
14
+    }
15 15
 
16
-	$field_html = '';
17
-	$cimode = strpos($field_type, ':');
18
-	if($cimode === false) {
19
-		switch($field_type) {
16
+    $field_html = '';
17
+    $cimode = strpos($field_type, ':');
18
+    if($cimode === false) {
19
+        switch($field_type) {
20 20
 
21
-			case "text": // handler for regular text boxes
22
-			case "rawtext"; // non-htmlentity converted text boxes
23
-				$field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" />';
24
-				break;
25
-			case "email": // handles email input fields
26
-				$field_html .= '<input type="email" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%"/>';
27
-				break;
28
-			case "number": // handles the input of numbers
29
-				$field_html .= '<input type="number" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" onkeyup="this.value=this.value.replace(/[^\d-,.+]/,\'\')"/>';
30
-				break;
31
-			case "textareamini": // handler for textarea mini boxes
32
-				$field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="5" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>';
33
-				break;
34
-			case "textarea": // handler for textarea boxes
35
-			case "rawtextarea": // non-htmlentity convertex textarea boxes
36
-			case "htmlarea": // handler for textarea boxes (deprecated)
37
-			case "richtext": // handler for textarea boxes
38
-				$field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="15" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>';
39
-				break;
40
-			case "date":
41
-				$field_id = str_replace(array(
42
-					'-',
43
-					'.'
44
-				), '_', urldecode($field_id));
45
-				if($field_value == '') {
46
-					$field_value = 0;
47
-				}
48
-				$field_html .= '<input id="tv' . $field_id . '" name="tv' . $field_id . '" class="DatePicker" type="text" value="' . ($field_value == 0 || !isset($field_value) ? "" : $field_value) . '" onblur="documentDirty=true;" />';
49
-				$field_html .= ' <a onclick="document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].value=\'\';document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].onblur(); return true;" onmouseover="window.status=\'clear the date\'; return true;" onmouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand"><i class="' . $_style["actions_calendar_delete"] . '"></i></a>';
21
+            case "text": // handler for regular text boxes
22
+            case "rawtext"; // non-htmlentity converted text boxes
23
+                $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" />';
24
+                break;
25
+            case "email": // handles email input fields
26
+                $field_html .= '<input type="email" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%"/>';
27
+                break;
28
+            case "number": // handles the input of numbers
29
+                $field_html .= '<input type="number" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" onkeyup="this.value=this.value.replace(/[^\d-,.+]/,\'\')"/>';
30
+                break;
31
+            case "textareamini": // handler for textarea mini boxes
32
+                $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="5" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>';
33
+                break;
34
+            case "textarea": // handler for textarea boxes
35
+            case "rawtextarea": // non-htmlentity convertex textarea boxes
36
+            case "htmlarea": // handler for textarea boxes (deprecated)
37
+            case "richtext": // handler for textarea boxes
38
+                $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="15" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>';
39
+                break;
40
+            case "date":
41
+                $field_id = str_replace(array(
42
+                    '-',
43
+                    '.'
44
+                ), '_', urldecode($field_id));
45
+                if($field_value == '') {
46
+                    $field_value = 0;
47
+                }
48
+                $field_html .= '<input id="tv' . $field_id . '" name="tv' . $field_id . '" class="DatePicker" type="text" value="' . ($field_value == 0 || !isset($field_value) ? "" : $field_value) . '" onblur="documentDirty=true;" />';
49
+                $field_html .= ' <a onclick="document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].value=\'\';document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].onblur(); return true;" onmouseover="window.status=\'clear the date\'; return true;" onmouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand"><i class="' . $_style["actions_calendar_delete"] . '"></i></a>';
50 50
 
51
-				break;
52
-			case "dropdown": // handler for select boxes
53
-				$field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" size="1" onchange="documentDirty=true;">';
54
-				$index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray));
55
-				while(list($item, $itemvalue) = each($index_list)) {
56
-					list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue);
57
-					if(strlen($itemvalue) == 0) {
58
-						$itemvalue = $item;
59
-					}
60
-					$field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>';
61
-				}
62
-				$field_html .= "</select>";
63
-				break;
64
-			case "listbox": // handler for select boxes
65
-				$field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" onchange="documentDirty=true;" size="8">';
66
-				$index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray));
67
-				while(list($item, $itemvalue) = each($index_list)) {
68
-					list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue);
69
-					if(strlen($itemvalue) == 0) {
70
-						$itemvalue = $item;
71
-					}
72
-					$field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>';
73
-				}
74
-				$field_html .= "</select>";
75
-				break;
76
-			case "listbox-multiple": // handler for select boxes where you can choose multiple items
77
-				$field_value = explode("||", $field_value);
78
-				$field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '[]" multiple="multiple" onchange="documentDirty=true;" size="8">';
79
-				$index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray));
80
-				while(list($item, $itemvalue) = each($index_list)) {
81
-					list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue);
82
-					if(strlen($itemvalue) == 0) {
83
-						$itemvalue = $item;
84
-					}
85
-					$field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . (in_array($itemvalue, $field_value) ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>';
86
-				}
87
-				$field_html .= "</select>";
88
-				break;
89
-			case "url": // handles url input fields
90
-				$urls = array(
91
-					'' => '--',
92
-					'http://' => 'http://',
93
-					'https://' => 'https://',
94
-					'ftp://' => 'ftp://',
95
-					'mailto:' => 'mailto:'
96
-				);
97
-				$field_html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td><select id="tv' . $field_id . '_prefix" name="tv' . $field_id . '_prefix" onchange="documentDirty=true;">';
98
-				foreach($urls as $k => $v) {
99
-					if(strpos($field_value, $v) === false) {
100
-						$field_html .= '<option value="' . $v . '">' . $k . '</option>';
101
-					} else {
102
-						$field_value = str_replace($v, '', $field_value);
103
-						$field_html .= '<option value="' . $v . '" selected="selected">' . $k . '</option>';
104
-					}
105
-				}
106
-				$field_html .= '</select></td><td>';
107
-				$field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" width="100" ' . $field_style . ' onchange="documentDirty=true;" /></td></tr></table>';
108
-				break;
109
-			case 'checkbox': // handles check boxes
110
-				$values = !is_array($field_value) ? explode('||', $field_value) : $field_value;
111
-				$index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray));
112
-				$tpl = '<label class="checkbox"><input type="checkbox" value="%s" id="tv_%s" name="tv%s[]" %s onchange="documentDirty=true;" />%s</label><br />';
113
-				static $i = 0;
114
-				$_ = array();
115
-				foreach($index_list as $c => $item) {
116
-					if(is_array($item)) {
117
-						$name = trim($item[0]);
118
-						$value = isset($item[1]) ? $item[1] : $name;
119
-					} else {
120
-						$item = trim($item);
121
-						list($name, $value) = (strpos($item, '==') !== false) ? explode('==', $item, 2) : array(
122
-							$item,
123
-							$item
124
-						);
125
-					}
126
-					$checked = in_array($value, $values) ? ' checked="checked"' : '';
127
-					$param = array(
128
-						$modx->htmlspecialchars($value),
129
-						$i,
130
-						$field_id,
131
-						$checked,
132
-						$modx->htmlspecialchars($name)
133
-					);
134
-					$_[] = vsprintf($tpl, $param);
135
-					$i++;
136
-				}
137
-				$field_html = implode("\n", $_);
138
-				break;
139
-			case "option": // handles radio buttons
140
-				$index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray));
141
-				static $i = 0;
142
-				while(list($item, $itemvalue) = each($index_list)) {
143
-					list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue);
144
-					if(strlen($itemvalue) == 0) {
145
-						$itemvalue = $item;
146
-					}
147
-					$field_html .= '<input type="radio" value="' . $modx->htmlspecialchars($itemvalue) . '" id="tv_' . $i . '" name="tv' . $field_id . '" ' . ($itemvalue == $field_value ? 'checked="checked"' : '') . ' onchange="documentDirty=true;" /><label for="tv_' . $i . '" class="radio">' . $item . '</label><br />';
148
-					$i++;
149
-				}
150
-				break;
151
-			case "image": // handles image fields using htmlarea image manager
152
-				global $_lang;
153
-				global $ResourceManagerLoaded;
154
-				global $content, $use_editor, $which_editor;
155
-				if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) {
156
-					$field_html .= "
51
+                break;
52
+            case "dropdown": // handler for select boxes
53
+                $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" size="1" onchange="documentDirty=true;">';
54
+                $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray));
55
+                while(list($item, $itemvalue) = each($index_list)) {
56
+                    list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue);
57
+                    if(strlen($itemvalue) == 0) {
58
+                        $itemvalue = $item;
59
+                    }
60
+                    $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>';
61
+                }
62
+                $field_html .= "</select>";
63
+                break;
64
+            case "listbox": // handler for select boxes
65
+                $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" onchange="documentDirty=true;" size="8">';
66
+                $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray));
67
+                while(list($item, $itemvalue) = each($index_list)) {
68
+                    list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue);
69
+                    if(strlen($itemvalue) == 0) {
70
+                        $itemvalue = $item;
71
+                    }
72
+                    $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>';
73
+                }
74
+                $field_html .= "</select>";
75
+                break;
76
+            case "listbox-multiple": // handler for select boxes where you can choose multiple items
77
+                $field_value = explode("||", $field_value);
78
+                $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '[]" multiple="multiple" onchange="documentDirty=true;" size="8">';
79
+                $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray));
80
+                while(list($item, $itemvalue) = each($index_list)) {
81
+                    list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue);
82
+                    if(strlen($itemvalue) == 0) {
83
+                        $itemvalue = $item;
84
+                    }
85
+                    $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . (in_array($itemvalue, $field_value) ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>';
86
+                }
87
+                $field_html .= "</select>";
88
+                break;
89
+            case "url": // handles url input fields
90
+                $urls = array(
91
+                    '' => '--',
92
+                    'http://' => 'http://',
93
+                    'https://' => 'https://',
94
+                    'ftp://' => 'ftp://',
95
+                    'mailto:' => 'mailto:'
96
+                );
97
+                $field_html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td><select id="tv' . $field_id . '_prefix" name="tv' . $field_id . '_prefix" onchange="documentDirty=true;">';
98
+                foreach($urls as $k => $v) {
99
+                    if(strpos($field_value, $v) === false) {
100
+                        $field_html .= '<option value="' . $v . '">' . $k . '</option>';
101
+                    } else {
102
+                        $field_value = str_replace($v, '', $field_value);
103
+                        $field_html .= '<option value="' . $v . '" selected="selected">' . $k . '</option>';
104
+                    }
105
+                }
106
+                $field_html .= '</select></td><td>';
107
+                $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" width="100" ' . $field_style . ' onchange="documentDirty=true;" /></td></tr></table>';
108
+                break;
109
+            case 'checkbox': // handles check boxes
110
+                $values = !is_array($field_value) ? explode('||', $field_value) : $field_value;
111
+                $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray));
112
+                $tpl = '<label class="checkbox"><input type="checkbox" value="%s" id="tv_%s" name="tv%s[]" %s onchange="documentDirty=true;" />%s</label><br />';
113
+                static $i = 0;
114
+                $_ = array();
115
+                foreach($index_list as $c => $item) {
116
+                    if(is_array($item)) {
117
+                        $name = trim($item[0]);
118
+                        $value = isset($item[1]) ? $item[1] : $name;
119
+                    } else {
120
+                        $item = trim($item);
121
+                        list($name, $value) = (strpos($item, '==') !== false) ? explode('==', $item, 2) : array(
122
+                            $item,
123
+                            $item
124
+                        );
125
+                    }
126
+                    $checked = in_array($value, $values) ? ' checked="checked"' : '';
127
+                    $param = array(
128
+                        $modx->htmlspecialchars($value),
129
+                        $i,
130
+                        $field_id,
131
+                        $checked,
132
+                        $modx->htmlspecialchars($name)
133
+                    );
134
+                    $_[] = vsprintf($tpl, $param);
135
+                    $i++;
136
+                }
137
+                $field_html = implode("\n", $_);
138
+                break;
139
+            case "option": // handles radio buttons
140
+                $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray));
141
+                static $i = 0;
142
+                while(list($item, $itemvalue) = each($index_list)) {
143
+                    list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue);
144
+                    if(strlen($itemvalue) == 0) {
145
+                        $itemvalue = $item;
146
+                    }
147
+                    $field_html .= '<input type="radio" value="' . $modx->htmlspecialchars($itemvalue) . '" id="tv_' . $i . '" name="tv' . $field_id . '" ' . ($itemvalue == $field_value ? 'checked="checked"' : '') . ' onchange="documentDirty=true;" /><label for="tv_' . $i . '" class="radio">' . $item . '</label><br />';
148
+                    $i++;
149
+                }
150
+                break;
151
+            case "image": // handles image fields using htmlarea image manager
152
+                global $_lang;
153
+                global $ResourceManagerLoaded;
154
+                global $content, $use_editor, $which_editor;
155
+                if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) {
156
+                    $field_html .= "
157 157
 						<script type=\"text/javascript\">
158 158
 							/* <![CDATA[ */
159 159
 								var lastImageCtrl;
@@ -212,18 +212,18 @@  discard block
 block discarded – undo
212 212
 								}
213 213
 							/* ]]> */
214 214
 						</script>";
215
-					$ResourceManagerLoaded = true;
216
-				}
217
-				$field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '"  value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseServer(\'tv' . $field_id . '\')" />';
218
-				break;
219
-			case "file": // handles the input of file uploads
220
-				/* Modified by Timon for use with resource browser */
221
-				global $_lang;
222
-				global $ResourceManagerLoaded;
223
-				global $content, $use_editor, $which_editor;
224
-				if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) {
225
-					/* I didn't understand the meaning of the condition above, so I left it untouched ;-) */
226
-					$field_html .= "
215
+                    $ResourceManagerLoaded = true;
216
+                }
217
+                $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '"  value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseServer(\'tv' . $field_id . '\')" />';
218
+                break;
219
+            case "file": // handles the input of file uploads
220
+                /* Modified by Timon for use with resource browser */
221
+                global $_lang;
222
+                global $ResourceManagerLoaded;
223
+                global $content, $use_editor, $which_editor;
224
+                if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) {
225
+                    /* I didn't understand the meaning of the condition above, so I left it untouched ;-) */
226
+                    $field_html .= "
227 227
 						<script type=\"text/javascript\">
228 228
 							/* <![CDATA[ */
229 229
 								var lastImageCtrl;
@@ -282,101 +282,101 @@  discard block
 block discarded – undo
282 282
 								}
283 283
 							/* ]]> */
284 284
 						</script>";
285
-					$ResourceManagerLoaded = true;
286
-				}
287
-				$field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '"  value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseFileServer(\'tv' . $field_id . '\')" />';
285
+                    $ResourceManagerLoaded = true;
286
+                }
287
+                $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '"  value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseFileServer(\'tv' . $field_id . '\')" />';
288 288
 
289
-				break;
289
+                break;
290 290
 
291
-			case 'custom_tv':
292
-				$custom_output = '';
293
-				/* If we are loading a file */
294
-				if(substr($field_elements, 0, 5) == "@FILE") {
295
-					$file_name = MODX_BASE_PATH . trim(substr($field_elements, 6));
296
-					if(!file_exists($file_name)) {
297
-						$custom_output = $file_name . ' does not exist';
298
-					} else {
299
-						$custom_output = file_get_contents($file_name);
300
-					}
301
-				} elseif(substr($field_elements, 0, 8) == '@INCLUDE') {
302
-					$file_name = MODX_BASE_PATH . trim(substr($field_elements, 9));
303
-					if(!file_exists($file_name)) {
304
-						$custom_output = $file_name . ' does not exist';
305
-					} else {
306
-						ob_start();
307
-						include $file_name;
308
-						$custom_output = ob_get_contents();
309
-						ob_end_clean();
310
-					}
311
-				} elseif(substr($field_elements, 0, 6) == "@CHUNK") {
312
-					$chunk_name = trim(substr($field_elements, 7));
313
-					$chunk_body = $modx->getChunk($chunk_name);
314
-					if($chunk_body == false) {
315
-						$custom_output = $_lang['chunk_no_exist'] . '(' . $_lang['htmlsnippet_name'] . ':' . $chunk_name . ')';
316
-					} else {
317
-						$custom_output = $chunk_body;
318
-					}
319
-				} elseif(substr($field_elements, 0, 5) == "@EVAL") {
320
-					$eval_str = trim(substr($field_elements, 6));
321
-					$custom_output = eval($eval_str);
322
-				} else {
323
-					$custom_output = $field_elements;
324
-				}
325
-				$replacements = array(
326
-					'[+field_type+]' => $field_type,
327
-					'[+field_id+]' => $field_id,
328
-					'[+default_text+]' => $default_text,
329
-					'[+field_value+]' => $modx->htmlspecialchars($field_value),
330
-					'[+field_style+]' => $field_style,
331
-				);
332
-				$custom_output = str_replace(array_keys($replacements), $replacements, $custom_output);
333
-				$modx->documentObject = $content;
334
-				$modx->documentIdentifier = $content['id'];
335
-				$custom_output = $modx->parseDocumentSource($custom_output);
336
-				$field_html .= $custom_output;
337
-				break;
291
+            case 'custom_tv':
292
+                $custom_output = '';
293
+                /* If we are loading a file */
294
+                if(substr($field_elements, 0, 5) == "@FILE") {
295
+                    $file_name = MODX_BASE_PATH . trim(substr($field_elements, 6));
296
+                    if(!file_exists($file_name)) {
297
+                        $custom_output = $file_name . ' does not exist';
298
+                    } else {
299
+                        $custom_output = file_get_contents($file_name);
300
+                    }
301
+                } elseif(substr($field_elements, 0, 8) == '@INCLUDE') {
302
+                    $file_name = MODX_BASE_PATH . trim(substr($field_elements, 9));
303
+                    if(!file_exists($file_name)) {
304
+                        $custom_output = $file_name . ' does not exist';
305
+                    } else {
306
+                        ob_start();
307
+                        include $file_name;
308
+                        $custom_output = ob_get_contents();
309
+                        ob_end_clean();
310
+                    }
311
+                } elseif(substr($field_elements, 0, 6) == "@CHUNK") {
312
+                    $chunk_name = trim(substr($field_elements, 7));
313
+                    $chunk_body = $modx->getChunk($chunk_name);
314
+                    if($chunk_body == false) {
315
+                        $custom_output = $_lang['chunk_no_exist'] . '(' . $_lang['htmlsnippet_name'] . ':' . $chunk_name . ')';
316
+                    } else {
317
+                        $custom_output = $chunk_body;
318
+                    }
319
+                } elseif(substr($field_elements, 0, 5) == "@EVAL") {
320
+                    $eval_str = trim(substr($field_elements, 6));
321
+                    $custom_output = eval($eval_str);
322
+                } else {
323
+                    $custom_output = $field_elements;
324
+                }
325
+                $replacements = array(
326
+                    '[+field_type+]' => $field_type,
327
+                    '[+field_id+]' => $field_id,
328
+                    '[+default_text+]' => $default_text,
329
+                    '[+field_value+]' => $modx->htmlspecialchars($field_value),
330
+                    '[+field_style+]' => $field_style,
331
+                );
332
+                $custom_output = str_replace(array_keys($replacements), $replacements, $custom_output);
333
+                $modx->documentObject = $content;
334
+                $modx->documentIdentifier = $content['id'];
335
+                $custom_output = $modx->parseDocumentSource($custom_output);
336
+                $field_html .= $custom_output;
337
+                break;
338 338
 
339
-			default: // the default handler -- for errors, mostly
340
-				$field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' onchange="documentDirty=true;" />';
339
+            default: // the default handler -- for errors, mostly
340
+                $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' onchange="documentDirty=true;" />';
341 341
 
342
-		} // end switch statement
343
-	} else {
344
-		$custom = explode(":", $field_type);
345
-		$custom_output = '';
346
-		$file_name = MODX_BASE_PATH . 'assets/tvs/' . $custom['1'] . '/' . $custom['1'] . '.customtv.php';
347
-		if(!file_exists($file_name)) {
348
-			$custom_output = $file_name . ' does not exist';
349
-		} else {
350
-			ob_start();
351
-			include $file_name;
352
-			$custom_output = ob_get_contents();
353
-			ob_end_clean();
354
-		}
355
-		$replacements = array(
356
-			'[+field_type+]' => $field_type,
357
-			'[+field_id+]' => $field_id,
358
-			'[+default_text+]' => $default_text,
359
-			'[+field_value+]' => $modx->htmlspecialchars($field_value),
360
-			'[+field_style+]' => $field_style,
361
-		);
362
-		$custom_output = str_replace(array_keys($replacements), $replacements, $custom_output);
363
-		$modx->documentObject = $content;
364
-		$custom_output = $modx->parseDocumentSource($custom_output);
365
-		$field_html .= $custom_output;
366
-	}
342
+        } // end switch statement
343
+    } else {
344
+        $custom = explode(":", $field_type);
345
+        $custom_output = '';
346
+        $file_name = MODX_BASE_PATH . 'assets/tvs/' . $custom['1'] . '/' . $custom['1'] . '.customtv.php';
347
+        if(!file_exists($file_name)) {
348
+            $custom_output = $file_name . ' does not exist';
349
+        } else {
350
+            ob_start();
351
+            include $file_name;
352
+            $custom_output = ob_get_contents();
353
+            ob_end_clean();
354
+        }
355
+        $replacements = array(
356
+            '[+field_type+]' => $field_type,
357
+            '[+field_id+]' => $field_id,
358
+            '[+default_text+]' => $default_text,
359
+            '[+field_value+]' => $modx->htmlspecialchars($field_value),
360
+            '[+field_style+]' => $field_style,
361
+        );
362
+        $custom_output = str_replace(array_keys($replacements), $replacements, $custom_output);
363
+        $modx->documentObject = $content;
364
+        $custom_output = $modx->parseDocumentSource($custom_output);
365
+        $field_html .= $custom_output;
366
+    }
367 367
 
368
-	return $field_html;
368
+    return $field_html;
369 369
 } // end renderFormElement function
370 370
 
371 371
 function ParseIntputOptions($v) {
372
-	global $modx;
373
-	$a = array();
374
-	if(is_array($v)) {
375
-		return $v;
376
-	} else if($modx->db->isResult($v)) {
377
-		while($cols = $modx->db->getRow($v, 'num')) $a[] = $cols;
378
-	} else {
379
-		$a = explode("||", $v);
380
-	}
381
-	return $a;
372
+    global $modx;
373
+    $a = array();
374
+    if(is_array($v)) {
375
+        return $v;
376
+    } else if($modx->db->isResult($v)) {
377
+        while($cols = $modx->db->getRow($v, 'num')) $a[] = $cols;
378
+    } else {
379
+        $a = explode("||", $v);
380
+    }
381
+    return $a;
382 382
 }
Please login to merge, or discard this patch.
manager/media/rss/rss_cache.inc 2 patches
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -16,27 +16,27 @@  discard block
 block discarded – undo
16 16
  *
17 17
  */
18 18
 
19
-class RSSCache {
20
-    var $BASE_CACHE = './cache';    // where the cache files are stored
21
-    var $MAX_AGE    = 3600;         // when are files stale, default one hour
22
-    var $ERROR      = "";           // accumulate error messages
19
+class RSSCache{
20
+    var $BASE_CACHE = './cache'; // where the cache files are stored
21
+    var $MAX_AGE    = 3600; // when are files stale, default one hour
22
+    var $ERROR      = ""; // accumulate error messages
23 23
 
24
-    function __construct($base='', $age='') {
25
-        if ( $base ) {
24
+    function __construct($base = '', $age = ''){
25
+        if ($base) {
26 26
             $this->BASE_CACHE = $base;
27 27
         }
28
-        if ( $age ) {
28
+        if ($age) {
29 29
             $this->MAX_AGE = $age;
30 30
         }
31 31
 
32 32
         // attempt to make the cache directory
33
-        if ( ! file_exists( $this->BASE_CACHE ) ) {
34
-            $status = @mkdir( $this->BASE_CACHE, 0755 );
33
+        if (!file_exists($this->BASE_CACHE)) {
34
+            $status = @mkdir($this->BASE_CACHE, 0755);
35 35
 
36 36
             // if make failed
37
-            if ( ! $status ) {
37
+            if (!$status) {
38 38
                 $this->error(
39
-                    "Cache couldn't make dir '" . $this->BASE_CACHE . "'."
39
+                    "Cache couldn't make dir '".$this->BASE_CACHE."'."
40 40
                 );
41 41
             }
42 42
         }
@@ -48,12 +48,12 @@  discard block
 block discarded – undo
48 48
     Input:      url from wich the rss file was fetched
49 49
     Output:     true on sucess
50 50
 \*=======================================================================*/
51
-    function set ($url, $rss) {
51
+    function set($url, $rss){
52 52
         $this->ERROR = "";
53
-        $cache_file = $this->file_name( $url );
54
-        $fp = @fopen( $cache_file, 'w' );
53
+        $cache_file = $this->file_name($url);
54
+        $fp = @fopen($cache_file, 'w');
55 55
 
56
-        if ( ! $fp ) {
56
+        if (!$fp) {
57 57
             $this->error(
58 58
                 "Cache unable to open file for writing: $cache_file"
59 59
             );
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
         }
62 62
 
63 63
 
64
-        $data = $this->serialize( $rss );
65
-        fwrite( $fp, $data );
66
-        fclose( $fp );
64
+        $data = $this->serialize($rss);
65
+        fwrite($fp, $data);
66
+        fclose($fp);
67 67
 
68 68
         return $cache_file;
69 69
     }
@@ -74,11 +74,11 @@  discard block
 block discarded – undo
74 74
     Input:      url from wich the rss file was fetched
75 75
     Output:     cached object on HIT, false on MISS
76 76
 \*=======================================================================*/
77
-    function get ($url) {
77
+    function get($url){
78 78
         $this->ERROR = "";
79
-        $cache_file = $this->file_name( $url );
79
+        $cache_file = $this->file_name($url);
80 80
 
81
-        if ( ! file_exists( $cache_file ) ) {
81
+        if (!file_exists($cache_file)) {
82 82
             $this->debug(
83 83
                 "Cache doesn't contain: $url (cache file: $cache_file)"
84 84
             );
@@ -86,16 +86,16 @@  discard block
 block discarded – undo
86 86
         }
87 87
 
88 88
         $fp = @fopen($cache_file, 'r');
89
-        if ( ! $fp ) {
89
+        if (!$fp) {
90 90
             $this->error(
91 91
                 "Failed to open cache file for reading: $cache_file"
92 92
             );
93 93
             return 0;
94 94
         }
95 95
 
96
-        if ($filesize = filesize($cache_file) ) {
97
-        	$data = fread( $fp, filesize($cache_file) );
98
-        	$rss = $this->unserialize( $data );
96
+        if ($filesize = filesize($cache_file)) {
97
+        	$data = fread($fp, filesize($cache_file));
98
+        	$rss = $this->unserialize($data);
99 99
 
100 100
         	return $rss;
101 101
     	}
@@ -110,16 +110,16 @@  discard block
 block discarded – undo
110 110
     Input:      url from wich the rss file was fetched
111 111
     Output:     cached object on HIT, false on MISS
112 112
 \*=======================================================================*/
113
-    function check_cache ( $url ) {
113
+    function check_cache($url){
114 114
         $this->ERROR = "";
115
-        $filename = $this->file_name( $url );
115
+        $filename = $this->file_name($url);
116 116
 
117
-        if ( file_exists( $filename ) ) {
117
+        if (file_exists($filename)) {
118 118
             // find how long ago the file was added to the cache
119 119
             // and whether that is longer then MAX_AGE
120
-            $mtime = filemtime( $filename );
120
+            $mtime = filemtime($filename);
121 121
             $age = time() - $mtime;
122
-            if ( $this->MAX_AGE > $age ) {
122
+            if ($this->MAX_AGE > $age) {
123 123
                 // object exists and is current
124 124
                 return 'HIT';
125 125
             }
@@ -134,10 +134,10 @@  discard block
 block discarded – undo
134 134
         }
135 135
     }
136 136
 
137
-	function cache_age( $cache_key ) {
138
-		$filename = $this->file_name( $url );
139
-		if ( file_exists( $filename ) ) {
140
-			$mtime = filemtime( $filename );
137
+	function cache_age($cache_key){
138
+		$filename = $this->file_name($url);
139
+		if (file_exists($filename)) {
140
+			$mtime = filemtime($filename);
141 141
             $age = time() - $mtime;
142 142
 			return $age;
143 143
 		}
@@ -149,15 +149,15 @@  discard block
 block discarded – undo
149 149
 /*=======================================================================*\
150 150
     Function:   serialize
151 151
 \*=======================================================================*/
152
-    function serialize ( $rss ) {
153
-        return serialize( $rss );
152
+    function serialize($rss){
153
+        return serialize($rss);
154 154
     }
155 155
 
156 156
 /*=======================================================================*\
157 157
     Function:   unserialize
158 158
 \*=======================================================================*/
159
-    function unserialize ( $data ) {
160
-        return unserialize( $data );
159
+    function unserialize($data){
160
+        return unserialize($data);
161 161
     }
162 162
 
163 163
 /*=======================================================================*\
@@ -166,31 +166,31 @@  discard block
 block discarded – undo
166 166
     Input:      url from wich the rss file was fetched
167 167
     Output:     a file name
168 168
 \*=======================================================================*/
169
-    function file_name ($url) {
170
-        $filename = md5( $url );
171
-        return implode( DIRECTORY_SEPARATOR, array( $this->BASE_CACHE, $filename ) );
169
+    function file_name($url){
170
+        $filename = md5($url);
171
+        return implode(DIRECTORY_SEPARATOR, array($this->BASE_CACHE, $filename));
172 172
     }
173 173
 
174 174
 /*=======================================================================*\
175 175
     Function:   error
176 176
     Purpose:    register error
177 177
 \*=======================================================================*/
178
-    function error ($errormsg, $lvl=E_USER_WARNING) {
178
+    function error($errormsg, $lvl = E_USER_WARNING){
179 179
         // append PHP's error message if track_errors enabled
180
-        if ( isset($php_errormsg) ) {
180
+        if (isset($php_errormsg)) {
181 181
             $errormsg .= " ($php_errormsg)";
182 182
         }
183 183
         $this->ERROR = $errormsg;
184
-        if ( MAGPIE_DEBUG ) {
185
-            trigger_error( $errormsg, $lvl);
184
+        if (MAGPIE_DEBUG) {
185
+            trigger_error($errormsg, $lvl);
186 186
         }
187 187
         else {
188
-            error_log( $errormsg, 0);
188
+            error_log($errormsg, 0);
189 189
         }
190 190
     }
191 191
 
192
-    function debug ($debugmsg, $lvl=E_USER_NOTICE) {
193
-        if ( MAGPIE_DEBUG ) {
192
+    function debug($debugmsg, $lvl = E_USER_NOTICE){
193
+        if (MAGPIE_DEBUG) {
194 194
             $this->error("MagpieRSS [debug] $debugmsg", $lvl);
195 195
         }
196 196
     }
Please login to merge, or discard this patch.
Braces   +26 added lines, -19 removed lines patch added patch discarded remove patch
@@ -16,12 +16,14 @@  discard block
 block discarded – undo
16 16
  *
17 17
  */
18 18
 
19
-class RSSCache {
19
+class RSSCache
20
+{
20 21
     var $BASE_CACHE = './cache';    // where the cache files are stored
21 22
     var $MAX_AGE    = 3600;         // when are files stale, default one hour
22 23
     var $ERROR      = "";           // accumulate error messages
23 24
 
24
-    function __construct($base='', $age='') {
25
+    function __construct($base='', $age='')
26
+    {
25 27
         if ( $base ) {
26 28
             $this->BASE_CACHE = $base;
27 29
         }
@@ -48,7 +50,8 @@  discard block
 block discarded – undo
48 50
     Input:      url from wich the rss file was fetched
49 51
     Output:     true on sucess
50 52
 \*=======================================================================*/
51
-    function set ($url, $rss) {
53
+    function set ($url, $rss)
54
+    {
52 55
         $this->ERROR = "";
53 56
         $cache_file = $this->file_name( $url );
54 57
         $fp = @fopen( $cache_file, 'w' );
@@ -74,7 +77,8 @@  discard block
 block discarded – undo
74 77
     Input:      url from wich the rss file was fetched
75 78
     Output:     cached object on HIT, false on MISS
76 79
 \*=======================================================================*/
77
-    function get ($url) {
80
+    function get ($url)
81
+    {
78 82
         $this->ERROR = "";
79 83
         $cache_file = $this->file_name( $url );
80 84
 
@@ -110,7 +114,8 @@  discard block
 block discarded – undo
110 114
     Input:      url from wich the rss file was fetched
111 115
     Output:     cached object on HIT, false on MISS
112 116
 \*=======================================================================*/
113
-    function check_cache ( $url ) {
117
+    function check_cache ( $url )
118
+    {
114 119
         $this->ERROR = "";
115 120
         $filename = $this->file_name( $url );
116 121
 
@@ -122,26 +127,24 @@  discard block
 block discarded – undo
122 127
             if ( $this->MAX_AGE > $age ) {
123 128
                 // object exists and is current
124 129
                 return 'HIT';
125
-            }
126
-            else {
130
+            } else {
127 131
                 // object exists but is old
128 132
                 return 'STALE';
129 133
             }
130
-        }
131
-        else {
134
+        } else {
132 135
             // object does not exist
133 136
             return 'MISS';
134 137
         }
135 138
     }
136 139
 
137
-	function cache_age( $cache_key ) {
140
+	function cache_age( $cache_key )
141
+	{
138 142
 		$filename = $this->file_name( $url );
139 143
 		if ( file_exists( $filename ) ) {
140 144
 			$mtime = filemtime( $filename );
141 145
             $age = time() - $mtime;
142 146
 			return $age;
143
-		}
144
-		else {
147
+		} else {
145 148
 			return -1;
146 149
 		}
147 150
 	}
@@ -149,14 +152,16 @@  discard block
 block discarded – undo
149 152
 /*=======================================================================*\
150 153
     Function:   serialize
151 154
 \*=======================================================================*/
152
-    function serialize ( $rss ) {
155
+    function serialize ( $rss )
156
+    {
153 157
         return serialize( $rss );
154 158
     }
155 159
 
156 160
 /*=======================================================================*\
157 161
     Function:   unserialize
158 162
 \*=======================================================================*/
159
-    function unserialize ( $data ) {
163
+    function unserialize ( $data )
164
+    {
160 165
         return unserialize( $data );
161 166
     }
162 167
 
@@ -166,7 +171,8 @@  discard block
 block discarded – undo
166 171
     Input:      url from wich the rss file was fetched
167 172
     Output:     a file name
168 173
 \*=======================================================================*/
169
-    function file_name ($url) {
174
+    function file_name ($url)
175
+    {
170 176
         $filename = md5( $url );
171 177
         return implode( DIRECTORY_SEPARATOR, array( $this->BASE_CACHE, $filename ) );
172 178
     }
@@ -175,7 +181,8 @@  discard block
 block discarded – undo
175 181
     Function:   error
176 182
     Purpose:    register error
177 183
 \*=======================================================================*/
178
-    function error ($errormsg, $lvl=E_USER_WARNING) {
184
+    function error ($errormsg, $lvl=E_USER_WARNING)
185
+    {
179 186
         // append PHP's error message if track_errors enabled
180 187
         if ( isset($php_errormsg) ) {
181 188
             $errormsg .= " ($php_errormsg)";
@@ -183,13 +190,13 @@  discard block
 block discarded – undo
183 190
         $this->ERROR = $errormsg;
184 191
         if ( MAGPIE_DEBUG ) {
185 192
             trigger_error( $errormsg, $lvl);
186
-        }
187
-        else {
193
+        } else {
188 194
             error_log( $errormsg, 0);
189 195
         }
190 196
     }
191 197
 
192
-    function debug ($debugmsg, $lvl=E_USER_NOTICE) {
198
+    function debug ($debugmsg, $lvl=E_USER_NOTICE)
199
+    {
193 200
         if ( MAGPIE_DEBUG ) {
194 201
             $this->error("MagpieRSS [debug] $debugmsg", $lvl);
195 202
         }
Please login to merge, or discard this patch.
manager/includes/veriword.php 2 patches
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 $modx->getSettings();
6 6
 $modx->invokeEvent('OnWebPageInit');
7 7
 
8
-$vword = new VeriWord(148,60);
8
+$vword = new VeriWord(148, 60);
9 9
 $vword->output_image();
10 10
 $vword->destroy_image();
11 11
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 ## see sample.php for test and usage
42 42
 ## sample URL: http://www.program-ruti.org/veriword/
43 43
 ####
44
-class VeriWord {
44
+class VeriWord{
45 45
 
46 46
     /* path to font directory*/
47 47
     public $dir_font   = "ttf/";
@@ -52,44 +52,44 @@  discard block
 block discarded – undo
52 52
     public $im_height  = 0;
53 53
     public $im;
54 54
 
55
-    public function __construct($w=200, $h=80) {
55
+    public function __construct($w = 200, $h = 80){
56 56
         /* create session to set word for verification */
57 57
         $this->set_veriword();
58
-        $this->dir_font = dirname(__FILE__) . '/' . $this->dir_font;
58
+        $this->dir_font = dirname(__FILE__).'/'.$this->dir_font;
59 59
         $this->im_width         = $w;
60 60
         $this->im_height        = $h;
61 61
     }
62 62
 
63
-    public function set_veriword() {
63
+    public function set_veriword(){
64 64
         /* create session variable for verification,
65 65
            you may change the session variable name */
66 66
         $this->word             = $this->pick_word();
67 67
         $_SESSION['veriword']   = $this->word;
68 68
     }
69 69
 
70
-    public function output_image() {
70
+    public function output_image(){
71 71
         /* output the image as jpeg */
72 72
         $this->draw_image();
73 73
         header("Content-type: image/jpeg");
74 74
         imagejpeg($this->im);
75 75
     }
76 76
 
77
-    public function pick_word() {
77
+    public function pick_word(){
78 78
         global $modx;
79 79
         // set default words
80
-        $words="MODX,Access,Better,BitCode,Chunk,Cache,Desc,Design,Excell,Enjoy,URLs,TechView,Gerald,Griff,Humphrey,Holiday,Intel,Integration,Joystick,Join(),Oscope,Genetic,Light,Likeness,Marit,Maaike,Niche,Netherlands,Ordinance,Oscillo,Parser,Phusion,Query,Question,Regalia,Righteous,Snippet,Sentinel,Template,Thespian,Unity,Enterprise,Verily,Veri,Website,WideWeb,Yap,Yellow,Zebra,Zygote";
80
+        $words = "MODX,Access,Better,BitCode,Chunk,Cache,Desc,Design,Excell,Enjoy,URLs,TechView,Gerald,Griff,Humphrey,Holiday,Intel,Integration,Joystick,Join(),Oscope,Genetic,Light,Likeness,Marit,Maaike,Niche,Netherlands,Ordinance,Oscillo,Parser,Phusion,Query,Question,Regalia,Righteous,Snippet,Sentinel,Template,Thespian,Unity,Enterprise,Verily,Veri,Website,WideWeb,Yap,Yellow,Zebra,Zygote";
81 81
         $words = $modx->config['captcha_words'] ? $modx->config['captcha_words'] : $words;
82 82
         $arr_words = array_filter(array_map('trim', explode(',', $words)));
83 83
 
84 84
         /* pick one randomly for text verification */
85
-        return (string) $arr_words[array_rand($arr_words)].rand(10,999);
85
+        return (string) $arr_words[array_rand($arr_words)].rand(10, 999);
86 86
     }
87 87
 
88
-    public function draw_text() {
88
+    public function draw_text(){
89 89
         $dir = dir($this->dir_font);
90 90
         $fontstmp = array();
91 91
         while (false !== ($file = $dir->read())) {
92
-            if(substr($file, -4) == '.ttf') {
92
+            if (substr($file, -4) == '.ttf') {
93 93
                 $fontstmp[] = $this->dir_font.$file;
94 94
             }
95 95
         }
@@ -97,35 +97,35 @@  discard block
 block discarded – undo
97 97
         $text_font = (string) $fontstmp[array_rand($fontstmp)];
98 98
 
99 99
         /* angle for text inclination */
100
-        $text_angle = rand(-9,9);
100
+        $text_angle = rand(-9, 9);
101 101
         /* initial text size */
102 102
         $text_size  = 30;
103 103
         /* calculate text width and height */
104
-        $box        = imagettfbbox ( $text_size, $text_angle, $text_font, $this->word);
105
-        $text_width = $box[2]-$box[0]; //text width
106
-        $text_height= $box[5]-$box[3]; //text height
104
+        $box        = imagettfbbox($text_size, $text_angle, $text_font, $this->word);
105
+        $text_width = $box[2] - $box[0]; //text width
106
+        $text_height = $box[5] - $box[3]; //text height
107 107
 
108 108
         /* adjust text size */
109
-        $text_size  = round((20 * $this->im_width)/$text_width);
109
+        $text_size  = round((20 * $this->im_width) / $text_width);
110 110
 
111 111
         /* recalculate text width and height */
112
-        $box        = imagettfbbox ( $text_size, $text_angle, $text_font, $this->word);
113
-        $text_width = $box[2]-$box[0]; //text width
114
-        $text_height= $box[5]-$box[3]; //text height
112
+        $box        = imagettfbbox($text_size, $text_angle, $text_font, $this->word);
113
+        $text_width = $box[2] - $box[0]; //text width
114
+        $text_height = $box[5] - $box[3]; //text height
115 115
 
116 116
         /* calculate center position of text */
117
-        $text_x         = ($this->im_width - $text_width)/2;
118
-        $text_y         = ($this->im_height - $text_height)/2;
117
+        $text_x         = ($this->im_width - $text_width) / 2;
118
+        $text_y         = ($this->im_height - $text_height) / 2;
119 119
 
120 120
         /* create canvas for text drawing */
121
-        $im_text        = imagecreate ($this->im_width, $this->im_height);
122
-        $bg_color       = imagecolorallocate ($im_text, 255, 255, 255);
121
+        $im_text        = imagecreate($this->im_width, $this->im_height);
122
+        $bg_color       = imagecolorallocate($im_text, 255, 255, 255);
123 123
 
124 124
         /* pick color for text */
125
-        $text_color     = imagecolorallocate ($im_text, 0, 51, 153);
125
+        $text_color     = imagecolorallocate($im_text, 0, 51, 153);
126 126
 
127 127
         /* draw text into canvas */
128
-        imagettftext    (   $im_text,
128
+        imagettftext($im_text,
129 129
             $text_size,
130 130
             $text_angle,
131 131
             $text_x,
@@ -140,19 +140,19 @@  discard block
 block discarded – undo
140 140
     }
141 141
 
142 142
 
143
-    public function draw_image() {
143
+    public function draw_image(){
144 144
 
145 145
         /* pick one background image randomly from image directory */
146
-        $img_file       = $this->dir_noise."noise".rand(1,4).".jpg";
146
+        $img_file       = $this->dir_noise."noise".rand(1, 4).".jpg";
147 147
 
148 148
         /* create "noise" background image from your image stock*/
149
-        $noise_img      = @imagecreatefromjpeg ($img_file);
149
+        $noise_img      = @imagecreatefromjpeg($img_file);
150 150
         $noise_width    = imagesx($noise_img);
151 151
         $noise_height   = imagesy($noise_img);
152 152
 
153 153
         /* resize the background image to fit the size of image output */
154
-        $this->im       = imagecreatetruecolor($this->im_width,$this->im_height);
155
-        imagecopyresampled ($this->im,
154
+        $this->im       = imagecreatetruecolor($this->im_width, $this->im_height);
155
+        imagecopyresampled($this->im,
156 156
             $noise_img,
157 157
             0, 0, 0, 0,
158 158
             $this->im_width,
@@ -161,17 +161,17 @@  discard block
 block discarded – undo
161 161
             $noise_height);
162 162
 
163 163
         /* put text image into background image */
164
-        imagecopymerge (    $this->im,
164
+        imagecopymerge($this->im,
165 165
             $this->draw_text(),
166 166
             0, 0, 0, 0,
167 167
             $this->im_width,
168 168
             $this->im_height,
169
-            70 );
169
+            70);
170 170
 
171 171
         return $this->im;
172 172
     }
173 173
 
174
-    public function destroy_image() {
174
+    public function destroy_image(){
175 175
 
176 176
         imagedestroy($this->im);
177 177
 
Please login to merge, or discard this patch.
Braces   +16 added lines, -8 removed lines patch added patch discarded remove patch
@@ -41,7 +41,8 @@  discard block
 block discarded – undo
41 41
 ## see sample.php for test and usage
42 42
 ## sample URL: http://www.program-ruti.org/veriword/
43 43
 ####
44
-class VeriWord {
44
+class VeriWord
45
+{
45 46
 
46 47
     /* path to font directory*/
47 48
     public $dir_font   = "ttf/";
@@ -52,7 +53,8 @@  discard block
 block discarded – undo
52 53
     public $im_height  = 0;
53 54
     public $im;
54 55
 
55
-    public function __construct($w=200, $h=80) {
56
+    public function __construct($w=200, $h=80)
57
+    {
56 58
         /* create session to set word for verification */
57 59
         $this->set_veriword();
58 60
         $this->dir_font = dirname(__FILE__) . '/' . $this->dir_font;
@@ -60,21 +62,24 @@  discard block
 block discarded – undo
60 62
         $this->im_height        = $h;
61 63
     }
62 64
 
63
-    public function set_veriword() {
65
+    public function set_veriword()
66
+    {
64 67
         /* create session variable for verification,
65 68
            you may change the session variable name */
66 69
         $this->word             = $this->pick_word();
67 70
         $_SESSION['veriword']   = $this->word;
68 71
     }
69 72
 
70
-    public function output_image() {
73
+    public function output_image()
74
+    {
71 75
         /* output the image as jpeg */
72 76
         $this->draw_image();
73 77
         header("Content-type: image/jpeg");
74 78
         imagejpeg($this->im);
75 79
     }
76 80
 
77
-    public function pick_word() {
81
+    public function pick_word()
82
+    {
78 83
         global $modx;
79 84
         // set default words
80 85
         $words="MODX,Access,Better,BitCode,Chunk,Cache,Desc,Design,Excell,Enjoy,URLs,TechView,Gerald,Griff,Humphrey,Holiday,Intel,Integration,Joystick,Join(),Oscope,Genetic,Light,Likeness,Marit,Maaike,Niche,Netherlands,Ordinance,Oscillo,Parser,Phusion,Query,Question,Regalia,Righteous,Snippet,Sentinel,Template,Thespian,Unity,Enterprise,Verily,Veri,Website,WideWeb,Yap,Yellow,Zebra,Zygote";
@@ -85,7 +90,8 @@  discard block
 block discarded – undo
85 90
         return (string) $arr_words[array_rand($arr_words)].rand(10,999);
86 91
     }
87 92
 
88
-    public function draw_text() {
93
+    public function draw_text()
94
+    {
89 95
         $dir = dir($this->dir_font);
90 96
         $fontstmp = array();
91 97
         while (false !== ($file = $dir->read())) {
@@ -140,7 +146,8 @@  discard block
 block discarded – undo
140 146
     }
141 147
 
142 148
 
143
-    public function draw_image() {
149
+    public function draw_image()
150
+    {
144 151
 
145 152
         /* pick one background image randomly from image directory */
146 153
         $img_file       = $this->dir_noise."noise".rand(1,4).".jpg";
@@ -171,7 +178,8 @@  discard block
 block discarded – undo
171 178
         return $this->im;
172 179
     }
173 180
 
174
-    public function destroy_image() {
181
+    public function destroy_image()
182
+    {
175 183
 
176 184
         imagedestroy($this->im);
177 185
 
Please login to merge, or discard this patch.