Completed
Push — develop ( 75b835...a38a21 )
by Maxim
09:33 queued 04:23
created
manager/actions/resources/tab3_chunks.inc.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <!-- chunks -->
2 2
 <?php
3
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
4 4
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
5 5
 }
6 6
 
Please login to merge, or discard this patch.
manager/actions/resources/tab6_categoryview.inc.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 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
 
Please login to merge, or discard this patch.
manager/actions/resources/tab4_snippets.inc.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <!-- snippets -->
2 2
 <?php
3
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
4 4
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
5 5
 }
6 6
 
Please login to merge, or discard this patch.
manager/actions/resources/functions.inc.php 3 patches
Indentation   +214 added lines, -214 removed lines patch added patch discarded remove patch
@@ -1,239 +1,239 @@
 block discarded – undo
1 1
 <?php
2 2
 if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3
-	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
3
+    die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 
6 6
 $tpl = array(
7
-	'viewForm' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_viewForm.tpl'),
8
-	'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'),
9
-	'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'),
10
-	'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'),
11
-	'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl')
7
+    'viewForm' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_viewForm.tpl'),
8
+    'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'),
9
+    'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'),
10
+    'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'),
11
+    'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl')
12 12
 );
13 13
 
14 14
 function parsePh($tpl, $ph) {
15
-	global $modx, $_lang;
16
-	$tpl = $modx->parseText($tpl, $_lang, '[%', '%]');
17
-	return $modx->parseText($tpl, $ph);
15
+    global $modx, $_lang;
16
+    $tpl = $modx->parseText($tpl, $_lang, '[%', '%]');
17
+    return $modx->parseText($tpl, $ph);
18 18
 }
19 19
 
20 20
 function renderViewSwitchButtons($cssId) {
21
-	global $modx, $_lang, $tpl;
21
+    global $modx, $_lang, $tpl;
22 22
 
23
-	return parsePh($tpl['viewForm'], array(
24
-		'cssId' => $cssId
25
-	));
23
+    return parsePh($tpl['viewForm'], array(
24
+        'cssId' => $cssId
25
+    ));
26 26
 }
27 27
 
28 28
 function createResourceList($resourceTable, $resources) {
29
-	global $modx, $_lang, $_style, $modx_textdir, $tpl;
30
-
31
-	$items = isset($resources->items[$resourceTable]) ? $resources->items[$resourceTable] : false;
32
-
33
-	if( ! is_array($items) || empty($items)) {
34
-		return $_lang['no_results'];
35
-	}
36
-
37
-	// Prepare elements- and categories-list
38
-	$elements = array();
39
-	$categories = array();
40
-	foreach($items as $row) {
41
-		$catid = $row['catid'] ? $row['catid'] : 0;
42
-		$categories[$catid] = array('name' => stripslashes($row['category']));
43
-		$elements[$catid][] = prepareElementRowPh($row, $resourceTable, $resources);
44
-	}
45
-
46
-	// Now render categories / panel-collapse
47
-	$panelGroup = '';
48
-	foreach($elements as $catid => $elList) {
49
-		// Add panel-heading / category-collapse to output
50
-		$panelGroup .= parsePh($tpl['panelHeading'], array(
51
-			'tab' => $resourceTable,
52
-			'category' => $categories[$catid]['name'],
53
-			'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '',
54
-			'catid' => $catid,
55
-		));
56
-
57
-		// Prepare content for panel-collapse
58
-		$panelCollapse = '';
59
-		foreach($elList as $el) {
60
-			$panelCollapse .= parsePh($tpl['elementsRow'], $el);
61
-		}
62
-
63
-		// Add panel-collapse with elements to output
64
-		$panelGroup .= parsePh($tpl['panelCollapse'], array(
65
-			'tab' => $resourceTable,
66
-			'catid' => $catid,
67
-			'wrapper' => $panelCollapse,
68
-		));
69
-	}
70
-
71
-	return parsePh($tpl['panelGroup'], array(
72
-		'resourceTable' => $resourceTable,
73
-		'wrapper' => $panelGroup
74
-	));
29
+    global $modx, $_lang, $_style, $modx_textdir, $tpl;
30
+
31
+    $items = isset($resources->items[$resourceTable]) ? $resources->items[$resourceTable] : false;
32
+
33
+    if( ! is_array($items) || empty($items)) {
34
+        return $_lang['no_results'];
35
+    }
36
+
37
+    // Prepare elements- and categories-list
38
+    $elements = array();
39
+    $categories = array();
40
+    foreach($items as $row) {
41
+        $catid = $row['catid'] ? $row['catid'] : 0;
42
+        $categories[$catid] = array('name' => stripslashes($row['category']));
43
+        $elements[$catid][] = prepareElementRowPh($row, $resourceTable, $resources);
44
+    }
45
+
46
+    // Now render categories / panel-collapse
47
+    $panelGroup = '';
48
+    foreach($elements as $catid => $elList) {
49
+        // Add panel-heading / category-collapse to output
50
+        $panelGroup .= parsePh($tpl['panelHeading'], array(
51
+            'tab' => $resourceTable,
52
+            'category' => $categories[$catid]['name'],
53
+            'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '',
54
+            'catid' => $catid,
55
+        ));
56
+
57
+        // Prepare content for panel-collapse
58
+        $panelCollapse = '';
59
+        foreach($elList as $el) {
60
+            $panelCollapse .= parsePh($tpl['elementsRow'], $el);
61
+        }
62
+
63
+        // Add panel-collapse with elements to output
64
+        $panelGroup .= parsePh($tpl['panelCollapse'], array(
65
+            'tab' => $resourceTable,
66
+            'catid' => $catid,
67
+            'wrapper' => $panelCollapse,
68
+        ));
69
+    }
70
+
71
+    return parsePh($tpl['panelGroup'], array(
72
+        'resourceTable' => $resourceTable,
73
+        'wrapper' => $panelGroup
74
+    ));
75 75
 }
76 76
 
77 77
 function createCombinedView($resources) {
78
-	global $modx, $_lang, $_style, $modx_textdir;
79
-
80
-	$itemsPerCategory = isset($resources->itemsPerCategory) ? $resources->itemsPerCategory : false;
81
-	$types = isset($resources->types) ? $resources->types : false;
82
-	$categories = isset($resources->categories) ? $resources->categories : false;
83
-
84
-	if(!$itemsPerCategory) {
85
-		return $_lang['no_results'];
86
-	}
87
-
88
-	$tpl = array(
89
-		'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'),
90
-		'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'),
91
-		'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'),
92
-		'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl'),
93
-	);
94
-
95
-	// Easily loop through $itemsPerCategory-Array
96
-	$panelGroup = '';
97
-	foreach($categories as $catid => $category) {
98
-		// Prepare collapse content / elements-list
99
-		$panelCollapse = '';
100
-		foreach($itemsPerCategory[$catid] as $el) {
101
-			$resourceTable = $el['type'];
102
-			$ph = prepareElementRowPh($el, $resourceTable, $resources);
103
-			$panelCollapse .= parsePh($tpl['elementsRow'], $ph);
104
-		}
105
-
106
-		// Add panel-heading / button
107
-		$panelGroup .= parsePh($tpl['panelHeading'], array(
108
-			'tab' => 'categories_list',
109
-			'category' => $categories[$catid],
110
-			'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '',
111
-			'catid' => $catid,
112
-		));
113
-
114
-		// Add panel
115
-		$panelGroup .= parsePh($tpl['panelCollapse'], array(
116
-			'tab' => 'categories_list',
117
-			'catid' => $catid,
118
-			'wrapper' => $panelCollapse,
119
-		));
120
-	}
121
-
122
-	return parsePh($tpl['panelGroup'], array(
123
-		'resourceTable' => 'categories_list',
124
-		'wrapper' => $panelGroup
125
-	));
78
+    global $modx, $_lang, $_style, $modx_textdir;
79
+
80
+    $itemsPerCategory = isset($resources->itemsPerCategory) ? $resources->itemsPerCategory : false;
81
+    $types = isset($resources->types) ? $resources->types : false;
82
+    $categories = isset($resources->categories) ? $resources->categories : false;
83
+
84
+    if(!$itemsPerCategory) {
85
+        return $_lang['no_results'];
86
+    }
87
+
88
+    $tpl = array(
89
+        'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'),
90
+        'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'),
91
+        'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'),
92
+        'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl'),
93
+    );
94
+
95
+    // Easily loop through $itemsPerCategory-Array
96
+    $panelGroup = '';
97
+    foreach($categories as $catid => $category) {
98
+        // Prepare collapse content / elements-list
99
+        $panelCollapse = '';
100
+        foreach($itemsPerCategory[$catid] as $el) {
101
+            $resourceTable = $el['type'];
102
+            $ph = prepareElementRowPh($el, $resourceTable, $resources);
103
+            $panelCollapse .= parsePh($tpl['elementsRow'], $ph);
104
+        }
105
+
106
+        // Add panel-heading / button
107
+        $panelGroup .= parsePh($tpl['panelHeading'], array(
108
+            'tab' => 'categories_list',
109
+            'category' => $categories[$catid],
110
+            'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '',
111
+            'catid' => $catid,
112
+        ));
113
+
114
+        // Add panel
115
+        $panelGroup .= parsePh($tpl['panelCollapse'], array(
116
+            'tab' => 'categories_list',
117
+            'catid' => $catid,
118
+            'wrapper' => $panelCollapse,
119
+        ));
120
+    }
121
+
122
+    return parsePh($tpl['panelGroup'], array(
123
+        'resourceTable' => 'categories_list',
124
+        'wrapper' => $panelGroup
125
+    ));
126 126
 }
127 127
 
