Completed
Push — develop ( 8dee05 )
by Dmytro
20:08
created
manager/processors/duplicate_htmlsnippet.processor.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,12 +3,12 @@
 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_chunk')) {
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
Please login to merge, or discard this patch.
manager/processors/save_user.processor.php 1 patch
Indentation   +205 added lines, -205 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('save_user')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $input = $_POST;
@@ -39,131 +39,131 @@  discard block
 block discarded – undo
39 39
 
40 40
 // verify password
41 41
 if ($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) {
42
-	webAlertAndQuit("Password typed is mismatched", 12);
42
+    webAlertAndQuit("Password typed is mismatched", 12);
43 43
 }
44 44
 
45 45
 // verify email
46 46
 if ($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) {
47
-	webAlertAndQuit("E-mail address doesn't seem to be valid!", 12);
47
+    webAlertAndQuit("E-mail address doesn't seem to be valid!", 12);
48 48
 }
49 49
 
50 50
 // verify admin security
51 51
 if ($_SESSION['mgrRole'] != 1) {
52
-	// Check to see if user tried to spoof a "1" (admin) role
52
+    // Check to see if user tried to spoof a "1" (admin) role
53 53
     if (!$modx->hasPermission('save_user')) {
54
-		webAlertAndQuit("Illegal attempt to create/modify administrator by non-administrator!", 12);
55
-	}
56
-	// Verify that the user being edited wasn't an admin and the user ID got spoofed
57
-	if (EvolutionCMS\Models\ManagerUser::where('role', '=', 1)->where('internalKey', '=', $id)->first()) {
58
-		webAlertAndQuit("You cannot alter an administrative user.", 12);
59
-	}
54
+        webAlertAndQuit("Illegal attempt to create/modify administrator by non-administrator!", 12);
55
+    }
56
+    // Verify that the user being edited wasn't an admin and the user ID got spoofed
57
+    if (EvolutionCMS\Models\ManagerUser::where('role', '=', 1)->where('internalKey', '=', $id)->first()) {
58
+        webAlertAndQuit("You cannot alter an administrative user.", 12);
59
+    }
60 60
 
61 61
 }
62 62
 
63 63
 switch ($input['mode']) {
64
-	case '11' : // new user
65
-		// check if this user name already exist
66
-		if (EvolutionCMS\Models\ManagerUser::where('username', '=', $newusername)->first()) {
67
-			webAlertAndQuit("User name is already in use!", 12);
68
-		}
69
-
70
-		// check if the email address already exist
71
-		if (EvolutionCMS\Models\UserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) {
72
-			webAlertAndQuit("Email is already in use!", 12);
73
-		}
74
-
75
-		// generate a new password for this user
64
+    case '11' : // new user
65
+        // check if this user name already exist
66
+        if (EvolutionCMS\Models\ManagerUser::where('username', '=', $newusername)->first()) {
67
+            webAlertAndQuit("User name is already in use!", 12);
68
+        }
69
+
70
+        // check if the email address already exist
71
+        if (EvolutionCMS\Models\UserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) {
72
+            webAlertAndQuit("Email is already in use!", 12);
73
+        }
74
+
75
+        // generate a new password for this user
76 76
         if ($specifiedpassword != "" && $passwordgenmethod == "spec") {
77 77
             if (strlen($specifiedpassword) < 6) {
78
-				webAlertAndQuit("Password is too short!", 12);
79
-			} else {
80
-				$newpassword = $specifiedpassword;
81
-			}
78
+                webAlertAndQuit("Password is too short!", 12);
79
+            } else {
80
+                $newpassword = $specifiedpassword;
81
+            }
82 82
         } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") {
83
-			webAlertAndQuit("You didn't specify a password for this user!", 12);
83
+            webAlertAndQuit("You didn't specify a password for this user!", 12);
84 84
         } elseif ($passwordgenmethod == 'g') {
85
-			$newpassword = generate_password(8);
86
-		} else {
87
-			webAlertAndQuit("No password generation method specified!", 12);
88
-		}
89
-
90
-		// invoke OnBeforeUserFormSave event
91
-		$modx->invokeEvent("OnBeforeUserFormSave", array(
92
-			"mode" => "new",
93
-		));
94
-
95
-		// create the user account
96
-		$field = array();
97
-		$field['password'] = $modx->getPasswordHash()->HashPassword($newpassword);
98
-		$field['username'] = $newusername;
99
-		$managerUser= EvolutionCMS\Models\ManagerUser::create($field);
100
-		$internalKey = $managerUser->getKey();
101
-		$field = compact( 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter');
102
-		$managerUser->attributes()->create($field);
85
+            $newpassword = generate_password(8);
86
+        } else {
87
+            webAlertAndQuit("No password generation method specified!", 12);
88
+        }
89
+
90
+        // invoke OnBeforeUserFormSave event
91
+        $modx->invokeEvent("OnBeforeUserFormSave", array(
92
+            "mode" => "new",
93
+        ));
94
+
95
+        // create the user account
96
+        $field = array();
97
+        $field['password'] = $modx->getPasswordHash()->HashPassword($newpassword);
98
+        $field['username'] = $newusername;
99
+        $managerUser= EvolutionCMS\Models\ManagerUser::create($field);
100
+        $internalKey = $managerUser->getKey();
101
+        $field = compact( 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter');
102
+        $managerUser->attributes()->create($field);
103 103
 
104 104
         $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street',
105 105
             'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter');
106 106
         $field = $modx->db->escape($field);
107 107
         $modx->db->insert($field, $tbl_user_attributes);
108 108
 
109
-		// Save user settings
109
+        // Save user settings
110 110
         saveManagerUserSettings($internalKey);
111 111
 
