Completed
Push — develop ( dba6d0...45e39e )
by Agel_Nash
12:14
created
manager/processors/save_web_user.processor.php 1 patch
Indentation   +192 added lines, -192 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_web_user')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $tbl_web_users = $modx->getDatabase()->getFullTableName('web_users');
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
 
13 13
 $input = $_POST;
14 14
 foreach($input as $k => $v) {
15
-	if($k !== 'comment') {
16
-		$v = $modx->getPhpCompat()->htmlspecialchars($v, ENT_NOQUOTES);
17
-	}
18
-	$input[$k] = $v;
15
+    if($k !== 'comment') {
16
+        $v = $modx->getPhpCompat()->htmlspecialchars($v, ENT_NOQUOTES);
17
+    }
18
+    $input[$k] = $v;
19 19
 }
20 20
 
21 21
 $id = (int)$input['id'];
@@ -51,82 +51,82 @@  discard block
 block discarded – undo
51 51
 
52 52
 // verify password
53 53
 if($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) {
54
-	webAlertAndQuit("Password typed is mismatched", 88);
54
+    webAlertAndQuit("Password typed is mismatched", 88);
55 55
 }
56 56
 
57 57
 // verify email
58 58
 if($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) {
59
-	webAlertAndQuit("E-mail address doesn't seem to be valid!", 88);
59
+    webAlertAndQuit("E-mail address doesn't seem to be valid!", 88);
60 60
 }
61 61
 
62 62
 switch($input['mode']) {
63
-	case '87' : // new user
64
-		// check if this user name already exist
65
-		$rs = $modx->getDatabase()->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'");
66
-		$limit = $modx->getDatabase()->getValue($rs);
67
-		if($limit > 0) {
68
-			webAlertAndQuit("User name is already in use!", 88);
69
-		}
70
-
71
-		// check if the email address already exist
72
-		if ($modx->config['allow_multiple_emails'] != 1) {
73
-			$rs = $modx->getDatabase()->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'");
74
-			$limit = $modx->getDatabase()->getValue($rs);
75
-			if($limit > 0) {
76
-				webAlertAndQuit("Email is already in use!", 88);
77
-			}
78
-		}
79
-
80
-		// generate a new password for this user
81
-		if($specifiedpassword != "" && $passwordgenmethod == "spec") {
82
-			if(strlen($specifiedpassword) < 6) {
83
-				webAlertAndQuit("Password is too short!", 88);
84
-			} else {
85
-				$newpassword = $specifiedpassword;
86
-			}
87
-		} elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
88
-			webAlertAndQuit("You didn't specify a password for this user!", 88);
89
-		} elseif($passwordgenmethod == 'g') {
90
-			$newpassword = generate_password(8);
91
-		} else {
92
-			webAlertAndQuit("No password generation method specified!", 88);
93
-		}
94
-
95
-		// invoke OnBeforeWUsrFormSave event
96
-		$modx->invokeEvent("OnBeforeWUsrFormSave", array(
97
-			"mode" => "new",
98
-		));
99
-
100
-		// create the user account
101
-		$field = array();
102
-		$field['username'] = $esc_newusername;
103
-		$field['password'] = md5($newpassword);
104
-		$internalKey = $modx->getDatabase()->insert($field, $tbl_web_users);
105
-
106
-		$field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter');
107
-		$field = $modx->getDatabase()->escape($field);
108
-		$modx->getDatabase()->insert($field, $tbl_web_user_attributes);
109
-
110
-		// Save User Settings
63
+    case '87' : // new user
64
+        // check if this user name already exist
65
+        $rs = $modx->getDatabase()->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'");
66
+        $limit = $modx->getDatabase()->getValue($rs);
67
+        if($limit > 0) {
68
+            webAlertAndQuit("User name is already in use!", 88);
69
+        }
70
+
71
+        // check if the email address already exist
72
+        if ($modx->config['allow_multiple_emails'] != 1) {
73
+            $rs = $modx->getDatabase()->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'");
74
+            $limit = $modx->getDatabase()->getValue($rs);
75
+            if($limit > 0) {
76
+                webAlertAndQuit("Email is already in use!", 88);
77
+            }
78
+        }
79
+
80
+        // generate a new password for this user
81
+        if($specifiedpassword != "" && $passwordgenmethod == "spec") {
82
+            if(strlen($specifiedpassword) < 6) {
83
+                webAlertAndQuit("Password is too short!", 88);
84
+            } else {
85
+                $newpassword = $specifiedpassword;
86
+            }
87
+        } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
88
+            webAlertAndQuit("You didn't specify a password for this user!", 88);
89
+        } elseif($passwordgenmethod == 'g') {
90
+            $newpassword = generate_password(8);
91
+        } else {
92
+            webAlertAndQuit("No password generation method specified!", 88);
93
+        }
94
+
95
+        // invoke OnBeforeWUsrFormSave event
96
+        $modx->invokeEvent("OnBeforeWUsrFormSave", array(
97
+            "mode" => "new",
98
+        ));
99
+
100
+        // create the user account
101
+        $field = array();
102
+        $field['username'] = $esc_newusername;
103
+        $field['password'] = md5($newpassword);
104
+        $internalKey = $modx->getDatabase()->insert($field, $tbl_web_users);
105
+
106
+        $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter');
107
+        $field = $modx->getDatabase()->escape($field);
108
+        $modx->getDatabase()->insert($field, $tbl_web_user_attributes);
109
+
110
+        // Save User Settings
111 111
         saveWebUserSettings($internalKey);
112 112
 
113
-		// Set the item name for logger
114
-		$_SESSION['itemname'] = $newusername;
115
-
116
-		/*******************************************************************************/
117
-		// put the user in the user_groups he/ she should be in
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++) {
122
-					$f = array();
123
-					$f['webgroup'] = (int)$user_groups[$i];
124
-					$f['webuser'] = $internalKey;
125
-					$modx->getDatabase()->insert($f, $tbl_web_groups);
126
-				}
127
-			}
128
-		}
129
-		// end of user_groups stuff!
113
+        // Set the item name for logger
114
+        $_SESSION['itemname'] = $newusername;
115
+
116
+        /*******************************************************************************/
117
+        // put the user in the user_groups he/ she should be in
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++) {
122
+                    $f = array();
123
+                    $f['webgroup'] = (int)$user_groups[$i];
124
+                    $f['webuser'] = $internalKey;
125
+                    $modx->getDatabase()->insert($f, $tbl_web_groups);
126
+                }
127
+            }
128
+        }
129
+        // end of user_groups stuff!
130 130
 
131 131
         // invoke OnWebSaveUser event
132 132
         $modx->invokeEvent("OnWebSaveUser", array(
@@ -144,26 +144,26 @@  discard block
 block discarded – undo
144 144
             "id" => $internalKey
145 145
         ));
146 146
 
147
-		if($passwordnotifymethod == 'e') {
147
+        if($passwordnotifymethod == 'e') {
148 148
             sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url);
149
-			if($input['stay'] != '') {
150
-				$a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87";
151
-				$header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
152
-				header($header);
153
-			} else {
154
-				$header = "Location: index.php?a=99&r=2";
155
-				header($header);
156
-			}
157
-		} else {
158
-			if($input['stay'] != '') {
159
-				$a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87";
160
-				$stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
161
-			} else {
162
-				$stayUrl = "index.php?a=99&r=2";
163
-			}
164
-
165
-			include_once "header.inc.php";
166
-			?>
149
+            if($input['stay'] != '') {
150
+                $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87";
151
+                $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
152
+                header($header);
153
+            } else {
154
+                $header = "Location: index.php?a=99&r=2";
155
+                header($header);
156
+            }
157
+        } else {
158
+            if($input['stay'] != '') {
159
+                $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87";
160
+                $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
161
+            } else {
162
+                $stayUrl = "index.php?a=99&r=2";
163
+            }
164
+
165
+            include_once "header.inc.php";
166
+            ?>
167 167
 
168 168
 			<h1><?php echo $_lang['web_user_title']; ?></h1>
169 169
 
@@ -185,86 +185,86 @@  discard block
 block discarded – undo
185 185
 			</div>
186 186
 			<?php
187 187
 
188
-			include_once "footer.inc.php";
189
-		}
190
-		break;
191
-	case '88' : // edit user
192
-		// generate a new password for this user
193
-		if($genpassword == 1) {
194
-			if($specifiedpassword != "" && $passwordgenmethod == "spec") {
195
-				if(strlen($specifiedpassword) < 6) {
196
-					webAlertAndQuit("Password is too short!", 88);
197
-				} else {
198
-					$newpassword = $specifiedpassword;
199
-				}
200
-			} elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
201
-				webAlertAndQuit("You didn't specify a password for this user!", 88);
202
-			} elseif($passwordgenmethod == 'g') {
203
-				$newpassword = generate_password(8);
204
-			} else {
205
-				webAlertAndQuit("No password generation method specified!", 88);
206
-			}
207
-		}
208
-		if($passwordnotifymethod == 'e') {
188
+            include_once "footer.inc.php";
189
+        }
190
+        break;
191
+    case '88' : // edit user
192
+        // generate a new password for this user
193
+        if($genpassword == 1) {
194
+            if($specifiedpassword != "" && $passwordgenmethod == "spec") {
195
+                if(strlen($specifiedpassword) < 6) {
196
+                    webAlertAndQuit("Password is too short!", 88);
197
+                } else {
198
+                    $newpassword = $specifiedpassword;
199
+                }
200
+            } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
201
+                webAlertAndQuit("You didn't specify a password for this user!", 88);
202
+            } elseif($passwordgenmethod == 'g') {
203
+                $newpassword = generate_password(8);
204
+            } else {
205
+                webAlertAndQuit("No password generation method specified!", 88);
206
+            }
207
+        }
208
+        if($passwordnotifymethod == 'e') {
209 209
             sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url);
