Completed
Push — develop ( 923a1c...1e9876 )
by Maxim
47s queued 29s
created
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.
manager/actions/category_mgr/inc/request_trigger.inc.php 1 patch
Braces   +32 added lines, -67 removed lines patch added patch discarded remove patch
@@ -6,26 +6,22 @@  discard block
 block discarded – undo
6 6
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
7 7
 }
8 8
 
9
-if( isset( $_REQUEST[$cm->get('request_key')]['ajax'] ) )
10
-{
9
+if( isset( $_REQUEST[$cm->get('request_key')]['ajax'] ) ) {
11 10
     $_data  = $_REQUEST[$cm->get('request_key')];
12 11
     $output = '';
13 12
     $task   = $_data['task'];
14
-    switch( $task )
15
-    {
13
+    switch( $task ) {
16 14
         /**
17 15
          * get categories
18 16
          */
19 17
         case 'categorize_load_elements':
20 18
             $elements = $_data['elements'];
21 19
             
22
-            if( $uncategorized_elements = $cm->getAssignedElements( 0, $_data['elements'] ) )
23
-            { 
20
+            if( $uncategorized_elements = $cm->getAssignedElements( 0, $_data['elements'] ) ) {
24 21
                $output .= $cm->renderView('chunks/categorize/uncategorized_elements', $uncategorized_elements);
25 22
             }
26 23
             
27
-            foreach( $cm->getCategories() as $category )
28
-            {
24
+            foreach( $cm->getCategories() as $category ) {
29 25
                 $category['elements'] = $cm->getAssignedElements( $category['id'], $_data['elements'] );
30 26
                 $output .= $cm->renderView('chunks/categorize/category', $category);
31 27
             }            
@@ -41,8 +37,7 @@  discard block
 block discarded – undo
41 37
  * @see http://modxcms.com/forums/index.php/topic,40430.msg251476.html#msg251476 
42 38
  * 
43 39
  */
44
-if( isset( $_POST[$cm->get('request_key')]['categorize']['submit'] ) )
45
-{  
40
+if( isset( $_POST[$cm->get('request_key')]['categorize']['submit'] ) ) {
46 41
     $_data = $_POST[$cm->get('request_key')]['categorize'];
47 42
     $_changes = 0;
48 43
 
@@ -54,16 +49,13 @@  discard block
 block discarded – undo
54 49
         'categorize'
55 50
     );
56 51
     
57
-    if( !isset( $_data['elements'] ) )
58
-    {
52
+    if( !isset( $_data['elements'] ) ) {
59 53
         $cm->addMessage( $cm->txt('cm_unknown_error'), 'categorize' );
60 54
         return;
61 55
     }
62 56
 
63
-    foreach( $_data['elements'] as $element_id => $data )
64
-    {
65
-        if( $cm->updateElement( $_data['elementsgroup'], $element_id, $data['category_id'] ) )
66
-        {
57
+    foreach( $_data['elements'] as $element_id => $data ) {
58
+        if( $cm->updateElement( $_data['elementsgroup'], $element_id, $data['category_id'] ) ) {
67 59
             $cm->addMessage(
68 60
                 sprintf( 
69 61
                     $cm->txt('cm_x_assigned_to_category_y'), 
@@ -78,13 +70,10 @@  discard block
 block discarded – undo
78 70
         }
79 71
     }
80 72
     
81
-    if( $_changes === 0 )
82
-    {
73
+    if( $_changes === 0 ) {
83 74
         $cm->addMessage( $cm->txt('cm_no_categorization'), 'categorize' );
84 75
         return;
85
-    }
86
-    else
87
-    {
76
+    } else {
88 77
         $cm->addMessage(
89 78
             sprintf( 
90 79
                 $cm->txt('cm_x_changes_made'), 
@@ -98,26 +87,22 @@  discard block
 block discarded – undo
98 87
 /**
99 88
  * Add a new category
100 89
  */
101
-if( isset( $_POST[$cm->get('request_key')]['add']['submit'] ) )
102
-{
90
+if( isset( $_POST[$cm->get('request_key')]['add']['submit'] ) ) {
103 91
     $_data    = $_POST[$cm->get('request_key')]['add']['data'];
104 92
     $category = trim( html_entity_decode($_data['name']) );
105 93
     $rank     = (int) $_data['rank'];
106 94
 
107
-    if( empty( $category ) )
108
-    {
95
+    if( empty( $category ) ) {
109 96
        $cm->addMessage( $cm->txt('cm_enter_name_for_category'), 'add' );
110 97
        return;
111 98
     }
112 99
 
113
-    if( $cm->isCategoryExists( $category ) )
114
-    {
100
+    if( $cm->isCategoryExists( $category ) ) {
115 101
        $cm->addMessage( sprintf( $cm->txt('cm_category_x_exists'), $category ), 'add' ); 
116 102
        return;
117 103
     }
118 104
     
119
-    if( $cm->addCategory( $category, $rank ) !== 0 )
120
-    {
105
+    if( $cm->addCategory( $category, $rank ) !== 0 ) {
121 106
         $cm->addMessage(
122 107
             sprintf( 
123 108
                 $cm->txt( 'cm_category_x_saved_at_position_y' ),
@@ -126,9 +111,7 @@  discard block
 block discarded – undo
126 111
             ),
127 112
             'add'
128 113
         );
129
-    }
130
-    else
131
-    {
114
+    } else {
132 115
         $cm->addMessage( $cm->txt('cm_unknown_error'), 'add' );
133 116
     }    
134 117
 }
@@ -136,20 +119,17 @@  discard block
 block discarded – undo
136 119
 /**
137 120
  * Sort categories
138 121
  */
139
-if( isset( $_POST[$cm->get('request_key')]['sort']['submit'] ) )
140
-{
122
+if( isset( $_POST[$cm->get('request_key')]['sort']['submit'] ) ) {
141 123
     $categories = $_POST[$cm->get('request_key')]['sort']['data'];
142 124
     $_changes   = 0;
143 125
     
144
-    foreach( $categories as $category_id => $_data  ) 
145
-    {
126
+    foreach( $categories as $category_id => $_data  ) {
146 127
         $data = array(
147 128
             'category' => urldecode( $_data['category'] ),
148 129
             'rank'     => $_data['rank']
149 130
         );
150 131
         
151
-        if( $cm->updateCategory( $category_id, $data ) )
152
-        {
132
+        if( $cm->updateCategory( $category_id, $data ) ) {
153 133
             $cm->addMessage(
154 134
                 sprintf( 
155 135
                     $cm->txt('cm_category_x_moved_to_position_y'),
@@ -162,12 +142,9 @@  discard block
 block discarded – undo
162 142
         }
163 143
     }
164 144
         
165
-    if( $_changes === 0 )
166
-    {
145
+    if( $_changes === 0 ) {
167 146
         $cm->addMessage( $cm->txt( 'cm_no_changes' ), 'sort');
168
-    }
169
-    else
170
-    {
147
+    } else {
171 148
         $cm->addMessage(
172 149
             sprintf( 
173 150
                 $cm->txt('cm_x_changes_made'), 
@@ -181,17 +158,13 @@  discard block
 block discarded – undo
181 158
 /**
182 159
  * Edit categories
183 160
  */
184
-if( isset( $_POST[$cm->get('request_key')]['edit']['submit'] ) )
185
-{
161
+if( isset( $_POST[$cm->get('request_key')]['edit']['submit'] ) ) {
186 162
     $categories = $_POST[$cm->get('request_key')]['edit']['data'];
187 163
     $_changes   = 0;
188 164
 
189
-    foreach( $categories as $category_id => $_data  ) 
190
-    {
191
-        if( isset( $_data['delete'] ) )
192
-        {
193
-            if( $cm->deleteCategory( $category_id ) )
194
-            {
165
+    foreach( $categories as $category_id => $_data  ) {
166
+        if( isset( $_data['delete'] ) ) {
167
+            if( $cm->deleteCategory( $category_id ) ) {
195 168
                 $cm->addMessage(
196 169
                     sprintf(
197 170
                         $cm->txt('cm_category_x_deleted'),
@@ -209,8 +182,7 @@  discard block
 block discarded – undo
209 182
             'rank'     => $_data['rank']
210 183
         );
211 184
         
212
-        if( $cm->updateCategory( $category_id, $data ) )
213
-        {
185
+        if( $cm->updateCategory( $category_id, $data ) ) {
214 186
             $cm->addMessage(
215 187
                 sprintf( 
216 188
                     $cm->txt('cm_category_x_renamed_to_y'),
@@ -223,8 +195,7 @@  discard block
 block discarded – undo
223 195
         }
224 196
     }
225 197
 
226
-    if( $_changes === 0 )
227
-    {
198
+    if( $_changes === 0 ) {
228 199
         $cm->addMessage( $cm->txt( 'cm_no_changes' ), 'edit');
229 200
     }
230 201
 }
@@ -233,12 +204,10 @@  discard block
 block discarded – undo
233 204
  * Delete singel category by $_GET
234 205
  */
235 206
 if( isset( $_GET[$cm->get('request_key')]['delete'] ) 
236
-    && !empty( $_GET[$cm->get('request_key')]['delete'] ) )
237
-{
207
+    && !empty( $_GET[$cm->get('request_key')]['delete'] ) ) {
238 208
     $category_id = (int)$_GET[$cm->get('request_key')]['delete'];
239 209
     
240
-    if( $cm->deleteCategory( $category_id ) )
241
-    {
210
+    if( $cm->deleteCategory( $category_id ) ) {
242 211
         $cm->addMessage(
243 212
             sprintf(
244 213
                 $cm->txt('cm_category_x_deleted'), 
@@ -251,16 +220,13 @@  discard block
 block discarded – undo
251 220
 /**
252 221
  * Translate phrases
253 222
  */
254
-if( isset( $_POST[$cm->get('request_key')]['translate']['submit'] ) )
255
-{ 
223
+if( isset( $_POST[$cm->get('request_key')]['translate']['submit'] ) ) {
256 224
     $translations = $_POST[$cm->get('request_key')]['translate']['data'];
257 225
 
258
-    foreach( $translations as $native_phrase => $translation )
259
-    {
226
+    foreach( $translations as $native_phrase => $translation ) {
260 227
         $native_phrase = urldecode( $native_phrase );
261 228
 
262
-        if( empty( $translation ) )
263
-        {
229
+        if( empty( $translation ) ) {
264 230
             $translation = $native_phrase;
265 231
             
266 232
             $cm->addMessage(
@@ -285,8 +251,7 @@  discard block
 block discarded – undo
285 251
         );
286 252
     }
287 253
 
288
-    if( empty( $cm->new_translations ) )
289
-    {   
254
+    if( empty( $cm->new_translations ) ) {
290 255
        //$_REQUEST['webfxtab_manage-categories-pane'] = 0;
291 256
        // unset( $_COOKIE['webfxtab_manage-categories-pane'] );
292 257
        // setcookie('webfxtab_manage-categories-pane', 0);
Please login to merge, or discard this patch.