112
-		// invoke OnManagerSaveUser event
113
-		$modx->invokeEvent("OnManagerSaveUser", array(
114
-			"mode" => "new",
115
-			"userid" => $internalKey,
116
-			"username" => $newusername,
117
-			"userpassword" => $newpassword,
118
-			"useremail" => $email,
119
-			"userfullname" => $fullname,
120
-			"userroleid" => $role
121
-		));
122
-
123
-		// invoke OnUserFormSave event
124
-		$modx->invokeEvent("OnUserFormSave", array(
125
-			"mode" => "new",
126
-			"id" => $internalKey
127
-		));
128
-
129
-		// Set the item name for logger
130
-		$_SESSION['itemname'] = $newusername;
131
-
132
-		/*******************************************************************************/
133
-		// put the user in the user_groups he/ she should be in
134
-		// first, check that up_perms are switched on!
135
-		if($modx->getConfig('use_udperms') == 1) {
136
-			if(!empty($user_groups)) {
137
-				for($i = 0; $i < count($user_groups); $i++) {
138
-					$field = array();
139
-					$field['user_group'] = (int)$user_groups[$i];
140
-					$field['member'] = $id;
141
-					$managerUser->memberGroups()->create($field);
142
-				}
143
-			}
144
-		}
145
-		// end of user_groups stuff!
112
+        // invoke OnManagerSaveUser event
113
+        $modx->invokeEvent("OnManagerSaveUser", array(
114
+            "mode" => "new",
115
+            "userid" => $internalKey,
116
+            "username" => $newusername,
117
+            "userpassword" => $newpassword,
118
+            "useremail" => $email,
119
+            "userfullname" => $fullname,
120
+            "userroleid" => $role
121
+        ));
122
+
123
+        // invoke OnUserFormSave event
124
+        $modx->invokeEvent("OnUserFormSave", array(
125
+            "mode" => "new",
126
+            "id" => $internalKey
127
+        ));
128
+
129
+        // Set the item name for logger
130
+        $_SESSION['itemname'] = $newusername;
131
+
132
+        /*******************************************************************************/
133
+        // put the user in the user_groups he/ she should be in
134
+        // first, check that up_perms are switched on!
135
+        if($modx->getConfig('use_udperms') == 1) {
136
+            if(!empty($user_groups)) {
137
+                for($i = 0; $i < count($user_groups); $i++) {
138
+                    $field = array();
139
+                    $field['user_group'] = (int)$user_groups[$i];
140
+                    $field['member'] = $id;
141
+                    $managerUser->memberGroups()->create($field);
142
+                }
143
+            }
144
+        }
145
+        // end of user_groups stuff!
146 146
 
147 147
         if ($passwordnotifymethod == 'e') {
148 148
             sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL);
149 149
             if ($input['stay'] != '') {
150
-				$a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11";
151
-				$header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
152
-				header($header);
153
-			} else {
154
-				$header = "Location: index.php?a=75&r=2";
155
-				header($header);
156
-			}
157
-		} else {
150
+                $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11";
151
+                $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
152
+                header($header);
153
+            } else {
154
+                $header = "Location: index.php?a=75&r=2";
155
+                header($header);
156
+            }
157
+        } else {
158 158
             if ($input['stay'] != '') {
159
-				$a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11";
160
-				$stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
161
-			} else {
162
-				$stayUrl = "index.php?a=75&r=2";
163
-			}
159
+                $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11";
160
+                $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
161
+            } else {
162
+                $stayUrl = "index.php?a=75&r=2";
163
+            }
164 164
 
165
-			include_once MODX_MANAGER_PATH . "includes/header.inc.php";
166
-			?>
165
+            include_once MODX_MANAGER_PATH . "includes/header.inc.php";
166
+            ?>
167 167
 
168 168
 			<h1><?php echo $_lang['user_title']; ?></h1>
169 169
 
@@ -185,123 +185,123 @@  discard block
 block discarded – undo
185 185
 			</div>
186 186
 			<?php
187 187
 
188
-			include_once MODX_MANAGER_PATH . "includes/footer.inc.php";
189
-		}
190
-		break;
191
-	case '12' : // edit user
192
-		// generate a new password for this user
188
+            include_once MODX_MANAGER_PATH . "includes/footer.inc.php";
189
+        }
190
+        break;
191
+    case '12' : // edit user
192
+        // generate a new password for this user
193 193
         if ($genpassword == 1) {
194 194
             if ($specifiedpassword != "" && $passwordgenmethod == "spec") {
195 195
                 if (strlen($specifiedpassword) < 6) {
196
-					webAlertAndQuit("Password is too short!", 12);
197
-				} else {
198
-					$newpassword = $specifiedpassword;
199
-				}
196
+                    webAlertAndQuit("Password is too short!", 12);
197
+                } else {
198
+                    $newpassword = $specifiedpassword;
199
+                }
200 200
             } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") {
201
-				webAlertAndQuit("You didn't specify a password for this user!", 12);
201
+                webAlertAndQuit("You didn't specify a password for this user!", 12);
202 202
             } elseif ($passwordgenmethod == 'g') {
203
-				$newpassword = generate_password(8);
204
-			} else {
205
-				webAlertAndQuit("No password generation method specified!", 12);
206
-			}
207
-		}
203
+                $newpassword = generate_password(8);
204
+            } else {
205
+                webAlertAndQuit("No password generation method specified!", 12);
206
+            }
207
+        }
208 208
         if ($passwordnotifymethod == 'e') {
209 209
             sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL);
210
-		}
211
-
212
-		// check if the username already exist
213
-		if (EvolutionCMS\Models\ManagerUser::where('username', '=', $newusername)->where('id', '!=', $id)->first()) {
214
-			webAlertAndQuit("User name is already in use!", 12);
215
-		}
216
-
217
-		// check if the email address already exists
218
-		if (EvolutionCMS\Models\UserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) {
219
-			webAlertAndQuit("Email is already in use!", 12);
220
-		}
221
-
222
-		// invoke OnBeforeUserFormSave event
223
-		$modx->invokeEvent("OnBeforeUserFormSave", array(
224
-			"mode" => "upd",
225
-			"id" => $id
226
-		));
227
-
228
-		// update user name and password
229
-		$field = array();
230
-		$field['username'] = $newusername;
210
+        }
211
+
212
+        // check if the username already exist
213
+        if (EvolutionCMS\Models\ManagerUser::where('username', '=', $newusername)->where('id', '!=', $id)->first()) {
214
+            webAlertAndQuit("User name is already in use!", 12);
215
+        }
216
+
217
+        // check if the email address already exists
218
+        if (EvolutionCMS\Models\UserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) {
219
+            webAlertAndQuit("Email is already in use!", 12);
220
+        }
221
+
222
+        // invoke OnBeforeUserFormSave event
223
+        $modx->invokeEvent("OnBeforeUserFormSave", array(
224
+            "mode" => "upd",
225
+            "id" => $id
226
+        ));
227
+
228
+        // update user name and password
229
+        $field = array();
230
+        $field['username'] = $newusername;
231 231
         if ($genpassword == 1) {
232
-			$field['password'] = $modx->getPasswordHash()->HashPassword($newpassword);
233
-		}
234
-		$managerUser = EvolutionCMS\Models\ManagerUser::find($id);
235
-		$managerUser->update($field);
232
+            $field['password'] = $modx->getPasswordHash()->HashPassword($newpassword);
233
+        }
234
+        $managerUser = EvolutionCMS\Models\ManagerUser::find($id);
235
+        $managerUser->update($field);
236 236
         $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state',
237 237
             'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil',
238 238
             'blockedafter');
239
-		$managerUser->attributes->update($field);
239
+        $managerUser->attributes->update($field);
240 240
 
241
-		// Save user settings
241
+        // Save user settings
242 242
         saveManagerUserSettings($id);
243 243
 