210
-		}
211
-
212
-		// check if the username already exist
213
-		$rs = $modx->getDatabase()->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'");
214
-		$limit = $modx->getDatabase()->getValue($rs);
215
-		if($limit > 0) {
216
-			webAlertAndQuit("User name is already in use!", 88);
217
-		}
218
-
219
-		// check if the email address already exists
220
-		if ($modx->config['allow_multiple_emails'] != 1) {
221
-			$rs = $modx->getDatabase()->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'");
222
-			$limit = $modx->getDatabase()->getValue($rs);
223
-			if($limit > 0) {
224
-				webAlertAndQuit("Email is already in use!", 88);
225
-			}
226
-		}
227
-
228
-		// invoke OnBeforeWUsrFormSave event
229
-		$modx->invokeEvent("OnBeforeWUsrFormSave", array(
230
-			"mode" => "upd",
231
-			"id" => $id
232
-		));
233
-
234
-		// update user name and password
235
-		$field = array();
236
-		$field['username'] = $esc_newusername;
237
-		if($genpassword == 1) {
238
-			$field['password'] = md5($newpassword);
239
-		}
240
-		$modx->getDatabase()->update($field, $tbl_web_users, "id='{$id}'");
241
-		$field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter');
242
-		$field = $modx->getDatabase()->escape($field);
243
-		$modx->getDatabase()->update($field, $tbl_web_user_attributes, "internalKey='{$id}'");
244
-
245
-		// Save User Settings
210
+        }
211
+
212
+        // check if the username already exist
213
+        $rs = $modx->getDatabase()->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'");
214
+        $limit = $modx->getDatabase()->getValue($rs);
215
+        if($limit > 0) {
216
+            webAlertAndQuit("User name is already in use!", 88);
217
+        }
218
+
219
+        // check if the email address already exists
220
+        if ($modx->config['allow_multiple_emails'] != 1) {
221
+            $rs = $modx->getDatabase()->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'");
222
+            $limit = $modx->getDatabase()->getValue($rs);
223
+            if($limit > 0) {
224
+                webAlertAndQuit("Email is already in use!", 88);
225
+            }
226
+        }
227
+
228
+        // invoke OnBeforeWUsrFormSave event
229
+        $modx->invokeEvent("OnBeforeWUsrFormSave", array(
230
+            "mode" => "upd",
231
+            "id" => $id
232
+        ));
233
+
234
+        // update user name and password
235
+        $field = array();
236
+        $field['username'] = $esc_newusername;
237
+        if($genpassword == 1) {
238
+            $field['password'] = md5($newpassword);
239
+        }
240
+        $modx->getDatabase()->update($field, $tbl_web_users, "id='{$id}'");
241
+        $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter');
242
+        $field = $modx->getDatabase()->escape($field);
243
+        $modx->getDatabase()->update($field, $tbl_web_user_attributes, "internalKey='{$id}'");
244
+
245
+        // Save User Settings
246 246
         saveWebUserSettings($id);
247 247
 
248
-		// Set the item name for logger
249
-		$_SESSION['itemname'] = $newusername;
250
-
251
-		/*******************************************************************************/
252
-		// put the user in the user_groups he/ she should be in
253
-		// first, check that up_perms are switched on!
254
-		if($use_udperms == 1) {
255
-			// as this is an existing user, delete his/ her entries in the groups before saving the new groups
256
-			$modx->getDatabase()->delete($tbl_web_groups, "webuser='{$id}'");
257
-			if(!empty($user_groups)) {
258
-				for($i = 0; $i < count($user_groups); $i++) {
259
-					$field = array();
260
-					$field['webgroup'] = (int)$user_groups[$i];
261
-					$field['webuser'] = $id;
262
-					$modx->getDatabase()->insert($field, $tbl_web_groups);
263
-				}
264
-			}
265
-		}
266
-		// end of user_groups stuff!
267
-		/*******************************************************************************/
248
+        // Set the item name for logger
249
+        $_SESSION['itemname'] = $newusername;
250
+
251
+        /*******************************************************************************/
252
+        // put the user in the user_groups he/ she should be in
253
+        // first, check that up_perms are switched on!
254
+        if($use_udperms == 1) {
255
+            // as this is an existing user, delete his/ her entries in the groups before saving the new groups
256
+            $modx->getDatabase()->delete($tbl_web_groups, "webuser='{$id}'");
257
+            if(!empty($user_groups)) {
258
+                for($i = 0; $i < count($user_groups); $i++) {
259
+                    $field = array();
260
+                    $field['webgroup'] = (int)$user_groups[$i];
261
+                    $field['webuser'] = $id;
262
+                    $modx->getDatabase()->insert($field, $tbl_web_groups);
263
+                }
264
+            }
265
+        }
266
+        // end of user_groups stuff!
267
+        /*******************************************************************************/
268 268
 
269 269
         // invoke OnWebSaveUser event
270 270
         $modx->invokeEvent("OnWebSaveUser", array(
@@ -293,16 +293,16 @@  discard block
 block discarded – undo
293 293
             "id" => $id
294 294
         ));
295 295
 
296
-		if($genpassword == 1 && $passwordnotifymethod == 's') {
297
-			if($input['stay'] != '') {
298
-				$a = ($input['stay'] == '2') ? "88&id={$id}" : "87";
299
-				$stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
300
-			} else {
301
-				$stayUrl = "index.php?a=99&r=2";
302
-			}
296
+        if($genpassword == 1 && $passwordnotifymethod == 's') {
297
+            if($input['stay'] != '') {
298
+                $a = ($input['stay'] == '2') ? "88&id={$id}" : "87";
299
+                $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
300
+            } else {
301
+                $stayUrl = "index.php?a=99&r=2";
302
+            }
303 303
 
304
-			include_once "header.inc.php";
305
-			?>
304
+            include_once "header.inc.php";
305
+            ?>
306 306
 
307 307
 			<h1><?php echo $_lang['web_user_title']; ?></h1>
308 308
 
@@ -322,18 +322,18 @@  discard block
 block discarded – undo
322 322
 			</div>
323 323
 			<?php
324 324
 
325
-			include_once "footer.inc.php";
326
-		} else {
327
-			if($input['stay'] != '') {
328
-				$a = ($input['stay'] == '2') ? "88&id={$id}" : "87";
329
-				$header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
330
-				header($header);
331
-			} else {
332
-				$header = "Location: index.php?a=99&r=2";
333
-				header($header);
334
-			}
335
-		}
336
-		break;
337
-	default :
338
-		webAlertAndQuit("No operation set in request.", 88);
325
+            include_once "footer.inc.php";
326
+        } else {
327
+            if($input['stay'] != '') {
328
+                $a = ($input['stay'] == '2') ? "88&id={$id}" : "87";
329
+                $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
330
+                header($header);
331
+            } else {
332
+                $header = "Location: index.php?a=99&r=2";
333
+                header($header);
334
+            }
335
+        }
336
+        break;
337
+    default :
338
+        webAlertAndQuit("No operation set in request.", 88);
339 339
 }
Please login to merge, or discard this patch.
manager/processors/empty_table.processor.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 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
 
9 9
 $modx->getDatabase()->truncate($modx->getDatabase()->getFullTableName('manager_log'));
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,9 +22,9 @@  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
 $modx->getDatabase()->delete($modx->getDatabase()->getFullTableName('manager_users'), "id='{$id}'");
@@ -39,16 +39,16 @@  discard block
 block discarded – undo
39 39
 
40 40
 // invoke OnManagerDeleteUser event
41 41
 $modx->invokeEvent("OnManagerDeleteUser",
42
-	array(
43
-		"userid"		=> $id,
44
-		"username"		=> $username
45
-	));
42
+    array(
43
+        "userid"		=> $id,
44
+        "username"		=> $username
45
+    ));
46 46
 
47 47
 // invoke OnUserFormDelete event
