Completed
Push — develop ( 6e72d2...5c04fc )
by Dmytro
16:21 queued 06:21
created
manager/actions/mutate_settings/tab3_user_settings.inc.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@  discard block
 block discarded – undo
6 6
   <tr>
7 7
     <td nowrap class="warning"><?php echo $_lang['udperms_title'] ?><br><small>[(use_udperms)]</small></td>
8 8
     <td>
9
-        <?php echo wrap_label($_lang['yes'],form_radio('use_udperms', 1, 'id="udPermsOn"'));?><br />
10
-        <?php echo wrap_label($_lang['no'], form_radio('use_udperms', 0, 'id="udPermsOff"'));?>
9
+        <?php echo wrap_label($_lang['yes'], form_radio('use_udperms', 1, 'id="udPermsOn"')); ?><br />
10
+        <?php echo wrap_label($_lang['no'], form_radio('use_udperms', 0, 'id="udPermsOff"')); ?>
11 11
     </td>
12 12
   </tr>
13 13
   <tr>
@@ -17,16 +17,16 @@  discard block
 block discarded – undo
17 17
   <tr>
18 18
     <td colspan="2"><div class="split"></div></td>
19 19
   </tr>
20
-  <tr class="udPerms" <?php echo showHide($use_udperms==1);?>>
20
+  <tr class="udPerms" <?php echo showHide($use_udperms == 1); ?>>
21 21
     <td nowrap class="warning"><?php echo $_lang['udperms_allowroot_title'] ?><br><small>[(udperms_allowroot)]</small></td>
22 22
     <td>
23
-      <label><input type="radio" name="udperms_allowroot" value="1" <?php echo $udperms_allowroot=='1' ? 'checked="checked"' : "" ; ?> />
23
+      <label><input type="radio" name="udperms_allowroot" value="1" <?php echo $udperms_allowroot == '1' ? 'checked="checked"' : ""; ?> />
24 24
       <?php echo $_lang['yes']?></label><br />
25
-      <label><input type="radio" name="udperms_allowroot" value="0" <?php echo $udperms_allowroot=='0' ? 'checked="checked"' : "" ; ?> />
25
+      <label><input type="radio" name="udperms_allowroot" value="0" <?php echo $udperms_allowroot == '0' ? 'checked="checked"' : ""; ?> />
26 26
       <?php echo $_lang['no']?></label>
27 27
     </td>
28 28
   </tr>
29
-  <tr class="udPerms" <?php echo showHide($use_udperms==1);?>>
29
+  <tr class="udPerms" <?php echo showHide($use_udperms == 1); ?>>
30 30
     <td width="200">&nbsp;</td>
31 31
     <td class="comment"><?php echo $_lang['udperms_allowroot_message'] ?></td>
32 32
   </tr>
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
   <tr>
38 38
     <td nowrap class="warning"><?php echo $_lang['email_sender_method'] ?><br><small>[(email_sender_method)]</small></td>
39 39
     <td>
40
-      <label><input type="radio" name="email_sender_method" value="1" <?php echo $email_sender_method=='1' ? 'checked="checked"' : "" ; ?> />
40
+      <label><input type="radio" name="email_sender_method" value="1" <?php echo $email_sender_method == '1' ? 'checked="checked"' : ""; ?> />
41 41
       <?php echo $_lang['auto']?></label><br />
42
-      <label><input type="radio" name="email_sender_method" value="0" <?php echo $email_sender_method=='0' ? 'checked="checked"' : "" ; ?> />
42
+      <label><input type="radio" name="email_sender_method" value="0" <?php echo $email_sender_method == '0' ? 'checked="checked"' : ""; ?> />
43 43
       <?php echo $_lang['use_emailsender']?></label>
44 44
     </td>
45 45
   </tr>
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
   <tr>
56 56
     <td nowrap class="warning"><?php echo $_lang['email_method_title'] ?><br><small>[(email_method)]</small></td>
57 57
     <td>