244
-		// Set the item name for logger
245
-		$_SESSION['itemname'] = $newusername;
246
-
247
-		// invoke OnManagerSaveUser event
248
-		$modx->invokeEvent("OnManagerSaveUser", array(
249
-			"mode" => "upd",
250
-			"userid" => $id,
251
-			"username" => $newusername,
252
-			"userpassword" => $newpassword,
253
-			"useremail" => $email,
254
-			"userfullname" => $fullname,
255
-			"userroleid" => $role,
256
-			"oldusername" => (($oldusername != $newusername) ? $oldusername : ""),
257
-			"olduseremail" => (($oldemail != $email) ? $oldemail : "")
258
-		));
259
-
260
-		// invoke OnManagerChangePassword event
244
+        // Set the item name for logger
245
+        $_SESSION['itemname'] = $newusername;
246
+
247
+        // invoke OnManagerSaveUser event
248
+        $modx->invokeEvent("OnManagerSaveUser", array(
249
+            "mode" => "upd",
250
+            "userid" => $id,
251
+            "username" => $newusername,
252
+            "userpassword" => $newpassword,
253
+            "useremail" => $email,
254
+            "userfullname" => $fullname,
255
+            "userroleid" => $role,
256
+            "oldusername" => (($oldusername != $newusername) ? $oldusername : ""),
257
+            "olduseremail" => (($oldemail != $email) ? $oldemail : "")
258
+        ));
259
+
260
+        // invoke OnManagerChangePassword event
261 261
         if ($genpassword == 1) {
262
-			$modx->invokeEvent("OnManagerChangePassword", array(
263
-				"userid" => $id,
264
-				"username" => $newusername,
265
-				"userpassword" => $newpassword
266
-			));
267
-		}
268
-
269
-		// invoke OnUserFormSave event
270
-		$modx->invokeEvent("OnUserFormSave", array(
271
-			"mode" => "upd",
272
-			"id" => $id
273
-		));
274
-
275
-		/*******************************************************************************/
276
-		// put the user in the user_groups he/ she should be in
277
-		// first, check that up_perms are switched on!
278
-		if($modx->getConfig('use_udperms') == 1) {
279
-			// as this is an existing user, delete his/ her entries in the groups before saving the new groups
280
-			$managerUser->memberGroups()->delete();
262
+            $modx->invokeEvent("OnManagerChangePassword", array(
263
+                "userid" => $id,
264
+                "username" => $newusername,
265
+                "userpassword" => $newpassword
266
+            ));
267
+        }
268
+
269
+        // invoke OnUserFormSave event
270
+        $modx->invokeEvent("OnUserFormSave", array(
271
+            "mode" => "upd",
272
+            "id" => $id
273
+        ));
274
+
275
+        /*******************************************************************************/
276
+        // put the user in the user_groups he/ she should be in
277
+        // first, check that up_perms are switched on!
278
+        if($modx->getConfig('use_udperms') == 1) {
279
+            // as this is an existing user, delete his/ her entries in the groups before saving the new groups
280
+            $managerUser->memberGroups()->delete();
281 281
             if (!empty($user_groups)) {
282 282
                 for ($i = 0; $i < count($user_groups); $i++) {
283
-					$field = array();
284
-					$field['user_group'] = (int)$user_groups[$i];
285
-					$field['member'] = $id;
286
-					$managerUser->memberGroups()->create($field);
287
-				}
288
-			}
289
-		}
290
-		// end of user_groups stuff!
291
-		/*******************************************************************************/
283
+                    $field = array();
284
+                    $field['user_group'] = (int)$user_groups[$i];
285
+                    $field['member'] = $id;
286
+                    $managerUser->memberGroups()->create($field);
287
+                }
288
+            }
289
+        }
290
+        // end of user_groups stuff!
291
+        /*******************************************************************************/
292 292
         if ($id == $modx->getLoginUserID() && ($genpassword !== 1 && $passwordnotifymethod != 's')) {
293
-			$modx->webAlertAndQuit($_lang["user_changeddata"], 'javascript:top.location.href="index.php?a=8";');
294
-		}
293
+            $modx->webAlertAndQuit($_lang["user_changeddata"], 'javascript:top.location.href="index.php?a=8";');
294
+        }
295 295
         if ($genpassword == 1 && $passwordnotifymethod == 's') {
296 296
             if ($input['stay'] != '') {
297
-				$a = ($input['stay'] == '2') ? "12&id={$id}" : "11";
298
-				$stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
299
-			} else {
300
-				$stayUrl = "index.php?a=75&r=2";
301
-			}
297
+                $a = ($input['stay'] == '2') ? "12&id={$id}" : "11";
298
+                $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
299
+            } else {
300
+                $stayUrl = "index.php?a=75&r=2";
301
+            }
302 302
 
303
-			include_once MODX_MANAGER_PATH . "includes/header.inc.php";
304
-			?>
303
+            include_once MODX_MANAGER_PATH . "includes/header.inc.php";
304
+            ?>
305 305
 
306 306
 			<h1><?php echo $_lang['user_title']; ?></h1>
307 307
 
@@ -324,18 +324,18 @@  discard block
 block discarded – undo
324 324
 			</div>
325 325
 			<?php
326 326
 
327
-			include_once MODX_MANAGER_PATH . "includes/footer.inc.php";
328
-		} else {
327
+            include_once MODX_MANAGER_PATH . "includes/footer.inc.php";
328
+        } else {
329 329
             if ($input['stay'] != '') {
330
-				$a = ($input['stay'] == '2') ? "12&id={$id}" : "11";
331
-				$header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
332
-				header($header);
333
-			} else {
334
-				$header = "Location: index.php?a=75&r=2";
335
-				header($header);
336
-			}
337
-		}
338
-		break;
339
-	default:
340
-		webAlertAndQuit("No operation set in request.", 12);
330
+                $a = ($input['stay'] == '2') ? "12&id={$id}" : "11";
331
+                $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
332
+                header($header);
333
+            } else {
334
+                $header = "Location: index.php?a=75&r=2";
335
+                header($header);
336
+            }
337
+        }
338
+        break;
339
+    default:
340
+        webAlertAndQuit("No operation set in request.", 12);
341 341
 }