128 128
 function prepareElementRowPh($row, $resourceTable, $resources) {
129
-	global $modx, $modx_textdir, $_style, $_lang;
130
-
131
-	$types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false;
132
-
133
-	$class = '';
134
-	$_lang["confirm_delete"] = $_lang["delete"];
135
-
136
-	if($resourceTable == 'site_templates') {
137
-		$class = $row['selectable'] ? '' : 'disabledPlugin';
138
-		$lockElementType = 1;
139
-		$_lang["confirm_delete"] = $_lang["confirm_delete_template"];
140
-	}
141
-	if($resourceTable == 'site_tmplvars') {
142
-		$class = $row['reltpl'] ? '' : 'disabledPlugin';
143
-		$lockElementType = 2;
144
-		$_lang["confirm_delete"] = $_lang["confirm_delete_tmplvars"];
145
-	}
146
-	if($resourceTable == 'site_htmlsnippets') {
129
+    global $modx, $modx_textdir, $_style, $_lang;
130
+
131
+    $types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false;
132
+
133
+    $class = '';
134
+    $_lang["confirm_delete"] = $_lang["delete"];
135
+
136
+    if($resourceTable == 'site_templates') {
137
+        $class = $row['selectable'] ? '' : 'disabledPlugin';
138
+        $lockElementType = 1;
139
+        $_lang["confirm_delete"] = $_lang["confirm_delete_template"];
140
+    }
141
+    if($resourceTable == 'site_tmplvars') {
142
+        $class = $row['reltpl'] ? '' : 'disabledPlugin';
143
+        $lockElementType = 2;
144
+        $_lang["confirm_delete"] = $_lang["confirm_delete_tmplvars"];
145
+    }
146
+    if($resourceTable == 'site_htmlsnippets') {
147 147
         $class = $row['disabled'] ? 'disabledPlugin' : '';
148
-		$lockElementType = 3;
149
-		$_lang["confirm_delete"] = $_lang["confirm_delete_htmlsnippet"];
150
-	}
151
-	if($resourceTable == 'site_snippets') {
148
+        $lockElementType = 3;
149
+        $_lang["confirm_delete"] = $_lang["confirm_delete_htmlsnippet"];
150
+    }
151
+    if($resourceTable == 'site_snippets') {
152 152
         $class = $row['disabled'] ? 'disabledPlugin' : '';
153
-		$lockElementType = 4;
154
-		$_lang["confirm_delete"] = $_lang["confirm_delete_snippet"];
155
-	}
156
-	if($resourceTable == 'site_plugins') {
157
-		$class = $row['disabled'] ? 'disabledPlugin' : '';
158
-		$lockElementType = 5;
159
-		$_lang["confirm_delete"] = $_lang["confirm_delete_plugin"];
160
-	}
161
-	if($resourceTable == 'site_modules') {
153
+        $lockElementType = 4;
154
+        $_lang["confirm_delete"] = $_lang["confirm_delete_snippet"];
155
+    }
156
+    if($resourceTable == 'site_plugins') {
157
+        $class = $row['disabled'] ? 'disabledPlugin' : '';
158
+        $lockElementType = 5;
159
+        $_lang["confirm_delete"] = $_lang["confirm_delete_plugin"];
160
+    }
161
+    if($resourceTable == 'site_modules') {
162 162
         $class = $row['disabled'] ? '' : 'disabledPlugin';
163
-		$_lang["confirm_delete"] = $_lang["confirm_delete_module"];
164
-	}
165
-
166
-	// Prepare displaying user-locks
167
-	$lockedByUser = '';
168
-	$rowLock = $modx->elementIsLocked($lockElementType, $row['id'], true);
169
-	if($rowLock && $modx->hasPermission('display_locks')) {
170
-		if($rowLock['sid'] == $modx->sid) {
171
-			$title = $modx->parseText($_lang["lock_element_editing"], array(
172
-				'element_type' => $_lang["lock_element_type_" . $lockElementType],
173
-				'lasthit_df' => $rowLock['lasthit_df']
174
-			));
175
-			$lockedByUser = '<span title="' . $title . '" class="editResource" style="cursor:context-menu;">' . $_style['tree_preview_resource'] . '</span>&nbsp;';
176
-		} else {
177
-			$title = $modx->parseText($_lang["lock_element_locked_by"], array(
178
-				'element_type' => $_lang["lock_element_type_" . $lockElementType],
179
-				'username' => $rowLock['username'],
180
-				'lasthit_df' => $rowLock['lasthit_df']
181
-			));
182
-			if($modx->hasPermission('remove_locks')) {
183
-				$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 {
185
-				$lockedByUser = '<span title="' . $title . '" class="lockedResource" style="cursor:context-menu;"><i class="' . $_style['icons_secured'] . '"></i></span>';
186
-			}
187
-		}
188
-	}
189
-	if($lockedByUser) {
190
-		$lockedByUser = '<div class="lockCell">' . $lockedByUser . '</div>';
191
-	}
192
-
193
-	// Caption
194
-	if($resourceTable == 'site_tmplvars') {
195
-		$caption = !empty($row['description']) ? ' ' . $row['caption'] . ' &nbsp; <small>(' . $row['description'] . ')</small>' : ' ' . $row['caption'];
196
-	} else {
197
-		$caption = !empty($row['description']) ? ' ' . $row['description'] : '';
198
-	}
199
-
200
-	// Special marks
201
-	$tplInfo = array();
202
-	if($row['locked']) {
203
-		$tplInfo[] = $_lang['locked'];
204
-	}
205
-	if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') {
206
-		$tplInfo[] = $_lang['defaulttemplate_title'];
207
-	}
208
-	$marks = !empty($tplInfo) ? ' <em>(' . join(', ', $tplInfo) . ')</em>' : '';
209
-
210
-	/* row buttons */
211
-	$buttons = '';
212
-	if($modx->hasPermission($types['actions']['edit'][1])) {
213
-		$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
-	}
215
-	if($modx->hasPermission($types['actions']['duplicate'][1])) {
216
-		$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
-	}
218
-	if($modx->hasPermission($types['actions']['remove'][1])) {
219
-		$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
-	}
221
-	$buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">' . $buttons . '</ul></div>' : '';
222
-
223
-	$catid = $row['catid'] ? $row['catid'] : 0;
224
-
225
-	// Placeholders for elements-row
226
-	return array(
227
-		'class' => $class ? ' class="' . $class . '"' : '',
228
-		'lockedByUser' => $lockedByUser,
229
-		'name' => $row['name'],
230
-		'caption' => $caption,
231
-		'buttons' => $buttons,
232
-		'marks' => $marks,
233
-		'id' => $row['id'],
234
-		'resourceTable' => $resourceTable,
235
-		'actionEdit' => $types['actions']['edit'][0],
236
-		'catid' => $catid,
237
-		'textdir' => $modx_textdir ? '&rlm;' : '',
238
-	);
163
+        $_lang["confirm_delete"] = $_lang["confirm_delete_module"];
164
+    }
165
+
166
+    // Prepare displaying user-locks
167
+    $lockedByUser = '';
168
+    $rowLock = $modx->elementIsLocked($lockElementType, $row['id'], true);
169
+    if($rowLock && $modx->hasPermission('display_locks')) {
170
+        if($rowLock['sid'] == $modx->sid) {
171
+            $title = $modx->parseText($_lang["lock_element_editing"], array(
172
+                'element_type' => $_lang["lock_element_type_" . $lockElementType],
173
+                'lasthit_df' => $rowLock['lasthit_df']
174
+            ));
175
+            $lockedByUser = '<span title="' . $title . '" class="editResource" style="cursor:context-menu;">' . $_style['tree_preview_resource'] . '</span>&nbsp;';
176
+        } else {
177
+            $title = $modx->parseText($_lang["lock_element_locked_by"], array(
178
+                'element_type' => $_lang["lock_element_type_" . $lockElementType],
179
+                'username' => $rowLock['username'],
180
+                'lasthit_df' => $rowLock['lasthit_df']
181
+            ));
182
+            if($modx->hasPermission('remove_locks')) {
183
+                $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 {
185
+                $lockedByUser = '<span title="' . $title . '" class="lockedResource" style="cursor:context-menu;"><i class="' . $_style['icons_secured'] . '"></i></span>';
186
+            }
187
+        }
188
+    }
189
+    if($lockedByUser) {
190
+        $lockedByUser = '<div class="lockCell">' . $lockedByUser . '</div>';
191
+    }
192
+
193
+    // Caption
194
+    if($resourceTable == 'site_tmplvars') {
195
+        $caption = !empty($row['description']) ? ' ' . $row['caption'] . ' &nbsp; <small>(' . $row['description'] . ')</small>' : ' ' . $row['caption'];
196
+    } else {
197
+        $caption = !empty($row['description']) ? ' ' . $row['description'] : '';
198
+    }
199
+
200
+    // Special marks
201
+    $tplInfo = array();
202
+    if($row['locked']) {
203
+        $tplInfo[] = $_lang['locked'];
204
+    }
205
+    if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') {
206
+        $tplInfo[] = $_lang['defaulttemplate_title'];
207
+    }
208
+    $marks = !empty($tplInfo) ? ' <em>(' . join(', ', $tplInfo) . ')</em>' : '';
209
+
210
+    /* row buttons */
211
+    $buttons = '';
212
+    if($modx->hasPermission($types['actions']['edit'][1])) {
213
+        $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
+    }
215
+    if($modx->hasPermission($types['actions']['duplicate'][1])) {
216
+        $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
+    }
218
+    if($modx->hasPermission($types['actions']['remove'][1])) {
219
+        $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
+    }
221
+    $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">' . $buttons . '</ul></div>' : '';
222
+
223
+    $catid = $row['catid'] ? $row['catid'] : 0;
224
+
225
+    // Placeholders for elements-row
226
+    return array(
227
+        'class' => $class ? ' class="' . $class . '"' : '',
228
+        'lockedByUser' => $lockedByUser,
229
+        'name' => $row['name'],
230
+        'caption' => $caption,
231
+        'buttons' => $buttons,
232
+        'marks' => $marks,
233
+        'id' => $row['id'],
234
+        'resourceTable' => $resourceTable,
235
+        'actionEdit' => $types['actions']['edit'][0],
236
+        'catid' => $catid,
237
+        'textdir' => $modx_textdir ? '&rlm;' : '',
238
+    );
239 239
 }