48 48
 $modx->invokeEvent("OnUserFormDelete",
49
-	array(
50
-		"id"	=> $id
51
-	));
49
+    array(
50
+        "id"	=> $id
51
+    ));
52 52
 
53 53
 $header="Location: index.php?a=75";
54 54
 header($header);
Please login to merge, or discard this patch.
manager/processors/duplicate_snippet.processor.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -3,12 +3,12 @@  discard block
 block discarded – undo
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 if(!$modx->hasPermission('new_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
 // count duplicates
@@ -19,14 +19,14 @@  discard block
 block discarded – undo
19 19
 
20 20
 // duplicate Snippet
21 21
 $newid = $modx->getDatabase()->insert(
22
-	array(
23
-		'name'=>'',
24
-		'description'=>'',
25
-		'snippet'=>'',
26
-		'properties'=>'',
27
-		'category'=>'',
28
-		), $modx->getDatabase()->getFullTableName('site_snippets'), // Insert into
29
-	"CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, snippet, properties, category", $modx->getDatabase()->getFullTableName('site_snippets'), "id='{$id}'"); // Copy from
22
+    array(
23
+        'name'=>'',
24
+        'description'=>'',
25
+        'snippet'=>'',
26
+        'properties'=>'',
27
+        'category'=>'',
28
+        ), $modx->getDatabase()->getFullTableName('site_snippets'), // Insert into
29
+    "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, snippet, properties, category", $modx->getDatabase()->getFullTableName('site_snippets'), "id='{$id}'"); // Copy from
30 30
 
31 31
 // Set the item name for logger
32 32
 $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_snippets'), "id='{$newid}'"));
Please login to merge, or discard this patch.
manager/processors/delete_module.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_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
 // Set the item name for logger
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
 
18 18
 // invoke OnBeforeModFormDelete event
19 19
 $modx->invokeEvent("OnBeforeModFormDelete",
20
-	array(
21
-		"id"	=> $id
22
-	));
20
+    array(
21
+        "id"	=> $id
22
+    ));
23 23
 
24 24
 // delete the module.
25 25
 $modx->getDatabase()->delete($modx->getDatabase()->getFullTableName('site_modules'), "id='{$id}'");
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
 
33 33
 // invoke OnModFormDelete event
34 34
 $modx->invokeEvent("OnModFormDelete",
35
-	array(
36
-		"id"	=> $id
37
-	));
35
+    array(
36
+        "id"	=> $id
37
+    ));
38 38
 
39 39
 // empty cache
40 40
 $modx->clearCache('full');
Please login to merge, or discard this patch.
manager/processors/undelete_content.processor.php 1 patch
Indentation   +15 added lines, -15 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_document')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $id = isset($_REQUEST['id'])? (int)$_REQUEST['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
 /************ webber ********/
@@ -31,14 +31,14 @@  discard block
 block discarded – undo
31 31
 $udperms->role = $_SESSION['mgrRole'];
32 32
 
33 33
 if(!$udperms->checkPermissions()) {
34
-	$modx->webAlertAndQuit($_lang["access_permission_denied"]);
34
+    $modx->webAlertAndQuit($_lang["access_permission_denied"]);
35 35
 }
36 36
 
37 37
 // get the timestamp on which the document was deleted.
38 38
 $rs = $modx->getDatabase()->select('deletedon', $modx->getDatabase()->getFullTableName('site_content'), "id='{$id}' AND deleted=1");
39 39
 $deltime = $modx->getDatabase()->getValue($rs);
40 40
 if(!$deltime) {
41
-	$modx->webAlertAndQuit("Couldn't find document to determine it's date of deletion!");
41
+    $modx->webAlertAndQuit("Couldn't find document to determine it's date of deletion!");
42 42
 }
43 43
 
44 44
 $children = array();
@@ -46,20 +46,20 @@  discard block
 block discarded – undo
46 46
 getChildrenForUnDelete($id);
47 47
 
48 48
 if(count($children)>0) {
49
-	$modx->getDatabase()->update(
50
-		array(
51
-			'deleted'   => 0,
52
-			'deletedby' => 0,
53
-			'deletedon' => 0,
54
-		), $modx->getDatabase()->getFullTableName('site_content'), "id IN(".implode(", ", $children).")");
49
+    $modx->getDatabase()->update(
50
+        array(
51
+            'deleted'   => 0,
52
+            'deletedby' => 0,
53
+            'deletedon' => 0,
54
+        ), $modx->getDatabase()->getFullTableName('site_content'), "id IN(".implode(", ", $children).")");
55 55
 }
56 56
 //'undelete' the document.
57 57
 $modx->getDatabase()->update(
58
-	array(
59
-		'deleted'   => 0,
60
-		'deletedby' => 0,
61
-		'deletedon' => 0,
62
-	), $modx->getDatabase()->getFullTableName('site_content'), "id='{$id}'");
58
+    array(
59
+        'deleted'   => 0,
60
+        'deletedby' => 0,
61
+        'deletedon' => 0,
62
+    ), $modx->getDatabase()->getFullTableName('site_content'), "id='{$id}'");
63 63
 