Please login to merge, or discard this patch.
manager/processors/execute_module.processor.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -3,51 +3,51 @@
 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('exec_module')) {
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
 // check if user has access permission, except admins
15 15
 if($_SESSION['mgrRole']!=1){
16
-	$rs = $modx->getDatabase()->select(
17
-		'sma.usergroup,mg.member',
18
-		$modx->getDatabase()->getFullTableName("site_module_access")." sma
16
+    $rs = $modx->getDatabase()->select(
17
+        'sma.usergroup,mg.member',
18
+        $modx->getDatabase()->getFullTableName("site_module_access")." sma
19 19
 			LEFT JOIN ".$modx->getDatabase()->getFullTableName("member_groups")." mg ON mg.user_group = sma.usergroup AND member='".$modx->getLoginUserID()."'",
20
-		"sma.module = '{$id}'"
21
-		);
22
-	//initialize permission to -1, if it stays -1 no permissions
23
-	//attached so permission granted
24
-	$permissionAccessInt = -1;
20
+        "sma.module = '{$id}'"
21
+        );
22
+    //initialize permission to -1, if it stays -1 no permissions
23
+    //attached so permission granted
24
+    $permissionAccessInt = -1;
25 25
 
26
-	while ($row = $modx->getDatabase()->getRow($rs)) {
27
-		if($row["usergroup"] && $row["member"]) {
28
-			//if there are permissions and this member has permission, ofcourse
29
-			//this is granted
30
-			$permissionAccessInt = 1;
31
-		} elseif ($permissionAccessInt==-1) {
32
-			//if there are permissions but this member has no permission and the
33
-			//variable was still in init state we set permission to 0; no permissions
34
-			$permissionAccessInt = 0;
35
-		}
36
-	}
26
+    while ($row = $modx->getDatabase()->getRow($rs)) {
27
+        if($row["usergroup"] && $row["member"]) {
28
+            //if there are permissions and this member has permission, ofcourse
29
+            //this is granted
30
+            $permissionAccessInt = 1;
31
+        } elseif ($permissionAccessInt==-1) {
32
+            //if there are permissions but this member has no permission and the
33
+            //variable was still in init state we set permission to 0; no permissions
34
+            $permissionAccessInt = 0;
35
+        }
36
+    }
37 37
 
38
-	if($permissionAccessInt==0) {
39
-		$modx->webAlertAndQuit("You do not sufficient privileges to execute this module.", "index.php?a=106");
40
-	}
38
+    if($permissionAccessInt==0) {
39
+        $modx->webAlertAndQuit("You do not sufficient privileges to execute this module.", "index.php?a=106");
40
+    }
41 41
 }
42 42
 
43 43
 // get module data
44 44
 $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName("site_modules"), "id='{$id}'");
45 45
 $content = $modx->getDatabase()->getRow($rs);
46 46
 if(!$content) {
47
-	$modx->webAlertAndQuit("No record found for id {$id}.", "index.php?a=106");
47
+    $modx->webAlertAndQuit("No record found for id {$id}.", "index.php?a=106");
48 48
 }
49 49
 if($content['disabled']) {
50
-	$modx->webAlertAndQuit("This module is disabled and cannot be executed.", "index.php?a=106");
50
+    $modx->webAlertAndQuit("This module is disabled and cannot be executed.", "index.php?a=106");
51 51
 }
52 52
 
53 53
 // Set the item name for logger
Please login to merge, or discard this patch.
manager/processors/delete_user.processor.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -3,17 +3,17 @@  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('delete_user')) {
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
 // delete the user, but first check if we are deleting our own record
15 15
 if($id==$modx->getLoginUserID()) {
16
-	$modx->webAlertAndQuit("You can't delete yourself!");
16
+    $modx->webAlertAndQuit("You can't delete yourself!");
17 17
 }
18 18
 
19 19
 // Set the item name for logger
@@ -22,25 +22,25 @@  discard block
 block discarded – undo
22 22
 
23 23
 // invoke OnBeforeUserFormDelete event
24 24
 $modx->invokeEvent("OnBeforeUserFormDelete",
25
-	array(
26
-		"id"	=> $id
27
-	));
25
+    array(
26
+        "id"	=> $id
27
+    ));
28 28
 
29 29
 // delete the user.
30 30
 EvolutionCMS\Models\ManagerUser::destroy($id);
31 31
 
32 32
 // invoke OnManagerDeleteUser event
33 33
 $modx->invokeEvent("OnManagerDeleteUser",
34
-	array(
35
-		"userid"		=> $id,
36
-		"username"		=> $username
37
-	));
34
+    array(
35
+        "userid"		=> $id,
36
+        "username"		=> $username
37
+    ));
38 38
 
39 39
 // invoke OnUserFormDelete event
40 40
 $modx->invokeEvent("OnUserFormDelete",
41
-	array(
42
-		"id"	=> $id
43
-	));
41
+    array(
42
+        "id"	=> $id
43
+    ));
44 44
 
45 45
 $header="Location: index.php?a=75";
46 46
 header($header);
Please login to merge, or discard this patch.
manager/processors/save_settings.processor.php 1 patch
Indentation   +98 added lines, -98 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('settings')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 $data = $_POST;
9 9
 // lose the POST now, gets rid of quirky issue with Safari 3 - see FS#972
@@ -11,41 +11,41 @@  discard block
 block discarded – undo
11 11
 
12 12
 if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false)
13 13
 {
14
-	$htaccess        = MODX_BASE_PATH . '.htaccess';
15
-	$sample_htaccess = MODX_BASE_PATH . 'ht.access';
16
-	$dir = '/' . trim(MODX_BASE_URL,'/');
17
-	if(is_file($htaccess))
18
-	{
19
-		$_ = file_get_contents($htaccess);
20
-		if(strpos($_,'RewriteBase')===false)
21
-		{
22
-			$warnings[] = $_lang["settings_friendlyurls_alert2"];
23
-		}
24
-		elseif(is_writable($htaccess))
25
-		{
26
-			$_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_);
27
-			if(!@file_put_contents($htaccess,$_))
28
-			{
29
-				$warnings[] = $_lang["settings_friendlyurls_alert2"];
30
-			}
31
-		}
32
-	}
33
-	elseif(is_file($sample_htaccess))
34
-	{
35
-		if(!@rename($sample_htaccess,$htaccess))
14
+    $htaccess        = MODX_BASE_PATH . '.htaccess';
15
+    $sample_htaccess = MODX_BASE_PATH . 'ht.access';
16
+    $dir = '/' . trim(MODX_BASE_URL,'/');
17
+    if(is_file($htaccess))
18
+    {
19
+        $_ = file_get_contents($htaccess);
20
+        if(strpos($_,'RewriteBase')===false)
36 21
         {
37
-        	$warnings[] = $_lang["settings_friendlyurls_alert"];
38
-		}
39
-		elseif(MODX_BASE_URL!=='/')
40
-		{
41
-			$_ = file_get_contents($htaccess);
42
-			$_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_);
43
-			if(!@file_put_contents($htaccess,$_))
44
-			{
45
-				$warnings[] = $_lang["settings_friendlyurls_alert2"];
46
-			}
47
-		}
48
-	}
22
+            $warnings[] = $_lang["settings_friendlyurls_alert2"];
23
+        }
24
+        elseif(is_writable($htaccess))
25
+        {
26
+            $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_);
27
+            if(!@file_put_contents($htaccess,$_))
28
+            {
29
+                $warnings[] = $_lang["settings_friendlyurls_alert2"];
30
+            }
31
+        }
32
+    }
33
+    elseif(is_file($sample_htaccess))
34
+    {
35
+        if(!@rename($sample_htaccess,$htaccess))
36
+        {
37
+            $warnings[] = $_lang["settings_friendlyurls_alert"];
38
+        }
39
+        elseif(MODX_BASE_URL!=='/')
40
+        {
41
+            $_ = file_get_contents($htaccess);
42
+            $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_);
43
+            if(!@file_put_contents($htaccess,$_))
44
+            {
45
+                $warnings[] = $_lang["settings_friendlyurls_alert2"];
46
+            }
47
+        }
48
+    }
49 49
 }
