Completed
Pull Request — develop (#725)
by Agel_Nash
08:07
created
manager/processors/save_user.processor.php 1 patch
Spacing   +45 added lines, -45 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('save_user')) {
5
+if (!$modx->hasPermission('save_user')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
 $input = $_POST;
14 14
 
15
-$id = (int)$input['id'];
15
+$id = (int) $input['id'];
16 16
 $oldusername = $input['oldusername'];
17 17
 $newusername = !empty ($input['newusername']) ? trim($input['newusername']) : "New User";
18 18
 $fullname = $input['fullname'];
@@ -42,56 +42,56 @@  discard block
 block discarded – undo
42 42
 $user_groups = $input['user_groups'];
43 43
 
44 44
 // verify password
45
-if($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) {
45
+if ($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) {
46 46
 	webAlertAndQuit("Password typed is mismatched", 12);
47 47
 }
48 48
 
49 49
 // verify email
50
-if($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) {
50
+if ($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) {
51 51
 	webAlertAndQuit("E-mail address doesn't seem to be valid!", 12);
52 52
 }
53 53
 
54 54
 // verify admin security
55
-if($_SESSION['mgrRole'] != 1) {
55
+if ($_SESSION['mgrRole'] != 1) {
56 56
 	// Check to see if user tried to spoof a "1" (admin) role
57
-	if(!$modx->hasPermission('save_user')) {
57
+	if (!$modx->hasPermission('save_user')) {
58 58
 		webAlertAndQuit("Illegal attempt to create/modify administrator by non-administrator!", 12);
59 59
 	}
60 60
 	// Verify that the user being edited wasn't an admin and the user ID got spoofed
61 61
 	$rs = $modx->getDatabase()->select('count(internalKey)', $tbl_user_attributes, "internalKey='{$id}' AND role=1");
62 62
 	$limit = $modx->getDatabase()->getValue($rs);
63
-	if($limit > 0) {
63
+	if ($limit > 0) {
64 64
 		webAlertAndQuit("You cannot alter an administrative user.", 12);
65 65
 	}
66 66
 
67 67
 }
68 68
 
69
-switch($input['mode']) {
69
+switch ($input['mode']) {
70 70
 	case '11' : // new user
71 71
 		// check if this user name already exist
72 72
 		$rs = $modx->getDatabase()->select('count(id)', $tbl_manager_users, sprintf("username='%s'", $modx->getDatabase()->escape($newusername)));
73 73
 		$limit = $modx->getDatabase()->getValue($rs);
74
-		if($limit > 0) {
74
+		if ($limit > 0) {
75 75
 			webAlertAndQuit("User name is already in use!", 12);
76 76
 		}
77 77
 
78 78
 		// check if the email address already exist
79 79
 		$rs = $modx->getDatabase()->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND id!='%s'", $modx->getDatabase()->escape($email), $id));
80 80
 		$limit = $modx->getDatabase()->getValue($rs);
81
-		if($limit > 0) {
81
+		if ($limit > 0) {
82 82
 			webAlertAndQuit("Email is already in use!", 12);
83 83
 		}
84 84
 
85 85
 		// generate a new password for this user
86
-		if($specifiedpassword != "" && $passwordgenmethod == "spec") {
87
-			if(strlen($specifiedpassword) < 6) {
86
+		if ($specifiedpassword != "" && $passwordgenmethod == "spec") {
87
+			if (strlen($specifiedpassword) < 6) {
88 88
 				webAlertAndQuit("Password is too short!", 12);
89 89
 			} else {
90 90
 				$newpassword = $specifiedpassword;
91 91
 			}
92
-		} elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
92
+		} elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") {
93 93
 			webAlertAndQuit("You didn't specify a password for this user!", 12);
94
-		} elseif($passwordgenmethod == 'g') {
94
+		} elseif ($passwordgenmethod == 'g') {
95 95
 			$newpassword = generate_password(8);
96 96
 		} else {
97 97
 			webAlertAndQuit("No password generation method specified!", 12);
@@ -139,11 +139,11 @@  discard block
 block discarded – undo
139 139
 		/*******************************************************************************/
140 140
 		// put the user in the user_groups he/ she should be in
141 141
 		// first, check that up_perms are switched on!
142
-		if($use_udperms == 1) {
143
-			if(!empty($user_groups)) {
144
-				for($i = 0; $i < count($user_groups); $i++) {
142
+		if ($use_udperms == 1) {
143
+			if (!empty($user_groups)) {
144
+				for ($i = 0; $i < count($user_groups); $i++) {
145 145
 					$f = array();
146
-					$f['user_group'] = (int)$user_groups[$i];
146
+					$f['user_group'] = (int) $user_groups[$i];
147 147
 					$f['member'] = $internalKey;
148 148
 					$modx->getDatabase()->insert($f, $tbl_member_groups);
149 149
 				}
@@ -151,20 +151,20 @@  discard block
 block discarded – undo
151 151
 		}
152 152
 		// end of user_groups stuff!
153 153
 
154
-		if($passwordnotifymethod == 'e') {
154
+		if ($passwordnotifymethod == 'e') {
155 155
             sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL);
156
-			if($input['stay'] != '') {
156
+			if ($input['stay'] != '') {
157 157
 				$a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11";
158
-				$header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
158
+				$header = "Location: index.php?a={$a}&r=2&stay=".$input['stay'];
159 159
 				header($header);
160 160
 			} else {
161 161
 				$header = "Location: index.php?a=75&r=2";
162 162
 				header($header);
163 163
 			}
164 164
 		} else {
165
-			if($input['stay'] != '') {
165
+			if ($input['stay'] != '') {
166 166
 				$a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11";
167
-				$stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
167
+				$stayUrl = "index.php?a={$a}&r=2&stay=".$input['stay'];
168 168
 			} else {
169 169
 				$stayUrl = "index.php?a=75&r=2";
170 170
 			}
@@ -197,36 +197,36 @@  discard block
 block discarded – undo
197 197
 		break;
198 198
 	case '12' : // edit user
199 199
 		// generate a new password for this user
200
-		if($genpassword == 1) {
201
-			if($specifiedpassword != "" && $passwordgenmethod == "spec") {
202
-				if(strlen($specifiedpassword) < 6) {
200
+		if ($genpassword == 1) {
201
+			if ($specifiedpassword != "" && $passwordgenmethod == "spec") {
202
+				if (strlen($specifiedpassword) < 6) {
203 203
 					webAlertAndQuit("Password is too short!", 12);
204 204
 				} else {
205 205
 					$newpassword = $specifiedpassword;
206 206
 				}
207
-			} elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
207
+			} elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") {
208 208
 				webAlertAndQuit("You didn't specify a password for this user!", 12);
209
-			} elseif($passwordgenmethod == 'g') {
209
+			} elseif ($passwordgenmethod == 'g') {
210 210
 				$newpassword = generate_password(8);
211 211
 			} else {
212 212
 				webAlertAndQuit("No password generation method specified!", 12);
213 213
 			}
214 214
 		}
215
-		if($passwordnotifymethod == 'e') {
215
+		if ($passwordnotifymethod == 'e') {
216 216
             sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL);
217 217
 		}
218 218
 
219 219
 		// check if the username already exist
220 220
 		$rs = $modx->getDatabase()->select('count(id)', $tbl_manager_users, sprintf("username='%s' AND id!='%s'", $modx->getDatabase()->escape($newusername), $id));
221 221
 		$limit = $modx->getDatabase()->getValue($rs);
222
-		if($limit > 0) {
222
+		if ($limit > 0) {
223 223
 			webAlertAndQuit("User name is already in use!", 12);
224 224
 		}
225 225
 
226 226
 		// check if the email address already exists
227 227
 		$rs = $modx->getDatabase()->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND internalKey!='%s'", $modx->getDatabase()->escape($email), $id));
228 228
 		$limit = $modx->getDatabase()->getValue($rs);
229
-		if($limit > 0) {
229
+		if ($limit > 0) {
230 230
 			webAlertAndQuit("Email is already in use!", 12);
231 231
 		}
232 232
 
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 		// update user name and password
240 240
 		$field = array();
241 241
 		$field['username'] = $modx->getDatabase()->escape($newusername);
242
-		if($genpassword == 1) {
242
+		if ($genpassword == 1) {
243 243
 			$field['password'] = $modx->getPasswordHash()->HashPassword($newpassword);
244 244
 		}
245 245
 		$modx->getDatabase()->update($field, $tbl_manager_users, "id='{$id}'");
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 		));
268 268
 
269 269
 		// invoke OnManagerChangePassword event
270
-		if($genpassword == 1) {
270
+		if ($genpassword == 1) {
271 271
 			$modx->invokeEvent("OnManagerChangePassword", array(
272 272
 				"userid" => $id,
273 273
 				"username" => $newusername,
@@ -284,13 +284,13 @@  discard block
 block discarded – undo
284 284
 		/*******************************************************************************/
285 285
 		// put the user in the user_groups he/ she should be in
286 286
 		// first, check that up_perms are switched on!
287
-		if($use_udperms == 1) {
287
+		if ($use_udperms == 1) {
288 288
 			// as this is an existing user, delete his/ her entries in the groups before saving the new groups
289 289
 			$modx->getDatabase()->delete($tbl_member_groups, "member='{$id}'");
290
-			if(!empty($user_groups)) {
291
-				for($i = 0; $i < count($user_groups); $i++) {
290
+			if (!empty($user_groups)) {
291
+				for ($i = 0; $i < count($user_groups); $i++) {
292 292
 					$field = array();
293
-					$field['user_group'] = (int)$user_groups[$i];
293
+					$field['user_group'] = (int) $user_groups[$i];
294 294
 					$field['member'] = $id;
295 295
 					$modx->getDatabase()->insert($field, $tbl_member_groups);
296 296
 				}
@@ -298,13 +298,13 @@  discard block
 block discarded – undo
298 298
 		}
299 299
 		// end of user_groups stuff!
300 300
 		/*******************************************************************************/
301
-		if($id == $modx->getLoginUserID() && ($genpassword !== 1 && $passwordnotifymethod != 's')) {
301
+		if ($id == $modx->getLoginUserID() && ($genpassword !== 1 && $passwordnotifymethod != 's')) {
302 302
 			$modx->webAlertAndQuit($_lang["user_changeddata"], 'javascript:top.location.href="index.php?a=8";');
303 303
 		}
304
-		if($genpassword == 1 && $passwordnotifymethod == 's') {
305
-			if($input['stay'] != '') {
304
+		if ($genpassword == 1 && $passwordnotifymethod == 's') {
305
+			if ($input['stay'] != '') {
306 306
 				$a = ($input['stay'] == '2') ? "12&id={$id}" : "11";
307
-				$stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
307
+				$stayUrl = "index.php?a={$a}&r=2&stay=".$input['stay'];
308 308
 			} else {
309 309
 				$stayUrl = "index.php?a=75&r=2";
310 310
 			}
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 				<div class="sectionHeader"><?php echo $_lang['user_title']; ?></div>
325 325
 				<div class="sectionBody">
326 326
 					<div id="disp">
327
-						<p><?php echo sprintf($_lang["password_msg"], $modx->getPhpCompat()->htmlspecialchars($newusername), $modx->getPhpCompat()->htmlspecialchars($newpassword)) . (($id == $modx->getLoginUserID()) ? ' ' . $_lang['user_changeddata'] : ''); ?></p>
327
+						<p><?php echo sprintf($_lang["password_msg"], $modx->getPhpCompat()->htmlspecialchars($newusername), $modx->getPhpCompat()->htmlspecialchars($newpassword)).(($id == $modx->getLoginUserID()) ? ' '.$_lang['user_changeddata'] : ''); ?></p>
328 328
 					</div>
329 329
 				</div>
330 330
 			</div>
@@ -332,9 +332,9 @@  discard block
 block discarded – undo
332 332
 
333 333
 			include_once "footer.inc.php";
334 334
 		} else {
335
-			if($input['stay'] != '') {
335
+			if ($input['stay'] != '') {
336 336
 				$a = ($input['stay'] == '2') ? "12&id={$id}" : "11";
337
-				$header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
337
+				$header = "Location: index.php?a={$a}&r=2&stay=".$input['stay'];
338 338
 				header($header);
339 339
 			} else {
340 340
 				$header = "Location: index.php?a=75&r=2";
Please login to merge, or discard this patch.
manager/processors/export_site.processor.php 1 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
 
@@ -10,15 +10,15 @@  discard block
 block discarded – undo
10 10
 @set_time_limit($maxtime);
11 11
 
12 12
 
13
-if(is_dir(MODX_BASE_PATH . 'temp'))       $export_dir = MODX_BASE_PATH . 'temp/export';
14
-elseif(is_dir(MODX_BASE_PATH . 'assets')) $export_dir = MODX_BASE_PATH . 'assets/export';
13
+if (is_dir(MODX_BASE_PATH.'temp'))       $export_dir = MODX_BASE_PATH.'temp/export';
14
+elseif (is_dir(MODX_BASE_PATH.'assets')) $export_dir = MODX_BASE_PATH.'assets/export';
15 15
 $modx->getExportSite()->targetDir = $export_dir;
16 16
 
17
-if(strpos($modx->config['base_path'],"{$export_dir}/")===0 && 0 <= strlen(str_replace("{$export_dir}/",'',$modx->config['base_path'])))
17
+if (strpos($modx->config['base_path'], "{$export_dir}/") === 0 && 0 <= strlen(str_replace("{$export_dir}/", '', $modx->config['base_path'])))
18 18
 	return $_lang['export_site.static.php6'];
19
-elseif($modx->config['rb_base_dir'] === $export_dir . '/')
20
-	return $modx->parsePlaceholder($_lang['export_site.static.php7'],'rb_base_url=' . $modx->config['base_url'] . $modx->config['rb_base_url']);
21
-elseif(!is_writable($export_dir))
19
+elseif ($modx->config['rb_base_dir'] === $export_dir.'/')
20
+	return $modx->parsePlaceholder($_lang['export_site.static.php7'], 'rb_base_url='.$modx->config['base_url'].$modx->config['rb_base_url']);
21
+elseif (!is_writable($export_dir))
22 22
 	return $_lang['export_site_target_unwritable'];
23 23
 
24 24
 $modx->getExportSite()->generate_mode = $_POST['generate_mode'];
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
 $repl_after      = $_POST['repl_after'];
32 32
 $includenoncache = $_POST['includenoncache'];
33 33
 
34
-if($ignore_ids!==$_POST['ignore_ids']
35
- ||$includenoncache!==$_POST['includenoncache']
36
- ||$repl_before!==$_POST['repl_before']
37
- ||$repl_after !==$_POST['repl_after']) {
34
+if ($ignore_ids !== $_POST['ignore_ids']
35
+ ||$includenoncache !== $_POST['includenoncache']
36
+ ||$repl_before !== $_POST['repl_before']
37
+ ||$repl_after !== $_POST['repl_after']) {
38 38
 	$modx->clearCache('full');
39 39
 }
40 40
 
@@ -50,5 +50,5 @@  discard block
 block discarded – undo
50 50
 
51 51
 $exportend = $modx->getExportSite()->get_mtime();
52 52
 $totaltime = ($exportend - $modx->getExportSite()->exportstart);
53
-$output .= sprintf ('<p>'.$_lang["export_site_time"].'</p>', round($totaltime, 3));
53
+$output .= sprintf('<p>'.$_lang["export_site_time"].'</p>', round($totaltime, 3));
54 54
 return $output;
Please login to merge, or discard this patch.
manager/processors/delete_tmplvars.processor.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,24 +1,24 @@  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('delete_template')) {
5
+if (!$modx->hasPermission('delete_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
 $forced = isset($_GET['force']) ? $_GET['force'] : 0;
15 15
 
16 16
 // check for relations
17
-if(!$forced) {
18
-	$drs = $modx->getDatabase()->select('sc.id, sc.pagetitle,sc.description', $modx->getFullTableName('site_content') . " AS sc
19
-			INNER JOIN " . $modx->getFullTableName('site_tmplvar_contentvalues') . " AS stcv ON stcv.contentid=sc.id", "stcv.tmplvarid='{$id}'");
17
+if (!$forced) {
18
+	$drs = $modx->getDatabase()->select('sc.id, sc.pagetitle,sc.description', $modx->getFullTableName('site_content')." AS sc
19
+			INNER JOIN " . $modx->getFullTableName('site_tmplvar_contentvalues')." AS stcv ON stcv.contentid=sc.id", "stcv.tmplvarid='{$id}'");
20 20
 	$count = $modx->getDatabase()->getRecordCount($drs);
21
-	if($count > 0) {
21
+	if ($count > 0) {
22 22
 		include_once "header.inc.php";
23 23
 		?>
24 24
 		<script>
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 				<p><?= $_lang['tmplvar_inuse'] ?></p>
43 43
 				<ul>
44 44
 					<?php
45
-					while($row = $modx->getDatabase()->getRow($drs)) {
46
-						echo '<li><span style="width: 200px"><a href="index.php?id=' . $row['id'] . '&a=27">' . $row['pagetitle'] . '</a></span>' . ($row['description'] != '' ? ' - ' . $row['description'] : '') . '</li>';
45
+					while ($row = $modx->getDatabase()->getRow($drs)) {
46
+						echo '<li><span style="width: 200px"><a href="index.php?id='.$row['id'].'&a=27">'.$row['pagetitle'].'</a></span>'.($row['description'] != '' ? ' - '.$row['description'] : '').'</li>';
47 47
 					}
48 48
 					?>
49 49
 				</ul>
Please login to merge, or discard this patch.
manager/processors/delete_message.processor.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 if (!$modx->hasPermission('messages')) {
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
 
@@ -18,12 +18,12 @@  discard block
 block discarded – undo
18 18
     $modx->webAlertAndQuit("Wrong number of messages returned!");
19 19
 }
20 20
 
21
-if ($message['recipient']!=$modx->getLoginUserID()) {
21
+if ($message['recipient'] != $modx->getLoginUserID()) {
22 22
     $modx->webAlertAndQuit("You are not allowed to delete this message!");
23 23
 }
24 24
 
25 25
 // delete message
26 26
 $modx->getDatabase()->delete($modx->getFullTableName('user_messages'), "id='{$id}'");
27 27
 
28
-$header="Location: index.php?a=10";
28
+$header = "Location: index.php?a=10";
29 29
 header($header);
Please login to merge, or discard this patch.
manager/processors/duplicate_module.processor.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,19 +1,19 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5
-if(!$modx->hasPermission('new_module')) {
5
+if (!$modx->hasPermission('new_module')) {
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
 // count duplicates
14 14
 $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getFullTableName('site_modules'), "id='{$id}'"));
15 15
 $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('name', $modx->getFullTableName('site_modules'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'"));
16
-if($count>=1) $count = ' '.($count+1);
16
+if ($count >= 1) $count = ' '.($count + 1);
17 17
 else $count = '';
18 18
 
19 19
 // duplicate module
@@ -58,5 +58,5 @@  discard block
 block discarded – undo
58 58
 $_SESSION['itemname'] = $name;
59 59
 
60 60
 // finish duplicating - redirect to new module
61
-$header="Location: index.php?r=2&a=108&id=$newid";
61
+$header = "Location: index.php?r=2&a=108&id=$newid";
62 62
 header($header);
Please login to merge, or discard this patch.
manager/processors/save_module.processor.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  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
 if (!$modx->hasPermission('save_module')) {
6 6
     $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9
-$id = (int)$_POST['id'];
9
+$id = (int) $_POST['id'];
10 10
 $name = $modx->getDatabase()->escape(trim($_POST['name']));
11 11
 $description = $modx->getDatabase()->escape($_POST['description']);
12 12
 $resourcefile = $modx->getDatabase()->escape($_POST['resourcefile']);
@@ -25,11 +25,11 @@  discard block
 block discarded – undo
25 25
 
26 26
 //Kyle Jaebker - added category support
27 27
 if (empty($_POST['newcategory']) && $_POST['categoryid'] > 0) {
28
-    $categoryid = (int)$_POST['categoryid'];
28
+    $categoryid = (int) $_POST['categoryid'];
29 29
 } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) {
30 30
     $categoryid = 0;
31 31
 } else {
32
-    include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
32
+    include_once(MODX_MANAGER_PATH.'includes/categories.inc.php');
33 33
     $categoryid = checkCategory($_POST['newcategory']);
34 34
     if (!$categoryid) {
35 35
         $categoryid = newCategory($_POST['newcategory']);
@@ -45,15 +45,15 @@  discard block
 block discarded – undo
45 45
     $name = isset($parsed['name']) ? $parsed['name'] : $name;
46 46
     $properties = isset($parsed['properties']) ? $parsed['properties'] : $properties;
47 47
     $guid = isset($parsed['guid']) ? $parsed['guid'] : $guid;
48
-    $enable_sharedparams = isset($parsed['shareparams']) ? (int)$parsed['shareparams'] : $enable_sharedparams;
48
+    $enable_sharedparams = isset($parsed['shareparams']) ? (int) $parsed['shareparams'] : $enable_sharedparams;
49 49
 
50 50
     $description = isset($parsed['description']) ? $parsed['description'] : $description;
51
-    $version = isset($parsed['version']) ? '<b>' . $parsed['version'] . '</b> ' : '';
51
+    $version = isset($parsed['version']) ? '<b>'.$parsed['version'].'</b> ' : '';
52 52
     if ($version) {
53
-        $description = $version . trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description));
53
+        $description = $version.trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description));
54 54
     }
55 55
     if (isset($parsed['modx_category'])) {
56
-        include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
56
+        include_once(MODX_MANAGER_PATH.'includes/categories.inc.php');
57 57
         $categoryid = getCategory($parsed['modx_category']);
58 58
     }
59 59
 }
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
         // finished emptying cache - redirect
112 112
         if ($_POST['stay'] != '') {
113 113
             $a = ($_POST['stay'] == '2') ? "108&id=$newid" : "107";
114
-            $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'];
114
+            $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay'];
115 115
             header($header);
116 116
         } else {
117 117
             $header = "Location: index.php?a=106&r=2";
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
         // finished emptying cache - redirect
169 169
         if ($_POST['stay'] != '') {
170 170
             $a = ($_POST['stay'] == '2') ? "108&id=$id" : "107";
171
-            $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'];
171
+            $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay'];
172 172
             header($header);
173 173
         } else {
174 174
             $modx->unlockElement(6, $id);
Please login to merge, or discard this patch.
manager/processors/save_password.processor.php 1 patch
Spacing   +7 added lines, -7 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('save_password')) {
5
+if (!$modx->hasPermission('save_password')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
10 10
 $pass1 = $_POST['pass1'];
11 11
 $pass2 = $_POST['pass2'];
12 12
 
13
-if($pass1!=$pass2){
13
+if ($pass1 != $pass2) {
14 14
 	$modx->webAlertAndQuit("Passwords don't match!");
15 15
 }
16 16
 
17
-if(strlen($pass1)<6){
17
+if (strlen($pass1) < 6) {
18 18
 	$modx->webAlertAndQuit("Password is too short. Please specify a password of at least 6 characters.");
19 19
 }
20 20
 
@@ -22,14 +22,14 @@  discard block
 block discarded – undo
22 22
 	$tbl_manager_users = $modx->getFullTableName('manager_users');
23 23
 	$uid = $modx->getLoginUserID();
24 24
 	$f['password'] = $modx->getPasswordHash()->HashPassword($pass1);
25
-	$modx->getDatabase()->update($f,$tbl_manager_users,"id='{$uid}'");
25
+	$modx->getDatabase()->update($f, $tbl_manager_users, "id='{$uid}'");
26 26
 
27 27
 	// invoke OnManagerChangePassword event
28
-	$modx->invokeEvent('OnManagerChangePassword', array (
28
+	$modx->invokeEvent('OnManagerChangePassword', array(
29 29
 		'userid' => $uid,
30 30
 		'username' => $_SESSION['mgrShortname'],
31 31
 		'userpassword' => $pass1
32 32
 	));
33 33
 
34
-$header="Location: index.php?a=2";
34
+$header = "Location: index.php?a=2";
35 35
 header($header);
Please login to merge, or discard this patch.
manager/processors/access_groups.processor.php 1 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('access_permissions')) {
5
+if (!$modx->hasPermission('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->getDatabase()->insert(array('name' => $modx->getDatabase()->escape($newgroup)), $tbl_membergroup_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->getDatabase()->insert(array('name' => $modx->getDatabase()->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->getDatabase()->delete($tbl_membergroup_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->getDatabase()->delete($tbl_documentgroup_names, "id='{$group}'");
@@ -75,11 +75,11 @@  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 group id specified for rename.");
84 84
 		}
85 85
 
@@ -87,11 +87,11 @@  discard block
 block discarded – undo
87 87
 	break;
88 88
 	case "rename_document_group" :
89 89
 		$newgroupname = $_REQUEST['newgroupname'];
90
-		if(empty($newgroupname)) {
90
+		if (empty($newgroupname)) {
91 91
 			$modx->webAlertAndQuit("No group name specified.");
92 92
 		}
93
-		$groupid = (int)$_REQUEST['groupid'];
94
-		if(empty($groupid)) {
93
+		$groupid = (int) $_REQUEST['groupid'];
94
+		if (empty($groupid)) {
95 95
 			$modx->webAlertAndQuit("No group id specified for rename.");
96 96
 		}
97 97
 
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
 	break;
100 100
 	case "add_document_group_to_user_group" :
101 101
 		$updategroupaccess = true;
102
-		$usergroup = (int)$_REQUEST['usergroup'];
103
-		$docgroup = (int)$_REQUEST['docgroup'];
102
+		$usergroup = (int) $_REQUEST['usergroup'];
103
+		$docgroup = (int) $_REQUEST['docgroup'];
104 104
 		$rs = $modx->getDatabase()->select('COUNT(*)', $tbl_membergroup_access, "membergroup='{$usergroup}' AND documentgroup='{$docgroup}'");
105 105
 		$limit = $modx->getDatabase()->getValue($rs);
106
-		if($limit<=0) {
106
+		if ($limit <= 0) {
107 107
 			$modx->getDatabase()->insert(array('membergroup' => $usergroup, 'documentgroup' => $docgroup), $tbl_membergroup_access);
108 108
 		} else {
109 109
 			//alert user that coupling already exists?
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	break;
112 112
 	case "remove_document_group_from_user_group" :
113 113
 		$updategroupaccess = true;
114
-		$coupling = (int)$_REQUEST['coupling'];
114
+		$coupling = (int) $_REQUEST['coupling'];
115 115
 		$modx->getDatabase()->delete($tbl_membergroup_access, "id='{$coupling}'");
116 116
 	break;
117 117
 	default :
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 }
120 120
 
121 121
 // secure manager documents - flag as private
122
-if($updategroupaccess==true){
122
+if ($updategroupaccess == true) {
123 123
 	include MODX_MANAGER_PATH."includes/secure_mgr_documents.inc.php";
124 124
 	secureMgrDocument();
125 125
 
Please login to merge, or discard this patch.
manager/processors/save_content.processor.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
         case 'new' :
278 278
 
279 279
             // invoke OnBeforeDocFormSave event
280
-            switch($modx->config['docid_incrmnt_method'])
280
+            switch ($modx->config['docid_incrmnt_method'])
281 281
             {
282 282
             case '1':
283 283
                 $from = "{$tbl_site_content} AS T0 LEFT JOIN {$tbl_site_content} AS T1 ON T0.id + 1 = T1.id";
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
             if (!$was_published && $published) {
489 489
                 $publishedon = $currentdate;
490 490
                 $publishedby = $modx->getLoginUserID();
491
-                }elseif ((!empty($pub_date)&& $pub_date<=$currentdate && $published)) {
491
+                }elseif ((!empty($pub_date) && $pub_date <= $currentdate && $published)) {
492 492
                 $publishedon = $pub_date;
493 493
                 $publishedby = $modx->getLoginUserID();
494 494
                    }elseif ($was_published && !$published) {
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
             }
501 501
 
502 502
             // invoke OnBeforeDocFormSave event
503
-            $modx->invokeEvent("OnBeforeDocFormSave", array (
503
+            $modx->invokeEvent("OnBeforeDocFormSave", array(
504 504
                 "mode" => "upd",
505 505
                 "id" => $id
506 506
             ));
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
                 . "menuindex={$menuindex}, "
526 526
                 . "searchable={$searchable}, "
527 527
                 . "cacheable={$cacheable}, "
528
-                . "editedby=" . $modx->getLoginUserID() . ", "
528
+                . "editedby=".$modx->getLoginUserID().", "
529 529
                 . "editedon={$currentdate}, "
530 530
                 . "publishedon={$publishedon}, "
531 531
                 . "publishedby={$publishedby}, "
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
 
540 540
             // update template variables
541 541
             $rs = $modx->getDatabase()->select('id, tmplvarid', $tbl_site_tmplvar_contentvalues, "contentid='{$id}'");
542
-            $tvIds = array ();
542
+            $tvIds = array();
543 543
             while ($row = $modx->getDatabase()->getRow($rs)) {
544 544
                 $tvIds[$row['tmplvarid']] = $row['id'];
545 545
             }
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
                     'groups.id, groups.document_group',
593 593
                     "{$tbl_document_groups} AS groups
594 594
                     LEFT JOIN {$tbl_documentgroup_names} AS dgn ON dgn.id = groups.document_group",
595
-                    "((1=".(int)$isManager." AND dgn.private_memgroup) OR (1=".(int)$isWeb." AND dgn.private_webgroup)) AND groups.document = '{$id}'"
595
+                    "((1=".(int) $isManager." AND dgn.private_memgroup) OR (1=".(int) $isWeb." AND dgn.private_webgroup)) AND groups.document = '{$id}'"
596 596
                     );
597 597
                 $old_groups = array();
598 598
                 while ($row = $modx->getDatabase()->getRow($rs)) $old_groups[$row['document_group']] = $row['id'];
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
                         unset($old_groups[$group]);
605 605
                         continue;
606 606
                     } elseif ($link_id == 'new') {
607
-                        $insertions[] = '('.(int)$group.','.$id.')';
607
+                        $insertions[] = '('.(int) $group.','.$id.')';
608 608
                     }
609 609
                 }
610 610
                 if (!empty($insertions)) {
@@ -636,17 +636,17 @@  discard block
 block discarded – undo
636 636
 
637 637
 
638 638
             // invoke OnDocFormSave event
639
-            $modx->invokeEvent("OnDocFormSave", array (
639
+            $modx->invokeEvent("OnDocFormSave", array(
640 640
                 "mode" => "upd",
641 641
                 "id" => $id
642 642
             ));
643 643
 
644 644
             // secure web documents - flag as private
645
-            include MODX_MANAGER_PATH . "includes/secure_web_documents.inc.php";
645
+            include MODX_MANAGER_PATH."includes/secure_web_documents.inc.php";
646 646
             secureWebDocument($id);
647 647
 
648 648
             // secure manager documents - flag as private
649
-            include MODX_MANAGER_PATH . "includes/secure_mgr_documents.inc.php";
649
+            include MODX_MANAGER_PATH."includes/secure_mgr_documents.inc.php";
650 650
             secureMgrDocument($id);
651 651
 
652 652
             // Set the item name for logger
@@ -672,13 +672,13 @@  discard block
 block discarded – undo
672 672
                         // document
673 673
                         $a = ($_POST['stay'] == '2') ? "27&id=$id" : "4&pid=$parent";
674 674
                     }
675
-                    $header = "Location: index.php?a=" . $a . "&r=1&stay=" . $_POST['stay'].$add_path;
675
+                    $header = "Location: index.php?a=".$a."&r=1&stay=".$_POST['stay'].$add_path;
676 676
                 } else {
677 677
                     $header = "Location: index.php?a=3&id=$id&r=1".$add_path;
678 678
                 }
679 679
             }
680 680
             if (headers_sent()) {
681
-                $header = str_replace('Location: ','',$header);
681
+                $header = str_replace('Location: ', '', $header);
682 682
                 echo "<script>document.location.href='$header';</script>\n";
683 683
             } else {
684 684
                 header($header);
Please login to merge, or discard this patch.