Completed
Push — develop ( 75b835...a38a21 )
by Maxim
09:33 queued 04:23
created
manager/actions/modules.static.php 1 patch
Braces   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5
-if (!($modx->hasPermission('new_module') || $modx->hasPermission('edit_module') || $modx->hasPermission('exec_module'))) {
5
+if (!($modx->hasPermission('new_module') || $modx->hasPermission('edit_module') || $modx->hasPermission('exec_module'))) {
6 6
     $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
@@ -10,10 +10,10 @@  discard block
 block discarded – undo
10 10
 $modx->manager->initPageViewState();
11 11
 
12 12
 // get and save search string
13
-if ($_REQUEST['op'] == 'reset') {
13
+if ($_REQUEST['op'] == 'reset') {
14 14
     $query = '';
15 15
     $_PAGE['vs']['search'] = '';
16
-} else {
16
+} else {
17 17
     $query = isset($_REQUEST['search']) ? $_REQUEST['search'] : $_PAGE['vs']['search'];
18 18
     $sqlQuery = $modx->db->escape($query);
19 19
     $_PAGE['vs']['search'] = $query;
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 include_once MODX_MANAGER_PATH . "includes/controls/contextmenu.php";
29 29
 $cm = new ContextMenu("cntxm", 150);
30 30
 $cm->addItem($_lang["run_module"], "js:menuAction(1)", $_style['actions_run'], (!$modx->hasPermission('exec_module') ? 1 : 0));
31
-if ($modx->hasPermission('edit_module') || $modx->hasPermission('new_module') || $modx->hasPermission('delete_module')) {
31
+if ($modx->hasPermission('edit_module') || $modx->hasPermission('new_module') || $modx->hasPermission('delete_module')) {
32 32
     $cm->addSeparator();
33 33
 }
34 34
 $cm->addItem($_lang["edit"], "js:menuAction(2)", $_style['actions_edit'], (!$modx->hasPermission('edit_module') ? 1 : 0));
@@ -107,21 +107,21 @@  discard block
 block discarded – undo
107 107
 <div class="tab-page">
108 108
     <div class="table-responsive">
109 109
         <?php
110
-        if ($_SESSION['mgrRole'] != 1 && !empty($modx->config['use_udperms'])) {
110
+        if ($_SESSION['mgrRole'] != 1 && !empty($modx->config['use_udperms'])) {
111 111
             $rs = $modx->db->query('SELECT DISTINCT sm.id, sm.name, sm.description, mg.member, IF(disabled,"' . $_lang['yes'] . '","-") as disabled, IF(sm.icon<>"",sm.icon,"' . $_style['icons_modules'] . '") as icon
112 112
 				FROM ' . $modx->getFullTableName('site_modules') . ' AS sm
113 113
 				LEFT JOIN ' . $modx->getFullTableName('site_module_access') . ' AS sma ON sma.module = sm.id
114 114
 				LEFT JOIN ' . $modx->getFullTableName('member_groups') . ' AS mg ON sma.usergroup = mg.user_group
115 115
                 WHERE (mg.member IS NULL OR mg.member = ' . $modx->getLoginUserID() . ') AND sm.disabled != 1 AND sm.locked != 1
116 116
                 ORDER BY sm.name');
117
-            if ($modx->hasPermission('edit_module')) {
117
+            if ($modx->hasPermission('edit_module')) {
118 118
                 $title = "<a href='index.php?a=108&id=[+id+]' title='" . $_lang["module_edit_click_title"] . "'>[+value+]</a>";
119
-            } else if ($modx->hasPermission('exec_module')) {
119
+            } else if ($modx->hasPermission('exec_module')) {
120 120
                 $title = "<a href='index.php?a=112&id=[+id+]' title='" . $_lang["module_edit_click_title"] . "'>[+value+]</a>";
121
-            } else {
121
+            } else {
122 122
                 $title = '[+value+]';
123 123
             }
124
-        } else {
124
+        } else {
125 125
             $rs = $modx->db->select("id, name, description, IF(locked,'{$_lang['yes']}','-') as locked, IF(disabled,'{$_lang['yes']}','-') as disabled, IF(icon<>'',icon,'{$_style['icons_module']}') as icon", $modx->getFullTableName("site_modules"), (!empty($sqlQuery) ? "(name LIKE '%{$sqlQuery}%') OR (description LIKE '%{$sqlQuery}%')" : ""), "name");
126 126
             $title = "<a href='index.php?a=108&id=[+id+]' title='" . $_lang["module_edit_click_title"] . "'>[+value+]</a>";
127 127
         }
@@ -137,10 +137,10 @@  discard block
 block discarded – undo
137 137
         $grd->colWidths = "34,,,60,60";
138 138
         $grd->colAligns = "center,,,center,center";
139 139
         $grd->colTypes = "template:<a class='tableRowIcon' href='javascript:;' onclick='return showContentMenu([+id+],event);' title='" . $_lang["click_to_context"] . "'><i class='[+value+]'></i></a>||template:" . $title;
140
-        if ($listmode == '1') {
140
+        if ($listmode == '1') {
141 141
             $grd->pageSize = 0;
142 142
         }
143
-        if ($_REQUEST['op'] == 'reset') {
143
+        if ($_REQUEST['op'] == 'reset') {
144 144
             $grd->pageNumber = 1;
145 145
         }
146 146
         // render grid
Please login to merge, or discard this patch.
manager/actions/sysinfo.static.php 1 patch
Braces   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5
-if (!$modx->hasPermission('logs')) {
5
+if (!$modx->hasPermission('logs')) {
6 6
     $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
                 <table class="table data table-sm nowrap">
56 56
                     <tbody>
57 57
                     <?php
58
-                    foreach ($serverArr as $key => $value) {
58
+                    foreach ($serverArr as $key => $value) {
59 59
                         ?>
60 60
                         <tr>
61 61
                             <td width="1%"><?= $key ?></td>
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
                     $sql = "SHOW TABLE STATUS FROM $dbase LIKE '" . $modx->db->escape($modx->db->config['table_prefix']) . "%';";
99 99
                     $rs = $modx->db->query($sql);
100 100
                     $i = 0;
101
-                    while ($log_status = $modx->db->getRow($rs)) {
101
+                    while ($log_status = $modx->db->getRow($rs)) {
102 102
                         ?>
103 103
                         <tr>
104 104
                             <td class="text-primary"><b><?= $log_status['Name'] ?></b></td>
@@ -110,17 +110,17 @@  discard block
 block discarded – undo
110 110
                                 $modx->db->config['table_prefix'] . 'event_log',
111 111
                                 $modx->db->config['table_prefix'] . 'manager_log',
112 112
                             );
113
-                            if ($modx->hasPermission('settings') && in_array($log_status['Name'], $truncateable)) {
113
+                            if ($modx->hasPermission('settings') && in_array($log_status['Name'], $truncateable)) {
114 114
                                 echo "<td class=\"text-xs-right\">";
115 115
                                 echo "<a class=\"text-danger\" href='index.php?a=54&mode=$action&u=" . $log_status['Name'] . "' title='" . $_lang['truncate_table'] . "'>" . $modx->nicesize($log_status['Data_length'] + $log_status['Data_free']) . "</a>";
116 116
                                 echo "</td>";
117
-                            } else {
117
+                            } else {
118 118
                                 echo "<td class=\"text-xs-right\">" . $modx->nicesize($log_status['Data_length'] + $log_status['Data_free']) . "</td>";
119 119
                             }
120 120
 
121
-                            if ($modx->hasPermission('settings')) {
121
+                            if ($modx->hasPermission('settings')) {
122 122
                                 echo "<td class=\"text-xs-right\">" . ($log_status['Data_free'] > 0 ? "<a class=\"text-danger\" href='index.php?a=54&mode=$action&t=" . $log_status['Name'] . "' title='" . $_lang['optimize_table'] . "' ><span>" . $modx->nicesize($log_status['Data_free']) . "</span></a>" : "-") . "</td>";
123
-                            } else {
123
+                            } else {
124 124
                                 echo "<td class=\"text-xs-right\">" . ($log_status['Data_free'] > 0 ? $modx->nicesize($log_status['Data_free']) : "-") . "</td>";
125 125
                             }
126 126
                             ?>
Please login to merge, or discard this patch.
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.