50 50
 
51 51
 if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) {
@@ -56,19 +56,19 @@  discard block
 block discarded – undo
56 56
 $data['rb_base_dir']      = str_replace('[(base_path)]',MODX_BASE_PATH,$data['rb_base_dir']);
57 57
 
58 58
 if (isset($data) && count($data) > 0) {
59
-	if(isset($data['manager_language'])) {
60
-		$lang_path = MODX_MANAGER_PATH . 'includes/lang/' . $data['manager_language'] . '.inc.php';
61
-		if(is_file($lang_path)) {
62
-			include $lang_path;
59
+    if(isset($data['manager_language'])) {
60
+        $lang_path = MODX_MANAGER_PATH . 'includes/lang/' . $data['manager_language'] . '.inc.php';
61
+        if(is_file($lang_path)) {
62
+            include $lang_path;
63 63
             global $modx_lang_attribute;
64 64
             $data['lang_code'] = !$modx_lang_attribute ? 'en' : $modx_lang_attribute;
65
-		}
66
-	}
67
-	$savethese = array();
68
-	$data['sys_files_checksum'] = $modx->getManagerApi()->getSystemChecksum($data['check_files_onlogin']);
69
-	$data['mail_check_timeperiod'] = (int)$data['mail_check_timeperiod'] < 60 ? 60 : $data['mail_check_timeperiod']; // updateMail() in mainMenu no faster than every minute
70
-	foreach ($data as $k => $v) {
71
-		switch ($k) {
65
+        }
66
+    }
67
+    $savethese = array();
68
+    $data['sys_files_checksum'] = $modx->getManagerApi()->getSystemChecksum($data['check_files_onlogin']);
69
+    $data['mail_check_timeperiod'] = (int)$data['mail_check_timeperiod'] < 60 ? 60 : $data['mail_check_timeperiod']; // updateMail() in mainMenu no faster than every minute
70
+    foreach ($data as $k => $v) {
71
+        switch ($k) {
72 72
             case 'settings_version':{
73 73
                 if($modx->getVersionData('version')!=$data['settings_version']){
74 74
                     $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version');
@@ -76,24 +76,24 @@  discard block
 block discarded – undo
76 76
                 }
77 77
                 break;
78 78
             }
79
-			case 'error_page':
80
-			case 'unauthorized_page':
81
-			if (trim($v) == '' || !is_numeric($v)) {
82
-				$v = $data['site_start'];
83
-			}
84
-			break;
79
+            case 'error_page':
80
+            case 'unauthorized_page':
81
+            if (trim($v) == '' || !is_numeric($v)) {
82
+                $v = $data['site_start'];
83
+            }
84
+            break;
85 85
 
86
-			case 'lst_custom_contenttype':
87
-			case 'txt_custom_contenttype':
88
-				// Skip these
89
-				$k = '';
90
-				break;
91
-			case 'rb_base_dir':
92
-			case 'rb_base_url':
93
-			case 'filemanager_path':
94
-				$v = trim($v);
95
-				$v = rtrim($v,'/') . '/';
96
-				break;
86
+            case 'lst_custom_contenttype':
87
+            case 'txt_custom_contenttype':
88
+                // Skip these
89
+                $k = '';
90
+                break;
91
+            case 'rb_base_dir':
92
+            case 'rb_base_url':
93
+            case 'filemanager_path':
94
+                $v = trim($v);
95
+                $v = rtrim($v,'/') . '/';
96
+                break;
97 97
             case 'manager_language':
98 98
                 $langDir = realpath(MODX_MANAGER_PATH . 'includes/lang');
99 99
                 $langFile = realpath(MODX_MANAGER_PATH . 'includes/lang/' . $v . '.inc.php');
@@ -101,47 +101,47 @@  discard block
 block discarded – undo
101 101
                 if($langDir !== $langFileDir || !file_exists($langFile)) {
102 102
                     $v = 'english';
103 103
                 }
104
-				break;
105
-			case 'smtppw':
106
-				if ($v !== '********************' && $v !== '') {
107
-					$v = trim($v);
108
-					$v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7);
109
-					$v = str_replace('=','%',$v);
110
-				} elseif ($v === '********************') {
111
-					$k = '';
112
-				}
113
-				break;
114
-			case 'session_timeout':
115
-				$mail_check_timeperiod = $data['mail_check_timeperiod'];
116
-				$v = (int)$v < ($data['mail_check_timeperiod']/60+1) ? ($data['mail_check_timeperiod']/60+1) : $v; // updateMail() in mainMenu pings as per mail_check_timeperiod, so +1min is minimum
117
-				break;
118
-			default:
119
-			break;
120
-		}
121
-		$v = is_array($v) ? implode(",", $v) : $v;
104
+                break;
105
+            case 'smtppw':
106
+                if ($v !== '********************' && $v !== '') {
107
+                    $v = trim($v);
108
+                    $v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7);
109
+                    $v = str_replace('=','%',$v);
110
+                } elseif ($v === '********************') {
111
+                    $k = '';
112
+                }
113
+                break;
114
+            case 'session_timeout':
115
+                $mail_check_timeperiod = $data['mail_check_timeperiod'];
116
+                $v = (int)$v < ($data['mail_check_timeperiod']/60+1) ? ($data['mail_check_timeperiod']/60+1) : $v; // updateMail() in mainMenu pings as per mail_check_timeperiod, so +1min is minimum
117
+                break;
118
+            default:
119
+            break;
120
+        }
121
+        $v = is_array($v) ? implode(",", $v) : $v;
122 122
 
123
-		$modx->config[$k] = $v;
123
+        $modx->config[$k] = $v;
124 124
 
125
-		if(!empty($k)) $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')';
126
-	}
125
+        if(!empty($k)) $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')';
126
+    }
127 127
 
128
-	// Run a single query to save all the values
129
-	$sql = "REPLACE INTO ".$modx->getDatabase()->getFullTableName("system_settings")." (setting_name, setting_value)
128
+    // Run a single query to save all the values
129
+    $sql = "REPLACE INTO ".$modx->getDatabase()->getFullTableName("system_settings")." (setting_name, setting_value)
130 130
 		VALUES ".implode(', ', $savethese);
131
-	$modx->getDatabase()->query($sql);
131
+    $modx->getDatabase()->query($sql);
132 132
 
133
-	// Reset Template Pages
134
-	if (isset($data['reset_template'])) {
135
-		$newtemplate = (int)$data['default_template'];
136
-		$oldtemplate = (int)$data['old_template'];
137
-		$tbl = $modx->getDatabase()->getFullTableName('site_content');
138
-		$reset = $data['reset_template'];
139
-		if($reset==1) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'");
140
-		else if($reset==2) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'");
141
-	}
133
+    // Reset Template Pages
134
+    if (isset($data['reset_template'])) {
135
+        $newtemplate = (int)$data['default_template'];
136
+        $oldtemplate = (int)$data['old_template'];
137
+        $tbl = $modx->getDatabase()->getFullTableName('site_content');
138
+        $reset = $data['reset_template'];
139
+        if($reset==1) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'");
140
+        else if($reset==2) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'");
141
+    }
142 142
 