Please login to merge, or discard this patch.
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -1,23 +1,23 @@  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
 
6 6
 $tpl = array(
7
-	'viewForm' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_viewForm.tpl'),
8
-	'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'),
9
-	'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'),
10
-	'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'),
11
-	'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl')
7
+	'viewForm' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_viewForm.tpl'),
8
+	'panelGroup' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelGroup.tpl'),
9
+	'panelHeading' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelHeading.tpl'),
10
+	'panelCollapse' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelCollapse.tpl'),
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
 	global $modx, $_lang;
16 16
 	$tpl = $modx->parseText($tpl, $_lang, '[%', '%]');
17 17
 	return $modx->parseText($tpl, $ph);
18 18
 }
19 19
 
20
-function renderViewSwitchButtons($cssId) {
20
+function renderViewSwitchButtons($cssId){
21 21
 	global $modx, $_lang, $tpl;
22 22
 
23 23
 	return parsePh($tpl['viewForm'], array(
@@ -25,19 +25,19 @@  discard block
 block discarded – undo
25 25
 	));
26 26
 }
27 27
 
28
-function createResourceList($resourceTable, $resources) {
28
+function createResourceList($resourceTable, $resources){
29 29
 	global $modx, $_lang, $_style, $modx_textdir, $tpl;
30 30
 
31 31
 	$items = isset($resources->items[$resourceTable]) ? $resources->items[$resourceTable] : false;
32 32
 
33
-	if( ! is_array($items) || empty($items)) {
33
+	if (!is_array($items) || empty($items)) {
34 34
 		return $_lang['no_results'];
35 35
 	}
36 36
 
37 37
 	// Prepare elements- and categories-list
38 38
 	$elements = array();
39 39
 	$categories = array();
40
-	foreach($items as $row) {
40
+	foreach ($items as $row) {
41 41
 		$catid = $row['catid'] ? $row['catid'] : 0;
42 42
 		$categories[$catid] = array('name' => stripslashes($row['category']));
43 43
 		$elements[$catid][] = prepareElementRowPh($row, $resourceTable, $resources);
@@ -45,18 +45,18 @@  discard block
 block discarded – undo
45 45
 
46 46
 	// Now render categories / panel-collapse
47 47
 	$panelGroup = '';
48
-	foreach($elements as $catid => $elList) {
48
+	foreach ($elements as $catid => $elList) {
49 49
 		// Add panel-heading / category-collapse to output
50 50
 		$panelGroup .= parsePh($tpl['panelHeading'], array(
51 51
 			'tab' => $resourceTable,
52 52
 			'category' => $categories[$catid]['name'],
53
-			'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '',
53
+			'categoryid' => $catid != '' ? ' <small>('.$catid.')</small>' : '',
54 54
 			'catid' => $catid,
55 55
 		));
56 56
 
57 57
 		// Prepare content for panel-collapse
58 58
 		$panelCollapse = '';
59
-		foreach($elList as $el) {
59
+		foreach ($elList as $el) {
60 60
 			$panelCollapse .= parsePh($tpl['elementsRow'], $el);
61 61
 		}
62 62
 
@@ -74,30 +74,30 @@  discard block
 block discarded – undo
74 74
 	));
75 75
 }
76 76
 
77
-function createCombinedView($resources) {
77
+function createCombinedView($resources){
78 78
 	global $modx, $_lang, $_style, $modx_textdir;
79 79
 
80 80
 	$itemsPerCategory = isset($resources->itemsPerCategory) ? $resources->itemsPerCategory : false;
81 81
 	$types = isset($resources->types) ? $resources->types : false;
82 82
 	$categories = isset($resources->categories) ? $resources->categories : false;
83 83
 
84
-	if(!$itemsPerCategory) {
84
+	if (!$itemsPerCategory) {
85 85
 		return $_lang['no_results'];
86 86
 	}
87 87
 
88 88
 	$tpl = array(
89
-		'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'),
90
-		'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'),
91
-		'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'),
92
-		'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl'),
89
+		'panelGroup' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelGroup.tpl'),
90
+		'panelHeading' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelHeading.tpl'),
91
+		'panelCollapse' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelCollapse.tpl'),
92
+		'elementsRow' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_elementsRow.tpl'),
93 93
 	);
94 94
 
95 95
 	// Easily loop through $itemsPerCategory-Array
96 96
 	$panelGroup = '';
97
-	foreach($categories as $catid => $category) {
97
+	foreach ($categories as $catid => $category) {
98 98
 		// Prepare collapse content / elements-list
99 99
 		$panelCollapse = '';
100
-		foreach($itemsPerCategory[$catid] as $el) {
100
+		foreach ($itemsPerCategory[$catid] as $el) {
101 101
 			$resourceTable = $el['type'];
102 102
 			$ph = prepareElementRowPh($el, $resourceTable, $resources);
103 103
 			$panelCollapse .= parsePh($tpl['elementsRow'], $ph);
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 		$panelGroup .= parsePh($tpl['panelHeading'], array(
108 108
 			'tab' => 'categories_list',
109 109
 			'category' => $categories[$catid],
110
-			'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '',
110
+			'categoryid' => $catid != '' ? ' <small>('.$catid.')</small>' : '',
111 111
 			'catid' => $catid,
112 112
 		));
113 113
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	));
126 126
 }
127 127
 
128
-function prepareElementRowPh($row, $resourceTable, $resources) {
128
+function prepareElementRowPh($row, $resourceTable, $resources){
129 129
 	global $modx, $modx_textdir, $_style, $_lang;
130 130
 
131 131
 	$types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false;
@@ -133,32 +133,32 @@  discard block
 block discarded – undo
133 133
 	$class = '';
134 134
 	$_lang["confirm_delete"] = $_lang["delete"];
135 135
 
136
-	if($resourceTable == 'site_templates') {
136
+	if ($resourceTable == 'site_templates') {
137 137
 		$class = $row['selectable'] ? '' : 'disabledPlugin';
138 138
 		$lockElementType = 1;
139 139
 		$_lang["confirm_delete"] = $_lang["confirm_delete_template"];
140 140
 	}
141
-	if($resourceTable == 'site_tmplvars') {
141
+	if ($resourceTable == 'site_tmplvars') {
142 142
 		$class = $row['reltpl'] ? '' : 'disabledPlugin';
143 143
 		$lockElementType = 2;
144 144
 		$_lang["confirm_delete"] = $_lang["confirm_delete_tmplvars"];
145 145
 	}
146
-	if($resourceTable == 'site_htmlsnippets') {
146
+	if ($resourceTable == 'site_htmlsnippets') {
147 147
         $class = $row['disabled'] ? 'disabledPlugin' : '';
148 148
 		$lockElementType = 3;
149 149
 		$_lang["confirm_delete"] = $_lang["confirm_delete_htmlsnippet"];
150 150
 	}
151
-	if($resourceTable == 'site_snippets') {
151
+	if ($resourceTable == 'site_snippets') {
152 152
         $class = $row['disabled'] ? 'disabledPlugin' : '';
153 153
 		$lockElementType = 4;
154 154
 		$_lang["confirm_delete"] = $_lang["confirm_delete_snippet"];
155 155
 	}
156
-	if($resourceTable == 'site_plugins') {
156
+	if ($resourceTable == 'site_plugins') {
157 157
 		$class = $row['disabled'] ? 'disabledPlugin' : '';
158 158
 		$lockElementType = 5;
159 159
 		$_lang["confirm_delete"] = $_lang["confirm_delete_plugin"];
160 160
 	}
161
-	if($resourceTable == 'site_modules') {
161
+	if ($resourceTable == 'site_modules') {
162 162
         $class = $row['disabled'] ? '' : 'disabledPlugin';
163 163
 		$_lang["confirm_delete"] = $_lang["confirm_delete_module"];
164 164
 	}
@@ -166,65 +166,65 @@  discard block
 block discarded – undo
166 166
 	// Prepare displaying user-locks
167 167
 	$lockedByUser = '';
168 168
 	$rowLock = $modx->elementIsLocked($lockElementType, $row['id'], true);
169
-	if($rowLock && $modx->hasPermission('display_locks')) {
170
-		if($rowLock['sid'] == $modx->sid) {
169
+	if ($rowLock && $modx->hasPermission('display_locks')) {
170
+		if ($rowLock['sid'] == $modx->sid) {
171 171
 			$title = $modx->parseText($_lang["lock_element_editing"], array(
172
-				'element_type' => $_lang["lock_element_type_" . $lockElementType],
172
+				'element_type' => $_lang["lock_element_type_".$lockElementType],
173 173
 				'lasthit_df' => $rowLock['lasthit_df']
174 174
 			));
175
-			$lockedByUser = '<span title="' . $title . '" class="editResource" style="cursor:context-menu;">' . $_style['tree_preview_resource'] . '</span>&nbsp;';
175
+			$lockedByUser = '<span title="'.$title.'" class="editResource" style="cursor:context-menu;">'.$_style['tree_preview_resource'].'</span>&nbsp;';
176 176
 		} else {
177 177
 			$title = $modx->parseText($_lang["lock_element_locked_by"], array(
178
-				'element_type' => $_lang["lock_element_type_" . $lockElementType],
178
+				'element_type' => $_lang["lock_element_type_".$lockElementType],
179 179
 				'username' => $rowLock['username'],
180 180
 				'lasthit_df' => $rowLock['lasthit_df']
181 181
 			));
182
-			if($modx->hasPermission('remove_locks')) {
183
-				$lockedByUser = '<a href="javascript:;" onclick="unlockElement(' . $lockElementType . ', ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource"><i class="' . $_style['icons_secured'] . '"></i></a>';
182
+			if ($modx->hasPermission('remove_locks')) {
183
+				$lockedByUser = '<a href="javascript:;" onclick="unlockElement('.$lockElementType.', '.$row['id'].', this);return false;" title="'.$title.'" class="lockedResource"><i class="'.$_style['icons_secured'].'"></i></a>';
184 184
 			} else {
185
-				$lockedByUser = '<span title="' . $title . '" class="lockedResource" style="cursor:context-menu;"><i class="' . $_style['icons_secured'] . '"></i></span>';
185
+				$lockedByUser = '<span title="'.$title.'" class="lockedResource" style="cursor:context-menu;"><i class="'.$_style['icons_secured'].'"></i></span>';
186 186
 			}
187 187
 		}
188 188
 	}
189
-	if($lockedByUser) {
190
-		$lockedByUser = '<div class="lockCell">' . $lockedByUser . '</div>';
189
+	if ($lockedByUser) {
190
+		$lockedByUser = '<div class="lockCell">'.$lockedByUser.'</div>';
191 191
 	}
192 192
 
193 193
 	// Caption
194
-	if($resourceTable == 'site_tmplvars') {
195
-		$caption = !empty($row['description']) ? ' ' . $row['caption'] . ' &nbsp; <small>(' . $row['description'] . ')</small>' : ' ' . $row['caption'];
194
+	if ($resourceTable == 'site_tmplvars') {
195
+		$caption = !empty($row['description']) ? ' '.$row['caption'].' &nbsp; <small>('.$row['description'].')</small>' : ' '.$row['caption'];
196 196
 	} else {
197
-		$caption = !empty($row['description']) ? ' ' . $row['description'] : '';
197
+		$caption = !empty($row['description']) ? ' '.$row['description'] : '';
198 198
 	}
199 199
 
200 200
 	// Special marks
201 201
 	$tplInfo = array();
202
-	if($row['locked']) {
202
+	if ($row['locked']) {
203 203
 		$tplInfo[] = $_lang['locked'];
204 204
 	}
205
-	if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') {
205
+	if ($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') {
206 206
 		$tplInfo[] = $_lang['defaulttemplate_title'];
207 207
 	}
208
-	$marks = !empty($tplInfo) ? ' <em>(' . join(', ', $tplInfo) . ')</em>' : '';
208
+	$marks = !empty($tplInfo) ? ' <em>('.join(', ', $tplInfo).')</em>' : '';
209 209
 
210 210
 	/* row buttons */
211 211
 	$buttons = '';
212
-	if($modx->hasPermission($types['actions']['edit'][1])) {
213
-		$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>';
212
+	if ($modx->hasPermission($types['actions']['edit'][1])) {
213
+		$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 214
 	}
215
-	if($modx->hasPermission($types['actions']['duplicate'][1])) {
216
-		$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>';
215
+	if ($modx->hasPermission($types['actions']['duplicate'][1])) {
216
+		$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 217
 	}
218
-	if($modx->hasPermission($types['actions']['remove'][1])) {
219
-		$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>';
218
+	if ($modx->hasPermission($types['actions']['remove'][1])) {
219
+		$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 220
 	}
221
-	$buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">' . $buttons . '</ul></div>' : '';
221
+	$buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">'.$buttons.'</ul></div>' : '';
222 222
 
223 223
 	$catid = $row['catid'] ? $row['catid'] : 0;
224 224
 
225 225
 	// Placeholders for elements-row
226 226
 	return array(
227
-		'class' => $class ? ' class="' . $class . '"' : '',
227
+		'class' => $class ? ' class="'.$class.'"' : '',
228 228
 		'lockedByUser' => $lockedByUser,
229 229
 		'name' => $row['name'],
230 230
 		'caption' => $caption,
Please login to merge, or discard this 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 3 patches
Indentation   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -4,123 +4,123 @@
 block discarded – undo
4 4
 }
5 5
 
6 6
 class mgrResources {
7
-	var $types = array();
8
-	var $items = array();
9
-	var $categories = array();
10
-	var $itemsPerCategory = array();
11
-
12
-	function __construct() {
13
-		$this->setTypes();
14
-		$this->queryItemsFromDB();
15
-		$this->prepareCategoryArrays();
16
-	}
17
-
18
-	function setTypes() {
19
-		global $_lang;
20
-		$this->types['site_templates']    = array(
21
-			'title'=>$_lang["manage_templates"],
22
-			'actions'=>array( 'edit'=>array(16,'edit_template'), 'duplicate'=>array(96,'new_template'), 'remove'=>array(21,'delete_template') ),
23
-			'permissions'=>array('new_template','edit_template'),
24
-			'name'=>'templatename'
25
-		);
26
-		$this->types['site_tmplvars']     = array(
27
-			'title'=>$_lang["tmplvars"],
28
-			'actions'=>array('edit'=>array(301,'edit_template'), 'duplicate'=>array(304,'edit_template'), 'remove'=>array(303,'edit_template')),
29
-			'permissions'=>array('new_template','edit_template'),
30
-		);
31
-		$this->types['site_htmlsnippets'] = array(
32
-			'title'=>$_lang["manage_htmlsnippets"],
33
-			'actions'=>array('edit'=>array(78,'edit_chunk'), 'duplicate'=>array(97,'new_chunk'), 'remove'=>array(80,'delete_chunk')),
34
-			'permissions'=>array('new_chunk','edit_chunk'),
35
-		);
36
-		$this->types['site_snippets']     = array(
37
-			'title'=>$_lang["manage_snippets"],
38
-			'actions'=>array('edit'=>array(22,'edit_snippet'), 'duplicate'=>array(98,'new_snippet'), 'remove'=>array(25,'delete_snippet')),
39
-			'permissions'=>array('new_snippet','edit_snippet'),
40
-		);
41
-		$this->types['site_plugins']      = array(
42
-			'title'=>$_lang["manage_plugins"],
43
-			'actions'=>array('edit'=>array(102,'edit_plugin'), 'duplicate'=>array(105,'new_plugin'), 'remove'=>array(104,'delete_plugin')),
44
-			'permissions'=>array('new_plugin','edit_plugin'),
45
-		);
46
-		$this->types['site_modules']      = array(
47
-			'title'=>$_lang["manage_modules"],
48
-			'actions'=>array('edit'=>array(108,'edit_module'), 'duplicate'=>array(111,'new_module'), 'remove'=>array(110,'delete_module')),
49
-			'permissions'=>array('new_module','edit_module'),
50
-		);
51
-	}
52
-
53
-	function queryItemsFromDB() {
54
-		foreach($this->types as $resourceTable=>$type) {
55
-			if($this->hasAnyPermissions($type['permissions'])) {
56
-				$nameField = isset($type['name']) ? $type['name'] : 'name';
57
-				$this->items[$resourceTable] = $this->queryResources($resourceTable, $nameField);
58
-		   }
59
-		 }
60
-	}
61
-
62
-	function hasAnyPermissions($permissions) {
63
-		global $modx;
64
-
65
-		foreach($permissions as $p)
66
-			if($modx->hasPermission($p)) return true;
67
-
68
-		return false;
69
-	}
70
-
71
-	function queryResources($resourceTable, $nameField = 'name') {
72
-		global $modx, $_lang;
73
-
74
-		$pluginsql = ($resourceTable == 'site_htmlsnippets' || $resourceTable == 'site_snippets' || $resourceTable == 'site_plugins' || $resourceTable == 'site_modules') ? $resourceTable . '.disabled, ' : '';
75
-
76
-		$tvsql  = '';
77
-		$tvjoin = '';
78
-		if ($resourceTable == 'site_tmplvars') {
79
-			$tvsql    = 'site_tmplvars.caption, ';
80
-			$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
-			$sttfield = 'IF(stt.templateid,1,0) AS reltpl,';
82
-		}
83
-		else $sttfield = '';
84
-
85
-		$selectableTemplates = $resourceTable == 'site_templates' ? "{$resourceTable}.selectable, " : "";
86
-
87
-		$rs = $modx->db->select(
88
-			"{$sttfield} {$pluginsql} {$tvsql} {$resourceTable}.{$nameField} as name, {$resourceTable}.id, {$resourceTable}.description, {$resourceTable}.locked, {$selectableTemplates}IF(isnull(categories.category),'{$_lang['no_category']}',categories.category) as category, categories.id as catid",
89
-			$modx->getFullTableName($resourceTable) . " AS {$resourceTable}
7
+    var $types = array();
8
+    var $items = array();
9
+    var $categories = array();
10
+    var $itemsPerCategory = array();
11
+
12
+    function __construct() {
13
+        $this->setTypes();
14
+        $this->queryItemsFromDB();
15
+        $this->prepareCategoryArrays();
16
+    }
17
+
18
+    function setTypes() {
19
+        global $_lang;
20
+        $this->types['site_templates']    = array(
21
+            'title'=>$_lang["manage_templates"],
22
+            'actions'=>array( 'edit'=>array(16,'edit_template'), 'duplicate'=>array(96,'new_template'), 'remove'=>array(21,'delete_template') ),
23
+            'permissions'=>array('new_template','edit_template'),
24
+            'name'=>'templatename'
25
+        );
26
+        $this->types['site_tmplvars']     = array(
27
+            'title'=>$_lang["tmplvars"],
28
+            'actions'=>array('edit'=>array(301,'edit_template'), 'duplicate'=>array(304,'edit_template'), 'remove'=>array(303,'edit_template')),
29
+            'permissions'=>array('new_template','edit_template'),
30
+        );
31
+        $this->types['site_htmlsnippets'] = array(
32
+            'title'=>$_lang["manage_htmlsnippets"],
33
+            'actions'=>array('edit'=>array(78,'edit_chunk'), 'duplicate'=>array(97,'new_chunk'), 'remove'=>array(80,'delete_chunk')),
34
+            'permissions'=>array('new_chunk','edit_chunk'),
35
+        );
36
+        $this->types['site_snippets']     = array(
37
+            'title'=>$_lang["manage_snippets"],
38
+            'actions'=>array('edit'=>array(22,'edit_snippet'), 'duplicate'=>array(98,'new_snippet'), 'remove'=>array(25,'delete_snippet')),
39
+            'permissions'=>array('new_snippet','edit_snippet'),
40
+        );
41
+        $this->types['site_plugins']      = array(
42
+            'title'=>$_lang["manage_plugins"],
43
+            'actions'=>array('edit'=>array(102,'edit_plugin'), 'duplicate'=>array(105,'new_plugin'), 'remove'=>array(104,'delete_plugin')),
44
+            'permissions'=>array('new_plugin','edit_plugin'),
45
+        );
46
+        $this->types['site_modules']      = array(
47
+            'title'=>$_lang["manage_modules"],
48
+            'actions'=>array('edit'=>array(108,'edit_module'), 'duplicate'=>array(111,'new_module'), 'remove'=>array(110,'delete_module')),
49
+            'permissions'=>array('new_module','edit_module'),
50
+        );
51
+    }
52
+
53
+    function queryItemsFromDB() {
54
+        foreach($this->types as $resourceTable=>$type) {
55
+            if($this->hasAnyPermissions($type['permissions'])) {
56
+                $nameField = isset($type['name']) ? $type['name'] : 'name';
57
+                $this->items[$resourceTable] = $this->queryResources($resourceTable, $nameField);
58
+            }
59
+            }
60
+    }
61
+
62
+    function hasAnyPermissions($permissions) {
63
+        global $modx;
64
+
65
+        foreach($permissions as $p)
66
+            if($modx->hasPermission($p)) return true;
67
+
68
+        return false;
69
+    }
70
+
71
+    function queryResources($resourceTable, $nameField = 'name') {
72
+        global $modx, $_lang;
73
+
74
+        $pluginsql = ($resourceTable == 'site_htmlsnippets' || $resourceTable == 'site_snippets' || $resourceTable == 'site_plugins' || $resourceTable == 'site_modules') ? $resourceTable . '.disabled, ' : '';
75
+
76
+        $tvsql  = '';
77
+        $tvjoin = '';
78
+        if ($resourceTable == 'site_tmplvars') {
79
+            $tvsql    = 'site_tmplvars.caption, ';
80
+            $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
+            $sttfield = 'IF(stt.templateid,1,0) AS reltpl,';
82
+        }
83
+        else $sttfield = '';
84
+
85
+        $selectableTemplates = $resourceTable == 'site_templates' ? "{$resourceTable}.selectable, " : "";
86
+
87
+        $rs = $modx->db->select(
88
+            "{$sttfield} {$pluginsql} {$tvsql} {$resourceTable}.{$nameField} as name, {$resourceTable}.id, {$resourceTable}.description, {$resourceTable}.locked, {$selectableTemplates}IF(isnull(categories.category),'{$_lang['no_category']}',categories.category) as category, categories.id as catid",
89
+            $modx->getFullTableName($resourceTable) . " AS {$resourceTable}
90 90
 	            LEFT JOIN " . $modx->getFullTableName('categories') . " AS categories ON {$resourceTable}.category = categories.id {$tvjoin}",
91
-			"",
92
-			"category,name"
93
-		);
94
-		$limit = $modx->db->getRecordCount($rs);
95
-
96
-		if($limit < 1) return false;
97
-
98
-		$result = array();
99
-		while ($row = $modx->db->getRow($rs)) {
100
-			$result[] = $row;
101
-		}
102
-		return $result;
103
-	}
104
-
105
-	function prepareCategoryArrays() {
106
-		foreach($this->items as $type=>$items) {
107
-			foreach((array)$items as $item) {
108
-				$catid = $item['catid'] ? $item['catid'] : 0;
109
-				$this->categories[$catid] = $item['category'];
110
-
111
-				$item['type'] = $type;
112
-				$this->itemsPerCategory[$catid][] = $item;
113
-			}
114
-		}
115
-
116
-		// Sort categories by name
117
-		natcasesort($this->categories);
118
-
119
-		// Now sort by name
120
-		foreach($this->itemsPerCategory as $catid=>$items) {
121
-			usort($this->itemsPerCategory[$catid], function ($a, $b) {
122
-				return strcasecmp($a['name'], $b['name']);
123
-			});
124
-		}
125
-	}
91
+            "",
92
+            "category,name"
93
+        );
94
+        $limit = $modx->db->getRecordCount($rs);
95
+
96
+        if($limit < 1) return false;
97
+
98
+        $result = array();
99
+        while ($row = $modx->db->getRow($rs)) {
100
+            $result[] = $row;
101
+        }
102
+        return $result;
103
+    }
104
+
105
+    function prepareCategoryArrays() {
106
+        foreach($this->items as $type=>$items) {
107
+            foreach((array)$items as $item) {
108
+                $catid = $item['catid'] ? $item['catid'] : 0;
109
+                $this->categories[$catid] = $item['category'];
110
+
111
+                $item['type'] = $type;
112
+                $this->itemsPerCategory[$catid][] = $item;
113
+            }
114
+        }
115
+
116
+        // Sort categories by name
117
+        natcasesort($this->categories);
118
+
119
+        // Now sort by name
120
+        foreach($this->itemsPerCategory as $catid=>$items) {
121
+            usort($this->itemsPerCategory[$catid], function ($a, $b) {
122
+                return strcasecmp($a['name'], $b['name']);
123
+            });
124
+        }
125
+    }
126 126
 }
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -1,77 +1,77 @@  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
 
6
-class mgrResources {
6
+class mgrResources{
7 7
 	var $types = array();
8 8
 	var $items = array();
9 9
 	var $categories = array();
10 10
 	var $itemsPerCategory = array();
11 11
 
12
-	function __construct() {
12
+	function __construct(){
13 13
 		$this->setTypes();
14 14
 		$this->queryItemsFromDB();
15 15
 		$this->prepareCategoryArrays();
16 16
 	}
17 17
 
18
-	function setTypes() {
18
+	function setTypes(){
19 19
 		global $_lang;
20
-		$this->types['site_templates']    = array(
20
+		$this->types['site_templates'] = array(
21 21
 			'title'=>$_lang["manage_templates"],
22
-			'actions'=>array( 'edit'=>array(16,'edit_template'), 'duplicate'=>array(96,'new_template'), 'remove'=>array(21,'delete_template') ),
23
-			'permissions'=>array('new_template','edit_template'),
22
+			'actions'=>array('edit'=>array(16, 'edit_template'), 'duplicate'=>array(96, 'new_template'), 'remove'=>array(21, 'delete_template')),
23
+			'permissions'=>array('new_template', 'edit_template'),
24 24
 			'name'=>'templatename'
25 25
 		);
26
-		$this->types['site_tmplvars']     = array(
26
+		$this->types['site_tmplvars'] = array(
27 27
 			'title'=>$_lang["tmplvars"],
28
-			'actions'=>array('edit'=>array(301,'edit_template'), 'duplicate'=>array(304,'edit_template'), 'remove'=>array(303,'edit_template')),
29
-			'permissions'=>array('new_template','edit_template'),
28
+			'actions'=>array('edit'=>array(301, 'edit_template'), 'duplicate'=>array(304, 'edit_template'), 'remove'=>array(303, 'edit_template')),
29
+			'permissions'=>array('new_template', 'edit_template'),
30 30
 		);
31 31
 		$this->types['site_htmlsnippets'] = array(
32 32
 			'title'=>$_lang["manage_htmlsnippets"],
33
-			'actions'=>array('edit'=>array(78,'edit_chunk'), 'duplicate'=>array(97,'new_chunk'), 'remove'=>array(80,'delete_chunk')),
34
-			'permissions'=>array('new_chunk','edit_chunk'),
33
+			'actions'=>array('edit'=>array(78, 'edit_chunk'), 'duplicate'=>array(97, 'new_chunk'), 'remove'=>array(80, 'delete_chunk')),
34
+			'permissions'=>array('new_chunk', 'edit_chunk'),
35 35
 		);
36
-		$this->types['site_snippets']     = array(
36
+		$this->types['site_snippets'] = array(
37 37
 			'title'=>$_lang["manage_snippets"],
38
-			'actions'=>array('edit'=>array(22,'edit_snippet'), 'duplicate'=>array(98,'new_snippet'), 'remove'=>array(25,'delete_snippet')),
39
-			'permissions'=>array('new_snippet','edit_snippet'),
38
+			'actions'=>array('edit'=>array(22, 'edit_snippet'), 'duplicate'=>array(98, 'new_snippet'), 'remove'=>array(25, 'delete_snippet')),
39
+			'permissions'=>array('new_snippet', 'edit_snippet'),
40 40
 		);
41
-		$this->types['site_plugins']      = array(
41
+		$this->types['site_plugins'] = array(
42 42
 			'title'=>$_lang["manage_plugins"],
43
-			'actions'=>array('edit'=>array(102,'edit_plugin'), 'duplicate'=>array(105,'new_plugin'), 'remove'=>array(104,'delete_plugin')),
44
-			'permissions'=>array('new_plugin','edit_plugin'),
43
+			'actions'=>array('edit'=>array(102, 'edit_plugin'), 'duplicate'=>array(105, 'new_plugin'), 'remove'=>array(104, 'delete_plugin')),
44
+			'permissions'=>array('new_plugin', 'edit_plugin'),
45 45
 		);
46
-		$this->types['site_modules']      = array(
46
+		$this->types['site_modules'] = array(
47 47
 			'title'=>$_lang["manage_modules"],
48
-			'actions'=>array('edit'=>array(108,'edit_module'), 'duplicate'=>array(111,'new_module'), 'remove'=>array(110,'delete_module')),
49
-			'permissions'=>array('new_module','edit_module'),
48
+			'actions'=>array('edit'=>array(108, 'edit_module'), 'duplicate'=>array(111, 'new_module'), 'remove'=>array(110, 'delete_module')),
49
+			'permissions'=>array('new_module', 'edit_module'),
50 50
 		);
51 51
 	}
52 52
 
53
-	function queryItemsFromDB() {
54
-		foreach($this->types as $resourceTable=>$type) {
55
-			if($this->hasAnyPermissions($type['permissions'])) {
53
+	function queryItemsFromDB(){
54
+		foreach ($this->types as $resourceTable=>$type) {
55
+			if ($this->hasAnyPermissions($type['permissions'])) {
56 56
 				$nameField = isset($type['name']) ? $type['name'] : 'name';
57 57
 				$this->items[$resourceTable] = $this->queryResources($resourceTable, $nameField);
58 58
 		   }
59 59
 		 }
60 60
 	}
61 61
 
62
-	function hasAnyPermissions($permissions) {
62
+	function hasAnyPermissions($permissions){
63 63
 		global $modx;
64 64
 
65
-		foreach($permissions as $p)
66
-			if($modx->hasPermission($p)) return true;
65
+		foreach ($permissions as $p)
66
+			if ($modx->hasPermission($p)) return true;
67 67
 
68 68
 		return false;
69 69
 	}
70 70
 
71
-	function queryResources($resourceTable, $nameField = 'name') {
71
+	function queryResources($resourceTable, $nameField = 'name'){
72 72
 		global $modx, $_lang;
73 73
 
74
-		$pluginsql = ($resourceTable == 'site_htmlsnippets' || $resourceTable == 'site_snippets' || $resourceTable == 'site_plugins' || $resourceTable == 'site_modules') ? $resourceTable . '.disabled, ' : '';
74
+		$pluginsql = ($resourceTable == 'site_htmlsnippets' || $resourceTable == 'site_snippets' || $resourceTable == 'site_plugins' || $resourceTable == 'site_modules') ? $resourceTable.'.disabled, ' : '';
75 75
 
76 76
 		$tvsql  = '';
77 77
 		$tvjoin = '';
@@ -86,14 +86,14 @@  discard block
 block discarded – undo
86 86
 
87 87
 		$rs = $modx->db->select(
88 88
 			"{$sttfield} {$pluginsql} {$tvsql} {$resourceTable}.{$nameField} as name, {$resourceTable}.id, {$resourceTable}.description, {$resourceTable}.locked, {$selectableTemplates}IF(isnull(categories.category),'{$_lang['no_category']}',categories.category) as category, categories.id as catid",
89
-			$modx->getFullTableName($resourceTable) . " AS {$resourceTable}
90
-	            LEFT JOIN " . $modx->getFullTableName('categories') . " AS categories ON {$resourceTable}.category = categories.id {$tvjoin}",
89
+			$modx->getFullTableName($resourceTable)." AS {$resourceTable}
90
+	            LEFT JOIN ".$modx->getFullTableName('categories')." AS categories ON {$resourceTable}.category = categories.id {$tvjoin}",
91 91
 			"",
92 92
 			"category,name"
93 93
 		);
94 94
 		$limit = $modx->db->getRecordCount($rs);
95 95
 
96
-		if($limit < 1) return false;
96
+		if ($limit < 1) return false;
97 97
 
98 98
 		$result = array();
99 99
 		while ($row = $modx->db->getRow($rs)) {
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
 		return $result;
103 103
 	}
104 104
 
105
-	function prepareCategoryArrays() {
106
-		foreach($this->items as $type=>$items) {
107
-			foreach((array)$items as $item) {
105
+	function prepareCategoryArrays(){
106
+		foreach ($this->items as $type=>$items) {
107
+			foreach ((array) $items as $item) {
108 108
 				$catid = $item['catid'] ? $item['catid'] : 0;
109 109
 				$this->categories[$catid] = $item['category'];
110 110
 
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
 		natcasesort($this->categories);
118 118
 
119 119
 		// Now sort by name
120
-		foreach($this->itemsPerCategory as $catid=>$items) {
121
-			usort($this->itemsPerCategory[$catid], function ($a, $b) {
120
+		foreach ($this->itemsPerCategory as $catid=>$items) {
121
+			usort($this->itemsPerCategory[$catid], function($a, $b){
122 122
 				return strcasecmp($a['name'], $b['name']);
123 123
 			});
124 124
 		}
Please login to merge, or discard this 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/resources/tab1_templates.inc.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <!-- Templates -->
2 2
 <?php
3
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
4 4
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
5 5
 }
6 6
 
Please login to merge, or discard this patch.
manager/actions/resources/tab5_plugins.inc.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <!-- plugins -->
2 2
 <?php
3
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
4 4
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
5 5
 }
6 6
 
Please login to merge, or discard this patch.
manager/actions/move_document.dynamic.php 1 patch
Spacing   +4 added lines, -4 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
 if (!$modx->hasPermission('save_document')) {
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 }
14 14
 
15 15
 // check permissions on the document
16
-include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php";
16
+include_once MODX_MANAGER_PATH."processors/user_documents_permissions.class.php";
17 17
 $udperms = new udperms();
18 18
 $udperms->user = $modx->getLoginUserID();
19 19
 $udperms->document = $id;
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
     },
40 40
     cancel: function() {
41 41
       documentDirty = false;
42
-        <?= ($id == 0 ? 'document.location.href="index.php?a=2";' : 'document.location.href="index.php?a=3&id=' . $id . '";') ?>
42
+        <?= ($id == 0 ? 'document.location.href="index.php?a=2";' : 'document.location.href="index.php?a=3&id='.$id.'";') ?>
43 43
     }
44 44
   };
45 45
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 </script>
81 81
 
82 82
 <h1>
83
-    <i class="fa fa-arrows"></i><?= ($pagetitle ? $pagetitle . '<small>(' . $id . ')</small>' : $_lang['move_resource_title']) ?>
83
+    <i class="fa fa-arrows"></i><?= ($pagetitle ? $pagetitle.'<small>('.$id.')</small>' : $_lang['move_resource_title']) ?>
84 84
 </h1>
85 85
 
86 86
 <?= $_style['actionbuttons']['dynamic']['save'] ?>
Please login to merge, or discard this patch.
manager/actions/web_access_permissions.dynamic.php 2 patches
Indentation   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -1,32 +1,32 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3
-	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
3
+    die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 if(!$modx->hasPermission('web_access_permissions')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 // find all document groups, for the select :)
10 10
 $rs = $modx->db->select('*', $modx->getFullTableName('documentgroup_names'), '', 'name');
11 11
 if($modx->db->getRecordCount($rs) < 1) {
12
-	$docgroupselector = "[no groups to add]";
12
+    $docgroupselector = "[no groups to add]";
13 13
 } else {
14
-	$docgroupselector = '<select name="docgroup">' . "\n";
15
-	while($row = $modx->db->getRow($rs)) {
16
-		$docgroupselector .= "\t" . '<option value="' . $row['id'] . '">' . $row['name'] . "</option>\n";
17
-	}
18
-	$docgroupselector .= "</select>\n";
14
+    $docgroupselector = '<select name="docgroup">' . "\n";
15
+    while($row = $modx->db->getRow($rs)) {
16
+        $docgroupselector .= "\t" . '<option value="' . $row['id'] . '">' . $row['name'] . "</option>\n";
17
+    }
18
+    $docgroupselector .= "</select>\n";
19 19
 }
20 20
 
21 21
 $rs = $modx->db->select('*', $modx->getFullTableName('webgroup_names'), '', 'name');
22 22
 if($modx->db->getRecordCount($rs) < 1) {
23
-	$usrgroupselector = '[no user groups]';
23
+    $usrgroupselector = '[no user groups]';
24 24
 } else {
25
-	$usrgroupselector = '<select name="usergroup">' . "\n";
26
-	while($row = $modx->db->getRow($rs)) {
27
-		$usrgroupselector .= "\t" . '<option value="' . $row['id'] . '">' . $row['name'] . "</option>\n";
28
-	}
29
-	$usrgroupselector .= "</select>\n";
25
+    $usrgroupselector = '<select name="usergroup">' . "\n";
26
+    while($row = $modx->db->getRow($rs)) {
27
+        $usrgroupselector .= "\t" . '<option value="' . $row['id'] . '">' . $row['name'] . "</option>\n";
28
+    }
29
+    $usrgroupselector .= "</select>\n";
30 30
 }
31 31
 
32 32
 ?>
@@ -88,24 +88,24 @@  discard block
 block discarded – undo
88 88
 				</form>
89 89
 			</div>
90 90
 			<?php
91
-			$rs = $modx->db->select('groupnames.*, users.id AS user_id, users.username user_name ', $modx->getFullTableName('webgroup_names') . " AS groupnames
91
+            $rs = $modx->db->select('groupnames.*, users.id AS user_id, users.username user_name ', $modx->getFullTableName('webgroup_names') . " AS groupnames
92 92
 			LEFT JOIN " . $modx->getFullTableName('web_groups') . " AS groups ON groups.webgroup = groupnames.id
93 93
 			LEFT JOIN " . $modx->getFullTableName('web_users') . " AS users ON users.id = groups.webuser", '', 'groupnames.name, user_name');
94
-			if($modx->db->getRecordCount($rs) < 1) {
95
-				?>
94
+            if($modx->db->getRecordCount($rs) < 1) {
95
+                ?>
96 96
 				<div class="text-danger"><?= $_lang['no_groups_found'] ?></div>
97 97
 				<?php
98
-			} else {
99
-			?>
98
+            } else {
99
+            ?>
100 100
 			<div class="form-group">
101 101
 				<?php
102
-				$pid = '';
103
-				while($row = $modx->db->getRow($rs)) {
104
-					if($pid != $row['id']) {
105
-						if($pid != '') {
106
-							echo '</div><div class="form-group">';
107
-						}
108
-						?>
102
+                $pid = '';
103
+                while($row = $modx->db->getRow($rs)) {
104
+                    if($pid != $row['id']) {
105
+                        if($pid != '') {
106
+                            echo '</div><div class="form-group">';
107
+                        }
108
+                        ?>
109 109
 						<form method="post" action="index.php" name="accesspermissions">
110 110
 							<input type="hidden" name="a" value="92" />
111 111
 							<input type="hidden" name="groupid" value="<?= $row['id'] ?>" />
@@ -120,21 +120,21 @@  discard block
 block discarded – undo
120 120
 						</form>
121 121
 						<?= $_lang['web_access_permissions_users_in_group'] ?>
122 122
 						<?php
123
-					}
124
-					if(!$row['user_id']) {
125
-						?>
123
+                    }
124
+                    if(!$row['user_id']) {
125
+                        ?>
126 126
 						<i><?= $_lang['access_permissions_no_users_in_group'] ?></i>
127 127
 						<?php
128
-						$pid = $row['id'];
129
-						continue;
130
-					}
131
-					?>
128
+                        $pid = $row['id'];
129
+                        continue;
130
+                    }
131
+                    ?>
132 132
 					<?= ($pid == $row['id'] ? ', ' : '') ?><a href="index.php?a=88&id=<?= $row['user_id'] ?>"><?= $row['user_name'] ?></a>
133 133
 					<?php
134
-					$pid = $row['id'];
135
-				}
136
-				}
137
-				?>
134
+                    $pid = $row['id'];
135
+                }
136
+                }
137
+                ?>
138 138
 			</div>
139 139
 		</div>
140 140
 	</div>
@@ -159,24 +159,24 @@  discard block
 block discarded – undo
159 159
 				</form>
160 160
 			</div>
161 161
 			<?php
162
-			$rs = $modx->db->select('dgnames.id, dgnames.name, sc.id AS doc_id, sc.pagetitle AS doc_title', $modx->getFullTableName('documentgroup_names') . " AS dgnames
162
+            $rs = $modx->db->select('dgnames.id, dgnames.name, sc.id AS doc_id, sc.pagetitle AS doc_title', $modx->getFullTableName('documentgroup_names') . " AS dgnames
163 163
 			LEFT JOIN " . $modx->getFullTableName('document_groups') . " AS dg ON dg.document_group = dgnames.id
164 164
 			LEFT JOIN " . $modx->getFullTableName('site_content') . " AS sc ON sc.id = dg.document", '', 'dgnames.name, sc.id');
165
-			if($modx->db->getRecordCount($rs) < 1) {
166
-				?>
165
+            if($modx->db->getRecordCount($rs) < 1) {
166
+                ?>
167 167
 				<div class="text-danger"><?= $_lang['no_groups_found'] ?></div>
168 168
 				<?php
169
-			} else {
170
-			?>
169
+            } else {
170
+            ?>
171 171
 			<div class="form-group">
172 172
 				<?php
173
-				$pid = '';
174
-				while($row = $modx->db->getRow($rs)) {
175
-					if($pid != $row['id']) {
176
-						if($pid != '') {
177
-							echo '</div><div class="form-group">';
178
-						}
179
-						?>
173
+                $pid = '';
174
+                while($row = $modx->db->getRow($rs)) {
175
+                    if($pid != $row['id']) {
176
+                        if($pid != '') {
177
+                            echo '</div><div class="form-group">';
178
+                        }
179
+                        ?>
180 180
 						<form method="post" action="index.php" name="accesspermissions">
181 181
 							<input type="hidden" name="a" value="92" />
182 182
 							<input type="hidden" name="groupid" value="<?= $row['id'] ?>" />
@@ -191,21 +191,21 @@  discard block
 block discarded – undo
191 191
 						</form>
192 192
 						<?= $_lang['access_permissions_resources_in_group'] ?>
193 193
 						<?php
194
-					}
195
-					if(!$row['doc_id']) {
196
-						?>
194
+                    }
195
+                    if(!$row['doc_id']) {
196
+                        ?>
197 197
 						<i><?= $_lang['access_permissions_no_resources_in_group'] ?></i>
198 198
 						<?php
199
-						$pid = $row['id'];
200
-						continue;
201
-					}
202
-					?>
199
+                        $pid = $row['id'];
200
+                        continue;
201
+                    }
202
+                    ?>
203 203
 					<?= ($pid == $row['id'] ? ', ' : '') ?><a href="index.php?a=3&id=<?= $row['doc_id'] ?>" title="<?= $modx->htmlspecialchars($row['doc_title']) ?>"><?= $row['doc_id'] ?></a>
204 204
 					<?php
205
-					$pid = $row['id'];
206
-				}
207
-				}
208
-				?>
205
+                    $pid = $row['id'];
206
+                }
207
+                }
208
+                ?>
209 209
 			</div>
210 210
 		</div>
211 211
 	</div>
@@ -217,15 +217,15 @@  discard block
 block discarded – undo
217 217
 		<div class="container container-body">
218 218
 			<p class="element-edit-message-tab alert alert-warning"><?= $_lang['access_permissions_links_tab'] ?></p>
219 219
 			<?php
220
-			$rs = $modx->db->select('groupnames.*, groupacc.id AS link_id, dgnames.id AS dg_id, dgnames.name AS dg_name', $modx->getFullTableName('webgroup_names') . " AS groupnames
220
+            $rs = $modx->db->select('groupnames.*, groupacc.id AS link_id, dgnames.id AS dg_id, dgnames.name AS dg_name', $modx->getFullTableName('webgroup_names') . " AS groupnames
221 221
 			LEFT JOIN " . $modx->getFullTableName('webgroup_access') . " AS groupacc ON groupacc.webgroup = groupnames.id
222 222
 			LEFT JOIN " . $modx->getFullTableName('documentgroup_names') . " AS dgnames ON dgnames.id = groupacc.documentgroup", '', 'name, dg_name');
223
-			if($modx->db->getRecordCount($rs) < 1) {
224
-				?>
223
+            if($modx->db->getRecordCount($rs) < 1) {
224
+                ?>
225 225
 				<div class="text-danger"><?= $_lang['no_groups_found'] ?></div>
226 226
 				<?php
227
-			} else {
228
-				?>
227
+            } else {
228
+                ?>
229 229
 				<div class="form-group">
230 230
 					<b><?= $_lang["access_permissions_group_link"] ?></b>
231 231
 					<form method="post" action="index.php" name="accesspermissions">
@@ -241,38 +241,38 @@  discard block
 block discarded – undo
241 241
 				<hr>
242 242
 				<ul>
243 243
 					<?php
244
-					$pid = '';
245
-					while($row = $modx->db->getRow($rs)) {
246
-						if($row['id'] != $pid) {
247
-							if($pid != '') {
248
-								echo '</ul></li>';
249
-							} // close previous one
250
-							?>
244
+                    $pid = '';
245
+                    while($row = $modx->db->getRow($rs)) {
246
+                        if($row['id'] != $pid) {
247
+                            if($pid != '') {
248
+                                echo '</ul></li>';
249
+                            } // close previous one
250
+                            ?>
251 251
 							<li><b><?= $row['name'] ?></b></li>
252 252
 							<?php
253
-							if(!$row['dg_id']) {
254
-								echo '<i>' . $_lang['no_groups_found'] . '</i></li>';
255
-								$pid = '';
256
-								continue;
257
-							} else {
258
-								echo '<ul>';
259
-							}
260
-						}
261
-						if(!$row['dg_id']) {
262
-							continue;
263
-						}
264
-						?>
253
+                            if(!$row['dg_id']) {
254
+                                echo '<i>' . $_lang['no_groups_found'] . '</i></li>';
255
+                                $pid = '';
256
+                                continue;
257
+                            } else {
258
+                                echo '<ul>';
259
+                            }
260
+                        }
261
+                        if(!$row['dg_id']) {
262
+                            continue;
263
+                        }
264
+                        ?>
265 265
 						<li><?= $row['dg_name'] ?>
266 266
 							<small><i>(<a class="text-danger" href="index.php?a=92&coupling=<?= $row['link_id'] ?>&operation=remove_document_group_from_user_group"><?= $_lang['remove'] ?></a>)</i></small>
267 267
 						</li>
268 268
 						<?php
269
-						$pid = $row['id'];
270
-					}
271
-					?>
269
+                        $pid = $row['id'];
270
+                    }
271
+                    ?>
272 272
 				</ul>
273 273
 				<?php
274
-			}
275
-			?>
274
+            }
275
+            ?>
276 276
 		</div>
277 277
 	</div>
278 278
 
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -1,30 +1,30 @@  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('web_access_permissions')) {
5
+if (!$modx->hasPermission('web_access_permissions')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 // find all document groups, for the select :)
10 10
 $rs = $modx->db->select('*', $modx->getFullTableName('documentgroup_names'), '', 'name');
11
-if($modx->db->getRecordCount($rs) < 1) {
11
+if ($modx->db->getRecordCount($rs) < 1) {
12 12
 	$docgroupselector = "[no groups to add]";
13 13
 } else {
14
-	$docgroupselector = '<select name="docgroup">' . "\n";
15
-	while($row = $modx->db->getRow($rs)) {
16
-		$docgroupselector .= "\t" . '<option value="' . $row['id'] . '">' . $row['name'] . "</option>\n";
14
+	$docgroupselector = '<select name="docgroup">'."\n";
15
+	while ($row = $modx->db->getRow($rs)) {
16
+		$docgroupselector .= "\t".'<option value="'.$row['id'].'">'.$row['name']."</option>\n";
17 17
 	}
18 18
 	$docgroupselector .= "</select>\n";
19 19
 }
20 20
 
21 21
 $rs = $modx->db->select('*', $modx->getFullTableName('webgroup_names'), '', 'name');
22
-if($modx->db->getRecordCount($rs) < 1) {
22
+if ($modx->db->getRecordCount($rs) < 1) {
23 23
 	$usrgroupselector = '[no user groups]';
24 24
 } else {
25
-	$usrgroupselector = '<select name="usergroup">' . "\n";
26
-	while($row = $modx->db->getRow($rs)) {
27
-		$usrgroupselector .= "\t" . '<option value="' . $row['id'] . '">' . $row['name'] . "</option>\n";
25
+	$usrgroupselector = '<select name="usergroup">'."\n";
26
+	while ($row = $modx->db->getRow($rs)) {
27
+		$usrgroupselector .= "\t".'<option value="'.$row['id'].'">'.$row['name']."</option>\n";
28 28
 	}
29 29
 	$usrgroupselector .= "</select>\n";
30 30
 }
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	<div class="alert alert-info"><?= $_lang['access_permissions_introtext'] ?></div>
61 61
 </div>
62 62
 
63
-<div class="container"><?= ($use_udperms != 1 ? '<div class="alert alert-danger">' . $_lang['access_permissions_off'] . '</div>' : '') ?></div>
63
+<div class="container"><?= ($use_udperms != 1 ? '<div class="alert alert-danger">'.$_lang['access_permissions_off'].'</div>' : '') ?></div>
64 64
 
65 65
 
66 66
 <div class="tab-pane" id="wuapPane">
@@ -88,10 +88,10 @@  discard block
 block discarded – undo
88 88
 				</form>
89 89
 			</div>
90 90
 			<?php
91
-			$rs = $modx->db->select('groupnames.*, users.id AS user_id, users.username user_name ', $modx->getFullTableName('webgroup_names') . " AS groupnames
92
-			LEFT JOIN " . $modx->getFullTableName('web_groups') . " AS groups ON groups.webgroup = groupnames.id
93
-			LEFT JOIN " . $modx->getFullTableName('web_users') . " AS users ON users.id = groups.webuser", '', 'groupnames.name, user_name');
94
-			if($modx->db->getRecordCount($rs) < 1) {
91
+			$rs = $modx->db->select('groupnames.*, users.id AS user_id, users.username user_name ', $modx->getFullTableName('webgroup_names')." AS groupnames
92
+			LEFT JOIN " . $modx->getFullTableName('web_groups')." AS groups ON groups.webgroup = groupnames.id
93
+			LEFT JOIN " . $modx->getFullTableName('web_users')." AS users ON users.id = groups.webuser", '', 'groupnames.name, user_name');
94
+			if ($modx->db->getRecordCount($rs) < 1) {
95 95
 				?>
96 96
 				<div class="text-danger"><?= $_lang['no_groups_found'] ?></div>
97 97
 				<?php
@@ -100,9 +100,9 @@  discard block
 block discarded – undo
100 100
 			<div class="form-group">
101 101
 				<?php
102 102
 				$pid = '';
103
-				while($row = $modx->db->getRow($rs)) {
104
-					if($pid != $row['id']) {
105
-						if($pid != '') {
103
+				while ($row = $modx->db->getRow($rs)) {
104
+					if ($pid != $row['id']) {
105
+						if ($pid != '') {
106 106
 							echo '</div><div class="form-group">';
107 107
 						}
108 108
 						?>
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 						<?= $_lang['web_access_permissions_users_in_group'] ?>
122 122
 						<?php
123 123
 					}
124
-					if(!$row['user_id']) {
124
+					if (!$row['user_id']) {
125 125
 						?>
126 126
 						<i><?= $_lang['access_permissions_no_users_in_group'] ?></i>
127 127
 						<?php
@@ -159,10 +159,10 @@  discard block
 block discarded – undo
159 159
 				</form>
160 160
 			</div>
161 161
 			<?php
162
-			$rs = $modx->db->select('dgnames.id, dgnames.name, sc.id AS doc_id, sc.pagetitle AS doc_title', $modx->getFullTableName('documentgroup_names') . " AS dgnames
163
-			LEFT JOIN " . $modx->getFullTableName('document_groups') . " AS dg ON dg.document_group = dgnames.id
164
-			LEFT JOIN " . $modx->getFullTableName('site_content') . " AS sc ON sc.id = dg.document", '', 'dgnames.name, sc.id');
165
-			if($modx->db->getRecordCount($rs) < 1) {
162
+			$rs = $modx->db->select('dgnames.id, dgnames.name, sc.id AS doc_id, sc.pagetitle AS doc_title', $modx->getFullTableName('documentgroup_names')." AS dgnames
163
+			LEFT JOIN " . $modx->getFullTableName('document_groups')." AS dg ON dg.document_group = dgnames.id
164
+			LEFT JOIN " . $modx->getFullTableName('site_content')." AS sc ON sc.id = dg.document", '', 'dgnames.name, sc.id');
165
+			if ($modx->db->getRecordCount($rs) < 1) {
166 166
 				?>
167 167
 				<div class="text-danger"><?= $_lang['no_groups_found'] ?></div>
168 168
 				<?php
@@ -171,9 +171,9 @@  discard block
 block discarded – undo
171 171
 			<div class="form-group">
172 172
 				<?php
173 173
 				$pid = '';
174
-				while($row = $modx->db->getRow($rs)) {
175
-					if($pid != $row['id']) {
176
-						if($pid != '') {
174
+				while ($row = $modx->db->getRow($rs)) {
175
+					if ($pid != $row['id']) {
176
+						if ($pid != '') {
177 177
 							echo '</div><div class="form-group">';
178 178
 						}
179 179
 						?>
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 						<?= $_lang['access_permissions_resources_in_group'] ?>
193 193
 						<?php
194 194
 					}
195
-					if(!$row['doc_id']) {
195
+					if (!$row['doc_id']) {
196 196
 						?>
197 197
 						<i><?= $_lang['access_permissions_no_resources_in_group'] ?></i>
198 198
 						<?php
@@ -217,10 +217,10 @@  discard block
 block discarded – undo
217 217
 		<div class="container container-body">
218 218
 			<p class="element-edit-message-tab alert alert-warning"><?= $_lang['access_permissions_links_tab'] ?></p>
219 219
 			<?php
220
-			$rs = $modx->db->select('groupnames.*, groupacc.id AS link_id, dgnames.id AS dg_id, dgnames.name AS dg_name', $modx->getFullTableName('webgroup_names') . " AS groupnames
221
-			LEFT JOIN " . $modx->getFullTableName('webgroup_access') . " AS groupacc ON groupacc.webgroup = groupnames.id
222
-			LEFT JOIN " . $modx->getFullTableName('documentgroup_names') . " AS dgnames ON dgnames.id = groupacc.documentgroup", '', 'name, dg_name');
223
-			if($modx->db->getRecordCount($rs) < 1) {
220
+			$rs = $modx->db->select('groupnames.*, groupacc.id AS link_id, dgnames.id AS dg_id, dgnames.name AS dg_name', $modx->getFullTableName('webgroup_names')." AS groupnames
221
+			LEFT JOIN " . $modx->getFullTableName('webgroup_access')." AS groupacc ON groupacc.webgroup = groupnames.id
222
+			LEFT JOIN " . $modx->getFullTableName('documentgroup_names')." AS dgnames ON dgnames.id = groupacc.documentgroup", '', 'name, dg_name');
223
+			if ($modx->db->getRecordCount($rs) < 1) {
224 224
 				?>
225 225
 				<div class="text-danger"><?= $_lang['no_groups_found'] ?></div>
226 226
 				<?php
@@ -242,23 +242,23 @@  discard block
 block discarded – undo
242 242
 				<ul>
243 243
 					<?php
244 244
 					$pid = '';
245
-					while($row = $modx->db->getRow($rs)) {
246
-						if($row['id'] != $pid) {
247
-							if($pid != '') {
245
+					while ($row = $modx->db->getRow($rs)) {
246
+						if ($row['id'] != $pid) {
247
+							if ($pid != '') {
248 248
 								echo '</ul></li>';
249 249
 							} // close previous one
250 250
 							?>
251 251
 							<li><b><?= $row['name'] ?></b></li>
252 252
 							<?php
253
-							if(!$row['dg_id']) {
254
-								echo '<i>' . $_lang['no_groups_found'] . '</i></li>';
253
+							if (!$row['dg_id']) {
254
+								echo '<i>'.$_lang['no_groups_found'].'</i></li>';
255 255
 								$pid = '';
256 256
 								continue;
257 257
 							} else {
258 258
 								echo '<ul>';
259 259
 							}
260 260
 						}
261
-						if(!$row['dg_id']) {
261
+						if (!$row['dg_id']) {
262 262
 							continue;
263 263
 						}
264 264
 						?>
Please login to merge, or discard this patch.