58
-        <?php echo wrap_label($_lang['email_method_mail'],form_radio('email_method','mail','id="useMail"'));?><br />
59
-        <?php echo wrap_label($_lang['email_method_smtp'],form_radio('email_method','smtp','id="useSmtp"'));?>
60
-        <div class="smtpRow" <?php echo showHide($email_method=='smtp');?>>
61
-            <?php include_once(MODX_MANAGER_PATH . 'actions/mutate_settings/snippet_smtp.inc.php'); ?>
58
+        <?php echo wrap_label($_lang['email_method_mail'], form_radio('email_method', 'mail', 'id="useMail"')); ?><br />
59
+        <?php echo wrap_label($_lang['email_method_smtp'], form_radio('email_method', 'smtp', 'id="useSmtp"')); ?>
60
+        <div class="smtpRow" <?php echo showHide($email_method == 'smtp'); ?>>
61
+            <?php include_once(MODX_MANAGER_PATH.'actions/mutate_settings/snippet_smtp.inc.php'); ?>
62 62
         </div>
63 63
     </td>
64 64
   </tr>
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
       <br />
71 71
       <p><?php echo $_lang['update_settings_from_language']; ?></p>
72 72
       <select name="reload_emailsubject" id="reload_emailsubject_select" onchange="confirmLangChange(this, 'emailsubject_default', 'emailsubject_field');">
73
-<?php echo get_lang_options('emailsubject_default');?>
73
+<?php echo get_lang_options('emailsubject_default'); ?>
74 74
       </select>
75 75
     </td>
76 76
     <td ><input id="emailsubject_field" name="emailsubject" onchange="documentDirty=true;" type="text" maxlength="255" style="width: 250px;" value="<?php echo $emailsubject; ?>" />
77
-        <input type="hidden" name="emailsubject_default" id="emailsubject_default_hidden" value="<?php echo addslashes($_lang['emailsubject_default']);?>" />
77
+        <input type="hidden" name="emailsubject_default" id="emailsubject_default_hidden" value="<?php echo addslashes($_lang['emailsubject_default']); ?>" />
78 78
     </td>
79 79
   </tr>
80 80
   <tr>
@@ -89,11 +89,11 @@  discard block
 block discarded – undo
89 89
       <br />
90 90
       <p><?php echo $_lang['update_settings_from_language']; ?></p>
91 91
       <select name="reload_signupemail_message" id="reload_signupemail_message_select" onchange="confirmLangChange(this, 'system_email_signup', 'signupemail_message_textarea');">
92
-<?php echo get_lang_options('system_email_signup');?>
92
+<?php echo get_lang_options('system_email_signup'); ?>
93 93
       </select>
94 94
     </td>
95 95
     <td> <textarea id="signupemail_message_textarea" name="signupemail_message" style="width:100%; height: 120px;"><?php echo $signupemail_message; ?></textarea>
96
-        <input type="hidden" name="system_email_signup_default" id="system_email_signup_hidden" value="<?php echo addslashes($_lang['system_email_signup']);?>" />
96
+        <input type="hidden" name="system_email_signup_default" id="system_email_signup_hidden" value="<?php echo addslashes($_lang['system_email_signup']); ?>" />
97 97
     </td>
98 98
   </tr>
99 99
   <tr>
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
       <br />
109 109
       <p><?php echo $_lang['update_settings_from_language']; ?></p>
110 110
       <select name="reload_websignupemail_message" id="reload_websignupemail_message_select" onchange="confirmLangChange(this, 'system_email_websignup', 'websignupemail_message_textarea');">
111
-<?php echo get_lang_options('system_email_websignup');?>
111
+<?php echo get_lang_options('system_email_websignup'); ?>
112 112
       </select>
113 113
     </td>
114 114
     <td> <textarea id="websignupemail_message_textarea" name="websignupemail_message" style="width:100%; height: 120px;"><?php echo $websignupemail_message; ?></textarea>
115
-        <input type="hidden" name="system_email_websignup_default" id="system_email_websignup_hidden" value="<?php echo addslashes($_lang['system_email_websignup']);?>" />
115
+        <input type="hidden" name="system_email_websignup_default" id="system_email_websignup_hidden" value="<?php echo addslashes($_lang['system_email_websignup']); ?>" />
116 116
     </td>
117 117
   </tr>
118 118
   <tr>
@@ -127,11 +127,11 @@  discard block
 block discarded – undo
127 127
       <br />
128 128
       <p><?php echo $_lang['update_settings_from_language']; ?></p>
129 129
       <select name="reload_system_email_webreminder_message" id="reload_system_email_webreminder_select" onchange="confirmLangChange(this, 'system_email_webreminder', 'system_email_webreminder_textarea');">