143
-	// empty cache
144
-	$modx->clearCache('full');
143
+    // empty cache
144
+    $modx->clearCache('full');
145 145
 }
146 146
 $header="Location: index.php?a=7&r=10";
147 147
 header($header);
Please login to merge, or discard this patch.
manager/processors/delete_template.processor.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@  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('delete_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
 // delete the template, but first check it doesn't have any documents using it
15 15
 $rs = $modx->getDatabase()->select('id, pagetitle,introtext', $modx->getDatabase()->getFullTableName('site_content'), "template='{$id}' AND deleted=0");
16 16
 $limit = $modx->getDatabase()->getRecordCount($rs);
17 17
 if($limit > 0) {
18
-	include MODX_MANAGER_PATH . "includes/header.inc.php";
19
-	?>
18
+    include MODX_MANAGER_PATH . "includes/header.inc.php";
19
+    ?>
20 20
 
21 21
 	<h1><?php echo $_lang['manage_templates']; ?></h1>
22 22
 
@@ -28,20 +28,20 @@  discard block
 block discarded – undo
28 28
 			<p>Documents using this template:</p>
29 29
 			<ul>
30 30
 				<?php
31
-				while($row = $modx->getDatabase()->getRow($rs)) {
32
-					echo '<li><span style="width: 200px"><a href="index.php?id=' . $row['id'] . '&a=27">' . $row['pagetitle'] . '</a></span>' . ($row['introtext'] != '' ? ' - ' . $row['introtext'] : '') . '</li>';
33
-				}
34
-				?>
31
+                while($row = $modx->getDatabase()->getRow($rs)) {
32
+                    echo '<li><span style="width: 200px"><a href="index.php?id=' . $row['id'] . '&a=27">' . $row['pagetitle'] . '</a></span>' . ($row['introtext'] != '' ? ' - ' . $row['introtext'] : '') . '</li>';
33
+                }
34
+                ?>
35 35
 			</ul>
36 36
 		</div>
37 37
 	</div>
38 38
 	<?php
39
-	include_once MODX_MANAGER_PATH . "includes/footer.inc.php";
40
-	exit;
39
+    include_once MODX_MANAGER_PATH . "includes/footer.inc.php";
40
+    exit;
41 41
 }
42 42
 
43 43
 if($id == $default_template) {
44
-	$modx->webAlertAndQuit("This template is set as the default template. Please choose a different default template in the MODX configuration before deleting this template.");
44
+    $modx->webAlertAndQuit("This template is set as the default template. Please choose a different default template in the MODX configuration before deleting this template.");
45 45
 }
46 46
 
47 47
 // Set the item name for logger
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
 
51 51
 // invoke OnBeforeTempFormDelete event
52 52
 $modx->invokeEvent("OnBeforeTempFormDelete", array(
53
-		"id" => $id
54
-	));
53
+        "id" => $id
54
+    ));
55 55
 
56 56
 // delete the document.
57 57
 $modx->getDatabase()->delete($modx->getDatabase()->getFullTableName('site_templates'), "id='{$id}'");
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
 
61 61
 // invoke OnTempFormDelete event
62 62
 $modx->invokeEvent("OnTempFormDelete", array(
63
-		"id" => $id
64
-	));
63
+        "id" => $id
64
+    ));
65 65
 
66 66
 // empty cache
67 67
 $modx->clearCache('full');
Please login to merge, or discard this patch.
manager/processors/save_web_user.processor.php 1 patch
Indentation   +156 added lines, -156 removed lines patch added patch discarded remove patch
@@ -1,17 +1,17 @@  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('save_web_user')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $input = $_POST;
10 10
 foreach ($input as $k => $v) {
11 11
     if ($k !== 'comment' && $k !== 'user_groups') {
12
-		$v = $modx->getPhpCompat()->htmlspecialchars($v, ENT_NOQUOTES);
13
-	}
14
-	$input[$k] = $v;
12
+        $v = $modx->getPhpCompat()->htmlspecialchars($v, ENT_NOQUOTES);
13
+    }
14
+    $input[$k] = $v;
15 15
 }
16 16
 
17 17
 $id = (int)$input['id'];
@@ -45,81 +45,81 @@  discard block
 block discarded – undo
45 45
 
46 46
 // verify password
47 47
 if ($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) {
48
-	webAlertAndQuit("Password typed is mismatched", 88);
48
+    webAlertAndQuit("Password typed is mismatched", 88);
49 49
 }
50 50
 
51 51
 // verify email
52 52
 if ($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) {
53
-	webAlertAndQuit("E-mail address doesn't seem to be valid!", 88);
53
+    webAlertAndQuit("E-mail address doesn't seem to be valid!", 88);
54 54
 }
55 55
 
56 56
 switch ($input['mode']) {
57
-	case '87' : // new user
58
-		// check if this user name already exist
59
-		if (EvolutionCMS\Models\WebUser::where('username', '=', $newusername)->first()) {
60
-			webAlertAndQuit("User name is already in use!", 88);
61
-		}
62
-
63
-		// check if the email address already exist
64
-		if ($modx->config['allow_multiple_emails'] != 1) {
65
-			if (EvolutionCMS\Models\WebUserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) {
66
-				webAlertAndQuit("Email is already in use!", 88);
67
-			}
68
-		}
69
-
70
-		// generate a new password for this user
57
+    case '87' : // new user
58
+        // check if this user name already exist
59
+        if (EvolutionCMS\Models\WebUser::where('username', '=', $newusername)->first()) {
60
+            webAlertAndQuit("User name is already in use!", 88);
61
+        }
62
+
63
+        // check if the email address already exist
64
+        if ($modx->config['allow_multiple_emails'] != 1) {
65
+            if (EvolutionCMS\Models\WebUserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) {
66
+                webAlertAndQuit("Email is already in use!", 88);
67
+            }
68
+        }
69
+
70
+        // generate a new password for this user
71 71
         if ($specifiedpassword != "" && $passwordgenmethod == "spec") {
72 72
             if (strlen($specifiedpassword) < 6) {
73
-				webAlertAndQuit("Password is too short!", 88);
74
-			} else {
75
-				$newpassword = $specifiedpassword;
76
-			}
73
+                webAlertAndQuit("Password is too short!", 88);
74
+            } else {
75
+                $newpassword = $specifiedpassword;
76
+            }
77 77
         } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") {
