Completed
Push — develop ( 053968...47dc8d )
by Maxim
12s
created
manager/actions/mutate_user.dynamic.php 4 patches
Braces   +42 added lines, -37 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->manager->action) {
6
+switch($modx->manager->action) {
7 7
 	case 12:
8
-		if(!$modx->hasPermission('edit_user')) {
8
+		if(!$modx->hasPermission('edit_user')) {
9 9
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
10 10
 		}
11 11
 		break;
12 12
 	case 11:
13
-		if(!$modx->hasPermission('new_user')) {
13
+		if(!$modx->hasPermission('new_user')) {
14 14
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
15 15
 		}
16 16
 		break;
@@ -22,16 +22,16 @@  discard block
 block discarded – undo
22 22
 
23 23
 // check to see the snippet editor isn't locked
24 24
 $rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=12 AND id='{$user}' AND internalKey!='" . $modx->getLoginUserID() . "'");
25
-if($username = $modx->db->getValue($rs)) {
25
+if($username = $modx->db->getValue($rs)) {
26 26
 	$modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "user"));
27 27
 }
28 28
 // end check for lock
29 29
 
30
-if($modx->manager->action == '12') {
30
+if($modx->manager->action == '12') {
31 31
 	// get user attribute
32 32
 	$rs = $modx->db->select('*', $modx->getFullTableName('user_attributes'), "internalKey = '{$user}'");
33 33
 	$userdata = $modx->db->getRow($rs);
34
-	if(!$userdata) {
34
+	if(!$userdata) {
35 35
 		$modx->webAlertAndQuit("No user returned!");
36 36
 	}
37 37
 
@@ -39,10 +39,12 @@  discard block
 block discarded – undo
39 39
 	// get user settings
40 40
 	$rs = $modx->db->select('*', $modx->getFullTableName('user_settings'), "user = '{$user}'");
41 41
 	$usersettings = array();
42
-	while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value'];
42
+	while($row = $modx->db->getRow($rs)) {
43
+	    $usersettings[$row['setting_name']] = $row['setting_value'];
44
+	}
43 45
 	// manually extract so that user display settings are not overwritten
44
-	foreach($usersettings as $k => $v) {
45
-		if($k != 'manager_language' && $k != 'manager_theme') {
46
+	foreach($usersettings as $k => $v) {
47
+		if($k != 'manager_language' && $k != 'manager_theme') {
46 48
 			${$k} = $v;
47 49
 		}
48 50
 	}
@@ -50,11 +52,11 @@  discard block
 block discarded – undo
50 52
 	// get user name
51 53
 	$rs = $modx->db->select('*', $modx->getFullTableName('manager_users'), "id = '{$user}'");
52 54
 	$usernamedata = $modx->db->getRow($rs);
53
-	if(!$usernamedata) {
55
+	if(!$usernamedata) {
54 56
 		$modx->webAlertAndQuit("No user returned while getting username!");
55 57
 	}
56 58
 	$_SESSION['itemname'] = $usernamedata['username'];
57
-} else {
59
+} else {
58 60
 	$userdata = array();
59 61
 	$usersettings = array();
60 62
 	$usernamedata = array();
@@ -62,14 +64,14 @@  discard block
 block discarded – undo
62 64
 }
63 65
 
64 66
 // avoid doubling htmlspecialchars (already encoded in DB)
65
-foreach($userdata as $key => $val) {
67
+foreach($userdata as $key => $val) {
66 68
 	$userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']);
67 69
 };
68 70
 $usernamedata['username'] = html_entity_decode($usernamedata['username'], ENT_NOQUOTES, $modx->config['modx_charset']);
69 71
 
70 72
 // restore saved form
71 73
 $formRestored = false;
72
-if($modx->manager->hasFormValues()) {
74
+if($modx->manager->hasFormValues()) {
73 75
 	$modx->manager->loadFormValues();
74 76
 	// restore post values
75 77
 	$userdata = array_merge($userdata, $_POST);
@@ -84,13 +86,13 @@  discard block
 block discarded – undo
84 86
 // include the country list language file
85 87
 $_country_lang = array();
86 88
 include_once "lang/country/english_country.inc.php";
87
-if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) {
89
+if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) {
88 90
 	include_once "lang/country/" . $manager_language . "_country.inc.php";
89 91
 }
90 92
 asort($_country_lang);
91 93
 
92 94
 $displayStyle = ($_SESSION['browser'] === 'modern') ? 'table-row' : 'block';
93
-if($which_browser == 'default') {
95
+if($which_browser == 'default') {
94 96
 	$which_browser = $modx->configGlobal['which_browser'] ? $modx->configGlobal['which_browser'] : $modx->config['which_browser'];
95 97
 }
96 98
 ?>
@@ -205,7 +207,7 @@  discard block
 block discarded – undo
205 207
 	$evtOut = $modx->invokeEvent("OnUserFormPrerender", array(
206 208
 		"id" => $user
207 209
 	));
208
-	if(is_array($evtOut)) {
210
+	if(is_array($evtOut)) {
209 211
 		echo implode("", $evtOut);
210 212
 	}
211 213
 	?>
@@ -305,10 +307,10 @@  discard block
 block discarded – undo
305 307
 							?>
306 308
 							<select name="role" class="inputBox" onChange='documentDirty=true;' style="width:300px">
307 309
 								<?php
308
-								while($row = $modx->db->getRow($rs)) {
309
-									if($modx->manager->action == '11') {
310
+								while($row = $modx->db->getRow($rs)) {
311
+									if($modx->manager->action == '11') {
310 312
 										$selectedtext = $row['id'] == '1' ? ' selected="selected"' : '';
311
-									} else {
313
+									} else {
312 314
 										$selectedtext = $row['id'] == $userdata['role'] ? "selected='selected'" : '';
313 315
 									}
314 316
 									?>
@@ -360,7 +362,7 @@  discard block
 block discarded – undo
360 362
 								<?php $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $userdata['country']; ?>
361 363
 								<option value="" <?php (!isset($chosenCountry) ? ' selected' : '') ?> >&nbsp;</option>
362 364
 								<?php
363
-								foreach($_country_lang as $key => $country) {
365
+								foreach($_country_lang as $key => $country) {
364 366
 									echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>";
365 367
 								}
366 368
 								?>
@@ -441,8 +443,8 @@  discard block
 block discarded – undo
441 443
 								<?php
442 444
 								$activelang = !empty($usersettings['manager_language']) ? $usersettings['manager_language'] : '';
443 445
 								$dir = dir("includes/lang");
444
-								while($file = $dir->read()) {
445
-									if(strpos($file, ".inc.php") > 0) {
446
+								while($file = $dir->read()) {
447
+									if(strpos($file, ".inc.php") > 0) {
446 448
 										$endpos = strpos($file, ".");
447 449
 										$languagename = substr($file, 0, $endpos);
448 450
 										$selectedtext = $languagename == $activelang ? "selected='selected'" : "";
@@ -529,14 +531,14 @@  discard block
 block discarded – undo
529 531
 								<option value=""></option>
530 532
 								<?php
531 533
 								$dir = dir("media/style/");
532
-								while($file = $dir->read()) {
533
-									if($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') {
534
+								while($file = $dir->read()) {
535
+									if($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') {
534 536
 										$themename = $file;
535
-										if($themename === 'common') {
537
+										if($themename === 'common') {
536 538
 											continue;
537 539
 										}
538 540
 										$attr = 'value="' . $themename . '" ';
539
-										if(isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) {
541
+										if(isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) {
540 542
 											$attr .= 'selected="selected" ';
541 543
 										}
542 544
 										echo "\t\t<option " . rtrim($attr) . '>' . ucwords(str_replace("_", " ", $themename)) . "</option>\n";
@@ -557,7 +559,7 @@  discard block
 block discarded – undo
557 559
 								<?php
558 560
 								$selected = 'default' == $usersettings['which_browser'] || !$usersettings['which_browser'] ? ' selected="selected"' : '';
559 561
 								echo '<option value="default"' . $selected . '>' . $_lang['option_default'] . "</option>\n";
560
-								foreach(glob("media/browser/*", GLOB_ONLYDIR) as $dir) {
562
+								foreach(glob("media/browser/*", GLOB_ONLYDIR) as $dir) {
561 563
 									$dir = str_replace('\\', '/', $dir);
562 564
 									$browser_name = substr($dir, strrpos($dir, '/') + 1);
563 565
 									$selected = $browser_name == $usersettings['which_browser'] ? ' selected="selected"' : '';
@@ -644,8 +646,8 @@  discard block
 block discarded – undo
644 646
 								// invoke OnRichTextEditorRegister event
645 647
 								$evtOut = $modx->invokeEvent("OnRichTextEditorRegister");
646 648
 								echo "<option value='none'" . ($edt == 'none' ? " selected='selected'" : "") . ">" . $_lang["none"] . "</option>\n";
647
-								if(is_array($evtOut)) {
648
-									for($i = 0; $i < count($evtOut); $i++) {
649
+								if(is_array($evtOut)) {
650
+									for($i = 0; $i < count($evtOut); $i++) {
649 651
 										$editor = $evtOut[$i];
650 652
 										echo "<option value='$editor'" . ($edt == $editor ? " selected='selected'" : "") . ">$editor</option>\n";
651 653
 									}
@@ -685,7 +687,7 @@  discard block
 block discarded – undo
685 687
 				<?php
686 688
 				// invoke OnInterfaceSettingsRender event
687 689
 				$evtOut = $modx->invokeEvent("OnInterfaceSettingsRender");
688
-				if(is_array($evtOut)) {
690
+				if(is_array($evtOut)) {
689 691
 					echo implode("", $evtOut);
690 692
 				}
691 693
 				?>
@@ -735,17 +737,20 @@  discard block
 block discarded – undo
735 737
 					</tr>
736 738
 				</table>
737 739
 			</div>
738
-			<?php if($use_udperms == 1) {
740
+			<?php if($use_udperms == 1) {
739 741
 
740 742
 			$groupsarray = array();
741 743
 
742
-			if($modx->manager->action == '12') { // only do this bit if the user is being edited
744
+			if($modx->manager->action == '12') {
745
+// only do this bit if the user is being edited
743 746
 				$rs = $modx->db->select('user_group', $modx->getFullTableName('member_groups'), "member='{$user}'");
744 747
 				$groupsarray = $modx->db->getColumn('user_group', $rs);
745 748
 			}
746 749
 			// retain selected doc groups between post
747
-			if(is_array($_POST['user_groups'])) {
748
-				foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v;
750
+			if(is_array($_POST['user_groups'])) {
751
+				foreach($_POST['user_groups'] as $n => $v) {
752
+				    $groupsarray[] = $v;
753
+				}
749 754
 			}
750 755
 			?>
751 756
 			<div class="tab-page" id="tabAccess">
@@ -754,7 +759,7 @@  discard block
 block discarded – undo
754 759
 				<p><?php echo $_lang['access_permissions_user_message'] ?></p>
755 760
 				<?php
756 761
 				$rs = $modx->db->select('name, id', $modx->getFullTableName('membergroup_names'), '', 'name');
757
-				while($row = $modx->db->getRow($rs)) {
762
+				while($row = $modx->db->getRow($rs)) {
758 763
 					echo "<label><input type='checkbox' name='user_groups[]' value='" . $row['id'] . "'" . (in_array($row['id'], $groupsarray) ? " checked='checked'" : "") . " />" . $row['name'] . "</label><br />";
759 764
 				}
760 765
 				}
@@ -768,7 +773,7 @@  discard block
 block discarded – undo
768 773
 	$evtOut = $modx->invokeEvent("OnUserFormRender", array(
769 774
 		"id" => $user
770 775
 	));
771
-	if(is_array($evtOut)) {
776
+	if(is_array($evtOut)) {
772 777
 		echo implode("", $evtOut);
773 778
 	}
774 779
 	?>
Please login to merge, or discard this patch.
Indentation   +158 added lines, -158 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@  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
 switch($modx->manager->action) {
7
-	case 12:
8
-		if(!$modx->hasPermission('edit_user')) {
9
-			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
10
-		}
11
-		break;
12
-	case 11:
13
-		if(!$modx->hasPermission('new_user')) {
14
-			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
15
-		}
16
-		break;
17
-	default:
18
-		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7
+    case 12:
8
+        if(!$modx->hasPermission('edit_user')) {
9
+            $modx->webAlertAndQuit($_lang["error_no_privileges"]);
10
+        }
11
+        break;
12
+    case 11:
13
+        if(!$modx->hasPermission('new_user')) {
14
+            $modx->webAlertAndQuit($_lang["error_no_privileges"]);
15
+        }
16
+        break;
17
+    default:
18
+        $modx->webAlertAndQuit($_lang["error_no_privileges"]);
19 19
 }
20 20
 
21 21
 $user = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
@@ -23,75 +23,75 @@  discard block
 block discarded – undo
23 23
 // check to see the snippet editor isn't locked
24 24
 $rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=12 AND id='{$user}' AND internalKey!='" . $modx->getLoginUserID() . "'");
25 25
 if($username = $modx->db->getValue($rs)) {
26
-	$modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "user"));
26
+    $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "user"));
27 27
 }
28 28
 // end check for lock
29 29
 
30 30
 if($modx->manager->action == '12') {
31
-	// get user attribute
32
-	$rs = $modx->db->select('*', $modx->getFullTableName('user_attributes'), "internalKey = '{$user}'");
33
-	$userdata = $modx->db->getRow($rs);
34
-	if(!$userdata) {
35
-		$modx->webAlertAndQuit("No user returned!");
36
-	}
37
-
38
-
39
-	// get user settings
40
-	$rs = $modx->db->select('*', $modx->getFullTableName('user_settings'), "user = '{$user}'");
41
-	$usersettings = array();
42
-	while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value'];
43
-	// manually extract so that user display settings are not overwritten
44
-	foreach($usersettings as $k => $v) {
45
-		if($k != 'manager_language' && $k != 'manager_theme') {
46
-			${$k} = $v;
47
-		}
48
-	}
49
-
50
-	// get user name
51
-	$rs = $modx->db->select('*', $modx->getFullTableName('manager_users'), "id = '{$user}'");
52
-	$usernamedata = $modx->db->getRow($rs);
53
-	if(!$usernamedata) {
54
-		$modx->webAlertAndQuit("No user returned while getting username!");
55
-	}
56
-	$_SESSION['itemname'] = $usernamedata['username'];
31
+    // get user attribute
32
+    $rs = $modx->db->select('*', $modx->getFullTableName('user_attributes'), "internalKey = '{$user}'");
33
+    $userdata = $modx->db->getRow($rs);
34
+    if(!$userdata) {
35
+        $modx->webAlertAndQuit("No user returned!");
36
+    }
37
+
38
+
39
+    // get user settings
40
+    $rs = $modx->db->select('*', $modx->getFullTableName('user_settings'), "user = '{$user}'");
41
+    $usersettings = array();
42
+    while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value'];
43
+    // manually extract so that user display settings are not overwritten
44
+    foreach($usersettings as $k => $v) {
45
+        if($k != 'manager_language' && $k != 'manager_theme') {
46
+            ${$k} = $v;
47
+        }
48
+    }
49
+
50
+    // get user name
51
+    $rs = $modx->db->select('*', $modx->getFullTableName('manager_users'), "id = '{$user}'");
52
+    $usernamedata = $modx->db->getRow($rs);
53
+    if(!$usernamedata) {
54
+        $modx->webAlertAndQuit("No user returned while getting username!");
55
+    }
56
+    $_SESSION['itemname'] = $usernamedata['username'];
57 57
 } else {
58
-	$userdata = array();
59
-	$usersettings = array();
60
-	$usernamedata = array();
61
-	$_SESSION['itemname'] = $_lang["new_user"];
58
+    $userdata = array();
59
+    $usersettings = array();
60
+    $usernamedata = array();
61
+    $_SESSION['itemname'] = $_lang["new_user"];
62 62
 }
63 63
 
64 64
 // avoid doubling htmlspecialchars (already encoded in DB)
65 65
 foreach($userdata as $key => $val) {
66
-	$userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']);
66
+    $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']);
67 67
 };
68 68
 $usernamedata['username'] = html_entity_decode($usernamedata['username'], ENT_NOQUOTES, $modx->config['modx_charset']);
69 69
 
70 70
 // restore saved form
71 71
 $formRestored = false;
72 72
 if($modx->manager->hasFormValues()) {
73
-	$modx->manager->loadFormValues();
74
-	// restore post values
75
-	$userdata = array_merge($userdata, $_POST);
76
-	$userdata['dob'] = $modx->toTimeStamp($userdata['dob']);
77
-	$usernamedata['username'] = $userdata['newusername'];
78
-	$usernamedata['oldusername'] = $_POST['oldusername'];
79
-	$usersettings = array_merge($usersettings, $userdata);
80
-	$usersettings['allowed_days'] = is_array($_POST['allowed_days']) ? implode(",", $_POST['allowed_days']) : "";
81
-	extract($usersettings, EXTR_OVERWRITE);
73
+    $modx->manager->loadFormValues();
74
+    // restore post values
75
+    $userdata = array_merge($userdata, $_POST);
76
+    $userdata['dob'] = $modx->toTimeStamp($userdata['dob']);
77
+    $usernamedata['username'] = $userdata['newusername'];
78
+    $usernamedata['oldusername'] = $_POST['oldusername'];
79
+    $usersettings = array_merge($usersettings, $userdata);
80
+    $usersettings['allowed_days'] = is_array($_POST['allowed_days']) ? implode(",", $_POST['allowed_days']) : "";
81
+    extract($usersettings, EXTR_OVERWRITE);
82 82
 }
83 83
 
84 84
 // include the country list language file
85 85
 $_country_lang = array();
86 86
 include_once "lang/country/english_country.inc.php";
87 87
 if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) {
88
-	include_once "lang/country/" . $manager_language . "_country.inc.php";
88
+    include_once "lang/country/" . $manager_language . "_country.inc.php";
89 89
 }
90 90
 asort($_country_lang);
91 91
 
92 92
 $displayStyle = ($_SESSION['browser'] === 'modern') ? 'table-row' : 'block';
93 93
 if($which_browser == 'default') {
94
-	$which_browser = $modx->configGlobal['which_browser'] ? $modx->configGlobal['which_browser'] : $modx->config['which_browser'];
94
+    $which_browser = $modx->configGlobal['which_browser'] ? $modx->configGlobal['which_browser'] : $modx->config['which_browser'];
95 95
 }
96 96
 ?>
97 97
 <script type="text/javascript">
@@ -201,14 +201,14 @@  discard block
 block discarded – undo
201 201
 <form action="index.php?a=32" method="post" name="userform">
202 202
 	<?php
203 203
 
204
-	// invoke OnUserFormPrerender event
205
-	$evtOut = $modx->invokeEvent("OnUserFormPrerender", array(
206
-		"id" => $user
207
-	));
208
-	if(is_array($evtOut)) {
209
-		echo implode("", $evtOut);
210
-	}
211
-	?>
204
+    // invoke OnUserFormPrerender event
205
+    $evtOut = $modx->invokeEvent("OnUserFormPrerender", array(
206
+        "id" => $user
207
+    ));
208
+    if(is_array($evtOut)) {
209
+        echo implode("", $evtOut);
210
+    }
211
+    ?>
212 212
 	<input type="hidden" name="mode" value="<?php echo $modx->manager->action; ?>">
213 213
 	<input type="hidden" name="id" value="<?php echo $user ?>">
214 214
 	<input type="hidden" name="blockedmode" value="<?php echo ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || ($userdata['blockedafter'] < time() && $userdata['blockedafter'] != 0) || $userdata['failedlogins'] > 3) ? "1" : "0" ?>" />
@@ -301,21 +301,21 @@  discard block
 block discarded – undo
301 301
 						<td>&nbsp;</td>
302 302
 						<td><?php
303 303
 
304
-							$rs = $modx->db->select('name, id', '[+prefix+]user_roles', ($modx->hasPermission('save_role')) ? '' : 'id != 1');
305
-							?>
304
+                            $rs = $modx->db->select('name, id', '[+prefix+]user_roles', ($modx->hasPermission('save_role')) ? '' : 'id != 1');
305
+                            ?>
306 306
 							<select name="role" class="inputBox" onChange='documentDirty=true;' style="width:300px">
307 307
 								<?php
308
-								while($row = $modx->db->getRow($rs)) {
309
-									if($modx->manager->action == '11') {
310
-										$selectedtext = $row['id'] == '1' ? ' selected="selected"' : '';
311
-									} else {
312
-										$selectedtext = $row['id'] == $userdata['role'] ? "selected='selected'" : '';
313
-									}
314
-									?>
308
+                                while($row = $modx->db->getRow($rs)) {
309
+                                    if($modx->manager->action == '11') {
310
+                                        $selectedtext = $row['id'] == '1' ? ' selected="selected"' : '';
311
+                                    } else {
312
+                                        $selectedtext = $row['id'] == $userdata['role'] ? "selected='selected'" : '';
313
+                                    }
314
+                                    ?>
315 315
 									<option value="<?php echo $row['id']; ?>"<?php echo $selectedtext; ?>><?php echo $row['name']; ?></option>
316 316
 									<?php
317
-								}
318
-								?>
317
+                                }
318
+                                ?>
319 319
 							</select></td>
320 320
 					</tr>
321 321
 					<tr>
@@ -360,10 +360,10 @@  discard block
 block discarded – undo
360 360
 								<?php $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $userdata['country']; ?>
361 361
 								<option value="" <?php (!isset($chosenCountry) ? ' selected' : '') ?> >&nbsp;</option>
362 362
 								<?php
363
-								foreach($_country_lang as $key => $country) {
364
-									echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>";
365
-								}
366
-								?>
363
+                                foreach($_country_lang as $key => $country) {
364
+                                    echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>";
365
+                                }
366
+                                ?>
367 367
 							</select></td>
368 368
 					</tr>
369 369
 					<tr>
@@ -439,21 +439,21 @@  discard block
 block discarded – undo
439 439
 						<td><select name="manager_language" class="inputBox" onChange="documentDirty=true">
440 440
 								<option value=""></option>
441 441
 								<?php
442
-								$activelang = !empty($usersettings['manager_language']) ? $usersettings['manager_language'] : '';
443
-								$dir = dir("includes/lang");
444
-								while($file = $dir->read()) {
445
-									if(strpos($file, ".inc.php") > 0) {
446
-										$endpos = strpos($file, ".");
447
-										$languagename = substr($file, 0, $endpos);
448
-										$selectedtext = $languagename == $activelang ? "selected='selected'" : "";
449
-										?>
442
+                                $activelang = !empty($usersettings['manager_language']) ? $usersettings['manager_language'] : '';
443
+                                $dir = dir("includes/lang");
444
+                                while($file = $dir->read()) {
445
+                                    if(strpos($file, ".inc.php") > 0) {
446
+                                        $endpos = strpos($file, ".");
447
+                                        $languagename = substr($file, 0, $endpos);
448
+                                        $selectedtext = $languagename == $activelang ? "selected='selected'" : "";
449
+                                        ?>
450 450
 										<option value="<?php echo $languagename; ?>" <?php echo $selectedtext; ?>><?php echo ucwords(str_replace("_", " ", $languagename)); ?></option>
451 451
 										<?php
452 452
 
453
-									}
454
-								}
455
-								$dir->close();
456
-								?>
453
+                                    }
454
+                                }
455
+                                $dir->close();
456
+                                ?>
457 457
 							</select></td>
458 458
 					</tr>
459 459
 					<tr>
@@ -528,22 +528,22 @@  discard block
 block discarded – undo
528 528
 						<td><select name="manager_theme" class="inputBox" onChange="documentDirty=true;document.userform.theme_refresher.value = Date.parse(new Date());">
529 529
 								<option value=""></option>
530 530
 								<?php
531
-								$dir = dir("media/style/");
532
-								while($file = $dir->read()) {
533
-									if($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') {
534
-										$themename = $file;
535
-										if($themename === 'common') {
536
-											continue;
537
-										}
538
-										$attr = 'value="' . $themename . '" ';
539
-										if(isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) {
540
-											$attr .= 'selected="selected" ';
541
-										}
542
-										echo "\t\t<option " . rtrim($attr) . '>' . ucwords(str_replace("_", " ", $themename)) . "</option>\n";
543
-									}
544
-								}
545
-								$dir->close();
546
-								?>
531
+                                $dir = dir("media/style/");
532
+                                while($file = $dir->read()) {
533
+                                    if($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') {
534
+                                        $themename = $file;
535
+                                        if($themename === 'common') {
536
+                                            continue;
537
+                                        }
538
+                                        $attr = 'value="' . $themename . '" ';
539
+                                        if(isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) {
540
+                                            $attr .= 'selected="selected" ';
541
+                                        }
542
+                                        echo "\t\t<option " . rtrim($attr) . '>' . ucwords(str_replace("_", " ", $themename)) . "</option>\n";
543
+                                    }
544
+                                }
545
+                                $dir->close();
546
+                                ?>
547 547
 							</select>
548 548
 							<input type="hidden" name="theme_refresher" value=""></td>
549 549
 					</tr>
@@ -555,15 +555,15 @@  discard block
 block discarded – undo
555 555
 						<th><?php echo $_lang["which_browser_title"] ?></th>
556 556
 						<td><select name="which_browser" class="inputBox" onChange="documentDirty=true;">
557 557
 								<?php
558
-								$selected = 'default' == $usersettings['which_browser'] || !$usersettings['which_browser'] ? ' selected="selected"' : '';
559
-								echo '<option value="default"' . $selected . '>' . $_lang['option_default'] . "</option>\n";
560
-								foreach(glob("media/browser/*", GLOB_ONLYDIR) as $dir) {
561
-									$dir = str_replace('\\', '/', $dir);
562
-									$browser_name = substr($dir, strrpos($dir, '/') + 1);
563
-									$selected = $browser_name == $usersettings['which_browser'] ? ' selected="selected"' : '';
564
-									echo '<option value="' . $browser_name . '"' . $selected . '>' . "{$browser_name}</option>\n";
565
-								}
566
-								?>
558
+                                $selected = 'default' == $usersettings['which_browser'] || !$usersettings['which_browser'] ? ' selected="selected"' : '';
559
+                                echo '<option value="default"' . $selected . '>' . $_lang['option_default'] . "</option>\n";
560
+                                foreach(glob("media/browser/*", GLOB_ONLYDIR) as $dir) {
561
+                                    $dir = str_replace('\\', '/', $dir);
562
+                                    $browser_name = substr($dir, strrpos($dir, '/') + 1);
563
+                                    $selected = $browser_name == $usersettings['which_browser'] ? ' selected="selected"' : '';
564
+                                    echo '<option value="' . $browser_name . '"' . $selected . '>' . "{$browser_name}</option>\n";
565
+                                }
566
+                                ?>
567 567
 							</select></td>
568 568
 					</tr>
569 569
 					<tr>
@@ -640,17 +640,17 @@  discard block
 block discarded – undo
640 640
 								<option value=""></option>
641 641
 								<?php
642 642
 
643
-								$edt = isset ($usersettings["which_editor"]) ? $usersettings["which_editor"] : '';
644
-								// invoke OnRichTextEditorRegister event
645
-								$evtOut = $modx->invokeEvent("OnRichTextEditorRegister");
646
-								echo "<option value='none'" . ($edt == 'none' ? " selected='selected'" : "") . ">" . $_lang["none"] . "</option>\n";
647
-								if(is_array($evtOut)) {
648
-									for($i = 0; $i < count($evtOut); $i++) {
649
-										$editor = $evtOut[$i];
650
-										echo "<option value='$editor'" . ($edt == $editor ? " selected='selected'" : "") . ">$editor</option>\n";
651
-									}
652
-								}
653
-								?>
643
+                                $edt = isset ($usersettings["which_editor"]) ? $usersettings["which_editor"] : '';
644
+                                // invoke OnRichTextEditorRegister event
645
+                                $evtOut = $modx->invokeEvent("OnRichTextEditorRegister");
646
+                                echo "<option value='none'" . ($edt == 'none' ? " selected='selected'" : "") . ">" . $_lang["none"] . "</option>\n";
647
+                                if(is_array($evtOut)) {
648
+                                    for($i = 0; $i < count($evtOut); $i++) {
649
+                                        $editor = $evtOut[$i];
650
+                                        echo "<option value='$editor'" . ($edt == $editor ? " selected='selected'" : "") . ">$editor</option>\n";
651
+                                    }
652
+                                }
653
+                                ?>
654 654
 							</select></td>
655 655
 					</tr>
656 656
 					<tr id='editorRow1' style="display: <?php echo $use_editor == 1 ? $displayStyle : 'none'; ?>">
@@ -683,12 +683,12 @@  discard block
 block discarded – undo
683 683
 					</tr>
684 684
 				</table>
685 685
 				<?php
686
-				// invoke OnInterfaceSettingsRender event
687
-				$evtOut = $modx->invokeEvent("OnInterfaceSettingsRender");
688
-				if(is_array($evtOut)) {
689
-					echo implode("", $evtOut);
690
-				}
691
-				?>
686
+                // invoke OnInterfaceSettingsRender event
687
+                $evtOut = $modx->invokeEvent("OnInterfaceSettingsRender");
688
+                if(is_array($evtOut)) {
689
+                    echo implode("", $evtOut);
690
+                }
691
+                ?>
692 692
 			</div>
693 693
 
694 694
 			<!-- Photo -->
@@ -737,39 +737,39 @@  discard block
 block discarded – undo
737 737
 			</div>
738 738
 			<?php if($use_udperms == 1) {
739 739
 
740
-			$groupsarray = array();
741
-
742
-			if($modx->manager->action == '12') { // only do this bit if the user is being edited
743
-				$rs = $modx->db->select('user_group', $modx->getFullTableName('member_groups'), "member='{$user}'");
744
-				$groupsarray = $modx->db->getColumn('user_group', $rs);
745
-			}
746
-			// retain selected doc groups between post
747
-			if(is_array($_POST['user_groups'])) {
748
-				foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v;
749
-			}
750
-			?>
740
+            $groupsarray = array();
741
+
742
+            if($modx->manager->action == '12') { // only do this bit if the user is being edited
743
+                $rs = $modx->db->select('user_group', $modx->getFullTableName('member_groups'), "member='{$user}'");
744
+                $groupsarray = $modx->db->getColumn('user_group', $rs);
745
+            }
746
+            // retain selected doc groups between post
747
+            if(is_array($_POST['user_groups'])) {
748
+                foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v;
749
+            }
750
+            ?>
751 751
 			<div class="tab-page" id="tabAccess">
752 752
 				<h2 class="tab"><?php echo $_lang["access_permissions"] ?></h2>
753 753
 				<script type="text/javascript">tpUser.addTabPage(document.getElementById("tabAccess"));</script>
754 754
 				<p><?php echo $_lang['access_permissions_user_message'] ?></p>
755 755
 				<?php
756
-				$rs = $modx->db->select('name, id', $modx->getFullTableName('membergroup_names'), '', 'name');
757
-				while($row = $modx->db->getRow($rs)) {
758
-					echo "<label><input type='checkbox' name='user_groups[]' value='" . $row['id'] . "'" . (in_array($row['id'], $groupsarray) ? " checked='checked'" : "") . " />" . $row['name'] . "</label><br />";
759
-				}
760
-				}
761
-				?>
756
+                $rs = $modx->db->select('name, id', $modx->getFullTableName('membergroup_names'), '', 'name');
757
+                while($row = $modx->db->getRow($rs)) {
758
+                    echo "<label><input type='checkbox' name='user_groups[]' value='" . $row['id'] . "'" . (in_array($row['id'], $groupsarray) ? " checked='checked'" : "") . " />" . $row['name'] . "</label><br />";
759
+                }
760
+                }
761
+                ?>
762 762
 			</div>
763 763
 		</div>
764 764
 	</div>
765 765
 	<input type="submit" name="save" style="display:none">
766 766
 	<?php
767
-	// invoke OnUserFormRender event
768
-	$evtOut = $modx->invokeEvent("OnUserFormRender", array(
769
-		"id" => $user
770
-	));
771
-	if(is_array($evtOut)) {
772
-		echo implode("", $evtOut);
773
-	}
774
-	?>
767
+    // invoke OnUserFormRender event
768
+    $evtOut = $modx->invokeEvent("OnUserFormRender", array(
769
+        "id" => $user
770
+    ));
771
+    if(is_array($evtOut)) {
772
+        echo implode("", $evtOut);
773
+    }
774
+    ?>
775 775
 </form>
Please login to merge, or discard this patch.
Switch Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -4,18 +4,18 @@
 block discarded – undo
4 4
 }
5 5
 
6 6
 switch($modx->manager->action) {
7
-	case 12:
8
-		if(!$modx->hasPermission('edit_user')) {
9
-			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
10
-		}
11
-		break;
12
-	case 11:
13
-		if(!$modx->hasPermission('new_user')) {
14
-			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
15
-		}
16
-		break;
17
-	default:
18
-		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7
+	    case 12:
8
+		    if(!$modx->hasPermission('edit_user')) {
9
+			    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
10
+		    }
11
+		    break;
12
+	    case 11:
13
+		    if(!$modx->hasPermission('new_user')) {
14
+			    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
15
+		    }
16
+		    break;
17
+	    default:
18
+		    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
19 19
 }
20 20
 
21 21
 $user = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
Please login to merge, or discard this patch.
Spacing   +58 added lines, -58 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->manager->action) {
6
+switch ($modx->manager->action) {
7 7
 	case 12:
8
-		if(!$modx->hasPermission('edit_user')) {
8
+		if (!$modx->hasPermission('edit_user')) {
9 9
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
10 10
 		}
11 11
 		break;
12 12
 	case 11:
13
-		if(!$modx->hasPermission('new_user')) {
13
+		if (!$modx->hasPermission('new_user')) {
14 14
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
15 15
 		}
16 16
 		break;
@@ -18,20 +18,20 @@  discard block
 block discarded – undo
18 18
 		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
19 19
 }
20 20
 
21
-$user = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
21
+$user = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
22 22
 
23 23
 // check to see the snippet editor isn't locked
24
-$rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=12 AND id='{$user}' AND internalKey!='" . $modx->getLoginUserID() . "'");
25
-if($username = $modx->db->getValue($rs)) {
24
+$rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=12 AND id='{$user}' AND internalKey!='".$modx->getLoginUserID()."'");
25
+if ($username = $modx->db->getValue($rs)) {
26 26
 	$modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "user"));
27 27
 }
28 28
 // end check for lock
29 29
 
30
-if($modx->manager->action == '12') {
30
+if ($modx->manager->action == '12') {
31 31
 	// get user attribute
32 32
 	$rs = $modx->db->select('*', $modx->getFullTableName('user_attributes'), "internalKey = '{$user}'");
33 33
 	$userdata = $modx->db->getRow($rs);
34
-	if(!$userdata) {
34
+	if (!$userdata) {
35 35
 		$modx->webAlertAndQuit("No user returned!");
36 36
 	}
37 37
 
@@ -39,10 +39,10 @@  discard block
 block discarded – undo
39 39
 	// get user settings
40 40
 	$rs = $modx->db->select('*', $modx->getFullTableName('user_settings'), "user = '{$user}'");
41 41
 	$usersettings = array();
42
-	while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value'];
42
+	while ($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value'];
43 43
 	// manually extract so that user display settings are not overwritten
44
-	foreach($usersettings as $k => $v) {
45
-		if($k != 'manager_language' && $k != 'manager_theme') {
44
+	foreach ($usersettings as $k => $v) {
45
+		if ($k != 'manager_language' && $k != 'manager_theme') {
46 46
 			${$k} = $v;
47 47
 		}
48 48
 	}
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	// get user name
51 51
 	$rs = $modx->db->select('*', $modx->getFullTableName('manager_users'), "id = '{$user}'");
52 52
 	$usernamedata = $modx->db->getRow($rs);
53
-	if(!$usernamedata) {
53
+	if (!$usernamedata) {
54 54
 		$modx->webAlertAndQuit("No user returned while getting username!");
55 55
 	}
56 56
 	$_SESSION['itemname'] = $usernamedata['username'];
@@ -62,14 +62,14 @@  discard block
 block discarded – undo
62 62
 }
63 63
 
64 64
 // avoid doubling htmlspecialchars (already encoded in DB)
65
-foreach($userdata as $key => $val) {
65
+foreach ($userdata as $key => $val) {
66 66
 	$userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']);
67 67
 };
68 68
 $usernamedata['username'] = html_entity_decode($usernamedata['username'], ENT_NOQUOTES, $modx->config['modx_charset']);
69 69
 
70 70
 // restore saved form
71 71
 $formRestored = false;
72
-if($modx->manager->hasFormValues()) {
72
+if ($modx->manager->hasFormValues()) {
73 73
 	$modx->manager->loadFormValues();
74 74
 	// restore post values
75 75
 	$userdata = array_merge($userdata, $_POST);
@@ -84,13 +84,13 @@  discard block
 block discarded – undo
84 84
 // include the country list language file
85 85
 $_country_lang = array();
86 86
 include_once "lang/country/english_country.inc.php";
87
-if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) {
88
-	include_once "lang/country/" . $manager_language . "_country.inc.php";
87
+if ($manager_language != "english" && file_exists($modx->config['site_manager_path']."includes/lang/country/".$manager_language."_country.inc.php")) {
88
+	include_once "lang/country/".$manager_language."_country.inc.php";
89 89
 }
90 90
 asort($_country_lang);
91 91
 
92 92
 $displayStyle = ($_SESSION['browser'] === 'modern') ? 'table-row' : 'block';
93
-if($which_browser == 'default') {
93
+if ($which_browser == 'default') {
94 94
 	$which_browser = $modx->configGlobal['which_browser'] ? $modx->configGlobal['which_browser'] : $modx->config['which_browser'];
95 95
 }
96 96
 ?>
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 			document.userform.save.click();
183 183
 		},
184 184
 		delete: function() {
185
-			<?php if($_GET['id'] == $modx->getLoginUserID()) { ?>
185
+			<?php if ($_GET['id'] == $modx->getLoginUserID()) { ?>
186 186
 			alert("<?php echo $_lang['alert_delete_self']; ?>");
187 187
 			<?php } else { ?>
188 188
 			if(confirm("<?php echo $_lang['confirm_delete_user']; ?>") === true) {
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 	$evtOut = $modx->invokeEvent("OnUserFormPrerender", array(
206 206
 		"id" => $user
207 207
 	));
208
-	if(is_array($evtOut)) {
208
+	if (is_array($evtOut)) {
209 209
 		echo implode("", $evtOut);
210 210
 	}
211 211
 	?>
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	<input type="hidden" name="blockedmode" value="<?php echo ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || ($userdata['blockedafter'] < time() && $userdata['blockedafter'] != 0) || $userdata['failedlogins'] > 3) ? "1" : "0" ?>" />
215 215
 
216 216
 	<h1>
217
-        <i class="fa fa fa-user"></i><?= ($usernamedata['username'] ? $usernamedata['username'] . '<small>(' . $usernamedata['id'] . ')</small>' : $_lang['user_title']) ?>
217
+        <i class="fa fa fa-user"></i><?= ($usernamedata['username'] ? $usernamedata['username'].'<small>('.$usernamedata['id'].')</small>' : $_lang['user_title']) ?>
218 218
     </h1>
219 219
 
220 220
 	<?php echo $_style['actionbuttons']['dynamic']['user'] ?>
@@ -232,13 +232,13 @@  discard block
 block discarded – undo
232 232
 				<table border="0" cellspacing="0" cellpadding="3" class="table table--edit table--editUser">
233 233
 					<tr>
234 234
 						<td colspan="3"><span id="blocked" class="warning">
235
-							<?php if($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || $userdata['failedlogins'] > 3) { ?>
235
+							<?php if ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || $userdata['failedlogins'] > 3) { ?>
236 236
 								<?php echo $_lang['user_is_blocked']; ?>
237 237
 							<?php } ?>
238 238
 							</span>
239 239
 							<br /></td>
240 240
 					</tr>
241
-					<?php if(!empty($userdata['id'])) { ?>
241
+					<?php if (!empty($userdata['id'])) { ?>
242 242
 						<tr id="showname" style="display: <?php echo ($modx->manager->action == '12' && (!isset($usernamedata['oldusername']) || $usernamedata['oldusername'] == $usernamedata['username'])) ? $displayStyle : 'none'; ?> ">
243 243
 							<td colspan="3"><i class="<?php echo $_style["icons_user"] ?>"></i>&nbsp;<b><?php echo $modx->htmlspecialchars(!empty($usernamedata['oldusername']) ? $usernamedata['oldusername'] : $usernamedata['username']); ?></b> - <span class="comment"><a href="javascript:;" onClick="changeName();return false;"><?php echo $_lang["change_name"]; ?></a></span>
244 244
 								<input type="hidden" name="oldusername" value="<?php echo $modx->htmlspecialchars(!empty($usernamedata['oldusername']) ? $usernamedata['oldusername'] : $usernamedata['username']); ?>" />
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 						<td><input type="text" name="newusername" class="inputBox" value="<?php echo $modx->htmlspecialchars($usernamedata['username']); ?>" onChange='documentDirty=true;' maxlength="100" /></td>
252 252
 					</tr>
253 253
 					<tr>
254
-						<th><?php echo $modx->manager->action == '11' ? $_lang['password'] . ":" : $_lang['change_password_new'] . ":"; ?></th>
254
+						<th><?php echo $modx->manager->action == '11' ? $_lang['password'].":" : $_lang['change_password_new'].":"; ?></th>
255 255
 						<td>&nbsp;</td>
256 256
 						<td><input name="newpasswordcheck" type="checkbox" onClick="changestate(document.userform.newpassword);changePasswordState(document.userform.newpassword);"<?php echo $modx->manager->action == "11" ? " checked disabled" : ""; ?>>
257 257
 							<input type="hidden" name="newpassword" value="<?php echo $modx->manager->action == "11" ? 1 : 0; ?>" onChange="documentDirty=true;" />
@@ -305,8 +305,8 @@  discard block
 block discarded – undo
305 305
 							?>
306 306
 							<select name="role" class="inputBox" onChange='documentDirty=true;' style="width:300px">
307 307
 								<?php
308
-								while($row = $modx->db->getRow($rs)) {
309
-									if($modx->manager->action == '11') {
308
+								while ($row = $modx->db->getRow($rs)) {
309
+									if ($modx->manager->action == '11') {
310 310
 										$selectedtext = $row['id'] == '1' ? ' selected="selected"' : '';
311 311
 									} else {
312 312
 										$selectedtext = $row['id'] == $userdata['role'] ? "selected='selected'" : '';
@@ -360,8 +360,8 @@  discard block
 block discarded – undo
360 360
 								<?php $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $userdata['country']; ?>
361 361
 								<option value="" <?php (!isset($chosenCountry) ? ' selected' : '') ?> >&nbsp;</option>
362 362
 								<?php
363
-								foreach($_country_lang as $key => $country) {
364
-									echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>";
363
+								foreach ($_country_lang as $key => $country) {
364
+									echo "<option value=\"$key\"".(isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '').">$country</option>";
365 365
 								}
366 366
 								?>
367 367
 							</select></td>
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 						<td>&nbsp;</td>
388 388
 						<td><textarea type="text" name="comment" class="inputBox" rows="5" onChange="documentDirty=true;"><?php echo $modx->htmlspecialchars($userdata['comment']); ?></textarea></td>
389 389
 					</tr>
390
-					<?php if($modx->manager->action == '12') { ?>
390
+					<?php if ($modx->manager->action == '12') { ?>
391 391
 						<tr>
392 392
 							<th><?php echo $_lang['user_logincount']; ?>:</th>
393 393
 							<td>&nbsp;</td>
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 						</tr>
425 425
 					<?php } ?>
426 426
 				</table>
427
-				<?php if($_GET['id'] == $modx->getLoginUserID()) { ?>
427
+				<?php if ($_GET['id'] == $modx->getLoginUserID()) { ?>
428 428
 					<p><?php echo $_lang['user_edit_self_msg']; ?></p>
429 429
 				<?php } ?>
430 430
 			</div>
@@ -441,8 +441,8 @@  discard block
 block discarded – undo
441 441
 								<?php
442 442
 								$activelang = !empty($usersettings['manager_language']) ? $usersettings['manager_language'] : '';
443 443
 								$dir = dir("includes/lang");
444
-								while($file = $dir->read()) {
445
-									if(strpos($file, ".inc.php") > 0) {
444
+								while ($file = $dir->read()) {
445
+									if (strpos($file, ".inc.php") > 0) {
446 446
 										$endpos = strpos($file, ".");
447 447
 										$languagename = substr($file, 0, $endpos);
448 448
 										$selectedtext = $languagename == $activelang ? "selected='selected'" : "";
@@ -529,17 +529,17 @@  discard block
 block discarded – undo
529 529
 								<option value=""></option>
530 530
 								<?php
531 531
 								$dir = dir("media/style/");
532
-								while($file = $dir->read()) {
533
-									if($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') {
532
+								while ($file = $dir->read()) {
533
+									if ($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') {
534 534
 										$themename = $file;
535
-										if($themename === 'common') {
535
+										if ($themename === 'common') {
536 536
 											continue;
537 537
 										}
538
-										$attr = 'value="' . $themename . '" ';
539
-										if(isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) {
538
+										$attr = 'value="'.$themename.'" ';
539
+										if (isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) {
540 540
 											$attr .= 'selected="selected" ';
541 541
 										}
542
-										echo "\t\t<option " . rtrim($attr) . '>' . ucwords(str_replace("_", " ", $themename)) . "</option>\n";
542
+										echo "\t\t<option ".rtrim($attr).'>'.ucwords(str_replace("_", " ", $themename))."</option>\n";
543 543
 									}
544 544
 								}
545 545
 								$dir->close();
@@ -556,12 +556,12 @@  discard block
 block discarded – undo
556 556
 						<td><select name="which_browser" class="inputBox" onChange="documentDirty=true;">
557 557
 								<?php
558 558
 								$selected = 'default' == $usersettings['which_browser'] || !$usersettings['which_browser'] ? ' selected="selected"' : '';
559
-								echo '<option value="default"' . $selected . '>' . $_lang['option_default'] . "</option>\n";
560
-								foreach(glob("media/browser/*", GLOB_ONLYDIR) as $dir) {
559
+								echo '<option value="default"'.$selected.'>'.$_lang['option_default']."</option>\n";
560
+								foreach (glob("media/browser/*", GLOB_ONLYDIR) as $dir) {
561 561
 									$dir = str_replace('\\', '/', $dir);
562 562
 									$browser_name = substr($dir, strrpos($dir, '/') + 1);
563 563
 									$selected = $browser_name == $usersettings['which_browser'] ? ' selected="selected"' : '';
564
-									echo '<option value="' . $browser_name . '"' . $selected . '>' . "{$browser_name}</option>\n";
564
+									echo '<option value="'.$browser_name.'"'.$selected.'>'."{$browser_name}</option>\n";
565 565
 								}
566 566
 								?>
567 567
 							</select></td>
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
 					</tr>
589 589
 					<tr>
590 590
 						<td>&nbsp;</td>
591
-						<td class='comment'><?php echo $_lang["uploadable_images_message"] . $_lang["user_upload_message"] ?></td>
591
+						<td class='comment'><?php echo $_lang["uploadable_images_message"].$_lang["user_upload_message"] ?></td>
592 592
 					</tr>
593 593
 					<tr>
594 594
 						<th><?php echo $_lang["uploadable_media_title"] ?></th>
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
 					</tr>
601 601
 					<tr>
602 602
 						<td>&nbsp;</td>
603
-						<td class='comment'><?php echo $_lang["uploadable_media_message"] . $_lang["user_upload_message"] ?></td>
603
+						<td class='comment'><?php echo $_lang["uploadable_media_message"].$_lang["user_upload_message"] ?></td>
604 604
 					</tr>
605 605
 					<tr>
606 606
 						<th><?php echo $_lang["uploadable_flash_title"] ?></th>
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
 					</tr>
613 613
 					<tr>
614 614
 						<td>&nbsp;</td>
615
-						<td class='comment'><?php echo $_lang["uploadable_flash_message"] . $_lang["user_upload_message"] ?></td>
615
+						<td class='comment'><?php echo $_lang["uploadable_flash_message"].$_lang["user_upload_message"] ?></td>
616 616
 					</tr>
617 617
 					<tr>
618 618
 						<th><?php echo $_lang["uploadable_files_title"] ?></th>
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
 					</tr>
625 625
 					<tr>
626 626
 						<td>&nbsp;</td>
627
-						<td class='comment'><?php echo $_lang["uploadable_files_message"] . $_lang["user_upload_message"] ?></td>
627
+						<td class='comment'><?php echo $_lang["uploadable_files_message"].$_lang["user_upload_message"] ?></td>
628 628
 					</tr>
629 629
 					<tr class='row2'>
630 630
 						<th><?php echo $_lang["upload_maxsize_title"] ?></th>
@@ -643,11 +643,11 @@  discard block
 block discarded – undo
643 643
 								$edt = isset ($usersettings["which_editor"]) ? $usersettings["which_editor"] : '';
644 644
 								// invoke OnRichTextEditorRegister event
645 645
 								$evtOut = $modx->invokeEvent("OnRichTextEditorRegister");
646
-								echo "<option value='none'" . ($edt == 'none' ? " selected='selected'" : "") . ">" . $_lang["none"] . "</option>\n";
647
-								if(is_array($evtOut)) {
648
-									for($i = 0; $i < count($evtOut); $i++) {
646
+								echo "<option value='none'".($edt == 'none' ? " selected='selected'" : "").">".$_lang["none"]."</option>\n";
647
+								if (is_array($evtOut)) {
648
+									for ($i = 0; $i < count($evtOut); $i++) {
649 649
 										$editor = $evtOut[$i];
650
-										echo "<option value='$editor'" . ($edt == $editor ? " selected='selected'" : "") . ">$editor</option>\n";
650
+										echo "<option value='$editor'".($edt == $editor ? " selected='selected'" : "").">$editor</option>\n";
651 651
 									}
652 652
 								}
653 653
 								?>
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
 				<?php
686 686
 				// invoke OnInterfaceSettingsRender event
687 687
 				$evtOut = $modx->invokeEvent("OnInterfaceSettingsRender");
688
-				if(is_array($evtOut)) {
688
+				if (is_array($evtOut)) {
689 689
 					echo implode("", $evtOut);
690 690
 				}
691 691
 				?>
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 					function BrowseServer() {
713 713
 						var w = screen.width * 0.7;
714 714
 						var h = screen.height * 0.7;
715
-						OpenServerBrowser("<?php echo MODX_MANAGER_URL; ?>media/browser/<?php echo $which_browser;?>/browser.php?Type=images", w, h);
715
+						OpenServerBrowser("<?php echo MODX_MANAGER_URL; ?>media/browser/<?php echo $which_browser; ?>/browser.php?Type=images", w, h);
716 716
 					}
717 717
 
718 718
 					function SetUrl(url, width, height, alt) {
@@ -735,17 +735,17 @@  discard block
 block discarded – undo
735 735
 					</tr>
736 736
 				</table>
737 737
 			</div>
738
-			<?php if($use_udperms == 1) {
738
+			<?php if ($use_udperms == 1) {
739 739
 
740 740
 			$groupsarray = array();
741 741
 
742
-			if($modx->manager->action == '12') { // only do this bit if the user is being edited
742
+			if ($modx->manager->action == '12') { // only do this bit if the user is being edited
743 743
 				$rs = $modx->db->select('user_group', $modx->getFullTableName('member_groups'), "member='{$user}'");
744 744
 				$groupsarray = $modx->db->getColumn('user_group', $rs);
745 745
 			}
746 746
 			// retain selected doc groups between post
747
-			if(is_array($_POST['user_groups'])) {
748
-				foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v;
747
+			if (is_array($_POST['user_groups'])) {
748
+				foreach ($_POST['user_groups'] as $n => $v) $groupsarray[] = $v;
749 749
 			}
750 750
 			?>
751 751
 			<div class="tab-page" id="tabAccess">
@@ -754,8 +754,8 @@  discard block
 block discarded – undo
754 754
 				<p><?php echo $_lang['access_permissions_user_message'] ?></p>
755 755
 				<?php
756 756
 				$rs = $modx->db->select('name, id', $modx->getFullTableName('membergroup_names'), '', 'name');
757
-				while($row = $modx->db->getRow($rs)) {
758
-					echo "<label><input type='checkbox' name='user_groups[]' value='" . $row['id'] . "'" . (in_array($row['id'], $groupsarray) ? " checked='checked'" : "") . " />" . $row['name'] . "</label><br />";
757
+				while ($row = $modx->db->getRow($rs)) {
758
+					echo "<label><input type='checkbox' name='user_groups[]' value='".$row['id']."'".(in_array($row['id'], $groupsarray) ? " checked='checked'" : "")." />".$row['name']."</label><br />";
759 759
 				}
760 760
 				}
761 761
 				?>
@@ -768,7 +768,7 @@  discard block
 block discarded – undo
768 768
 	$evtOut = $modx->invokeEvent("OnUserFormRender", array(
769 769
 		"id" => $user
770 770
 	));
771
-	if(is_array($evtOut)) {
771
+	if (is_array($evtOut)) {
772 772
 		echo implode("", $evtOut);
773 773
 	}
774 774
 	?>
Please login to merge, or discard this patch.
manager/actions/category_mgr/inc/request_trigger.inc.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 
22 22
             if( $uncategorized_elements = $cm->getAssignedElements( 0, $_data['elements'] ) )
23 23
             {
24
-               $output .= $cm->renderView('chunks/categorize/uncategorized_elements', $uncategorized_elements);
24
+                $output .= $cm->renderView('chunks/categorize/uncategorized_elements', $uncategorized_elements);
25 25
             }
26 26
 
27 27
             foreach( $cm->getCategories() as $category )
@@ -106,14 +106,14 @@  discard block
 block discarded – undo
106 106
 
107 107
     if( empty( $category ) )
108 108
     {
109
-       $cm->addMessage( $cm->txt('cm_enter_name_for_category'), 'add' );
110
-       return;
109
+        $cm->addMessage( $cm->txt('cm_enter_name_for_category'), 'add' );
110
+        return;
111 111
     }
112 112
 
113 113
     if( $cm->isCategoryExists( $category ) )
114 114
     {
115
-       $cm->addMessage( sprintf( $cm->txt('cm_category_x_exists'), $category ), 'add' );
116
-       return;
115
+        $cm->addMessage( sprintf( $cm->txt('cm_category_x_exists'), $category ), 'add' );
116
+        return;
117 117
     }
118 118
 
119 119
     if( $cm->addCategory( $category, $rank ) !== 0 )
Please login to merge, or discard this patch.
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -2,16 +2,16 @@  discard block
 block discarded – undo
2 2
 /**
3 3
  * Ajax Requests
4 4
  */
5
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
5
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
6 6
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
7 7
 }
8 8
 
9
-if( isset( $_REQUEST[$cm->get('request_key')]['ajax'] ) )
9
+if (isset($_REQUEST[$cm->get('request_key')]['ajax']))
10 10
 {
11 11
     $_data  = $_REQUEST[$cm->get('request_key')];
12 12
     $output = '';
13 13
     $task   = $_data['task'];
14
-    switch( $task )
14
+    switch ($task)
15 15
     {
16 16
         /**
17 17
          * get categories
@@ -19,19 +19,19 @@  discard block
 block discarded – undo
19 19
         case 'categorize_load_elements':
20 20
             $elements = $_data['elements'];
21 21
 
22
-            if( $uncategorized_elements = $cm->getAssignedElements( 0, $_data['elements'] ) )
22
+            if ($uncategorized_elements = $cm->getAssignedElements(0, $_data['elements']))
23 23
             {
24 24
                $output .= $cm->renderView('chunks/categorize/uncategorized_elements', $uncategorized_elements);
25 25
             }
26 26
 
27
-            foreach( $cm->getCategories() as $category )
27
+            foreach ($cm->getCategories() as $category)
28 28
             {
29
-                $category['elements'] = $cm->getAssignedElements( $category['id'], $_data['elements'] );
29
+                $category['elements'] = $cm->getAssignedElements($category['id'], $_data['elements']);
30 30
                 $output .= $cm->renderView('chunks/categorize/category', $category);
31 31
             }
32 32
             break;
33 33
     }
34
-    exit( $output );
34
+    exit($output);
35 35
 }
36 36
 /**
37 37
  * Categorize elements
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
  * @see http://modxcms.com/forums/index.php/topic,40430.msg251476.html#msg251476
42 42
  *
43 43
  */
44
-if( isset( $_POST[$cm->get('request_key')]['categorize']['submit'] ) )
44
+if (isset($_POST[$cm->get('request_key')]['categorize']['submit']))
45 45
 {
46 46
     $_data = $_POST[$cm->get('request_key')]['categorize'];
47 47
     $_changes = 0;
@@ -54,15 +54,15 @@  discard block
 block discarded – undo
54 54
         'categorize'
55 55
     );
56 56
 
57
-    if( !isset( $_data['elements'] ) )
57
+    if (!isset($_data['elements']))
58 58
     {
59
-        $cm->addMessage( $cm->txt('cm_unknown_error'), 'categorize' );
59
+        $cm->addMessage($cm->txt('cm_unknown_error'), 'categorize');
60 60
         return;
61 61
     }
62 62
 
63
-    foreach( $_data['elements'] as $element_id => $data )
63
+    foreach ($_data['elements'] as $element_id => $data)
64 64
     {
65
-        if( $cm->updateElement( $_data['elementsgroup'], $element_id, $data['category_id'] ) )
65
+        if ($cm->updateElement($_data['elementsgroup'], $element_id, $data['category_id']))
66 66
         {
67 67
             $cm->addMessage(
68 68
                 sprintf(
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
         }
79 79
     }
80 80
 
81
-    if( $_changes === 0 )
81
+    if ($_changes === 0)
82 82
     {
83
-        $cm->addMessage( $cm->txt('cm_no_categorization'), 'categorize' );
83
+        $cm->addMessage($cm->txt('cm_no_categorization'), 'categorize');
84 84
         return;
85 85
     }
86 86
     else
@@ -98,29 +98,29 @@  discard block
 block discarded – undo
98 98
 /**
99 99
  * Add a new category
100 100
  */
101
-if( isset( $_POST[$cm->get('request_key')]['add']['submit'] ) )
101
+if (isset($_POST[$cm->get('request_key')]['add']['submit']))
102 102
 {
103 103
     $_data    = $_POST[$cm->get('request_key')]['add']['data'];
104
-    $category = trim( html_entity_decode($_data['name']) );
104
+    $category = trim(html_entity_decode($_data['name']));
105 105
     $rank     = (int) $_data['rank'];
106 106
 
107
-    if( empty( $category ) )
107
+    if (empty($category))
108 108
     {
109
-       $cm->addMessage( $cm->txt('cm_enter_name_for_category'), 'add' );
109
+       $cm->addMessage($cm->txt('cm_enter_name_for_category'), 'add');
110 110
        return;
111 111
     }
112 112
 
113
-    if( $cm->isCategoryExists( $category ) )
113
+    if ($cm->isCategoryExists($category))
114 114
     {
115
-       $cm->addMessage( sprintf( $cm->txt('cm_category_x_exists'), $category ), 'add' );
115
+       $cm->addMessage(sprintf($cm->txt('cm_category_x_exists'), $category), 'add');
116 116
        return;
117 117
     }
118 118
 
119
-    if( $cm->addCategory( $category, $rank ) !== 0 )
119
+    if ($cm->addCategory($category, $rank) !== 0)
120 120
     {
121 121
         $cm->addMessage(
122 122
             sprintf(
123
-                $cm->txt( 'cm_category_x_saved_at_position_y' ),
123
+                $cm->txt('cm_category_x_saved_at_position_y'),
124 124
                 $category,
125 125
                 $rank
126 126
             ),
@@ -129,26 +129,26 @@  discard block
 block discarded – undo
129 129
     }
130 130
     else
131 131
     {
132
-        $cm->addMessage( $cm->txt('cm_unknown_error'), 'add' );
132
+        $cm->addMessage($cm->txt('cm_unknown_error'), 'add');
133 133
     }
134 134
 }
135 135
 
136 136
 /**
137 137
  * Sort categories
138 138
  */
139
-if( isset( $_POST[$cm->get('request_key')]['sort']['submit'] ) )
139
+if (isset($_POST[$cm->get('request_key')]['sort']['submit']))
140 140
 {
141 141
     $categories = $_POST[$cm->get('request_key')]['sort']['data'];
142 142
     $_changes   = 0;
143 143
 
144
-    foreach( $categories as $category_id => $_data  )
144
+    foreach ($categories as $category_id => $_data)
145 145
     {
146 146
         $data = array(
147
-            'category' => urldecode( $_data['category'] ),
147
+            'category' => urldecode($_data['category']),
148 148
             'rank'     => $_data['rank']
149 149
         );
150 150
 
151
-        if( $cm->updateCategory( $category_id, $data ) )
151
+        if ($cm->updateCategory($category_id, $data))
152 152
         {
153 153
             $cm->addMessage(
154 154
                 sprintf(
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
         }
163 163
     }
164 164
 
165
-    if( $_changes === 0 )
165
+    if ($_changes === 0)
166 166
     {
167
-        $cm->addMessage( $cm->txt( 'cm_no_changes' ), 'sort');
167
+        $cm->addMessage($cm->txt('cm_no_changes'), 'sort');
168 168
     }
169 169
     else
170 170
     {
@@ -181,21 +181,21 @@  discard block
 block discarded – undo
181 181
 /**
182 182
  * Edit categories
183 183
  */
184
-if( isset( $_POST[$cm->get('request_key')]['edit']['submit'] ) )
184
+if (isset($_POST[$cm->get('request_key')]['edit']['submit']))
185 185
 {
186 186
     $categories = $_POST[$cm->get('request_key')]['edit']['data'];
187 187
     $_changes   = 0;
188 188
 
189
-    foreach( $categories as $category_id => $_data  )
189
+    foreach ($categories as $category_id => $_data)
190 190
     {
191
-        if( isset( $_data['delete'] ) )
191
+        if (isset($_data['delete']))
192 192
         {
193
-            if( $cm->deleteCategory( $category_id ) )
193
+            if ($cm->deleteCategory($category_id))
194 194
             {
195 195
                 $cm->addMessage(
196 196
                     sprintf(
197 197
                         $cm->txt('cm_category_x_deleted'),
198
-                        urldecode( $_data['origin'] )
198
+                        urldecode($_data['origin'])
199 199
                     ),
200 200
                     'edit'
201 201
                 );
@@ -205,16 +205,16 @@  discard block
 block discarded – undo
205 205
         }
206 206
 
207 207
         $data = array(
208
-            'category' => trim( html_entity_decode( $_data['category'] ) ),
208
+            'category' => trim(html_entity_decode($_data['category'])),
209 209
             'rank'     => $_data['rank']
210 210
         );
211 211
 
212
-        if( $cm->updateCategory( $category_id, $data ) )
212
+        if ($cm->updateCategory($category_id, $data))
213 213
         {
214 214
             $cm->addMessage(
215 215
                 sprintf(
216 216
                     $cm->txt('cm_category_x_renamed_to_y'),
217
-                    urldecode( $_data['origin'] ),
217
+                    urldecode($_data['origin']),
218 218
                     $data['category']
219 219
                 ),
220 220
                 'edit'
@@ -223,26 +223,26 @@  discard block
 block discarded – undo
223 223
         }
224 224
     }
225 225
 
226
-    if( $_changes === 0 )
226
+    if ($_changes === 0)
227 227
     {
228
-        $cm->addMessage( $cm->txt( 'cm_no_changes' ), 'edit');
228
+        $cm->addMessage($cm->txt('cm_no_changes'), 'edit');
229 229
     }
230 230
 }
231 231
 
232 232
 /**
233 233
  * Delete singel category by $_GET
234 234
  */
235
-if( isset( $_GET[$cm->get('request_key')]['delete'] )
236
-    && !empty( $_GET[$cm->get('request_key')]['delete'] ) )
235
+if (isset($_GET[$cm->get('request_key')]['delete'])
236
+    && !empty($_GET[$cm->get('request_key')]['delete']))
237 237
 {
238
-    $category_id = (int)$_GET[$cm->get('request_key')]['delete'];
238
+    $category_id = (int) $_GET[$cm->get('request_key')]['delete'];
239 239
 
240
-    if( $cm->deleteCategory( $category_id ) )
240
+    if ($cm->deleteCategory($category_id))
241 241
     {
242 242
         $cm->addMessage(
243 243
             sprintf(
244 244
                 $cm->txt('cm_category_x_deleted'),
245
-                urldecode( $_GET[$cm->get('request_key')]['category'] )
245
+                urldecode($_GET[$cm->get('request_key')]['category'])
246 246
             ),
247 247
             'edit'
248 248
         );
@@ -251,15 +251,15 @@  discard block
 block discarded – undo
251 251
 /**
252 252
  * Translate phrases
253 253
  */
254
-if( isset( $_POST[$cm->get('request_key')]['translate']['submit'] ) )
254
+if (isset($_POST[$cm->get('request_key')]['translate']['submit']))
255 255
 {
256 256
     $translations = $_POST[$cm->get('request_key')]['translate']['data'];
257 257
 
258
-    foreach( $translations as $native_phrase => $translation )
258
+    foreach ($translations as $native_phrase => $translation)
259 259
     {
260
-        $native_phrase = urldecode( $native_phrase );
260
+        $native_phrase = urldecode($native_phrase);
261 261
 
262
-        if( empty( $translation ) )
262
+        if (empty($translation))
263 263
         {
264 264
             $translation = $native_phrase;
265 265
 
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
             );
273 273
         }
274 274
 
275
-        $cm->c('Translator')->addTranslation( $native_phrase, $translation, 'phrase' );
275
+        $cm->c('Translator')->addTranslation($native_phrase, $translation, 'phrase');
276 276
 
277 277
         $cm->addMessage(
278 278
             sprintf(
Please login to merge, or discard this patch.
Braces   +31 added lines, -65 removed lines patch added patch discarded remove patch
@@ -6,26 +6,22 @@  discard block
 block discarded – undo
6 6
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
7 7
 }
8 8
 
9
-if( isset( $_REQUEST[$cm->get('request_key')]['ajax'] ) )
10
-{
9
+if( isset( $_REQUEST[$cm->get('request_key')]['ajax'] ) ) {
11 10
     $_data  = $_REQUEST[$cm->get('request_key')];
12 11
     $output = '';
13 12
     $task   = $_data['task'];
14
-    switch( $task )
15
-    {
13
+    switch( $task ) {
16 14
         /**
17 15
          * get categories
18 16
          */
19 17
         case 'categorize_load_elements':
20 18
             $elements = $_data['elements'];
21 19
 
22
-            if( $uncategorized_elements = $cm->getAssignedElements( 0, $_data['elements'] ) )
23
-            {
20
+            if( $uncategorized_elements = $cm->getAssignedElements( 0, $_data['elements'] ) ) {
24 21
                $output .= $cm->renderView('chunks/categorize/uncategorized_elements', $uncategorized_elements);
25 22
             }
26 23
 
27
-            foreach( $cm->getCategories() as $category )
28
-            {
24
+            foreach( $cm->getCategories() as $category ) {
29 25
                 $category['elements'] = $cm->getAssignedElements( $category['id'], $_data['elements'] );
30 26
                 $output .= $cm->renderView('chunks/categorize/category', $category);
31 27
             }
@@ -41,8 +37,7 @@  discard block
 block discarded – undo
41 37
  * @see http://modxcms.com/forums/index.php/topic,40430.msg251476.html#msg251476
42 38
  *
43 39
  */
44
-if( isset( $_POST[$cm->get('request_key')]['categorize']['submit'] ) )
45
-{
40
+if( isset( $_POST[$cm->get('request_key')]['categorize']['submit'] ) ) {
46 41
     $_data = $_POST[$cm->get('request_key')]['categorize'];
47 42
     $_changes = 0;
48 43
 
@@ -54,16 +49,13 @@  discard block
 block discarded – undo
54 49
         'categorize'
55 50
     );
56 51
 
57
-    if( !isset( $_data['elements'] ) )
58
-    {
52
+    if( !isset( $_data['elements'] ) ) {
59 53
         $cm->addMessage( $cm->txt('cm_unknown_error'), 'categorize' );
60 54
         return;
61 55
     }
62 56
 
63
-    foreach( $_data['elements'] as $element_id => $data )
64
-    {
65
-        if( $cm->updateElement( $_data['elementsgroup'], $element_id, $data['category_id'] ) )
66
-        {
57
+    foreach( $_data['elements'] as $element_id => $data ) {
58
+        if( $cm->updateElement( $_data['elementsgroup'], $element_id, $data['category_id'] ) ) {
67 59
             $cm->addMessage(
68 60
                 sprintf(
69 61
                     $cm->txt('cm_x_assigned_to_category_y'),
@@ -78,13 +70,10 @@  discard block
 block discarded – undo
78 70
         }
79 71
     }
80 72
 
81
-    if( $_changes === 0 )
82
-    {
73
+    if( $_changes === 0 ) {
83 74
         $cm->addMessage( $cm->txt('cm_no_categorization'), 'categorize' );
84 75
         return;
85
-    }
86
-    else
87
-    {
76
+    } else {
88 77
         $cm->addMessage(
89 78
             sprintf(
90 79
                 $cm->txt('cm_x_changes_made'),
@@ -98,26 +87,22 @@  discard block
 block discarded – undo
98 87
 /**
99 88
  * Add a new category
100 89
  */
101
-if( isset( $_POST[$cm->get('request_key')]['add']['submit'] ) )
102
-{
90
+if( isset( $_POST[$cm->get('request_key')]['add']['submit'] ) ) {
103 91
     $_data    = $_POST[$cm->get('request_key')]['add']['data'];
104 92
     $category = trim( html_entity_decode($_data['name']) );
105 93
     $rank     = (int) $_data['rank'];
106 94
 
107
-    if( empty( $category ) )
108
-    {
95
+    if( empty( $category ) ) {
109 96
        $cm->addMessage( $cm->txt('cm_enter_name_for_category'), 'add' );
110 97
        return;
111 98
     }
112 99
 
113
-    if( $cm->isCategoryExists( $category ) )
114
-    {
100
+    if( $cm->isCategoryExists( $category ) ) {
115 101
        $cm->addMessage( sprintf( $cm->txt('cm_category_x_exists'), $category ), 'add' );
116 102
        return;
117 103
     }
118 104
 
119
-    if( $cm->addCategory( $category, $rank ) !== 0 )
120
-    {
105
+    if( $cm->addCategory( $category, $rank ) !== 0 ) {
121 106
         $cm->addMessage(
122 107
             sprintf(
123 108
                 $cm->txt( 'cm_category_x_saved_at_position_y' ),
@@ -126,9 +111,7 @@  discard block
 block discarded – undo
126 111
             ),
127 112
             'add'
128 113
         );
129
-    }
130
-    else
131
-    {
114
+    } else {
132 115
         $cm->addMessage( $cm->txt('cm_unknown_error'), 'add' );
133 116
     }
134 117
 }
@@ -136,20 +119,17 @@  discard block
 block discarded – undo
136 119
 /**
137 120
  * Sort categories
138 121
  */
139
-if( isset( $_POST[$cm->get('request_key')]['sort']['submit'] ) )
140
-{
122
+if( isset( $_POST[$cm->get('request_key')]['sort']['submit'] ) ) {
141 123
     $categories = $_POST[$cm->get('request_key')]['sort']['data'];
142 124
     $_changes   = 0;
143 125
 
144
-    foreach( $categories as $category_id => $_data  )
145
-    {
126
+    foreach( $categories as $category_id => $_data  ) {
146 127
         $data = array(
147 128
             'category' => urldecode( $_data['category'] ),
148 129
             'rank'     => $_data['rank']
149 130
         );
150 131
 
151
-        if( $cm->updateCategory( $category_id, $data ) )
152
-        {
132
+        if( $cm->updateCategory( $category_id, $data ) ) {
153 133
             $cm->addMessage(
154 134
                 sprintf(
155 135
                     $cm->txt('cm_category_x_moved_to_position_y'),
@@ -162,12 +142,9 @@  discard block
 block discarded – undo
162 142
         }
163 143
     }
164 144
 
165
-    if( $_changes === 0 )
166
-    {
145
+    if( $_changes === 0 ) {
167 146
         $cm->addMessage( $cm->txt( 'cm_no_changes' ), 'sort');
168
-    }
169
-    else
170
-    {
147
+    } else {
171 148
         $cm->addMessage(
172 149
             sprintf(
173 150
                 $cm->txt('cm_x_changes_made'),
@@ -181,17 +158,13 @@  discard block
 block discarded – undo
181 158
 /**
182 159
  * Edit categories
183 160
  */
184
-if( isset( $_POST[$cm->get('request_key')]['edit']['submit'] ) )
185
-{
161
+if( isset( $_POST[$cm->get('request_key')]['edit']['submit'] ) ) {
186 162
     $categories = $_POST[$cm->get('request_key')]['edit']['data'];
187 163
     $_changes   = 0;
188 164
 
189
-    foreach( $categories as $category_id => $_data  )
190
-    {
191
-        if( isset( $_data['delete'] ) )
192
-        {
193
-            if( $cm->deleteCategory( $category_id ) )
194
-            {
165
+    foreach( $categories as $category_id => $_data  ) {
166
+        if( isset( $_data['delete'] ) ) {
167
+            if( $cm->deleteCategory( $category_id ) ) {
195 168
                 $cm->addMessage(
196 169
                     sprintf(
197 170
                         $cm->txt('cm_category_x_deleted'),
@@ -209,8 +182,7 @@  discard block
 block discarded – undo
209 182
             'rank'     => $_data['rank']
210 183
         );
211 184
 
212
-        if( $cm->updateCategory( $category_id, $data ) )
213
-        {
185
+        if( $cm->updateCategory( $category_id, $data ) ) {
214 186
             $cm->addMessage(
215 187
                 sprintf(
216 188
                     $cm->txt('cm_category_x_renamed_to_y'),
@@ -223,8 +195,7 @@  discard block
 block discarded – undo
223 195
         }
224 196
     }
225 197
 
226
-    if( $_changes === 0 )
227
-    {
198
+    if( $_changes === 0 ) {
228 199
         $cm->addMessage( $cm->txt( 'cm_no_changes' ), 'edit');
229 200
     }
230 201
 }
@@ -233,12 +204,10 @@  discard block
 block discarded – undo
233 204
  * Delete singel category by $_GET
234 205
  */
235 206
 if( isset( $_GET[$cm->get('request_key')]['delete'] )
236
-    && !empty( $_GET[$cm->get('request_key')]['delete'] ) )
237
-{
207
+    && !empty( $_GET[$cm->get('request_key')]['delete'] ) ) {
238 208
     $category_id = (int)$_GET[$cm->get('request_key')]['delete'];
239 209
 
240
-    if( $cm->deleteCategory( $category_id ) )
241
-    {
210
+    if( $cm->deleteCategory( $category_id ) ) {
242 211
         $cm->addMessage(
243 212
             sprintf(
244 213
                 $cm->txt('cm_category_x_deleted'),
@@ -251,16 +220,13 @@  discard block
 block discarded – undo
251 220
 /**
252 221
  * Translate phrases
253 222
  */
254
-if( isset( $_POST[$cm->get('request_key')]['translate']['submit'] ) )
255
-{
223
+if( isset( $_POST[$cm->get('request_key')]['translate']['submit'] ) ) {
256 224
     $translations = $_POST[$cm->get('request_key')]['translate']['data'];
257 225
 
258
-    foreach( $translations as $native_phrase => $translation )
259
-    {
226
+    foreach( $translations as $native_phrase => $translation ) {
260 227
         $native_phrase = urldecode( $native_phrase );
261 228
 
262
-        if( empty( $translation ) )
263
-        {
229
+        if( empty( $translation ) ) {
264 230
             $translation = $native_phrase;
265 231
 
266 232
             $cm->addMessage(
Please login to merge, or discard this patch.
manager/actions/eventlog_details.dynamic.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  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
 if(!$modx->hasPermission('view_eventlog')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 // get id
@@ -41,18 +41,18 @@  discard block
 block discarded – undo
41 41
 	<div class="tab-page">
42 42
 		<div class="container container-body">
43 43
 			<?php
44
-			$date = $modx->toDateFormat($content["createdon"]);
45
-			if($content["type"] == 1) {
46
-				$icon = $_style['actions_info'] . ' text-info';
47
-				$msgtype = $_lang["information"];
48
-			} else if($content["type"] == 2) {
49
-				$icon = $_style['actions_triangle'] . ' text-warning';
50
-				$msgtype = $_lang["warning"];
51
-			} else if($content["type"] == 3) {
52
-				$icon = $_style['actions_error'] . ' text-danger';
53
-				$msgtype = $_lang["error"];
54
-			}
55
-			?>
44
+            $date = $modx->toDateFormat($content["createdon"]);
45
+            if($content["type"] == 1) {
46
+                $icon = $_style['actions_info'] . ' text-info';
47
+                $msgtype = $_lang["information"];
48
+            } else if($content["type"] == 2) {
49
+                $icon = $_style['actions_triangle'] . ' text-warning';
50
+                $msgtype = $_lang["warning"];
51
+            } else if($content["type"] == 3) {
52
+                $icon = $_style['actions_error'] . ' text-danger';
53
+                $msgtype = $_lang["error"];
54
+            }
55
+            ?>
56 56
 			<p><b><?= $content['source'] . " - " . $_lang['eventlog_viewer'] ?></b></p>
57 57
 			<p>
58 58
 				<i class="<?= $icon ?>"></i> <?= $msgtype ?>
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,17 +1,17 @@  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
 
9 9
 // get id
10
-$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
10
+$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
11 11
 
12
-$ds = $modx->db->select('el.*, IFNULL(wu.username,mu.username) as username', $modx->getFullTableName("event_log") . " el 
13
-		LEFT JOIN " . $modx->getFullTableName("manager_users") . " mu ON mu.id=el.user AND el.usertype=0
14
-		LEFT JOIN " . $modx->getFullTableName("web_users") . " wu ON wu.id=el.user AND el.usertype=1", "el.id='{$id}'");
12
+$ds = $modx->db->select('el.*, IFNULL(wu.username,mu.username) as username', $modx->getFullTableName("event_log")." el 
13
+		LEFT JOIN " . $modx->getFullTableName("manager_users")." mu ON mu.id=el.user AND el.usertype=0
14
+		LEFT JOIN " . $modx->getFullTableName("web_users")." wu ON wu.id=el.user AND el.usertype=1", "el.id='{$id}'");
15 15
 $content = $modx->db->getRow($ds);
16 16
 
17 17
 ?>
@@ -42,18 +42,18 @@  discard block
 block discarded – undo
42 42
 		<div class="container container-body">
43 43
 			<?php
44 44
 			$date = $modx->toDateFormat($content["createdon"]);
45
-			if($content["type"] == 1) {
46
-				$icon = $_style['actions_info'] . ' text-info';
45
+			if ($content["type"] == 1) {
46
+				$icon = $_style['actions_info'].' text-info';
47 47
 				$msgtype = $_lang["information"];
48
-			} else if($content["type"] == 2) {
49
-				$icon = $_style['actions_triangle'] . ' text-warning';
48
+			} else if ($content["type"] == 2) {
49
+				$icon = $_style['actions_triangle'].' text-warning';
50 50
 				$msgtype = $_lang["warning"];
51
-			} else if($content["type"] == 3) {
52
-				$icon = $_style['actions_error'] . ' text-danger';
51
+			} else if ($content["type"] == 3) {
52
+				$icon = $_style['actions_error'].' text-danger';
53 53
 				$msgtype = $_lang["error"];
54 54
 			}
55 55
 			?>
56
-			<p><b><?= $content['source'] . " - " . $_lang['eventlog_viewer'] ?></b></p>
56
+			<p><b><?= $content['source']." - ".$_lang['eventlog_viewer'] ?></b></p>
57 57
 			<p>
58 58
 				<i class="<?= $icon ?>"></i> <?= $msgtype ?>
59 59
 			</p>
Please login to merge, or discard this patch.
manager/includes/footer.inc.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  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
 global $SystemAlertMsgQueque;
6 6
 // display system alert window if messages are available
7 7
 if(count($SystemAlertMsgQueque) > 0) {
8
-	include "sysalert.display.inc.php";
8
+    include "sysalert.display.inc.php";
9 9
 }
10 10
 ?>
11 11
 <script type='text/javascript'>
@@ -19,17 +19,17 @@  discard block
 block discarded – undo
19 19
 </script>
20 20
 <?php
21 21
 if(in_array($modx->manager->action, array(
22
-	85,
23
-	27,
24
-	4,
25
-	72,
26
-	13,
27
-	11,
28
-	12,
29
-	87,
30
-	88
22
+    85,
23
+    27,
24
+    4,
25
+    72,
26
+    13,
27
+    11,
28
+    12,
29
+    87,
30
+    88
31 31
 ))) {
32
-	echo $modx->manager->loadDatePicker($modx->config['mgr_date_picker_path']);
32
+    echo $modx->manager->loadDatePicker($modx->config['mgr_date_picker_path']);
33 33
 }
34 34
 ?>
35 35
 </body>
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  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
 global $SystemAlertMsgQueque;
6 6
 // display system alert window if messages are available
7
-if(count($SystemAlertMsgQueque) > 0) {
7
+if (count($SystemAlertMsgQueque) > 0) {
8 8
 	include "sysalert.display.inc.php";
9 9
 }
10 10
 ?>
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	});
19 19
 </script>
20 20
 <?php
21
-if(in_array($modx->manager->action, array(
21
+if (in_array($modx->manager->action, array(
22 22
 	85,
23 23
 	27,
24 24
 	4,
Please login to merge, or discard this patch.
manager/processors/export_site.processor.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
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
 if(!$modx->hasPermission('export_static')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $maxtime = (is_numeric($_POST['maxtime'])) ? $_POST['maxtime'] : 30;
@@ -17,11 +17,11 @@  discard block
 block discarded – undo
17 17
 $modx->export->targetDir = $export_dir;
18 18
 
19 19
 if(strpos($modx->config['base_path'],"{$export_dir}/")===0 && 0 <= strlen(str_replace("{$export_dir}/",'',$modx->config['base_path'])))
20
-	return $_lang['export_site.static.php6'];
20
+    return $_lang['export_site.static.php6'];
21 21
 elseif($modx->config['rb_base_dir'] === $export_dir . '/')
22
-	return $modx->parsePlaceholder($_lang['export_site.static.php7'],'rb_base_url=' . $modx->config['base_url'] . $modx->config['rb_base_url']);
22
+    return $modx->parsePlaceholder($_lang['export_site.static.php7'],'rb_base_url=' . $modx->config['base_url'] . $modx->config['rb_base_url']);
23 23
 elseif(!is_writable($export_dir))
24
-	return $_lang['export_site_target_unwritable'];
24
+    return $_lang['export_site_target_unwritable'];
25 25
 
26 26
 $modx->export->generate_mode = $_POST['generate_mode'];
27 27
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
  ||$includenoncache!==$_POST['includenoncache']
38 38
  ||$repl_before!==$_POST['repl_before']
39 39
  ||$repl_after !==$_POST['repl_after']) {
40
-	$modx->clearCache('full');
40
+    $modx->clearCache('full');
41 41
 }
42 42
 
43 43
 $total = $modx->export->getTotal($_POST['ignore_ids'], $modx->config['export_includenoncache']);
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 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('export_static')) {
5
+if (!$modx->hasPermission('export_static')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
@@ -12,15 +12,15 @@  discard block
 block discarded – undo
12 12
 $modx->loadExtension('EXPORT_SITE');
13 13
 
14 14
 
15
-if(is_dir(MODX_BASE_PATH . 'temp'))       $export_dir = MODX_BASE_PATH . 'temp/export';
16
-elseif(is_dir(MODX_BASE_PATH . 'assets')) $export_dir = MODX_BASE_PATH . 'assets/export';
15
+if (is_dir(MODX_BASE_PATH.'temp'))       $export_dir = MODX_BASE_PATH.'temp/export';
16
+elseif (is_dir(MODX_BASE_PATH.'assets')) $export_dir = MODX_BASE_PATH.'assets/export';
17 17
 $modx->export->targetDir = $export_dir;
18 18
 
19
-if(strpos($modx->config['base_path'],"{$export_dir}/")===0 && 0 <= strlen(str_replace("{$export_dir}/",'',$modx->config['base_path'])))
19
+if (strpos($modx->config['base_path'], "{$export_dir}/") === 0 && 0 <= strlen(str_replace("{$export_dir}/", '', $modx->config['base_path'])))
20 20
 	return $_lang['export_site.static.php6'];
21
-elseif($modx->config['rb_base_dir'] === $export_dir . '/')
22
-	return $modx->parsePlaceholder($_lang['export_site.static.php7'],'rb_base_url=' . $modx->config['base_url'] . $modx->config['rb_base_url']);
23
-elseif(!is_writable($export_dir))
21
+elseif ($modx->config['rb_base_dir'] === $export_dir.'/')
22
+	return $modx->parsePlaceholder($_lang['export_site.static.php7'], 'rb_base_url='.$modx->config['base_url'].$modx->config['rb_base_url']);
23
+elseif (!is_writable($export_dir))
24 24
 	return $_lang['export_site_target_unwritable'];
25 25
 
26 26
 $modx->export->generate_mode = $_POST['generate_mode'];
@@ -33,10 +33,10 @@  discard block
 block discarded – undo
33 33
 $repl_after      = $_POST['repl_after'];
34 34
 $includenoncache = $_POST['includenoncache'];
35 35
 
36
-if($ignore_ids!==$_POST['ignore_ids']
37
- ||$includenoncache!==$_POST['includenoncache']
38
- ||$repl_before!==$_POST['repl_before']
39
- ||$repl_after !==$_POST['repl_after']) {
36
+if ($ignore_ids !== $_POST['ignore_ids']
37
+ ||$includenoncache !== $_POST['includenoncache']
38
+ ||$repl_before !== $_POST['repl_before']
39
+ ||$repl_after !== $_POST['repl_after']) {
40 40
 	$modx->clearCache('full');
41 41
 }
42 42
 
@@ -52,5 +52,5 @@  discard block
 block discarded – undo
52 52
 
53 53
 $exportend = $modx->export->get_mtime();
54 54
 $totaltime = ($exportend - $modx->export->exportstart);
55
-$output .= sprintf ('<p>'.$_lang["export_site_time"].'</p>', round($totaltime, 3));
55
+$output .= sprintf('<p>'.$_lang["export_site_time"].'</p>', round($totaltime, 3));
56 56
 return $output;
Please login to merge, or discard this patch.
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -12,16 +12,20 @@
 block discarded – undo
12 12
 $modx->loadExtension('EXPORT_SITE');
13 13
 
14 14
 
15
-if(is_dir(MODX_BASE_PATH . 'temp'))       $export_dir = MODX_BASE_PATH . 'temp/export';
16
-elseif(is_dir(MODX_BASE_PATH . 'assets')) $export_dir = MODX_BASE_PATH . 'assets/export';
15
+if(is_dir(MODX_BASE_PATH . 'temp')) {
16
+    $export_dir = MODX_BASE_PATH . 'temp/export';
17
+} elseif(is_dir(MODX_BASE_PATH . 'assets')) {
18
+    $export_dir = MODX_BASE_PATH . 'assets/export';
19
+}
17 20
 $modx->export->targetDir = $export_dir;
18 21
 
19
-if(strpos($modx->config['base_path'],"{$export_dir}/")===0 && 0 <= strlen(str_replace("{$export_dir}/",'',$modx->config['base_path'])))
22
+if(strpos($modx->config['base_path'],"{$export_dir}/")===0 && 0 <= strlen(str_replace("{$export_dir}/",'',$modx->config['base_path']))) {
20 23
 	return $_lang['export_site.static.php6'];
21
-elseif($modx->config['rb_base_dir'] === $export_dir . '/')
24
+} elseif($modx->config['rb_base_dir'] === $export_dir . '/') {
22 25
 	return $modx->parsePlaceholder($_lang['export_site.static.php7'],'rb_base_url=' . $modx->config['base_url'] . $modx->config['rb_base_url']);
23
-elseif(!is_writable($export_dir))
26
+} elseif(!is_writable($export_dir)) {
24 27
 	return $_lang['export_site_target_unwritable'];
28
+}
25 29
 
26 30
 $modx->export->generate_mode = $_POST['generate_mode'];
27 31
 
Please login to merge, or discard this patch.
manager/processors/duplicate_plugin.processor.php 3 patches
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,11 @@
 block discarded – undo
14 14
 // count duplicates
15 15
 $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_plugins'), "id='{$id}'"));
16 16
 $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_plugins'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'"));
17
-if($count>=1) $count = ' '.($count+1);
18
-else $count = '';
17
+if($count>=1) {
18
+    $count = ' '.($count+1);
19
+} else {
20
+    $count = '';
21
+}
19 22
 
20 23
 // duplicate Plugin
21 24
 $newid = $modx->db->insert(
Please login to merge, or discard this patch.
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -3,12 +3,12 @@  discard block
 block discarded – undo
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
 if(!$modx->hasPermission('new_plugin')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $id = isset($_GET['id'])? (int)$_GET['id'] : 0;
10 10
 if($id==0) {
11
-	$modx->webAlertAndQuit($_lang["error_no_id"]);
11
+    $modx->webAlertAndQuit($_lang["error_no_id"]);
12 12
 }
13 13
 
14 14
 // count duplicates
@@ -19,25 +19,25 @@  discard block
 block discarded – undo
19 19
 
20 20
 // duplicate Plugin
21 21
 $newid = $modx->db->insert(
22
-	array(
23
-		'name'=>'',
24
-		'description'=>'',
25
-		'disabled'=>'',
26
-		'moduleguid'=>'',
27
-		'plugincode'=>'',
28
-		'properties'=>'',
29
-		'category'=>'',
30
-		), $modx->getFullTableName('site_plugins'), // Insert into
31
-	"CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, '1' AS disabled, moduleguid, plugincode, properties, category", $modx->getFullTableName('site_plugins'), "id='{$id}'"); // Copy from
22
+    array(
23
+        'name'=>'',
24
+        'description'=>'',
25
+        'disabled'=>'',
26
+        'moduleguid'=>'',
27
+        'plugincode'=>'',
28
+        'properties'=>'',
29
+        'category'=>'',
30
+        ), $modx->getFullTableName('site_plugins'), // Insert into
31
+    "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, '1' AS disabled, moduleguid, plugincode, properties, category", $modx->getFullTableName('site_plugins'), "id='{$id}'"); // Copy from
32 32
 
33 33
 // duplicate Plugin Event Listeners
34 34
 $modx->db->insert(
35
-	array(
36
-		'pluginid'=>'',
37
-		'evtid'=>'',
38
-		'priority'=>'',
39
-		), $modx->getFullTableName('site_plugin_events'), // Insert into
40
-	"'{$newid}', evtid, priority", $modx->getFullTableName('site_plugin_events'), "pluginid='{$id}'"); // Copy from
35
+    array(
36
+        'pluginid'=>'',
37
+        'evtid'=>'',
38
+        'priority'=>'',
39
+        ), $modx->getFullTableName('site_plugin_events'), // Insert into
40
+    "'{$newid}', evtid, priority", $modx->getFullTableName('site_plugin_events'), "pluginid='{$id}'"); // Copy from
41 41
 
42 42
 // Set the item name for logger
43 43
 $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_plugins'), "id='{$newid}'"));
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,20 +1,20 @@  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_plugin')) {
5
+if (!$modx->hasPermission('new_plugin')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9
-$id = isset($_GET['id'])? (int)$_GET['id'] : 0;
10
-if($id==0) {
9
+$id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
10
+if ($id == 0) {
11 11
 	$modx->webAlertAndQuit($_lang["error_no_id"]);
12 12
 }
13 13
 
14 14
 // count duplicates
15 15
 $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_plugins'), "id='{$id}'"));
16 16
 $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_plugins'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'"));
17
-if($count>=1) $count = ' '.($count+1);
17
+if ($count >= 1) $count = ' '.($count + 1);
18 18
 else $count = '';
19 19
 
20 20
 // duplicate Plugin
@@ -44,5 +44,5 @@  discard block
 block discarded – undo
44 44
 $_SESSION['itemname'] = $name;
45 45
 
46 46
 // finish duplicating - redirect to new plugin
47
-$header="Location: index.php?r=2&a=102&id=$newid";
47
+$header = "Location: index.php?r=2&a=102&id=$newid";
48 48
 header($header);
Please login to merge, or discard this patch.
manager/processors/duplicate_tmplvars.processor.php 3 patches
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,11 @@
 block discarded – undo
14 14
 // count duplicates
15 15
 $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_tmplvars'), "id='{$id}'"));
16 16
 $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_tmplvars'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'"));
17
-if($count>=1) $count = ' '.($count+1);
18
-else $count = '';
17
+if($count>=1) {
18
+    $count = ' '.($count+1);
19
+} else {
20
+    $count = '';
21
+}
19 22
 
20 23
 // duplicate TV
21 24
 $newid = $modx->db->insert(
Please login to merge, or discard this patch.
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -3,12 +3,12 @@  discard block
 block discarded – undo
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
 if(!$modx->hasPermission('edit_template')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $id = isset($_GET['id'])? (int)$_GET['id'] : 0;
10 10
 if($id==0) {
11
-	$modx->webAlertAndQuit($_lang["error_no_id"]);
11
+    $modx->webAlertAndQuit($_lang["error_no_id"]);
12 12
 }
13 13
 
14 14
 // count duplicates
@@ -19,37 +19,37 @@  discard block
 block discarded – undo
19 19
 
20 20
 // duplicate TV
21 21
 $newid = $modx->db->insert(
22
-	array(
23
-		'type'=>'',
24
-		'name'=>'',
25
-		'caption'=>'',
26
-		'description'=>'',
27
-		'default_text'=>'',
28
-		'elements'=>'',
29
-		'rank'=>'',
30
-		'display'=>'',
31
-		'display_params'=>'',
32
-		'category'=>'',
33
-		), $modx->getFullTableName('site_tmplvars'), // Insert into
34
-	"type, CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, CONCAT(caption, ' Duplicate{$count}') AS caption, description, default_text, elements, rank, display, display_params, category", $modx->getFullTableName('site_tmplvars'), "id='{$id}'"); // Copy from
22
+    array(
23
+        'type'=>'',
24
+        'name'=>'',
25
+        'caption'=>'',
26
+        'description'=>'',
27
+        'default_text'=>'',
28
+        'elements'=>'',
29
+        'rank'=>'',
30
+        'display'=>'',
31
+        'display_params'=>'',
32
+        'category'=>'',
33
+        ), $modx->getFullTableName('site_tmplvars'), // Insert into
34
+    "type, CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, CONCAT(caption, ' Duplicate{$count}') AS caption, description, default_text, elements, rank, display, display_params, category", $modx->getFullTableName('site_tmplvars'), "id='{$id}'"); // Copy from
35 35
 
36 36
 
37 37
 // duplicate TV Template Access Permissions
38 38
 $modx->db->insert(
39
-	array(
40
-		'tmplvarid'=>'',
41
-		'templateid'=>'',
42
-		'rank'=>'',
43
-		), $modx->getFullTableName('site_tmplvar_templates'), // Insert into
44
-	"'{$newid}', templateid, rank", $modx->getFullTableName('site_tmplvar_templates'), "tmplvarid='{$id}'"); // Copy from
39
+    array(
40
+        'tmplvarid'=>'',
41
+        'templateid'=>'',
42
+        'rank'=>'',
43
+        ), $modx->getFullTableName('site_tmplvar_templates'), // Insert into
44
+    "'{$newid}', templateid, rank", $modx->getFullTableName('site_tmplvar_templates'), "tmplvarid='{$id}'"); // Copy from
45 45
 
46 46
 // duplicate TV Access Permissions
47 47
 $modx->db->insert(
48
-	array(
49
-		'tmplvarid'=>'',
50
-		'documentgroup'=>'',
51
-		), $modx->getFullTableName('site_tmplvar_access'), // Insert into
52
-	"'{$newid}', documentgroup", $modx->getFullTableName('site_tmplvar_access'), "tmplvarid='{$id}'"); // Copy from
48
+    array(
49
+        'tmplvarid'=>'',
50
+        'documentgroup'=>'',
51
+        ), $modx->getFullTableName('site_tmplvar_access'), // Insert into
52
+    "'{$newid}', documentgroup", $modx->getFullTableName('site_tmplvar_access'), "tmplvarid='{$id}'"); // Copy from
53 53
 
54 54
 // Set the item name for logger
55 55
 $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_tmplvars'), "id='{$newid}'"));
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,20 +1,20 @@  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('edit_template')) {
5
+if (!$modx->hasPermission('edit_template')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9
-$id = isset($_GET['id'])? (int)$_GET['id'] : 0;
10
-if($id==0) {
9
+$id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
10
+if ($id == 0) {
11 11
 	$modx->webAlertAndQuit($_lang["error_no_id"]);
12 12
 }
13 13
 
14 14
 // count duplicates
15 15
 $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_tmplvars'), "id='{$id}'"));
16 16
 $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_tmplvars'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'"));
17
-if($count>=1) $count = ' '.($count+1);
17
+if ($count >= 1) $count = ' '.($count + 1);
18 18
 else $count = '';
19 19
 
20 20
 // duplicate TV
@@ -56,5 +56,5 @@  discard block
 block discarded – undo
56 56
 $_SESSION['itemname'] = $name;
57 57
 
58 58
 // finish duplicating - redirect to new variable
59
-$header="Location: index.php?r=2&a=301&id=$newid";
59
+$header = "Location: index.php?r=2&a=301&id=$newid";
60 60
 header($header);
Please login to merge, or discard this patch.
manager/processors/remove_locks.processor.php 3 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,9 @@
 block discarded – undo
4 4
 }
5 5
 
6 6
 if(!isset($_GET['id'])) {
7
-	if(!$modx->hasPermission('remove_locks')) $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7
+	if(!$modx->hasPermission('remove_locks')) {
8
+	    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
9
+	}
8 10
 
9 11
 	// Remove all locks
10 12
 	$modx->db->truncate($modx->getFullTableName('active_user_locks'));
Please login to merge, or discard this patch.
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -4,23 +4,23 @@
 block discarded – undo
4 4
 }
5 5
 
6 6
 if(!isset($_GET['id'])) {
7
-	if(!$modx->hasPermission('remove_locks')) $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7
+    if(!$modx->hasPermission('remove_locks')) $modx->webAlertAndQuit($_lang["error_no_privileges"]);
8 8
 
9
-	// Remove all locks
10
-	$modx->db->truncate($modx->getFullTableName('active_user_locks'));
9
+    // Remove all locks
10
+    $modx->db->truncate($modx->getFullTableName('active_user_locks'));
11 11
 
12
-	$header = "Location: index.php?a=2";
13
-	header($header);
12
+    $header = "Location: index.php?a=2";
13
+    header($header);
14 14
 } else {
15
-	// Remove single locks via AJAX / window.onbeforeunload
16
-	$type = (int)$_GET['type'];
17
-	$id = (int)$_GET['id'];
18
-	$includeAllUsers = $modx->hasPermission('remove_locks'); // Enables usage of "unlock"-ajax-button
19
-	if($type && $id) {
20
-		$modx->unlockElement($type, $id, $includeAllUsers);
21
-		echo '1';
22
-		exit;
23
-	} else {
24
-		echo 'No type or id sent with request.';
25
-	}
15
+    // Remove single locks via AJAX / window.onbeforeunload
16
+    $type = (int)$_GET['type'];
17
+    $id = (int)$_GET['id'];
18
+    $includeAllUsers = $modx->hasPermission('remove_locks'); // Enables usage of "unlock"-ajax-button
19
+    if($type && $id) {
20
+        $modx->unlockElement($type, $id, $includeAllUsers);
21
+        echo '1';
22
+        exit;
23
+    } else {
24
+        echo 'No type or id sent with request.';
25
+    }
26 26
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  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
-if(!isset($_GET['id'])) {
7
-	if(!$modx->hasPermission('remove_locks')) $modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+if (!isset($_GET['id'])) {
7
+	if (!$modx->hasPermission('remove_locks')) $modx->webAlertAndQuit($_lang["error_no_privileges"]);
8 8
 
9 9
 	// Remove all locks
10 10
 	$modx->db->truncate($modx->getFullTableName('active_user_locks'));
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 	header($header);
14 14
 } else {
15 15
 	// Remove single locks via AJAX / window.onbeforeunload
16
-	$type = (int)$_GET['type'];
17
-	$id = (int)$_GET['id'];
16
+	$type = (int) $_GET['type'];
17
+	$id = (int) $_GET['id'];
18 18
 	$includeAllUsers = $modx->hasPermission('remove_locks'); // Enables usage of "unlock"-ajax-button
19
-	if($type && $id) {
19
+	if ($type && $id) {
20 20
 		$modx->unlockElement($type, $id, $includeAllUsers);
21 21
 		echo '1';
22 22
 		exit;
Please login to merge, or discard this patch.
manager/processors/web_access_groups.processor.php 3 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@
 block discarded – undo
117 117
 }
118 118
 
119 119
 // secure web documents - flag as private
120
-if($updategroupaccess==true){
120
+if($updategroupaccess==true) {
121 121
 	include MODX_MANAGER_PATH."includes/secure_web_documents.inc.php";
122 122
 	secureWebDocument();
123 123
 
Please login to merge, or discard this patch.
Indentation   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
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
 if(!$modx->hasPermission('web_access_permissions')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 // web access group processor.
@@ -20,111 +20,111 @@  discard block
 block discarded – undo
20 20
 $operation = $_REQUEST['operation'];
21 21
 
22 22
 switch ($operation) {
23
-	case "add_user_group" :
24
-		$newgroup = $_REQUEST['newusergroup'];
25
-		if(empty($newgroup)) {
26
-			$modx->webAlertAndQuit("No group name specified.");
27
-		} else {
28
-			$id = $modx->db->insert(array('name'=>$modx->db->escape($newgroup)), $tbl_webgroup_names);
23
+    case "add_user_group" :
24
+        $newgroup = $_REQUEST['newusergroup'];
25
+        if(empty($newgroup)) {
26
+            $modx->webAlertAndQuit("No group name specified.");
27
+        } else {
28
+            $id = $modx->db->insert(array('name'=>$modx->db->escape($newgroup)), $tbl_webgroup_names);
29 29
 
30
-			// invoke OnWebCreateGroup event
31
-			$modx->invokeEvent('OnWebCreateGroup', array(
32
-				'groupid'   => $id,
33
-				'groupname' => $newgroup,
34
-			));
35
-		}
36
-	break;
37
-	case "add_document_group" :
38
-		$newgroup = $_REQUEST['newdocgroup'];
39
-		if(empty($newgroup)) {
40
-			$modx->webAlertAndQuit("No group name specified.");
41
-		} else {
42
-			$id = $modx->db->insert(array('name'=>$modx->db->escape($newgroup)), $tbl_documentgroup_names);
30
+            // invoke OnWebCreateGroup event
31
+            $modx->invokeEvent('OnWebCreateGroup', array(
32
+                'groupid'   => $id,
33
+                'groupname' => $newgroup,
34
+            ));
35
+        }
36
+    break;
37
+    case "add_document_group" :
38
+        $newgroup = $_REQUEST['newdocgroup'];
39
+        if(empty($newgroup)) {
40
+            $modx->webAlertAndQuit("No group name specified.");
41
+        } else {
42
+            $id = $modx->db->insert(array('name'=>$modx->db->escape($newgroup)), $tbl_documentgroup_names);
43 43
 
44
-			// invoke OnCreateDocGroup event
45
-			$modx->invokeEvent('OnCreateDocGroup', array(
46
-				'groupid'   => $id,
47
-				'groupname' => $newgroup,
48
-			));
49
-		}
50
-	break;
51
-	case "delete_user_group" :
52
-		$updategroupaccess = true;
53
-		$usergroup = (int)$_REQUEST['usergroup'];
54
-		if(empty($usergroup)) {
55
-			$modx->webAlertAndQuit("No user group id specified for deletion.");
56
-		} else {
57
-			$modx->db->delete($tbl_webgroup_names, "id='{$usergroup}'");
44
+            // invoke OnCreateDocGroup event
45
+            $modx->invokeEvent('OnCreateDocGroup', array(
46
+                'groupid'   => $id,
47
+                'groupname' => $newgroup,
48
+            ));
49
+        }
50
+    break;
51
+    case "delete_user_group" :
52
+        $updategroupaccess = true;
53
+        $usergroup = (int)$_REQUEST['usergroup'];
54
+        if(empty($usergroup)) {
55
+            $modx->webAlertAndQuit("No user group id specified for deletion.");
56
+        } else {
57
+            $modx->db->delete($tbl_webgroup_names, "id='{$usergroup}'");
58 58
 
59
-			$modx->db->delete($tbl_webgroup_access, "webgroup='{$usergroup}'");
59
+            $modx->db->delete($tbl_webgroup_access, "webgroup='{$usergroup}'");
60 60
 
61
-			$modx->db->delete($tbl_web_groups, "webuser='{$usergroup}'");
62
-		}
63
-	break;
64
-	case "delete_document_group" :
65
-		$group = (int)$_REQUEST['documentgroup'];
66
-		if(empty($group)) {
67
-			$modx->webAlertAndQuit("No document group id specified for deletion.");
68
-		} else {
69
-			$modx->db->delete($tbl_documentgroup_names, "id='{$group}'");
61
+            $modx->db->delete($tbl_web_groups, "webuser='{$usergroup}'");
62
+        }
63
+    break;
64
+    case "delete_document_group" :
65
+        $group = (int)$_REQUEST['documentgroup'];
66
+        if(empty($group)) {
67
+            $modx->webAlertAndQuit("No document group id specified for deletion.");
68
+        } else {
69
+            $modx->db->delete($tbl_documentgroup_names, "id='{$group}'");
70 70
 
71
-			$modx->db->delete($tbl_webgroup_access, "documentgroup='{$group}'");
71
+            $modx->db->delete($tbl_webgroup_access, "documentgroup='{$group}'");
72 72
 
73
-			$modx->db->delete($tbl_document_groups, "document_group='{$group}'");
74
-		}
75
-	break;
76
-	case "rename_user_group" :
77
-		$newgroupname = $_REQUEST['newgroupname'];
78
-		if(empty($newgroupname)) {
79
-			$modx->webAlertAndQuit("No group name specified.");
80
-		}
81
-		$groupid = (int)$_REQUEST['groupid'];
82
-		if(empty($groupid)) {
83
-			$modx->webAlertAndQuit("No user group id specified for rename.");
84
-		}
85
-		$modx->db->update(array('name' => $modx->db->escape($newgroupname)), $tbl_webgroup_names, "id='{$groupid}'");
86
-	break;
87
-	case "rename_document_group" :
88
-		$newgroupname = $_REQUEST['newgroupname'];
89
-		if(empty($newgroupname)) {
90
-			$modx->webAlertAndQuit("No group name specified.");
91
-		}
92
-		$groupid = (int)$_REQUEST['groupid'];
93
-		if(empty($groupid)) {
94
-			$modx->webAlertAndQuit("No document group id specified for rename.");
95
-		}
96
-		$modx->db->update(array('name' => $modx->db->escape($newgroupname)), $tbl_documentgroup_names, "id='{$groupid}'");
97
-	break;
98
-	case "add_document_group_to_user_group" :
99
-		$updategroupaccess = true;
100
-		$usergroup = (int)$_REQUEST['usergroup'];
101
-		$docgroup = (int)$_REQUEST['docgroup'];
102
-		$rs = $modx->db->select('COUNT(*)', $tbl_webgroup_access, "webgroup='{$usergroup}' AND documentgroup='{$docgroup}'");
103
-		$limit = $modx->db->getValue($rs);
104
-		if($limit<=0) {
105
-			$modx->db->insert(array('webgroup'=>$usergroup, 'documentgroup'=>$docgroup), $tbl_webgroup_access);
106
-		} else {
107
-			//alert user that coupling already exists?
108
-		}
109
-	break;
110
-	case "remove_document_group_from_user_group" :
111
-		$updategroupaccess = true;
112
-		$coupling = (int)$_REQUEST['coupling'];
113
-		$modx->db->delete($tbl_webgroup_access, "id='{$coupling}'");
114
-	break;
115
-	default :
116
-		$modx->webAlertAndQuit("No operation set in request.");
73
+            $modx->db->delete($tbl_document_groups, "document_group='{$group}'");
74
+        }
75
+    break;
76
+    case "rename_user_group" :
77
+        $newgroupname = $_REQUEST['newgroupname'];
78
+        if(empty($newgroupname)) {
79
+            $modx->webAlertAndQuit("No group name specified.");
80
+        }
81
+        $groupid = (int)$_REQUEST['groupid'];
82
+        if(empty($groupid)) {
83
+            $modx->webAlertAndQuit("No user group id specified for rename.");
84
+        }
85
+        $modx->db->update(array('name' => $modx->db->escape($newgroupname)), $tbl_webgroup_names, "id='{$groupid}'");
86
+    break;
87
+    case "rename_document_group" :
88
+        $newgroupname = $_REQUEST['newgroupname'];
89
+        if(empty($newgroupname)) {
90
+            $modx->webAlertAndQuit("No group name specified.");
91
+        }
92
+        $groupid = (int)$_REQUEST['groupid'];
93
+        if(empty($groupid)) {
94
+            $modx->webAlertAndQuit("No document group id specified for rename.");
95
+        }
96
+        $modx->db->update(array('name' => $modx->db->escape($newgroupname)), $tbl_documentgroup_names, "id='{$groupid}'");
97
+    break;
98
+    case "add_document_group_to_user_group" :
99
+        $updategroupaccess = true;
100
+        $usergroup = (int)$_REQUEST['usergroup'];
101
+        $docgroup = (int)$_REQUEST['docgroup'];
102
+        $rs = $modx->db->select('COUNT(*)', $tbl_webgroup_access, "webgroup='{$usergroup}' AND documentgroup='{$docgroup}'");
103
+        $limit = $modx->db->getValue($rs);
104
+        if($limit<=0) {
105
+            $modx->db->insert(array('webgroup'=>$usergroup, 'documentgroup'=>$docgroup), $tbl_webgroup_access);
106
+        } else {
107
+            //alert user that coupling already exists?
108
+        }
109
+    break;
110
+    case "remove_document_group_from_user_group" :
111
+        $updategroupaccess = true;
112
+        $coupling = (int)$_REQUEST['coupling'];
113
+        $modx->db->delete($tbl_webgroup_access, "id='{$coupling}'");
114
+    break;
115
+    default :
116
+        $modx->webAlertAndQuit("No operation set in request.");
117 117
 }
118 118
 
119 119
 // secure web documents - flag as private
120 120
 if($updategroupaccess==true){
121
-	include MODX_MANAGER_PATH."includes/secure_web_documents.inc.php";
122
-	secureWebDocument();
121
+    include MODX_MANAGER_PATH."includes/secure_web_documents.inc.php";
122
+    secureWebDocument();
123 123
 
124
-	// Update the private group column
125
-	$modx->db->update(
126
-		'dgn.private_webgroup = (wga.webgroup IS NOT NULL)',
127
-		"{$tbl_documentgroup_names} AS dgn LEFT JOIN {$tbl_webgroup_access} AS wga ON wga.documentgroup = dgn.id");
124
+    // Update the private group column
125
+    $modx->db->update(
126
+        'dgn.private_webgroup = (wga.webgroup IS NOT NULL)',
127
+        "{$tbl_documentgroup_names} AS dgn LEFT JOIN {$tbl_webgroup_access} AS wga ON wga.documentgroup = dgn.id");
128 128
 }
129 129
 
130 130
 $header = "Location: index.php?a=91";
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 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('web_access_permissions')) {
5
+if (!$modx->hasPermission('web_access_permissions')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 switch ($operation) {
23 23
 	case "add_user_group" :
24 24
 		$newgroup = $_REQUEST['newusergroup'];
25
-		if(empty($newgroup)) {
25
+		if (empty($newgroup)) {
26 26
 			$modx->webAlertAndQuit("No group name specified.");
27 27
 		} else {
28 28
 			$id = $modx->db->insert(array('name'=>$modx->db->escape($newgroup)), $tbl_webgroup_names);
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	break;
37 37
 	case "add_document_group" :
38 38
 		$newgroup = $_REQUEST['newdocgroup'];
39
-		if(empty($newgroup)) {
39
+		if (empty($newgroup)) {
40 40
 			$modx->webAlertAndQuit("No group name specified.");
41 41
 		} else {
42 42
 			$id = $modx->db->insert(array('name'=>$modx->db->escape($newgroup)), $tbl_documentgroup_names);
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
 	break;
51 51
 	case "delete_user_group" :
52 52
 		$updategroupaccess = true;
53
-		$usergroup = (int)$_REQUEST['usergroup'];
54
-		if(empty($usergroup)) {
53
+		$usergroup = (int) $_REQUEST['usergroup'];
54
+		if (empty($usergroup)) {
55 55
 			$modx->webAlertAndQuit("No user group id specified for deletion.");
56 56
 		} else {
57 57
 			$modx->db->delete($tbl_webgroup_names, "id='{$usergroup}'");
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 		}
63 63
 	break;
64 64
 	case "delete_document_group" :
65
-		$group = (int)$_REQUEST['documentgroup'];
66
-		if(empty($group)) {
65
+		$group = (int) $_REQUEST['documentgroup'];
66
+		if (empty($group)) {
67 67
 			$modx->webAlertAndQuit("No document group id specified for deletion.");
68 68
 		} else {
69 69
 			$modx->db->delete($tbl_documentgroup_names, "id='{$group}'");
@@ -75,33 +75,33 @@  discard block
 block discarded – undo
75 75
 	break;
76 76
 	case "rename_user_group" :
77 77
 		$newgroupname = $_REQUEST['newgroupname'];
78
-		if(empty($newgroupname)) {
78
+		if (empty($newgroupname)) {
79 79
 			$modx->webAlertAndQuit("No group name specified.");
80 80
 		}
81
-		$groupid = (int)$_REQUEST['groupid'];
82
-		if(empty($groupid)) {
81
+		$groupid = (int) $_REQUEST['groupid'];
82
+		if (empty($groupid)) {
83 83
 			$modx->webAlertAndQuit("No user group id specified for rename.");
84 84
 		}
85 85
 		$modx->db->update(array('name' => $modx->db->escape($newgroupname)), $tbl_webgroup_names, "id='{$groupid}'");
86 86
 	break;
87 87
 	case "rename_document_group" :
88 88
 		$newgroupname = $_REQUEST['newgroupname'];
89
-		if(empty($newgroupname)) {
89
+		if (empty($newgroupname)) {
90 90
 			$modx->webAlertAndQuit("No group name specified.");
91 91
 		}
92
-		$groupid = (int)$_REQUEST['groupid'];
93
-		if(empty($groupid)) {
92
+		$groupid = (int) $_REQUEST['groupid'];
93
+		if (empty($groupid)) {
94 94
 			$modx->webAlertAndQuit("No document group id specified for rename.");
95 95
 		}
96 96
 		$modx->db->update(array('name' => $modx->db->escape($newgroupname)), $tbl_documentgroup_names, "id='{$groupid}'");
97 97
 	break;
98 98
 	case "add_document_group_to_user_group" :
99 99
 		$updategroupaccess = true;
100
-		$usergroup = (int)$_REQUEST['usergroup'];
101
-		$docgroup = (int)$_REQUEST['docgroup'];
100
+		$usergroup = (int) $_REQUEST['usergroup'];
101
+		$docgroup = (int) $_REQUEST['docgroup'];
102 102
 		$rs = $modx->db->select('COUNT(*)', $tbl_webgroup_access, "webgroup='{$usergroup}' AND documentgroup='{$docgroup}'");
103 103
 		$limit = $modx->db->getValue($rs);
104
-		if($limit<=0) {
104
+		if ($limit <= 0) {
105 105
 			$modx->db->insert(array('webgroup'=>$usergroup, 'documentgroup'=>$docgroup), $tbl_webgroup_access);
106 106
 		} else {
107 107
 			//alert user that coupling already exists?
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	break;
110 110
 	case "remove_document_group_from_user_group" :
111 111
 		$updategroupaccess = true;
112
-		$coupling = (int)$_REQUEST['coupling'];
112
+		$coupling = (int) $_REQUEST['coupling'];
113 113
 		$modx->db->delete($tbl_webgroup_access, "id='{$coupling}'");
114 114
 	break;
115 115
 	default :
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 }
118 118
 
119 119
 // secure web documents - flag as private
120
-if($updategroupaccess==true){
120
+if ($updategroupaccess == true) {
121 121
 	include MODX_MANAGER_PATH."includes/secure_web_documents.inc.php";
122 122
 	secureWebDocument();
123 123
 
Please login to merge, or discard this patch.