130
-<?php echo get_lang_options('system_email_webreminder');?>
130
+<?php echo get_lang_options('system_email_webreminder'); ?>
131 131
       </select>
132 132
     </td>
133 133
     <td> <textarea id="system_email_webreminder_textarea" name="webpwdreminder_message" style="width:100%; height: 120px;"><?php echo $webpwdreminder_message; ?></textarea>
134
-        <input type="hidden" name="system_email_webreminder_default" id="system_email_webreminder_hidden" value="<?php echo addslashes($_lang['system_email_webreminder']);?>" />
134
+        <input type="hidden" name="system_email_webreminder_default" id="system_email_webreminder_hidden" value="<?php echo addslashes($_lang['system_email_webreminder']); ?>" />
135 135
     </td>
136 136
   </tr>
137 137
   <tr>
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
         <?php
144 144
             // invoke OnUserSettingsRender event
145 145
             $evtOut = $modx->invokeEvent('OnUserSettingsRender');
146
-            if(is_array($evtOut)) echo implode("",$evtOut);
146
+            if (is_array($evtOut)) echo implode("", $evtOut);
147 147
         ?>
148 148
     </td>
149 149
   </tr>
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
   <tr>
154 154
     <td nowrap class="warning" valign="top"><?php echo $_lang['allow_multiple_emails_title'] ?><br><small>[(allow_multiple_emails)]</small></td>
155 155
     <td>
156
-      <?php echo wrap_label($_lang['yes'],form_radio('allow_multiple_emails','1'));?><br />
157
-      <?php echo wrap_label($_lang['no'], form_radio('allow_multiple_emails','0'));?>
156
+      <?php echo wrap_label($_lang['yes'], form_radio('allow_multiple_emails', '1')); ?><br />
157
+      <?php echo wrap_label($_lang['no'], form_radio('allow_multiple_emails', '0')); ?>
158 158
     </td>
159 159
   </tr>
160 160
   <tr>