78
-			webAlertAndQuit("You didn't specify a password for this user!", 88);
78
+            webAlertAndQuit("You didn't specify a password for this user!", 88);
79 79
         } elseif ($passwordgenmethod == 'g') {
80
-			$newpassword = generate_password(8);
81
-		} else {
82
-			webAlertAndQuit("No password generation method specified!", 88);
83
-		}
84
-
85
-		// invoke OnBeforeWUsrFormSave event
86
-		$modx->invokeEvent("OnBeforeWUsrFormSave", array(
87
-			"mode" => "new",
88
-		));
89
-
90
-		// create the user account
91
-		$field = array();
92
-		$field['username'] = $newusername;
93
-		$field['password'] = md5($newpassword);
94
-		$webUser= EvolutionCMS\Models\WebUser::create($field);
95
-		$internalKey = $webUser->getKey();
96
-		$field = compact( 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter');
97
-		$webUser->attributes()->create($field);
80
+            $newpassword = generate_password(8);
81
+        } else {
82
+            webAlertAndQuit("No password generation method specified!", 88);
83
+        }
84
+
85
+        // invoke OnBeforeWUsrFormSave event
86
+        $modx->invokeEvent("OnBeforeWUsrFormSave", array(
87
+            "mode" => "new",
88
+        ));
89
+
90
+        // create the user account
91
+        $field = array();
92
+        $field['username'] = $newusername;
93
+        $field['password'] = md5($newpassword);
94
+        $webUser= EvolutionCMS\Models\WebUser::create($field);
95
+        $internalKey = $webUser->getKey();
96
+        $field = compact( 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter');
97
+        $webUser->attributes()->create($field);
98 98
 
99 99
         $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street',
100 100
             'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter');
101 101
         $field = $modx->db->escape($field);
102 102
         $modx->db->insert($field, $tbl_web_user_attributes);
103 103
 
104
-		// Save User Settings
104
+        // Save User Settings
105 105
         saveWebUserSettings($internalKey);
106 106
 
107
-		// Set the item name for logger
108
-		$_SESSION['itemname'] = $newusername;
109
-
110
-		/*******************************************************************************/
111
-		// put the user in the user_groups he/ she should be in
112
-		// first, check that up_perms are switched on!
113
-		if($modx->getConfig('use_udperms') == 1) {
114
-			if(!empty($user_groups)) {
115
-				for($i = 0; $i < count($user_groups); $i++) {
116
-					$field = array();
117
-					$field['webgroup'] = (int)$user_groups[$i];
118
-					$webUser->memberGroups()->create($field);
119
-				}
120
-			}
121
-		}
122
-		// end of user_groups stuff!
107
+        // Set the item name for logger
108
+        $_SESSION['itemname'] = $newusername;
109
+
110
+        /*******************************************************************************/
111
+        // put the user in the user_groups he/ she should be in
112
+        // first, check that up_perms are switched on!
113
+        if($modx->getConfig('use_udperms') == 1) {
114
+            if(!empty($user_groups)) {
115
+                for($i = 0; $i < count($user_groups); $i++) {
116
+                    $field = array();
117
+                    $field['webgroup'] = (int)$user_groups[$i];
118
+                    $webUser->memberGroups()->create($field);
119
+                }
120
+            }
121
+        }
122
+        // end of user_groups stuff!
123 123
 
124 124
         // invoke OnWebSaveUser event
125 125
         $modx->invokeEvent("OnWebSaveUser", array(
@@ -140,23 +140,23 @@  discard block
 block discarded – undo
140 140
         if ($passwordnotifymethod == 'e') {
141 141
             sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url);
142 142
             if ($input['stay'] != '') {
143
-				$a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87";
144
-				$header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
145
-				header($header);
146
-			} else {
147
-				$header = "Location: index.php?a=99&r=2";
148
-				header($header);
149
-			}
150
-		} else {
143
+                $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87";
144
+                $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
145
+                header($header);
146
+            } else {
147
+                $header = "Location: index.php?a=99&r=2";
148
+                header($header);
149
+            }
150
+        } else {
151 151
             if ($input['stay'] != '') {
152
-				$a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87";
153
-				$stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
154
-			} else {
155
-				$stayUrl = "index.php?a=99&r=2";
156
-			}
152
+                $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87";
153
+                $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
154
+            } else {
155
+                $stayUrl = "index.php?a=99&r=2";
156
+            }
157 157
 
158
-			include_once MODX_MANAGER_PATH . "includes/header.inc.php";
159
-			?>
158
+            include_once MODX_MANAGER_PATH . "includes/header.inc.php";
159
+            ?>
160 160
 
161 161
 			<h1><?php echo $_lang['web_user_title']; ?></h1>
162 162
 
@@ -178,83 +178,83 @@  discard block
 block discarded – undo
178 178
 			</div>
179 179
 			<?php
180 180
 
181
-			include_once MODX_MANAGER_PATH . "includes/footer.inc.php";
182
-		}
183
-		break;
184
-	case '88' : // edit user
185
-		// generate a new password for this user
181
+            include_once MODX_MANAGER_PATH . "includes/footer.inc.php";
182
+        }
183
+        break;
184
+    case '88' : // edit user
185
+        // generate a new password for this user
186 186
         if ($genpassword == 1) {
187 187
             if ($specifiedpassword != "" && $passwordgenmethod == "spec") {
188 188
                 if (strlen($specifiedpassword) < 6) {
189
-					webAlertAndQuit("Password is too short!", 88);
190
-				} else {
191
-					$newpassword = $specifiedpassword;
192
-				}
189
+                    webAlertAndQuit("Password is too short!", 88);
190
+                } else {
191
+                    $newpassword = $specifiedpassword;
192
+                }
193 193
             } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") {
194
-				webAlertAndQuit("You didn't specify a password for this user!", 88);
194
+                webAlertAndQuit("You didn't specify a password for this user!", 88);
195 195
             } elseif ($passwordgenmethod == 'g') {
196
-				$newpassword = generate_password(8);
197
-			} else {
198
-				webAlertAndQuit("No password generation method specified!", 88);
199
-			}
200
-		}
196
+                $newpassword = generate_password(8);
197
+            } else {
198
+                webAlertAndQuit("No password generation method specified!", 88);
199
+            }
200
+        }
201 201
         if ($passwordnotifymethod == 'e') {
202 202
             sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url);