64 64
 $modx->invokeEvent("OnDocFormUnDelete",
65 65
     array(
Please login to merge, or discard this patch.
manager/frames/mainmenu.php 1 patch
Indentation   +325 added lines, -325 removed lines patch added patch discarded remove patch
@@ -4,237 +4,237 @@  discard block
 block discarded – undo
4 4
 */
5 5
 
6 6
 $sitemenu['bars'] = array(
7
-	'bars',
8
-	'main',
9
-	'<i class="fa fa-bars"></i>',
10
-	'javascript:;',
11
-	$_lang['home'],
12
-	'modx.resizer.toggle(); return false;',
13
-	' return false;',
14
-	'',
15
-	0,
16
-	10,
17
-	''
7
+    'bars',
8
+    'main',
9
+    '<i class="fa fa-bars"></i>',
10
+    'javascript:;',
11
+    $_lang['home'],
12
+    'modx.resizer.toggle(); return false;',
13
+    ' return false;',
14
+    '',
15
+    0,
16
+    10,
17
+    ''
18 18
 );
19 19
 
20 20
 //mainMenu
21 21
 $sitemenu['site'] = array(
22
-	'site',
23
-	'main',
24
-	'<i class="fa fa-tachometer"></i><span class="menu-item-text">' . $_lang['home'] . '</span>',
25
-	'index.php?a=2',
26
-	$_lang['home'],
27
-	'',
28
-	'',
29
-	'main',
30
-	0,
31
-	10,
32
-	'active'
22
+    'site',
23
+    'main',
24
+    '<i class="fa fa-tachometer"></i><span class="menu-item-text">' . $_lang['home'] . '</span>',
25
+    'index.php?a=2',
26
+    $_lang['home'],
27
+    '',
28
+    '',
29
+    'main',
30
+    0,
31
+    10,
32
+    'active'
33 33
 );
34 34
 
35 35
 if($modx->hasPermission('edit_template') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('file_manager')) {
36
-	$sitemenu['elements'] = array(
37
-		'elements',
38
-		'main',
39
-		'<i class="fa fa-th"></i><span class="menu-item-text">' . $_lang['elements'] . '</span>',
40
-		'javascript:;',
41
-		$_lang['elements'],
42
-		' return false;',
43
-		'',
44
-		'',
45
-		0,
46
-		20,
47
-		''
48
-	);
36
+    $sitemenu['elements'] = array(
37
+        'elements',
38
+        'main',
39
+        '<i class="fa fa-th"></i><span class="menu-item-text">' . $_lang['elements'] . '</span>',
40
+        'javascript:;',
41
+        $_lang['elements'],
42
+        ' return false;',
43
+        '',
44
+        '',
45
+        0,
46
+        20,
47
+        ''
48
+    );
49 49
 }
50 50
 
51 51
 if($modx->hasPermission('exec_module')) {
52
-	$sitemenu['modules'] = array(
53
-		'modules',
54
-		'main',
55
-		'<i class="'.$_style['icons_modules'] .'"></i><span class="menu-item-text">' . $_lang['modules'] . '</span>',
56
-		'javascript:;',
57
-		$_lang['modules'],
58
-		' return false;',
59
-		'',
60
-		'',
61
-		0,
62
-		30,
63
-		''
64
-	);
52
+    $sitemenu['modules'] = array(
53
+        'modules',
54
+        'main',
55
+        '<i class="'.$_style['icons_modules'] .'"></i><span class="menu-item-text">' . $_lang['modules'] . '</span>',
56
+        'javascript:;',
57
+        $_lang['modules'],
58
+        ' return false;',
59
+        '',
60
+        '',
61
+        0,
62
+        30,
63
+        ''
64
+    );
65 65
 }
66 66
 
67 67
 if($modx->hasPermission('edit_user') || $modx->hasPermission('edit_web_user') || $modx->hasPermission('edit_role') || $modx->hasPermission('access_permissions') || $modx->hasPermission('web_access_permissions')) {
68
-	$sitemenu['users'] = array(
69
-		'users',
70
-		'main',
71
-		'<i class="fa fa-users"></i><span class="menu-item-text">' . $_lang['users'] . '</span>',
72
-		'javascript:;',
73
-		$_lang['users'],
74
-		' return false;',
75
-		'edit_user',
76
-		'',
77
-		0,
78
-		40,
79
-		''
80
-	);
68
+    $sitemenu['users'] = array(
69
+        'users',
70
+        'main',
71
+        '<i class="fa fa-users"></i><span class="menu-item-text">' . $_lang['users'] . '</span>',
72
+        'javascript:;',
73
+        $_lang['users'],
74
+        ' return false;',
75
+        'edit_user',
76
+        '',
77
+        0,
78
+        40,
79
+        ''
80
+    );
81 81
 }
82 82
 
83 83
 if($modx->hasPermission('empty_cache') || $modx->hasPermission('bk_manager') || $modx->hasPermission('remove_locks') || $modx->hasPermission('import_static') || $modx->hasPermission('export_static')) {
84
-	$sitemenu['tools'] = array(
85
-		'tools',
86
-		'main',
87
-		'<i class="fa fa-wrench"></i><span class="menu-item-text">' . $_lang['tools'] . '</span>',
88
-		'javascript:;',
89
-		$_lang['tools'],
90
-		' return false;',
91
-		'',
92
-		'',
93
-		0,
94
-		50,
95
-		''
96
-	);
84
+    $sitemenu['tools'] = array(
85
+        'tools',
86
+        'main',
87
+        '<i class="fa fa-wrench"></i><span class="menu-item-text">' . $_lang['tools'] . '</span>',
88
+        'javascript:;',
89
+        $_lang['tools'],
90
+        ' return false;',
91
+        '',
92
+        '',
93
+        0,
94
+        50,
95
+        ''
96
+    );
97 97
 }
98 98
 
99 99
 $tab = 0;
100 100
 if($modx->hasPermission('edit_template')) {
101
-	$sitemenu['element_templates'] = array(
102
-		'element_templates',
103
-		'elements',
104
-		'<i class="fa fa-newspaper-o"></i>' . $_lang['manage_templates'] . '<i class="fa fa-angle-right toggle"></i>',
105
-		'index.php?a=76&tab=' . $tab++,
106
-		$_lang['manage_templates'],
107
-		'',
108
-		'new_template,edit_template',
109
-		'main',
110
-		0,
111
-		10,
112
-		'dropdown-toggle'
113
-	);
101
+    $sitemenu['element_templates'] = array(
102
+        'element_templates',
103
+        'elements',
104
+        '<i class="fa fa-newspaper-o"></i>' . $_lang['manage_templates'] . '<i class="fa fa-angle-right toggle"></i>',
105
+        'index.php?a=76&tab=' . $tab++,
106
+        $_lang['manage_templates'],
107
+        '',
108
+        'new_template,edit_template',
109
+        'main',
110
+        0,
111
+        10,
112
+        'dropdown-toggle'
113
+    );
114 114
 }
115 115
 if($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) {
116
-	$sitemenu['element_tplvars'] = array(
117
-		'element_tplvars',
118
-		'elements',
119
-		'<i class="fa fa-list-alt"></i>' . $_lang['tmplvars'] . '<i class="fa fa-angle-right toggle"></i>',
120
-		'index.php?a=76&tab=' . $tab++,
121
-		$_lang['tmplvars'],
122
-		'',
123
-		'new_template,edit_template',
124
-		'main',
125
-		0,
126
-		20,
127
-		'dropdown-toggle'
128
-	);
116
+    $sitemenu['element_tplvars'] = array(
117
+        'element_tplvars',
118
+        'elements',
119
+        '<i class="fa fa-list-alt"></i>' . $_lang['tmplvars'] . '<i class="fa fa-angle-right toggle"></i>',
120
+        'index.php?a=76&tab=' . $tab++,
121
+        $_lang['tmplvars'],
122
+        '',
123
+        'new_template,edit_template',
124
+        'main',
125
+        0,
126
+        20,
127
+        'dropdown-toggle'
128
+    );
129 129
 }
130 130
 if($modx->hasPermission('edit_chunk')) {
131
-	$sitemenu['element_htmlsnippets'] = array(
132
-		'element_htmlsnippets',
133
-		'elements',
134
-		'<i class="fa fa-th-large"></i>' . $_lang['manage_htmlsnippets'] . '<i class="fa fa-angle-right toggle"></i>',
135
-		'index.php?a=76&tab=' . $tab++,
136
-		$_lang['manage_htmlsnippets'],
137
-		'',
138
-		'new_chunk,edit_chunk',
139
-		'main',
140
-		0,
141
-		30,
142
-		'dropdown-toggle'
143
-	);
131
+    $sitemenu['element_htmlsnippets'] = array(
132
+        'element_htmlsnippets',
133
+        'elements',
134
+        '<i class="fa fa-th-large"></i>' . $_lang['manage_htmlsnippets'] . '<i class="fa fa-angle-right toggle"></i>',
135
+        'index.php?a=76&tab=' . $tab++,
136
+        $_lang['manage_htmlsnippets'],
137
+        '',
138
+        'new_chunk,edit_chunk',
139
+        'main',
140
+        0,
141
+        30,
142
+        'dropdown-toggle'
143
+    );
144 144
 }
145 145
 if($modx->hasPermission('edit_snippet')) {
146
-	$sitemenu['element_snippets'] = array(
147
-		'element_snippets',
148
-		'elements',
149
-		'<i class="fa fa-code"></i>' . $_lang['manage_snippets'] . '<i class="fa fa-angle-right toggle"></i>',
150
-		'index.php?a=76&tab=' . $tab++,
151
-		$_lang['manage_snippets'],
152
-		'',
153
-		'new_snippet,edit_snippet',
154
-		'main',
155
-		0,
156
-		40,
157
-		'dropdown-toggle'
158
-	);
146
+    $sitemenu['element_snippets'] = array(
147
+        'element_snippets',
148
+        'elements',
149
+        '<i class="fa fa-code"></i>' . $_lang['manage_snippets'] . '<i class="fa fa-angle-right toggle"></i>',
150
+        'index.php?a=76&tab=' . $tab++,
151
+        $_lang['manage_snippets'],
152
+        '',
153
+        'new_snippet,edit_snippet',
154
+        'main',
155
+        0,
156
+        40,
157
+        'dropdown-toggle'
158
+    );
159 159
 }
160 160
 if($modx->hasPermission('edit_plugin')) {
161
-	$sitemenu['element_plugins'] = array(
162
-		'element_plugins',
163
-		'elements',
164
-		'<i class="fa fa-plug"></i>' . $_lang['manage_plugins'] . '<i class="fa fa-angle-right toggle"></i>',
165
-		'index.php?a=76&tab=' . $tab++,
166
-		$_lang['manage_plugins'],
167
-		'',
168
-		'new_plugin,edit_plugin',
169
-		'main',
170
-		0,
171
-		50,
172
-		'dropdown-toggle'
173
-	);
161
+    $sitemenu['element_plugins'] = array(
162
+        'element_plugins',
163
+        'elements',
164
+        '<i class="fa fa-plug"></i>' . $_lang['manage_plugins'] . '<i class="fa fa-angle-right toggle"></i>',
165
+        'index.php?a=76&tab=' . $tab++,
166
+        $_lang['manage_plugins'],
167
+        '',
168
+        'new_plugin,edit_plugin',
169
+        'main',
170
+        0,
171
+        50,
172
+        'dropdown-toggle'
173
+    );
174 174
 }
175 175
 //$sitemenu['element_categories']     = array('element_categories','elements',$_lang['element_categories'],'index.php?a=76&tab=5',$_lang['element_categories'],'','new_template,edit_template,new_snippet,edit_snippet,new_chunk,edit_chunk,new_plugin,edit_plugin','main',1,60,'');
176 176
 
177 177
 if($modx->hasPermission('file_manager')) {
178
-	$sitemenu['manage_files'] = array(
179
-		'manage_files',
180
-		'elements',
181
-		'<i class="fa fa-folder-open-o"></i>' . $_lang['manage_files'],
182
-		'index.php?a=31',
183
-		$_lang['manage_files'],
184
-		'',
185
-		'file_manager',
186
-		'main',
187
-		0,
188
-		80,
189
-		''
190
-	);
178
+    $sitemenu['manage_files'] = array(
179
+        'manage_files',
180
+        'elements',
181
+        '<i class="fa fa-folder-open-o"></i>' . $_lang['manage_files'],
182
+        'index.php?a=31',
183
+        $_lang['manage_files'],
184
+        '',
185
+        'file_manager',
186
+        'main',
187
+        0,
188
+        80,
189
+        ''
190
+    );
191 191
 }
192 192
 if($modx->hasPermission('category_manager')) {
193
-	$sitemenu['manage_categories'] = array(
194
-		'manage_categories',
195
-		'elements',
196
-		'<i class="fa fa-object-group"></i>' . $_lang['manage_categories'],
197
-		'index.php?a=120',
198
-		$_lang['manage_categories'],
199
-		'',
200
-		'category_manager',
201
-		'main',
202
-		0,
203
-		70,
204
-		''
205
-	);
193
+    $sitemenu['manage_categories'] = array(
194
+        'manage_categories',
195
+        'elements',
196
+        '<i class="fa fa-object-group"></i>' . $_lang['manage_categories'],
197
+        'index.php?a=120',
198
+        $_lang['manage_categories'],
199
+        '',
200
+        'category_manager',
201
+        'main',
202
+        0,
203
+        70,
204
+        ''
205
+    );
206 206
 }
207 207
 
208 208
 // Modules Menu Items
209 209
 if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module') || $modx->hasPermission('save_module')) {
210
-	$sitemenu['new_module'] = array(
211
-		'new_module',
212
-		'modules',
213
-		'<i class="'.$_style['icons_modules'] .'"></i>' . $_lang['module_management'],
214
-		'index.php?a=106',
215
-		$_lang['module_management'],
216
-		'',
217
-		'new_module,edit_module',
218
-		'main',
219
-		1,
220
-		0,
221
-		''
222
-	);
210
+    $sitemenu['new_module'] = array(
211
+        'new_module',
212
+        'modules',
213
+        '<i class="'.$_style['icons_modules'] .'"></i>' . $_lang['module_management'],
214
+        'index.php?a=106',
215
+        $_lang['module_management'],
216
+        '',
217
+        'new_module,edit_module',
218
+        'main',
219
+        1,
220
+        0,
221
+        ''
222
+    );
223 223
 }
224 224
 
225 225
 if($modx->hasPermission('exec_module')) {
226
-	if($_SESSION['mgrRole'] != 1 && !empty($modx->config['use_udperms'])) {
227
-		$rs = $modx->getDatabase()->query('SELECT DISTINCT sm.id, sm.name, sm.icon, mg.member
226
+    if($_SESSION['mgrRole'] != 1 && !empty($modx->config['use_udperms'])) {
227
+        $rs = $modx->getDatabase()->query('SELECT DISTINCT sm.id, sm.name, sm.icon, mg.member
228 228
 				FROM ' . $modx->getDatabase()->getFullTableName('site_modules') . ' AS sm
229 229
 				LEFT JOIN ' . $modx->getDatabase()->getFullTableName('site_module_access') . ' AS sma ON sma.module = sm.id
230 230
 				LEFT JOIN ' . $modx->getDatabase()->getFullTableName('member_groups') . ' AS mg ON sma.usergroup = mg.user_group
231 231
                 WHERE (mg.member IS NULL OR mg.member = ' . $modx->getLoginUserID() . ') AND sm.disabled != 1 AND sm.locked != 1
232 232
                 ORDER BY sm.name');
233
-	} else {
234
-		$rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('site_modules'), 'disabled != 1', 'name');
235
-	}
236
-	if($modx->getDatabase()->getRecordCount($rs)) {
237
-	    while ($row = $modx->getDatabase()->getRow($rs)) {
233
+    } else {
234
+        $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('site_modules'), 'disabled != 1', 'name');
235
+    }
236
+    if($modx->getDatabase()->getRecordCount($rs)) {
237
+        while ($row = $modx->getDatabase()->getRow($rs)) {
238 238
             $sitemenu['module' . $row['id']] = array(
239 239
                 'module' . $row['id'],
240 240
                 'modules',
@@ -255,83 +255,83 @@  discard block
 block discarded – undo
255 255
 // security menu items (users)
256 256
 
257 257
 if($modx->hasPermission('edit_user')) {
258
-	$sitemenu['user_management_title'] = array(
259
-		'user_management_title',
260
-		'users',
261
-		'<i class="fa fa fa-user"></i>' . $_lang['user_management_title'] . '<i class="fa fa-angle-right toggle"></i>',
262
-		'index.php?a=75',
263
-		$_lang['user_management_title'],
264
-		'',
265
-		'edit_user',
266
-		'main',
267
-		0,
268
-		10,
269
-		'dropdown-toggle'
270
-	);
258
+    $sitemenu['user_management_title'] = array(
259
+        'user_management_title',
260
+        'users',
261
+        '<i class="fa fa fa-user"></i>' . $_lang['user_management_title'] . '<i class="fa fa-angle-right toggle"></i>',
262
+        'index.php?a=75',
263
+        $_lang['user_management_title'],
264
+        '',
265
+        'edit_user',
266
+        'main',
267
+        0,
268
+        10,
269
+        'dropdown-toggle'
270
+    );
271 271
 }
272 272
 
273 273
 if($modx->hasPermission('edit_web_user')) {
274
-	$sitemenu['web_user_management_title'] = array(
275
-		'web_user_management_title',
276
-		'users',
277
-		'<i class="fa fa-users"></i>' . $_lang['web_user_management_title'] . '<i class="fa fa-angle-right toggle"></i>',
278
-		'index.php?a=99',
279
-		$_lang['web_user_management_title'],
280
-		'',
281
-		'edit_web_user',
282
-		'main',
283
-		0,
284
-		20,
285
-		'dropdown-toggle'
286
-	);
274
+    $sitemenu['web_user_management_title'] = array(
275
+        'web_user_management_title',
276
+        'users',
277
+        '<i class="fa fa-users"></i>' . $_lang['web_user_management_title'] . '<i class="fa fa-angle-right toggle"></i>',
278
+        'index.php?a=99',
279
+        $_lang['web_user_management_title'],
280
+        '',
281
+        'edit_web_user',
282
+        'main',
283
+        0,
284
+        20,
285
+        'dropdown-toggle'
286
+    );
287 287
 }
288 288
 
289 289
 if($modx->hasPermission('edit_role')) {
290
-	$sitemenu['role_management_title'] = array(
291
-		'role_management_title',
292
-		'users',
293
-		'<i class="fa fa-legal"></i>' . $_lang['role_management_title'],
294
-		'index.php?a=86',
295
-		$_lang['role_management_title'],
296
-		'',
297
-		'new_role,edit_role,delete_role',
298
-		'main',
299
-		0,
300
-		30,
301
-		''
302
-	);
290
+    $sitemenu['role_management_title'] = array(
291
+        'role_management_title',
292
+        'users',
293
+        '<i class="fa fa-legal"></i>' . $_lang['role_management_title'],
294
+        'index.php?a=86',
295
+        $_lang['role_management_title'],
296
+        '',
297
+        'new_role,edit_role,delete_role',
298
+        'main',
299
+        0,
300
+        30,
301
+        ''
302
+    );
303 303
 }
304 304
 
305 305
 if($modx->hasPermission('access_permissions')) {
306
-	$sitemenu['manager_permissions'] = array(
307
-		'manager_permissions',
308
-		'users',
309
-		'<i class="fa fa-male"></i>' . $_lang['manager_permissions'],
310
-		'index.php?a=40',
311
-		$_lang['manager_permissions'],
312
-		'',
313
-		'access_permissions',
314
-		'main',
315
-		0,
316
-		40,
317
-		''
318
-	);
306
+    $sitemenu['manager_permissions'] = array(
307
+        'manager_permissions',
308
+        'users',
309
+        '<i class="fa fa-male"></i>' . $_lang['manager_permissions'],
310
+        'index.php?a=40',
311
+        $_lang['manager_permissions'],
312
+        '',
313
+        'access_permissions',
314
+        'main',
315
+        0,
316
+        40,
317
+        ''
318
+    );
319 319
 }
320 320
 
321 321
 if($modx->hasPermission('web_access_permissions')) {
322
-	$sitemenu['web_permissions'] = array(
323
-		'web_permissions',
324
-		'users',
325
-		'<i class="fa fa-universal-access"></i>' . $_lang['web_permissions'],
326
-		'index.php?a=91',
327
-		$_lang['web_permissions'],
328
-		'',
329
-		'web_access_permissions',
330
-		'main',
331
-		0,
332
-		50,
333
-		''
334
-	);
322
+    $sitemenu['web_permissions'] = array(
323
+        'web_permissions',
324
+        'users',
325
+        '<i class="fa fa-universal-access"></i>' . $_lang['web_permissions'],
326
+        'index.php?a=91',
327
+        $_lang['web_permissions'],
328
+        '',
329
+        'web_access_permissions',
330
+        'main',
331
+        0,
332
+        50,
333
+        ''
334
+    );
335 335
 }
336 336
 
337 337
 // Tools Menu
@@ -361,104 +361,104 @@  discard block
 block discarded – undo
361 361
 );
362 362
 
363 363
 $sitemenu['search'] = array(
364
-	'search',
365
-	'tools',
366
-	'<i class="fa fa-search"></i>' . $_lang['search'],
367
-	'index.php?a=71',
368
-	$_lang['search'],
369
-	'',
370
-	'',
371
-	'main',
372
-	1,
373
-	9,
374
-	''
364
+    'search',
365
+    'tools',
366
+    '<i class="fa fa-search"></i>' . $_lang['search'],
367
+    'index.php?a=71',
368
+    $_lang['search'],
369
+    '',
370
+    '',
371
+    'main',
372
+    1,
373
+    9,
374
+    ''
375 375
 );
376 376
 
377 377
 if($modx->hasPermission('bk_manager')) {
378
-	$sitemenu['bk_manager'] = array(
379
-		'bk_manager',
380
-		'tools',
381
-		'<i class="fa fa-database"></i>' . $_lang['bk_manager'],
382
-		'index.php?a=93',
383
-		$_lang['bk_manager'],
384
-		'',
385
-		'bk_manager',
386
-		'main',
387
-		0,
388
-		10,
389
-		''
390
-	);
378
+    $sitemenu['bk_manager'] = array(
379
+        'bk_manager',
380
+        'tools',
381
+        '<i class="fa fa-database"></i>' . $_lang['bk_manager'],
382
+        'index.php?a=93',
383
+        $_lang['bk_manager'],
384
+        '',
385
+        'bk_manager',
386
+        'main',
387
+        0,
388
+        10,
389
+        ''
390
+    );
391 391
 }
392 392
 
393 393
 if($modx->hasPermission('remove_locks')) {
394
-	$sitemenu['remove_locks'] = array(
395
-		'remove_locks',
396
-		'tools',
397
-		'<i class="fa fa-hourglass"></i>' . $_lang['remove_locks'],
398
-		'javascript:modx.removeLocks();',
399
-		$_lang['remove_locks'],
400
-		'',
401
-		'remove_locks',
402
-		'',
403
-		0,
404
-		20,
405
-		''
406
-	);
394
+    $sitemenu['remove_locks'] = array(
395
+        'remove_locks',
396
+        'tools',
397
+        '<i class="fa fa-hourglass"></i>' . $_lang['remove_locks'],
398
+        'javascript:modx.removeLocks();',
399
+        $_lang['remove_locks'],
400
+        '',
401
+        'remove_locks',
402
+        '',
403
+        0,
404
+        20,
405
+        ''
406
+    );
407 407
 }
408 408
 
409 409
 if($modx->hasPermission('import_static')) {
410
-	$sitemenu['import_site'] = array(
411
-		'import_site',
412
-		'tools',
413
-		'<i class="fa fa-upload"></i>' . $_lang['import_site'],
414
-		'index.php?a=95',
415
-		$_lang['import_site'],
416
-		'',
417
-		'import_static',
418
-		'main',
419
-		0,
420
-		30,
421
-		''
422
-	);
410
+    $sitemenu['import_site'] = array(
411
+        'import_site',
412
+        'tools',
413
+        '<i class="fa fa-upload"></i>' . $_lang['import_site'],
414
+        'index.php?a=95',
415
+        $_lang['import_site'],
416
+        '',
417
+        'import_static',
418
+        'main',
419
+        0,
420
+        30,
421
+        ''
422
+    );
423 423
 }
424 424
 
425 425
 if($modx->hasPermission('export_static')) {
426
-	$sitemenu['export_site'] = array(
427
-		'export_site',
428
-		'tools',
429
-		'<i class="fa fa-download"></i>' . $_lang['export_site'],
430
-		'index.php?a=83',
431
-		$_lang['export_site'],
432
-		'',
433
-		'export_static',
434
-		'main',
435
-		1,
436
-		40,
437
-		''
438
-	);
426
+    $sitemenu['export_site'] = array(
427
+        'export_site',
428
+        'tools',
429
+        '<i class="fa fa-download"></i>' . $_lang['export_site'],
430
+        'index.php?a=83',
431
+        $_lang['export_site'],
432
+        '',
433
+        'export_static',
434
+        'main',
435
+        1,
436
+        40,
437
+        ''
438
+    );
439 439
 }
440 440
 
441 441
 $menu = $modx->invokeEvent("OnManagerMenuPrerender", array('menu' => $sitemenu));
442 442
 if(is_array($menu)) {
443
-	$newmenu = array();
444
-	foreach($menu as $item){
445
-		if(is_array(unserialize($item))){
446
-			$newmenu = array_merge($newmenu, unserialize($item));
447
-		}
448
-	}
449
-	if(count($newmenu)> 0) $sitemenu = $newmenu;
443
+    $newmenu = array();
444
+    foreach($menu as $item){
445
+        if(is_array(unserialize($item))){
446
+            $newmenu = array_merge($newmenu, unserialize($item));
447
+        }
448
+    }
449
+    if(count($newmenu)> 0) $sitemenu = $newmenu;
450 450
 }
451 451
 
452 452
 if(file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/includes/menu.class.inc.php')) {
453
-	include_once(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/includes/menu.class.inc.php');
453
+    include_once(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/includes/menu.class.inc.php');
454 454
 } else {
455
-	include_once(MODX_MANAGER_PATH . 'includes/menu.class.inc.php');
455
+    include_once(MODX_MANAGER_PATH . 'includes/menu.class.inc.php');
456 456
 }
457 457
 $menu = new EVOmenu();
458 458
 $menu->Build($sitemenu, array(
459
-	'outerClass' => 'nav',
460
-	'innerClass' => 'dropdown-menu',
461
-	'parentClass' => 'dropdown',
459
+    'outerClass' => 'nav',
460
+    'innerClass' => 'dropdown-menu',
461
+    'parentClass' => 'dropdown',
462 462
     'parentLinkClass' => 'dropdown-toggle',
463 463
     'parentLinkAttr' => '',
464 464
     'parentLinkIn' => ''
Please login to merge, or discard this patch.
manager/actions/role_management.static.php 1 patch
Indentation   +16 added lines, -16 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('edit_user')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 ?>
@@ -18,14 +18,14 @@  discard block
 block discarded – undo
18 18
 		<div class="form-group"><?= $_lang['role_management_msg'] ?> <a class="btn btn-secondary btn-sm" href="index.php?a=38"><i class="<?= $_style["actions_new"] ?> hide4desktop"></i> <?= $_lang['new_role'] ?></a></div>
19 19
 		<div class="form-group">
20 20
 			<?php
21
-			$rs = $modx->getDatabase()->select('name, id, description', $modx->getDatabase()->getFullTableName('user_roles'), '', 'name');
22
-			$limit = $modx->getDatabase()->getRecordCount($rs);
23
-			if($limit < 1) {
24
-				?>
21
+            $rs = $modx->getDatabase()->select('name, id, description', $modx->getDatabase()->getFullTableName('user_roles'), '', 'name');
22
+            $limit = $modx->getDatabase()->getRecordCount($rs);
23
+            if($limit < 1) {
24
+                ?>
25 25
 				<p><?= $_lang["no_records_found"] ?></p>
26 26
 				<?php
27
-			} else {
28
-				?>
27
+            } else {
28
+                ?>
29 29
 				<div class="row">
30 30
 					<div class="table-responsive">
31 31
 						<table class="table data">
@@ -37,24 +37,24 @@  discard block
 block discarded – undo
37 37
 							</thead>
38 38
 							<tbody>
39 39
 							<?php
40
-							while($row = $modx->getDatabase()->getRow($rs)) {
41
-								if($row['id'] == 1) {
42
-									?>
40
+                            while($row = $modx->getDatabase()->getRow($rs)) {
41
+                                if($row['id'] == 1) {
42
+                                    ?>
43 43
 									<tr class="text-muted disabled">
44 44
 										<td><b><?= $row['name'] ?></b></td>
45 45
 										<td><span><?= $_lang['administrator_role_message'] ?></span></td>
46 46
 									</tr>
47 47
 									<?php
48
-								} else {
49
-									?>
48
+                                } else {
49
+                                    ?>
50 50
 									<tr>
51 51
 										<td><a class="text-primary" href="index.php?id=<?= $row['id'] ?>&a=35"><?= $row['name'] ?></a></td>
52 52
 										<td><?= $row['description'] ?></td>
53 53
 									</tr>
54 54
 									<?php
55
-								}
56
-							}
57
-							?>
55
+                                }
56
+                            }
57
+                            ?>
58 58
 							</tbody>
59 59
 						</table>
60 60
 					</div>
Please login to merge, or discard this patch.
manager/actions/mutate_tmplvars.dynamic.php 1 patch
Indentation   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  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('edit_template') && $modx->getManagerApi()->action == '301') {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 if(!$modx->hasPermission('new_template') && $modx->getManagerApi()->action == '300') {
9
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
9
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
10 10
 }
11 11
 
12 12
 $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 
21 21
 // check to see the snippet editor isn't locked
22 22
 if($lockedEl = $modx->elementIsLocked(2, $id)) {
23
-	$modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['tmplvar']));
23
+    $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['tmplvar']));
24 24
 }
25 25
 // end check for lock
26 26
 
@@ -30,25 +30,25 @@  discard block
 block discarded – undo
30 30
 global $content;
31 31
 $content = array();
32 32
 if(isset($_GET['id'])) {
33
-	$rs = $modx->getDatabase()->select('*', $tbl_site_tmplvars, "id='{$id}'");
34
-	$content = $modx->getDatabase()->getRow($rs);
35
-	if(!$content) {
36
-		header("Location: " . MODX_SITE_URL . "index.php?id={$site_start}");
37
-	}
38
-
39
-	$_SESSION['itemname'] = $content['caption'];
40
-	if($content['locked'] == 1 && $modx->hasPermission('save_role') != 1) {
41
-		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
42
-	}
33
+    $rs = $modx->getDatabase()->select('*', $tbl_site_tmplvars, "id='{$id}'");
34
+    $content = $modx->getDatabase()->getRow($rs);
35
+    if(!$content) {
36
+        header("Location: " . MODX_SITE_URL . "index.php?id={$site_start}");
37
+    }
38
+
39
+    $_SESSION['itemname'] = $content['caption'];
40
+    if($content['locked'] == 1 && $modx->hasPermission('save_role') != 1) {
41
+        $modx->webAlertAndQuit($_lang["error_no_privileges"]);
42
+    }
43 43
 } else if(isset($_REQUEST['itemname'])) {
44
-	$content['name'] = $_REQUEST['itemname'];
44
+    $content['name'] = $_REQUEST['itemname'];
45 45
 } else {
46
-	$_SESSION['itemname'] = $_lang["new_tmplvars"];
47
-	$content['category'] = (int)$_REQUEST['catid'];
46
+    $_SESSION['itemname'] = $_lang["new_tmplvars"];
47
+    $content['category'] = (int)$_REQUEST['catid'];
48 48
 }
49 49
 
50 50
 if($modx->getManagerApi()->hasFormValues()) {
51
-	$modx->getManagerApi()->loadFormValues();
51
+    $modx->getManagerApi()->loadFormValues();
52 52
 }
53 53
 
54 54
 $content = array_merge($content, $_POST);
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 $RTEditors = '';
63 63
 $evtOut = $modx->invokeEvent('OnRichTextEditorRegister', array('forfrontend' => 1));
64 64
 if(is_array($evtOut)) {
65
-	$RTEditors = implode(',', $evtOut);
65
+    $RTEditors = implode(',', $evtOut);
66 66
 }
67 67
 
68 68
 ?>
@@ -277,12 +277,12 @@  discard block
 block discarded – undo
277 277
 
278 278
 <form name="mutate" method="post" action="index.php" enctype="multipart/form-data">
279 279
 	<?php
280
-	// invoke OnTVFormPrerender event
281
-	$evtOut = $modx->invokeEvent('OnTVFormPrerender', array('id' => $id));
282
-	if(is_array($evtOut)) {
283
-		echo implode("", $evtOut);
284
-	}
285
-	?>
280
+    // invoke OnTVFormPrerender event
281
+    $evtOut = $modx->invokeEvent('OnTVFormPrerender', array('id' => $id));
282
+    if(is_array($evtOut)) {
283
+        echo implode("", $evtOut);
284
+    }
285
+    ?>
286 286
 	<input type="hidden" name="id" value="<?= $content['id'] ?>">
287 287
 	<input type="hidden" name="a" value="302">
288 288
 	<input type="hidden" name="or" value="<?= $origin ?>">
@@ -343,11 +343,11 @@  discard block
 block discarded – undo
343 343
 						<select name="categoryid" class="form-control" onChange="documentDirty=true;">
344 344
 							<option>&nbsp;</option>
345 345
 							<?php
346
-							include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
347
-							foreach(getCategories() as $n => $v) {
348
-								echo "<option value='" . $v['id'] . "'" . ($content["category"] == $v["id"] ? " selected='selected'" : "") . ">" . $modx->getPhpCompat()->htmlspecialchars($v["category"]) . "</option>";
349
-							}
350
-							?>
346
+                            include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
347
+                            foreach(getCategories() as $n => $v) {
348
+                                echo "<option value='" . $v['id'] . "'" . ($content["category"] == $v["id"] ? " selected='selected'" : "") . ">" . $modx->getPhpCompat()->htmlspecialchars($v["category"]) . "</option>";
349
+                            }
350
+                            ?>
351 351
 						</select>
352 352
 					</div>
353 353
 				</div>
@@ -383,14 +383,14 @@  discard block
 block discarded – undo
383 383
 							<optgroup label="Custom Type">
384 384
 								<option value="custom_tv" <?= ($content['type'] == 'custom_tv' ? "selected='selected'" : "") ?>>Custom Input</option>
385 385
 								<?php
386
-								$custom_tvs = scandir(MODX_BASE_PATH . 'assets/tvs');
387
-								foreach($custom_tvs as $ctv) {
388
-									if(strpos($ctv, '.') !== 0 && $ctv != 'index.html') {
389
-										$selected = ($content['type'] == 'custom_tv:' . $ctv ? "selected='selected'" : "");
390
-										echo '<option value="custom_tv:' . $ctv . '"  ' . $selected . '>' . $ctv . '</option>';
391
-									}
392
-								}
393
-								?>
386
+                                $custom_tvs = scandir(MODX_BASE_PATH . 'assets/tvs');
387
+                                foreach($custom_tvs as $ctv) {
388
+                                    if(strpos($ctv, '.') !== 0 && $ctv != 'index.html') {
389
+                                        $selected = ($content['type'] == 'custom_tv:' . $ctv ? "selected='selected'" : "");
390
+                                        echo '<option value="custom_tv:' . $ctv . '"  ' . $selected . '>' . $ctv . '</option>';
391
+                                    }
392
+                                }
393
+                                ?>
394 394
 							</optgroup>
395 395
 						</select>
396 396
 					</div>
@@ -455,63 +455,63 @@  discard block
 block discarded – undo
455 455
 					<a class="btn btn-secondary btn-sm" href="javascript:;" onClick="check_toggle(); return false;"><?= $_lang['check_toggle'] ?></a>
456 456
 				</div>
457 457
 				<?php
458
-				$rs = $modx->getDatabase()->select(sprintf("tpl.id AS id, templatename, tpl.description AS tpldescription, tpl.locked AS tpllocked, tpl.selectable AS selectable, tmplvarid, if(isnull(cat.category),'%s',cat.category) AS category, cat.id AS catid", $_lang['no_category']), sprintf("%s as tpl
458
+                $rs = $modx->getDatabase()->select(sprintf("tpl.id AS id, templatename, tpl.description AS tpldescription, tpl.locked AS tpllocked, tpl.selectable AS selectable, tmplvarid, if(isnull(cat.category),'%s',cat.category) AS category, cat.id AS catid", $_lang['no_category']), sprintf("%s as tpl
459 459
                     LEFT JOIN %s as stt ON stt.templateid=tpl.id AND stt.tmplvarid='%s'
460 460
                     LEFT JOIN %s as cat ON tpl.category=cat.id", $modx->getDatabase()->getFullTableName('site_templates'), $modx->getDatabase()->getFullTableName('site_tmplvar_templates'), $id, $modx->getDatabase()->getFullTableName('categories')), '', "category, templatename");
461 461
 
462
-				$tplList = '<ul>';
463
-				$preCat = '';
464
-				$insideUl = 0;
465
-				while($row = $modx->getDatabase()->getRow($rs)) {
466
-					$row['category'] = stripslashes($row['category']); //pixelchutes
467
-					if($preCat !== $row['category']) {
468
-						$tplList .= $insideUl ? '</ul>' : '';
469
-						$tplList .= '<li><strong>' . $row['category'] . ($row['catid'] != '' ? ' <small>(' . $row['catid'] . ')</small>' : '') . '</strong><ul>';
470
-						$insideUl = 1;
471
-					}
472
-
473
-					if($modx->getManagerApi()->action == '300' && $modx->config['default_template'] == $row['id']) {
474
-						$checked = true;
475
-					} elseif(isset($_GET['tpl']) && $_GET['tpl'] == $row['id']) {
476
-						$checked = true;
477
-					} elseif($id == 0 && is_array($_POST['template'])) {
478
-						$checked = in_array($row['id'], $_POST['template']);
479
-					} else {
480
-						$checked = $row['tmplvarid'];
481
-					}
482
-					$selectable = !$row['selectable'] ? ' class="disabled"' : '';
483
-					$checked = $checked ? ' checked="checked"' : '';
484
-					$tplId = '&nbsp;<small>(' . $row['id'] . ')</small>';
485
-					$desc = !empty($row['tpldescription']) ? ' - ' . $row['tpldescription'] : '';
486
-
487
-					$tplInfo = array();
488
-					if($row['tpllocked']) {
489
-						$tplInfo[] = $_lang['locked'];
490
-					}
491
-					if($row['id'] == $modx->config['default_template']) {
492
-						$tplInfo[] = $_lang['defaulttemplate_title'];
493
-					}
494
-					$tplInfo = !empty($tplInfo) ? ' <em>(' . implode(', ', $tplInfo) . ')</em>' : '';
495
-
496
-					$tplList .= sprintf('<li><label%s><input name="template[]" value="%s" type="checkbox" %s onchange="documentDirty=true;"> %s%s%s%s</label></li>', $selectable, $row['id'], $checked, $row['templatename'], $tplId, $desc, $tplInfo);
497
-					$tplList .= '</li>';
498
-
499
-					$preCat = $row['category'];
500
-				}
501
-				$tplList .= $insideUl ? '</ul>' : '';
502
-				$tplList .= '</ul>';
503
-				echo $tplList;
504
-
505
-				?>
462
+                $tplList = '<ul>';
463
+                $preCat = '';
464
+                $insideUl = 0;
465
+                while($row = $modx->getDatabase()->getRow($rs)) {
466
+                    $row['category'] = stripslashes($row['category']); //pixelchutes
467
+                    if($preCat !== $row['category']) {
468
+                        $tplList .= $insideUl ? '</ul>' : '';
469
+                        $tplList .= '<li><strong>' . $row['category'] . ($row['catid'] != '' ? ' <small>(' . $row['catid'] . ')</small>' : '') . '</strong><ul>';
470
+                        $insideUl = 1;
471
+                    }
472
+
473
+                    if($modx->getManagerApi()->action == '300' && $modx->config['default_template'] == $row['id']) {
474
+                        $checked = true;
475
+                    } elseif(isset($_GET['tpl']) && $_GET['tpl'] == $row['id']) {
476
+                        $checked = true;
477
+                    } elseif($id == 0 && is_array($_POST['template'])) {
478
+                        $checked = in_array($row['id'], $_POST['template']);
479
+                    } else {
480
+                        $checked = $row['tmplvarid'];
481
+                    }
482
+                    $selectable = !$row['selectable'] ? ' class="disabled"' : '';
483
+                    $checked = $checked ? ' checked="checked"' : '';
484
+                    $tplId = '&nbsp;<small>(' . $row['id'] . ')</small>';
485
+                    $desc = !empty($row['tpldescription']) ? ' - ' . $row['tpldescription'] : '';
486
+
487
+                    $tplInfo = array();
488
+                    if($row['tpllocked']) {
489
+                        $tplInfo[] = $_lang['locked'];
490
+                    }
491
+                    if($row['id'] == $modx->config['default_template']) {
492
+                        $tplInfo[] = $_lang['defaulttemplate_title'];
493
+                    }
494
+                    $tplInfo = !empty($tplInfo) ? ' <em>(' . implode(', ', $tplInfo) . ')</em>' : '';
495
+
496
+                    $tplList .= sprintf('<li><label%s><input name="template[]" value="%s" type="checkbox" %s onchange="documentDirty=true;"> %s%s%s%s</label></li>', $selectable, $row['id'], $checked, $row['templatename'], $tplId, $desc, $tplInfo);
497
+                    $tplList .= '</li>';
498
+
499
+                    $preCat = $row['category'];
500
+                }
501
+                $tplList .= $insideUl ? '</ul>' : '';
502
+                $tplList .= '</ul>';
503
+                echo $tplList;
504
+
505
+                ?>
506 506
 
507 507
 				<!-- Access Permissions -->
508 508
 				<?php
509
-				if($use_udperms == 1) {
510
-					// fetch permissions for the variable
511
-					$rs = $modx->getDatabase()->select('documentgroup', $modx->getDatabase()->getFullTableName('site_tmplvar_access'), "tmplvarid='{$id}'");
512
-					$groupsarray = $modx->getDatabase()->getColumn('documentgroup', $rs);
509
+                if($use_udperms == 1) {
510
+                    // fetch permissions for the variable
511
+                    $rs = $modx->getDatabase()->select('documentgroup', $modx->getDatabase()->getFullTableName('site_tmplvar_access'), "tmplvarid='{$id}'");
512
+                    $groupsarray = $modx->getDatabase()->getColumn('documentgroup', $rs);
513 513
 
514
-					?>
514
+                    ?>
515 515
 					<?php if($modx->hasPermission('access_permissions')) { ?>
516 516
 						<script type="text/javascript">
517 517
 							function makePublic(b) {
@@ -539,29 +539,29 @@  discard block
 block discarded – undo
539 539
 						<!--<b><?php /*echo $_lang['access_permissions']; */ ?></b>-->
540 540
 						<p><?= $_lang['tmplvar_access_msg'] ?></p>
541 541
 						<?php
542
-						$chk = '';
543
-						$rs = $modx->getDatabase()->select('name, id', $tbl_documentgroup_names);
544
-						if(empty($groupsarray) && is_array($_POST['docgroups']) && empty($_POST['id'])) {
545
-							$groupsarray = $_POST['docgroups'];
546
-						}
547
-						while($row = $modx->getDatabase()->getRow($rs)) {
548
-							$checked = in_array($row['id'], $groupsarray);
549
-							if($modx->hasPermission('access_permissions')) {
550
-								if($checked) {
551
-									$notPublic = true;
552
-								}
553
-								$chks .= "<li><label><input type='checkbox' name='docgroups[]' value='" . $row['id'] . "' " . ($checked ? "checked='checked'" : '') . " onclick=\"makePublic(false)\" /> " . $row['name'] . "</label></li>";
554
-							} else {
555
-								if($checked) {
556
-									echo "<input type='hidden' name='docgroups[]'  value='" . $row['id'] . "' />";
557
-								}
558
-							}
559
-						}
560
-						if($modx->hasPermission('access_permissions')) {
561
-							$chks = "<li><label><input type='checkbox' name='chkalldocs' " . (!$notPublic ? "checked='checked'" : '') . " onclick=\"makePublic(true)\" /> <span class='warning'>" . $_lang['all_doc_groups'] . "</span></label></li>" . $chks;
562
-						}
563
-						echo '<ul>' . $chks . '</ul>';
564
-						?>
542
+                        $chk = '';
543
+                        $rs = $modx->getDatabase()->select('name, id', $tbl_documentgroup_names);
544
+                        if(empty($groupsarray) && is_array($_POST['docgroups']) && empty($_POST['id'])) {
545
+                            $groupsarray = $_POST['docgroups'];
546
+                        }
547
+                        while($row = $modx->getDatabase()->getRow($rs)) {
548
+                            $checked = in_array($row['id'], $groupsarray);
549
+                            if($modx->hasPermission('access_permissions')) {
550
+                                if($checked) {
551
+                                    $notPublic = true;
552
+                                }
553
+                                $chks .= "<li><label><input type='checkbox' name='docgroups[]' value='" . $row['id'] . "' " . ($checked ? "checked='checked'" : '') . " onclick=\"makePublic(false)\" /> " . $row['name'] . "</label></li>";
554
+                            } else {
555
+                                if($checked) {
556
+                                    echo "<input type='hidden' name='docgroups[]'  value='" . $row['id'] . "' />";
557
+                                }
558
+                            }
559
+                        }
560
+                        if($modx->hasPermission('access_permissions')) {
561
+                            $chks = "<li><label><input type='checkbox' name='chkalldocs' " . (!$notPublic ? "checked='checked'" : '') . " onclick=\"makePublic(true)\" /> <span class='warning'>" . $_lang['all_doc_groups'] . "</span></label></li>" . $chks;
562
+                        }
563
+                        echo '<ul>' . $chks . '</ul>';
564
+                        ?>
565 565
 					<?php } ?>
566 566
 				<?php } ?>
567 567
 
@@ -571,12 +571,12 @@  discard block
 block discarded – undo
571 571
 		<input type="submit" name="save" style="display:none">
572 572
 
573 573
 		<?php
574
-		// invoke OnTVFormRender event
575
-		$evtOut = $modx->invokeEvent('OnTVFormRender', array('id' => $id));
576
-		if(is_array($evtOut)) {
577
-			echo implode('', $evtOut);
578
-		}
579
-		?>
574
+        // invoke OnTVFormRender event
575
+        $evtOut = $modx->invokeEvent('OnTVFormRender', array('id' => $id));
576
+        if(is_array($evtOut)) {
577
+            echo implode('', $evtOut);
578
+        }
579
+        ?>
580 580
 	</div>
581 581
 </form>
582 582
 <script type="text/javascript">setTimeout('showParameters()', 10);</script>
Please login to merge, or discard this patch.