Completed
Push — develop ( af49d9...193edd )
by Maxim
09:39
created
manager/actions/mutate_web_user.dynamic.php 1 patch
Braces   +27 added lines, -22 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  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
-switch($modx->getManagerApi()->action) {
6
+switch($modx->getManagerApi()->action) {
7 7
 	case 88:
8
-		if(!$modx->hasPermission('edit_web_user')) {
8
+		if(!$modx->hasPermission('edit_web_user')) {
9 9
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
10 10
 		}
11 11
 		break;
12 12
 	case 87:
13
-		if(!$modx->hasPermission('new_web_user')) {
13
+		if(!$modx->hasPermission('new_web_user')) {
14 14
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
15 15
 		}
16 16
 		break;
@@ -23,33 +23,35 @@  discard block
 block discarded – undo
23 23
 
24 24
 // check to see the snippet editor isn't locked
25 25
 $rs = $modx->getDatabase()->select('username', $modx->getDatabase()->getFullTableName('active_users'), "action=88 AND id='{$user}' AND internalKey!='" . $modx->getLoginUserID() . "'");
26
-if($username = $modx->getDatabase()->getValue($rs)) {
26
+if($username = $modx->getDatabase()->getValue($rs)) {
27 27
 	$modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "web user"));
28 28
 }
29 29
 // end check for lock
30 30
 
31
-if($modx->getManagerApi()->action == '88') {
31
+if($modx->getManagerApi()->action == '88') {
32 32
 	// get user attributes
33 33
 	$rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('web_user_attributes'), "internalKey = '{$user}'");
34 34
 	$userdata = $modx->getDatabase()->getRow($rs);
35
-	if(!$userdata) {
35
+	if(!$userdata) {
36 36
 		$modx->webAlertAndQuit("No user returned!");
37 37
 	}
38 38
 
39 39
 	// get user settings
40 40
 	$rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('web_user_settings'), "webuser = '{$user}'");
41 41
 	$usersettings = array();
42
-	while($row = $modx->getDatabase()->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value'];
42
+	while($row = $modx->getDatabase()->getRow($rs)) {
43
+	    $usersettings[$row['setting_name']] = $row['setting_value'];
44
+	}
43 45
 	extract($usersettings, EXTR_OVERWRITE);
44 46
 
45 47
 	// get user name
46 48
 	$rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('web_users'), "id = '{$user}'");
47 49
 	$usernamedata = $modx->getDatabase()->getRow($rs);
48
-	if(!$usernamedata) {
50
+	if(!$usernamedata) {
49 51
 		$modx->webAlertAndQuit("No user returned while getting username!");
50 52
 	}
51 53
 	$_SESSION['itemname'] = $usernamedata['username'];
52
-} else {
54
+} else {
53 55
 	$userdata = array();
54 56
 	$usersettings = array();
55 57
 	$usernamedata = array();
@@ -57,14 +59,14 @@  discard block
 block discarded – undo
57 59
 }
58 60
 
59 61
 // avoid doubling htmlspecialchars (already encoded in DB)
60
-foreach($userdata as $key => $val) {
62
+foreach($userdata as $key => $val) {
61 63
 	$userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']);
62 64
 };
63 65
 $usernamedata['username'] = html_entity_decode($usernamedata['username'], ENT_NOQUOTES, $modx->config['modx_charset']);
64 66
 
65 67
 // restore saved form
66 68
 $formRestored = false;
67
-if($modx->getManagerApi()->hasFormValues()) {
69
+if($modx->getManagerApi()->hasFormValues()) {
68 70
 	$modx->getManagerApi()->loadFormValues();
69 71
 	// restore post values
70 72
 	$userdata = array_merge($userdata, $_POST);
@@ -78,9 +80,9 @@  discard block
 block discarded – undo
78 80
 
79 81
 // include the country list language file
80 82
 $_country_lang = array();
81
-if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) {
83
+if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) {
82 84
 	include_once "lang/country/" . $manager_language . "_country.inc.php";
83
-} else {
85
+} else {
84 86
 	include_once "lang/country/english_country.inc.php";
85 87
 }
86 88
 asort($_country_lang);
@@ -191,7 +193,7 @@  discard block
 block discarded – undo
191 193
 	<?php
192 194
 	// invoke OnWUsrFormPrerender event
193 195
 	$evtOut = $modx->invokeEvent("OnWUsrFormPrerender", array("id" => $user));
194
-	if(is_array($evtOut)) {
196
+	if(is_array($evtOut)) {
195 197
 		echo implode("", $evtOut);
196 198
 	}
197 199
 	?>
@@ -324,7 +326,7 @@  discard block
 block discarded – undo
324 326
 								<?php $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $userdata['country']; ?>
325 327
 								<option value="" <?php (!isset($chosenCountry) ? ' selected' : '') ?> >&nbsp;</option>
326 328
 								<?php
327
-								foreach($_country_lang as $key => $country) {
329
+								foreach($_country_lang as $key => $country) {
328 330
 									echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>";
329 331
 								}
330 332
 								?>
@@ -496,17 +498,20 @@  discard block
 block discarded – undo
496 498
 				</table>
497 499
 			</div>
498 500
 			<?php
499
-			if($use_udperms == 1) {
501
+			if($use_udperms == 1) {
500 502
 
501 503
 			$groupsarray = array();
502 504
 
503
-			if($modx->getManagerApi()->action == '88') { // only do this bit if the user is being edited
505
+			if($modx->getManagerApi()->action == '88') {
506
+// only do this bit if the user is being edited
504 507
 				$rs = $modx->getDatabase()->select('webgroup', $modx->getDatabase()->getFullTableName('web_groups'), "webuser='{$user}'");
505 508
 				$groupsarray = $modx->getDatabase()->getColumn('webgroup', $rs);
506 509
 			}
507 510
 			// retain selected user groups between post
508
-			if(is_array($_POST['user_groups'])) {
509
-				foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v;
511
+			if(is_array($_POST['user_groups'])) {
512
+				foreach($_POST['user_groups'] as $n => $v) {
513
+				    $groupsarray[] = $v;
514
+				}
510 515
 			}
511 516
 			?>
512 517
 			<div class="tab-page" id="tabPermissions">
@@ -515,7 +520,7 @@  discard block
 block discarded – undo
515 520
 				<p><?php echo $_lang['access_permissions_user_message'] ?></p>
516 521
 				<?php
517 522
 				$rs = $modx->getDatabase()->select('name, id', $modx->getDatabase()->getFullTableName('webgroup_names'), '', 'name');
518
-				while($row = $modx->getDatabase()->getRow($rs)) {
523
+				while($row = $modx->getDatabase()->getRow($rs)) {
519 524
 					echo '<label><input type="checkbox" name="user_groups[]" value="' . $row['id'] . '"' . (in_array($row['id'], $groupsarray) ? ' checked="checked"' : '') . ' />' . $row['name'] . '</label><br />';
520 525
 				}
521 526
 				}
@@ -526,7 +531,7 @@  discard block
 block discarded – undo
526 531
 			$evtOut = $modx->invokeEvent("OnWUsrFormRender", array(
527 532
 				"id" => $user
528 533
 			));
529
-			if(is_array($evtOut)) {
534
+			if(is_array($evtOut)) {
530 535
 				echo implode("", $evtOut);
531 536
 			}
532 537
 			?>
Please login to merge, or discard this patch.
manager/actions/welcome.static.php 1 patch
Braces   +48 added lines, -46 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;
@@ -33,46 +33,46 @@  discard block
 block discarded – undo
33 33
 
34 34
 $iconTpl = $modx->getChunk('manager#welcome\WrapIcon');
35 35
 // setup icons
36
-if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
36
+if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
37 37
 	$icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]';
38 38
 	$ph['SecurityIcon'] = sprintf($iconTpl,$icon, 75);
39 39
 }
40
-if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
40
+if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
41 41
 	$icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]';
42 42
 	$ph['WebUserIcon'] = sprintf($iconTpl,$icon, 99);
43 43
 }
44
-if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
44
+if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
45 45
 	$icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]';
46 46
 	$ph['ModulesIcon'] = sprintf($iconTpl,$icon, 106);
47 47
 }
48
-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
+if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
49 49
 	$icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]';
50 50
 	$ph['ResourcesIcon'] = sprintf($iconTpl,$icon, 76);
51 51
 }
52
-if($modx->hasPermission('bk_manager')) {
52
+if($modx->hasPermission('bk_manager')) {
53 53
 	$icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]';
54 54
 	$ph['BackupIcon'] = sprintf($iconTpl,$icon, 93);
55 55
 }
56
-if($modx->hasPermission('help')) {
56
+if($modx->hasPermission('help')) {
57 57
 	$icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]';
58 58
 	$ph['HelpIcon'] = sprintf($iconTpl,$icon, 9);
59 59
 }
60 60
 
61
-if($modx->hasPermission('new_document')) {
61
+if($modx->hasPermission('new_document')) {
62 62
 	$icon = '<i class="[&icons_resource_large&]"></i>[%add_resource%]';
63 63
 	$ph['ResourceIcon'] = sprintf($iconTpl,$icon, 4);
64 64
 	$icon = '<i class="[&icons_weblink_large&]"></i>[%add_weblink%]';
65 65
 	$ph['WeblinkIcon'] = sprintf($iconTpl,$icon, 72);
66 66
 }
67
-if($modx->hasPermission('assets_images')) {
67
+if($modx->hasPermission('assets_images')) {
68 68
 	$icon = '<i class="[&icons_images_large&]"></i>[%images_management%]';
69 69
 	$ph['ImagesIcon'] = sprintf($iconTpl,$icon, 72);
70 70
 }
71
-if($modx->hasPermission('assets_files')) {
71
+if($modx->hasPermission('assets_files')) {
72 72
 	$icon = '<i class="[&icons_files_large&]"></i>[%files_management%]';
73 73
 	$ph['FilesIcon'] = sprintf($iconTpl,$icon, 72);
74 74
 }
75
-if($modx->hasPermission('change_password')) {
75
+if($modx->hasPermission('change_password')) {
76 76
 	$icon = '<i class="[&icons_password_large&]"></i>[%change_password%]';
77 77
 	$ph['PasswordIcon'] = sprintf($iconTpl,$icon, 28);
78 78
 }
@@ -80,21 +80,21 @@  discard block
 block discarded – undo
80 80
 $ph['LogoutIcon'] = sprintf($iconTpl,$icon, 8);
81 81
 
82 82
 // do some config checks
83
-if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
83
+if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
84 84
 	include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php');
85
-	if($config_check_results != $_lang['configcheck_ok']) {
85
+	if($config_check_results != $_lang['configcheck_ok']) {
86 86
 		$ph['config_check_results'] = $config_check_results;
87 87
 		$ph['config_display'] = 'block';
88
-	} else {
88
+	} else {
89 89
 		$ph['config_display'] = 'none';
90 90
 	}
91
-} else {
91
+} else {
92 92
 	$ph['config_display'] = 'none';
93 93
 }
94 94
 
95 95
 // Check logout-reminder
96
-if(isset($_SESSION['show_logout_reminder'])) {
97
-	switch($_SESSION['show_logout_reminder']['type']) {
96
+if(isset($_SESSION['show_logout_reminder'])) {
97
+	switch($_SESSION['show_logout_reminder']['type']) {
98 98
 		case 'logout_reminder':
99 99
 			$date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly');
100 100
 			$ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	}
103 103
 	$ph['show_logout_reminder'] = 'block';
104 104
 	unset($_SESSION['show_logout_reminder']);
105
-} else {
105
+} else {
106 106
 	$ph['show_logout_reminder'] = 'none';
107 107
 }
108 108
 
@@ -163,9 +163,9 @@  discard block
 block discarded – undo
163 163
 $from[] = " us LEFT JOIN " . $modx->getDatabase()->getFullTableName('active_users') . " au ON au.sid=us.sid WHERE au.action <> '8'";
164 164
 $rs = $modx->getDatabase()->select('*', $from, '', 'username ASC, au.sid ASC');
165 165
 
166
-if($modx->getDatabase()->getRecordCount($rs) < 1) {
166
+if($modx->getDatabase()->getRecordCount($rs) < 1) {
167 167
 	$html = '<p>[%no_active_users_found%]</p>';
168
-} else {
168
+} else {
169 169
 	include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
170 170
 	$now = $_SERVER['REQUEST_TIME'] + $server_offset_time;
171 171
 	$ph['now'] = strftime('%H:%M:%S', $now);
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 	$userList = array();
192 192
 	$userCount = array();
193 193
 	// Create userlist with session-count first before output
194
-	while($activeusers = $modx->getDatabase()->getRow($rs)) {
194
+	while($activeusers = $modx->getDatabase()->getRow($rs)) {
195 195
 		$userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1;
196 196
 
197 197
 		$idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : '';
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 			$currentaction
210 210
 		);
211 211
 	}
212
-	foreach($userList as $params) {
212
+	foreach($userList as $params) {
213 213
 		$params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : '';
214 214
 		$html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
215 215
 	}
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 
255 255
 // invoke event OnManagerWelcomePrerender
256 256
 $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender');
257
-if(is_array($evtOut)) {
257
+if(is_array($evtOut)) {
258 258
 	$output = implode('', $evtOut);
259 259
 	$ph['OnManagerWelcomePrerender'] = $output;
260 260
 }
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 	'body' => '<div class="widget-stage">[+RecentInfo+]</div>',
360 360
 	'hide'=>'0'
361 361
 );
362
-if ($modx->config['rss_url_news']) {
362
+if ($modx->config['rss_url_news']) {
363 363
     $widgets['news'] = array(
364 364
         'menuindex' => '40',
365 365
         'id' => 'news',
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
         'hide'=>'0'
371 371
     );
372 372
 }
373
-if ($modx->config['rss_url_security']) {
373
+if ($modx->config['rss_url_security']) {
374 374
     $widgets['security'] = array(
375 375
         'menuindex' => '50',
376 376
         'id' => 'security',
@@ -384,29 +384,29 @@  discard block
 block discarded – undo
384 384
 
385 385
 // invoke OnManagerWelcomeHome event
386 386
 $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
387
-if(is_array($sitewidgets)) {
387
+if(is_array($sitewidgets)) {
388 388
 	$newwidgets = array();
389
-    foreach($sitewidgets as $widget){
389
+    foreach($sitewidgets as $widget) {
390 390
         $newwidgets = array_merge($newwidgets, unserialize($widget));
391 391
     }
392 392
     $widgets = (count($newwidgets) > 0) ? $newwidgets : $widgets;
393 393
 }
394 394
 
395
-usort($widgets, function ($a, $b) {
395
+usort($widgets, function ($a, $b){
396 396
 	return $a['menuindex'] - $b['menuindex'];
397 397
 });
398 398
 
399 399
 $tpl = $modx->getChunk('manager#welcome\Widget');
400 400
 $output = '';
401
-foreach($widgets as $widget) {
402
-	if ($widget['hide'] != '1'){
401
+foreach($widgets as $widget) {
402
+	if ($widget['hide'] != '1') {
403 403
 		$output .= $modx->parseText($tpl, $widget);
404 404
 	}
405 405
 }
406 406
 $ph['widgets'] = $output;
407 407
 
408 408
 // load template
409
-if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
409
+if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
410 410
 	$modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl';
411 411
 }
412 412
 
@@ -414,26 +414,28 @@  discard block
 block discarded – undo
414 414
 $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target);
415 415
 $target = $modx->mergeSettingsContent($target);
416 416
 
417
-if(substr($target, 0, 1) === '@') {
418
-	if(substr($target, 0, 6) === '@CHUNK') {
417
+if(substr($target, 0, 1) === '@') {
418
+	if(substr($target, 0, 6) === '@CHUNK') {
419 419
 		$content = $modx->getChunk(trim(substr($target, 7)));
420
-	} elseif(substr($target, 0, 5) === '@FILE') {
420
+	} elseif(substr($target, 0, 5) === '@FILE') {
421 421
 		$content = file_get_contents(trim(substr($target, 6)));
422
-	} else {
422
+	} else {
423 423
 		$content = '';
424 424
 	}
425
-} else {
425
+} else {
426 426
 	$chunk = $modx->getChunk($target);
427
-	if($chunk !== false && !empty($chunk)) {
427
+	if($chunk !== false && !empty($chunk)) {
428 428
 		$content = $chunk;
429
-	} elseif(is_file(MODX_BASE_PATH . $target)) {
429
+	} elseif(is_file(MODX_BASE_PATH . $target)) {
430 430
 		$content = file_get_contents(MODX_BASE_PATH . $target);
431
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
431
+	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
432 432
 		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl');
433
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible
433
+	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) {
434
+	    // ClipperCMS compatible
434 435
 	{
435
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
436
-	} else {
436
+		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
437
+	}
438
+	} else {
437 439
 		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl');
438 440
 	}
439 441
 }
@@ -442,7 +444,7 @@  discard block
 block discarded – undo
442 444
 $content = $modx->mergeConditionalTagsContent($content);
443 445
 $content = $modx->mergeSettingsContent($content);
444 446
 $content = $modx->parseText($content, $ph);
445
-if(strpos($content, '[+') !== false) {
447
+if(strpos($content, '[+') !== false) {
446 448
 	$modx->toPlaceholders($ph);
447 449
 	$content = $modx->mergePlaceholderContent($content);
448 450
 }
@@ -451,7 +453,7 @@  discard block
 block discarded – undo
451 453
 $content = $modx->parseText($content, $_style, '[&', '&]');
452 454
 $content = $modx->cleanUpMODXTags($content); //cleanup
453 455
 
454
-if($js = $modx->getRegisteredClientScripts()) {
456
+if($js = $modx->getRegisteredClientScripts()) {
455 457
 	$content .= $js;
456 458
 }
457 459
 
Please login to merge, or discard this patch.
manager/actions/mutate_settings/tab1_site_settings.inc.php 1 patch
Braces   +16 added lines, -13 removed lines patch added patch discarded remove patch
@@ -82,23 +82,23 @@  discard block
 block discarded – undo
82 82
         <?php
83 83
 
84 84
         $currentCategory = '';
85
-                        while ($row = $modx->getDatabase()->getRow($rs)) {
85
+                        while ($row = $modx->getDatabase()->getRow($rs)) {
86 86
             $thisCategory = $row['category'];
87
-            if($thisCategory == null) {
87
+            if($thisCategory == null) {
88 88
                 $thisCategory = $_lang['no_category'];
89 89
             }
90
-            if($thisCategory != $currentCategory) {
91
-                if($closeOptGroup) {
90
+            if($thisCategory != $currentCategory) {
91
+                if($closeOptGroup) {
92 92
                     echo "\t\t\t\t\t</optgroup>\n";
93 93
                 }
94 94
                 echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n";
95 95
                 $closeOptGroup = true;
96
-            } else {
96
+            } else {
97 97
                 $closeOptGroup = false;
98 98
             }
99 99
 
100 100
             $selectedtext = $row['id'] == $default_template ? ' selected="selected"' : '';
101
-            if ($selectedtext) {
101
+            if ($selectedtext) {
102 102
                 $oldTmpId = $row['id'];
103 103
                 $oldTmpName = $row['templatename'];
104 104
             }
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
             echo "\t\t\t\t\t".'<option value="'.$row['id'].'"'.$selectedtext.'>'.$row['templatename']."</option>\n";
107 107
             $currentCategory = $thisCategory;
108 108
         }
109
-        if($thisCategory != '') {
109
+        if($thisCategory != '') {
110 110
             echo "\t\t\t\t\t</optgroup>\n";
111 111
         }
112 112
 ?>
@@ -138,11 +138,12 @@  discard block
 block discarded – undo
138 138
               $modx->getDatabase()->select('id', $modx->getDatabase()->getFullTableName('site_plugins'),
139 139
               "plugincode LIKE '%phx.parser.class.inc.php%OnParseDocument();%' AND disabled != 1")
140 140
             );
141
-            if($count) {
141
+            if($count) {
142 142
                 $disabledFilters = 1;
143 143
                 echo '<b>'.$_lang['enable_filter_phx_warning'].'</b><br/>';
144
-            }
145
-            else $disabledFilters = false;
144
+            } else {
145
+                $disabledFilters = false;
146
+            }
146 147
         ?>
147 148
         <?php echo wrap_label($_lang['yes'],form_radio('enable_filter', 1, '', $disabledFilters));?><br />
148 149
         <?php echo wrap_label($_lang['no'], form_radio('enable_filter', 0, '', $disabledFilters));?>
@@ -204,7 +205,7 @@  discard block
 block discarded – undo
204 205
     <select name="lst_custom_contenttype" style="width:200px;height:100px;" size="5">
205 206
     <?php
206 207
         $ct = explode(",",$custom_contenttype);
207
-        for($i=0;$i<count($ct);$i++) {
208
+        for($i=0;$i<count($ct);$i++) {
208 209
             echo "<option value=\"".$ct[$i]."\">".$ct[$i]."</option>";
209 210
         }
210 211
     ?>
@@ -259,7 +260,7 @@  discard block
 block discarded – undo
259 260
       <th><?php echo $_lang['serveroffset_title'] ?><br><small>[(server_offset_time)]</small></th>
260 261
       <td> <select name="server_offset_time" size="1" class="inputBox">
261 262
           <?php
262
-      for($i=-24; $i<25; $i++) {
263
+      for($i=-24; $i<25; $i++) {
263 264
           $seconds = $i*60*60;
264 265
           $selectedtext = $seconds==$server_offset_time ? "selected='selected'" : "" ;
265 266
       ?>
@@ -301,7 +302,9 @@  discard block
 block discarded – undo
301 302
         <?php
302 303
             // invoke OnSiteSettingsRender event
303 304
             $evtOut = $modx->invokeEvent('OnSiteSettingsRender');
304
-            if(is_array($evtOut)) echo implode("",$evtOut);
305
+            if(is_array($evtOut)) {
306
+                echo implode("",$evtOut);
307
+            }
305 308
         ?>
306 309
     </td>
307 310
   </tr>
Please login to merge, or discard this patch.
manager/actions/mutate_settings.dynamic.php 1 patch
Braces   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@  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 />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5
-if(!$modx->hasPermission('settings')) {
5
+if(!$modx->hasPermission('settings')) {
6 6
 	$modx->webAlertAndQuit($_lang['error_no_privileges']);
7 7
 }
8 8
 
9 9
 // check to see the edit settings page isn't locked
10 10
 $rs = $modx->getDatabase()->select('username', $modx->getDatabase()->getFullTableName('active_users'), "action=17 AND internalKey!='" . $modx->getLoginUserID() . "'");
11
-if($username = $modx->getDatabase()->getValue($rs)) {
11
+if($username = $modx->getDatabase()->getValue($rs)) {
12 12
 	$modx->webAlertAndQuit(sprintf($_lang['lock_settings_msg'], $username));
13 13
 }
14 14
 // end check for lock
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 $settings = array();
19 19
 include_once(MODX_MANAGER_PATH . 'includes/default_config.php');
20 20
 $rs = $modx->getDatabase()->select('setting_name, setting_value', $modx->getDatabase()->getFullTableName('system_settings'));
21
-while($row = $modx->getDatabase()->getRow($rs)) {
21
+while($row = $modx->getDatabase()->getRow($rs)) {
22 22
 	$settings[$row['setting_name']] = $row['setting_value'];
23 23
 }
24 24
 $settings['filemanager_path'] = preg_replace('@^' . preg_quote(MODX_BASE_PATH) . '@', '[(base_path)]', $settings['filemanager_path']);
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
 // load languages and keys
30 30
 $lang_keys = array();
31 31
 $dir = dir('includes/lang');
32
-while($file = $dir->read()) {
33
-	if(strpos($file, '.inc.php') > 0) {
32
+while($file = $dir->read()) {
33
+	if(strpos($file, '.inc.php') > 0) {
34 34
 		$endpos = strpos($file, '.');
35 35
 		$languagename = substr($file, 0, $endpos);
36 36
 		$lang_keys[$languagename] = get_lang_keys($file);
@@ -129,6 +129,6 @@  discard block
 block discarded – undo
129 129
 		});
130 130
 	</script>
131 131
 <?php
132
-if(is_numeric($_GET['tab'])) {
132
+if(is_numeric($_GET['tab'])) {
133 133
 	echo '<script type="text/javascript">tpSettings.setSelectedIndex( ' . $_GET['tab'] . ' );</script>';
134 134
 }
Please login to merge, or discard this patch.
manager/actions/site_schedule.static.php 1 patch
Braces   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  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
-if(!$modx->hasPermission('view_eventlog')) {
5
+if(!$modx->hasPermission('view_eventlog')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 ?>
@@ -19,11 +19,11 @@  discard block
 block discarded – undo
19 19
 			<?php
20 20
 			$rs = $modx->getDatabase()->select('id, pagetitle, pub_date', $modx->getDatabase()->getFullTableName('site_content'), "pub_date > " . time() . "", 'pub_date ASC');
21 21
 			$limit = $modx->getDatabase()->getRecordCount($rs);
22
-			if($limit < 1) {
22
+			if($limit < 1) {
23 23
 				?>
24 24
 				<p><?= $_lang["no_docs_pending_publishing"] ?></p>
25 25
 				<?php
26
-			} else {
26
+			} else {
27 27
 				?>
28 28
 				<div class="table-responsive">
29 29
 					<table class="grid sortabletable" id="table-1">
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 						</thead>
37 37
 						<tbody>
38 38
 						<?php
39
-						while($row = $modx->getDatabase()->getRow($rs)) {
39
+						while($row = $modx->getDatabase()->getRow($rs)) {
40 40
 							?>
41 41
 							<tr>
42 42
 								<td class="text-right"><?= $row['id'] ?></td>
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
 			<?php
59 59
 			$rs = $modx->getDatabase()->select('id, pagetitle, unpub_date', $modx->getDatabase()->getFullTableName('site_content'), "unpub_date > " . time() . "", 'unpub_date ASC');
60 60
 			$limit = $modx->getDatabase()->getRecordCount($rs);
61
-			if($limit < 1) {
61
+			if($limit < 1) {
62 62
 				?>
63 63
 				<p><?= $_lang["no_docs_pending_unpublishing"] ?></p>
64 64
 				<?php
65
-			} else {
65
+			} else {
66 66
 				?>
67 67
 				<div class="table-responsive">
68 68
 					<table class="grid sortabletable" id="table-2">
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 						</thead>
76 76
 						<tbody>
77 77
 						<?php
78
-						while($row = $modx->getDatabase()->getRow($rs)) {
78
+						while($row = $modx->getDatabase()->getRow($rs)) {
79 79
 							?>
80 80
 							<tr>
81 81
 								<td class="text-right"><?= $row['id'] ?></td>
@@ -97,11 +97,11 @@  discard block
 block discarded – undo
97 97
 			<?php
98 98
 			$rs = $modx->getDatabase()->select('id, pagetitle, pub_date, unpub_date', $modx->getDatabase()->getFullTableName('site_content'), "pub_date > 0 OR unpub_date > 0", "pub_date DESC");
99 99
 			$limit = $modx->getDatabase()->getRecordCount($rs);
100
-			if($limit < 1) {
100
+			if($limit < 1) {
101 101
 				?>
102 102
 				<p><?= $_lang["no_docs_pending_pubunpub"] ?></p>
103 103
 				<?php
104
-			} else {
104
+			} else {
105 105
 				?>
106 106
 				<div class="table-responsive">
107 107
 					<table class="grid sortabletable" id="table-3">
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 						</thead>
116 116
 						<tbody>
117 117
 						<?php
118
-						while($row = $modx->getDatabase()->getRow($rs)) {
118
+						while($row = $modx->getDatabase()->getRow($rs)) {
119 119
 							?>
120 120
 							<tr>
121 121
 								<td class="text-right"><?= $row['id'] ?></td>
Please login to merge, or discard this patch.
manager/actions/mutate_user.dynamic.php 1 patch
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,7 +43,9 @@  discard block
 block discarded – undo
43 43
 	// get user settings
44 44
 	$rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('user_settings'), "user = '{$user}'");
45 45
 	$usersettings = array();
46
-	while($row = $modx->getDatabase()->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value'];
46
+	while($row = $modx->getDatabase()->getRow($rs)) {
47
+	    $usersettings[$row['setting_name']] = $row['setting_value'];
48
+	}
47 49
 	// manually extract so that user display settings are not overwritten
48 50
 	foreach($usersettings as $k => $v) {
49 51
 		if($k != 'manager_language' && $k != 'manager_theme') {
@@ -771,13 +773,16 @@  discard block
 block discarded – undo
771 773
 
772 774
 			$groupsarray = array();
773 775
 
774
-			if($modx->getManagerApi()->action == '12') { // only do this bit if the user is being edited
776
+			if($modx->getManagerApi()->action == '12') {
777
+// only do this bit if the user is being edited
775 778
 				$rs = $modx->getDatabase()->select('user_group', $modx->getDatabase()->getFullTableName('member_groups'), "member='{$user}'");
776 779
 				$groupsarray = $modx->getDatabase()->getColumn('user_group', $rs);
777 780
 			}
778 781
 			// retain selected doc groups between post
779 782
 			if(is_array($_POST['user_groups'])) {
780
-				foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v;
783
+				foreach($_POST['user_groups'] as $n => $v) {
784
+				    $groupsarray[] = $v;
785
+				}
781 786
 			}
782 787
 			?>
783 788
 			<div class="tab-page" id="tabAccess">
Please login to merge, or discard this patch.
manager/actions/modules.static.php 1 patch
Braces   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  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
-if (!($modx->hasPermission('new_module') || $modx->hasPermission('edit_module') || $modx->hasPermission('exec_module'))) {
5
+if (!($modx->hasPermission('new_module') || $modx->hasPermission('edit_module') || $modx->hasPermission('exec_module'))) {
6 6
     $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
@@ -10,10 +10,10 @@  discard block
 block discarded – undo
10 10
 $modx->getManagerApi()->initPageViewState();
11 11
 
12 12
 // get and save search string
13
-if ($_REQUEST['op'] == 'reset') {
13
+if ($_REQUEST['op'] == 'reset') {
14 14
     $query = '';
15 15
     $_PAGE['vs']['search'] = '';
16
-} else {
16
+} else {
17 17
     $query = isset($_REQUEST['search']) ? $_REQUEST['search'] : $_PAGE['vs']['search'];
18 18
     $sqlQuery = $modx->getDatabase()->escape($query);
19 19
     $_PAGE['vs']['search'] = $query;
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 // context menu
28 28
 $cm = new \EvolutionCMS\Support\ContextMenu("cntxm", 150);
29 29
 $cm->addItem($_lang["run_module"], "js:menuAction(1)", $_style['actions_run'], (!$modx->hasPermission('exec_module') ? 1 : 0));
30
-if ($modx->hasPermission('edit_module') || $modx->hasPermission('new_module') || $modx->hasPermission('delete_module')) {
30
+if ($modx->hasPermission('edit_module') || $modx->hasPermission('new_module') || $modx->hasPermission('delete_module')) {
31 31
     $cm->addSeparator();
32 32
 }
33 33
 $cm->addItem($_lang["edit"], "js:menuAction(2)", $_style['actions_edit'], (!$modx->hasPermission('edit_module') ? 1 : 0));
@@ -106,21 +106,21 @@  discard block
 block discarded – undo
106 106
 <div class="tab-page">
107 107
     <div class="table-responsive">
108 108
         <?php
109
-        if ($_SESSION['mgrRole'] != 1 && !empty($modx->config['use_udperms'])) {
109
+        if ($_SESSION['mgrRole'] != 1 && !empty($modx->config['use_udperms'])) {
110 110
             $rs = $modx->getDatabase()->query('SELECT DISTINCT sm.id, sm.name, sm.description, mg.member, IF(disabled,"' . $_lang['yes'] . '","-") as disabled, IF(sm.icon<>"",sm.icon,"' . $_style['icons_modules'] . '") as icon
111 111
 				FROM ' . $modx->getDatabase()->getFullTableName('site_modules') . ' AS sm
112 112
 				LEFT JOIN ' . $modx->getDatabase()->getFullTableName('site_module_access') . ' AS sma ON sma.module = sm.id
113 113
 				LEFT JOIN ' . $modx->getDatabase()->getFullTableName('member_groups') . ' AS mg ON sma.usergroup = mg.user_group
114 114
                 WHERE (mg.member IS NULL OR mg.member = ' . $modx->getLoginUserID() . ') AND sm.disabled != 1 AND sm.locked != 1
115 115
                 ORDER BY sm.name');
116
-            if ($modx->hasPermission('edit_module')) {
116
+            if ($modx->hasPermission('edit_module')) {
117 117
                 $title = "<a href='index.php?a=108&id=[+id+]' title='" . $_lang["module_edit_click_title"] . "'>[+value+]</a>";
118
-            } else if ($modx->hasPermission('exec_module')) {
118
+            } else if ($modx->hasPermission('exec_module')) {
119 119
                 $title = "<a href='index.php?a=112&id=[+id+]' title='" . $_lang["module_edit_click_title"] . "'>[+value+]</a>";
120
-            } else {
120
+            } else {
121 121
                 $title = '[+value+]';
122 122
             }
123
-        } else {
123
+        } else {
124 124
             $rs = $modx->getDatabase()->select("id, name, description, IF(locked,'{$_lang['yes']}','-') as locked, IF(disabled,'{$_lang['yes']}','-') as disabled, IF(icon<>'',icon,'{$_style['icons_module']}') as icon", $modx->getDatabase()->getFullTableName("site_modules"), (!empty($sqlQuery) ? "(name LIKE '%{$sqlQuery}%') OR (description LIKE '%{$sqlQuery}%')" : ""), "name");
125 125
             $title = "<a href='index.php?a=108&id=[+id+]' title='" . $_lang["module_edit_click_title"] . "'>[+value+]</a>";
126 126
         }
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
         $grd->colWidths = "34,,,60,60";
136 136
         $grd->colAligns = "center,,,center,center";
137 137
         $grd->colTypes = "template:<a class='tableRowIcon' href='javascript:;' onclick='return showContentMenu([+id+],event);' title='" . $_lang["click_to_context"] . "'><i class='[+value+]'></i></a>||template:" . $title;
138
-        if ($listmode == '1') {
138
+        if ($listmode == '1') {
139 139
             $grd->pageSize = 0;
140 140
         }
141
-        if ($_REQUEST['op'] == 'reset') {
141
+        if ($_REQUEST['op'] == 'reset') {
142 142
             $grd->pageNumber = 1;
143 143
         }
144 144
         // render grid
Please login to merge, or discard this patch.
manager/actions/logging.static.php 1 patch
Braces   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  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
-if (!$modx->hasPermission('logs')) {
5
+if (!$modx->hasPermission('logs')) {
6 6
     $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
                             <?php
27 27
                             // get all users currently in the log
28 28
                             $logs_user = record_sort(array_unique_multi($logs, 'internalKey'), 'username');
29
-                            foreach ($logs_user as $row) {
29
+                            foreach ($logs_user as $row) {
30 30
                                 $selectedtext = $row['internalKey'] == $_REQUEST['searchuser'] ? ' selected="selected"' : '';
31 31
                                 echo "\t\t" . '<option value="' . $row['internalKey'] . '"' . $selectedtext . '>' . $row['username'] . "</option>\n";
32 32
                             }
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
                             // get all available actions in the log
44 44
                             include_once "actionlist.inc.php";
45 45
                             $logs_actions = record_sort(array_unique_multi($logs, 'action'), 'action');
46
-                            foreach ($logs_actions as $row) {
46
+                            foreach ($logs_actions as $row) {
47 47
                                 $action = getAction($row['action']);
48
-                                if ($action == 'Idle') {
48
+                                if ($action == 'Idle') {
49 49
                                     continue;
50 50
                                 }
51 51
                                 $selectedtext = $row['action'] == $_REQUEST['action'] ? ' selected="selected"' : '';
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
                             <?php
64 64
                             // get all itemid currently in logging
65 65
                             $logs_items = record_sort(array_unique_multi($logs, 'itemid'), 'itemid');
66
-                            foreach ($logs_items as $row) {
66
+                            foreach ($logs_items as $row) {
67 67
                                 $selectedtext = $row['itemid'] == $_REQUEST['itemid'] ? ' selected="selected"' : '';
68 68
                                 echo "\t\t" . '<option value="' . $row['itemid'] . '"' . $selectedtext . '>' . $row['itemid'] . "</option>\n";
69 69
                             }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
                             <?php
80 80
                             // get all itemname currently in logging
81 81
                             $logs_names = record_sort(array_unique_multi($logs, 'itemname'), 'itemname');
82
-                            foreach ($logs_names as $row) {
82
+                            foreach ($logs_names as $row) {
83 83
                                 $selectedtext = $row['itemname'] == $_REQUEST['itemname'] ? ' selected="selected"' : '';
84 84
                                 echo "\t\t" . '<option value="' . $row['itemname'] . '"' . $selectedtext . '>' . $row['itemname'] . "</option>\n";
85 85
                             }
@@ -135,36 +135,36 @@  discard block
 block discarded – undo
135 135
     <div class="container container-body">
136 136
 
137 137
 <?php
138
-if (isset($_REQUEST['log_submit'])) {
138
+if (isset($_REQUEST['log_submit'])) {
139 139
     // get the selections the user made.
140 140
     $sqladd = array();
141
-    if ($_REQUEST['searchuser'] != 0) {
141
+    if ($_REQUEST['searchuser'] != 0) {
142 142
         $sqladd[] = "internalKey='" . (int)$_REQUEST['searchuser'] . "'";
143 143
     }
144
-    if ($_REQUEST['action'] != 0) {
144
+    if ($_REQUEST['action'] != 0) {
145 145
         $sqladd[] = "action=" . (int)$_REQUEST['action'];
146 146
     }
147
-    if ($_REQUEST['itemid'] != 0 || $_REQUEST['itemid'] == "-") {
147
+    if ($_REQUEST['itemid'] != 0 || $_REQUEST['itemid'] == "-") {
148 148
         $sqladd[] = "itemid='" . $_REQUEST['itemid'] . "'";
149 149
     }
150
-    if ($_REQUEST['itemname'] != '0') {
150
+    if ($_REQUEST['itemname'] != '0') {
151 151
         $sqladd[] = "itemname='" . $modx->getDatabase()->escape($_REQUEST['itemname']) . "'";
152 152
     }
153
-    if ($_REQUEST['message'] != "") {
153
+    if ($_REQUEST['message'] != "") {
154 154
         $sqladd[] = "message LIKE '%" . $modx->getDatabase()->escape($_REQUEST['message']) . "%'";
155 155
     }
156 156
     // date stuff
157
-    if ($_REQUEST['datefrom'] != "") {
157
+    if ($_REQUEST['datefrom'] != "") {
158 158
         $sqladd[] = "timestamp>" . $modx->toTimeStamp($_REQUEST['datefrom']);
159 159
     }
160
-    if ($_REQUEST['dateto'] != "") {
160
+    if ($_REQUEST['dateto'] != "") {
161 161
         $sqladd[] = "timestamp<" . $modx->toTimeStamp($_REQUEST['dateto']);
162 162
     }
163 163
 
164 164
     // If current position is not set, set it to zero
165
-    if (!isset($_REQUEST['int_cur_position']) || $_REQUEST['int_cur_position'] == 0) {
165
+    if (!isset($_REQUEST['int_cur_position']) || $_REQUEST['int_cur_position'] == 0) {
166 166
         $int_cur_position = 0;
167
-    } else {
167
+    } else {
168 168
         $int_cur_position = $_REQUEST['int_cur_position'];
169 169
     }
170 170
 
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
 
179 179
     $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('manager_log'), (!empty($sqladd) ? implode(' AND ', $sqladd) : ''), 'timestamp DESC, id DESC', "{$int_cur_position}, {$int_num_result}");
180 180
 
181
-if ($limit < 1) {
181
+if ($limit < 1) {
182 182
     echo '<p>' . $_lang["mgrlog_emptysrch"] . '</p>';
183
-} else {
183
+} else {
184 184
     echo '<p>' . $_lang["mgrlog_sortinst"] . '</p>';
185 185
 
186 186
     // New instance of the Paging class, you can modify the color and the width of the html table
@@ -198,14 +198,14 @@  discard block
 block discarded – undo
198 198
     $paging = $array_paging['first_link'] . $_lang["paging_first"] . (isset($array_paging['first_link']) ? "</a> " : " ");
199 199
     $paging .= $array_paging['previous_link'] . $_lang["paging_prev"] . (isset($array_paging['previous_link']) ? "</a> " : " ");
200 200
     $pagesfound = sizeof($array_row_paging);
201
-    if ($pagesfound > 6) {
201
+    if ($pagesfound > 6) {
202 202
         $paging .= $array_row_paging[$current_row - 2]; // ."&nbsp;";
203 203
         $paging .= $array_row_paging[$current_row - 1]; // ."&nbsp;";
204 204
         $paging .= $array_row_paging[$current_row]; // ."&nbsp;";
205 205
         $paging .= $array_row_paging[$current_row + 1]; // ."&nbsp;";
206 206
         $paging .= $array_row_paging[$current_row + 2]; // ."&nbsp;";
207
-    } else {
208
-        for ($i = 0; $i < $pagesfound; $i++) {
207
+    } else {
208
+        for ($i = 0; $i < $pagesfound; $i++) {
209 209
             $paging .= $array_row_paging[$i] . "&nbsp;";
210 210
         }
211 211
     }
@@ -242,12 +242,12 @@  discard block
 block discarded – undo
242 242
                 // grab the entire log file...
243 243
                 $logentries = array();
244 244
                 $i = 0;
245
-                while ($logentry = $modx->getDatabase()->getRow($rs)) {
246
-                    if (!preg_match("/^[0-9]+$/", $logentry['itemid'])) {
245
+                while ($logentry = $modx->getDatabase()->getRow($rs)) {
246
+                    if (!preg_match("/^[0-9]+$/", $logentry['itemid'])) {
247 247
                         $item = '<div style="text-align:center;">-</div>';
248
-                    } elseif ($logentry['action'] == 3 || $logentry['action'] == 27 || $logentry['action'] == 5) {
248
+                    } elseif ($logentry['action'] == 3 || $logentry['action'] == 27 || $logentry['action'] == 5) {
249 249
                         $item = '<a href="index.php?a=3&amp;id=' . $logentry['itemid'] . '">' . $logentry['itemname'] . '</a>';
250
-                    } else {
250
+                    } else {
251 251
                         $item = $logentry['itemname'];
252 252
                     }
253 253
                     //index.php?a=13&searchuser=' . $logentry['internalKey'] . '&action=' . $logentry['action'] . '&itemname=' . $logentry['itemname'] . '&log_submit=true'
@@ -284,6 +284,6 @@  discard block
 block discarded – undo
284 284
     // @see index.php @ 915
285 285
     global $action;
286 286
     $action = 1;
287
-} else {
287
+} else {
288 288
     echo $_lang["mgrlog_noquery"];
289 289
 }
Please login to merge, or discard this patch.
manager/media/style/default/ajax.php 1 patch
Braces   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -7,11 +7,11 @@  discard block
 block discarded – undo
7 7
 
8 8
 $modx->getDatabase()->connect();
9 9
 
10
-if (empty ($modx->config)) {
10
+if (empty ($modx->config)) {
11 11
     $modx->getSettings();
12 12
 }
13 13
 
14
-if (!isset($_SESSION['mgrValidated']) || !isset($_SERVER['HTTP_X_REQUESTED_WITH']) || (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest') || ($_SERVER['REQUEST_METHOD'] != 'POST')) {
14
+if (!isset($_SESSION['mgrValidated']) || !isset($_SERVER['HTTP_X_REQUESTED_WITH']) || (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest') || ($_SERVER['REQUEST_METHOD'] != 'POST')) {
15 15
     $modx->sendErrorPage();
16 16
 }
17 17
 
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 
20 20
 $_lang = array();
21 21
 include_once MODX_MANAGER_PATH . '/includes/lang/english.inc.php';
22
-if ($modx->config['manager_language'] != 'english') {
22
+if ($modx->config['manager_language'] != 'english') {
23 23
     include_once MODX_MANAGER_PATH . '/includes/lang/' . $modx->config['manager_language'] . '.inc.php';
24 24
 }
25 25
 include_once MODX_MANAGER_PATH . '/media/style/' . $modx->config['manager_theme'] . '/style.php';
@@ -32,12 +32,12 @@  discard block
 block discarded – undo
32 32
 // set limit sql query
33 33
 $limit = !empty($modx->config['number_of_results']) ? (int) $modx->config['number_of_results'] : 100;
34 34
 
35
-if (isset($action)) {
36
-    switch ($action) {
35
+if (isset($action)) {
36
+    switch ($action) {
37 37
 
38 38
         case '1': {
39 39
 
40
-            switch ($frame) {
40
+            switch ($frame) {
41 41
                 case 'nodes':
42 42
                     include_once MODX_MANAGER_PATH . '/frames/nodes.php';
43 43
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
             $elements = isset($_REQUEST['elements']) && is_scalar($_REQUEST['elements']) ? htmlentities($_REQUEST['elements']) : '';
53 53
 
54
-            if ($elements) {
54
+            if ($elements) {
55 55
                 $output = '';
56 56
                 $items = '';
57 57
                 $sql = '';
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
                 $sqlLike = $filter ? 'WHERE t1.name LIKE "' . $modx->getDatabase()->escape($filter) . '%"' : '';
61 61
                 $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit;
62 62
 
63
-                switch ($elements) {
63
+                switch ($elements) {
64 64
                     case 'element_templates':
65 65
                         $a = 16;
66 66
                         $sqlLike = $filter ? 'WHERE t1.templatename LIKE "' . $modx->getDatabase()->escape($filter) . '%"' : '';
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
                         ORDER BY t1.templatename ASC
71 71
                         ' . $sqlLimit);
72 72
 
73
-                        if ($modx->hasPermission('new_template')) {
73
+                        if ($modx->hasPermission('new_template')) {
74 74
                             $output .= '<li><a id="a_19" href="index.php?a=19" target="main"><i class="fa fa-plus"></i>' . $_lang['new_template'] . '</a></li>';
75 75
                         }
76 76
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
                         ORDER BY t1.name ASC
87 87
                         ' . $sqlLimit);
88 88
 
89
-                        if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) {
89
+                        if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) {
90 90
                             $output .= '<li><a id="a_300" href="index.php?a=300" target="main"><i class="fa fa-plus"></i>' . $_lang['new_tmplvars'] . '</a></li>';
91 91
                         }
92 92
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
                         ORDER BY t1.name ASC
101 101
                         ' . $sqlLimit);
102 102
 
103
-                        if ($modx->hasPermission('new_chunk')) {
103
+                        if ($modx->hasPermission('new_chunk')) {
104 104
                             $output .= '<li><a id="a_77" href="index.php?a=77" target="main"><i class="fa fa-plus"></i>' . $_lang['new_htmlsnippet'] . '</a></li>';
105 105
                         }
106 106
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
                         ORDER BY t1.name ASC
115 115
                         ' . $sqlLimit);
116 116
 
117
-                        if ($modx->hasPermission('new_snippet')) {
117
+                        if ($modx->hasPermission('new_snippet')) {
118 118
                             $output .= '<li><a id="a_23" href="index.php?a=23" target="main"><i class="fa fa-plus"></i>' . $_lang['new_snippet'] . '</a></li>';
119 119
                         }
120 120
 
@@ -128,19 +128,19 @@  discard block
 block discarded – undo
128 128
                         ORDER BY t1.name ASC
129 129
                         ' . $sqlLimit);
130 130
 
131
-                        if ($modx->hasPermission('new_plugin')) {
131
+                        if ($modx->hasPermission('new_plugin')) {
132 132
                             $output .= '<li><a id="a_101" href="index.php?a=101" target="main"><i class="fa fa-plus"></i>' . $_lang['new_plugin'] . '</a></li>';
133 133
                         }
134 134
 
135 135
                         break;
136 136
                 }
137 137
 
138
-                if ($count = $modx->getDatabase()->getRecordCount($sql)) {
139
-                    if ($count == $limit) {
138
+                if ($count = $modx->getDatabase()->getRecordCount($sql)) {
139
+                    if ($count == $limit) {
140 140
                         $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>';
141 141
                     }
142
-                    while ($row = $modx->getDatabase()->getRow($sql)) {
143
-                        if (($row['disabled'] || $row['locked']) && $role != 1) {
142
+                    while ($row = $modx->getDatabase()->getRow($sql)) {
143
+                        if (($row['disabled'] || $row['locked']) && $role != 1) {
144 144
                             continue;
145 145
                         }
146 146
 
@@ -148,9 +148,9 @@  discard block
 block discarded – undo
148 148
                     }
149 149
                 }
150 150
 
151
-                if (isset($_REQUEST['filter'])) {
151
+                if (isset($_REQUEST['filter'])) {
152 152
                     $output = $items;
153
-                } else {
153
+                } else {
154 154
                     $output .= $items;
155 155
                 }
156 156
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
             $sqlLike = $filter ? 'WHERE t1.username LIKE "' . $modx->getDatabase()->escape($filter) . '%"' : '';
169 169
             $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit;
170 170
 
171
-            if(!$modx->hasPermission('save_role')) {
171
+            if(!$modx->hasPermission('save_role')) {
172 172
                 $sqlLike .= $sqlLike ? ' AND ' : 'WHERE ';
173 173
                 $sqlLike .= 't2.role != 1';
174 174
             }
@@ -180,22 +180,22 @@  discard block
 block discarded – undo
180 180
 				ORDER BY t1.username ASC
181 181
 				' . $sqlLimit);
182 182
 
183
-            if ($modx->hasPermission('new_user')) {
183
+            if ($modx->hasPermission('new_user')) {
184 184
                 $output .= '<li><a id="a_11" href="index.php?a=11" target="main"><i class="fa fa-plus"></i>' . $_lang['new_user'] . '</a></li>';
185 185
             }
186 186
 
187
-            if ($count = $modx->getDatabase()->getRecordCount($sql)) {
188
-                if ($count == $limit) {
187
+            if ($count = $modx->getDatabase()->getRecordCount($sql)) {
188
+                if ($count == $limit) {
189 189
                     $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>';
190 190
                 }
191
-                while ($row = $modx->getDatabase()->getRow($sql)) {
191
+                while ($row = $modx->getDatabase()->getRow($sql)) {
192 192
                     $items .= '<li class="item ' . ($row['blocked'] ? 'disabled' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>';
193 193
                 }
194 194
             }
195 195
 
196
-            if (isset($_REQUEST['filter'])) {
196
+            if (isset($_REQUEST['filter'])) {
197 197
                 $output = $items;
198
-            } else {
198
+            } else {
199 199
                 $output .= $items;
200 200
             }
201 201
 
@@ -219,22 +219,22 @@  discard block
 block discarded – undo
219 219
 				ORDER BY t1.username ASC
220 220
 				' . $sqlLimit);
221 221
 
222
-            if ($modx->hasPermission('new_web_user')) {
222
+            if ($modx->hasPermission('new_web_user')) {
223 223
                 $output .= '<li><a id="a_87" href="index.php?a=87" target="main"><i class="fa fa-plus"></i>' . $_lang['new_web_user'] . '</a></li>';
224 224
             }
225 225
 
226
-            if ($count = $modx->getDatabase()->getRecordCount($sql)) {
227
-                if ($count == $limit) {
226
+            if ($count = $modx->getDatabase()->getRecordCount($sql)) {
227
+                if ($count == $limit) {
228 228
                     $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>';
229 229
                 }
230
-                while ($row = $modx->getDatabase()->getRow($sql)) {
230
+                while ($row = $modx->getDatabase()->getRow($sql)) {
231 231
                     $items .= '<li class="item ' . ($row['blocked'] ? 'disabled' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>';
232 232
                 }
233 233
             }
234 234
 
235
-            if (isset($_REQUEST['filter'])) {
235
+            if (isset($_REQUEST['filter'])) {
236 236
                 $output = $items;
237
-            } else {
237
+            } else {
238 238
                 $output .= $items;
239 239
             }
240 240
 
@@ -248,8 +248,8 @@  discard block
 block discarded – undo
248 248
             $type = isset($_REQUEST['type']) && is_scalar($_REQUEST['type']) ? $modx->getDatabase()->escape($_REQUEST['type']) : false;
249 249
             $contextmenu = '';
250 250
 
251
-            if ($role && $name && $type) {
252
-                switch ($type) {
251
+            if ($role && $name && $type) {
252
+                switch ($type) {
253 253
                     case 'Snippet':
254 254
                     case 'SnippetNoCache': {
255 255
 
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 						WHERE name="' . $name . '"
259 259
 						LIMIT 1');
260 260
 
261
-                        if ($modx->getDatabase()->getRecordCount($sql)) {
261
+                        if ($modx->getDatabase()->getRecordCount($sql)) {
262 262
                             $row = $modx->getDatabase()->getRow($sql);
263 263
                             $contextmenu = array(
264 264
                                 'header' => array(
@@ -269,13 +269,13 @@  discard block
 block discarded – undo
269 269
                                     'url' => "index.php?a=22&id=" . $row['id']
270 270
                                 )
271 271
                             );
272
-                            if (!empty($row['description'])) {
272
+                            if (!empty($row['description'])) {
273 273
                                 $contextmenu['seperator'] = '';
274 274
                                 $contextmenu['description'] = array(
275 275
                                     'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
276 276
                                 );
277 277
                             }
278
-                        } else {
278
+                        } else {
279 279
                             $contextmenu = array(
280 280
                                 'header' => array(
281 281
                                     'innerHTML' => '<i class="fa fa-code"></i> ' . $name
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 						WHERE name="' . $name . '"
297 297
 						LIMIT 1');
298 298
 
299
-                        if ($modx->getDatabase()->getRecordCount($sql)) {
299
+                        if ($modx->getDatabase()->getRecordCount($sql)) {
300 300
                             $row = $modx->getDatabase()->getRow($sql);
301 301
                             $contextmenu = array(
302 302
                                 'header' => array(
@@ -307,13 +307,13 @@  discard block
 block discarded – undo
307 307
                                     'url' => "index.php?a=78&id=" . $row['id']
308 308
                                 )
309 309
                             );
310
-                            if (!empty($row['description'])) {
310
+                            if (!empty($row['description'])) {
311 311
                                 $contextmenu['seperator'] = '';
312 312
                                 $contextmenu['description'] = array(
313 313
                                     'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
314 314
                                 );
315 315
                             }
316
-                        } else {
316
+                        } else {
317 317
                             $contextmenu = array(
318 318
                                 'header' => array(
319 319
                                     'innerHTML' => '<i class="fa fa-th-large"></i> ' . $name
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 						WHERE name="' . $name . '"
334 334
 						LIMIT 1');
335 335
 
336
-                        if ($modx->getDatabase()->getRecordCount($sql)) {
336
+                        if ($modx->getDatabase()->getRecordCount($sql)) {
337 337
                             $row = $modx->getDatabase()->getRow($sql);
338 338
                             $contextmenu = array(
339 339
                                 'header' => array(
@@ -344,20 +344,20 @@  discard block
 block discarded – undo
344 344
                                     'url' => "index.php?a=78&id=" . $row['id']
345 345
                                 )
346 346
                             );
347
-                            if (!empty($row['description'])) {
347
+                            if (!empty($row['description'])) {
348 348
                                 $contextmenu['seperator'] = '';
349 349
                                 $contextmenu['description'] = array(
350 350
                                     'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
351 351
                                 );
352 352
                             }
353
-                        } else {
353
+                        } else {
354 354
 
355 355
                             $sql = $modx->getDatabase()->query('SELECT *
356 356
 							FROM ' . $modx->getDatabase()->getFullTableName('site_snippets') . '
357 357
 							WHERE name="' . $name . '"
358 358
 							LIMIT 1');
359 359
 
360
-                            if ($modx->getDatabase()->getRecordCount($sql)) {
360
+                            if ($modx->getDatabase()->getRecordCount($sql)) {
361 361
                                 $row = $modx->getDatabase()->getRow($sql);
362 362
                                 $contextmenu = array(
363 363
                                     'header' => array(
@@ -368,13 +368,13 @@  discard block
 block discarded – undo
368 368
                                         'url' => "index.php?a=22&id=" . $row['id']
369 369
                                     )
370 370
                                 );
371
-                                if (!empty($row['description'])) {
371
+                                if (!empty($row['description'])) {
372 372
                                     $contextmenu['seperator'] = '';
373 373
                                     $contextmenu['description'] = array(
374 374
                                         'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
375 375
                                     );
376 376
                                 }
377
-                            } else {
377
+                            } else {
378 378
                                 $contextmenu = array(
379 379
                                     'header' => array(
380 380
                                         'innerHTML' => '<i class="fa fa-code"></i> ' . $name
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
                             'alias_visible'
437 437
                         );
438 438
 
439
-                        if (in_array($name, $default_field)) {
439
+                        if (in_array($name, $default_field)) {
440 440
                             return;
441 441
                         }
442 442
 
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 						WHERE name="' . $name . '"
446 446
 						LIMIT 1');
447 447
 
448
-                        if ($modx->getDatabase()->getRecordCount($sql)) {
448
+                        if ($modx->getDatabase()->getRecordCount($sql)) {
449 449
                             $row = $modx->getDatabase()->getRow($sql);
450 450
                             $contextmenu = array(
451 451
                                 'header' => array(
@@ -456,13 +456,13 @@  discard block
 block discarded – undo
456 456
                                     'url' => "index.php?a=301&id=" . $row['id']
457 457
                                 )
458 458
                             );
459
-                            if (!empty($row['description'])) {
459
+                            if (!empty($row['description'])) {
460 460
                                 $contextmenu['seperator'] = '';
461 461
                                 $contextmenu['description'] = array(
462 462
                                     'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
463 463
                                 );
464 464
                             }
465
-                        } else {
465
+                        } else {
466 466
                             $contextmenu = array(
467 467
                                 'header' => array(
468 468
                                     'innerHTML' => '<i class="fa fa-list-alt"></i> ' . $name
@@ -487,13 +487,13 @@  discard block
 block discarded – undo
487 487
         case 'movedocument' : {
488 488
             $json = array();
489 489
 
490
-            if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) {
490
+            if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) {
491 491
                 $id = !empty($_REQUEST['id']) ? (int)$_REQUEST['id'] : '';
492 492
                 $parent = isset($_REQUEST['parent']) ? (int)$_REQUEST['parent'] : 0;
493 493
                 $menuindex = isset($_REQUEST['menuindex']) && is_scalar($_REQUEST['menuindex']) ? $_REQUEST['menuindex'] : 0;
494 494
 
495 495
                 // set parent
496
-                if ($id && $parent >= 0) {
496
+                if ($id && $parent >= 0) {
497 497
 
498 498
                     // find older parent
499 499
                     $parentOld = $modx->getDatabase()->getValue($modx->getDatabase()->select('parent', $modx->getDatabase()->getFullTableName('site_content'), 'id=' . $id));
@@ -504,31 +504,31 @@  discard block
 block discarded – undo
504 504
                         'new_parent'  => $parent,
505 505
                     ]);
506 506
 
507
-                    if (is_array($eventOut) && count($eventOut) > 0) {
507
+                    if (is_array($eventOut) && count($eventOut) > 0) {
508 508
                         $eventParent = array_pop($eventOut);
509 509
 
510
-                        if ($eventParent == $parentOld) {
510
+                        if ($eventParent == $parentOld) {
511 511
                             $json['errors'] = $_lang['error_movedocument2'];
512
-                        } else {
512
+                        } else {
513 513
                             $parent = $eventParent;
514 514
                         }
515 515
                     }
516 516
 
517
-                    if (empty($json['errors'])) {
517
+                    if (empty($json['errors'])) {
518 518
                         // check privileges user for move docs
519
-                        if (!empty($modx->config['tree_show_protected']) && $role != 1) {
519
+                        if (!empty($modx->config['tree_show_protected']) && $role != 1) {
520 520
                             $sql = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('document_groups'), 'document IN(' . $id . ',' . $parent . ',' . $parentOld . ')');
521
-                            if ($modx->getDatabase()->getRecordCount($sql)) {
521
+                            if ($modx->getDatabase()->getRecordCount($sql)) {
522 522
                                 $document_groups = array();
523
-                                while ($row = $modx->getDatabase()->getRow($sql)) {
523
+                                while ($row = $modx->getDatabase()->getRow($sql)) {
524 524
                                     $document_groups[$row['document']]['groups'][] = $row['document_group'];
525 525
                                 }
526
-                                foreach ($document_groups as $key => $value) {
527
-                                    if (($key == $parent || $key == $parentOld || $key == $id) && !in_array($role, $value['groups'])) {
526
+                                foreach ($document_groups as $key => $value) {
527
+                                    if (($key == $parent || $key == $parentOld || $key == $id) && !in_array($role, $value['groups'])) {
528 528
                                         $json['errors'] = $_lang["error_no_privileges"];
529 529
                                     }
530 530
                                 }
531
-                                if ($json['errors']) {
531
+                                if ($json['errors']) {
532 532
                                     header('content-type: application/json');
533 533
                                     echo json_encode($json, JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE);
534 534
                                     break;
@@ -536,9 +536,9 @@  discard block
 block discarded – undo
536 536
                             }
537 537
                         }
538 538
 
539
-                        if ($parent == 0 && $parent != $parentOld && !$modx->config['udperms_allowroot'] && $role != 1) {
539
+                        if ($parent == 0 && $parent != $parentOld && !$modx->config['udperms_allowroot'] && $role != 1) {
540 540
                             $json['errors'] = $_lang["error_no_privileges"];
541
-                        } else {
541
+                        } else {
542 542
                             // set new parent
543 543
                             $modx->getDatabase()->update(array(
544 544
                                 'parent' => $parent
@@ -548,13 +548,13 @@  discard block
 block discarded – undo
548 548
                                 'isfolder' => 1
549 549
                             ), $modx->getDatabase()->getFullTableName('site_content'), 'id=' . $parent);
550 550
 
551
-                            if ($parent != $parentOld) {
551
+                            if ($parent != $parentOld) {
552 552
                                 // check children docs and set parent isfolder
553
-                                if ($modx->getDatabase()->getRecordCount($modx->getDatabase()->select('id', $modx->getDatabase()->getFullTableName('site_content'), 'parent=' . $parentOld))) {
553
+                                if ($modx->getDatabase()->getRecordCount($modx->getDatabase()->select('id', $modx->getDatabase()->getFullTableName('site_content'), 'parent=' . $parentOld))) {
554 554
                                     $modx->getDatabase()->update(array(
555 555
                                         'isfolder' => 1
556 556
                                     ), $modx->getDatabase()->getFullTableName('site_content'), 'id=' . $parentOld);
557
-                                } else {
557
+                                } else {
558 558
                                     $modx->getDatabase()->update(array(
559 559
                                         'isfolder' => 0
560 560
                                     ), $modx->getDatabase()->getFullTableName('site_content'), 'id=' . $parentOld);
@@ -562,16 +562,16 @@  discard block
 block discarded – undo
562 562
                             }
563 563
 
564 564
                             // set menuindex
565
-                            if (!empty($menuindex)) {
565
+                            if (!empty($menuindex)) {
566 566
                                 $menuindex = explode(',', $menuindex);
567
-                                foreach ($menuindex as $key => $value) {
567
+                                foreach ($menuindex as $key => $value) {
568 568
                                     $modx->getDatabase()->query('UPDATE ' . $modx->getDatabase()->getFullTableName('site_content') . ' SET menuindex=' . $key . ' WHERE id=' . $value);
569 569
                                 }
570
-                            } else {
570
+                            } else {
571 571
                                 // TODO: max(*) menuindex
572 572
                             }
573 573
 
574
-                            if (!$json['errors']) {
574
+                            if (!$json['errors']) {
575 575
                                 $json['success'] = $_lang["actioncomplete"];
576 576
 
577 577
                                 $modx->invokeEvent('onAfterMoveDocument', [
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
                         }
584 584
                     }
585 585
                 }
586
-            } else {
586
+            } else {
587 587
                 $json['errors'] = $_lang["error_no_privileges"];
588 588
             }
589 589
 
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
 
600 600
             $output = !!$modx->elementIsLocked($type, $id, true);
601 601
 
602
-            if (!$output) {
602
+            if (!$output) {
603 603
                 $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : '';
604 604
                 $docgrp_cond = $docgrp ? ' OR dg.document_group IN (' . $docgrp . ')' : '';
605 605
                 $sql = '
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
                     LEFT JOIN ' . $modx->getDatabase()->getFullTableName('document_groups') . ' dg ON dg.document=sc.id
609 609
                     WHERE sc.id=' . $id . ' GROUP BY sc.id';
610 610
                 $sql = $modx->getDatabase()->query($sql);
611
-                if ($modx->getDatabase()->getRecordCount($sql)) {
611
+                if ($modx->getDatabase()->getRecordCount($sql)) {
612 612
                     $row = $modx->getDatabase()->getRow($sql);
613 613
                     $output = !!$row['locked'];
614 614
                 }
Please login to merge, or discard this patch.