203
-		}
204
-
205
-		// check if the username already exist
206
-		if (EvolutionCMS\Models\WebUser::where('id', '!=', $id)->where('username', '=', $newusername)->first()) {
207
-			webAlertAndQuit("User name is already in use!", 88);
208
-		}
209
-
210
-		// check if the email address already exists
211
-		if ($modx->config['allow_multiple_emails'] != 1) {
212
-			if (EvolutionCMS\Models\WebUserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) {
213
-				webAlertAndQuit("Email is already in use!", 88);
214
-			}
215
-		}
216
-
217
-		// invoke OnBeforeWUsrFormSave event
218
-		$modx->invokeEvent("OnBeforeWUsrFormSave", array(
219
-			"mode" => "upd",
220
-			"id" => $id
221
-		));
222
-
223
-		// update user name and password
224
-		$field = array();
225
-		$field['username'] = $newusername;
203
+        }
204
+
205
+        // check if the username already exist
206
+        if (EvolutionCMS\Models\WebUser::where('id', '!=', $id)->where('username', '=', $newusername)->first()) {
207
+            webAlertAndQuit("User name is already in use!", 88);
208
+        }
209
+
210
+        // check if the email address already exists
211
+        if ($modx->config['allow_multiple_emails'] != 1) {
212
+            if (EvolutionCMS\Models\WebUserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) {
213
+                webAlertAndQuit("Email is already in use!", 88);
214
+            }
215
+        }
216
+
217
+        // invoke OnBeforeWUsrFormSave event
218
+        $modx->invokeEvent("OnBeforeWUsrFormSave", array(
219
+            "mode" => "upd",
220
+            "id" => $id
221
+        ));
222
+
223
+        // update user name and password
224
+        $field = array();
225
+        $field['username'] = $newusername;
226 226
         if ($genpassword == 1) {
227
-			$field['password'] = md5($newpassword);
228
-		}
229
-		$webUser = EvolutionCMS\Models\WebUser::find($id);
230
-		$webUser->update($field);
227
+            $field['password'] = md5($newpassword);
228
+        }
229
+        $webUser = EvolutionCMS\Models\WebUser::find($id);
230
+        $webUser->update($field);
231 231
         $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state',
232 232
             'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil',
233 233
             'blockedafter');
234
-		$webUser->attributes->update($field);
234
+        $webUser->attributes->update($field);
235 235
 
236
-		// Save User Settings
236
+        // Save User Settings
237 237
         saveWebUserSettings($id);
238 238
 
239
-		// Set the item name for logger
240
-		$_SESSION['itemname'] = $newusername;
239
+        // Set the item name for logger
240
+        $_SESSION['itemname'] = $newusername;
241 241
 
242
-		/*******************************************************************************/
243
-		// put the user in the user_groups he/ she should be in
244
-		// first, check that up_perms are switched on!
245
-		if($modx->getConfig('use_udperms') == 1) {
246
-			// as this is an existing user, delete his/ her entries in the groups before saving the new groups
247
-			$webUser->memberGroups()->delete();
242
+        /*******************************************************************************/
243
+        // put the user in the user_groups he/ she should be in
244
+        // first, check that up_perms are switched on!
245
+        if($modx->getConfig('use_udperms') == 1) {
246
+            // as this is an existing user, delete his/ her entries in the groups before saving the new groups
247
+            $webUser->memberGroups()->delete();
248 248
             if (!empty($user_groups)) {
249 249
                 for ($i = 0; $i < count($user_groups); $i++) {
250
-					$field = array();
251
-					$field['webgroup'] = (int)$user_groups[$i];
252
-					$webUser->memberGroups()->create($field);
253
-				}
254
-			}
255
-		}
256
-		// end of user_groups stuff!
257
-		/*******************************************************************************/
250
+                    $field = array();
251
+                    $field['webgroup'] = (int)$user_groups[$i];
252
+                    $webUser->memberGroups()->create($field);
253
+                }
254
+            }
255
+        }
256
+        // end of user_groups stuff!
257
+        /*******************************************************************************/
258 258
 
259 259
         // invoke OnWebSaveUser event
260 260
         $modx->invokeEvent("OnWebSaveUser", array(
@@ -285,14 +285,14 @@  discard block
 block discarded – undo
285 285
 
286 286
         if ($genpassword == 1 && $passwordnotifymethod == 's') {
287 287
             if ($input['stay'] != '') {
288
-				$a = ($input['stay'] == '2') ? "88&id={$id}" : "87";
289
-				$stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
290
-			} else {
291
-				$stayUrl = "index.php?a=99&r=2";
292
-			}
288
+                $a = ($input['stay'] == '2') ? "88&id={$id}" : "87";
289
+                $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
290
+            } else {
291
+                $stayUrl = "index.php?a=99&r=2";
292
+            }
293 293
 
294
-			include_once MODX_MANAGER_PATH . "includes/header.inc.php";
295
-			?>
294
+            include_once MODX_MANAGER_PATH . "includes/header.inc.php";
295
+            ?>
296 296
 
297 297
 			<h1><?php echo $_lang['web_user_title']; ?></h1>
298 298
 
@@ -312,18 +312,18 @@  discard block
 block discarded – undo
312 312
 			</div>
313 313
 			<?php
314 314
 
315
-			include_once MODX_MANAGER_PATH . "includes/footer.inc.php";
316
-		} else {
315
+            include_once MODX_MANAGER_PATH . "includes/footer.inc.php";
316
+        } else {
317 317
             if ($input['stay'] != '') {
318
-				$a = ($input['stay'] == '2') ? "88&id={$id}" : "87";
319
-				$header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
320
-				header($header);
321
-			} else {
322
-				$header = "Location: index.php?a=99&r=2";
323
-				header($header);
324
-			}
325
-		}
326
-		break;
327
-	default :
328
-		webAlertAndQuit("No operation set in request.", 88);
318
+                $a = ($input['stay'] == '2') ? "88&id={$id}" : "87";
319
+                $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
320
+                header($header);
321
+            } else {
322
+                $header = "Location: index.php?a=99&r=2";
323
+                header($header);
324
+            }
325
+        }
326
+        break;
327
+    default :
328
+        webAlertAndQuit("No operation set in request.", 88);
329 329
 }
Please login to merge, or discard this patch.
manager/processors/delete_htmlsnippet.processor.php 1 patch
Indentation   +8 added lines, -8 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('delete_snippet')) {
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
 // Set the item name for logger
@@ -17,18 +17,18 @@  discard block
 block discarded – undo
17 17
 
18 18
 // invoke OnBeforeChunkFormDelete event
19 19
 $modx->invokeEvent("OnBeforeChunkFormDelete",
20
-	array(
21
-		"id"	=> $id
22
-	));
20
+    array(
21
+        "id"	=> $id
22
+    ));
23 23
 
24 24
 // delete the chunk.
25 25
 EvolutionCMS\Models\SiteHtmlsnippet::destroy($id);
26 26
 
27 27
 // invoke OnChunkFormDelete event
28 28
 $modx->invokeEvent("OnChunkFormDelete",
29
-	array(
30
-		"id"	=> $id
31
-	));
29
+    array(
30
+        "id"	=> $id
31
+    ));
32 32
 
33 33
 // empty cache
34 34
 $modx->clearCache('full');
Please login to merge, or discard this patch.
manager/processors/save_content.processor.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -492,7 +492,7 @@
 block discarded – undo
492 492
                 }elseif ((!empty($pub_date)&& $pub_date<=$currentdate && $published)) {
493 493
                 $publishedon = $pub_date;
494 494
                 $publishedby = $modx->getLoginUserID();
495
-                   }elseif ($was_published && !$published) {
495
+                    }elseif ($was_published && !$published) {
496 496
                 $publishedon = 0;
497 497
                 $publishedby = 0;
498 498
             } else {
Please login to merge, or discard this patch.