Please login to merge, or discard this patch.
manager/processors/save_web_user.processor.php 1 patch
Spacing   +61 added lines, -61 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_web_user')) {
5
+if (!$modx->hasPermission('save_web_user')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
@@ -11,14 +11,14 @@  discard block
 block discarded – undo
11 11
 $tbl_web_groups = $modx->getFullTableName('web_groups');
12 12
 
13 13
 $input = $_POST;
14
-foreach($input as $k => $v) {
15
-	if($k !== 'comment') {
14
+foreach ($input as $k => $v) {
15
+	if ($k !== 'comment') {
16 16
 		$v = sanitize($v);
17 17
 	}
18 18
 	$input[$k] = $v;
19 19
 }
20 20
 
21
-$id = (int)$input['id'];
21
+$id = (int) $input['id'];
22 22
 $oldusername = $input['oldusername'];
23 23
 $newusername = !empty ($input['newusername']) ? trim($input['newusername']) : "New User";
24 24
 $esc_newusername = $modx->db->escape($newusername);
@@ -50,21 +50,21 @@  discard block
 block discarded – undo
50 50
 $user_groups = $input['user_groups'];
51 51
 
52 52
 // verify password
53
-if($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) {
53
+if ($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) {
54 54
 	webAlertAndQuit("Password typed is mismatched");
55 55
 }
56 56
 
57 57
 // verify email
58
-if($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) {
58
+if ($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) {
59 59
 	webAlertAndQuit("E-mail address doesn't seem to be valid!");
60 60
 }
61 61
 
62
-switch($input['mode']) {
62
+switch ($input['mode']) {
63 63
 	case '87' : // new user
64 64
 		// check if this user name already exist
65 65
 		$rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'");
66 66
 		$limit = $modx->db->getValue($rs);
67
-		if($limit > 0) {
67
+		if ($limit > 0) {
68 68
 			webAlertAndQuit("User name is already in use!");
69 69
 		}
70 70
 
@@ -72,21 +72,21 @@  discard block
 block discarded – undo
72 72
 		if ($modx->config['allow_multiple_emails'] != 1) {
73 73
 			$rs = $modx->db->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'");
74 74
 			$limit = $modx->db->getValue($rs);
75
-			if($limit > 0) {
75
+			if ($limit > 0) {
76 76
 				webAlertAndQuit("Email is already in use!");
77 77
 			}
78 78
 		}
79 79
 
80 80
 		// generate a new password for this user
81
-		if($specifiedpassword != "" && $passwordgenmethod == "spec") {
82
-			if(strlen($specifiedpassword) < 6) {
81
+		if ($specifiedpassword != "" && $passwordgenmethod == "spec") {
82
+			if (strlen($specifiedpassword) < 6) {
83 83
 				webAlertAndQuit("Password is too short!");
84 84
 			} else {
85 85
 				$newpassword = $specifiedpassword;
86 86
 			}
87
-		} elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
87
+		} elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") {
88 88
 			webAlertAndQuit("You didn't specify a password for this user!");
89
-		} elseif($passwordgenmethod == 'g') {
89
+		} elseif ($passwordgenmethod == 'g') {
90 90
 			$newpassword = generate_password(8);
91 91
 		} else {
92 92
 			webAlertAndQuit("No password generation method specified!");
@@ -116,11 +116,11 @@  discard block
 block discarded – undo
116 116
 		/*******************************************************************************/
117 117
 		// put the user in the user_groups he/ she should be in
118 118
 		// first, check that up_perms are switched on!
119
-		if($use_udperms == 1) {
120
-			if(!empty($user_groups)) {
121
-				for($i = 0; $i < count($user_groups); $i++) {
119
+		if ($use_udperms == 1) {
120
+			if (!empty($user_groups)) {
121
+				for ($i = 0; $i < count($user_groups); $i++) {
122 122
 					$f = array();
123
-					$f['webgroup'] = (int)$user_groups[$i];
123
+					$f['webgroup'] = (int) $user_groups[$i];
124 124
 					$f['webuser'] = $internalKey;
125 125
 					$modx->db->insert($f, $tbl_web_groups);
126 126
 				}
@@ -144,20 +144,20 @@  discard block
 block discarded – undo
144 144
             "id" => $internalKey
145 145
         ));
146 146
 
147
-		if($passwordnotifymethod == 'e') {
147
+		if ($passwordnotifymethod == 'e') {
148 148
 			sendMailMessage($email, $newusername, $newpassword, $fullname);
149
-			if($input['stay'] != '') {
149
+			if ($input['stay'] != '') {
150 150
 				$a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87";
151
-				$header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
151
+				$header = "Location: index.php?a={$a}&r=2&stay=".$input['stay'];
152 152
 				header($header);
153 153
 			} else {
154 154
 				$header = "Location: index.php?a=99&r=2";
155 155
 				header($header);
156 156
 			}
157 157
 		} else {
158
-			if($input['stay'] != '') {
158
+			if ($input['stay'] != '') {
159 159
 				$a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87";
160
-				$stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
160
+				$stayUrl = "index.php?a={$a}&r=2&stay=".$input['stay'];
161 161
 			} else {
162 162
 				$stayUrl = "index.php?a=99&r=2";
163 163
 			}
@@ -190,29 +190,29 @@  discard block
 block discarded – undo
190 190
 		break;
191 191
 	case '88' : // edit user
192 192
 		// generate a new password for this user
193
-		if($genpassword == 1) {
194
-			if($specifiedpassword != "" && $passwordgenmethod == "spec") {
195
-				if(strlen($specifiedpassword) < 6) {
193
+		if ($genpassword == 1) {
194
+			if ($specifiedpassword != "" && $passwordgenmethod == "spec") {
195
+				if (strlen($specifiedpassword) < 6) {
196 196
 					webAlertAndQuit("Password is too short!");
197 197
 				} else {
198 198
 					$newpassword = $specifiedpassword;
199 199
 				}
200
-			} elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
200
+			} elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") {
201 201
 				webAlertAndQuit("You didn't specify a password for this user!");
202
-			} elseif($passwordgenmethod == 'g') {
202
+			} elseif ($passwordgenmethod == 'g') {
203 203
 				$newpassword = generate_password(8);
204 204
 			} else {
205 205
 				webAlertAndQuit("No password generation method specified!");
206 206
 			}
207 207
 		}
208
-		if($passwordnotifymethod == 'e') {
208
+		if ($passwordnotifymethod == 'e') {
209 209
 			sendMailMessage($email, $newusername, $newpassword, $fullname);
210 210
 		}
211 211
 
212 212
 		// check if the username already exist
213 213
 		$rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'");
214 214
 		$limit = $modx->db->getValue($rs);
215
-		if($limit > 0) {
215
+		if ($limit > 0) {
216 216
 			webAlertAndQuit("User name is already in use!");
217 217
 		}
218 218
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 		if ($modx->config['allow_multiple_emails'] != 1) {
221 221
 			$rs = $modx->db->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'");
222 222
 			$limit = $modx->db->getValue($rs);
223
-			if($limit > 0) {
223
+			if ($limit > 0) {
224 224
 				webAlertAndQuit("Email is already in use!");
225 225
 			}
226 226
 		}
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 		// update user name and password
235 235
 		$field = array();
236 236
 		$field['username'] = $esc_newusername;
237
-		if($genpassword == 1) {
237
+		if ($genpassword == 1) {
238 238
 			$field['password'] = md5($newpassword);
239 239
 		}
240 240
 		$modx->db->update($field, $tbl_web_users, "id='{$id}'");
@@ -251,13 +251,13 @@  discard block
 block discarded – undo
251 251
 		/*******************************************************************************/
252 252
 		// put the user in the user_groups he/ she should be in
253 253
 		// first, check that up_perms are switched on!
254
-		if($use_udperms == 1) {
254
+		if ($use_udperms == 1) {
255 255
 			// as this is an existing user, delete his/ her entries in the groups before saving the new groups
256 256
 			$modx->db->delete($tbl_web_groups, "webuser='{$id}'");
257
-			if(!empty($user_groups)) {
258
-				for($i = 0; $i < count($user_groups); $i++) {
257
+			if (!empty($user_groups)) {
258
+				for ($i = 0; $i < count($user_groups); $i++) {
259 259
 					$field = array();
260
-					$field['webgroup'] = (int)$user_groups[$i];
260
+					$field['webgroup'] = (int) $user_groups[$i];
261 261
 					$field['webuser'] = $id;
262 262
 					$modx->db->insert($field, $tbl_web_groups);
263 263
 				}
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
         ));
280 280
 
281 281
         // invoke OnWebChangePassword event
282
-        if($genpassword == 1) {
282
+        if ($genpassword == 1) {
283 283
             $modx->invokeEvent("OnWebChangePassword", array(
284 284
                 "userid" => $id,
285 285
                 "username" => $newusername,
@@ -293,10 +293,10 @@  discard block
 block discarded – undo
293 293
             "id" => $id
294 294
         ));
295 295
 
296
-		if($genpassword == 1 && $passwordnotifymethod == 's') {
297
-			if($input['stay'] != '') {
296
+		if ($genpassword == 1 && $passwordnotifymethod == 's') {
297
+			if ($input['stay'] != '') {
298 298
 				$a = ($input['stay'] == '2') ? "88&id={$id}" : "87";
299
-				$stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
299
+				$stayUrl = "index.php?a={$a}&r=2&stay=".$input['stay'];
300 300
 			} else {
301 301
 				$stayUrl = "index.php?a=99&r=2";
302 302
 			}
@@ -324,9 +324,9 @@  discard block
 block discarded – undo
324 324
 
325 325
 			include_once "footer.inc.php";
326 326
 		} else {
327
-			if($input['stay'] != '') {
327
+			if ($input['stay'] != '') {
328 328
 				$a = ($input['stay'] == '2') ? "88&id={$id}" : "87";
329
-				$header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
329
+				$header = "Location: index.php?a={$a}&r=2&stay=".$input['stay'];
330 330
 				header($header);
331 331
 			} else {
332 332
 				$header = "Location: index.php?a=99&r=2";
@@ -344,15 +344,15 @@  discard block
 block discarded – undo
344 344
  * @param string $string
345 345
  * @return string
346 346
  */
347
-function save_user_quoted_printable($string) {
347
+function save_user_quoted_printable($string){
348 348
 	$crlf = "\n";
349
-	$string = preg_replace('!(\r\n|\r|\n)!', $crlf, $string) . $crlf;
349
+	$string = preg_replace('!(\r\n|\r|\n)!', $crlf, $string).$crlf;
350 350
 	$f[] = '/([\000-\010\013\014\016-\037\075\177-\377])/e';
351 351
 	$r[] = "'=' . sprintf('%02X', ord('\\1'))";
352
-	$f[] = '/([\011\040])' . $crlf . '/e';
353
-	$r[] = "'=' . sprintf('%02X', ord('\\1')) . '" . $crlf . "'";
352
+	$f[] = '/([\011\040])'.$crlf.'/e';
353
+	$r[] = "'=' . sprintf('%02X', ord('\\1')) . '".$crlf."'";
354 354
 	$string = preg_replace($f, $r, $string);
355
-	return trim(wordwrap($string, 70, ' =' . $crlf));
355
+	return trim(wordwrap($string, 70, ' ='.$crlf));
356 356
 }
357 357
 
358 358
 /**
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
  * @param string $pwd
364 364
  * @param string $ufn
365 365
  */
366
-function sendMailMessage($email, $uid, $pwd, $ufn) {
366
+function sendMailMessage($email, $uid, $pwd, $ufn){
367 367
 	global $modx, $_lang, $websignupemail_message;
368 368
 	global $emailsubject, $emailsender;
369 369
 	global $site_name, $site_url;
@@ -384,14 +384,14 @@  discard block
 block discarded – undo
384 384
 	$param['to'] = $email;
385 385
 	$param['type'] = 'text';
386 386
 	$rs = $modx->sendmail($param);
387
-	if(!$rs) {
387
+	if (!$rs) {
388 388
 		$modx->manager->saveFormValues();
389 389
 		$modx->messageQuit("{$email} - {$_lang['error_sending_email']}");
390 390
 	}
391 391
 }
392 392
 
393 393
 // Save User Settings
394
-function saveUserSettings($id) {
394
+function saveUserSettings($id){
395 395
 	global $modx;
396 396
 	$tbl_web_user_settings = $modx->getFullTableName('web_user_settings');
397 397
 
@@ -403,12 +403,12 @@  discard block
 block discarded – undo
403 403
 
404 404
 	$modx->db->delete($tbl_web_user_settings, "webuser='{$id}'");
405 405
 
406
-	foreach($settings as $n) {
406
+	foreach ($settings as $n) {
407 407
 		$vl = $_POST[$n];
408
-		if(is_array($vl)) {
408
+		if (is_array($vl)) {
409 409
 			$vl = implode(",", $vl);
410 410
 		}
411
-		if($vl != '') {
411
+		if ($vl != '') {
412 412
 			$f = array();
413 413
 			$f['webuser'] = $id;
414 414
 			$f['setting_name'] = $n;
@@ -420,33 +420,33 @@  discard block
 block discarded – undo
420 420
 }
421 421
 
422 422
 // Web alert -  sends an alert to web browser
423
-function webAlertAndQuit($msg) {
423
+function webAlertAndQuit($msg){
424 424
 	global $id, $modx;
425 425
 	$mode = $_POST['mode'];
426 426
 	$modx->manager->saveFormValues($mode);
427
-	$modx->webAlertAndQuit($msg, "index.php?a={$mode}" . ($mode == '88' ? "&id={$id}" : ''));
427
+	$modx->webAlertAndQuit($msg, "index.php?a={$mode}".($mode == '88' ? "&id={$id}" : ''));
428 428
 }
429 429
 
430 430
 // Generate password
431
-function generate_password($length = 10) {
431
+function generate_password($length = 10){
432 432
 	$allowable_characters = "abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789";
433 433
 	$ps_len = strlen($allowable_characters);
434 434
 	mt_srand((double) microtime() * 1000000);
435 435
 	$pass = "";
436
-	for($i = 0; $i < $length; $i++) {
436
+	for ($i = 0; $i < $length; $i++) {
437 437
 		$pass .= $allowable_characters[mt_rand(0, $ps_len - 1)];
438 438
 	}
439 439
 	return $pass;
440 440
 }
441 441
 
442
-function sanitize($str = '', $safecount = 0) {
442
+function sanitize($str = '', $safecount = 0){
443 443
 	global $modx;
444 444
 	$safecount++;
445
-	if(1000 < $safecount) {
445
+	if (1000 < $safecount) {
446 446
 		exit("error too many loops '{$safecount}'");
447 447
 	}
448
-	if(is_array($str)) {
449
-		foreach($str as $i => $v) {
448
+	if (is_array($str)) {
449
+		foreach ($str as $i => $v) {
450 450
 			$str[$i] = sanitize($v, $safecount);
451 451
 		}
452 452
 	} else {
Please login to merge, or discard this patch.