Completed
Pull Request — develop (#518)
by Agel_Nash
06:14
created
manager/actions/mutate_web_user.dynamic.php 1 patch
Braces   +27 added lines, -22 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(IN_MANAGER_MODE != "true") {
2
+if(IN_MANAGER_MODE != "true") {
3 3
 	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 
6
-switch($modx->manager->action) {
6
+switch($modx->manager->action) {
7 7
 	case 88:
8
-		if(!$modx->hasPermission('edit_web_user')) {
8
+		if(!$modx->hasPermission('edit_web_user')) {
9 9
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
10 10
 		}
11 11
 		break;
12 12
 	case 87:
13
-		if(!$modx->hasPermission('new_web_user')) {
13
+		if(!$modx->hasPermission('new_web_user')) {
14 14
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
15 15
 		}
16 16
 		break;
@@ -23,33 +23,35 @@  discard block
 block discarded – undo
23 23
 
24 24
 // check to see the snippet editor isn't locked
25 25
 $rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=88 AND id='{$user}' AND internalKey!='" . $modx->getLoginUserID() . "'");
26
-if($username = $modx->db->getValue($rs)) {
26
+if($username = $modx->db->getValue($rs)) {
27 27
 	$modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "web user"));
28 28
 }
29 29
 // end check for lock
30 30
 
31
-if($modx->manager->action == '88') {
31
+if($modx->manager->action == '88') {
32 32
 	// get user attributes
33 33
 	$rs = $modx->db->select('*', $modx->getFullTableName('web_user_attributes'), "internalKey = '{$user}'");
34 34
 	$userdata = $modx->db->getRow($rs);
35
-	if(!$userdata) {
35
+	if(!$userdata) {
36 36
 		$modx->webAlertAndQuit("No user returned!");
37 37
 	}
38 38
 
39 39
 	// get user settings
40 40
 	$rs = $modx->db->select('*', $modx->getFullTableName('web_user_settings'), "webuser = '{$user}'");
41 41
 	$usersettings = array();
42
-	while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value'];
42
+	while($row = $modx->db->getRow($rs)) {
43
+	    $usersettings[$row['setting_name']] = $row['setting_value'];
44
+	}
43 45
 	extract($usersettings, EXTR_OVERWRITE);
44 46
 
45 47
 	// get user name
46 48
 	$rs = $modx->db->select('*', $modx->getFullTableName('web_users'), "id = '{$user}'");
47 49
 	$usernamedata = $modx->db->getRow($rs);
48
-	if(!$usernamedata) {
50
+	if(!$usernamedata) {
49 51
 		$modx->webAlertAndQuit("No user returned while getting username!");
50 52
 	}
51 53
 	$_SESSION['itemname'] = $usernamedata['username'];
52
-} else {
54
+} else {
53 55
 	$userdata = array();
54 56
 	$usersettings = array();
55 57
 	$usernamedata = array();
@@ -57,14 +59,14 @@  discard block
 block discarded – undo
57 59
 }
58 60
 
59 61
 // avoid doubling htmlspecialchars (already encoded in DB)
60
-foreach($userdata as $key => $val) {
62
+foreach($userdata as $key => $val) {
61 63
 	$userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']);
62 64
 };
63 65
 $usernamedata['username'] = html_entity_decode($usernamedata['username'], ENT_NOQUOTES, $modx->config['modx_charset']);
64 66
 
65 67
 // restore saved form
66 68
 $formRestored = false;
67
-if($modx->manager->hasFormValues()) {
69
+if($modx->manager->hasFormValues()) {
68 70
 	$modx->manager->loadFormValues();
69 71
 	// restore post values
70 72
 	$userdata = array_merge($userdata, $_POST);
@@ -78,9 +80,9 @@  discard block
 block discarded – undo
78 80
 
79 81
 // include the country list language file
80 82
 $_country_lang = array();
81
-if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) {
83
+if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) {
82 84
 	include_once "lang/country/" . $manager_language . "_country.inc.php";
83
-} else {
85
+} else {
84 86
 	include_once "lang/country/english_country.inc.php";
85 87
 }
86 88
 asort($_country_lang);
@@ -191,7 +193,7 @@  discard block
 block discarded – undo
191 193
 	<?php
192 194
 	// invoke OnWUsrFormPrerender event
193 195
 	$evtOut = $modx->invokeEvent("OnWUsrFormPrerender", array("id" => $user));
194
-	if(is_array($evtOut)) {
196
+	if(is_array($evtOut)) {
195 197
 		echo implode("", $evtOut);
196 198
 	}
197 199
 	?>
@@ -324,7 +326,7 @@  discard block
 block discarded – undo
324 326
 								<?php $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $userdata['country']; ?>
325 327
 								<option value="" <?php (!isset($chosenCountry) ? ' selected' : '') ?> >&nbsp;</option>
326 328
 								<?php
327
-								foreach($_country_lang as $key => $country) {
329
+								foreach($_country_lang as $key => $country) {
328 330
 									echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>";
329 331
 								}
330 332
 								?>
@@ -496,17 +498,20 @@  discard block
 block discarded – undo
496 498
 				</table>
497 499
 			</div>
498 500
 			<?php
499
-			if($use_udperms == 1) {
501
+			if($use_udperms == 1) {
500 502
 
501 503
 			$groupsarray = array();
502 504
 
503
-			if($modx->manager->action == '88') { // only do this bit if the user is being edited
505
+			if($modx->manager->action == '88') {
506
+// only do this bit if the user is being edited
504 507
 				$rs = $modx->db->select('webgroup', $modx->getFullTableName('web_groups'), "webuser='{$user}'");
505 508
 				$groupsarray = $modx->db->getColumn('webgroup', $rs);
506 509
 			}
507 510
 			// retain selected user groups between post
508
-			if(is_array($_POST['user_groups'])) {
509
-				foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v;
511
+			if(is_array($_POST['user_groups'])) {
512
+				foreach($_POST['user_groups'] as $n => $v) {
513
+				    $groupsarray[] = $v;
514
+				}
510 515
 			}
511 516
 			?>
512 517
 			<div class="tab-page" id="tabPermissions">
@@ -515,7 +520,7 @@  discard block
 block discarded – undo
515 520
 				<p><?php echo $_lang['access_permissions_user_message'] ?></p>
516 521
 				<?php
517 522
 				$rs = $modx->db->select('name, id', $modx->getFullTableName('webgroup_names'), '', 'name');
518
-				while($row = $modx->db->getRow($rs)) {
523
+				while($row = $modx->db->getRow($rs)) {
519 524
 					echo '<label><input type="checkbox" name="user_groups[]" value="' . $row['id'] . '"' . (in_array($row['id'], $groupsarray) ? ' checked="checked"' : '') . ' />' . $row['name'] . '</label><br />';
520 525
 				}
521 526
 				}
@@ -526,7 +531,7 @@  discard block
 block discarded – undo
526 531
 			$evtOut = $modx->invokeEvent("OnWUsrFormRender", array(
527 532
 				"id" => $user
528 533
 			));
529
-			if(is_array($evtOut)) {
534
+			if(is_array($evtOut)) {
530 535
 				echo implode("", $evtOut);
531 536
 			}
532 537
 			?>
Please login to merge, or discard this patch.
manager/actions/logging.static.php 1 patch
Braces   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (IN_MANAGER_MODE != "true") {
2
+if (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('logs')) {
5
+if (!$modx->hasPermission('logs')) {
6 6
     $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9
-function array_unique_multi($array, $checkKey)
10
-{
9
+function array_unique_multi($array, $checkKey)
10
+{
11 11
     // Use the builtin if we're not a multi-dimensional array
12
-    if (!is_array(current($array)) || empty($checkKey)) {
12
+    if (!is_array(current($array)) || empty($checkKey)) {
13 13
         return array_unique($array);
14 14
     }
15 15
 
16 16
     $ret = array();
17 17
     $checkValues = array(); // contains the unique key Values
18
-    foreach ($array as $key => $current) {
19
-        if (in_array($current[$checkKey], $checkValues)) {
18
+    foreach ($array as $key => $current) {
19
+        if (in_array($current[$checkKey], $checkValues)) {
20 20
             continue;
21 21
         } // duplicate
22 22
 
@@ -26,17 +26,17 @@  discard block
 block discarded – undo
26 26
     return $ret;
27 27
 }
28 28
 
29
-function record_sort($array, $key)
30
-{
29
+function record_sort($array, $key)
30
+{
31 31
     $hash = array();
32
-    foreach ($array as $k => $v) {
32
+    foreach ($array as $k => $v) {
33 33
         $hash[$k] = $v[$key];
34 34
     }
35 35
 
36 36
     natsort($hash);
37 37
 
38 38
     $records = array();
39
-    foreach ($hash as $k => $row) {
39
+    foreach ($hash as $k => $row) {
40 40
         $records[$k] = $array[$k];
41 41
     }
42 42
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
                             <?php
64 64
                             // get all users currently in the log
65 65
                             $logs_user = record_sort(array_unique_multi($logs, 'internalKey'), 'username');
66
-                            foreach ($logs_user as $row) {
66
+                            foreach ($logs_user as $row) {
67 67
                                 $selectedtext = $row['internalKey'] == $_REQUEST['searchuser'] ? ' selected="selected"' : '';
68 68
                                 echo "\t\t" . '<option value="' . $row['internalKey'] . '"' . $selectedtext . '>' . $row['username'] . "</option>\n";
69 69
                             }
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
                             // get all available actions in the log
81 81
                             include_once "actionlist.inc.php";
82 82
                             $logs_actions = record_sort(array_unique_multi($logs, 'action'), 'action');
83
-                            foreach ($logs_actions as $row) {
83
+                            foreach ($logs_actions as $row) {
84 84
                                 $action = getAction($row['action']);
85
-                                if ($action == 'Idle') {
85
+                                if ($action == 'Idle') {
86 86
                                     continue;
87 87
                                 }
88 88
                                 $selectedtext = $row['action'] == $_REQUEST['action'] ? ' selected="selected"' : '';
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
                             <?php
101 101
                             // get all itemid currently in logging
102 102
                             $logs_items = record_sort(array_unique_multi($logs, 'itemid'), 'itemid');
103
-                            foreach ($logs_items as $row) {
103
+                            foreach ($logs_items as $row) {
104 104
                                 $selectedtext = $row['itemid'] == $_REQUEST['itemid'] ? ' selected="selected"' : '';
105 105
                                 echo "\t\t" . '<option value="' . $row['itemid'] . '"' . $selectedtext . '>' . $row['itemid'] . "</option>\n";
106 106
                             }
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
                             <?php
117 117
                             // get all itemname currently in logging
118 118
                             $logs_names = record_sort(array_unique_multi($logs, 'itemname'), 'itemname');
119
-                            foreach ($logs_names as $row) {
119
+                            foreach ($logs_names as $row) {
120 120
                                 $selectedtext = $row['itemname'] == $_REQUEST['itemname'] ? ' selected="selected"' : '';
121 121
                                 echo "\t\t" . '<option value="' . $row['itemname'] . '"' . $selectedtext . '>' . $row['itemname'] . "</option>\n";
122 122
                             }
@@ -172,36 +172,36 @@  discard block
 block discarded – undo
172 172
     <div class="container container-body">
173 173
 
174 174
 <?php
175
-if (isset($_REQUEST['log_submit'])) {
175
+if (isset($_REQUEST['log_submit'])) {
176 176
     // get the selections the user made.
177 177
     $sqladd = array();
178
-    if ($_REQUEST['searchuser'] != 0) {
178
+    if ($_REQUEST['searchuser'] != 0) {
179 179
         $sqladd[] = "internalKey='" . intval($_REQUEST['searchuser']) . "'";
180 180
     }
181
-    if ($_REQUEST['action'] != 0) {
181
+    if ($_REQUEST['action'] != 0) {
182 182
         $sqladd[] = "action=" . intval($_REQUEST['action']);
183 183
     }
184
-    if ($_REQUEST['itemid'] != 0 || $_REQUEST['itemid'] == "-") {
184
+    if ($_REQUEST['itemid'] != 0 || $_REQUEST['itemid'] == "-") {
185 185
         $sqladd[] = "itemid='" . $_REQUEST['itemid'] . "'";
186 186
     }
187
-    if ($_REQUEST['itemname'] != '0') {
187
+    if ($_REQUEST['itemname'] != '0') {
188 188
         $sqladd[] = "itemname='" . $modx->db->escape($_REQUEST['itemname']) . "'";
189 189
     }
190
-    if ($_REQUEST['message'] != "") {
190
+    if ($_REQUEST['message'] != "") {
191 191
         $sqladd[] = "message LIKE '%" . $modx->db->escape($_REQUEST['message']) . "%'";
192 192
     }
193 193
     // date stuff
194
-    if ($_REQUEST['datefrom'] != "") {
194
+    if ($_REQUEST['datefrom'] != "") {
195 195
         $sqladd[] = "timestamp>" . $modx->toTimeStamp($_REQUEST['datefrom']);
196 196
     }
197
-    if ($_REQUEST['dateto'] != "") {
197
+    if ($_REQUEST['dateto'] != "") {
198 198
         $sqladd[] = "timestamp<" . $modx->toTimeStamp($_REQUEST['dateto']);
199 199
     }
200 200
 
201 201
     // If current position is not set, set it to zero
202
-    if (!isset($_REQUEST['int_cur_position']) || $_REQUEST['int_cur_position'] == 0) {
202
+    if (!isset($_REQUEST['int_cur_position']) || $_REQUEST['int_cur_position'] == 0) {
203 203
         $int_cur_position = 0;
204
-    } else {
204
+    } else {
205 205
         $int_cur_position = $_REQUEST['int_cur_position'];
206 206
     }
207 207
 
@@ -215,9 +215,9 @@  discard block
 block discarded – undo
215 215
 
216 216
     $rs = $modx->db->select('*', $modx->getFullTableName('manager_log'), (!empty($sqladd) ? implode(' AND ', $sqladd) : ''), 'timestamp DESC, id DESC', "{$int_cur_position}, {$int_num_result}");
217 217
 
218
-if ($limit < 1) {
218
+if ($limit < 1) {
219 219
     echo '<p>' . $_lang["mgrlog_emptysrch"] . '</p>';
220
-} else {
220
+} else {
221 221
     echo '<p>' . $_lang["mgrlog_sortinst"] . '</p>';
222 222
 
223 223
     include_once "paginate.inc.php";
@@ -236,14 +236,14 @@  discard block
 block discarded – undo
236 236
     $paging = $array_paging['first_link'] . $_lang["paging_first"] . (isset($array_paging['first_link']) ? "</a> " : " ");
237 237
     $paging .= $array_paging['previous_link'] . $_lang["paging_prev"] . (isset($array_paging['previous_link']) ? "</a> " : " ");
238 238
     $pagesfound = sizeof($array_row_paging);
239
-    if ($pagesfound > 6) {
239
+    if ($pagesfound > 6) {
240 240
         $paging .= $array_row_paging[$current_row - 2]; // ."&nbsp;";
241 241
         $paging .= $array_row_paging[$current_row - 1]; // ."&nbsp;";
242 242
         $paging .= $array_row_paging[$current_row]; // ."&nbsp;";
243 243
         $paging .= $array_row_paging[$current_row + 1]; // ."&nbsp;";
244 244
         $paging .= $array_row_paging[$current_row + 2]; // ."&nbsp;";
245
-    } else {
246
-        for ($i = 0; $i < $pagesfound; $i++) {
245
+    } else {
246
+        for ($i = 0; $i < $pagesfound; $i++) {
247 247
             $paging .= $array_row_paging[$i] . "&nbsp;";
248 248
         }
249 249
     }
@@ -278,12 +278,12 @@  discard block
 block discarded – undo
278 278
                 // grab the entire log file...
279 279
                 $logentries = array();
280 280
                 $i = 0;
281
-                while ($logentry = $modx->db->getRow($rs)) {
282
-                    if (!preg_match("/^[0-9]+$/", $logentry['itemid'])) {
281
+                while ($logentry = $modx->db->getRow($rs)) {
282
+                    if (!preg_match("/^[0-9]+$/", $logentry['itemid'])) {
283 283
                         $item = '<div style="text-align:center;">-</div>';
284
-                    } elseif ($logentry['action'] == 3 || $logentry['action'] == 27 || $logentry['action'] == 5) {
284
+                    } elseif ($logentry['action'] == 3 || $logentry['action'] == 27 || $logentry['action'] == 5) {
285 285
                         $item = '<a href="index.php?a=3&amp;id=' . $logentry['itemid'] . '">' . $logentry['itemname'] . '</a>';
286
-                    } else {
286
+                    } else {
287 287
                         $item = $logentry['itemname'];
288 288
                     }
289 289
                     //index.php?a=13&searchuser=' . $logentry['internalKey'] . '&action=' . $logentry['action'] . '&itemname=' . $logentry['itemname'] . '&log_submit=true'
@@ -318,6 +318,6 @@  discard block
 block discarded – undo
318 318
     // @see index.php @ 915
319 319
     global $action;
320 320
     $action = 1;
321
-} else {
321
+} else {
322 322
     echo $_lang["mgrlog_noquery"];
323 323
 }
Please login to merge, or discard this patch.
manager/actions/mutate_categories.dynamic.php 1 patch
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
2
+if(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.");
4
+}
3 5
 
4 6
 if(!$modx->hasPermission('category_manager')) {
5 7
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
@@ -26,16 +28,14 @@  discard block
 block discarded – undo
26 28
 $cm = new Module_Categories_Manager();
27 29
 
28 30
 // assign module_params to internal params
29
-foreach( $_module_params as $param => $value )
30
-{
31
+foreach( $_module_params as $param => $value ) {
31 32
 	$cm->set( $param, $value );
32 33
 }
33 34
 
34 35
 // catch the request actions
35 36
 include_once $cm->get('inc_dir') . 'request_trigger.inc.php';
36 37
 
37
-if( !$categories = $cm->getCategories() )
38
-{
38
+if( !$categories = $cm->getCategories() ) {
39 39
 	setcookie('webfxtab_manage-categories-pane', 0 );
40 40
 	$cm->addMessage( $cm->txt('Currently no categories available... JUST ADD A NEW ONE!'), 'global' );
41 41
 }
Please login to merge, or discard this patch.
manager/actions/resources.static.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,7 +28,9 @@  discard block
 block discarded – undo
28 28
 	'type7' => $_lang["lock_element_type_7"],
29 29
 	'type8' => $_lang["lock_element_type_8"]
30 30
 );
31
-foreach($unlockTranslations as $key => $value) $unlockTranslations[$key] = iconv($modx->config["modx_charset"], "utf-8", $value);
31
+foreach($unlockTranslations as $key => $value) {
32
+    $unlockTranslations[$key] = iconv($modx->config["modx_charset"], "utf-8", $value);
33
+}
32 34
 
33 35
 // Prepare lang-strings for mgrResAction()
34 36
 $mraTranslations = array(
@@ -44,7 +46,9 @@  discard block
 block discarded – undo
44 46
 	'confirm_delete_plugin' => $_lang["confirm_delete_plugin"],
45 47
 	'confirm_delete_module' => $_lang["confirm_delete_module"],
46 48
 );
47
-foreach($mraTranslations as $key => $value) $mraTranslations[$key] = iconv($modx->config["modx_charset"], "utf-8", $value);
49
+foreach($mraTranslations as $key => $value) {
50
+    $mraTranslations[$key] = iconv($modx->config["modx_charset"], "utf-8", $value);
51
+}
48 52
 ?>
49 53
 <script>var trans = <?php echo json_encode($unlockTranslations); ?>;</script>
50 54
 <script>var mraTrans = <?php echo json_encode($mraTranslations); ?>;</script>
Please login to merge, or discard this patch.
manager/actions/site_schedule.static.php 1 patch
Braces   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(IN_MANAGER_MODE != "true") {
2
+if(IN_MANAGER_MODE != "true") {
3 3
 	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5
-if(!$modx->hasPermission('view_eventlog')) {
5
+if(!$modx->hasPermission('view_eventlog')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 ?>
@@ -19,11 +19,11 @@  discard block
 block discarded – undo
19 19
 			<?php
20 20
 			$rs = $modx->db->select('id, pagetitle, pub_date', $modx->getFullTableName('site_content'), "pub_date > " . time() . "", 'pub_date ASC');
21 21
 			$limit = $modx->db->getRecordCount($rs);
22
-			if($limit < 1) {
22
+			if($limit < 1) {
23 23
 				?>
24 24
 				<p><?= $_lang["no_docs_pending_publishing"] ?></p>
25 25
 				<?php
26
-			} else {
26
+			} else {
27 27
 				?>
28 28
 				<div class="table-responsive">
29 29
 					<table class="grid sortabletable" id="table-1">
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 						</thead>
37 37
 						<tbody>
38 38
 						<?php
39
-						while($row = $modx->db->getRow($rs)) {
39
+						while($row = $modx->db->getRow($rs)) {
40 40
 							?>
41 41
 							<tr>
42 42
 								<td class="text-right"><?= $row['id'] ?></td>
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
 			<?php
59 59
 			$rs = $modx->db->select('id, pagetitle, unpub_date', $modx->getFullTableName('site_content'), "unpub_date > " . time() . "", 'unpub_date ASC');
60 60
 			$limit = $modx->db->getRecordCount($rs);
61
-			if($limit < 1) {
61
+			if($limit < 1) {
62 62
 				?>
63 63
 				<p><?= $_lang["no_docs_pending_unpublishing"] ?></p>
64 64
 				<?php
65
-			} else {
65
+			} else {
66 66
 				?>
67 67
 				<div class="table-responsive">
68 68
 					<table class="grid sortabletable" id="table-2">
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 						</thead>
76 76
 						<tbody>
77 77
 						<?php
78
-						while($row = $modx->db->getRow($rs)) {
78
+						while($row = $modx->db->getRow($rs)) {
79 79
 							?>
80 80
 							<tr>
81 81
 								<td class="text-right"><?= $row['id'] ?></td>
@@ -97,11 +97,11 @@  discard block
 block discarded – undo
97 97
 			<?php
98 98
 			$rs = $modx->db->select('id, pagetitle, pub_date, unpub_date', $modx->getFullTableName('site_content'), "pub_date > 0 OR unpub_date > 0", "pub_date DESC");
99 99
 			$limit = $modx->db->getRecordCount($rs);
100
-			if($limit < 1) {
100
+			if($limit < 1) {
101 101
 				?>
102 102
 				<p><?= $_lang["no_docs_pending_pubunpub"] ?></p>
103 103
 				<?php
104
-			} else {
104
+			} else {
105 105
 				?>
106 106
 				<div class="table-responsive">
107 107
 					<table class="grid sortabletable" id="table-3">
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 						</thead>
116 116
 						<tbody>
117 117
 						<?php
118
-						while($row = $modx->db->getRow($rs)) {
118
+						while($row = $modx->db->getRow($rs)) {
119 119
 							?>
120 120
 							<tr>
121 121
 								<td class="text-right"><?= $row['id'] ?></td>
Please login to merge, or discard this patch.
manager/actions/mutate_module.dynamic.php 1 patch
Braces   +22 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,15 +1,15 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(IN_MANAGER_MODE != "true") {
2
+if(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
-switch($modx->manager->action) {
5
+switch($modx->manager->action) {
6 6
 	case 107:
7
-		if(!$modx->hasPermission('new_module')) {
7
+		if(!$modx->hasPermission('new_module')) {
8 8
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
9 9
 		}
10 10
 		break;
11 11
 	case 108:
12
-		if(!$modx->hasPermission('edit_module')) {
12
+		if(!$modx->hasPermission('edit_module')) {
13 13
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
14 14
 		}
15 15
 		break;
@@ -29,7 +29,8 @@  discard block
 block discarded – undo
29 29
 $tbl_site_templates = $modx->getFullTableName('site_templates');
30 30
 $tbl_site_tmplvars = $modx->getFullTableName('site_tmplvars');
31 31
 // create globally unique identifiers (guid)
32
-function createGUID() {
32
+function createGUID()
33
+{
33 34
 	srand((double) microtime() * 1000000);
34 35
 	$r = rand();
35 36
 	$u = uniqid(getmypid() . $r . (double) microtime() * 1000000, 1);
@@ -38,7 +39,7 @@  discard block
 block discarded – undo
38 39
 }
39 40
 
40 41
 // check to see the module editor isn't locked
41
-if($lockedEl = $modx->elementIsLocked(6, $id)) {
42
+if($lockedEl = $modx->elementIsLocked(6, $id)) {
42 43
 	$modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['module']));
43 44
 }
44 45
 // end check for lock
@@ -46,22 +47,22 @@  discard block
 block discarded – undo
46 47
 // Lock snippet for other users to edit
47 48
 $modx->lockElement(6, $id);
48 49
 
49
-if(isset($_GET['id'])) {
50
+if(isset($_GET['id'])) {
50 51
 	$rs = $modx->db->select('*', $tbl_site_modules, "id='{$id}'");
51 52
 	$content = $modx->db->getRow($rs);
52
-	if(!$content) {
53
+	if(!$content) {
53 54
 		$modx->webAlertAndQuit("Module not found for id '{$id}'.");
54 55
 	}
55 56
 	$content['properties'] = str_replace("&", "&amp;", $content['properties']);
56 57
 	$_SESSION['itemname'] = $content['name'];
57
-	if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
58
+	if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
58 59
 		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
59 60
 	}
60
-} else {
61
+} else {
61 62
 	$_SESSION['itemname'] = $_lang["new_module"];
62 63
 	$content['wrap'] = '1';
63 64
 }
64
-if($modx->manager->hasFormValues()) {
65
+if($modx->manager->hasFormValues()) {
65 66
 	$modx->manager->loadFormValues();
66 67
 }
67 68
 
@@ -435,7 +436,7 @@  discard block
 block discarded – undo
435 436
 	<?php
436 437
 	// invoke OnModFormPrerender event
437 438
 	$evtOut = $modx->invokeEvent('OnModFormPrerender', array('id' => $id));
438
-	if(is_array($evtOut)) {
439
+	if(is_array($evtOut)) {
439 440
 		echo implode('', $evtOut);
440 441
 	}
441 442
 
@@ -498,7 +499,7 @@  discard block
 block discarded – undo
498 499
 								<option>&nbsp;</option>
499 500
 								<?php
500 501
 								include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
501
-								foreach(getCategories() as $n => $v) {
502
+								foreach(getCategories() as $n => $v) {
502 503
 									echo "\t\t\t" . '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($v['category']) . "</option>\n";
503 504
 								}
504 505
 								?>
@@ -650,7 +651,7 @@  discard block
 block discarded – undo
650 651
 					$rs = $modx->db->select('usergroup', $tbl_site_module_access, "module='{$id}'");
651 652
 					$groupsarray = $modx->db->getColumn('usergroup', $rs);
652 653
 
653
-					if($modx->hasPermission('access_permissions')) {
654
+					if($modx->hasPermission('access_permissions')) {
654 655
 						?>
655 656
 						<!-- User Group Access Permissions -->
656 657
 						<script type="text/javascript">
@@ -678,21 +679,21 @@  discard block
 block discarded – undo
678 679
 					}
679 680
 					$chk = '';
680 681
 					$rs = $modx->db->select('name, id', $tbl_membergroup_names, '', 'name');
681
-					while($row = $modx->db->getRow($rs)) {
682
+					while($row = $modx->db->getRow($rs)) {
682 683
 						$groupsarray = is_numeric($id) && $id > 0 ? $groupsarray : array();
683 684
 						$checked = in_array($row['id'], $groupsarray);
684
-						if($modx->hasPermission('access_permissions')) {
685
-							if($checked) {
685
+						if($modx->hasPermission('access_permissions')) {
686
+							if($checked) {
686 687
 								$notPublic = true;
687 688
 							}
688 689
 							$chks .= '<label><input type="checkbox" name="usrgroups[]" value="' . $row['id'] . '"' . ($checked ? ' checked="checked"' : '') . ' onclick="makePublic(false)" /> ' . $row['name'] . "</label><br />\n";
689
-						} else {
690
-							if($checked) {
690
+						} else {
691
+							if($checked) {
691 692
 								$chks = '<input type="hidden" name="usrgroups[]"  value="' . $row['id'] . '" />' . "\n" . $chks;
692 693
 							}
693 694
 						}
694 695
 					}
695
-					if($modx->hasPermission('access_permissions')) {
696
+					if($modx->hasPermission('access_permissions')) {
696 697
 						$chks = '<label><input type="checkbox" name="chkallgroups"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true)" /><span class="warning"> ' . $_lang['all_usr_groups'] . '</span></label><br />' . "\n" . $chks;
697 698
 					}
698 699
 					echo $chks;
@@ -714,7 +715,7 @@  discard block
 block discarded – undo
714 715
 		<?php
715 716
 		// invoke OnModFormRender event
716 717
 		$evtOut = $modx->invokeEvent('OnModFormRender', array('id' => $id));
717
-		if(is_array($evtOut)) {
718
+		if(is_array($evtOut)) {
718 719
 			echo implode('', $evtOut);
719 720
 		}
720 721
 		?>
Please login to merge, or discard this patch.
manager/actions/search.static.php 1 patch
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -118,18 +118,18 @@
 block discarded – undo
118 118
 		$articul_query = "SELECT `contentid` FROM {$tbl_site_tmplvar_contentvalues} WHERE `value` LIKE '%{$searchfields}%'";
119 119
 		$articul_result = $modx->db->query($articul_query);
120 120
 		$articul_id_array = $modx->db->makeArray($articul_result);
121
-		if(count($articul_id_array)>0){
121
+		if(count($articul_id_array)>0) {
122 122
 			$articul_id = '';
123 123
 			$i = 1;
124 124
 			foreach( $articul_id_array as $articul ) {
125 125
 				$articul_id.=$articul['contentid'];
126
-				if($i !== count($articul_id_array)){
126
+				if($i !== count($articul_id_array)) {
127 127
 					$articul_id.=',';
128 128
 				}
129 129
 				$i++;
130 130
 			}  
131 131
 		$articul_id_query = " OR sc.id IN ({$articul_id})";
132
-		}else{
132
+		} else {
133 133
 			$articul_id_query = '';
134 134
 		}
135 135
 		/*end search by TV*/
Please login to merge, or discard this patch.
manager/actions/category_mgr/inc/Module_Categories_Manager.php 1 patch
Braces   +11 added lines, -20 removed lines patch added patch discarded remove patch
@@ -3,8 +3,7 @@  discard block
 block discarded – undo
3 3
  * Class for MODx Categories Manager
4 4
  */
5 5
 if( !is_object( $modx )
6
-    || $modx->isBackend() === false )
7
-{
6
+    || $modx->isBackend() === false ) {
8 7
     die('Please use the MODx Backend.');
9 8
 }
10 9
 
@@ -41,16 +40,11 @@  discard block
 block discarded – undo
41 40
     {
42 41
         global $modx;
43 42
         
44
-        if( isset( $this->params[$key] ) )
45
-        {
43
+        if( isset( $this->params[$key] ) ) {
46 44
             return $this->params[$key];
47
-        }
48
-        elseif( isset( $modx->config[$key] ) )
49
-        {
45
+        } elseif( isset( $modx->config[$key] ) ) {
50 46
             return $modx->config[$key];
51
-        }
52
-        elseif( isset( $modx->event->params[$key] ) )
53
-        {
47
+        } elseif( isset( $modx->event->params[$key] ) ) {
54 48
             return $modx->event->params[$key];
55 49
         }
56 50
         return false;
@@ -65,8 +59,7 @@  discard block
 block discarded – undo
65 59
 
66 60
     function getMessages( $namespace = 'default' )
67 61
     {
68
-        if( isset( $this->params['messages'][$namespace] ) )
69
-        {
62
+        if( isset( $this->params['messages'][$namespace] ) ) {
70 63
             return $this->params['messages'][$namespace];
71 64
         }
72 65
         return false;
@@ -82,12 +75,9 @@  discard block
 block discarded – undo
82 75
         $view     = & $this;
83 76
 
84 77
         if( is_file( $file ) 
85
-            && is_readable( $file ) )
86
-        {
78
+            && is_readable( $file ) ) {
87 79
             include $file;
88
-        }
89
-        else
90
-        {
80
+        } else {
91 81
             echo sprintf(
92 82
                 'View "%s<strong>%s</strong>" not found.',
93 83
                 self::get('views_dir'), 
@@ -110,8 +100,7 @@  discard block
 block discarded – undo
110 100
             "`id` = '" . (int)$element_id . "'"
111 101
         );
112 102
 
113
-        if( $this->db->getAffectedRows() === 1 )
114
-        {
103
+        if( $this->db->getAffectedRows() === 1 ) {
115 104
             return true;
116 105
         }
117 106
         return false;
@@ -121,7 +110,9 @@  discard block
 block discarded – undo
121 110
     function txt( $txt )
122 111
     {
123 112
         global $_lang;
124
-        if(isset($_lang[$txt])) return $_lang[$txt];
113
+        if(isset($_lang[$txt])) {
114
+            return $_lang[$txt];
115
+        }
125 116
         return $txt;
126 117
     }
127 118
 }
128 119
\ No newline at end of file
Please login to merge, or discard this patch.
manager/actions/category_mgr/inc/Categories.php 1 patch
Braces   +14 added lines, -28 removed lines patch added patch discarded remove patch
@@ -15,8 +15,7 @@  discard block
 block discarded – undo
15 15
         $this->db                   = & $modx->db;
16 16
         $this->db_tbl['categories'] = $modx->getFullTableName('categories');
17 17
         
18
-        foreach( $this->elements as $element )
19
-        {
18
+        foreach( $this->elements as $element ) {
20 19
             $this->db_tbl[$element] = $modx->getFullTableName('site_' . $element );
21 20
         }
22 21
     }
@@ -37,8 +36,7 @@  discard block
 block discarded – undo
37 36
             )
38 37
         );
39 38
 
40
-        if( !empty( $categories ) )
41
-        {
39
+        if( !empty( $categories ) ) {
42 40
             return $categories;
43 41
         }
44 42
         return false;
@@ -70,12 +68,10 @@  discard block
 block discarded – undo
70 68
 
71 69
     function getAssignedElements( $category_id, $element )
72 70
     {
73
-        if( in_array( $element, $this->elements, true ) )
74
-        {
71
+        if( in_array( $element, $this->elements, true ) ) {
75 72
             
76 73
             $fields = '`name`,`description`';
77
-            if( $element === 'templates' )
78
-            {
74
+            if( $element === 'templates' ) {
79 75
                 $fields = '`templatename`,`description`';
80 76
             }
81 77
             
@@ -90,11 +86,9 @@  discard block
 block discarded – undo
90 86
             );
91 87
             
92 88
             // correct the name of templates
93
-            if( $element === 'templates' )
94
-            {
89
+            if( $element === 'templates' ) {
95 90
                 $_elements_count = count($elements);
96
-                for( $i=0; $i < $_elements_count; $i++ )
97
-                {
91
+                for( $i=0; $i < $_elements_count; $i++ ) {
98 92
                     $elements[$i]['name'] = $elements[$i]['templatename'];
99 93
                 }
100 94
             }
@@ -106,8 +100,7 @@  discard block
 block discarded – undo
106 100
     function getAllAssignedElements( $category_id )
107 101
     {
108 102
         $elements = array();
109
-        foreach( $this->elements as $element )
110
-        {
103
+        foreach( $this->elements as $element ) {
111 104
             $elements[$element] = $this->getAssignedElements( $category_id, $element );
112 105
         }
113 106
         return $elements;
@@ -116,8 +109,7 @@  discard block
 block discarded – undo
116 109
     function deleteCategory( $category_id )
117 110
     {
118 111
         $_update = array('category' => 0);
119
-        foreach( $this->elements as $element )
120
-        {
112
+        foreach( $this->elements as $element ) {
121 113
             $this->db->update(
122 114
                 $_update,
123 115
                 $this->db_tbl[$element],
@@ -130,8 +122,7 @@  discard block
 block discarded – undo
130 122
             "`id` = '" . $category_id . "'"
131 123
         );
132 124
         
133
-        if( $this->db->getAffectedRows() === 1 )
134
-        {
125
+        if( $this->db->getAffectedRows() === 1 ) {
135 126
             return true;    
136 127
         }
137 128
         return false;
@@ -140,8 +131,7 @@  discard block
 block discarded – undo
140 131
     function updateCategory( $category_id, $data = array() )
141 132
     {
142 133
         if( empty( $data )
143
-            || empty( $category_id ) )
144
-        {
134
+            || empty( $category_id ) ) {
145 135
             return false;
146 136
         }
147 137
         
@@ -156,8 +146,7 @@  discard block
 block discarded – undo
156 146
             "`id` = '" . (int)$category_id . "'"
157 147
         );
158 148
 
159
-        if( $this->db->getAffectedRows() === 1 )
160
-        {
149
+        if( $this->db->getAffectedRows() === 1 ) {
161 150
             return true;
162 151
         }
163 152
 
@@ -166,8 +155,7 @@  discard block
 block discarded – undo
166 155
 
167 156
     function addCategory( $category_name, $category_rank )
168 157
     {
169
-        if( $this->isCategoryExists( $category_name ) )
170
-        {
158
+        if( $this->isCategoryExists( $category_name ) ) {
171 159
             return false;
172 160
         }
173 161
 
@@ -181,8 +169,7 @@  discard block
 block discarded – undo
181 169
             $this->db_tbl['categories']
182 170
         );
183 171
         
184
-        if( $this->db->getAffectedRows() === 1 )
185
-        {
172
+        if( $this->db->getAffectedRows() === 1 ) {
186 173
             return $this->db->getInsertId();
187 174
         }
188 175
 
@@ -202,8 +189,7 @@  discard block
 block discarded – undo
202 189
             )
203 190
         );
204 191
         
205
-        if( $this->db->getAffectedRows() === 1 )
206
-        {
192
+        if( $this->db->getAffectedRows() === 1 ) {
207 193
             return $category_id;
208 194
         }
209 195
         return false;
Please login to merge, or discard this patch.