Completed
Pull Request — develop (#522)
by Agel_Nash
07:16
created
manager/actions/help.static.php 1 patch
Braces   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
 	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 $helpBasePath = "actions/help/";
@@ -16,9 +16,9 @@  discard block
 block discarded – undo
16 16
 		</script>
17 17
 
18 18
 		<?php
19
-		if($handle = opendir('actions/help')) {
20
-			while(false !== ($file = readdir($handle))) {
21
-				if($file != "." && $file != ".." && $file != ".svn" && $file != 'index.html' && !is_dir($helpBasePath . $file)) {
19
+		if($handle = opendir('actions/help')) {
20
+			while(false !== ($file = readdir($handle))) {
21
+				if($file != "." && $file != ".." && $file != ".svn" && $file != 'index.html' && !is_dir($helpBasePath . $file)) {
22 22
 					$help[] = $file;
23 23
 				}
24 24
 			}
@@ -27,12 +27,12 @@  discard block
 block discarded – undo
27 27
 
28 28
 		natcasesort($help);
29 29
 
30
-		foreach($help as $k => $v) {
30
+		foreach($help as $k => $v) {
31 31
 
32 32
 			$helpname = substr($v, 0, strrpos($v, '.'));
33 33
 
34 34
 			$prefix = substr($helpname, 0, 2);
35
-			if(is_numeric($prefix)) {
35
+			if(is_numeric($prefix)) {
36 36
 				$helpname = substr($helpname, 2, strlen($helpname) - 1);
37 37
 			}
38 38
 
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( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5
-if (!$modx->hasPermission('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/help/03Version_Notices.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,8 +18,7 @@
 block discarded – undo
18 18
     foreach($notices as $v) {
19 19
         if ($v >= '1.3.0') {
20 20
             $cms = 'EVO';
21
-        }
22
-        else {
21
+        } else {
23 22
             $cms = 'MODX EVO';
24 23
         }
25 24
         echo '<div class="sectionHeader"> '.$cms.' '.$v.'</div><div class="sectionBody">';
Please login to merge, or discard this patch.
manager/actions/help/01About_EVO.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,12 +18,15 @@
 block discarded – undo
18 18
 	1=>array('title'=>$_lang["extras"],'link'=>'https://www.transifex.com/evolutioncms/extras/'),
19 19
 );
20 20
 
21
-function createList($sectionHeader, $linkArr) {
21
+function createList($sectionHeader, $linkArr)
22
+{
22 23
 	$output = '<div class="sectionHeader">'.$sectionHeader.'</div><div class="sectionBody">'."\n";
23 24
 	$output .= '<table width="500"  border="0" cellspacing="0" cellpadding="0">'."\n";
24 25
 	$links = '';
25 26
 	foreach($linkArr as $row) {
26
-		if (!is_array($row['link'])) $row['link'] = array($row['link']);
27
+		if (!is_array($row['link'])) {
28
+		    $row['link'] = array($row['link']);
29
+		}
27 30
 		foreach ($row['link'] as $link) {
28 31
 			$links .= $links != '' ? '<br/>' : '';
29 32
 			$links .= '<a href="' . $link . '" target="_blank">' . $link . '</a>';
Please login to merge, or discard this patch.
manager/actions/help/04Changelog.php 1 patch
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,7 +8,8 @@
 block discarded – undo
8 8
 <div class="sectionBody">
9 9
 <?php
10 10
 	$changeLog = MODX_BASE_PATH . 'assets/docs/changelog.txt';
11
-	if(is_readable($changeLog))
12
-		echo str_replace("\n",'<br>',file_get_contents($changeLog));
13
-?>
11
+	if(is_readable($changeLog)) {
12
+			echo str_replace("\n",'<br>',file_get_contents($changeLog));
13
+	}
14
+	?>
14 15
 </div>
Please login to merge, or discard this patch.
manager/actions/resources/functions.inc.php 1 patch
Braces   +37 added lines, -32 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
 	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 
@@ -11,13 +11,15 @@  discard block
 block discarded – undo
11 11
 	'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl')
12 12
 );
13 13
 
14
-function parsePh($tpl, $ph) {
14
+function parsePh($tpl, $ph)
15
+{
15 16
 	global $modx, $_lang;
16 17
 	$tpl = $modx->parseText($tpl, $_lang, '[%', '%]');
17 18
 	return $modx->parseText($tpl, $ph);
18 19
 }
19 20
 
20
-function renderViewSwitchButtons($cssId) {
21
+function renderViewSwitchButtons($cssId)
22
+{
21 23
 	global $modx, $_lang, $tpl;
22 24
 
23 25
 	return parsePh($tpl['viewForm'], array(
@@ -25,19 +27,20 @@  discard block
 block discarded – undo
25 27
 	));
26 28
 }
27 29
 
28
-function createResourceList($resourceTable, $resources) {
30
+function createResourceList($resourceTable, $resources)
31
+{
29 32
 	global $modx, $_lang, $_style, $modx_textdir, $tpl;
30 33
 
31 34
 	$items = isset($resources->items[$resourceTable]) ? $resources->items[$resourceTable] : false;
32 35
 
33
-	if( ! is_array($items) || empty($items)) {
36
+	if( ! is_array($items) || empty($items)) {
34 37
 		return $_lang['no_results'];
35 38
 	}
36 39
 
37 40
 	// Prepare elements- and categories-list
38 41
 	$elements = array();
39 42
 	$categories = array();
40
-	foreach($items as $row) {
43
+	foreach($items as $row) {
41 44
 		$catid = $row['catid'] ? $row['catid'] : 0;
42 45
 		$categories[$catid] = array('name' => stripslashes($row['category']));
43 46
 		$elements[$catid][] = prepareElementRowPh($row, $resourceTable, $resources);
@@ -45,7 +48,7 @@  discard block
 block discarded – undo
45 48
 
46 49
 	// Now render categories / panel-collapse
47 50
 	$panelGroup = '';
48
-	foreach($elements as $catid => $elList) {
51
+	foreach($elements as $catid => $elList) {
49 52
 		// Add panel-heading / category-collapse to output
50 53
 		$panelGroup .= parsePh($tpl['panelHeading'], array(
51 54
 			'tab' => $resourceTable,
@@ -56,7 +59,7 @@  discard block
 block discarded – undo
56 59
 
57 60
 		// Prepare content for panel-collapse
58 61
 		$panelCollapse = '';
59
-		foreach($elList as $el) {
62
+		foreach($elList as $el) {
60 63
 			$panelCollapse .= parsePh($tpl['elementsRow'], $el);
61 64
 		}
62 65
 
@@ -74,14 +77,15 @@  discard block
 block discarded – undo
74 77
 	));
75 78
 }
76 79
 
77
-function createCombinedView($resources) {
80
+function createCombinedView($resources)
81
+{
78 82
 	global $modx, $_lang, $_style, $modx_textdir;
79 83
 
80 84
 	$itemsPerCategory = isset($resources->itemsPerCategory) ? $resources->itemsPerCategory : false;
81 85
 	$types = isset($resources->types) ? $resources->types : false;
82 86
 	$categories = isset($resources->categories) ? $resources->categories : false;
83 87
 
84
-	if(!$itemsPerCategory) {
88
+	if(!$itemsPerCategory) {
85 89
 		return $_lang['no_results'];
86 90
 	}
87 91
 
@@ -94,10 +98,10 @@  discard block
 block discarded – undo
94 98
 
95 99
 	// Easily loop through $itemsPerCategory-Array
96 100
 	$panelGroup = '';
97
-	foreach($categories as $catid => $category) {
101
+	foreach($categories as $catid => $category) {
98 102
 		// Prepare collapse content / elements-list
99 103
 		$panelCollapse = '';
100
-		foreach($itemsPerCategory[$catid] as $el) {
104
+		foreach($itemsPerCategory[$catid] as $el) {
101 105
 			$resourceTable = $el['type'];
102 106
 			$ph = prepareElementRowPh($el, $resourceTable, $resources);
103 107
 			$panelCollapse .= parsePh($tpl['elementsRow'], $ph);
@@ -125,7 +129,8 @@  discard block
 block discarded – undo
125 129
 	));
126 130
 }
127 131
 
128
-function prepareElementRowPh($row, $resourceTable, $resources) {
132
+function prepareElementRowPh($row, $resourceTable, $resources)
133
+{
129 134
 	global $modx, $modx_textdir, $_style, $_lang;
130 135
 
131 136
 	$types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false;
@@ -133,32 +138,32 @@  discard block
 block discarded – undo
133 138
 	$class = '';
134 139
 	$_lang["confirm_delete"] = $_lang["delete"];
135 140
 
136
-	if($resourceTable == 'site_templates') {
141
+	if($resourceTable == 'site_templates') {
137 142
 		$class = $row['selectable'] ? '' : 'disabledPlugin';
138 143
 		$lockElementType = 1;
139 144
 		$_lang["confirm_delete"] = $_lang["confirm_delete_template"];
140 145
 	}
141
-	if($resourceTable == 'site_tmplvars') {
146
+	if($resourceTable == 'site_tmplvars') {
142 147
 		$class = $row['reltpl'] ? '' : 'disabledPlugin';
143 148
 		$lockElementType = 2;
144 149
 		$_lang["confirm_delete"] = $_lang["confirm_delete_tmplvars"];
145 150
 	}
146
-	if($resourceTable == 'site_htmlsnippets') {
151
+	if($resourceTable == 'site_htmlsnippets') {
147 152
         $class = $row['disabled'] ? 'disabledPlugin' : '';
148 153
 		$lockElementType = 3;
149 154
 		$_lang["confirm_delete"] = $_lang["confirm_delete_htmlsnippet"];
150 155
 	}
151
-	if($resourceTable == 'site_snippets') {
156
+	if($resourceTable == 'site_snippets') {
152 157
         $class = $row['disabled'] ? 'disabledPlugin' : '';
153 158
 		$lockElementType = 4;
154 159
 		$_lang["confirm_delete"] = $_lang["confirm_delete_snippet"];
155 160
 	}
156
-	if($resourceTable == 'site_plugins') {
161
+	if($resourceTable == 'site_plugins') {
157 162
 		$class = $row['disabled'] ? 'disabledPlugin' : '';
158 163
 		$lockElementType = 5;
159 164
 		$_lang["confirm_delete"] = $_lang["confirm_delete_plugin"];
160 165
 	}
161
-	if($resourceTable == 'site_modules') {
166
+	if($resourceTable == 'site_modules') {
162 167
         $class = $row['disabled'] ? '' : 'disabledPlugin';
163 168
 		$_lang["confirm_delete"] = $_lang["confirm_delete_module"];
164 169
 	}
@@ -166,56 +171,56 @@  discard block
 block discarded – undo
166 171
 	// Prepare displaying user-locks
167 172
 	$lockedByUser = '';
168 173
 	$rowLock = $modx->elementIsLocked($lockElementType, $row['id'], true);
169
-	if($rowLock && $modx->hasPermission('display_locks')) {
170
-		if($rowLock['sid'] == $modx->sid) {
174
+	if($rowLock && $modx->hasPermission('display_locks')) {
175
+		if($rowLock['sid'] == $modx->sid) {
171 176
 			$title = $modx->parseText($_lang["lock_element_editing"], array(
172 177
 				'element_type' => $_lang["lock_element_type_" . $lockElementType],
173 178
 				'lasthit_df' => $rowLock['lasthit_df']
174 179
 			));
175 180
 			$lockedByUser = '<span title="' . $title . '" class="editResource" style="cursor:context-menu;">' . $_style['tree_preview_resource'] . '</span>&nbsp;';
176
-		} else {
181
+		} else {
177 182
 			$title = $modx->parseText($_lang["lock_element_locked_by"], array(
178 183
 				'element_type' => $_lang["lock_element_type_" . $lockElementType],
179 184
 				'username' => $rowLock['username'],
180 185
 				'lasthit_df' => $rowLock['lasthit_df']
181 186
 			));
182
-			if($modx->hasPermission('remove_locks')) {
187
+			if($modx->hasPermission('remove_locks')) {
183 188
 				$lockedByUser = '<a href="javascript:;" onclick="unlockElement(' . $lockElementType . ', ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource"><i class="' . $_style['icons_secured'] . '"></i></a>';
184
-			} else {
189
+			} else {
185 190
 				$lockedByUser = '<span title="' . $title . '" class="lockedResource" style="cursor:context-menu;"><i class="' . $_style['icons_secured'] . '"></i></span>';
186 191
 			}
187 192
 		}
188 193
 	}
189
-	if($lockedByUser) {
194
+	if($lockedByUser) {
190 195
 		$lockedByUser = '<div class="lockCell">' . $lockedByUser . '</div>';
191 196
 	}
192 197
 
193 198
 	// Caption
194
-	if($resourceTable == 'site_tmplvars') {
199
+	if($resourceTable == 'site_tmplvars') {
195 200
 		$caption = !empty($row['description']) ? ' ' . $row['caption'] . ' &nbsp; <small>(' . $row['description'] . ')</small>' : ' ' . $row['caption'];
196
-	} else {
201
+	} else {
197 202
 		$caption = !empty($row['description']) ? ' ' . $row['description'] : '';
198 203
 	}
199 204
 
200 205
 	// Special marks
201 206
 	$tplInfo = array();
202
-	if($row['locked']) {
207
+	if($row['locked']) {
203 208
 		$tplInfo[] = $_lang['locked'];
204 209
 	}
205
-	if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') {
210
+	if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') {
206 211
 		$tplInfo[] = $_lang['defaulttemplate_title'];
207 212
 	}
208 213
 	$marks = !empty($tplInfo) ? ' <em>(' . join(', ', $tplInfo) . ')</em>' : '';
209 214
 
210 215
 	/* row buttons */
211 216
 	$buttons = '';
212
-	if($modx->hasPermission($types['actions']['edit'][1])) {
217
+	if($modx->hasPermission($types['actions']['edit'][1])) {
213 218
 		$buttons .= '<li><a title="' . $_lang["edit_resource"] . '" href="index.php?a=' . $types['actions']['edit'][0] . '&amp;id=' . $row['id'] . '"><i class="fa fa-edit fa-fw"></i></a></li>';
214 219
 	}
215
-	if($modx->hasPermission($types['actions']['duplicate'][1])) {
220
+	if($modx->hasPermission($types['actions']['duplicate'][1])) {
216 221
 		$buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_duplicate_record"] . '\')" title="' . $_lang["resource_duplicate"] . '" href="index.php?a=' . $types['actions']['duplicate'][0] . '&amp;id=' . $row['id'] . '"><i class="fa fa-clone fa-fw"></i></a></li>';
217 222
 	}
218
-	if($modx->hasPermission($types['actions']['remove'][1])) {
223
+	if($modx->hasPermission($types['actions']['remove'][1])) {
219 224
 		$buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_delete"] . '\')" title="' . $_lang["delete"] . '" href="index.php?a=' . $types['actions']['remove'][0] . '&amp;id=' . $row['id'] . '"><i class="fa fa-trash fa-fw"></i></a></li>';
220 225
 	}
221 226
 	$buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">' . $buttons . '</ul></div>' : '';
Please login to merge, or discard this patch.
manager/actions/resources/mgrResources.class.php 1 patch
Braces   +23 added lines, -12 removed lines patch added patch discarded remove patch
@@ -3,19 +3,22 @@  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
 
6
-class mgrResources {
6
+class mgrResources
7
+{
7 8
 	var $types = array();
8 9
 	var $items = array();
9 10
 	var $categories = array();
10 11
 	var $itemsPerCategory = array();
11 12
 
12
-	function __construct() {
13
+	function __construct()
14
+	{
13 15
 		$this->setTypes();
14 16
 		$this->queryItemsFromDB();
15 17
 		$this->prepareCategoryArrays();
16 18
 	}
17 19
 
18
-	function setTypes() {
20
+	function setTypes()
21
+	{
19 22
 		global $_lang;
20 23
 		$this->types['site_templates']    = array(
21 24
 			'title'=>$_lang["manage_templates"],
@@ -50,7 +53,8 @@  discard block
 block discarded – undo
50 53
 		);
51 54
 	}
52 55
 
53
-	function queryItemsFromDB() {
56
+	function queryItemsFromDB()
57
+	{
54 58
 		foreach($this->types as $resourceTable=>$type) {
55 59
 			if($this->hasAnyPermissions($type['permissions'])) {
56 60
 				$nameField = isset($type['name']) ? $type['name'] : 'name';
@@ -59,16 +63,19 @@  discard block
 block discarded – undo
59 63
 		 }
60 64
 	}
61 65
 
62
-	function hasAnyPermissions($permissions) {
66
+	function hasAnyPermissions($permissions)
67
+	{
63 68
 		global $modx;
64 69
 
65
-		foreach($permissions as $p)
66
-			if($modx->hasPermission($p)) return true;
70
+		foreach($permissions as $p) {
71
+					if($modx->hasPermission($p)) return true;
72
+		}
67 73
 
68 74
 		return false;
69 75
 	}
70 76
 
71
-	function queryResources($resourceTable, $nameField = 'name') {
77
+	function queryResources($resourceTable, $nameField = 'name')
78
+	{
72 79
 		global $modx, $_lang;
73 80
 
74 81
 		$pluginsql = ($resourceTable == 'site_htmlsnippets' || $resourceTable == 'site_snippets' || $resourceTable == 'site_plugins' || $resourceTable == 'site_modules') ? $resourceTable . '.disabled, ' : '';
@@ -79,8 +86,9 @@  discard block
 block discarded – undo
79 86
 			$tvsql    = 'site_tmplvars.caption, ';
80 87
 			$tvjoin   = sprintf('LEFT JOIN %s AS stt ON site_tmplvars.id=stt.tmplvarid GROUP BY site_tmplvars.id,reltpl', $modx->getFullTableName('site_tmplvar_templates'));
81 88
 			$sttfield = 'IF(stt.templateid,1,0) AS reltpl,';
89
+		} else {
90
+		    $sttfield = '';
82 91
 		}
83
-		else $sttfield = '';
84 92
 
85 93
 		$selectableTemplates = $resourceTable == 'site_templates' ? "{$resourceTable}.selectable, " : "";
86 94
 
@@ -93,7 +101,9 @@  discard block
 block discarded – undo
93 101
 		);
94 102
 		$limit = $modx->db->getRecordCount($rs);
95 103
 
96
-		if($limit < 1) return false;
104
+		if($limit < 1) {
105
+		    return false;
106
+		}
97 107
 
98 108
 		$result = array();
99 109
 		while ($row = $modx->db->getRow($rs)) {
@@ -102,7 +112,8 @@  discard block
 block discarded – undo
102 112
 		return $result;
103 113
 	}
104 114
 
105
-	function prepareCategoryArrays() {
115
+	function prepareCategoryArrays()
116
+	{
106 117
 		foreach($this->items as $type=>$items) {
107 118
 			foreach((array)$items as $item) {
108 119
 				$catid = $item['catid'] ? $item['catid'] : 0;
@@ -118,7 +129,7 @@  discard block
 block discarded – undo
118 129
 
119 130
 		// Now sort by name
120 131
 		foreach($this->itemsPerCategory as $catid=>$items) {
121
-			usort($this->itemsPerCategory[$catid], function ($a, $b) {
132
+			usort($this->itemsPerCategory[$catid], function ($a, $b){
122 133
 				return strcasecmp($a['name'], $b['name']);
123 134
 			});
124 135
 		}
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( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
 	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5
-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/mutate_categories.dynamic.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,16 +28,14 @@
 block discarded – undo
28 28
 $cm = new Module_Categories_Manager();
29 29
 
30 30
 // assign module_params to internal params
31
-foreach( $_module_params as $param => $value )
32
-{
31
+foreach( $_module_params as $param => $value ) {
33 32
 	$cm->set( $param, $value );
34 33
 }
35 34
 
36 35
 // catch the request actions
37 36
 include_once $cm->get('inc_dir') . 'request_trigger.inc.php';
38 37
 
39
-if( !$categories = $cm->getCategories() )
40
-{
38
+if( !$categories = $cm->getCategories() ) {
41 39
 	setcookie('webfxtab_manage-categories-pane', 0 );
42 40
 	$cm->addMessage( $cm->txt('Currently no categories available... JUST ADD A NEW ONE!'), 'global' );
43 41
 }
Please login to merge, or discard this patch.