Completed
Pull Request — develop (#740)
by Maxim
08:32
created
manager/actions/document_data.static.php 2 patches
Indentation   +151 added lines, -151 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  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
 
6 6
 if(isset($_REQUEST['id'])) {
7
-	$id = (int) $_REQUEST['id'];
7
+    $id = (int) $_REQUEST['id'];
8 8
 } else {
9
-	$id = 0;
9
+    $id = 0;
10 10
 }
11 11
 
12 12
 if(isset($_GET['opened'])) {
13
-	$_SESSION['openedArray'] = $_GET['opened'];
13
+    $_SESSION['openedArray'] = $_GET['opened'];
14 14
 }
15 15
 
16 16
 $url = $modx->config['site_url'];
@@ -23,17 +23,17 @@  discard block
 block discarded – undo
23 23
 
24 24
 // Get access permissions
25 25
 if($_SESSION['mgrDocgroups']) {
26
-	$docgrp = implode(",", $_SESSION['mgrDocgroups']);
26
+    $docgrp = implode(",", $_SESSION['mgrDocgroups']);
27 27
 }
28 28
 $access = "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0" . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
29 29
 
30 30
 //
31 31
 if($_SESSION['tree_show_only_folders']) {
32
-	$parent = $id ? ($modx->getDatabase()->getValue("SELECT parent FROM " . $tbl_site_content . " WHERE id=$id LIMIT 1")) : 0;
33
-	$isfolder = $modx->getDatabase()->getValue("SELECT isfolder FROM " . $tbl_site_content . " WHERE id=$id LIMIT 1");
34
-	if(!$isfolder && $parent != 0) {
35
-		$id = $_REQUEST['id'] = $parent;
36
-	}
32
+    $parent = $id ? ($modx->getDatabase()->getValue("SELECT parent FROM " . $tbl_site_content . " WHERE id=$id LIMIT 1")) : 0;
33
+    $isfolder = $modx->getDatabase()->getValue("SELECT isfolder FROM " . $tbl_site_content . " WHERE id=$id LIMIT 1");
34
+    if(!$isfolder && $parent != 0) {
35
+        $id = $_REQUEST['id'] = $parent;
36
+    }
37 37
 }
38 38
 
39 39
 // Get the document content
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 		LEFT JOIN {$tbl_document_groups} AS dg ON dg.document = sc.id", "sc.id ='{$id}' AND ({$access})");
42 42
 $content = $modx->getDatabase()->getRow($rs);
43 43
 if(!$content) {
44
-	$modx->webAlertAndQuit($_lang["access_permission_denied"]);
44
+    $modx->webAlertAndQuit($_lang["access_permission_denied"]);
45 45
 }
46 46
 
47 47
 /**
@@ -83,134 +83,134 @@  discard block
 block discarded – undo
83 83
 $filter_sort = '';
84 84
 $filter_dir = '';
85 85
 if($numRecords > 0) {
86
-	$filter_sort = '<select size="1" name="sort" class="form-control form-control-sm" onchange="document.location=\'index.php?a=3&id=' . $id . '&dir=' . $dir . '&sort=\'+this.options[this.selectedIndex].value">' . '<option value="createdon"' . (($sort == 'createdon') ? ' selected' : '') . '>' . $_lang['createdon'] . '</option>' . '<option value="pub_date"' . (($sort == 'pub_date') ? ' selected' : '') . '>' . $_lang["page_data_publishdate"] . '</option>' . '<option value="pagetitle"' . (($sort == 'pagetitle') ? ' selected' : '') . '>' . $_lang['pagetitle'] . '</option>' . '<option value="menuindex"' . (($sort == 'menuindex') ? ' selected' : '') . '>' . $_lang['resource_opt_menu_index'] . '</option>' . //********  resource_opt_is_published - //
87
-		'<option value="published"' . (($sort == 'published') ? ' selected' : '') . '>' . $_lang['resource_opt_is_published'] . '</option>' . //********//
88
-		'</select>';
89
-	$filter_dir = '<select size="1" name="dir" class="form-control form-control-sm" onchange="document.location=\'index.php?a=3&id=' . $id . '&sort=' . $sort . '&dir=\'+this.options[this.selectedIndex].value">' . '<option value="DESC"' . (($dir == 'DESC') ? ' selected' : '') . '>' . $_lang['sort_desc'] . '</option>' . '<option value="ASC"' . (($dir == 'ASC') ? ' selected' : '') . '>' . $_lang['sort_asc'] . '</option>' . '</select>';
90
-	$resource = $modx->getDatabase()->makeArray($rs);
91
-
92
-	// CSS style for table
93
-	//	$tableClass = 'grid';
94
-	//	$rowHeaderClass = 'gridHeader';
95
-	//	$rowRegularClass = 'gridItem';
96
-	//	$rowAlternateClass = 'gridAltItem';
97
-	$tableClass = 'table data nowrap';
98
-	$columnHeaderClass = array(
99
-		'text-center',
100
-		'text-left',
101
-		'text-center',
102
-		'text-center',
103
-		'text-center',
104
-		'text-center'
105
-	);
106
-
107
-
108
-	$modx->getMakeTable()->setTableClass($tableClass);
109
-	$modx->getMakeTable()->setColumnHeaderClass($columnHeaderClass);
110
-	//	$modx->getMakeTable()->setRowHeaderClass($rowHeaderClass);
111
-	//	$modx->getMakeTable()->setRowRegularClass($rowRegularClass);
112
-	//	$modx->getMakeTable()->setRowAlternateClass($rowAlternateClass);
113
-
114
-	// Table header
115
-	$listTableHeader = array(
116
-		'docid' => $_lang['id'],
117
-		'title' => $_lang['resource_title'],
118
-		'createdon' => $_lang['createdon'],
119
-		'pub_date' => $_lang['page_data_publishdate'],
120
-		'status' => $_lang['page_data_status'],
121
-		'edit' => $_lang['mgrlog_action'],
122
-	);
123
-	$tbWidth = array(
124
-		'1%',
125
-		'',
126
-		'1%',
127
-		'1%',
128
-		'1%',
129
-		'1%'
130
-	);
131
-	$modx->getMakeTable()->setColumnWidths($tbWidth);
132
-
133
-	$sd = isset($_REQUEST['dir']) ? '&amp;dir=' . $_REQUEST['dir'] : '&amp;dir=DESC';
134
-	$sb = isset($_REQUEST['sort']) ? '&amp;sort=' . $_REQUEST['sort'] : '&amp;sort=createdon';
135
-	$pg = isset($_REQUEST['page']) ? '&amp;page=' . (int) $_REQUEST['page'] : '';
136
-	$add_path = $sd . $sb . $pg;
137
-
138
-	$icons = array(
139
-		'text/html' => $_style['tree_page_html'],
140
-		'text/plain' => $_style['tree_page'],
141
-		'text/xml' => $_style['tree_page_xml'],
142
-		'text/css' => $_style['tree_page_css'],
143
-		'text/javascript' => $_style['tree_page_js'],
144
-		'application/rss+xml' => $_style['tree_page_rss'],
145
-		'application/pdf' => $_style['tree_page_pdf'],
146
-		'application/vnd.ms-word' => $_style['tree_page_word'],
147
-		'application/vnd.ms-excel' => $_style['tree_page_excel'],
148
-		'image/gif' => $_style['tree_page_gif'],
149
-		'image/jpg' => $_style['tree_page_jpg'],
150
-		'image/png' => $_style['tree_page_png']
151
-	);
152
-
153
-	$listDocs = array();
154
-	foreach($resource as $k => $children) {
155
-
156
-		switch($children['id']) {
157
-			case $modx->config['site_start']            :
158
-				$icon = $_style['tree_page_home'];
159
-				break;
160
-			case $modx->config['error_page']            :
161
-				$icon = $_style['tree_page_404'];
162
-				break;
163
-			case $modx->config['site_unavailable_page'] :
164
-				$icon = $_style['tree_page_hourglass'];
165
-				break;
166
-			case $modx->config['unauthorized_page']     :
167
-				$icon = $_style['tree_page_info'];
168
-				break;
169
-			default:
170
-				if($children['isfolder']) {
171
-					$icon = $_style['tree_folder_new'];
172
-				} else {
173
-					if(isset($icons[$children['contentType']])) {
174
-						$icon = $icons[$children['contentType']];
175
-					} else {
176
-						$icon = $_style['tree_page'];
177
-					}
178
-				}
179
-		}
180
-
181
-		$private = ($children['privateweb'] || $children['privatemgr'] ? ' private' : '');
182
-
183
-		// дописываем в заголовок класс для неопубликованных плюс по всем ссылкам обратный путь
184
-		// для сохранения сортировки
185
-		$class = ($children['deleted'] ? 'text-danger text-decoration-through' : (!$children['published'] ? ' font-italic text-muted' : ' publish'));
186
-		//$class .= ($children['hidemenu'] ? ' text-muted' : ' text-primary');
187
-		//$class .= ($children['isfolder'] ? ' font-weight-bold' : '');
188
-		if($modx->hasPermission('edit_document')) {
189
-			$title = '<span class="doc-item' . $private . '">' . $icon . '<a href="index.php?a=27&amp;id=' . $children['id'] . $add_path . '">' . '<span class="' . $class . '">' . $children['pagetitle'] . '</span></a></span>';
190
-		} else {
191
-			$title = '<span class="doc-item' . $private . '">' . $icon . '<span class="' . $class . '">' . $children['pagetitle'] . '</span></span>';
192
-		}
193
-
194
-		$icon_pub_unpub = (!$children['published']) ? '<a href="index.php?a=61&amp;id=' . $children['id'] . $add_path . '" title="' . $_lang["publish_resource"] . '"><i class="' . $_style["icons_publish_document"] . '"></i></a>' : '<a href="index.php?a=62&amp;id=' . $children['id'] . $add_path . '" title="' . $_lang["unpublish_resource"] . '"><i class="' . $_style["icons_unpublish_resource"] . '" ></i></a>';
195
-
196
-		$icon_del_undel = (!$children['deleted']) ? '<a onclick="return confirm(\'' . $_lang["confirm_delete_resource"] . '\')" href="index.php?a=6&amp;id=' . $children['id'] . $add_path . '" title="' . $_lang['delete_resource'] . '"><i class="' . $_style["icons_delete_resource"] . '"></i></a>' : '<a onclick="return confirm(\'' . $_lang["confirm_undelete"] . '\')" href="index.php?a=63&amp;id=' . $children['id'] . $add_path . '" title="' . $_lang['undelete_resource'] . '"><i class="' . $_style["icons_undelete_resource"] . '"></i></a>';
197
-
198
-		$listDocs[] = array(
199
-			'docid' => '<div class="text-right">' . $children['id'] . '</div>',
200
-			'title' => $title,
201
-			'createdon' => '<div class="text-right">' . ($modx->toDateFormat($children['createdon'] + $server_offset_time, 'dateOnly')) . '</div>',
202
-			'pub_date' => '<div class="text-right">' . ($children['pub_date'] ? ($modx->toDateFormat($children['pub_date'] + $server_offset_time, 'dateOnly')) : '') . '</div>',
203
-			'status' => '<div class="text-nowrap">' . ($children['published'] == 0 ? '<span class="unpublishedDoc">' . $_lang['page_data_unpublished'] . '</span>' : '<span class="publishedDoc">' . $_lang['page_data_published'] . '</span>') . '</div>',
204
-			'edit' => '<div class="actions text-center text-nowrap">' . ($modx->hasPermission('edit_document') ? '<a href="index.php?a=27&amp;id=' . $children['id'] . $add_path . '" title="' . $_lang['edit'] . '"><i class="' . $_style["icons_edit_resource"] . '"></i></a><a href="index.php?a=51&amp;id=' . $children['id'] . $add_path . '" title="' . $_lang['move'] . '"><i 
86
+    $filter_sort = '<select size="1" name="sort" class="form-control form-control-sm" onchange="document.location=\'index.php?a=3&id=' . $id . '&dir=' . $dir . '&sort=\'+this.options[this.selectedIndex].value">' . '<option value="createdon"' . (($sort == 'createdon') ? ' selected' : '') . '>' . $_lang['createdon'] . '</option>' . '<option value="pub_date"' . (($sort == 'pub_date') ? ' selected' : '') . '>' . $_lang["page_data_publishdate"] . '</option>' . '<option value="pagetitle"' . (($sort == 'pagetitle') ? ' selected' : '') . '>' . $_lang['pagetitle'] . '</option>' . '<option value="menuindex"' . (($sort == 'menuindex') ? ' selected' : '') . '>' . $_lang['resource_opt_menu_index'] . '</option>' . //********  resource_opt_is_published - //
87
+        '<option value="published"' . (($sort == 'published') ? ' selected' : '') . '>' . $_lang['resource_opt_is_published'] . '</option>' . //********//
88
+        '</select>';
89
+    $filter_dir = '<select size="1" name="dir" class="form-control form-control-sm" onchange="document.location=\'index.php?a=3&id=' . $id . '&sort=' . $sort . '&dir=\'+this.options[this.selectedIndex].value">' . '<option value="DESC"' . (($dir == 'DESC') ? ' selected' : '') . '>' . $_lang['sort_desc'] . '</option>' . '<option value="ASC"' . (($dir == 'ASC') ? ' selected' : '') . '>' . $_lang['sort_asc'] . '</option>' . '</select>';
90
+    $resource = $modx->getDatabase()->makeArray($rs);
91
+
92
+    // CSS style for table
93
+    //	$tableClass = 'grid';
94
+    //	$rowHeaderClass = 'gridHeader';
95
+    //	$rowRegularClass = 'gridItem';
96
+    //	$rowAlternateClass = 'gridAltItem';
97
+    $tableClass = 'table data nowrap';
98
+    $columnHeaderClass = array(
99
+        'text-center',
100
+        'text-left',
101
+        'text-center',
102
+        'text-center',
103
+        'text-center',
104
+        'text-center'
105
+    );
106
+
107
+
108
+    $modx->getMakeTable()->setTableClass($tableClass);
109
+    $modx->getMakeTable()->setColumnHeaderClass($columnHeaderClass);
110
+    //	$modx->getMakeTable()->setRowHeaderClass($rowHeaderClass);
111
+    //	$modx->getMakeTable()->setRowRegularClass($rowRegularClass);
112
+    //	$modx->getMakeTable()->setRowAlternateClass($rowAlternateClass);
113
+
114
+    // Table header
115
+    $listTableHeader = array(
116
+        'docid' => $_lang['id'],
117
+        'title' => $_lang['resource_title'],
118
+        'createdon' => $_lang['createdon'],
119
+        'pub_date' => $_lang['page_data_publishdate'],
120
+        'status' => $_lang['page_data_status'],
121
+        'edit' => $_lang['mgrlog_action'],
122
+    );
123
+    $tbWidth = array(
124
+        '1%',
125
+        '',
126
+        '1%',
127
+        '1%',
128
+        '1%',
129
+        '1%'
130
+    );
131
+    $modx->getMakeTable()->setColumnWidths($tbWidth);
132
+
133
+    $sd = isset($_REQUEST['dir']) ? '&amp;dir=' . $_REQUEST['dir'] : '&amp;dir=DESC';
134
+    $sb = isset($_REQUEST['sort']) ? '&amp;sort=' . $_REQUEST['sort'] : '&amp;sort=createdon';
135
+    $pg = isset($_REQUEST['page']) ? '&amp;page=' . (int) $_REQUEST['page'] : '';
136
+    $add_path = $sd . $sb . $pg;
137
+
138
+    $icons = array(
139
+        'text/html' => $_style['tree_page_html'],
140
+        'text/plain' => $_style['tree_page'],
141
+        'text/xml' => $_style['tree_page_xml'],
142
+        'text/css' => $_style['tree_page_css'],
143
+        'text/javascript' => $_style['tree_page_js'],
144
+        'application/rss+xml' => $_style['tree_page_rss'],
145
+        'application/pdf' => $_style['tree_page_pdf'],
146
+        'application/vnd.ms-word' => $_style['tree_page_word'],
147
+        'application/vnd.ms-excel' => $_style['tree_page_excel'],
148
+        'image/gif' => $_style['tree_page_gif'],
149
+        'image/jpg' => $_style['tree_page_jpg'],
150
+        'image/png' => $_style['tree_page_png']
151
+    );
152
+
153
+    $listDocs = array();
154
+    foreach($resource as $k => $children) {
155
+
156
+        switch($children['id']) {
157
+            case $modx->config['site_start']            :
158
+                $icon = $_style['tree_page_home'];
159
+                break;
160
+            case $modx->config['error_page']            :
161
+                $icon = $_style['tree_page_404'];
162
+                break;
163
+            case $modx->config['site_unavailable_page'] :
164
+                $icon = $_style['tree_page_hourglass'];
165
+                break;
166
+            case $modx->config['unauthorized_page']     :
167
+                $icon = $_style['tree_page_info'];
168
+                break;
169
+            default:
170
+                if($children['isfolder']) {
171
+                    $icon = $_style['tree_folder_new'];
172
+                } else {
173
+                    if(isset($icons[$children['contentType']])) {
174
+                        $icon = $icons[$children['contentType']];
175
+                    } else {
176
+                        $icon = $_style['tree_page'];
177
+                    }
178
+                }
179
+        }
180
+
181
+        $private = ($children['privateweb'] || $children['privatemgr'] ? ' private' : '');
182
+
183
+        // дописываем в заголовок класс для неопубликованных плюс по всем ссылкам обратный путь
184
+        // для сохранения сортировки
185
+        $class = ($children['deleted'] ? 'text-danger text-decoration-through' : (!$children['published'] ? ' font-italic text-muted' : ' publish'));
186
+        //$class .= ($children['hidemenu'] ? ' text-muted' : ' text-primary');
187
+        //$class .= ($children['isfolder'] ? ' font-weight-bold' : '');
188
+        if($modx->hasPermission('edit_document')) {
189
+            $title = '<span class="doc-item' . $private . '">' . $icon . '<a href="index.php?a=27&amp;id=' . $children['id'] . $add_path . '">' . '<span class="' . $class . '">' . $children['pagetitle'] . '</span></a></span>';
190
+        } else {
191
+            $title = '<span class="doc-item' . $private . '">' . $icon . '<span class="' . $class . '">' . $children['pagetitle'] . '</span></span>';
192
+        }
193
+
194
+        $icon_pub_unpub = (!$children['published']) ? '<a href="index.php?a=61&amp;id=' . $children['id'] . $add_path . '" title="' . $_lang["publish_resource"] . '"><i class="' . $_style["icons_publish_document"] . '"></i></a>' : '<a href="index.php?a=62&amp;id=' . $children['id'] . $add_path . '" title="' . $_lang["unpublish_resource"] . '"><i class="' . $_style["icons_unpublish_resource"] . '" ></i></a>';
195
+
196
+        $icon_del_undel = (!$children['deleted']) ? '<a onclick="return confirm(\'' . $_lang["confirm_delete_resource"] . '\')" href="index.php?a=6&amp;id=' . $children['id'] . $add_path . '" title="' . $_lang['delete_resource'] . '"><i class="' . $_style["icons_delete_resource"] . '"></i></a>' : '<a onclick="return confirm(\'' . $_lang["confirm_undelete"] . '\')" href="index.php?a=63&amp;id=' . $children['id'] . $add_path . '" title="' . $_lang['undelete_resource'] . '"><i class="' . $_style["icons_undelete_resource"] . '"></i></a>';
197
+
198
+        $listDocs[] = array(
199
+            'docid' => '<div class="text-right">' . $children['id'] . '</div>',
200
+            'title' => $title,
201
+            'createdon' => '<div class="text-right">' . ($modx->toDateFormat($children['createdon'] + $server_offset_time, 'dateOnly')) . '</div>',
202
+            'pub_date' => '<div class="text-right">' . ($children['pub_date'] ? ($modx->toDateFormat($children['pub_date'] + $server_offset_time, 'dateOnly')) : '') . '</div>',
203
+            'status' => '<div class="text-nowrap">' . ($children['published'] == 0 ? '<span class="unpublishedDoc">' . $_lang['page_data_unpublished'] . '</span>' : '<span class="publishedDoc">' . $_lang['page_data_published'] . '</span>') . '</div>',
204
+            'edit' => '<div class="actions text-center text-nowrap">' . ($modx->hasPermission('edit_document') ? '<a href="index.php?a=27&amp;id=' . $children['id'] . $add_path . '" title="' . $_lang['edit'] . '"><i class="' . $_style["icons_edit_resource"] . '"></i></a><a href="index.php?a=51&amp;id=' . $children['id'] . $add_path . '" title="' . $_lang['move'] . '"><i 
205 205
 				class="' . $_style["icons_move_document"] . '"></i></a>' . $icon_pub_unpub : '') . ($modx->hasPermission('delete_document') ? $icon_del_undel : '') . '</div>'
206
-		);
207
-	}
206
+        );
207
+    }
208 208
 
209
-	$modx->getMakeTable()->createPagingNavigation($numRecords, 'a=3&id=' . $content['id'] . '&dir=' . $dir . '&sort=' . $sort);
210
-	$children_output = $modx->getMakeTable()->create($listDocs, $listTableHeader, 'index.php?a=3&amp;id=' . $content['id']);
209
+    $modx->getMakeTable()->createPagingNavigation($numRecords, 'a=3&id=' . $content['id'] . '&dir=' . $dir . '&sort=' . $sort);
210
+    $children_output = $modx->getMakeTable()->create($listDocs, $listTableHeader, 'index.php?a=3&amp;id=' . $content['id']);
211 211
 } else {
212
-	// No Child documents
213
-	$children_output = '<div class="container"><p>' . $_lang['resources_in_container_no'] . '</p></div>';
212
+    // No Child documents
213
+    $children_output = '<div class="container"><p>' . $_lang['resources_in_container_no'] . '</p></div>';
214 214
 }
215 215
 ?>
216 216
 	<script type="text/javascript">
@@ -411,20 +411,20 @@  discard block
 block discarded – undo
411 411
 				<h2 class="tab"><?= $_lang['page_data_source'] ?></h2>
412 412
 				<script type="text/javascript">docSettings.addTabPage(document.getElementById("tabSource"));</script>
413 413
 				<?php
414
-				$buffer = "";
415
-				$filename = $modx->config['base_path'] . "assets/cache/docid_" . $id . ".pageCache.php";
416
-				$handle = @fopen($filename, "r");
417
-				if(!$handle) {
418
-					$buffer = '<div class="container container-body">' . $_lang['page_data_notcached'] . '</div>';
419
-				} else {
420
-					while(!feof($handle)) {
421
-						$buffer .= fgets($handle, 4096);
422
-					}
423
-					fclose($handle);
424
-					$buffer = '<div class="navbar navbar-editor">' . $_lang['page_data_cached'] . '</div><div class="section-editor clearfix"><textarea rows="20" wrap="soft">' . $modx->getPhpCompat()->htmlspecialchars($buffer) . "</textarea></div>\n";
425
-				}
426
-				echo $buffer;
427
-				?>
414
+                $buffer = "";
415
+                $filename = $modx->config['base_path'] . "assets/cache/docid_" . $id . ".pageCache.php";
416
+                $handle = @fopen($filename, "r");
417
+                if(!$handle) {
418
+                    $buffer = '<div class="container container-body">' . $_lang['page_data_notcached'] . '</div>';
419
+                } else {
420
+                    while(!feof($handle)) {
421
+                        $buffer .= fgets($handle, 4096);
422
+                    }
423
+                    fclose($handle);
424
+                    $buffer = '<div class="navbar navbar-editor">' . $_lang['page_data_cached'] . '</div><div class="section-editor clearfix"><textarea rows="20" wrap="soft">' . $modx->getPhpCompat()->htmlspecialchars($buffer) . "</textarea></div>\n";
425
+                }
426
+                echo $buffer;
427
+                ?>
428 428
 			</div><!-- end tab-page -->
429 429
 		<?php } ?>
430 430
 
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 
433 433
 <?php
434 434
 if(isset($_GET['tab']) && is_numeric($_GET['tab'])) {
435
-	echo '<script type="text/javascript"> docSettings.setSelectedIndex( ' . $_GET['tab'] . ' );</script>';
435
+    echo '<script type="text/javascript"> docSettings.setSelectedIndex( ' . $_GET['tab'] . ' );</script>';
436 436
 }
437 437
 ?>
438 438
 
Please login to merge, or discard this patch.
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -1,15 +1,15 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
 	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 
6
-if(isset($_REQUEST['id'])) {
6
+if (isset($_REQUEST['id'])) {
7 7
 	$id = (int) $_REQUEST['id'];
8 8
 } else {
9 9
 	$id = 0;
10 10
 }
11 11
 
12
-if(isset($_GET['opened'])) {
12
+if (isset($_GET['opened'])) {
13 13
 	$_SESSION['openedArray'] = $_GET['opened'];
14 14
 }
15 15
 
@@ -22,16 +22,16 @@  discard block
 block discarded – undo
22 22
 $tbl_site_templates = $modx->getDatabase()->getFullTableName('site_templates');
23 23
 
24 24
 // Get access permissions
25
-if($_SESSION['mgrDocgroups']) {
25
+if ($_SESSION['mgrDocgroups']) {
26 26
 	$docgrp = implode(",", $_SESSION['mgrDocgroups']);
27 27
 }
28
-$access = "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0" . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
28
+$access = "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0".(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
29 29
 
30 30
 //
31
-if($_SESSION['tree_show_only_folders']) {
32
-	$parent = $id ? ($modx->getDatabase()->getValue("SELECT parent FROM " . $tbl_site_content . " WHERE id=$id LIMIT 1")) : 0;
33
-	$isfolder = $modx->getDatabase()->getValue("SELECT isfolder FROM " . $tbl_site_content . " WHERE id=$id LIMIT 1");
34
-	if(!$isfolder && $parent != 0) {
31
+if ($_SESSION['tree_show_only_folders']) {
32
+	$parent = $id ? ($modx->getDatabase()->getValue("SELECT parent FROM ".$tbl_site_content." WHERE id=$id LIMIT 1")) : 0;
33
+	$isfolder = $modx->getDatabase()->getValue("SELECT isfolder FROM ".$tbl_site_content." WHERE id=$id LIMIT 1");
34
+	if (!$isfolder && $parent != 0) {
35 35
 		$id = $_REQUEST['id'] = $parent;
36 36
 	}
37 37
 }
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 $rs = $modx->getDatabase()->select('DISTINCT sc.*', "{$tbl_site_content} AS sc
41 41
 		LEFT JOIN {$tbl_document_groups} AS dg ON dg.document = sc.id", "sc.id ='{$id}' AND ({$access})");
42 42
 $content = $modx->getDatabase()->getRow($rs);
43
-if(!$content) {
43
+if (!$content) {
44 44
 	$modx->webAlertAndQuit($_lang["access_permission_denied"]);
45 45
 }
46 46
 
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
 );
83 83
 $filter_sort = '';
84 84
 $filter_dir = '';
85
-if($numRecords > 0) {
86
-	$filter_sort = '<select size="1" name="sort" class="form-control form-control-sm" onchange="document.location=\'index.php?a=3&id=' . $id . '&dir=' . $dir . '&sort=\'+this.options[this.selectedIndex].value">' . '<option value="createdon"' . (($sort == 'createdon') ? ' selected' : '') . '>' . $_lang['createdon'] . '</option>' . '<option value="pub_date"' . (($sort == 'pub_date') ? ' selected' : '') . '>' . $_lang["page_data_publishdate"] . '</option>' . '<option value="pagetitle"' . (($sort == 'pagetitle') ? ' selected' : '') . '>' . $_lang['pagetitle'] . '</option>' . '<option value="menuindex"' . (($sort == 'menuindex') ? ' selected' : '') . '>' . $_lang['resource_opt_menu_index'] . '</option>' . //********  resource_opt_is_published - //
87
-		'<option value="published"' . (($sort == 'published') ? ' selected' : '') . '>' . $_lang['resource_opt_is_published'] . '</option>' . //********//
85
+if ($numRecords > 0) {
86
+	$filter_sort = '<select size="1" name="sort" class="form-control form-control-sm" onchange="document.location=\'index.php?a=3&id='.$id.'&dir='.$dir.'&sort=\'+this.options[this.selectedIndex].value">'.'<option value="createdon"'.(($sort == 'createdon') ? ' selected' : '').'>'.$_lang['createdon'].'</option>'.'<option value="pub_date"'.(($sort == 'pub_date') ? ' selected' : '').'>'.$_lang["page_data_publishdate"].'</option>'.'<option value="pagetitle"'.(($sort == 'pagetitle') ? ' selected' : '').'>'.$_lang['pagetitle'].'</option>'.'<option value="menuindex"'.(($sort == 'menuindex') ? ' selected' : '').'>'.$_lang['resource_opt_menu_index'].'</option>'.//********  resource_opt_is_published - //
87
+		'<option value="published"'.(($sort == 'published') ? ' selected' : '').'>'.$_lang['resource_opt_is_published'].'</option>'.//********//
88 88
 		'</select>';
89
-	$filter_dir = '<select size="1" name="dir" class="form-control form-control-sm" onchange="document.location=\'index.php?a=3&id=' . $id . '&sort=' . $sort . '&dir=\'+this.options[this.selectedIndex].value">' . '<option value="DESC"' . (($dir == 'DESC') ? ' selected' : '') . '>' . $_lang['sort_desc'] . '</option>' . '<option value="ASC"' . (($dir == 'ASC') ? ' selected' : '') . '>' . $_lang['sort_asc'] . '</option>' . '</select>';
89
+	$filter_dir = '<select size="1" name="dir" class="form-control form-control-sm" onchange="document.location=\'index.php?a=3&id='.$id.'&sort='.$sort.'&dir=\'+this.options[this.selectedIndex].value">'.'<option value="DESC"'.(($dir == 'DESC') ? ' selected' : '').'>'.$_lang['sort_desc'].'</option>'.'<option value="ASC"'.(($dir == 'ASC') ? ' selected' : '').'>'.$_lang['sort_asc'].'</option>'.'</select>';
90 90
 	$resource = $modx->getDatabase()->makeArray($rs);
91 91
 
92 92
 	// CSS style for table
@@ -130,10 +130,10 @@  discard block
 block discarded – undo
130 130
 	);
131 131
 	$modx->getMakeTable()->setColumnWidths($tbWidth);
132 132
 
133
-	$sd = isset($_REQUEST['dir']) ? '&amp;dir=' . $_REQUEST['dir'] : '&amp;dir=DESC';
134
-	$sb = isset($_REQUEST['sort']) ? '&amp;sort=' . $_REQUEST['sort'] : '&amp;sort=createdon';
135
-	$pg = isset($_REQUEST['page']) ? '&amp;page=' . (int) $_REQUEST['page'] : '';
136
-	$add_path = $sd . $sb . $pg;
133
+	$sd = isset($_REQUEST['dir']) ? '&amp;dir='.$_REQUEST['dir'] : '&amp;dir=DESC';
134
+	$sb = isset($_REQUEST['sort']) ? '&amp;sort='.$_REQUEST['sort'] : '&amp;sort=createdon';
135
+	$pg = isset($_REQUEST['page']) ? '&amp;page='.(int) $_REQUEST['page'] : '';
136
+	$add_path = $sd.$sb.$pg;
137 137
 
138 138
 	$icons = array(
139 139
 		'text/html' => $_style['tree_page_html'],
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
 	);
152 152
 
153 153
 	$listDocs = array();
154
-	foreach($resource as $k => $children) {
154
+	foreach ($resource as $k => $children) {
155 155
 
156
-		switch($children['id']) {
156
+		switch ($children['id']) {
157 157
 			case $modx->config['site_start']            :
158 158
 				$icon = $_style['tree_page_home'];
159 159
 				break;
@@ -167,10 +167,10 @@  discard block
 block discarded – undo
167 167
 				$icon = $_style['tree_page_info'];
168 168
 				break;
169 169
 			default:
170
-				if($children['isfolder']) {
170
+				if ($children['isfolder']) {
171 171
 					$icon = $_style['tree_folder_new'];
172 172
 				} else {
173
-					if(isset($icons[$children['contentType']])) {
173
+					if (isset($icons[$children['contentType']])) {
174 174
 						$icon = $icons[$children['contentType']];
175 175
 					} else {
176 176
 						$icon = $_style['tree_page'];
@@ -185,32 +185,32 @@  discard block
 block discarded – undo
185 185
 		$class = ($children['deleted'] ? 'text-danger text-decoration-through' : (!$children['published'] ? ' font-italic text-muted' : ' publish'));
186 186
 		//$class .= ($children['hidemenu'] ? ' text-muted' : ' text-primary');
187 187
 		//$class .= ($children['isfolder'] ? ' font-weight-bold' : '');
188
-		if($modx->hasPermission('edit_document')) {
189
-			$title = '<span class="doc-item' . $private . '">' . $icon . '<a href="index.php?a=27&amp;id=' . $children['id'] . $add_path . '">' . '<span class="' . $class . '">' . $children['pagetitle'] . '</span></a></span>';
188
+		if ($modx->hasPermission('edit_document')) {
189
+			$title = '<span class="doc-item'.$private.'">'.$icon.'<a href="index.php?a=27&amp;id='.$children['id'].$add_path.'">'.'<span class="'.$class.'">'.$children['pagetitle'].'</span></a></span>';
190 190
 		} else {
191
-			$title = '<span class="doc-item' . $private . '">' . $icon . '<span class="' . $class . '">' . $children['pagetitle'] . '</span></span>';
191
+			$title = '<span class="doc-item'.$private.'">'.$icon.'<span class="'.$class.'">'.$children['pagetitle'].'</span></span>';
192 192
 		}
193 193
 
194
-		$icon_pub_unpub = (!$children['published']) ? '<a href="index.php?a=61&amp;id=' . $children['id'] . $add_path . '" title="' . $_lang["publish_resource"] . '"><i class="' . $_style["icons_publish_document"] . '"></i></a>' : '<a href="index.php?a=62&amp;id=' . $children['id'] . $add_path . '" title="' . $_lang["unpublish_resource"] . '"><i class="' . $_style["icons_unpublish_resource"] . '" ></i></a>';
194
+		$icon_pub_unpub = (!$children['published']) ? '<a href="index.php?a=61&amp;id='.$children['id'].$add_path.'" title="'.$_lang["publish_resource"].'"><i class="'.$_style["icons_publish_document"].'"></i></a>' : '<a href="index.php?a=62&amp;id='.$children['id'].$add_path.'" title="'.$_lang["unpublish_resource"].'"><i class="'.$_style["icons_unpublish_resource"].'" ></i></a>';
195 195
 
196
-		$icon_del_undel = (!$children['deleted']) ? '<a onclick="return confirm(\'' . $_lang["confirm_delete_resource"] . '\')" href="index.php?a=6&amp;id=' . $children['id'] . $add_path . '" title="' . $_lang['delete_resource'] . '"><i class="' . $_style["icons_delete_resource"] . '"></i></a>' : '<a onclick="return confirm(\'' . $_lang["confirm_undelete"] . '\')" href="index.php?a=63&amp;id=' . $children['id'] . $add_path . '" title="' . $_lang['undelete_resource'] . '"><i class="' . $_style["icons_undelete_resource"] . '"></i></a>';
196
+		$icon_del_undel = (!$children['deleted']) ? '<a onclick="return confirm(\''.$_lang["confirm_delete_resource"].'\')" href="index.php?a=6&amp;id='.$children['id'].$add_path.'" title="'.$_lang['delete_resource'].'"><i class="'.$_style["icons_delete_resource"].'"></i></a>' : '<a onclick="return confirm(\''.$_lang["confirm_undelete"].'\')" href="index.php?a=63&amp;id='.$children['id'].$add_path.'" title="'.$_lang['undelete_resource'].'"><i class="'.$_style["icons_undelete_resource"].'"></i></a>';
197 197
 
198 198
 		$listDocs[] = array(
199
-			'docid' => '<div class="text-right">' . $children['id'] . '</div>',
199
+			'docid' => '<div class="text-right">'.$children['id'].'</div>',
200 200
 			'title' => $title,
201
-			'createdon' => '<div class="text-right">' . ($modx->toDateFormat($children['createdon'] + $server_offset_time, 'dateOnly')) . '</div>',
202
-			'pub_date' => '<div class="text-right">' . ($children['pub_date'] ? ($modx->toDateFormat($children['pub_date'] + $server_offset_time, 'dateOnly')) : '') . '</div>',
203
-			'status' => '<div class="text-nowrap">' . ($children['published'] == 0 ? '<span class="unpublishedDoc">' . $_lang['page_data_unpublished'] . '</span>' : '<span class="publishedDoc">' . $_lang['page_data_published'] . '</span>') . '</div>',
204
-			'edit' => '<div class="actions text-center text-nowrap">' . ($modx->hasPermission('edit_document') ? '<a href="index.php?a=27&amp;id=' . $children['id'] . $add_path . '" title="' . $_lang['edit'] . '"><i class="' . $_style["icons_edit_resource"] . '"></i></a><a href="index.php?a=51&amp;id=' . $children['id'] . $add_path . '" title="' . $_lang['move'] . '"><i 
205
-				class="' . $_style["icons_move_document"] . '"></i></a>' . $icon_pub_unpub : '') . ($modx->hasPermission('delete_document') ? $icon_del_undel : '') . '</div>'
201
+			'createdon' => '<div class="text-right">'.($modx->toDateFormat($children['createdon'] + $server_offset_time, 'dateOnly')).'</div>',
202
+			'pub_date' => '<div class="text-right">'.($children['pub_date'] ? ($modx->toDateFormat($children['pub_date'] + $server_offset_time, 'dateOnly')) : '').'</div>',
203
+			'status' => '<div class="text-nowrap">'.($children['published'] == 0 ? '<span class="unpublishedDoc">'.$_lang['page_data_unpublished'].'</span>' : '<span class="publishedDoc">'.$_lang['page_data_published'].'</span>').'</div>',
204
+			'edit' => '<div class="actions text-center text-nowrap">'.($modx->hasPermission('edit_document') ? '<a href="index.php?a=27&amp;id='.$children['id'].$add_path.'" title="'.$_lang['edit'].'"><i class="'.$_style["icons_edit_resource"].'"></i></a><a href="index.php?a=51&amp;id='.$children['id'].$add_path.'" title="'.$_lang['move'].'"><i 
205
+				class="' . $_style["icons_move_document"].'"></i></a>'.$icon_pub_unpub : '').($modx->hasPermission('delete_document') ? $icon_del_undel : '').'</div>'
206 206
 		);
207 207
 	}
208 208
 
209
-	$modx->getMakeTable()->createPagingNavigation($numRecords, 'a=3&id=' . $content['id'] . '&dir=' . $dir . '&sort=' . $sort);
210
-	$children_output = $modx->getMakeTable()->create($listDocs, $listTableHeader, 'index.php?a=3&amp;id=' . $content['id']);
209
+	$modx->getMakeTable()->createPagingNavigation($numRecords, 'a=3&id='.$content['id'].'&dir='.$dir.'&sort='.$sort);
210
+	$children_output = $modx->getMakeTable()->create($listDocs, $listTableHeader, 'index.php?a=3&amp;id='.$content['id']);
211 211
 } else {
212 212
 	// No Child documents
213
-	$children_output = '<div class="container"><p>' . $_lang['resources_in_container_no'] . '</p></div>';
213
+	$children_output = '<div class="container"><p>'.$_lang['resources_in_container_no'].'</p></div>';
214 214
 }
215 215
 ?>
216 216
 	<script type="text/javascript">
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 			},
237 237
 			cancel: function() {
238 238
 				documentDirty = false;
239
-				document.location.href = 'index.php?<?=($id == 0 ? 'a=2' : 'a=3&r=1&id=' . $id . $add_path) ?>';
239
+				document.location.href = 'index.php?<?=($id == 0 ? 'a=2' : 'a=3&r=1&id='.$id.$add_path) ?>';
240 240
 			},
241 241
 			move: function() {
242 242
 				document.location.href = "index.php?id=<?= $_REQUEST['id'] ?>&a=51";
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 				}
248 248
 			},
249 249
 			view: function() {
250
-				window.open('<?= ($modx->config['friendly_urls'] == '1') ? $modx->makeUrl($id) : $modx->config['site_url'] . 'index.php?id=' . $id ?>', 'previeWin');
250
+				window.open('<?= ($modx->config['friendly_urls'] == '1') ? $modx->makeUrl($id) : $modx->config['site_url'].'index.php?id='.$id ?>', 'previeWin');
251 251
 			}
252 252
 		};
253 253
 
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 	<script type="text/javascript" src="media/script/tablesort.js"></script>
256 256
 
257 257
 	<h1>
258
-		<i class="fa fa-info"></i><?= iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . ' <small>(' . $_REQUEST['id'] . ')</small>' ?>
258
+		<i class="fa fa-info"></i><?= iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']).(iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '').' <small>('.$_REQUEST['id'].')</small>' ?>
259 259
 	</h1>
260 260
 
261 261
 <?= $_style['actionbuttons']['static']['document'] ?>
@@ -282,16 +282,16 @@  discard block
 block discarded – undo
282 282
 					<tr>
283 283
 						<td width="200" valign="top"><?= $_lang['long_title'] ?>:</td>
284 284
 						<td>
285
-							<small><?= $content['longtitle'] != '' ? $content['longtitle'] : "(<i>" . $_lang['not_set'] . "</i>)" ?></small>
285
+							<small><?= $content['longtitle'] != '' ? $content['longtitle'] : "(<i>".$_lang['not_set']."</i>)" ?></small>
286 286
 						</td>
287 287
 					</tr>
288 288
 					<tr>
289 289
 						<td valign="top"><?= $_lang['resource_description'] ?>:</td>
290
-						<td><?= $content['description'] != '' ? $content['description'] : "(<i>" . $_lang['not_set'] . "</i>)" ?></td>
290
+						<td><?= $content['description'] != '' ? $content['description'] : "(<i>".$_lang['not_set']."</i>)" ?></td>
291 291
 					</tr>
292 292
 					<tr>
293 293
 						<td valign="top"><?= $_lang['resource_summary'] ?>:</td>
294
-						<td><?= $content['introtext'] != '' ? $content['introtext'] : "(<i>" . $_lang['not_set'] . "</i>)" ?></td>
294
+						<td><?= $content['introtext'] != '' ? $content['introtext'] : "(<i>".$_lang['not_set']."</i>)" ?></td>
295 295
 					</tr>
296 296
 					<tr>
297 297
 						<td valign="top"><?= $_lang['type'] ?>:</td>
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 					</tr>
300 300
 					<tr>
301 301
 						<td valign="top"><?= $_lang['resource_alias'] ?>:</td>
302
-						<td><?= $content['alias'] != '' ? $content['alias'] : "(<i>" . $_lang['not_set'] . "</i>)" ?></td>
302
+						<td><?= $content['alias'] != '' ? $content['alias'] : "(<i>".$_lang['not_set']."</i>)" ?></td>
303 303
 					</tr>
304 304
 					<tr>
305 305
 						<td colspan="2">&nbsp;</td>
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 						<td><?= $modx->toDateFormat($content['createdon'] + $server_offset_time) ?> (<b><?= $createdbyname ?></b>)
313 313
 						</td>
314 314
 					</tr>
315
-					<?php if($editedbyname != '') { ?>
315
+					<?php if ($editedbyname != '') { ?>
316 316
 						<tr>
317 317
 							<td><?= $_lang['page_data_edited'] ?>:</td>
318 318
 							<td><?= $modx->toDateFormat($content['editedon'] + $server_offset_time) ?> (<b><?= $editedbyname ?></b>)
@@ -327,15 +327,15 @@  discard block
 block discarded – undo
327 327
 					</tr>
328 328
 					<tr>
329 329
 						<td><?= $_lang['page_data_status'] ?>:</td>
330
-						<td><?= $content['published'] == 0 ? '<span class="unpublishedDoc">' . $_lang['page_data_unpublished'] . '</span>' : '<span class="publisheddoc">' . $_lang['page_data_published'] . '</span>' ?></td>
330
+						<td><?= $content['published'] == 0 ? '<span class="unpublishedDoc">'.$_lang['page_data_unpublished'].'</span>' : '<span class="publisheddoc">'.$_lang['page_data_published'].'</span>' ?></td>
331 331
 					</tr>
332 332
 					<tr>
333 333
 						<td><?= $_lang['page_data_publishdate'] ?>:</td>
334
-						<td><?= $content['pub_date'] == 0 ? "(<i>" . $_lang['not_set'] . "</i>)" : $modx->toDateFormat($content['pub_date']) ?></td>
334
+						<td><?= $content['pub_date'] == 0 ? "(<i>".$_lang['not_set']."</i>)" : $modx->toDateFormat($content['pub_date']) ?></td>
335 335
 					</tr>
336 336
 					<tr>
337 337
 						<td><?= $_lang['page_data_unpublishdate'] ?>:</td>
338
-						<td><?= $content['unpub_date'] == 0 ? "(<i>" . $_lang['not_set'] . "</i>)" : $modx->toDateFormat($content['unpub_date']) ?></td>
338
+						<td><?= $content['unpub_date'] == 0 ? "(<i>".$_lang['not_set']."</i>)" : $modx->toDateFormat($content['unpub_date']) ?></td>
339 339
 					</tr>
340 340
 					<tr>
341 341
 						<td><?= $_lang['page_data_cacheable'] ?>:</td>
@@ -355,11 +355,11 @@  discard block
 block discarded – undo
355 355
 					</tr>
356 356
 					<tr>
357 357
 						<td><?= $_lang['page_data_web_access'] ?>:</td>
358
-						<td><?= $content['privateweb'] == 0 ? $_lang['public'] : '<b style="color: #821517">' . $_lang['private'] . '</b> ' . $_style["icons_secured"] ?></td>
358
+						<td><?= $content['privateweb'] == 0 ? $_lang['public'] : '<b style="color: #821517">'.$_lang['private'].'</b> '.$_style["icons_secured"] ?></td>
359 359
 					</tr>
360 360
 					<tr>
361 361
 						<td><?= $_lang['page_data_mgr_access'] ?>:</td>
362
-						<td><?= $content['privatemgr'] == 0 ? $_lang['public'] : '<b style="color: #821517">' . $_lang['private'] . '</b> ' . $_style["icons_secured"] ?></td>
362
+						<td><?= $content['privatemgr'] == 0 ? $_lang['public'] : '<b style="color: #821517">'.$_lang['private'].'</b> '.$_style["icons_secured"] ?></td>
363 363
 					</tr>
364 364
 					<tr>
365 365
 						<td colspan="2">&nbsp;</td>
@@ -389,13 +389,13 @@  discard block
 block discarded – undo
389 389
 			<script type="text/javascript">docSettings.addTabPage(document.getElementById("tabChildren"));</script>
390 390
 			<div class="container container-body">
391 391
 				<div class="form-group clearfix">
392
-					<?php if($numRecords > 0) : ?>
392
+					<?php if ($numRecords > 0) : ?>
393 393
 						<div class="float-xs-left">
394
-							<span class="publishedDoc"><?= $numRecords . ' ' . $_lang['resources_in_container'] ?> (<strong><?= $content['pagetitle'] ?></strong>)</span>
394
+							<span class="publishedDoc"><?= $numRecords.' '.$_lang['resources_in_container'] ?> (<strong><?= $content['pagetitle'] ?></strong>)</span>
395 395
 						</div>
396 396
 					<?php endif; ?>
397 397
 					<div class="float-xs-right">
398
-						<?= $filter_sort . ' ' . $filter_dir ?>
398
+						<?= $filter_sort.' '.$filter_dir ?>
399 399
 					</div>
400 400
 
401 401
 				</div>
@@ -405,23 +405,23 @@  discard block
 block discarded – undo
405 405
 			</div>
406 406
 		</div><!-- end tab-page -->
407 407
 
408
-		<?php if($modx->config['cache_type'] != 2) { ?>
408
+		<?php if ($modx->config['cache_type'] != 2) { ?>
409 409
 			<!-- Page Source -->
410 410
 			<div class="tab-page" id="tabSource">
411 411
 				<h2 class="tab"><?= $_lang['page_data_source'] ?></h2>
412 412
 				<script type="text/javascript">docSettings.addTabPage(document.getElementById("tabSource"));</script>
413 413
 				<?php
414 414
 				$buffer = "";
415
-				$filename = $modx->config['base_path'] . "assets/cache/docid_" . $id . ".pageCache.php";
415
+				$filename = $modx->config['base_path']."assets/cache/docid_".$id.".pageCache.php";
416 416
 				$handle = @fopen($filename, "r");
417
-				if(!$handle) {
418
-					$buffer = '<div class="container container-body">' . $_lang['page_data_notcached'] . '</div>';
417
+				if (!$handle) {
418
+					$buffer = '<div class="container container-body">'.$_lang['page_data_notcached'].'</div>';
419 419
 				} else {
420
-					while(!feof($handle)) {
420
+					while (!feof($handle)) {
421 421
 						$buffer .= fgets($handle, 4096);
422 422
 					}
423 423
 					fclose($handle);
424
-					$buffer = '<div class="navbar navbar-editor">' . $_lang['page_data_cached'] . '</div><div class="section-editor clearfix"><textarea rows="20" wrap="soft">' . $modx->getPhpCompat()->htmlspecialchars($buffer) . "</textarea></div>\n";
424
+					$buffer = '<div class="navbar navbar-editor">'.$_lang['page_data_cached'].'</div><div class="section-editor clearfix"><textarea rows="20" wrap="soft">'.$modx->getPhpCompat()->htmlspecialchars($buffer)."</textarea></div>\n";
425 425
 				}
426 426
 				echo $buffer;
427 427
 				?>
@@ -431,12 +431,12 @@  discard block
 block discarded – undo
431 431
 	</div><!-- end documentPane -->
432 432
 
433 433
 <?php
434
-if(isset($_GET['tab']) && is_numeric($_GET['tab'])) {
435
-	echo '<script type="text/javascript"> docSettings.setSelectedIndex( ' . $_GET['tab'] . ' );</script>';
434
+if (isset($_GET['tab']) && is_numeric($_GET['tab'])) {
435
+	echo '<script type="text/javascript"> docSettings.setSelectedIndex( '.$_GET['tab'].' );</script>';
436 436
 }
437 437
 ?>
438 438
 
439
-<?php if($show_preview == 1) { ?>
439
+<?php if ($show_preview == 1) { ?>
440 440
 	<div class="sectionHeader"><?= $_lang['preview'] ?></div>
441 441
 	<div class="sectionBody" id="lyr2">
442 442
 		<iframe src="<?= MODX_SITE_URL ?>index.php?id=<?= $id ?>&z=manprev" frameborder="0" border="0" id="previewIframe"></iframe>
Please login to merge, or discard this patch.
manager/actions/mutate_templates.dynamic.php 3 patches
Switch Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -4,18 +4,18 @@
 block discarded – undo
4 4
 }
5 5
 
6 6
 switch($modx->getManagerApi()->action) {
7
-	case 16:
8
-		if(!$modx->hasPermission('edit_template')) {
9
-			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
10
-		}
11
-		break;
12
-	case 19:
13
-		if(!$modx->hasPermission('new_template')) {
14
-			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
15
-		}
16
-		break;
17
-	default:
18
-		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7
+	    case 16:
8
+		    if(!$modx->hasPermission('edit_template')) {
9
+			    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
10
+		    }
11
+		    break;
12
+	    case 19:
13
+		    if(!$modx->hasPermission('new_template')) {
14
+			    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
15
+		    }
16
+		    break;
17
+	    default:
18
+		    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
19 19
 }
20 20
 
21 21
 $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
Please login to merge, or discard this patch.
Indentation   +124 added lines, -124 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@  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
 
6 6
 switch($modx->getManagerApi()->action) {
7
-	case 16:
8
-		if(!$modx->hasPermission('edit_template')) {
9
-			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
10
-		}
11
-		break;
12
-	case 19:
13
-		if(!$modx->hasPermission('new_template')) {
14
-			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
15
-		}
16
-		break;
17
-	default:
18
-		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7
+    case 16:
8
+        if(!$modx->hasPermission('edit_template')) {
9
+            $modx->webAlertAndQuit($_lang["error_no_privileges"]);
10
+        }
11
+        break;
12
+    case 19:
13
+        if(!$modx->hasPermission('new_template')) {
14
+            $modx->webAlertAndQuit($_lang["error_no_privileges"]);
15
+        }
16
+        break;
17
+    default:
18
+        $modx->webAlertAndQuit($_lang["error_no_privileges"]);
19 19
 }
20 20
 
21 21
 $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
 // check to see the snippet editor isn't locked
26 26
 if($lockedEl = $modx->elementIsLocked(1, $id)) {
27
-	$modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['template']));
27
+    $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['template']));
28 28
 }
29 29
 // end check for lock
30 30
 
@@ -33,23 +33,23 @@  discard block
 block discarded – undo
33 33
 
34 34
 $content = array();
35 35
 if(!empty($id)) {
36
-	$rs = $modx->getDatabase()->select('*', $tbl_site_templates, "id='{$id}'");
37
-	$content = $modx->getDatabase()->getRow($rs);
38
-	if(!$content) {
39
-		$modx->webAlertAndQuit("No database record has been found for this template.");
40
-	}
41
-
42
-	$_SESSION['itemname'] = $content['templatename'];
43
-	if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
44
-		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
45
-	}
36
+    $rs = $modx->getDatabase()->select('*', $tbl_site_templates, "id='{$id}'");
37
+    $content = $modx->getDatabase()->getRow($rs);
38
+    if(!$content) {
39
+        $modx->webAlertAndQuit("No database record has been found for this template.");
40
+    }
41
+
42
+    $_SESSION['itemname'] = $content['templatename'];
43
+    if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
44
+        $modx->webAlertAndQuit($_lang["error_no_privileges"]);
45
+    }
46 46
 } else {
47
-	$_SESSION['itemname'] = $_lang["new_template"];
48
-	$content['category'] = (int)$_REQUEST['catid'];
47
+    $_SESSION['itemname'] = $_lang["new_template"];
48
+    $content['category'] = (int)$_REQUEST['catid'];
49 49
 }
50 50
 
51 51
 if($modx->getManagerApi()->hasFormValues()) {
52
-	$modx->getManagerApi()->loadFormValues();
52
+    $modx->getManagerApi()->loadFormValues();
53 53
 }
54 54
 
55 55
 $content = array_merge($content, $_POST);
@@ -98,12 +98,12 @@  discard block
 block discarded – undo
98 98
 
99 99
 <form name="mutate" method="post" action="index.php">
100 100
 	<?php
101
-	// invoke OnTempFormPrerender event
102
-	$evtOut = $modx->invokeEvent("OnTempFormPrerender", array("id" => $id));
103
-	if(is_array($evtOut)) {
104
-		echo implode("", $evtOut);
105
-	}
106
-	?>
101
+    // invoke OnTempFormPrerender event
102
+    $evtOut = $modx->invokeEvent("OnTempFormPrerender", array("id" => $id));
103
+    if(is_array($evtOut)) {
104
+        echo implode("", $evtOut);
105
+    }
106
+    ?>
107 107
 	<input type="hidden" name="a" value="20">
108 108
 	<input type="hidden" name="id" value="<?= $_REQUEST['id'] ?>">
109 109
 	<input type="hidden" name="mode" value="<?= $modx->getManagerApi()->action ?>">
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
 						<label class="col-md-3 col-lg-2">
134 134
 							<?= $_lang['template_name'] ?>
135 135
 							<?php if($id == $modx->config['default_template']) {
136
-								echo '<small class="form-text text-danger">' . mb_strtolower(rtrim($_lang['defaulttemplate_title'], ':'), $modx_manager_charset) . '</small>';
137
-							} ?>
136
+                                echo '<small class="form-text text-danger">' . mb_strtolower(rtrim($_lang['defaulttemplate_title'], ':'), $modx_manager_charset) . '</small>';
137
+                            } ?>
138 138
 						</label>
139 139
 						<div class="col-md-9 col-lg-10">
140 140
 							<div class="form-control-name clearfix">
@@ -162,11 +162,11 @@  discard block
 block discarded – undo
162 162
 							<select name="categoryid" class="form-control" onchange="documentDirty=true;">
163 163
 								<option>&nbsp;</option>
164 164
 								<?php
165
-								include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
166
-								foreach(getCategories() as $n => $v) {
167
-									echo "<option value='" . $v['id'] . "'" . ($content["category"] == $v["id"] ? " selected='selected'" : "") . ">" . $modx->getPhpCompat()->htmlspecialchars($v["category"]) . "</option>";
168
-								}
169
-								?>
165
+                                include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
166
+                                foreach(getCategories() as $n => $v) {
167
+                                    echo "<option value='" . $v['id'] . "'" . ($content["category"] == $v["id"] ? " selected='selected'" : "") . ">" . $modx->getPhpCompat()->htmlspecialchars($v["category"]) . "</option>";
168
+                                }
169
+                                ?>
170 170
 							</select>
171 171
 						</div>
172 172
 					</div>
@@ -197,38 +197,38 @@  discard block
 block discarded – undo
197 197
 			<input type="submit" name="save" style="display:none">
198 198
 
199 199
 			<?php
200
-			$selectedTvs = array();
201
-			if(!isset($_POST['assignedTv'])) {
202
-				$rs = $modx->getDatabase()->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category", $_lang['no_category']), sprintf("%s tv
200
+            $selectedTvs = array();
201
+            if(!isset($_POST['assignedTv'])) {
202
+                $rs = $modx->getDatabase()->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category", $_lang['no_category']), sprintf("%s tv
203 203
                 LEFT JOIN %s tr ON tv.id=tr.tmplvarid
204 204
                 LEFT JOIN %s cat ON tv.category=cat.id", $modx->getDatabase()->getFullTableName('site_tmplvars'), $modx->getDatabase()->getFullTableName('site_tmplvar_templates'), $modx->getDatabase()->getFullTableName('categories')), "templateid='{$id}'", "tr.rank DESC, tv.rank DESC, tvcaption DESC, tvid DESC"     // workaround for correct sort of none-existing ranks
205
-				);
206
-				while($row = $modx->getDatabase()->getRow($rs)) {
207
-					$selectedTvs[$row['tvid']] = $row;
208
-				}
209
-				$selectedTvs = array_reverse($selectedTvs, true);       // reverse ORDERBY DESC
210
-			}
211
-
212
-			$unselectedTvs = array();
213
-			$rs = $modx->getDatabase()->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category, cat.id as catid", $_lang['no_category']), sprintf("%s tv
205
+                );
206
+                while($row = $modx->getDatabase()->getRow($rs)) {
207
+                    $selectedTvs[$row['tvid']] = $row;
208
+                }
209
+                $selectedTvs = array_reverse($selectedTvs, true);       // reverse ORDERBY DESC
210
+            }
211
+
212
+            $unselectedTvs = array();
213
+            $rs = $modx->getDatabase()->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category, cat.id as catid", $_lang['no_category']), sprintf("%s tv
214 214
 	    LEFT JOIN %s tr ON tv.id=tr.tmplvarid
215 215
 	    LEFT JOIN %s cat ON tv.category=cat.id", $modx->getDatabase()->getFullTableName('site_tmplvars'), $modx->getDatabase()->getFullTableName('site_tmplvar_templates'), $modx->getDatabase()->getFullTableName('categories')), "", "category, tvcaption");
216
-			while($row = $modx->getDatabase()->getRow($rs)) {
217
-				$unselectedTvs[$row['tvid']] = $row;
218
-			}
219
-
220
-			// Catch checkboxes if form not validated
221
-			if(isset($_POST['assignedTv'])) {
222
-				$selectedTvs = array();
223
-				foreach($_POST['assignedTv'] as $tvid) {
224
-					if(isset($unselectedTvs[$tvid])) {
225
-						$selectedTvs[$tvid] = $unselectedTvs[$tvid];
226
-					}
227
-				};
228
-			}
229
-
230
-			$total = count($selectedTvs);
231
-			?>
216
+            while($row = $modx->getDatabase()->getRow($rs)) {
217
+                $unselectedTvs[$row['tvid']] = $row;
218
+            }
219
+
220
+            // Catch checkboxes if form not validated
221
+            if(isset($_POST['assignedTv'])) {
222
+                $selectedTvs = array();
223
+                foreach($_POST['assignedTv'] as $tvid) {
224
+                    if(isset($unselectedTvs[$tvid])) {
225
+                        $selectedTvs[$tvid] = $unselectedTvs[$tvid];
226
+                    }
227
+                };
228
+            }
229
+
230
+            $total = count($selectedTvs);
231
+            ?>
232 232
 		</div>
233 233
 
234 234
 		<div class="tab-page" id="tabAssignedTVs">
@@ -238,65 +238,65 @@  discard block
 block discarded – undo
238 238
 
239 239
 			<div class="container container-body">
240 240
 				<?php
241
-				if($total > 0) {
242
-					echo '<p>' . $_lang['template_tv_msg'] . '</p>';
243
-				}
244
-				if($modx->hasPermission('save_template') && $total > 1 && $id) {
245
-					echo sprintf('<div class="form-group"><a class="btn btn-primary" href="index.php?a=117&amp;id=%s">%s</a></div>', $id, $_lang['template_tv_edit']);
246
-				}
247
-
248
-				// Selected TVs
249
-				$tvList = '';
250
-				if($total > 0) {
251
-					$tvList .= '<ul>';
252
-					foreach($selectedTvs as $row) {
253
-						$desc = !empty($row['tvdescription']) ? '&nbsp;&nbsp;<small>(' . $row['tvdescription'] . ')</small>' : '';
254
-						$locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : "";
255
-						$tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" checked="checked" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->getManagerApi()->action, $id, $_lang['edit']);
256
-					}
257
-					$tvList .= '</ul>';
258
-
259
-				} else {
260
-					echo $_lang['template_no_tv'];
261
-				}
262
-				echo $tvList;
263
-
264
-				// Unselected TVs
265
-				$tvList = '<hr/><p>' . $_lang['template_notassigned_tv'] . '</p><ul>';
266
-				$preCat = '';
267
-				$insideUl = 0;
268
-				while($row = array_shift($unselectedTvs)) {
269
-					if(isset($selectedTvs[$row['tvid']])) {
270
-						continue;
271
-					} // Skip selected
272
-					$row['category'] = stripslashes($row['category']); //pixelchutes
273
-					if($preCat !== $row['category']) {
274
-						$tvList .= $insideUl ? '</ul>' : '';
275
-						$tvList .= '<li><strong>' . $row['category'] . ($row['catid'] != '' ? ' <small>(' . $row['catid'] . ')</small>' : '') . '</strong><ul>';
276
-						$insideUl = 1;
277
-					}
278
-
279
-					$desc = !empty($row['tvdescription']) ? '&nbsp;&nbsp;<small>(' . $row['tvdescription'] . ')</small>' : '';
280
-					$locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : "";
281
-					$tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->getManagerApi()->action, $id, $_lang['edit']);
282
-					$tvList .= '</li>';
283
-
284
-					$preCat = $row['category'];
285
-				}
286
-				$tvList .= $insideUl ? '</ul>' : '';
287
-				$tvList .= '</ul>';
288
-				echo $tvList;
289
-
290
-				?>
241
+                if($total > 0) {
242
+                    echo '<p>' . $_lang['template_tv_msg'] . '</p>';
243
+                }
244
+                if($modx->hasPermission('save_template') && $total > 1 && $id) {
245
+                    echo sprintf('<div class="form-group"><a class="btn btn-primary" href="index.php?a=117&amp;id=%s">%s</a></div>', $id, $_lang['template_tv_edit']);
246
+                }
247
+
248
+                // Selected TVs
249
+                $tvList = '';
250
+                if($total > 0) {
251
+                    $tvList .= '<ul>';
252
+                    foreach($selectedTvs as $row) {
253
+                        $desc = !empty($row['tvdescription']) ? '&nbsp;&nbsp;<small>(' . $row['tvdescription'] . ')</small>' : '';
254
+                        $locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : "";
255
+                        $tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" checked="checked" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->getManagerApi()->action, $id, $_lang['edit']);
256
+                    }
257
+                    $tvList .= '</ul>';
258
+
259
+                } else {
260
+                    echo $_lang['template_no_tv'];
261
+                }
262
+                echo $tvList;
263
+
264
+                // Unselected TVs
265
+                $tvList = '<hr/><p>' . $_lang['template_notassigned_tv'] . '</p><ul>';
266
+                $preCat = '';
267
+                $insideUl = 0;
268
+                while($row = array_shift($unselectedTvs)) {
269
+                    if(isset($selectedTvs[$row['tvid']])) {
270
+                        continue;
271
+                    } // Skip selected
272
+                    $row['category'] = stripslashes($row['category']); //pixelchutes
273
+                    if($preCat !== $row['category']) {
274
+                        $tvList .= $insideUl ? '</ul>' : '';
275
+                        $tvList .= '<li><strong>' . $row['category'] . ($row['catid'] != '' ? ' <small>(' . $row['catid'] . ')</small>' : '') . '</strong><ul>';
276
+                        $insideUl = 1;
277
+                    }
278
+
279
+                    $desc = !empty($row['tvdescription']) ? '&nbsp;&nbsp;<small>(' . $row['tvdescription'] . ')</small>' : '';
280
+                    $locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : "";
281
+                    $tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->getManagerApi()->action, $id, $_lang['edit']);
282
+                    $tvList .= '</li>';
283
+
284
+                    $preCat = $row['category'];
285
+                }
286
+                $tvList .= $insideUl ? '</ul>' : '';
287
+                $tvList .= '</ul>';
288
+                echo $tvList;
289
+
290
+                ?>
291 291
 			</div>
292 292
 		</div>
293 293
 
294 294
 		<?php
295
-		// invoke OnTempFormRender event
296
-		$evtOut = $modx->invokeEvent("OnTempFormRender", array("id" => $id));
297
-		if(is_array($evtOut)) {
298
-			echo implode("", $evtOut);
299
-		}
300
-		?>
295
+        // invoke OnTempFormRender event
296
+        $evtOut = $modx->invokeEvent("OnTempFormRender", array("id" => $id));
297
+        if(is_array($evtOut)) {
298
+            echo implode("", $evtOut);
299
+        }
300
+        ?>
301 301
 	</div>
302 302
 </form>
Please login to merge, or discard this patch.
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  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
-switch($modx->getManagerApi()->action) {
6
+switch ($modx->getManagerApi()->action) {
7 7
 	case 16:
8
-		if(!$modx->hasPermission('edit_template')) {
8
+		if (!$modx->hasPermission('edit_template')) {
9 9
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
10 10
 		}
11 11
 		break;
12 12
 	case 19:
13
-		if(!$modx->hasPermission('new_template')) {
13
+		if (!$modx->hasPermission('new_template')) {
14 14
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
15 15
 		}
16 16
 		break;
@@ -18,12 +18,12 @@  discard block
 block discarded – undo
18 18
 		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
19 19
 }
20 20
 
21
-$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
21
+$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
22 22
 
23 23
 $tbl_site_templates = $modx->getDatabase()->getFullTableName('site_templates');
24 24
 
25 25
 // check to see the snippet editor isn't locked
26
-if($lockedEl = $modx->elementIsLocked(1, $id)) {
26
+if ($lockedEl = $modx->elementIsLocked(1, $id)) {
27 27
 	$modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['template']));
28 28
 }
29 29
 // end check for lock
@@ -32,23 +32,23 @@  discard block
 block discarded – undo
32 32
 $modx->lockElement(1, $id);
33 33
 
34 34
 $content = array();
35
-if(!empty($id)) {
35
+if (!empty($id)) {
36 36
 	$rs = $modx->getDatabase()->select('*', $tbl_site_templates, "id='{$id}'");
37 37
 	$content = $modx->getDatabase()->getRow($rs);
38
-	if(!$content) {
38
+	if (!$content) {
39 39
 		$modx->webAlertAndQuit("No database record has been found for this template.");
40 40
 	}
41 41
 
42 42
 	$_SESSION['itemname'] = $content['templatename'];
43
-	if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
43
+	if ($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
44 44
 		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
45 45
 	}
46 46
 } else {
47 47
 	$_SESSION['itemname'] = $_lang["new_template"];
48
-	$content['category'] = (int)$_REQUEST['catid'];
48
+	$content['category'] = (int) $_REQUEST['catid'];
49 49
 }
50 50
 
51
-if($modx->getManagerApi()->hasFormValues()) {
51
+if ($modx->getManagerApi()->hasFormValues()) {
52 52
 	$modx->getManagerApi()->loadFormValues();
53 53
 }
54 54
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 // Add lock-element JS-Script
59 59
 $lockElementId = $id;
60 60
 $lockElementType = 1;
61
-require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php');
61
+require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php');
62 62
 ?>
63 63
 <script type="text/javascript">
64 64
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	<?php
101 101
 	// invoke OnTempFormPrerender event
102 102
 	$evtOut = $modx->invokeEvent("OnTempFormPrerender", array("id" => $id));
103
-	if(is_array($evtOut)) {
103
+	if (is_array($evtOut)) {
104 104
 		echo implode("", $evtOut);
105 105
 	}
106 106
 	?>
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	<input type="hidden" name="mode" value="<?= $modx->getManagerApi()->action ?>">
110 110
 
111 111
 	<h1>
112
-		<i class="fa fa-newspaper-o"></i><?= ($content['templatename'] ? $content['templatename'] . '<small>(' . $content['id'] . ')</small>' : $_lang['new_template']) ?><i class="fa fa-question-circle help"></i>
112
+		<i class="fa fa-newspaper-o"></i><?= ($content['templatename'] ? $content['templatename'].'<small>('.$content['id'].')</small>' : $_lang['new_template']) ?><i class="fa fa-question-circle help"></i>
113 113
 	</h1>
114 114
 
115 115
 	<?= $_style['actionbuttons']['dynamic']['element'] ?>
@@ -132,15 +132,15 @@  discard block
 block discarded – undo
132 132
 					<div class="row form-row">
133 133
 						<label class="col-md-3 col-lg-2">
134 134
 							<?= $_lang['template_name'] ?>
135
-							<?php if($id == $modx->config['default_template']) {
136
-								echo '<small class="form-text text-danger">' . mb_strtolower(rtrim($_lang['defaulttemplate_title'], ':'), $modx_manager_charset) . '</small>';
135
+							<?php if ($id == $modx->config['default_template']) {
136
+								echo '<small class="form-text text-danger">'.mb_strtolower(rtrim($_lang['defaulttemplate_title'], ':'), $modx_manager_charset).'</small>';
137 137
 							} ?>
138 138
 						</label>
139 139
 						<div class="col-md-9 col-lg-10">
140 140
 							<div class="form-control-name clearfix">
141 141
 								<input name="templatename" type="text" maxlength="100" value="<?= $modx->getPhpCompat()->htmlspecialchars($content['templatename']) ?>" class="form-control form-control-lg" onchange="documentDirty=true;">
142
-								<?php if($modx->hasPermission('save_role')): ?>
143
-									<label class="custom-control" title="<?= $_lang['lock_template'] . "\n" . $_lang['lock_template_msg'] ?>" tooltip>
142
+								<?php if ($modx->hasPermission('save_role')): ?>
143
+									<label class="custom-control" title="<?= $_lang['lock_template']."\n".$_lang['lock_template_msg'] ?>" tooltip>
144 144
 										<input name="locked" type="checkbox"<?= ($content['locked'] == 1 ? ' checked="checked"' : '') ?> />
145 145
 										<i class="fa fa-lock"></i>
146 146
 									</label>
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
 							<select name="categoryid" class="form-control" onchange="documentDirty=true;">
163 163
 								<option>&nbsp;</option>
164 164
 								<?php
165
-								include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
166
-								foreach(getCategories() as $n => $v) {
167
-									echo "<option value='" . $v['id'] . "'" . ($content["category"] == $v["id"] ? " selected='selected'" : "") . ">" . $modx->getPhpCompat()->htmlspecialchars($v["category"]) . "</option>";
165
+								include_once(MODX_MANAGER_PATH.'includes/categories.inc.php');
166
+								foreach (getCategories() as $n => $v) {
167
+									echo "<option value='".$v['id']."'".($content["category"] == $v["id"] ? " selected='selected'" : "").">".$modx->getPhpCompat()->htmlspecialchars($v["category"])."</option>";
168 168
 								}
169 169
 								?>
170 170
 							</select>
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 						</div>
178 178
 					</div>
179 179
 				</div>
180
-				<?php if($modx->hasPermission('save_role')): ?>
180
+				<?php if ($modx->hasPermission('save_role')): ?>
181 181
 					<div class="form-group">
182 182
 						<label>
183 183
 							<input name="selectable" type="checkbox"<?= ($selectable == 1 ? ' checked="checked"' : '') ?> /> <?= $_lang['template_selectable'] ?></label>
@@ -198,30 +198,30 @@  discard block
 block discarded – undo
198 198
 
199 199
 			<?php
200 200
 			$selectedTvs = array();
201
-			if(!isset($_POST['assignedTv'])) {
201
+			if (!isset($_POST['assignedTv'])) {
202 202
 				$rs = $modx->getDatabase()->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category", $_lang['no_category']), sprintf("%s tv
203 203
                 LEFT JOIN %s tr ON tv.id=tr.tmplvarid
204 204
                 LEFT JOIN %s cat ON tv.category=cat.id", $modx->getDatabase()->getFullTableName('site_tmplvars'), $modx->getDatabase()->getFullTableName('site_tmplvar_templates'), $modx->getDatabase()->getFullTableName('categories')), "templateid='{$id}'", "tr.rank DESC, tv.rank DESC, tvcaption DESC, tvid DESC"     // workaround for correct sort of none-existing ranks
205 205
 				);
206
-				while($row = $modx->getDatabase()->getRow($rs)) {
206
+				while ($row = $modx->getDatabase()->getRow($rs)) {
207 207
 					$selectedTvs[$row['tvid']] = $row;
208 208
 				}
209
-				$selectedTvs = array_reverse($selectedTvs, true);       // reverse ORDERBY DESC
209
+				$selectedTvs = array_reverse($selectedTvs, true); // reverse ORDERBY DESC
210 210
 			}
211 211
 
212 212
 			$unselectedTvs = array();
213 213
 			$rs = $modx->getDatabase()->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category, cat.id as catid", $_lang['no_category']), sprintf("%s tv
214 214
 	    LEFT JOIN %s tr ON tv.id=tr.tmplvarid
215 215
 	    LEFT JOIN %s cat ON tv.category=cat.id", $modx->getDatabase()->getFullTableName('site_tmplvars'), $modx->getDatabase()->getFullTableName('site_tmplvar_templates'), $modx->getDatabase()->getFullTableName('categories')), "", "category, tvcaption");
216
-			while($row = $modx->getDatabase()->getRow($rs)) {
216
+			while ($row = $modx->getDatabase()->getRow($rs)) {
217 217
 				$unselectedTvs[$row['tvid']] = $row;
218 218
 			}
219 219
 
220 220
 			// Catch checkboxes if form not validated
221
-			if(isset($_POST['assignedTv'])) {
221
+			if (isset($_POST['assignedTv'])) {
222 222
 				$selectedTvs = array();
223
-				foreach($_POST['assignedTv'] as $tvid) {
224
-					if(isset($unselectedTvs[$tvid])) {
223
+				foreach ($_POST['assignedTv'] as $tvid) {
224
+					if (isset($unselectedTvs[$tvid])) {
225 225
 						$selectedTvs[$tvid] = $unselectedTvs[$tvid];
226 226
 					}
227 227
 				};
@@ -238,20 +238,20 @@  discard block
 block discarded – undo
238 238
 
239 239
 			<div class="container container-body">
240 240
 				<?php
241
-				if($total > 0) {
242
-					echo '<p>' . $_lang['template_tv_msg'] . '</p>';
241
+				if ($total > 0) {
242
+					echo '<p>'.$_lang['template_tv_msg'].'</p>';
243 243
 				}
244
-				if($modx->hasPermission('save_template') && $total > 1 && $id) {
244
+				if ($modx->hasPermission('save_template') && $total > 1 && $id) {
245 245
 					echo sprintf('<div class="form-group"><a class="btn btn-primary" href="index.php?a=117&amp;id=%s">%s</a></div>', $id, $_lang['template_tv_edit']);
246 246
 				}
247 247
 
248 248
 				// Selected TVs
249 249
 				$tvList = '';
250
-				if($total > 0) {
250
+				if ($total > 0) {
251 251
 					$tvList .= '<ul>';
252
-					foreach($selectedTvs as $row) {
253
-						$desc = !empty($row['tvdescription']) ? '&nbsp;&nbsp;<small>(' . $row['tvdescription'] . ')</small>' : '';
254
-						$locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : "";
252
+					foreach ($selectedTvs as $row) {
253
+						$desc = !empty($row['tvdescription']) ? '&nbsp;&nbsp;<small>('.$row['tvdescription'].')</small>' : '';
254
+						$locked = $row['tvlocked'] ? ' <em>('.$_lang['locked'].')</em>' : "";
255 255
 						$tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" checked="checked" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->getManagerApi()->action, $id, $_lang['edit']);
256 256
 					}
257 257
 					$tvList .= '</ul>';
@@ -262,22 +262,22 @@  discard block
 block discarded – undo
262 262
 				echo $tvList;
263 263
 
264 264
 				// Unselected TVs
265
-				$tvList = '<hr/><p>' . $_lang['template_notassigned_tv'] . '</p><ul>';
265
+				$tvList = '<hr/><p>'.$_lang['template_notassigned_tv'].'</p><ul>';
266 266
 				$preCat = '';
267 267
 				$insideUl = 0;
268
-				while($row = array_shift($unselectedTvs)) {
269
-					if(isset($selectedTvs[$row['tvid']])) {
268
+				while ($row = array_shift($unselectedTvs)) {
269
+					if (isset($selectedTvs[$row['tvid']])) {
270 270
 						continue;
271 271
 					} // Skip selected
272 272
 					$row['category'] = stripslashes($row['category']); //pixelchutes
273
-					if($preCat !== $row['category']) {
273
+					if ($preCat !== $row['category']) {
274 274
 						$tvList .= $insideUl ? '</ul>' : '';
275
-						$tvList .= '<li><strong>' . $row['category'] . ($row['catid'] != '' ? ' <small>(' . $row['catid'] . ')</small>' : '') . '</strong><ul>';
275
+						$tvList .= '<li><strong>'.$row['category'].($row['catid'] != '' ? ' <small>('.$row['catid'].')</small>' : '').'</strong><ul>';
276 276
 						$insideUl = 1;
277 277
 					}
278 278
 
279
-					$desc = !empty($row['tvdescription']) ? '&nbsp;&nbsp;<small>(' . $row['tvdescription'] . ')</small>' : '';
280
-					$locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : "";
279
+					$desc = !empty($row['tvdescription']) ? '&nbsp;&nbsp;<small>('.$row['tvdescription'].')</small>' : '';
280
+					$locked = $row['tvlocked'] ? ' <em>('.$_lang['locked'].')</em>' : "";
281 281
 					$tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->getManagerApi()->action, $id, $_lang['edit']);
282 282
 					$tvList .= '</li>';
283 283
 
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 		<?php
295 295
 		// invoke OnTempFormRender event
296 296
 		$evtOut = $modx->invokeEvent("OnTempFormRender", array("id" => $id));
297
-		if(is_array($evtOut)) {
297
+		if (is_array($evtOut)) {
298 298
 			echo implode("", $evtOut);
299 299
 		}
300 300
 		?>
Please login to merge, or discard this patch.
manager/actions/mutate_snippet.dynamic.php 2 patches
Switch Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -4,18 +4,18 @@
 block discarded – undo
4 4
 }
5 5
 
6 6
 switch ($modx->getManagerApi()->action) {
7
-    case 22:
8
-        if (!$modx->hasPermission('edit_snippet')) {
9
-            $modx->webAlertAndQuit($_lang["error_no_privileges"]);
10
-        }
11
-        break;
12
-    case 23:
13
-        if (!$modx->hasPermission('new_snippet')) {
7
+        case 22:
8
+            if (!$modx->hasPermission('edit_snippet')) {
9
+                $modx->webAlertAndQuit($_lang["error_no_privileges"]);
10
+            }
11
+            break;
12
+        case 23:
13
+            if (!$modx->hasPermission('new_snippet')) {
14
+                $modx->webAlertAndQuit($_lang["error_no_privileges"]);
15
+            }
16
+            break;
17
+        default:
14 18
             $modx->webAlertAndQuit($_lang["error_no_privileges"]);
15
-        }
16
-        break;
17
-    default:
18
-        $modx->webAlertAndQuit($_lang["error_no_privileges"]);
19 19
 }
20 20
 
21 21
 $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 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
 
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
         $modx->webAlertAndQuit($_lang["error_no_privileges"]);
19 19
 }
20 20
 
21
-$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
21
+$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
22 22
 
23 23
 // Get table Names (alphabetical)
24 24
 $tbl_site_module_depobj = $modx->getDatabase()->getFullTableName('site_module_depobj');
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
     $rs = $modx->getDatabase()->select('*', $tbl_site_snippets, "id='{$id}'");
40 40
     $content = $modx->getDatabase()->getRow($rs);
41 41
     if (!$content) {
42
-        header("Location: " . MODX_SITE_URL . "index.php?id=" . $site_start);
42
+        header("Location: ".MODX_SITE_URL."index.php?id=".$site_start);
43 43
     }
44 44
     $_SESSION['itemname'] = $content['name'];
45 45
     if ($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     $content['name'] = $_REQUEST['itemname'];
51 51
 } else {
52 52
     $_SESSION['itemname'] = $_lang["new_snippet"];
53
-    $content['category'] = (int)$_REQUEST['catid'];
53
+    $content['category'] = (int) $_REQUEST['catid'];
54 54
 }
55 55
 
56 56
 if ($modx->getManagerApi()->hasFormValues()) {
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 // Add lock-element JS-Script
63 63
 $lockElementId = $id;
64 64
 $lockElementType = 4;
65
-require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php');
65
+require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php');
66 66
 ?>
67 67
 <script type="text/javascript">
68 68
 
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
     <input type="hidden" name="mode" value="<?= $modx->getManagerApi()->action ?>">
432 432
 
433 433
     <h1 class="pagetitle">
434
-        <i class="fa fa-code"></i><?= ($content['name'] ? $content['name'] . '<small>(' . $content['id'] . ')</small>' : $_lang['new_snippet']) ?><i class="fa fa-question-circle help"></i>
434
+        <i class="fa fa-code"></i><?= ($content['name'] ? $content['name'].'<small>('.$content['id'].')</small>' : $_lang['new_snippet']) ?><i class="fa fa-question-circle help"></i>
435 435
     </h1>
436 436
 
437 437
     <?= $_style['actionbuttons']['dynamic']['element'] ?>
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
                             <div class="form-control-name clearfix">
458 458
                                 <input name="name" type="text" maxlength="100" value="<?= $modx->getPhpCompat()->htmlspecialchars($content['name']) ?>" class="form-control form-control-lg" onchange="documentDirty=true;" />
459 459
                                 <?php if ($modx->hasPermission('save_role')): ?>
460
-                                    <label class="custom-control" title="<?= $_lang['lock_snippet'] . "\n" . $_lang['lock_snippet_msg'] ?>" tooltip>
460
+                                    <label class="custom-control" title="<?= $_lang['lock_snippet']."\n".$_lang['lock_snippet_msg'] ?>" tooltip>
461 461
                                         <input name="locked" type="checkbox"<?= ($content['locked'] == 1 ? ' checked="checked"' : '') ?> />
462 462
                                         <i class="fa fa-lock"></i>
463 463
                                     </label>
@@ -481,9 +481,9 @@  discard block
 block discarded – undo
481 481
                             <select name="categoryid" class="form-control" onchange="documentDirty=true;">
482 482
                                 <option>&nbsp;</option>
483 483
                                 <?php
484
-                                include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
484
+                                include_once(MODX_MANAGER_PATH.'includes/categories.inc.php');
485 485
                                 foreach (getCategories() as $n => $v) {
486
-                                    echo '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->getPhpCompat()->htmlspecialchars($v['category']) . '</option>';
486
+                                    echo '<option value="'.$v['id'].'"'.($content['category'] == $v['id'] ? ' selected="selected"' : '').'>'.$modx->getPhpCompat()->htmlspecialchars($v['category']).'</option>';
487 487
                                 }
488 488
                                 ?>
489 489
                             </select>
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
                     <div class="form-group">
501 501
                         <?php if ($_SESSION['mgrRole'] == 1): ?>
502 502
                             <div class="form-row">
503
-                                <label><input name="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> /> <?= ($content['disabled'] == 1 ? "<span class='text-danger'>" . $_lang['disabled'] . "</span>" : $_lang['disabled']) ?></label>
503
+                                <label><input name="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> /> <?= ($content['disabled'] == 1 ? "<span class='text-danger'>".$_lang['disabled']."</span>" : $_lang['disabled']) ?></label>
504 504
                             </div>
505 505
                         <?php endif; ?>
506 506
                         <div class="form-row">
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
                 <span><?= $_lang['snippet_code'] ?></span>
518 518
             </div>
519 519
             <div class="section-editor clearfix">
520
-                <textarea dir="ltr" name="post" class="phptextarea" rows="20" wrap="soft" onchange="documentDirty=true;"><?= (isset($content['post']) ? trim($modx->getPhpCompat()->htmlspecialchars($content['post'])) : "<?php" . "\n" . trim($modx->getPhpCompat()->htmlspecialchars($content['snippet'])) . "\n") ?></textarea>
520
+                <textarea dir="ltr" name="post" class="phptextarea" rows="20" wrap="soft" onchange="documentDirty=true;"><?= (isset($content['post']) ? trim($modx->getPhpCompat()->htmlspecialchars($content['post'])) : "<?php"."\n".trim($modx->getPhpCompat()->htmlspecialchars($content['snippet']))."\n") ?></textarea>
521 521
             </div>
522 522
             <!-- PHP text editor end -->
523 523
         </div>
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 								INNER JOIN {$tbl_site_module_depobj} AS smd ON smd.module=sm.id AND smd.type=40 
553 553
 								INNER JOIN {$tbl_site_snippets} AS ss ON ss.id=smd.resource", "smd.resource='{$id}' AND sm.enable_sharedparams=1", 'sm.name');
554 554
                                 while ($row = $modx->getDatabase()->getRow($ds)) {
555
-                                    echo "<option value='" . $row['guid'] . "'" . ($content['moduleguid'] == $row['guid'] ? " selected='selected'" : "") . ">" . $modx->getPhpCompat()->htmlspecialchars($row['name']) . "</option>";
555
+                                    echo "<option value='".$row['guid']."'".($content['moduleguid'] == $row['guid'] ? " selected='selected'" : "").">".$modx->getPhpCompat()->htmlspecialchars($row['name'])."</option>";
556 556
                                 }
557 557
                                 ?>
558 558
                             </select>
Please login to merge, or discard this patch.
manager/actions/mutate_tv_rank.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_template')) {
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 $updateMsg = '';
16 16
 
17 17
 if (isset($_POST['listSubmitted'])) {
18
-    $updateMsg .= '<span class="text-success" id="updated">' . $_lang['sort_updated'] . '</span>';
18
+    $updateMsg .= '<span class="text-success" id="updated">'.$_lang['sort_updated'].'</span>';
19 19
     foreach ($_POST as $listName => $listValue) {
20 20
         if ($listName == 'listSubmitted' || $listName == 'reset') {
21 21
             continue;
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
     $sortableList = '<div class="clearfix"><ul id="sortlist" class="sortableList">';
41 41
     while ($row = $modx->getDatabase()->getRow($rs)) {
42 42
         $caption = $row['caption'] != '' ? $row['caption'] : $row['name'];
43
-        $sortableList .= '<li id="item_' . $row['id'] . '"><i class="fa fa-list-alt"></i> ' . $caption . ' <small class="protectedNode" style="float:right">[*' . $row['name'] . '*]</small></li>';
43
+        $sortableList .= '<li id="item_'.$row['id'].'"><i class="fa fa-list-alt"></i> '.$caption.' <small class="protectedNode" style="float:right">[*'.$row['name'].'*]</small></li>';
44 44
     }
45 45
     $sortableList .= '</ul></div>';
46 46
 } else {
47
-    $updateMsg = '<p class="text-danger">' . $_lang['tmplvars_novars'] . '</p>';
47
+    $updateMsg = '<p class="text-danger">'.$_lang['tmplvars_novars'].'</p>';
48 48
 }
49 49
 ?>
50 50
 
Please login to merge, or discard this patch.
manager/actions/mutate_module.dynamic.php 4 patches
Switch Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -3,18 +3,18 @@
 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
 switch($modx->getManagerApi()->action) {
6
-	case 107:
7
-		if(!$modx->hasPermission('new_module')) {
8
-			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
9
-		}
10
-		break;
11
-	case 108:
12
-		if(!$modx->hasPermission('edit_module')) {
13
-			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
14
-		}
15
-		break;
16
-	default:
17
-		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+	    case 107:
7
+		    if(!$modx->hasPermission('new_module')) {
8
+			    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
9
+		    }
10
+		    break;
11
+	    case 108:
12
+		    if(!$modx->hasPermission('edit_module')) {
13
+			    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
14
+		    }
15
+		    break;
16
+	    default:
17
+		    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
18 18
 }
19 19
 $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
20 20
 // Get table names (alphabetical)
Please login to merge, or discard this patch.
Braces   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -1,15 +1,15 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
 	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5
-switch($modx->getManagerApi()->action) {
5
+switch($modx->getManagerApi()->action) {
6 6
 	case 107:
7
-		if(!$modx->hasPermission('new_module')) {
7
+		if(!$modx->hasPermission('new_module')) {
8 8
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
9 9
 		}
10 10
 		break;
11 11
 	case 108:
12
-		if(!$modx->hasPermission('edit_module')) {
12
+		if(!$modx->hasPermission('edit_module')) {
13 13
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
14 14
 		}
15 15
 		break;
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
 
33 33
 // check to see the module editor isn't locked
34
-if($lockedEl = $modx->elementIsLocked(6, $id)) {
34
+if($lockedEl = $modx->elementIsLocked(6, $id)) {
35 35
 	$modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['module']));
36 36
 }
37 37
 // end check for lock
@@ -39,22 +39,22 @@  discard block
 block discarded – undo
39 39
 // Lock snippet for other users to edit
40 40
 $modx->lockElement(6, $id);
41 41
 
42
-if(isset($_GET['id'])) {
42
+if(isset($_GET['id'])) {
43 43
 	$rs = $modx->getDatabase()->select('*', $tbl_site_modules, "id='{$id}'");
44 44
 	$content = $modx->getDatabase()->getRow($rs);
45
-	if(!$content) {
45
+	if(!$content) {
46 46
 		$modx->webAlertAndQuit("Module not found for id '{$id}'.");
47 47
 	}
48 48
 	$content['properties'] = str_replace("&", "&amp;", $content['properties']);
49 49
 	$_SESSION['itemname'] = $content['name'];
50
-	if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
50
+	if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
51 51
 		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
52 52
 	}
53
-} else {
53
+} else {
54 54
 	$_SESSION['itemname'] = $_lang["new_module"];
55 55
 	$content['wrap'] = '1';
56 56
 }
57
-if($modx->getManagerApi()->hasFormValues()) {
57
+if($modx->getManagerApi()->hasFormValues()) {
58 58
 	$modx->getManagerApi()->loadFormValues();
59 59
 }
60 60
 
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 	<?php
429 429
 	// invoke OnModFormPrerender event
430 430
 	$evtOut = $modx->invokeEvent('OnModFormPrerender', array('id' => $id));
431
-	if(is_array($evtOut)) {
431
+	if(is_array($evtOut)) {
432 432
 		echo implode('', $evtOut);
433 433
 	}
434 434
 
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
 								<option>&nbsp;</option>
492 492
 								<?php
493 493
 								include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
494
-								foreach(getCategories() as $n => $v) {
494
+								foreach(getCategories() as $n => $v) {
495 495
 									echo "\t\t\t" . '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->getPhpCompat()->htmlspecialchars($v['category']) . "</option>\n";
496 496
 								}
497 497
 								?>
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
 					$rs = $modx->getDatabase()->select('usergroup', $tbl_site_module_access, "module='{$id}'");
644 644
 					$groupsarray = $modx->getDatabase()->getColumn('usergroup', $rs);
645 645
 
646
-					if($modx->hasPermission('access_permissions')) {
646
+					if($modx->hasPermission('access_permissions')) {
647 647
 						?>
648 648
 						<!-- User Group Access Permissions -->
649 649
 						<script type="text/javascript">
@@ -671,21 +671,21 @@  discard block
 block discarded – undo
671 671
 					}
672 672
 					$chk = '';
673 673
 					$rs = $modx->getDatabase()->select('name, id', $tbl_membergroup_names, '', 'name');
674
-					while($row = $modx->getDatabase()->getRow($rs)) {
674
+					while($row = $modx->getDatabase()->getRow($rs)) {
675 675
 						$groupsarray = is_numeric($id) && $id > 0 ? $groupsarray : array();
676 676
 						$checked = in_array($row['id'], $groupsarray);
677
-						if($modx->hasPermission('access_permissions')) {
678
-							if($checked) {
677
+						if($modx->hasPermission('access_permissions')) {
678
+							if($checked) {
679 679
 								$notPublic = true;
680 680
 							}
681 681
 							$chks .= '<label><input type="checkbox" name="usrgroups[]" value="' . $row['id'] . '"' . ($checked ? ' checked="checked"' : '') . ' onclick="makePublic(false)" /> ' . $row['name'] . "</label><br />\n";
682
-						} else {
683
-							if($checked) {
682
+						} else {
683
+							if($checked) {
684 684
 								$chks = '<input type="hidden" name="usrgroups[]"  value="' . $row['id'] . '" />' . "\n" . $chks;
685 685
 							}
686 686
 						}
687 687
 					}
688
-					if($modx->hasPermission('access_permissions')) {
688
+					if($modx->hasPermission('access_permissions')) {
689 689
 						$chks = '<label><input type="checkbox" name="chkallgroups"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true)" /><span class="warning"> ' . $_lang['all_usr_groups'] . '</span></label><br />' . "\n" . $chks;
690 690
 					}
691 691
 					echo $chks;
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 		<?php
708 708
 		// invoke OnModFormRender event
709 709
 		$evtOut = $modx->invokeEvent('OnModFormRender', array('id' => $id));
710
-		if(is_array($evtOut)) {
710
+		if(is_array($evtOut)) {
711 711
 			echo implode('', $evtOut);
712 712
 		}
713 713
 		?>
Please login to merge, or discard this patch.
Indentation   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -1,20 +1,20 @@  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
 switch($modx->getManagerApi()->action) {
6
-	case 107:
7
-		if(!$modx->hasPermission('new_module')) {
8
-			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
9
-		}
10
-		break;
11
-	case 108:
12
-		if(!$modx->hasPermission('edit_module')) {
13
-			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
14
-		}
15
-		break;
16
-	default:
17
-		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    case 107:
7
+        if(!$modx->hasPermission('new_module')) {
8
+            $modx->webAlertAndQuit($_lang["error_no_privileges"]);
9
+        }
10
+        break;
11
+    case 108:
12
+        if(!$modx->hasPermission('edit_module')) {
13
+            $modx->webAlertAndQuit($_lang["error_no_privileges"]);
14
+        }
15
+        break;
16
+    default:
17
+        $modx->webAlertAndQuit($_lang["error_no_privileges"]);
18 18
 }
19 19
 $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
20 20
 // Get table names (alphabetical)
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 
33 33
 // check to see the module editor isn't locked
34 34
 if($lockedEl = $modx->elementIsLocked(6, $id)) {
35
-	$modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['module']));
35
+    $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['module']));
36 36
 }
37 37
 // end check for lock
38 38
 
@@ -40,22 +40,22 @@  discard block
 block discarded – undo
40 40
 $modx->lockElement(6, $id);
41 41
 
42 42
 if(isset($_GET['id'])) {
43
-	$rs = $modx->getDatabase()->select('*', $tbl_site_modules, "id='{$id}'");
44
-	$content = $modx->getDatabase()->getRow($rs);
45
-	if(!$content) {
46
-		$modx->webAlertAndQuit("Module not found for id '{$id}'.");
47
-	}
48
-	$content['properties'] = str_replace("&", "&amp;", $content['properties']);
49
-	$_SESSION['itemname'] = $content['name'];
50
-	if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
51
-		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
52
-	}
43
+    $rs = $modx->getDatabase()->select('*', $tbl_site_modules, "id='{$id}'");
44
+    $content = $modx->getDatabase()->getRow($rs);
45
+    if(!$content) {
46
+        $modx->webAlertAndQuit("Module not found for id '{$id}'.");
47
+    }
48
+    $content['properties'] = str_replace("&", "&amp;", $content['properties']);
49
+    $_SESSION['itemname'] = $content['name'];
50
+    if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
51
+        $modx->webAlertAndQuit($_lang["error_no_privileges"]);
52
+    }
53 53
 } else {
54
-	$_SESSION['itemname'] = $_lang["new_module"];
55
-	$content['wrap'] = '1';
54
+    $_SESSION['itemname'] = $_lang["new_module"];
55
+    $content['wrap'] = '1';
56 56
 }
57 57
 if($modx->getManagerApi()->hasFormValues()) {
58
-	$modx->getManagerApi()->loadFormValues();
58
+    $modx->getManagerApi()->loadFormValues();
59 59
 }
60 60
 
61 61
 // Add lock-element JS-Script
@@ -426,18 +426,18 @@  discard block
 block discarded – undo
426 426
 
427 427
 <form name="mutate" id="mutate" class="module" method="post" action="index.php?a=109">
428 428
 	<?php
429
-	// invoke OnModFormPrerender event
430
-	$evtOut = $modx->invokeEvent('OnModFormPrerender', array('id' => $id));
431
-	if(is_array($evtOut)) {
432
-		echo implode('', $evtOut);
433
-	}
434
-
435
-	// Prepare internal params & info-tab via parseDocBlock
436
-	$modulecode = isset($content['modulecode']) ? $modx->getDatabase()->escape($content['modulecode']) : '';
437
-	$docBlock = $modx->parseDocBlockFromString($modulecode);
438
-	$docBlockList = $modx->convertDocBlockIntoList($docBlock);
439
-	$internal = array();
440
-	?>
429
+    // invoke OnModFormPrerender event
430
+    $evtOut = $modx->invokeEvent('OnModFormPrerender', array('id' => $id));
431
+    if(is_array($evtOut)) {
432
+        echo implode('', $evtOut);
433
+    }
434
+
435
+    // Prepare internal params & info-tab via parseDocBlock
436
+    $modulecode = isset($content['modulecode']) ? $modx->getDatabase()->escape($content['modulecode']) : '';
437
+    $docBlock = $modx->parseDocBlockFromString($modulecode);
438
+    $docBlockList = $modx->convertDocBlockIntoList($docBlock);
439
+    $internal = array();
440
+    ?>
441 441
 	<input type="hidden" name="id" value="<?= $content['id'] ?>">
442 442
 	<input type="hidden" name="mode" value="<?= $modx->getManagerApi()->action ?>">
443 443
 
@@ -490,11 +490,11 @@  discard block
 block discarded – undo
490 490
 							<select name="categoryid" class="form-control" onchange="documentDirty=true;">
491 491
 								<option>&nbsp;</option>
492 492
 								<?php
493
-								include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
494
-								foreach(getCategories() as $n => $v) {
495
-									echo "\t\t\t" . '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->getPhpCompat()->htmlspecialchars($v['category']) . "</option>\n";
496
-								}
497
-								?>
493
+                                include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
494
+                                foreach(getCategories() as $n => $v) {
495
+                                    echo "\t\t\t" . '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->getPhpCompat()->htmlspecialchars($v['category']) . "</option>\n";
496
+                                }
497
+                                ?>
498 498
 							</select>
499 499
 						</div>
500 500
 					</div>
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 							<i class="<?= $_style["actions_save"] ?>"></i> <?= $_lang['manage_depends'] ?></a>
602 602
 					</div>
603 603
 					<?php
604
-					$ds = $modx->getDatabase()->select("smd.id, COALESCE(ss.name,st.templatename,sv.name,sc.name,sp.name,sd.pagetitle) AS name, 
604
+                    $ds = $modx->getDatabase()->select("smd.id, COALESCE(ss.name,st.templatename,sv.name,sc.name,sp.name,sd.pagetitle) AS name, 
605 605
 					CASE smd.type
606 606
 						WHEN 10 THEN 'Chunk'
607 607
 						WHEN 20 THEN 'Document'
@@ -617,16 +617,16 @@  discard block
 block discarded – undo
617 617
 						LEFT JOIN {$tbl_site_templates} AS st ON st.id = smd.resource AND smd.type = 50
618 618
 						LEFT JOIN {$tbl_site_tmplvars} AS sv ON sv.id = smd.resource AND smd.type = 60", "smd.module='{$id}'", 'smd.type,name');
619 619
 
620
-					$grd = new \EvolutionCMS\Support\DataGrid('', $ds, 0); // set page size to 0 t show all items
621
-					$grd->noRecordMsg = $_lang['no_records_found'];
622
-					$grd->cssClass = 'grid';
623
-					$grd->columnHeaderClass = 'gridHeader';
624
-					$grd->itemClass = 'gridItem';
625
-					$grd->altItemClass = 'gridAltItem';
626
-					$grd->columns = $_lang['element_name'] . " ," . $_lang['type'];
627
-					$grd->fields = "name,type";
628
-					echo $grd->render();
629
-					?>
620
+                    $grd = new \EvolutionCMS\Support\DataGrid('', $ds, 0); // set page size to 0 t show all items
621
+                    $grd->noRecordMsg = $_lang['no_records_found'];
622
+                    $grd->cssClass = 'grid';
623
+                    $grd->columnHeaderClass = 'gridHeader';
624
+                    $grd->itemClass = 'gridItem';
625
+                    $grd->altItemClass = 'gridAltItem';
626
+                    $grd->columns = $_lang['element_name'] . " ," . $_lang['type'];
627
+                    $grd->fields = "name,type";
628
+                    echo $grd->render();
629
+                    ?>
630 630
 				</div>
631 631
 			</div>
632 632
 		<?php endif; ?>
@@ -638,12 +638,12 @@  discard block
 block discarded – undo
638 638
 			<div class="container container-body">
639 639
 				<?php if($use_udperms == 1) : ?>
640 640
 					<?php
641
-					// fetch user access permissions for the module
642
-					$rs = $modx->getDatabase()->select('usergroup', $tbl_site_module_access, "module='{$id}'");
643
-					$groupsarray = $modx->getDatabase()->getColumn('usergroup', $rs);
641
+                    // fetch user access permissions for the module
642
+                    $rs = $modx->getDatabase()->select('usergroup', $tbl_site_module_access, "module='{$id}'");
643
+                    $groupsarray = $modx->getDatabase()->getColumn('usergroup', $rs);
644 644
 
645
-					if($modx->hasPermission('access_permissions')) {
646
-						?>
645
+                    if($modx->hasPermission('access_permissions')) {
646
+                        ?>
647 647
 						<!-- User Group Access Permissions -->
648 648
 						<script type="text/javascript">
649 649
 							function makePublic(b) {
@@ -667,28 +667,28 @@  discard block
 block discarded – undo
667 667
 						</script>
668 668
 						<p><?= $_lang['module_group_access_msg'] ?></p>
669 669
 						<?php
670
-					}
671
-					$chk = '';
672
-					$rs = $modx->getDatabase()->select('name, id', $tbl_membergroup_names, '', 'name');
673
-					while($row = $modx->getDatabase()->getRow($rs)) {
674
-						$groupsarray = is_numeric($id) && $id > 0 ? $groupsarray : array();
675
-						$checked = in_array($row['id'], $groupsarray);
676
-						if($modx->hasPermission('access_permissions')) {
677
-							if($checked) {
678
-								$notPublic = true;
679
-							}
680
-							$chks .= '<label><input type="checkbox" name="usrgroups[]" value="' . $row['id'] . '"' . ($checked ? ' checked="checked"' : '') . ' onclick="makePublic(false)" /> ' . $row['name'] . "</label><br />\n";
681
-						} else {
682
-							if($checked) {
683
-								$chks = '<input type="hidden" name="usrgroups[]"  value="' . $row['id'] . '" />' . "\n" . $chks;
684
-							}
685
-						}
686
-					}
687
-					if($modx->hasPermission('access_permissions')) {
688
-						$chks = '<label><input type="checkbox" name="chkallgroups"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true)" /><span class="warning"> ' . $_lang['all_usr_groups'] . '</span></label><br />' . "\n" . $chks;
689
-					}
690
-					echo $chks;
691
-					?>
670
+                    }
671
+                    $chk = '';
672
+                    $rs = $modx->getDatabase()->select('name, id', $tbl_membergroup_names, '', 'name');
673
+                    while($row = $modx->getDatabase()->getRow($rs)) {
674
+                        $groupsarray = is_numeric($id) && $id > 0 ? $groupsarray : array();
675
+                        $checked = in_array($row['id'], $groupsarray);
676
+                        if($modx->hasPermission('access_permissions')) {
677
+                            if($checked) {
678
+                                $notPublic = true;
679
+                            }
680
+                            $chks .= '<label><input type="checkbox" name="usrgroups[]" value="' . $row['id'] . '"' . ($checked ? ' checked="checked"' : '') . ' onclick="makePublic(false)" /> ' . $row['name'] . "</label><br />\n";
681
+                        } else {
682
+                            if($checked) {
683
+                                $chks = '<input type="hidden" name="usrgroups[]"  value="' . $row['id'] . '" />' . "\n" . $chks;
684
+                            }
685
+                        }
686
+                    }
687
+                    if($modx->hasPermission('access_permissions')) {
688
+                        $chks = '<label><input type="checkbox" name="chkallgroups"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true)" /><span class="warning"> ' . $_lang['all_usr_groups'] . '</span></label><br />' . "\n" . $chks;
689
+                    }
690
+                    echo $chks;
691
+                    ?>
692 692
 				<?php endif; ?>
693 693
 			</div>
694 694
 		</div>
@@ -704,11 +704,11 @@  discard block
 block discarded – undo
704 704
 
705 705
 		<input type="submit" name="save" style="display:none;">
706 706
 		<?php
707
-		// invoke OnModFormRender event
708
-		$evtOut = $modx->invokeEvent('OnModFormRender', array('id' => $id));
709
-		if(is_array($evtOut)) {
710
-			echo implode('', $evtOut);
711
-		}
712
-		?>
707
+        // invoke OnModFormRender event
708
+        $evtOut = $modx->invokeEvent('OnModFormRender', array('id' => $id));
709
+        if(is_array($evtOut)) {
710
+            echo implode('', $evtOut);
711
+        }
712
+        ?>
713 713
 </form>
714 714
 <script type="text/javascript">setTimeout('showParameters();', 10);</script>
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
 	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5
-switch($modx->getManagerApi()->action) {
5
+switch ($modx->getManagerApi()->action) {
6 6
 	case 107:
7
-		if(!$modx->hasPermission('new_module')) {
7
+		if (!$modx->hasPermission('new_module')) {
8 8
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
9 9
 		}
10 10
 		break;
11 11
 	case 108:
12
-		if(!$modx->hasPermission('edit_module')) {
12
+		if (!$modx->hasPermission('edit_module')) {
13 13
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
14 14
 		}
15 15
 		break;
16 16
 	default:
17 17
 		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
18 18
 }
19
-$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
19
+$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
20 20
 // Get table names (alphabetical)
21 21
 $tbl_membergroup_names = $modx->getDatabase()->getFullTableName('membergroup_names');
22 22
 $tbl_site_content = $modx->getDatabase()->getFullTableName('site_content');
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
 
33 33
 // check to see the module editor isn't locked
34
-if($lockedEl = $modx->elementIsLocked(6, $id)) {
34
+if ($lockedEl = $modx->elementIsLocked(6, $id)) {
35 35
 	$modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['module']));
36 36
 }
37 37
 // end check for lock
@@ -39,29 +39,29 @@  discard block
 block discarded – undo
39 39
 // Lock snippet for other users to edit
40 40
 $modx->lockElement(6, $id);
41 41
 
42
-if(isset($_GET['id'])) {
42
+if (isset($_GET['id'])) {
43 43
 	$rs = $modx->getDatabase()->select('*', $tbl_site_modules, "id='{$id}'");
44 44
 	$content = $modx->getDatabase()->getRow($rs);
45
-	if(!$content) {
45
+	if (!$content) {
46 46
 		$modx->webAlertAndQuit("Module not found for id '{$id}'.");
47 47
 	}
48 48
 	$content['properties'] = str_replace("&", "&amp;", $content['properties']);
49 49
 	$_SESSION['itemname'] = $content['name'];
50
-	if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
50
+	if ($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
51 51
 		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
52 52
 	}
53 53
 } else {
54 54
 	$_SESSION['itemname'] = $_lang["new_module"];
55 55
 	$content['wrap'] = '1';
56 56
 }
57
-if($modx->getManagerApi()->hasFormValues()) {
57
+if ($modx->getManagerApi()->hasFormValues()) {
58 58
 	$modx->getManagerApi()->loadFormValues();
59 59
 }
60 60
 
61 61
 // Add lock-element JS-Script
62 62
 $lockElementId = $id;
63 63
 $lockElementType = 6;
64
-require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php');
64
+require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php');
65 65
 ?>
66 66
 <script type="text/javascript">
67 67
 	function loadDependencies() {
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 	function BrowseServer() {
409 409
 		var w = screen.width * 0.7;
410 410
 		var h = screen.height * 0.7;
411
-		OpenServerBrowser("<?= MODX_MANAGER_URL;?>media/browser/<?= $which_browser;?>/browser.php?Type=images", w, h);
411
+		OpenServerBrowser("<?= MODX_MANAGER_URL; ?>media/browser/<?= $which_browser; ?>/browser.php?Type=images", w, h);
412 412
 	}
413 413
 
414 414
 	function SetUrl(url, width, height, alt) {
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 	<?php
429 429
 	// invoke OnModFormPrerender event
430 430
 	$evtOut = $modx->invokeEvent('OnModFormPrerender', array('id' => $id));
431
-	if(is_array($evtOut)) {
431
+	if (is_array($evtOut)) {
432 432
 		echo implode('', $evtOut);
433 433
 	}
434 434
 
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 	<input type="hidden" name="mode" value="<?= $modx->getManagerApi()->action ?>">
443 443
 
444 444
 	<h1>
445
-		<i class="<?= ($content['icon'] != '' ? $content['icon'] : $_style['icons_module']) ?>"></i><?= ($content['name'] ? $content['name'] . '<small>(' . $content['id'] . ')</small>' : $_lang['new_module']) ?><i class="fa fa-question-circle help"></i>
445
+		<i class="<?= ($content['icon'] != '' ? $content['icon'] : $_style['icons_module']) ?>"></i><?= ($content['name'] ? $content['name'].'<small>('.$content['id'].')</small>' : $_lang['new_module']) ?><i class="fa fa-question-circle help"></i>
446 446
 	</h1>
447 447
 
448 448
 	<?= $_style['actionbuttons']['dynamic']['element'] ?>
@@ -467,8 +467,8 @@  discard block
 block discarded – undo
467 467
 						<div class="col-md-9 col-lg-10">
468 468
 							<div class="form-control-name clearfix">
469 469
 								<input name="name" type="text" maxlength="100" value="<?= $modx->getPhpCompat()->htmlspecialchars($content['name']) ?>" class="form-control form-control-lg" onchange="documentDirty=true;" />
470
-								<?php if($modx->hasPermission('save_role')): ?>
471
-									<label class="custom-control" title="<?= $_lang['lock_module'] . "\n" . $_lang['lock_module_msg'] ?>" tooltip>
470
+								<?php if ($modx->hasPermission('save_role')): ?>
471
+									<label class="custom-control" title="<?= $_lang['lock_module']."\n".$_lang['lock_module_msg'] ?>" tooltip>
472 472
 										<input name="locked" type="checkbox"<?= ($content['locked'] == 1 ? ' checked="checked"' : '') ?> />
473 473
 										<i class="fa fa-lock"></i>
474 474
 									</label>
@@ -490,9 +490,9 @@  discard block
 block discarded – undo
490 490
 							<select name="categoryid" class="form-control" onchange="documentDirty=true;">
491 491
 								<option>&nbsp;</option>
492 492
 								<?php
493
-								include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
494
-								foreach(getCategories() as $n => $v) {
495
-									echo "\t\t\t" . '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->getPhpCompat()->htmlspecialchars($v['category']) . "</option>\n";
493
+								include_once(MODX_MANAGER_PATH.'includes/categories.inc.php');
494
+								foreach (getCategories() as $n => $v) {
495
+									echo "\t\t\t".'<option value="'.$v['id'].'"'.($content['category'] == $v['id'] ? ' selected="selected"' : '').'>'.$modx->getPhpCompat()->htmlspecialchars($v['category'])."</option>\n";
496 496
 								}
497 497
 								?>
498 498
 							</select>
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 				<div class="form-group">
525 525
 					<div class="form-row">
526 526
 						<label for="disabled"><input name="disabled" id="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> />
527
-							<?= ($content['disabled'] == 1 ? '<span class="text-danger">' . $_lang['module_disabled'] . '</span>' : $_lang['module_disabled']) ?></label>
527
+							<?= ($content['disabled'] == 1 ? '<span class="text-danger">'.$_lang['module_disabled'].'</span>' : $_lang['module_disabled']) ?></label>
528 528
 					</div>
529 529
 					<div class="form-row">
530 530
 						<label for="parse_docblock">
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 			</div>
590 590
 			<!-- HTML text editor end -->
591 591
 		</div>
592
-		<?php if($modx->getManagerApi()->action == '108'): ?>
592
+		<?php if ($modx->getManagerApi()->action == '108'): ?>
593 593
 			<!-- Dependencies -->
594 594
 			<div class="tab-page" id="tabDepend">
595 595
 				<h2 class="tab"><?= $_lang['settings_dependencies'] ?></h2>
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 					$grd->columnHeaderClass = 'gridHeader';
624 624
 					$grd->itemClass = 'gridItem';
625 625
 					$grd->altItemClass = 'gridAltItem';
626
-					$grd->columns = $_lang['element_name'] . " ," . $_lang['type'];
626
+					$grd->columns = $_lang['element_name']." ,".$_lang['type'];
627 627
 					$grd->fields = "name,type";
628 628
 					echo $grd->render();
629 629
 					?>
@@ -636,13 +636,13 @@  discard block
 block discarded – undo
636 636
 			<h2 class="tab"><?= $_lang['access_permissions'] ?></h2>
637 637
 			<script type="text/javascript">tp.addTabPage(document.getElementById("tabPermissions"));</script>
638 638
 			<div class="container container-body">
639
-				<?php if($use_udperms == 1) : ?>
639
+				<?php if ($use_udperms == 1) : ?>
640 640
 					<?php
641 641
 					// fetch user access permissions for the module
642 642
 					$rs = $modx->getDatabase()->select('usergroup', $tbl_site_module_access, "module='{$id}'");
643 643
 					$groupsarray = $modx->getDatabase()->getColumn('usergroup', $rs);
644 644
 
645
-					if($modx->hasPermission('access_permissions')) {
645
+					if ($modx->hasPermission('access_permissions')) {
646 646
 						?>
647 647
 						<!-- User Group Access Permissions -->
648 648
 						<script type="text/javascript">
@@ -670,22 +670,22 @@  discard block
 block discarded – undo
670 670
 					}
671 671
 					$chk = '';
672 672
 					$rs = $modx->getDatabase()->select('name, id', $tbl_membergroup_names, '', 'name');
673
-					while($row = $modx->getDatabase()->getRow($rs)) {
673
+					while ($row = $modx->getDatabase()->getRow($rs)) {
674 674
 						$groupsarray = is_numeric($id) && $id > 0 ? $groupsarray : array();
675 675
 						$checked = in_array($row['id'], $groupsarray);
676
-						if($modx->hasPermission('access_permissions')) {
677
-							if($checked) {
676
+						if ($modx->hasPermission('access_permissions')) {
677
+							if ($checked) {
678 678
 								$notPublic = true;
679 679
 							}
680
-							$chks .= '<label><input type="checkbox" name="usrgroups[]" value="' . $row['id'] . '"' . ($checked ? ' checked="checked"' : '') . ' onclick="makePublic(false)" /> ' . $row['name'] . "</label><br />\n";
680
+							$chks .= '<label><input type="checkbox" name="usrgroups[]" value="'.$row['id'].'"'.($checked ? ' checked="checked"' : '').' onclick="makePublic(false)" /> '.$row['name']."</label><br />\n";
681 681
 						} else {
682
-							if($checked) {
683
-								$chks = '<input type="hidden" name="usrgroups[]"  value="' . $row['id'] . '" />' . "\n" . $chks;
682
+							if ($checked) {
683
+								$chks = '<input type="hidden" name="usrgroups[]"  value="'.$row['id'].'" />'."\n".$chks;
684 684
 							}
685 685
 						}
686 686
 					}
687
-					if($modx->hasPermission('access_permissions')) {
688
-						$chks = '<label><input type="checkbox" name="chkallgroups"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true)" /><span class="warning"> ' . $_lang['all_usr_groups'] . '</span></label><br />' . "\n" . $chks;
687
+					if ($modx->hasPermission('access_permissions')) {
688
+						$chks = '<label><input type="checkbox" name="chkallgroups"'.(!$notPublic ? ' checked="checked"' : '').' onclick="makePublic(true)" /><span class="warning"> '.$_lang['all_usr_groups'].'</span></label><br />'."\n".$chks;
689 689
 					}
690 690
 					echo $chks;
691 691
 					?>
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
 		<?php
707 707
 		// invoke OnModFormRender event
708 708
 		$evtOut = $modx->invokeEvent('OnModFormRender', array('id' => $id));
709
-		if(is_array($evtOut)) {
709
+		if (is_array($evtOut)) {
710 710
 			echo implode('', $evtOut);
711 711
 		}
712 712
 		?>
Please login to merge, or discard this patch.
manager/actions/access_permissions.dynamic.php 2 patches
Indentation   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  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('access_permissions')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 // Get table names (alphabetical)
@@ -18,24 +18,24 @@  discard block
 block discarded – undo
18 18
 // find all document groups, for the select :)
19 19
 $rs = $modx->getDatabase()->select('*', $tbl_documentgroup_names, '', 'name');
20 20
 if($modx->getDatabase()->getRecordCount($rs) < 1) {
21
-	$docgroupselector = '[no groups to add]';
21
+    $docgroupselector = '[no groups to add]';
22 22
 } else {
23
-	$docgroupselector = '<select name="docgroup">' . "\n";
24
-	while($row = $modx->getDatabase()->getRow($rs)) {
25
-		$docgroupselector .= "\t" . '<option value="' . $row['id'] . '">' . $row['name'] . "</option>\n";
26
-	}
27
-	$docgroupselector .= "</select>\n";
23
+    $docgroupselector = '<select name="docgroup">' . "\n";
24
+    while($row = $modx->getDatabase()->getRow($rs)) {
25
+        $docgroupselector .= "\t" . '<option value="' . $row['id'] . '">' . $row['name'] . "</option>\n";
26
+    }
27
+    $docgroupselector .= "</select>\n";
28 28
 }
29 29
 
30 30
 $rs = $modx->getDatabase()->select('*', $tbl_membergroup_names, '', 'name');
31 31
 if($modx->getDatabase()->getRecordCount($rs) < 1) {
32
-	$usrgroupselector = '[no user groups]';
32
+    $usrgroupselector = '[no user groups]';
33 33
 } else {
34
-	$usrgroupselector = '<select name="usergroup">' . "\n";
35
-	while($row = $modx->getDatabase()->getRow($rs)) {
36
-		$usrgroupselector .= "\t" . '<option value="' . $row['id'] . '">' . $row['name'] . "</option>\n";
37
-	}
38
-	$usrgroupselector .= "</select>\n";
34
+    $usrgroupselector = '<select name="usergroup">' . "\n";
35
+    while($row = $modx->getDatabase()->getRow($rs)) {
36
+        $usrgroupselector .= "\t" . '<option value="' . $row['id'] . '">' . $row['name'] . "</option>\n";
37
+    }
38
+    $usrgroupselector .= "</select>\n";
39 39
 }
40 40
 
41 41
 ?>
@@ -96,24 +96,24 @@  discard block
 block discarded – undo
96 96
 				</form>
97 97
 			</div>
98 98
 			<?php
99
-			$rs = $modx->getDatabase()->select('groupnames.*, users.id AS user_id, users.username user_name', $tbl_membergroup_names . ' AS groupnames
99
+            $rs = $modx->getDatabase()->select('groupnames.*, users.id AS user_id, users.username user_name', $tbl_membergroup_names . ' AS groupnames
100 100
 			LEFT JOIN ' . $tbl_member_groups . ' AS groups ON groups.user_group = groupnames.id
101 101
 			LEFT JOIN ' . $tbl_manager_users . ' AS users ON users.id = groups.member', '', 'groupnames.name, user_name');
102
-			if($modx->getDatabase()->getRecordCount($rs) < 1) {
103
-				?>
102
+            if($modx->getDatabase()->getRecordCount($rs) < 1) {
103
+                ?>
104 104
 				<div class="text-danger"><?= $_lang['no_groups_found'] ?></div>
105 105
 				<?php
106
-			} else {
107
-			?>
106
+            } else {
107
+            ?>
108 108
 			<div class="form-group">
109 109
 				<?php
110
-				$pid = '';
111
-				while($row = $modx->getDatabase()->getRow($rs)) {
112
-					if($pid != $row['id']) {
113
-						if($pid != '') {
114
-							echo '</div><div class="form-group">';
115
-						}
116
-						?>
110
+                $pid = '';
111
+                while($row = $modx->getDatabase()->getRow($rs)) {
112
+                    if($pid != $row['id']) {
113
+                        if($pid != '') {
114
+                            echo '</div><div class="form-group">';
115
+                        }
116
+                        ?>
117 117
 						<form method="post" action="index.php" name="accesspermissions">
118 118
 							<input type="hidden" name="a" value="41" />
119 119
 							<input type="hidden" name="groupid" value="<?= $row['id'] ?>" />
@@ -128,21 +128,21 @@  discard block
 block discarded – undo
128 128
 						</form>
129 129
 						<?= $_lang['access_permissions_users_in_group'] ?>
130 130
 						<?php
131
-					}
132
-					if(!$row['user_id']) {
133
-						?>
131
+                    }
132
+                    if(!$row['user_id']) {
133
+                        ?>
134 134
 						<i><?= $_lang['access_permissions_no_users_in_group'] ?></i>
135 135
 						<?php
136
-						$pid = $row['id'];
137
-						continue;
138
-					}
139
-					?>
136
+                        $pid = $row['id'];
137
+                        continue;
138
+                    }
139
+                    ?>
140 140
 					<?= ($pid == $row['id'] ? ', ' : '') ?><a href="index.php?a=12&id=<?= $row['user_id'] ?>"><?= $row['user_name'] ?></a>
141 141
 					<?php
142
-					$pid = $row['id'];
143
-				}
144
-				}
145
-				?>
142
+                    $pid = $row['id'];
143
+                }
144
+                }
145
+                ?>
146 146
 			</div>
147 147
 		</div>
148 148
 	</div>
@@ -167,24 +167,24 @@  discard block
 block discarded – undo
167 167
 				</form>
168 168
 			</div>
169 169
 			<?php
170
-			$rs = $modx->getDatabase()->select('dgnames.id, dgnames.name, sc.id AS doc_id, sc.pagetitle AS doc_title', $tbl_documentgroup_names . ' AS dgnames
170
+            $rs = $modx->getDatabase()->select('dgnames.id, dgnames.name, sc.id AS doc_id, sc.pagetitle AS doc_title', $tbl_documentgroup_names . ' AS dgnames
171 171
 			LEFT JOIN ' . $tbl_document_groups . ' AS dg ON dg.document_group = dgnames.id
172 172
 			LEFT JOIN ' . $tbl_site_content . ' AS sc ON sc.id = dg.document', '', 'dgnames.name, sc.id');
173
-			if($modx->getDatabase()->getRecordCount($rs) < 1) {
174
-				?>
173
+            if($modx->getDatabase()->getRecordCount($rs) < 1) {
174
+                ?>
175 175
 				<div class="text-danger"><?= $_lang['no_groups_found'] ?></div>
176 176
 				<?php
177
-			} else {
178
-			?>
177
+            } else {
178
+            ?>
179 179
 			<div class="form-group">
180 180
 				<?php
181
-				$pid = '';
182
-				while($row = $modx->getDatabase()->getRow($rs)) {
183
-					if($pid != $row['id']) {
184
-						if($pid != '') {
185
-							echo '</div><div class="form-group">';
186
-						}
187
-						?>
181
+                $pid = '';
182
+                while($row = $modx->getDatabase()->getRow($rs)) {
183
+                    if($pid != $row['id']) {
184
+                        if($pid != '') {
185
+                            echo '</div><div class="form-group">';
186
+                        }
187
+                        ?>
188 188
 						<form method="post" action="index.php" name="accesspermissions">
189 189
 							<input type="hidden" name="a" value="41" />
190 190
 							<input type="hidden" name="groupid" value="<?= $row['id'] ?>" />
@@ -199,21 +199,21 @@  discard block
 block discarded – undo
199 199
 						</form>
200 200
 						<?= $_lang['access_permissions_resources_in_group'] ?>
201 201
 						<?php
202
-					}
203
-					if(!$row['doc_id']) {
204
-						?>
202
+                    }
203
+                    if(!$row['doc_id']) {
204
+                        ?>
205 205
 						<i><?= $_lang['access_permissions_no_resources_in_group'] ?></i>
206 206
 						<?php
207
-						$pid = $row['id'];
208
-						continue;
209
-					}
210
-					?>
207
+                        $pid = $row['id'];
208
+                        continue;
209
+                    }
210
+                    ?>
211 211
 					<?= ($pid == $row['id'] ? ', ' : '') ?><a href="index.php?a=3&id=<?= $row['doc_id'] ?>" title="<?= $modx->getPhpCompat()->htmlspecialchars($row['doc_title']) ?>"><?= $row['doc_id'] ?></a>
212 212
 					<?php
213
-					$pid = $row['id'];
214
-				}
215
-				}
216
-				?>
213
+                    $pid = $row['id'];
214
+                }
215
+                }
216
+                ?>
217 217
 			</div>
218 218
 		</div>
219 219
 	</div>
@@ -225,16 +225,16 @@  discard block
 block discarded – undo
225 225
 		<div class="container container-body">
226 226
 			<p class="element-edit-message-tab alert alert-warning"><?= $_lang['access_permissions_links_tab'] ?></p>
227 227
 			<?php
228
-			// User/Document Group Links
229
-			$rs = $modx->getDatabase()->select('groupnames.*, groupacc.id AS link_id, dgnames.id AS dg_id, dgnames.name AS dg_name', $tbl_membergroup_names . ' AS groupnames
228
+            // User/Document Group Links
229
+            $rs = $modx->getDatabase()->select('groupnames.*, groupacc.id AS link_id, dgnames.id AS dg_id, dgnames.name AS dg_name', $tbl_membergroup_names . ' AS groupnames
230 230
 			LEFT JOIN ' . $tbl_membergroup_access . ' AS groupacc ON groupacc.membergroup = groupnames.id
231 231
 			LEFT JOIN ' . $tbl_documentgroup_names . ' AS dgnames ON dgnames.id = groupacc.documentgroup', '', 'name, dg_name');
232
-			if($modx->getDatabase()->getRecordCount($rs) < 1) {
233
-				?>
232
+            if($modx->getDatabase()->getRecordCount($rs) < 1) {
233
+                ?>
234 234
 				<div class="text-danger"><?= $_lang['no_groups_found'] ?></div>
235 235
 				<?php
236
-			} else {
237
-				?>
236
+            } else {
237
+                ?>
238 238
 				<div class="form-group">
239 239
 					<b><?= $_lang["access_permissions_group_link"] ?></b>
240 240
 					<form method="post" action="index.php" name="accesspermissions">
@@ -250,38 +250,38 @@  discard block
 block discarded – undo
250 250
 				<hr>
251 251
 				<ul>
252 252
 					<?php
253
-					$pid = '';
254
-					while($row = $modx->getDatabase()->getRow($rs)) {
255
-						if($row['id'] != $pid) {
256
-							if($pid != '') {
257
-								echo '</ul></li>';
258
-							} // close previous one
259
-							?>
253
+                    $pid = '';
254
+                    while($row = $modx->getDatabase()->getRow($rs)) {
255
+                        if($row['id'] != $pid) {
256
+                            if($pid != '') {
257
+                                echo '</ul></li>';
258
+                            } // close previous one
259
+                            ?>
260 260
 							<li><b><?= $row['name'] ?></b></li>
261 261
 							<?php
262
-							if(!$row['dg_id']) {
263
-								echo '<i>' . $_lang['no_groups_found'] . '</i></li>';
264
-								$pid = '';
265
-								continue;
266
-							} else {
267
-								echo '<ul>';
268
-							}
269
-						}
270
-						if(!$row['dg_id']) {
271
-							continue;
272
-						}
273
-						?>
262
+                            if(!$row['dg_id']) {
263
+                                echo '<i>' . $_lang['no_groups_found'] . '</i></li>';
264
+                                $pid = '';
265
+                                continue;
266
+                            } else {
267
+                                echo '<ul>';
268
+                            }
269
+                        }
270
+                        if(!$row['dg_id']) {
271
+                            continue;
272
+                        }
273
+                        ?>
274 274
 						<li><?= $row['dg_name'] ?>
275 275
 							<small><i>(<a class="text-danger" href="index.php?a=41&coupling=<?= $row['link_id'] ?>&operation=remove_document_group_from_user_group"><?= $_lang['remove'] ?></a>)</i></small>
276 276
 						</li>
277 277
 						<?php
278
-						$pid = $row['id'];
279
-					}
280
-					?>
278
+                        $pid = $row['id'];
279
+                    }
280
+                    ?>
281 281
 				</ul>
282 282
 				<?php
283
-			}
284
-			?>
283
+            }
284
+            ?>
285 285
 		</div>
286 286
 	</div>
287 287
 
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
 	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5
-if(!$modx->hasPermission('access_permissions')) {
5
+if (!$modx->hasPermission('access_permissions')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
@@ -17,23 +17,23 @@  discard block
 block discarded – undo
17 17
 
18 18
 // find all document groups, for the select :)
19 19
 $rs = $modx->getDatabase()->select('*', $tbl_documentgroup_names, '', 'name');
20
-if($modx->getDatabase()->getRecordCount($rs) < 1) {
20
+if ($modx->getDatabase()->getRecordCount($rs) < 1) {
21 21
 	$docgroupselector = '[no groups to add]';
22 22
 } else {
23
-	$docgroupselector = '<select name="docgroup">' . "\n";
24
-	while($row = $modx->getDatabase()->getRow($rs)) {
25
-		$docgroupselector .= "\t" . '<option value="' . $row['id'] . '">' . $row['name'] . "</option>\n";
23
+	$docgroupselector = '<select name="docgroup">'."\n";
24
+	while ($row = $modx->getDatabase()->getRow($rs)) {
25
+		$docgroupselector .= "\t".'<option value="'.$row['id'].'">'.$row['name']."</option>\n";
26 26
 	}
27 27
 	$docgroupselector .= "</select>\n";
28 28
 }
29 29
 
30 30
 $rs = $modx->getDatabase()->select('*', $tbl_membergroup_names, '', 'name');
31
-if($modx->getDatabase()->getRecordCount($rs) < 1) {
31
+if ($modx->getDatabase()->getRecordCount($rs) < 1) {
32 32
 	$usrgroupselector = '[no user groups]';
33 33
 } else {
34
-	$usrgroupselector = '<select name="usergroup">' . "\n";
35
-	while($row = $modx->getDatabase()->getRow($rs)) {
36
-		$usrgroupselector .= "\t" . '<option value="' . $row['id'] . '">' . $row['name'] . "</option>\n";
34
+	$usrgroupselector = '<select name="usergroup">'."\n";
35
+	while ($row = $modx->getDatabase()->getRow($rs)) {
36
+		$usrgroupselector .= "\t".'<option value="'.$row['id'].'">'.$row['name']."</option>\n";
37 37
 	}
38 38
 	$usrgroupselector .= "</select>\n";
39 39
 }
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	<div class="alert alert-info"><?= $_lang['access_permissions_introtext'] ?></div>
70 70
 </div>
71 71
 
72
-<div class="container"><?= ($use_udperms != 1 ? '<div class="alert alert-danger">' . $_lang['access_permissions_off'] . '</div>' : '') ?></div>
72
+<div class="container"><?= ($use_udperms != 1 ? '<div class="alert alert-danger">'.$_lang['access_permissions_off'].'</div>' : '') ?></div>
73 73
 
74 74
 <div class="tab-pane" id="uapPane">
75 75
 	<script type="text/javascript">
@@ -96,10 +96,10 @@  discard block
 block discarded – undo
96 96
 				</form>
97 97
 			</div>
98 98
 			<?php
99
-			$rs = $modx->getDatabase()->select('groupnames.*, users.id AS user_id, users.username user_name', $tbl_membergroup_names . ' AS groupnames
100
-			LEFT JOIN ' . $tbl_member_groups . ' AS groups ON groups.user_group = groupnames.id
101
-			LEFT JOIN ' . $tbl_manager_users . ' AS users ON users.id = groups.member', '', 'groupnames.name, user_name');
102
-			if($modx->getDatabase()->getRecordCount($rs) < 1) {
99
+			$rs = $modx->getDatabase()->select('groupnames.*, users.id AS user_id, users.username user_name', $tbl_membergroup_names.' AS groupnames
100
+			LEFT JOIN ' . $tbl_member_groups.' AS groups ON groups.user_group = groupnames.id
101
+			LEFT JOIN ' . $tbl_manager_users.' AS users ON users.id = groups.member', '', 'groupnames.name, user_name');
102
+			if ($modx->getDatabase()->getRecordCount($rs) < 1) {
103 103
 				?>
104 104
 				<div class="text-danger"><?= $_lang['no_groups_found'] ?></div>
105 105
 				<?php
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
 			<div class="form-group">
109 109
 				<?php
110 110
 				$pid = '';
111
-				while($row = $modx->getDatabase()->getRow($rs)) {
112
-					if($pid != $row['id']) {
113
-						if($pid != '') {
111
+				while ($row = $modx->getDatabase()->getRow($rs)) {
112
+					if ($pid != $row['id']) {
113
+						if ($pid != '') {
114 114
 							echo '</div><div class="form-group">';
115 115
 						}
116 116
 						?>
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 						<?= $_lang['access_permissions_users_in_group'] ?>
130 130
 						<?php
131 131
 					}
132
-					if(!$row['user_id']) {
132
+					if (!$row['user_id']) {
133 133
 						?>
134 134
 						<i><?= $_lang['access_permissions_no_users_in_group'] ?></i>
135 135
 						<?php
@@ -167,10 +167,10 @@  discard block
 block discarded – undo
167 167
 				</form>
168 168
 			</div>
169 169
 			<?php
170
-			$rs = $modx->getDatabase()->select('dgnames.id, dgnames.name, sc.id AS doc_id, sc.pagetitle AS doc_title', $tbl_documentgroup_names . ' AS dgnames
171
-			LEFT JOIN ' . $tbl_document_groups . ' AS dg ON dg.document_group = dgnames.id
172
-			LEFT JOIN ' . $tbl_site_content . ' AS sc ON sc.id = dg.document', '', 'dgnames.name, sc.id');
173
-			if($modx->getDatabase()->getRecordCount($rs) < 1) {
170
+			$rs = $modx->getDatabase()->select('dgnames.id, dgnames.name, sc.id AS doc_id, sc.pagetitle AS doc_title', $tbl_documentgroup_names.' AS dgnames
171
+			LEFT JOIN ' . $tbl_document_groups.' AS dg ON dg.document_group = dgnames.id
172
+			LEFT JOIN ' . $tbl_site_content.' AS sc ON sc.id = dg.document', '', 'dgnames.name, sc.id');
173
+			if ($modx->getDatabase()->getRecordCount($rs) < 1) {
174 174
 				?>
175 175
 				<div class="text-danger"><?= $_lang['no_groups_found'] ?></div>
176 176
 				<?php
@@ -179,9 +179,9 @@  discard block
 block discarded – undo
179 179
 			<div class="form-group">
180 180
 				<?php
181 181
 				$pid = '';
182
-				while($row = $modx->getDatabase()->getRow($rs)) {
183
-					if($pid != $row['id']) {
184
-						if($pid != '') {
182
+				while ($row = $modx->getDatabase()->getRow($rs)) {
183
+					if ($pid != $row['id']) {
184
+						if ($pid != '') {
185 185
 							echo '</div><div class="form-group">';
186 186
 						}
187 187
 						?>
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 						<?= $_lang['access_permissions_resources_in_group'] ?>
201 201
 						<?php
202 202
 					}
203
-					if(!$row['doc_id']) {
203
+					if (!$row['doc_id']) {
204 204
 						?>
205 205
 						<i><?= $_lang['access_permissions_no_resources_in_group'] ?></i>
206 206
 						<?php
@@ -226,10 +226,10 @@  discard block
 block discarded – undo
226 226
 			<p class="element-edit-message-tab alert alert-warning"><?= $_lang['access_permissions_links_tab'] ?></p>
227 227
 			<?php
228 228
 			// User/Document Group Links
229
-			$rs = $modx->getDatabase()->select('groupnames.*, groupacc.id AS link_id, dgnames.id AS dg_id, dgnames.name AS dg_name', $tbl_membergroup_names . ' AS groupnames
230
-			LEFT JOIN ' . $tbl_membergroup_access . ' AS groupacc ON groupacc.membergroup = groupnames.id
231
-			LEFT JOIN ' . $tbl_documentgroup_names . ' AS dgnames ON dgnames.id = groupacc.documentgroup', '', 'name, dg_name');
232
-			if($modx->getDatabase()->getRecordCount($rs) < 1) {
229
+			$rs = $modx->getDatabase()->select('groupnames.*, groupacc.id AS link_id, dgnames.id AS dg_id, dgnames.name AS dg_name', $tbl_membergroup_names.' AS groupnames
230
+			LEFT JOIN ' . $tbl_membergroup_access.' AS groupacc ON groupacc.membergroup = groupnames.id
231
+			LEFT JOIN ' . $tbl_documentgroup_names.' AS dgnames ON dgnames.id = groupacc.documentgroup', '', 'name, dg_name');
232
+			if ($modx->getDatabase()->getRecordCount($rs) < 1) {
233 233
 				?>
234 234
 				<div class="text-danger"><?= $_lang['no_groups_found'] ?></div>
235 235
 				<?php
@@ -251,23 +251,23 @@  discard block
 block discarded – undo
251 251
 				<ul>
252 252
 					<?php
253 253
 					$pid = '';
254
-					while($row = $modx->getDatabase()->getRow($rs)) {
255
-						if($row['id'] != $pid) {
256
-							if($pid != '') {
254
+					while ($row = $modx->getDatabase()->getRow($rs)) {
255
+						if ($row['id'] != $pid) {
256
+							if ($pid != '') {
257 257
 								echo '</ul></li>';
258 258
 							} // close previous one
259 259
 							?>
260 260
 							<li><b><?= $row['name'] ?></b></li>
261 261
 							<?php
262
-							if(!$row['dg_id']) {
263
-								echo '<i>' . $_lang['no_groups_found'] . '</i></li>';
262
+							if (!$row['dg_id']) {
263
+								echo '<i>'.$_lang['no_groups_found'].'</i></li>';
264 264
 								$pid = '';
265 265
 								continue;
266 266
 							} else {
267 267
 								echo '<ul>';
268 268
 							}
269 269
 						}
270
-						if(!$row['dg_id']) {
270
+						if (!$row['dg_id']) {
271 271
 							continue;
272 272
 						}
273 273
 						?>
Please login to merge, or discard this patch.
manager/actions/welcome.static.php 3 patches
Indentation   +144 added lines, -144 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  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
 
6 6
 unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes
7 7
 
8 8
 if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
9
-	// seems to be a new install - send the user to the configuration page
10
-	exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
9
+    // seems to be a new install - send the user to the configuration page
10
+    exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
11 11
 }
12 12
 
13 13
 // set placeholders
@@ -17,93 +17,93 @@  discard block
 block discarded – undo
17 17
 
18 18
 // setup message info
19 19
 if($modx->hasPermission('messages')) {
20
-	include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php');
21
-	$_SESSION['nrtotalmessages'] = $nrtotalmessages;
22
-	$_SESSION['nrnewmessages'] = $nrnewmessages;
23
-
24
-	$msg = array();
25
-	$msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']);
26
-	$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : '';
27
-	$msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold">&nbsp;<a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages);
28
-	$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0';
29
-	$welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages);
30
-	$msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages);
31
-	$ph['MessageInfo'] = implode("\n", $msg);
20
+    include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php');
21
+    $_SESSION['nrtotalmessages'] = $nrtotalmessages;
22
+    $_SESSION['nrnewmessages'] = $nrnewmessages;
23
+
24
+    $msg = array();
25
+    $msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']);
26
+    $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : '';
27
+    $msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold">&nbsp;<a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages);
28
+    $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0';
29
+    $welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages);
30
+    $msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages);
31
+    $ph['MessageInfo'] = implode("\n", $msg);
32 32
 }
33 33
 
34 34
 $iconTpl = $modx->getChunk('manager#welcome\WrapIcon');
35 35
 // setup icons
36 36
 if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
37
-	$icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]';
38
-	$ph['SecurityIcon'] = sprintf($iconTpl,$icon, 75);
37
+    $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]';
38
+    $ph['SecurityIcon'] = sprintf($iconTpl,$icon, 75);
39 39
 }
40 40
 if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
41
-	$icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]';
42
-	$ph['WebUserIcon'] = sprintf($iconTpl,$icon, 99);
41
+    $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]';
42
+    $ph['WebUserIcon'] = sprintf($iconTpl,$icon, 99);
43 43
 }
44 44
 if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
45
-	$icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]';
46
-	$ph['ModulesIcon'] = sprintf($iconTpl,$icon, 106);
45
+    $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]';
46
+    $ph['ModulesIcon'] = sprintf($iconTpl,$icon, 106);
47 47
 }
48 48
 if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
49
-	$icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]';
50
-	$ph['ResourcesIcon'] = sprintf($iconTpl,$icon, 76);
49
+    $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]';
50
+    $ph['ResourcesIcon'] = sprintf($iconTpl,$icon, 76);
51 51
 }
52 52
 if($modx->hasPermission('bk_manager')) {
53
-	$icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]';
54
-	$ph['BackupIcon'] = sprintf($iconTpl,$icon, 93);
53
+    $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]';
54
+    $ph['BackupIcon'] = sprintf($iconTpl,$icon, 93);
55 55
 }
56 56
 if($modx->hasPermission('help')) {
57
-	$icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]';
58
-	$ph['HelpIcon'] = sprintf($iconTpl,$icon, 9);
57
+    $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]';
58
+    $ph['HelpIcon'] = sprintf($iconTpl,$icon, 9);
59 59
 }
60 60
 
61 61
 if($modx->hasPermission('new_document')) {
62
-	$icon = '<i class="[&icons_resource_large&]"></i>[%add_resource%]';
63
-	$ph['ResourceIcon'] = sprintf($iconTpl,$icon, 4);
64
-	$icon = '<i class="[&icons_weblink_large&]"></i>[%add_weblink%]';
65
-	$ph['WeblinkIcon'] = sprintf($iconTpl,$icon, 72);
62
+    $icon = '<i class="[&icons_resource_large&]"></i>[%add_resource%]';
63
+    $ph['ResourceIcon'] = sprintf($iconTpl,$icon, 4);
64
+    $icon = '<i class="[&icons_weblink_large&]"></i>[%add_weblink%]';
65
+    $ph['WeblinkIcon'] = sprintf($iconTpl,$icon, 72);
66 66
 }
67 67
 if($modx->hasPermission('assets_images')) {
68
-	$icon = '<i class="[&icons_images_large&]"></i>[%images_management%]';
69
-	$ph['ImagesIcon'] = sprintf($iconTpl,$icon, 72);
68
+    $icon = '<i class="[&icons_images_large&]"></i>[%images_management%]';
69
+    $ph['ImagesIcon'] = sprintf($iconTpl,$icon, 72);
70 70
 }
71 71
 if($modx->hasPermission('assets_files')) {
72
-	$icon = '<i class="[&icons_files_large&]"></i>[%files_management%]';
73
-	$ph['FilesIcon'] = sprintf($iconTpl,$icon, 72);
72
+    $icon = '<i class="[&icons_files_large&]"></i>[%files_management%]';
73
+    $ph['FilesIcon'] = sprintf($iconTpl,$icon, 72);
74 74
 }
75 75
 if($modx->hasPermission('change_password')) {
76
-	$icon = '<i class="[&icons_password_large&]"></i>[%change_password%]';
77
-	$ph['PasswordIcon'] = sprintf($iconTpl,$icon, 28);
76
+    $icon = '<i class="[&icons_password_large&]"></i>[%change_password%]';
77
+    $ph['PasswordIcon'] = sprintf($iconTpl,$icon, 28);
78 78
 }
79 79
 $icon = '<i class="[&icons_logout_large&]"></i>[%logout%]';
80 80
 $ph['LogoutIcon'] = sprintf($iconTpl,$icon, 8);
81 81
 
82 82
 // do some config checks
83 83
 if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
84
-	include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php');
85
-	if($config_check_results != $_lang['configcheck_ok']) {
86
-		$ph['config_check_results'] = $config_check_results;
87
-		$ph['config_display'] = 'block';
88
-	} else {
89
-		$ph['config_display'] = 'none';
90
-	}
84
+    include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php');
85
+    if($config_check_results != $_lang['configcheck_ok']) {
86
+        $ph['config_check_results'] = $config_check_results;
87
+        $ph['config_display'] = 'block';
88
+    } else {
89
+        $ph['config_display'] = 'none';
90
+    }
91 91
 } else {
92
-	$ph['config_display'] = 'none';
92
+    $ph['config_display'] = 'none';
93 93
 }
94 94
 
95 95
 // Check logout-reminder
96 96
 if(isset($_SESSION['show_logout_reminder'])) {
97
-	switch($_SESSION['show_logout_reminder']['type']) {
98
-		case 'logout_reminder':
99
-			$date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly');
100
-			$ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
101
-			break;
102
-	}
103
-	$ph['show_logout_reminder'] = 'block';
104
-	unset($_SESSION['show_logout_reminder']);
97
+    switch($_SESSION['show_logout_reminder']['type']) {
98
+        case 'logout_reminder':
99
+            $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly');
100
+            $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
101
+            break;
102
+    }
103
+    $ph['show_logout_reminder'] = 'block';
104
+    unset($_SESSION['show_logout_reminder']);
105 105
 } else {
106
-	$ph['show_logout_reminder'] = 'none';
106
+    $ph['show_logout_reminder'] = 'none';
107 107
 }
108 108
 
109 109
 // Check multiple sessions
@@ -151,11 +151,11 @@  discard block
 block discarded – undo
151 151
 $nrnewmessages = '<span class="text-danger">' . $_SESSION['nrnewmessages'] . '</span>';
152 152
 
153 153
 $ph['UserInfo'] = $modx->parseText($tpl, array(
154
-	'username' => $modx->getLoginUserName(),
155
-	'role' => $_SESSION['mgrPermissions']['name'],
156
-	'lastlogin' => $modx->toDateFormat($_SESSION['mgrLastlogin'] + $server_offset_time),
157
-	'logincount' => $_SESSION['mgrLogincount'] + 1,
158
-	'msginfo' => sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages)
154
+    'username' => $modx->getLoginUserName(),
155
+    'role' => $_SESSION['mgrPermissions']['name'],
156
+    'lastlogin' => $modx->toDateFormat($_SESSION['mgrLastlogin'] + $server_offset_time),
157
+    'logincount' => $_SESSION['mgrLogincount'] + 1,
158
+    'msginfo' => sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages)
159 159
 ));
160 160
 
161 161
 $from = array();
@@ -164,13 +164,13 @@  discard block
 block discarded – undo
164 164
 $rs = $modx->getDatabase()->select('*', $from, '', 'username ASC, au.sid ASC');
165 165
 
166 166
 if($modx->getDatabase()->getRecordCount($rs) < 1) {
167
-	$html = '<p>[%no_active_users_found%]</p>';
167
+    $html = '<p>[%no_active_users_found%]</p>';
168 168
 } else {
169
-	include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
170
-	$now = $_SERVER['REQUEST_TIME'] + $server_offset_time;
171
-	$ph['now'] = strftime('%H:%M:%S', $now);
172
-	$timetocheck = ($now - (60 * 20)); //+$server_offset_time;
173
-	$html = '
169
+    include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
170
+    $now = $_SERVER['REQUEST_TIME'] + $server_offset_time;
171
+    $ph['now'] = strftime('%H:%M:%S', $now);
172
+    $timetocheck = ($now - (60 * 20)); //+$server_offset_time;
173
+    $html = '
174 174
 	<div class="card-body">
175 175
 		[%onlineusers_message%] 
176 176
 		<b>[+now+]</b>):
@@ -188,33 +188,33 @@  discard block
 block discarded – undo
188 188
 	</thead>
189 189
 	<tbody>';
190 190
 
191
-	$userList = array();
192
-	$userCount = array();
193
-	// Create userlist with session-count first before output
194
-	while($activeusers = $modx->getDatabase()->getRow($rs)) {
195
-		$userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1;
196
-
197
-		$idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : '';
198
-		$webicon = $activeusers['internalKey'] < 0 ? '<img src="[&tree_globe&]" alt="Web user" />&nbsp;' : '';
199
-		$ip = $activeusers['ip'] === '::1' ? '127.0.0.1' : $activeusers['ip'];
200
-		$currentaction = getAction($activeusers['action'], $activeusers['id']);
201
-		$userList[] = array(
202
-			$idle,
203
-			'',
204
-			$activeusers['username'],
205
-			$webicon,
206
-			abs($activeusers['internalKey']),
207
-			$ip,
208
-			strftime('%H:%M:%S', $activeusers['lasthit'] + $server_offset_time),
209
-			$currentaction
210
-		);
211
-	}
212
-	foreach($userList as $params) {
213
-		$params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : '';
214
-		$html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
215
-	}
216
-
217
-	$html .= '
191
+    $userList = array();
192
+    $userCount = array();
193
+    // Create userlist with session-count first before output
194
+    while($activeusers = $modx->getDatabase()->getRow($rs)) {
195
+        $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1;
196
+
197
+        $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : '';
198
+        $webicon = $activeusers['internalKey'] < 0 ? '<img src="[&tree_globe&]" alt="Web user" />&nbsp;' : '';
199
+        $ip = $activeusers['ip'] === '::1' ? '127.0.0.1' : $activeusers['ip'];
200
+        $currentaction = getAction($activeusers['action'], $activeusers['id']);
201
+        $userList[] = array(
202
+            $idle,
203
+            '',
204
+            $activeusers['username'],
205
+            $webicon,
206
+            abs($activeusers['internalKey']),
207
+            $ip,
208
+            strftime('%H:%M:%S', $activeusers['lasthit'] + $server_offset_time),
209
+            $currentaction
210
+        );
211
+    }
212
+    foreach($userList as $params) {
213
+        $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : '';
214
+        $html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
215
+    }
216
+
217
+    $html .= '
218 218
 	</tbody>
219 219
 	</table>
220 220
 </div>
@@ -255,17 +255,17 @@  discard block
 block discarded – undo
255 255
 // invoke event OnManagerWelcomePrerender
256 256
 $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender');
257 257
 if(is_array($evtOut)) {
258
-	$output = implode('', $evtOut);
259
-	$ph['OnManagerWelcomePrerender'] = $output;
258
+    $output = implode('', $evtOut);
259
+    $ph['OnManagerWelcomePrerender'] = $output;
260 260
 }
261 261
 
262 262
 $widgets['welcome'] = array(
263
-	'menuindex' => '10',
264
-	'id' => 'welcome',
265
-	'cols' => 'col-lg-6',
266
-	'icon' => 'fa-home',
267
-	'title' => '[%welcome_title%]',
268
-	'body' => '
263
+    'menuindex' => '10',
264
+    'id' => 'welcome',
265
+    'cols' => 'col-lg-6',
266
+    'icon' => 'fa-home',
267
+    'title' => '[%welcome_title%]',
268
+    'body' => '
269 269
 				<div class="wm_buttons card-body"> 
270 270
 					<!--@IF:[[#hasPermission?key=new_document]]--> 
271 271
 					<span class="wm_button">
@@ -339,25 +339,25 @@  discard block
 block discarded – undo
339 339
 					</table>
340 340
 				</div>
341 341
 		',
342
-	'hide'=>'0'
342
+    'hide'=>'0'
343 343
 );
344 344
 $widgets['onlineinfo'] = array(
345
-	'menuindex' => '20',
346
-	'id' => 'onlineinfo',
347
-	'cols' => 'col-lg-6',
348
-	'icon' => 'fa-user',
349
-	'title' => '[%onlineusers_title%]',
350
-	'body' => '<div class="userstable">[+OnlineInfo+]</div>',
351
-	'hide'=>'0'
345
+    'menuindex' => '20',
346
+    'id' => 'onlineinfo',
347
+    'cols' => 'col-lg-6',
348
+    'icon' => 'fa-user',
349
+    'title' => '[%onlineusers_title%]',
350
+    'body' => '<div class="userstable">[+OnlineInfo+]</div>',
351
+    'hide'=>'0'
352 352
 );
353 353
 $widgets['recentinfo'] = array(
354
-	'menuindex' => '30',
355
-	'id' => 'modxrecent_widget',
356
-	'cols' => 'col-sm-12',
357
-	'icon' => 'fa-pencil-square-o',
358
-	'title' => '[%activity_title%]',
359
-	'body' => '<div class="widget-stage">[+RecentInfo+]</div>',
360
-	'hide'=>'0'
354
+    'menuindex' => '30',
355
+    'id' => 'modxrecent_widget',
356
+    'cols' => 'col-sm-12',
357
+    'icon' => 'fa-pencil-square-o',
358
+    'title' => '[%activity_title%]',
359
+    'body' => '<div class="widget-stage">[+RecentInfo+]</div>',
360
+    'hide'=>'0'
361 361
 );
362 362
 if ($modx->config['rss_url_news']) {
363 363
     $widgets['news'] = array(
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 // invoke OnManagerWelcomeHome event
386 386
 $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
387 387
 if(is_array($sitewidgets)) {
388
-	$newwidgets = array();
388
+    $newwidgets = array();
389 389
     foreach($sitewidgets as $widget){
390 390
         $newwidgets = array_merge($newwidgets, unserialize($widget));
391 391
     }
@@ -393,21 +393,21 @@  discard block
 block discarded – undo
393 393
 }
394 394
 
395 395
 usort($widgets, function ($a, $b) {
396
-	return $a['menuindex'] - $b['menuindex'];
396
+    return $a['menuindex'] - $b['menuindex'];
397 397
 });
398 398
 
399 399
 $tpl = $modx->getChunk('manager#welcome\Widget');
400 400
 $output = '';
401 401
 foreach($widgets as $widget) {
402
-	if ($widget['hide'] != '1'){
403
-		$output .= $modx->parseText($tpl, $widget);
404
-	}
402
+    if ($widget['hide'] != '1'){
403
+        $output .= $modx->parseText($tpl, $widget);
404
+    }
405 405
 }
406 406
 $ph['widgets'] = $output;
407 407
 
408 408
 // load template
409 409
 if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
410
-	$modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl';
410
+    $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl';
411 411
 }
412 412
 
413 413
 $target = $modx->config['manager_welcome_tpl'];
@@ -415,27 +415,27 @@  discard block
 block discarded – undo
415 415
 $target = $modx->mergeSettingsContent($target);
416 416
 
417 417
 if(substr($target, 0, 1) === '@') {
418
-	if(substr($target, 0, 6) === '@CHUNK') {
419
-		$content = $modx->getChunk(trim(substr($target, 7)));
420
-	} elseif(substr($target, 0, 5) === '@FILE') {
421
-		$content = file_get_contents(trim(substr($target, 6)));
422
-	} else {
423
-		$content = '';
424
-	}
418
+    if(substr($target, 0, 6) === '@CHUNK') {
419
+        $content = $modx->getChunk(trim(substr($target, 7)));
420
+    } elseif(substr($target, 0, 5) === '@FILE') {
421
+        $content = file_get_contents(trim(substr($target, 6)));
422
+    } else {
423
+        $content = '';
424
+    }
425 425
 } else {
426
-	$chunk = $modx->getChunk($target);
427
-	if($chunk !== false && !empty($chunk)) {
428
-		$content = $chunk;
429
-	} elseif(is_file(MODX_BASE_PATH . $target)) {
430
-		$content = file_get_contents(MODX_BASE_PATH . $target);
431
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
432
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl');
433
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible
434
-	{
435
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
436
-	} else {
437
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl');
438
-	}
426
+    $chunk = $modx->getChunk($target);
427
+    if($chunk !== false && !empty($chunk)) {
428
+        $content = $chunk;
429
+    } elseif(is_file(MODX_BASE_PATH . $target)) {
430
+        $content = file_get_contents(MODX_BASE_PATH . $target);
431
+    } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
432
+        $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl');
433
+    } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible
434
+    {
435
+        $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
436
+    } else {
437
+        $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl');
438
+    }
439 439
 }
440 440
 
441 441
 // merge placeholders
@@ -443,8 +443,8 @@  discard block
 block discarded – undo
443 443
 $content = $modx->mergeSettingsContent($content);
444 444
 $content = $modx->parseText($content, $ph);
445 445
 if(strpos($content, '[+') !== false) {
446
-	$modx->toPlaceholders($ph);
447
-	$content = $modx->mergePlaceholderContent($content);
446
+    $modx->toPlaceholders($ph);
447
+    $content = $modx->mergePlaceholderContent($content);
448 448
 }
449 449
 $content = $modx->parseDocumentSource($content);
450 450
 $content = $modx->parseText($content, $_lang, '[%', '%]');
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 $content = $modx->cleanUpMODXTags($content); //cleanup
453 453
 
454 454
 if($js = $modx->getRegisteredClientScripts()) {
455
-	$content .= $js;
455
+    $content .= $js;
456 456
 }
457 457
 
458 458
 echo $content;
Please login to merge, or discard this patch.
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  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
 unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes
7 7
 
8
-if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
8
+if ($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
9 9
 	// seems to be a new install - send the user to the configuration page
10 10
 	exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
11 11
 }
@@ -16,16 +16,16 @@  discard block
 block discarded – undo
16 16
 $_SESSION['nrnewmessages'] = 0;
17 17
 
18 18
 // setup message info
19
-if($modx->hasPermission('messages')) {
20
-	include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php');
19
+if ($modx->hasPermission('messages')) {
20
+	include_once(MODX_MANAGER_PATH.'includes/messageCount.inc.php');
21 21
 	$_SESSION['nrtotalmessages'] = $nrtotalmessages;
22 22
 	$_SESSION['nrnewmessages'] = $nrnewmessages;
23 23
 
24 24
 	$msg = array();
25 25
 	$msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']);
26
-	$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : '';
26
+	$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">'.$_SESSION['nrnewmessages'].'</span>)' : '';
27 27
 	$msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold">&nbsp;<a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages);
28
-	$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0';
28
+	$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">'.$_SESSION['nrnewmessages'].'</span>' : '0';
29 29
 	$welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages);
30 30
 	$msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages);
31 31
 	$ph['MessageInfo'] = implode("\n", $msg);
@@ -33,56 +33,56 @@  discard block
 block discarded – undo
33 33
 
34 34
 $iconTpl = $modx->getChunk('manager#welcome\WrapIcon');
35 35
 // setup icons
36
-if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
36
+if ($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
37 37
 	$icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]';
38
-	$ph['SecurityIcon'] = sprintf($iconTpl,$icon, 75);
38
+	$ph['SecurityIcon'] = sprintf($iconTpl, $icon, 75);
39 39
 }
40
-if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
40
+if ($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
41 41
 	$icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]';
42
-	$ph['WebUserIcon'] = sprintf($iconTpl,$icon, 99);
42
+	$ph['WebUserIcon'] = sprintf($iconTpl, $icon, 99);
43 43
 }
44
-if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
44
+if ($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
45 45
 	$icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]';
46
-	$ph['ModulesIcon'] = sprintf($iconTpl,$icon, 106);
46
+	$ph['ModulesIcon'] = sprintf($iconTpl, $icon, 106);
47 47
 }
48
-if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
48
+if ($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
49 49
 	$icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]';
50
-	$ph['ResourcesIcon'] = sprintf($iconTpl,$icon, 76);
50
+	$ph['ResourcesIcon'] = sprintf($iconTpl, $icon, 76);
51 51
 }
52
-if($modx->hasPermission('bk_manager')) {
52
+if ($modx->hasPermission('bk_manager')) {
53 53
 	$icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]';
54
-	$ph['BackupIcon'] = sprintf($iconTpl,$icon, 93);
54
+	$ph['BackupIcon'] = sprintf($iconTpl, $icon, 93);
55 55
 }
56
-if($modx->hasPermission('help')) {
56
+if ($modx->hasPermission('help')) {
57 57
 	$icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]';
58
-	$ph['HelpIcon'] = sprintf($iconTpl,$icon, 9);
58
+	$ph['HelpIcon'] = sprintf($iconTpl, $icon, 9);
59 59
 }
60 60
 
61
-if($modx->hasPermission('new_document')) {
61
+if ($modx->hasPermission('new_document')) {
62 62
 	$icon = '<i class="[&icons_resource_large&]"></i>[%add_resource%]';
63
-	$ph['ResourceIcon'] = sprintf($iconTpl,$icon, 4);
63
+	$ph['ResourceIcon'] = sprintf($iconTpl, $icon, 4);
64 64
 	$icon = '<i class="[&icons_weblink_large&]"></i>[%add_weblink%]';
65
-	$ph['WeblinkIcon'] = sprintf($iconTpl,$icon, 72);
65
+	$ph['WeblinkIcon'] = sprintf($iconTpl, $icon, 72);
66 66
 }
67
-if($modx->hasPermission('assets_images')) {
67
+if ($modx->hasPermission('assets_images')) {
68 68
 	$icon = '<i class="[&icons_images_large&]"></i>[%images_management%]';
69
-	$ph['ImagesIcon'] = sprintf($iconTpl,$icon, 72);
69
+	$ph['ImagesIcon'] = sprintf($iconTpl, $icon, 72);
70 70
 }
71
-if($modx->hasPermission('assets_files')) {
71
+if ($modx->hasPermission('assets_files')) {
72 72
 	$icon = '<i class="[&icons_files_large&]"></i>[%files_management%]';
73
-	$ph['FilesIcon'] = sprintf($iconTpl,$icon, 72);
73
+	$ph['FilesIcon'] = sprintf($iconTpl, $icon, 72);
74 74
 }
75
-if($modx->hasPermission('change_password')) {
75
+if ($modx->hasPermission('change_password')) {
76 76
 	$icon = '<i class="[&icons_password_large&]"></i>[%change_password%]';
77
-	$ph['PasswordIcon'] = sprintf($iconTpl,$icon, 28);
77
+	$ph['PasswordIcon'] = sprintf($iconTpl, $icon, 28);
78 78
 }
79 79
 $icon = '<i class="[&icons_logout_large&]"></i>[%logout%]';
80
-$ph['LogoutIcon'] = sprintf($iconTpl,$icon, 8);
80
+$ph['LogoutIcon'] = sprintf($iconTpl, $icon, 8);
81 81
 
82 82
 // do some config checks
83
-if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
84
-	include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php');
85
-	if($config_check_results != $_lang['configcheck_ok']) {
83
+if (($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
84
+	include_once(MODX_MANAGER_PATH.'includes/config_check.inc.php');
85
+	if ($config_check_results != $_lang['configcheck_ok']) {
86 86
 		$ph['config_check_results'] = $config_check_results;
87 87
 		$ph['config_display'] = 'block';
88 88
 	} else {
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
 }
94 94
 
95 95
 // Check logout-reminder
96
-if(isset($_SESSION['show_logout_reminder'])) {
97
-	switch($_SESSION['show_logout_reminder']['type']) {
96
+if (isset($_SESSION['show_logout_reminder'])) {
97
+	switch ($_SESSION['show_logout_reminder']['type']) {
98 98
 		case 'logout_reminder':
99 99
 			$date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly');
100 100
 			$ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	</tr>
149 149
 </table>';
150 150
 
151
-$nrnewmessages = '<span class="text-danger">' . $_SESSION['nrnewmessages'] . '</span>';
151
+$nrnewmessages = '<span class="text-danger">'.$_SESSION['nrnewmessages'].'</span>';
152 152
 
153 153
 $ph['UserInfo'] = $modx->parseText($tpl, array(
154 154
 	'username' => $modx->getLoginUserName(),
@@ -160,13 +160,13 @@  discard block
 block discarded – undo
160 160
 
161 161
 $from = array();
162 162
 $from[] = $modx->getDatabase()->getFullTableName('active_user_sessions');
163
-$from[] = " us LEFT JOIN " . $modx->getDatabase()->getFullTableName('active_users') . " au ON au.sid=us.sid WHERE au.action <> '8'";
163
+$from[] = " us LEFT JOIN ".$modx->getDatabase()->getFullTableName('active_users')." au ON au.sid=us.sid WHERE au.action <> '8'";
164 164
 $rs = $modx->getDatabase()->select('*', $from, '', 'username ASC, au.sid ASC');
165 165
 
166
-if($modx->getDatabase()->getRecordCount($rs) < 1) {
166
+if ($modx->getDatabase()->getRecordCount($rs) < 1) {
167 167
 	$html = '<p>[%no_active_users_found%]</p>';
168 168
 } else {
169
-	include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
169
+	include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php');
170 170
 	$now = $_SERVER['REQUEST_TIME'] + $server_offset_time;
171 171
 	$ph['now'] = strftime('%H:%M:%S', $now);
172 172
 	$timetocheck = ($now - (60 * 20)); //+$server_offset_time;
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 	$userList = array();
192 192
 	$userCount = array();
193 193
 	// Create userlist with session-count first before output
194
-	while($activeusers = $modx->getDatabase()->getRow($rs)) {
194
+	while ($activeusers = $modx->getDatabase()->getRow($rs)) {
195 195
 		$userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1;
196 196
 
197 197
 		$idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : '';
@@ -209,9 +209,9 @@  discard block
 block discarded – undo
209 209
 			$currentaction
210 210
 		);
211 211
 	}
212
-	foreach($userList as $params) {
212
+	foreach ($userList as $params) {
213 213
 		$params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : '';
214
-		$html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
214
+		$html .= "\n\t\t".vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
215 215
 	}
216 216
 
217 217
 	$html .= '
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 $ph['OnlineInfo'] = $html;
224 224
 
225 225
 // include rss feeds for important forum topics
226
-include_once(MODX_MANAGER_PATH . 'includes/rss.inc.php');
226
+include_once(MODX_MANAGER_PATH.'includes/rss.inc.php');
227 227
 $ph['modx_security_notices_content'] = $feedData['modx_security_notices_content'];
228 228
 $ph['modx_news_content'] = $feedData['modx_news_content'];
229 229
 
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 
255 255
 // invoke event OnManagerWelcomePrerender
256 256
 $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender');
257
-if(is_array($evtOut)) {
257
+if (is_array($evtOut)) {
258 258
 	$output = implode('', $evtOut);
259 259
 	$ph['OnManagerWelcomePrerender'] = $output;
260 260
 }
@@ -384,57 +384,57 @@  discard block
 block discarded – undo
384 384
 
385 385
 // invoke OnManagerWelcomeHome event
386 386
 $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
387
-if(is_array($sitewidgets)) {
387
+if (is_array($sitewidgets)) {
388 388
 	$newwidgets = array();
389
-    foreach($sitewidgets as $widget){
389
+    foreach ($sitewidgets as $widget) {
390 390
         $newwidgets = array_merge($newwidgets, unserialize($widget));
391 391
     }
392 392
     $widgets = (count($newwidgets) > 0) ? $newwidgets : $widgets;
393 393
 }
394 394
 
395
-usort($widgets, function ($a, $b) {
395
+usort($widgets, function($a, $b){
396 396
 	return $a['menuindex'] - $b['menuindex'];
397 397
 });
398 398
 
399 399
 $tpl = $modx->getChunk('manager#welcome\Widget');
400 400
 $output = '';
401
-foreach($widgets as $widget) {
402
-	if ($widget['hide'] != '1'){
401
+foreach ($widgets as $widget) {
402
+	if ($widget['hide'] != '1') {
403 403
 		$output .= $modx->parseText($tpl, $widget);
404 404
 	}
405 405
 }
406 406
 $ph['widgets'] = $output;
407 407
 
408 408
 // load template
409
-if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
410
-	$modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl';
409
+if (!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
410
+	$modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH.'media/style/common/welcome.tpl';
411 411
 }
412 412
 
413 413
 $target = $modx->config['manager_welcome_tpl'];
414 414
 $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target);
415 415
 $target = $modx->mergeSettingsContent($target);
416 416
 
417
-if(substr($target, 0, 1) === '@') {
418
-	if(substr($target, 0, 6) === '@CHUNK') {
417
+if (substr($target, 0, 1) === '@') {
418
+	if (substr($target, 0, 6) === '@CHUNK') {
419 419
 		$content = $modx->getChunk(trim(substr($target, 7)));
420
-	} elseif(substr($target, 0, 5) === '@FILE') {
420
+	} elseif (substr($target, 0, 5) === '@FILE') {
421 421
 		$content = file_get_contents(trim(substr($target, 6)));
422 422
 	} else {
423 423
 		$content = '';
424 424
 	}
425 425
 } else {
426 426
 	$chunk = $modx->getChunk($target);
427
-	if($chunk !== false && !empty($chunk)) {
427
+	if ($chunk !== false && !empty($chunk)) {
428 428
 		$content = $chunk;
429
-	} elseif(is_file(MODX_BASE_PATH . $target)) {
430
-		$content = file_get_contents(MODX_BASE_PATH . $target);
431
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
432
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl');
433
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible
429
+	} elseif (is_file(MODX_BASE_PATH.$target)) {
430
+		$content = file_get_contents(MODX_BASE_PATH.$target);
431
+	} elseif (is_file(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/welcome.tpl')) {
432
+		$content = file_get_contents(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/welcome.tpl');
433
+	} elseif (is_file(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/html/welcome.html')) // ClipperCMS compatible
434 434
 	{
435
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
435
+		$content = file_get_contents(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/html/welcome.html');
436 436
 	} else {
437
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl');
437
+		$content = file_get_contents(MODX_MANAGER_PATH.'media/style/common/welcome.tpl');
438 438
 	}
439 439
 }
440 440
 
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 $content = $modx->mergeConditionalTagsContent($content);
443 443
 $content = $modx->mergeSettingsContent($content);
444 444
 $content = $modx->parseText($content, $ph);
445
-if(strpos($content, '[+') !== false) {
445
+if (strpos($content, '[+') !== false) {
446 446
 	$modx->toPlaceholders($ph);
447 447
 	$content = $modx->mergePlaceholderContent($content);
448 448
 }
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 $content = $modx->parseText($content, $_style, '[&', '&]');
452 452
 $content = $modx->cleanUpMODXTags($content); //cleanup
453 453
 
454
-if($js = $modx->getRegisteredClientScripts()) {
454
+if ($js = $modx->getRegisteredClientScripts()) {
455 455
 	$content .= $js;
456 456
 }
457 457
 
Please login to merge, or discard this patch.
Braces   +48 added lines, -46 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  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
 unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes
7 7
 
8
-if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
8
+if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
9 9
 	// seems to be a new install - send the user to the configuration page
10 10
 	exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
11 11
 }
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 $_SESSION['nrnewmessages'] = 0;
17 17
 
18 18
 // setup message info
19
-if($modx->hasPermission('messages')) {
19
+if($modx->hasPermission('messages')) {
20 20
 	include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php');
21 21
 	$_SESSION['nrtotalmessages'] = $nrtotalmessages;
22 22
 	$_SESSION['nrnewmessages'] = $nrnewmessages;
@@ -33,46 +33,46 @@  discard block
 block discarded – undo
33 33
 
34 34
 $iconTpl = $modx->getChunk('manager#welcome\WrapIcon');
35 35
 // setup icons
36
-if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
36
+if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
37 37
 	$icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]';
38 38
 	$ph['SecurityIcon'] = sprintf($iconTpl,$icon, 75);
39 39
 }
40
-if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
40
+if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
41 41
 	$icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]';
42 42
 	$ph['WebUserIcon'] = sprintf($iconTpl,$icon, 99);
43 43
 }
44
-if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
44
+if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
45 45
 	$icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]';
46 46
 	$ph['ModulesIcon'] = sprintf($iconTpl,$icon, 106);
47 47
 }
48
-if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
48
+if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
49 49
 	$icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]';
50 50
 	$ph['ResourcesIcon'] = sprintf($iconTpl,$icon, 76);
51 51
 }
52
-if($modx->hasPermission('bk_manager')) {
52
+if($modx->hasPermission('bk_manager')) {
53 53
 	$icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]';
54 54
 	$ph['BackupIcon'] = sprintf($iconTpl,$icon, 93);
55 55
 }
56
-if($modx->hasPermission('help')) {
56
+if($modx->hasPermission('help')) {
57 57
 	$icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]';
58 58
 	$ph['HelpIcon'] = sprintf($iconTpl,$icon, 9);
59 59
 }
60 60
 
61
-if($modx->hasPermission('new_document')) {
61
+if($modx->hasPermission('new_document')) {
62 62
 	$icon = '<i class="[&icons_resource_large&]"></i>[%add_resource%]';
63 63
 	$ph['ResourceIcon'] = sprintf($iconTpl,$icon, 4);
64 64
 	$icon = '<i class="[&icons_weblink_large&]"></i>[%add_weblink%]';
65 65
 	$ph['WeblinkIcon'] = sprintf($iconTpl,$icon, 72);
66 66
 }
67
-if($modx->hasPermission('assets_images')) {
67
+if($modx->hasPermission('assets_images')) {
68 68
 	$icon = '<i class="[&icons_images_large&]"></i>[%images_management%]';
69 69
 	$ph['ImagesIcon'] = sprintf($iconTpl,$icon, 72);
70 70
 }
71
-if($modx->hasPermission('assets_files')) {
71
+if($modx->hasPermission('assets_files')) {
72 72
 	$icon = '<i class="[&icons_files_large&]"></i>[%files_management%]';
73 73
 	$ph['FilesIcon'] = sprintf($iconTpl,$icon, 72);
74 74
 }
75
-if($modx->hasPermission('change_password')) {
75
+if($modx->hasPermission('change_password')) {
76 76
 	$icon = '<i class="[&icons_password_large&]"></i>[%change_password%]';
77 77
 	$ph['PasswordIcon'] = sprintf($iconTpl,$icon, 28);
78 78
 }
@@ -80,21 +80,21 @@  discard block
 block discarded – undo
80 80
 $ph['LogoutIcon'] = sprintf($iconTpl,$icon, 8);
81 81
 
82 82
 // do some config checks
83
-if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
83
+if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
84 84
 	include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php');
85
-	if($config_check_results != $_lang['configcheck_ok']) {
85
+	if($config_check_results != $_lang['configcheck_ok']) {
86 86
 		$ph['config_check_results'] = $config_check_results;
87 87
 		$ph['config_display'] = 'block';
88
-	} else {
88
+	} else {
89 89
 		$ph['config_display'] = 'none';
90 90
 	}
91
-} else {
91
+} else {
92 92
 	$ph['config_display'] = 'none';
93 93
 }
94 94
 
95 95
 // Check logout-reminder
96
-if(isset($_SESSION['show_logout_reminder'])) {
97
-	switch($_SESSION['show_logout_reminder']['type']) {
96
+if(isset($_SESSION['show_logout_reminder'])) {
97
+	switch($_SESSION['show_logout_reminder']['type']) {
98 98
 		case 'logout_reminder':
99 99
 			$date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly');
100 100
 			$ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	}
103 103
 	$ph['show_logout_reminder'] = 'block';
104 104
 	unset($_SESSION['show_logout_reminder']);
105
-} else {
105
+} else {
106 106
 	$ph['show_logout_reminder'] = 'none';
107 107
 }
108 108
 
@@ -163,9 +163,9 @@  discard block
 block discarded – undo
163 163
 $from[] = " us LEFT JOIN " . $modx->getDatabase()->getFullTableName('active_users') . " au ON au.sid=us.sid WHERE au.action <> '8'";
164 164
 $rs = $modx->getDatabase()->select('*', $from, '', 'username ASC, au.sid ASC');
165 165
 
166
-if($modx->getDatabase()->getRecordCount($rs) < 1) {
166
+if($modx->getDatabase()->getRecordCount($rs) < 1) {
167 167
 	$html = '<p>[%no_active_users_found%]</p>';
168
-} else {
168
+} else {
169 169
 	include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
170 170
 	$now = $_SERVER['REQUEST_TIME'] + $server_offset_time;
171 171
 	$ph['now'] = strftime('%H:%M:%S', $now);
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 	$userList = array();
192 192
 	$userCount = array();
193 193
 	// Create userlist with session-count first before output
194
-	while($activeusers = $modx->getDatabase()->getRow($rs)) {
194
+	while($activeusers = $modx->getDatabase()->getRow($rs)) {
195 195
 		$userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1;
196 196
 
197 197
 		$idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : '';
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 			$currentaction
210 210
 		);
211 211
 	}
212
-	foreach($userList as $params) {
212
+	foreach($userList as $params) {
213 213
 		$params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : '';
214 214
 		$html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
215 215
 	}
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 
255 255
 // invoke event OnManagerWelcomePrerender
256 256
 $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender');
257
-if(is_array($evtOut)) {
257
+if(is_array($evtOut)) {
258 258
 	$output = implode('', $evtOut);
259 259
 	$ph['OnManagerWelcomePrerender'] = $output;
260 260
 }
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 	'body' => '<div class="widget-stage">[+RecentInfo+]</div>',
360 360
 	'hide'=>'0'
361 361
 );
362
-if ($modx->config['rss_url_news']) {
362
+if ($modx->config['rss_url_news']) {
363 363
     $widgets['news'] = array(
364 364
         'menuindex' => '40',
365 365
         'id' => 'news',
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
         'hide'=>'0'
371 371
     );
372 372
 }
373
-if ($modx->config['rss_url_security']) {
373
+if ($modx->config['rss_url_security']) {
374 374
     $widgets['security'] = array(
375 375
         'menuindex' => '50',
376 376
         'id' => 'security',
@@ -384,29 +384,29 @@  discard block
 block discarded – undo
384 384
 
385 385
 // invoke OnManagerWelcomeHome event
386 386
 $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
387
-if(is_array($sitewidgets)) {
387
+if(is_array($sitewidgets)) {
388 388
 	$newwidgets = array();
389
-    foreach($sitewidgets as $widget){
389
+    foreach($sitewidgets as $widget) {
390 390
         $newwidgets = array_merge($newwidgets, unserialize($widget));
391 391
     }
392 392
     $widgets = (count($newwidgets) > 0) ? $newwidgets : $widgets;
393 393
 }
394 394
 
395
-usort($widgets, function ($a, $b) {
395
+usort($widgets, function ($a, $b){
396 396
 	return $a['menuindex'] - $b['menuindex'];
397 397
 });
398 398
 
399 399
 $tpl = $modx->getChunk('manager#welcome\Widget');
400 400
 $output = '';
401
-foreach($widgets as $widget) {
402
-	if ($widget['hide'] != '1'){
401
+foreach($widgets as $widget) {
402
+	if ($widget['hide'] != '1') {
403 403
 		$output .= $modx->parseText($tpl, $widget);
404 404
 	}
405 405
 }
406 406
 $ph['widgets'] = $output;
407 407
 
408 408
 // load template
409
-if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
409
+if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
410 410
 	$modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl';
411 411
 }
412 412
 
@@ -414,26 +414,28 @@  discard block
 block discarded – undo
414 414
 $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target);
415 415
 $target = $modx->mergeSettingsContent($target);
416 416
 
417
-if(substr($target, 0, 1) === '@') {
418
-	if(substr($target, 0, 6) === '@CHUNK') {
417
+if(substr($target, 0, 1) === '@') {
418
+	if(substr($target, 0, 6) === '@CHUNK') {
419 419
 		$content = $modx->getChunk(trim(substr($target, 7)));
420
-	} elseif(substr($target, 0, 5) === '@FILE') {
420
+	} elseif(substr($target, 0, 5) === '@FILE') {
421 421
 		$content = file_get_contents(trim(substr($target, 6)));
422
-	} else {
422
+	} else {
423 423
 		$content = '';
424 424
 	}
425
-} else {
425
+} else {
426 426
 	$chunk = $modx->getChunk($target);
427
-	if($chunk !== false && !empty($chunk)) {
427
+	if($chunk !== false && !empty($chunk)) {
428 428
 		$content = $chunk;
429
-	} elseif(is_file(MODX_BASE_PATH . $target)) {
429
+	} elseif(is_file(MODX_BASE_PATH . $target)) {
430 430
 		$content = file_get_contents(MODX_BASE_PATH . $target);
431
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
431
+	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
432 432
 		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl');
433
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible
433
+	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) {
434
+	    // ClipperCMS compatible
434 435
 	{
435
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
436
-	} else {
436
+		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
437
+	}
438
+	} else {
437 439
 		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl');
438 440
 	}
439 441
 }
@@ -442,7 +444,7 @@  discard block
 block discarded – undo
442 444
 $content = $modx->mergeConditionalTagsContent($content);
443 445
 $content = $modx->mergeSettingsContent($content);
444 446
 $content = $modx->parseText($content, $ph);
445
-if(strpos($content, '[+') !== false) {
447
+if(strpos($content, '[+') !== false) {
446 448
 	$modx->toPlaceholders($ph);
447 449
 	$content = $modx->mergePlaceholderContent($content);
448 450
 }
@@ -451,7 +453,7 @@  discard block
 block discarded – undo
451 453
 $content = $modx->parseText($content, $_style, '[&', '&]');
452 454
 $content = $modx->cleanUpMODXTags($content); //cleanup
453 455
 
454
-if($js = $modx->getRegisteredClientScripts()) {
456
+if($js = $modx->getRegisteredClientScripts()) {
455 457
 	$content .= $js;
456 458
 }
457 459
 
Please login to merge, or discard this patch.
manager/actions/search.static.php 3 patches
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -118,18 +118,18 @@
 block discarded – undo
118 118
 		$articul_query = "SELECT `contentid` FROM {$tbl_site_tmplvar_contentvalues} WHERE `value` LIKE '%{$searchfields}%'";
119 119
 		$articul_result = $modx->getDatabase()->query($articul_query);
120 120
 		$articul_id_array = $modx->getDatabase()->makeArray($articul_result);
121
-		if(count($articul_id_array)>0){
121
+		if(count($articul_id_array)>0) {
122 122
 			$articul_id = '';
123 123
 			$i = 1;
124 124
 			foreach( $articul_id_array as $articul ) {
125 125
 				$articul_id.=$articul['contentid'];
126
-				if($i !== count($articul_id_array)){
126
+				if($i !== count($articul_id_array)) {
127 127
 					$articul_id.=',';
128 128
 				}
129 129
 				$i++;
130 130
 			}
131 131
 		$articul_id_query = " OR sc.id IN ({$articul_id})";
132
-		}else{
132
+		} else {
133 133
 			$articul_id_query = '';
134 134
 		}
135 135
 		/*end search by TV*/
Please login to merge, or discard this patch.
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -113,31 +113,31 @@
 block discarded – undo
113 113
     // Handle Input "Search in main fields"
114 114
     if ($searchfields != '') {
115 115
 
116
-		/*start search by TV. Added Rising13*/
117
-		$tbl_site_tmplvar_contentvalues = $modx->getDatabase()->getFullTableName('site_tmplvar_contentvalues');
118
-		$articul_query = "SELECT `contentid` FROM {$tbl_site_tmplvar_contentvalues} WHERE `value` LIKE '%{$searchfields}%'";
119
-		$articul_result = $modx->getDatabase()->query($articul_query);
120
-		$articul_id_array = $modx->getDatabase()->makeArray($articul_result);
121
-		if(count($articul_id_array)>0){
122
-			$articul_id = '';
123
-			$i = 1;
124
-			foreach( $articul_id_array as $articul ) {
125
-				$articul_id.=$articul['contentid'];
126
-				if($i !== count($articul_id_array)){
127
-					$articul_id.=',';
128
-				}
129
-				$i++;
130
-			}
131
-		$articul_id_query = " OR sc.id IN ({$articul_id})";
132
-		}else{
133
-			$articul_id_query = '';
134
-		}
135
-		/*end search by TV*/
116
+        /*start search by TV. Added Rising13*/
117
+        $tbl_site_tmplvar_contentvalues = $modx->getDatabase()->getFullTableName('site_tmplvar_contentvalues');
118
+        $articul_query = "SELECT `contentid` FROM {$tbl_site_tmplvar_contentvalues} WHERE `value` LIKE '%{$searchfields}%'";
119
+        $articul_result = $modx->getDatabase()->query($articul_query);
120
+        $articul_id_array = $modx->getDatabase()->makeArray($articul_result);
121
+        if(count($articul_id_array)>0){
122
+            $articul_id = '';
123
+            $i = 1;
124
+            foreach( $articul_id_array as $articul ) {
125
+                $articul_id.=$articul['contentid'];
126
+                if($i !== count($articul_id_array)){
127
+                    $articul_id.=',';
128
+                }
129
+                $i++;
130
+            }
131
+        $articul_id_query = " OR sc.id IN ({$articul_id})";
132
+        }else{
133
+            $articul_id_query = '';
134
+        }
135
+        /*end search by TV*/
136 136
 
137 137
         if (ctype_digit($searchfields)) {
138 138
             $sqladd .= "sc.id='{$searchfields}'";
139 139
             if (strlen($searchfields) > 3) {
140
-				$sqladd .= $articul_id_query;//search by TV
140
+                $sqladd .= $articul_id_query;//search by TV
141 141
                 $sqladd .= " OR sc.pagetitle LIKE '%{$searchfields}%'";
142 142
             }
143 143
         }
Please login to merge, or discard this patch.
Spacing   +73 added lines, -73 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
     exit();
4 4
 }
5 5
 unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
                         <?php
42 42
                         $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('site_templates'));
43 43
                         $option[] = '<option value="">No selected</option>';
44
-                        $templateid = (isset($_REQUEST['templateid']) && $_REQUEST['templateid'] !== '') ? (int)$_REQUEST['templateid'] : '';
44
+                        $templateid = (isset($_REQUEST['templateid']) && $_REQUEST['templateid'] !== '') ? (int) $_REQUEST['templateid'] : '';
45 45
                         $selected = $templateid === 0 ? ' selected="selected"' : '';
46
-                        $option[] = '<option value="0"' . $selected . '>(blank)</option>';
46
+                        $option[] = '<option value="0"'.$selected.'>(blank)</option>';
47 47
                         while ($row = $modx->getDatabase()->getRow($rs)) {
48 48
                             $templatename = htmlspecialchars($row['templatename'], ENT_QUOTES, $modx->config['modx_charset']);
49 49
                             $selected = $row['id'] == $templateid ? ' selected="selected"' : '';
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     $searchfields = htmlentities(trim($_POST['searchfields']), ENT_QUOTES, $modx_manager_charset);
87 87
     $searchlongtitle = $modx->getDatabase()->escape(trim($_REQUEST['searchfields']));
88 88
     $search_alias = $modx->getDatabase()->escape(trim($_REQUEST['searchfields']));
89
-    $templateid = isset($_REQUEST['templateid']) && $_REQUEST['templateid'] !== '' ? (int)$_REQUEST['templateid'] : '';
89
+    $templateid = isset($_REQUEST['templateid']) && $_REQUEST['templateid'] !== '' ? (int) $_REQUEST['templateid'] : '';
90 90
     $searchcontent = $modx->getDatabase()->escape($_REQUEST['content']);
91 91
 
92 92
     $fields = 'DISTINCT sc.id, contenttype, pagetitle, longtitle, description, introtext, menutitle, deleted, published, isfolder, type';
@@ -100,12 +100,12 @@  discard block
 block discarded – undo
100 100
         $friendly_url_suffix = $modx->config['friendly_url_suffix'];
101 101
         $base_url = $modx->config['base_url'];
102 102
         $site_url = $modx->config['site_url'];
103
-        $url = preg_replace('@' . $friendly_url_suffix . '$@', '', $url);
103
+        $url = preg_replace('@'.$friendly_url_suffix.'$@', '', $url);
104 104
         if ($url[0] === '/') {
105
-            $url = preg_replace('@^' . $base_url . '@', '', $url);
105
+            $url = preg_replace('@^'.$base_url.'@', '', $url);
106 106
         }
107 107
         if (substr($url, 0, 4) === 'http') {
108
-            $url = preg_replace('@^' . $site_url . '@', '', $url);
108
+            $url = preg_replace('@^'.$site_url.'@', '', $url);
109 109
         }
110 110
         $idFromAlias = $modx->getIdFromAlias($url);
111 111
     }
@@ -118,18 +118,18 @@  discard block
 block discarded – undo
118 118
 		$articul_query = "SELECT `contentid` FROM {$tbl_site_tmplvar_contentvalues} WHERE `value` LIKE '%{$searchfields}%'";
119 119
 		$articul_result = $modx->getDatabase()->query($articul_query);
120 120
 		$articul_id_array = $modx->getDatabase()->makeArray($articul_result);
121
-		if(count($articul_id_array)>0){
121
+		if (count($articul_id_array) > 0) {
122 122
 			$articul_id = '';
123 123
 			$i = 1;
124
-			foreach( $articul_id_array as $articul ) {
125
-				$articul_id.=$articul['contentid'];
126
-				if($i !== count($articul_id_array)){
127
-					$articul_id.=',';
124
+			foreach ($articul_id_array as $articul) {
125
+				$articul_id .= $articul['contentid'];
126
+				if ($i !== count($articul_id_array)) {
127
+					$articul_id .= ',';
128 128
 				}
129 129
 				$i++;
130 130
 			}
131 131
 		$articul_id_query = " OR sc.id IN ({$articul_id})";
132
-		}else{
132
+		} else {
133 133
 			$articul_id_query = '';
134 134
 		}
135 135
 		/*end search by TV*/
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
         if (ctype_digit($searchfields)) {
138 138
             $sqladd .= "sc.id='{$searchfields}'";
139 139
             if (strlen($searchfields) > 3) {
140
-				$sqladd .= $articul_id_query;//search by TV
140
+				$sqladd .= $articul_id_query; //search by TV
141 141
                 $sqladd .= " OR sc.pagetitle LIKE '%{$searchfields}%'";
142 142
             }
143 143
         }
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
             $sqladd .= " OR sc.introtext LIKE '%{$searchlongtitle}%'";
158 158
             $sqladd .= " OR sc.menutitle LIKE '%{$searchlongtitle}%'";
159 159
             $sqladd .= " OR sc.alias LIKE '%{$search_alias}%'";
160
-            $sqladd .= $articul_id_query;//search by TV
160
+            $sqladd .= $articul_id_query; //search by TV
161 161
             $sqladd .= ")";
162 162
         }
163 163
     } else if ($idFromAlias) {
@@ -181,8 +181,8 @@  discard block
 block discarded – undo
181 181
         $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : '';
182 182
         $mgrRole = (isset ($_SESSION['mgrRole']) && $_SESSION['mgrRole'] == 1) ? 1 : 0;
183 183
         $docgrp_cond = $docgrp ? " OR dg.document_group IN ({$docgrp})" : '';
184
-        $fields .= ', MAX(IF(1=' . $mgrRole . ' OR sc.privatemgr=0' . $docgrp_cond . ',1,0)) AS hasAccess';
185
-        $sqladd = '(' . $sqladd . ") AND (1={$mgrRole} OR sc.privatemgr=0" . (!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))");
184
+        $fields .= ', MAX(IF(1='.$mgrRole.' OR sc.privatemgr=0'.$docgrp_cond.',1,0)) AS hasAccess';
185
+        $sqladd = '('.$sqladd.") AND (1={$mgrRole} OR sc.privatemgr=0".(!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))");
186 186
     }
187 187
 
188 188
     if ($sqladd) {
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
     $where = $sqladd;
193 193
 
194 194
     if ($where) {
195
-        $rs = $modx->getDatabase()->select($fields, $tbl_site_content . ' AS sc LEFT JOIN ' . $tbldg . ' AS dg ON dg.document=sc.id', $where, 'sc.id');
195
+        $rs = $modx->getDatabase()->select($fields, $tbl_site_content.' AS sc LEFT JOIN '.$tbldg.' AS dg ON dg.document=sc.id', $where, 'sc.id');
196 196
         $limit = $modx->getDatabase()->getRecordCount($rs);
197 197
     } else {
198 198
         $limit = 0;
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
                 if ($limit < 1) {
212 212
                     echo $_lang['search_empty'];
213 213
                 } else {
214
-                    printf('<p>' . $_lang['search_results_returned_msg'] . '</p>', $limit);
214
+                    printf('<p>'.$_lang['search_results_returned_msg'].'</p>', $limit);
215 215
                     ?>
216 216
                     <script type="text/javascript" src="media/script/tablesort.js"></script>
217 217
                     <table class="grid sortabletable sortable-onload-2 rowstyle-even" id="table-1">
@@ -271,14 +271,14 @@  discard block
 block discarded – undo
271 271
                                 if (function_exists('mb_strlen') && function_exists('mb_substr')) {
272 272
                                     ?>
273 273
                                     <td<?= $tdClass ?>>
274
-                                        <a href="index.php?a=27&id=<?= $row['id'] ?>"><?= mb_strlen($row['pagetitle'], $modx_manager_charset) > 70 ? mb_substr($row['pagetitle'], 0, 70, $modx_manager_charset) . "..." : $row['pagetitle'] ?></a>
274
+                                        <a href="index.php?a=27&id=<?= $row['id'] ?>"><?= mb_strlen($row['pagetitle'], $modx_manager_charset) > 70 ? mb_substr($row['pagetitle'], 0, 70, $modx_manager_charset)."..." : $row['pagetitle'] ?></a>
275 275
                                     </td>
276
-                                    <td<?= $tdClass ?>><?= mb_strlen($row['description'], $modx_manager_charset) > 70 ? mb_substr($row['description'], 0, 70, $modx_manager_charset) . "..." : $row['description'] ?></td>
276
+                                    <td<?= $tdClass ?>><?= mb_strlen($row['description'], $modx_manager_charset) > 70 ? mb_substr($row['description'], 0, 70, $modx_manager_charset)."..." : $row['description'] ?></td>
277 277
                                     <?php
278 278
                                 } else {
279 279
                                     ?>
280
-                                    <td<?= $tdClass ?>><?= strlen($row['pagetitle']) > 20 ? substr($row['pagetitle'], 0, 20) . '...' : $row['pagetitle'] ?></td>
281
-                                    <td<?= $tdClass ?>><?= strlen($row['description']) > 35 ? substr($row['description'], 0, 35) . '...' : $row['description'] ?></td>
280
+                                    <td<?= $tdClass ?>><?= strlen($row['pagetitle']) > 20 ? substr($row['pagetitle'], 0, 20).'...' : $row['pagetitle'] ?></td>
281
+                                    <td<?= $tdClass ?>><?= strlen($row['description']) > 35 ? substr($row['description'], 0, 35).'...' : $row['description'] ?></td>
282 282
                                     <?php
283 283
                                 }
284 284
                                 ?>
@@ -298,115 +298,115 @@  discard block
 block discarded – undo
298 298
                 if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) {
299 299
                     $docscounts = $modx->getDatabase()->getRecordCount($rs);
300 300
                     if ($docscounts > 0) {
301
-                        $output .= '<li><b><i class="fa fa-sitemap"></i> ' . $_lang["manage_documents"] . ' (' . $docscounts . ')</b></li>';
301
+                        $output .= '<li><b><i class="fa fa-sitemap"></i> '.$_lang["manage_documents"].' ('.$docscounts.')</b></li>';
302 302
                         while ($row = $modx->getDatabase()->getRow($rs)) {
303
-                            $output .= '<li' . addClassForItemList('', !$row['published'], $row['deleted']) . '><a href="index.php?a=27&id=' . $row['id'] . '" id="content_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['pagetitle'] . ' <small>(' . $row['id'] . ')</small>', $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>';
303
+                            $output .= '<li'.addClassForItemList('', !$row['published'], $row['deleted']).'><a href="index.php?a=27&id='.$row['id'].'" id="content_'.$row['id'].'" target="main">'.highlightingCoincidence($row['pagetitle'].' <small>('.$row['id'].')</small>', $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>';
304 304
                         }
305 305
                     }
306 306
                 }
307 307
 
308 308
                 //templates
309 309
                 if ($modx->hasPermission('edit_template')) {
310
-                    $rs = $modx->getDatabase()->select("id,templatename,locked", $modx->getDatabase()->getFullTableName('site_templates'), "`id` like '%" . $searchfields . "%' 
311
-					OR `templatename` like '%" . $searchfields . "%' 
312
-					OR `description` like '%" . $searchfields . "%' 
313
-					OR `content` like '%" . $searchfields . "%'");
310
+                    $rs = $modx->getDatabase()->select("id,templatename,locked", $modx->getDatabase()->getFullTableName('site_templates'), "`id` like '%".$searchfields."%' 
311
+					OR `templatename` like '%" . $searchfields."%' 
312
+					OR `description` like '%" . $searchfields."%' 
313
+					OR `content` like '%" . $searchfields."%'");
314 314
                     $templatecounts = $modx->getDatabase()->getRecordCount($rs);
315 315
                     if ($templatecounts > 0) {
316
-                        $output .= '<li><b><i class="fa fa-newspaper-o"></i> ' . $_lang["manage_templates"] . ' (' . $templatecounts . ')</b></li>';
316
+                        $output .= '<li><b><i class="fa fa-newspaper-o"></i> '.$_lang["manage_templates"].' ('.$templatecounts.')</b></li>';
317 317
                         while ($row = $modx->getDatabase()->getRow($rs)) {
318
-                            $output .= '<li' . addClassForItemList($row['locked']) . '><a href="index.php?a=16&id=' . $row['id'] . '" id="templates_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['templatename'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>';
318
+                            $output .= '<li'.addClassForItemList($row['locked']).'><a href="index.php?a=16&id='.$row['id'].'" id="templates_'.$row['id'].'" target="main">'.highlightingCoincidence($row['templatename'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>';
319 319
                         }
320 320
                     }
321 321
                 }
322 322
 
323 323
                 //tvs
324 324
                 if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) {
325
-                    $rs = $modx->getDatabase()->select("id,name,locked", $modx->getDatabase()->getFullTableName('site_tmplvars'), "`id` like '%" . $searchfields . "%' 
326
-					OR `name` like '%" . $searchfields . "%' 
327
-					OR `description` like '%" . $searchfields . "%' 
328
-					OR `type` like '%" . $searchfields . "%' 
329
-					OR `elements` like '%" . $searchfields . "%' 
330
-					OR `display` like '%" . $searchfields . "%' 
331
-					OR `display_params` like '%" . $searchfields . "%' 
332
-					OR `default_text` like '%" . $searchfields . "%'");
325
+                    $rs = $modx->getDatabase()->select("id,name,locked", $modx->getDatabase()->getFullTableName('site_tmplvars'), "`id` like '%".$searchfields."%' 
326
+					OR `name` like '%" . $searchfields."%' 
327
+					OR `description` like '%" . $searchfields."%' 
328
+					OR `type` like '%" . $searchfields."%' 
329
+					OR `elements` like '%" . $searchfields."%' 
330
+					OR `display` like '%" . $searchfields."%' 
331
+					OR `display_params` like '%" . $searchfields."%' 
332
+					OR `default_text` like '%" . $searchfields."%'");
333 333
                     $tvscounts = $modx->getDatabase()->getRecordCount($rs);
334 334
                     if ($tvscounts > 0) {
335
-                        $output .= '<li><b><i class="fa fa-list-alt"></i> ' . $_lang["settings_templvars"] . ' (' . $tvscounts . ')</b></li>';
335
+                        $output .= '<li><b><i class="fa fa-list-alt"></i> '.$_lang["settings_templvars"].' ('.$tvscounts.')</b></li>';
336 336
                         while ($row = $modx->getDatabase()->getRow($rs)) {
337
-                            $output .= '<li' . addClassForItemList($row['locked']) . '><a href="index.php?a=301&id=' . $row['id'] . '" id="tmplvars_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>';
337
+                            $output .= '<li'.addClassForItemList($row['locked']).'><a href="index.php?a=301&id='.$row['id'].'" id="tmplvars_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>';
338 338
                         }
339 339
                     }
340 340
                 }
341 341
 
342 342
                 //Chunks
343 343
                 if ($modx->hasPermission('edit_chunk')) {
344
-                    $rs = $modx->getDatabase()->select("id,name,locked,disabled", $modx->getDatabase()->getFullTableName('site_htmlsnippets'), "`id` like '%" . $searchfields . "%' 
345
-					OR `name` like '%" . $searchfields . "%' 
346
-					OR `description` like '%" . $searchfields . "%'     
347
-					OR `snippet` like '%" . $searchfields . "%'");
344
+                    $rs = $modx->getDatabase()->select("id,name,locked,disabled", $modx->getDatabase()->getFullTableName('site_htmlsnippets'), "`id` like '%".$searchfields."%' 
345
+					OR `name` like '%" . $searchfields."%' 
346
+					OR `description` like '%" . $searchfields."%'     
347
+					OR `snippet` like '%" . $searchfields."%'");
348 348
                     $chunkscounts = $modx->getDatabase()->getRecordCount($rs);
349 349
                     if ($chunkscounts > 0) {
350
-                        $output .= '<li><b><i class="fa fa-th-large"></i> ' . $_lang["manage_htmlsnippets"] . ' (' . $chunkscounts . ')</b></li>';
350
+                        $output .= '<li><b><i class="fa fa-th-large"></i> '.$_lang["manage_htmlsnippets"].' ('.$chunkscounts.')</b></li>';
351 351
                         while ($row = $modx->getDatabase()->getRow($rs)) {
352
-                            $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=78&id=' . $row['id'] . '" id="htmlsnippets_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>';
352
+                            $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=78&id='.$row['id'].'" id="htmlsnippets_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>';
353 353
                         }
354 354
                     }
355 355
                 }
356 356
 
357 357
                 //Snippets
358 358
                 if ($modx->hasPermission('edit_snippet')) {
359
-                    $rs = $modx->getDatabase()->select("id,name,locked,disabled", $modx->getDatabase()->getFullTableName('site_snippets'), "`id` like '%" . $searchfields . "%' 
360
-					OR `name` like '%" . $searchfields . "%' 
361
-					OR `description` like '%" . $searchfields . "%' 
362
-					OR `snippet` like '%" . $searchfields . "%'  
363
-					OR `properties` like '%" . $searchfields . "%'      
364
-					OR `moduleguid` like '%" . $searchfields . "%'");
359
+                    $rs = $modx->getDatabase()->select("id,name,locked,disabled", $modx->getDatabase()->getFullTableName('site_snippets'), "`id` like '%".$searchfields."%' 
360
+					OR `name` like '%" . $searchfields."%' 
361
+					OR `description` like '%" . $searchfields."%' 
362
+					OR `snippet` like '%" . $searchfields."%'  
363
+					OR `properties` like '%" . $searchfields."%'      
364
+					OR `moduleguid` like '%" . $searchfields."%'");
365 365
                     $snippetscounts = $modx->getDatabase()->getRecordCount($rs);
366 366
                     if ($snippetscounts > 0) {
367
-                        $output .= '<li><b><i class="fa fa-code"></i> ' . $_lang["manage_snippets"] . ' (' . $snippetscounts . ')</b></li>';
367
+                        $output .= '<li><b><i class="fa fa-code"></i> '.$_lang["manage_snippets"].' ('.$snippetscounts.')</b></li>';
368 368
                         while ($row = $modx->getDatabase()->getRow($rs)) {
369
-                            $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=22&id=' . $row['id'] . '" id="snippets_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>';
369
+                            $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=22&id='.$row['id'].'" id="snippets_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>';
370 370
                         }
371 371
                     }
372 372
                 }
373 373
 
374 374
                 //plugins
375 375
                 if ($modx->hasPermission('edit_plugin')) {
376
-                    $rs = $modx->getDatabase()->select("id,name,locked,disabled", $modx->getDatabase()->getFullTableName('site_plugins'), "`id` like '%" . $searchfields . "%' 
377
-					OR `name` like '%" . $searchfields . "%' 
378
-					OR `description` like '%" . $searchfields . "%' 
379
-					OR `plugincode` like '%" . $searchfields . "%'  
380
-					OR `properties` like '%" . $searchfields . "%'      
381
-					OR `moduleguid` like '%" . $searchfields . "%'");
376
+                    $rs = $modx->getDatabase()->select("id,name,locked,disabled", $modx->getDatabase()->getFullTableName('site_plugins'), "`id` like '%".$searchfields."%' 
377
+					OR `name` like '%" . $searchfields."%' 
378
+					OR `description` like '%" . $searchfields."%' 
379
+					OR `plugincode` like '%" . $searchfields."%'  
380
+					OR `properties` like '%" . $searchfields."%'      
381
+					OR `moduleguid` like '%" . $searchfields."%'");
382 382
                     $pluginscounts = $modx->getDatabase()->getRecordCount($rs);
383 383
                     if ($pluginscounts > 0) {
384
-                        $output .= '<li><b><i class="fa fa-plug"></i> ' . $_lang["manage_plugins"] . ' (' . $pluginscounts . ')</b></li>';
384
+                        $output .= '<li><b><i class="fa fa-plug"></i> '.$_lang["manage_plugins"].' ('.$pluginscounts.')</b></li>';
385 385
                         while ($row = $modx->getDatabase()->getRow($rs)) {
386
-                            $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=102&id=' . $row['id'] . '" id="plugins_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>';
386
+                            $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=102&id='.$row['id'].'" id="plugins_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>';
387 387
                         }
388 388
                     }
389 389
                 }
390 390
 
391 391
                 //modules
392 392
                 if ($modx->hasPermission('edit_module')) {
393
-                    $rs = $modx->getDatabase()->select("id,name,locked,disabled", $modx->getDatabase()->getFullTableName('site_modules'), "`id` like '%" . $searchfields . "%' 
394
-                    OR `name` like '%" . $searchfields . "%' 
395
-                    OR `description` like '%" . $searchfields . "%' 
396
-                    OR `modulecode` like '%" . $searchfields . "%'  
397
-                    OR `properties` like '%" . $searchfields . "%'  
398
-                    OR `guid` like '%" . $searchfields . "%'      
399
-                    OR `resourcefile` like '%" . $searchfields . "%'");
393
+                    $rs = $modx->getDatabase()->select("id,name,locked,disabled", $modx->getDatabase()->getFullTableName('site_modules'), "`id` like '%".$searchfields."%' 
394
+                    OR `name` like '%" . $searchfields."%' 
395
+                    OR `description` like '%" . $searchfields."%' 
396
+                    OR `modulecode` like '%" . $searchfields."%'  
397
+                    OR `properties` like '%" . $searchfields."%'  
398
+                    OR `guid` like '%" . $searchfields."%'      
399
+                    OR `resourcefile` like '%" . $searchfields."%'");
400 400
                     $modulescounts = $modx->getDatabase()->getRecordCount($rs);
401 401
                     if ($modulescounts > 0) {
402
-                        $output .= '<li><b><i class="fa fa-cogs"></i> ' . $_lang["modules"] . ' (' . $modulescounts . ')</b></li>';
402
+                        $output .= '<li><b><i class="fa fa-cogs"></i> '.$_lang["modules"].' ('.$modulescounts.')</b></li>';
403 403
                         while ($row = $modx->getDatabase()->getRow($rs)) {
404
-                            $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=108&id=' . $row['id'] . '" id="modules_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>';
404
+                            $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=108&id='.$row['id'].'" id="modules_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>';
405 405
                         }
406 406
                     }
407 407
                 }
408 408
 
409
-                echo $output ? '<div class="ajaxSearchResults"><ul>' . $output . '</ul></div>' : '1';
409
+                echo $output ? '<div class="ajaxSearchResults"><ul>'.$output.'</ul></div>' : '1';
410 410
             }
411 411
 
412 412
             ?>
Please login to merge, or discard this patch.
manager/actions/mutate_user.dynamic.php 4 patches
Switch Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -4,18 +4,18 @@
 block discarded – undo
4 4
 }
5 5
 
6 6
 switch($modx->getManagerApi()->action) {
7
-	case 12:
8
-		if(!$modx->hasPermission('edit_user')) {
9
-			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
10
-		}
11
-		break;
12
-	case 11:
13
-		if(!$modx->hasPermission('new_user')) {
14
-			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
15
-		}
16
-		break;
17
-	default:
18
-		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7
+	    case 12:
8
+		    if(!$modx->hasPermission('edit_user')) {
9
+			    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
10
+		    }
11
+		    break;
12
+	    case 11:
13
+		    if(!$modx->hasPermission('new_user')) {
14
+			    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
15
+		    }
16
+		    break;
17
+	    default:
18
+		    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
19 19
 }
20 20
 
21 21
 $user = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
Please login to merge, or discard this patch.
Indentation   +156 added lines, -156 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@  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
 
6 6
 switch($modx->getManagerApi()->action) {
7
-	case 12:
8
-		if(!$modx->hasPermission('edit_user')) {
9
-			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
10
-		}
11
-		break;
12
-	case 11:
13
-		if(!$modx->hasPermission('new_user')) {
14
-			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
15
-		}
16
-		break;
17
-	default:
18
-		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7
+    case 12:
8
+        if(!$modx->hasPermission('edit_user')) {
9
+            $modx->webAlertAndQuit($_lang["error_no_privileges"]);
10
+        }
11
+        break;
12
+    case 11:
13
+        if(!$modx->hasPermission('new_user')) {
14
+            $modx->webAlertAndQuit($_lang["error_no_privileges"]);
15
+        }
16
+        break;
17
+    default:
18
+        $modx->webAlertAndQuit($_lang["error_no_privileges"]);
19 19
 }
20 20
 
21 21
 $user = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
@@ -23,79 +23,79 @@  discard block
 block discarded – undo
23 23
 // check to see the snippet editor isn't locked
24 24
 $rs = $modx->getDatabase()->select('username', $modx->getDatabase()->getFullTableName('active_users'), "action=12 AND id='{$user}' AND internalKey!='" . $modx->getLoginUserID() . "'");
25 25
 if($username = $modx->getDatabase()->getValue($rs)) {
26
-	$modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "user"));
26
+    $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "user"));
27 27
 }
28 28
 // end check for lock
29 29
 
30 30
 if($modx->getManagerApi()->action == '12') {
31
-	// get user attribute
32
-	$rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('user_attributes'), "internalKey = '{$user}'");
33
-	$userdata = $modx->getDatabase()->getRow($rs);
34
-	if(!$userdata) {
35
-		$modx->webAlertAndQuit("No user returned!");
36
-	}
31
+    // get user attribute
32
+    $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('user_attributes'), "internalKey = '{$user}'");
33
+    $userdata = $modx->getDatabase()->getRow($rs);
34
+    if(!$userdata) {
35
+        $modx->webAlertAndQuit("No user returned!");
36
+    }
37 37
 
38 38
     if($_SESSION['mgrRole'] != 1 && $userdata['role'] == 1) {
39 39
         $modx->webAlertAndQuit('Illegal attempt to create/modify administrator by non-administrator!');
40 40
     }
41 41
 
42 42
 
43
-	// get user settings
44
-	$rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('user_settings'), "user = '{$user}'");
45
-	$usersettings = array();
46
-	while($row = $modx->getDatabase()->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value'];
47
-	// manually extract so that user display settings are not overwritten
48
-	foreach($usersettings as $k => $v) {
49
-		if($k != 'manager_language' && $k != 'manager_theme') {
50
-			${$k} = $v;
51
-		}
52
-	}
43
+    // get user settings
44
+    $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('user_settings'), "user = '{$user}'");
45
+    $usersettings = array();
46
+    while($row = $modx->getDatabase()->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value'];
47
+    // manually extract so that user display settings are not overwritten
48
+    foreach($usersettings as $k => $v) {
49
+        if($k != 'manager_language' && $k != 'manager_theme') {
50
+            ${$k} = $v;
51
+        }
52
+    }
53 53
 
54
-	// get user name
55
-	$rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('manager_users'), "id = '{$user}'");
56
-	$usernamedata = $modx->getDatabase()->getRow($rs);
57
-	if(!$usernamedata) {
58
-		$modx->webAlertAndQuit("No user returned while getting username!");
59
-	}
60
-	$_SESSION['itemname'] = $usernamedata['username'];
54
+    // get user name
55
+    $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('manager_users'), "id = '{$user}'");
56
+    $usernamedata = $modx->getDatabase()->getRow($rs);
57
+    if(!$usernamedata) {
58
+        $modx->webAlertAndQuit("No user returned while getting username!");
59
+    }
60
+    $_SESSION['itemname'] = $usernamedata['username'];
61 61
 } else {
62
-	$userdata = array();
63
-	$usersettings = array();
64
-	$usernamedata = array();
65
-	$_SESSION['itemname'] = $_lang["new_user"];
62
+    $userdata = array();
63
+    $usersettings = array();
64
+    $usernamedata = array();
65
+    $_SESSION['itemname'] = $_lang["new_user"];
66 66
 }
67 67
 
68 68
 // avoid doubling htmlspecialchars (already encoded in DB)
69 69
 foreach($userdata as $key => $val) {
70
-	$userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']);
70
+    $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']);
71 71
 };
72 72
 $usernamedata['username'] = html_entity_decode($usernamedata['username'], ENT_NOQUOTES, $modx->config['modx_charset']);
73 73
 
74 74
 // restore saved form
75 75
 $formRestored = false;
76 76
 if($modx->getManagerApi()->hasFormValues()) {
77
-	$modx->getManagerApi()->loadFormValues();
78
-	// restore post values
79
-	$userdata = array_merge($userdata, $_POST);
80
-	$userdata['dob'] = $modx->toTimeStamp($userdata['dob']);
81
-	$usernamedata['username'] = $userdata['newusername'];
82
-	$usernamedata['oldusername'] = $_POST['oldusername'];
83
-	$usersettings = array_merge($usersettings, $userdata);
84
-	$usersettings['allowed_days'] = is_array($_POST['allowed_days']) ? implode(",", $_POST['allowed_days']) : "";
85
-	extract($usersettings, EXTR_OVERWRITE);
77
+    $modx->getManagerApi()->loadFormValues();
78
+    // restore post values
79
+    $userdata = array_merge($userdata, $_POST);
80
+    $userdata['dob'] = $modx->toTimeStamp($userdata['dob']);
81
+    $usernamedata['username'] = $userdata['newusername'];
82
+    $usernamedata['oldusername'] = $_POST['oldusername'];
83
+    $usersettings = array_merge($usersettings, $userdata);
84
+    $usersettings['allowed_days'] = is_array($_POST['allowed_days']) ? implode(",", $_POST['allowed_days']) : "";
85
+    extract($usersettings, EXTR_OVERWRITE);
86 86
 }
87 87
 
88 88
 // include the country list language file
89 89
 $_country_lang = array();
90 90
 include_once "lang/country/english_country.inc.php";
91 91
 if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) {
92
-	include_once "lang/country/" . $manager_language . "_country.inc.php";
92
+    include_once "lang/country/" . $manager_language . "_country.inc.php";
93 93
 }
94 94
 asort($_country_lang);
95 95
 
96 96
 $displayStyle = ($_SESSION['browser'] === 'modern') ? 'table-row' : 'block';
97 97
 if($which_browser == 'default') {
98
-	$which_browser = $modx->configGlobal['which_browser'] ? $modx->configGlobal['which_browser'] : $modx->config['which_browser'];
98
+    $which_browser = $modx->configGlobal['which_browser'] ? $modx->configGlobal['which_browser'] : $modx->config['which_browser'];
99 99
 }
100 100
 ?>
101 101
 <script type="text/javascript">
@@ -205,14 +205,14 @@  discard block
 block discarded – undo
205 205
 <form action="index.php?a=32" method="post" name="userform">
206 206
 	<?php
207 207
 
208
-	// invoke OnUserFormPrerender event
209
-	$evtOut = $modx->invokeEvent("OnUserFormPrerender", array(
210
-		"id" => $user
211
-	));
212
-	if(is_array($evtOut)) {
213
-		echo implode("", $evtOut);
214
-	}
215
-	?>
208
+    // invoke OnUserFormPrerender event
209
+    $evtOut = $modx->invokeEvent("OnUserFormPrerender", array(
210
+        "id" => $user
211
+    ));
212
+    if(is_array($evtOut)) {
213
+        echo implode("", $evtOut);
214
+    }
215
+    ?>
216 216
 	<input type="hidden" name="mode" value="<?php echo $modx->getManagerApi()->action; ?>">
217 217
 	<input type="hidden" name="id" value="<?php echo $user ?>">
218 218
 	<input type="hidden" name="blockedmode" value="<?php echo ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || ($userdata['blockedafter'] < time() && $userdata['blockedafter'] != 0) || $userdata['failedlogins'] > 3) ? "1" : "0" ?>" />
@@ -305,25 +305,25 @@  discard block
 block discarded – undo
305 305
 						<td>&nbsp;</td>
306 306
 						<td><?php
307 307
 
308
-							$rs = $modx->getDatabase()->select(
309
-							        'name, id',
308
+                            $rs = $modx->getDatabase()->select(
309
+                                    'name, id',
310 310
                                     $modx->getDatabase()->getFullTableName('user_roles'),
311 311
                                     ($modx->hasPermission('save_role')) ? '' : 'id != 1'
312 312
                             );
313
-							?>
313
+                            ?>
314 314
 							<select name="role" class="inputBox" onChange='documentDirty=true;' style="width:300px">
315 315
 								<?php
316
-								while($row = $modx->getDatabase()->getRow($rs)) {
317
-									if($modx->getManagerApi()->action == '11') {
318
-										$selectedtext = $row['id'] == '1' ? ' selected="selected"' : '';
319
-									} else {
320
-										$selectedtext = $row['id'] == $userdata['role'] ? "selected='selected'" : '';
321
-									}
322
-									?>
316
+                                while($row = $modx->getDatabase()->getRow($rs)) {
317
+                                    if($modx->getManagerApi()->action == '11') {
318
+                                        $selectedtext = $row['id'] == '1' ? ' selected="selected"' : '';
319
+                                    } else {
320
+                                        $selectedtext = $row['id'] == $userdata['role'] ? "selected='selected'" : '';
321
+                                    }
322
+                                    ?>
323 323
 									<option value="<?php echo $row['id']; ?>"<?php echo $selectedtext; ?>><?php echo $row['name']; ?></option>
324 324
 									<?php
325
-								}
326
-								?>
325
+                                }
326
+                                ?>
327 327
 							</select></td>
328 328
 					</tr>
329 329
 					<tr>
@@ -368,10 +368,10 @@  discard block
 block discarded – undo
368 368
 								<?php $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $userdata['country']; ?>
369 369
 								<option value="" <?php (!isset($chosenCountry) ? ' selected' : '') ?> >&nbsp;</option>
370 370
 								<?php
371
-								foreach($_country_lang as $key => $country) {
372
-									echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>";
373
-								}
374
-								?>
371
+                                foreach($_country_lang as $key => $country) {
372
+                                    echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>";
373
+                                }
374
+                                ?>
375 375
 							</select></td>
376 376
 					</tr>
377 377
 					<tr>
@@ -447,21 +447,21 @@  discard block
 block discarded – undo
447 447
 						<td><select name="manager_language" class="inputBox" onChange="documentDirty=true">
448 448
 								<option value=""></option>
449 449
 								<?php
450
-								$activelang = !empty($usersettings['manager_language']) ? $usersettings['manager_language'] : '';
451
-								$dir = dir("includes/lang");
452
-								while($file = $dir->read()) {
453
-									if(strpos($file, ".inc.php") > 0) {
454
-										$endpos = strpos($file, ".");
455
-										$languagename = substr($file, 0, $endpos);
456
-										$selectedtext = $languagename == $activelang ? "selected='selected'" : "";
457
-										?>
450
+                                $activelang = !empty($usersettings['manager_language']) ? $usersettings['manager_language'] : '';
451
+                                $dir = dir("includes/lang");
452
+                                while($file = $dir->read()) {
453
+                                    if(strpos($file, ".inc.php") > 0) {
454
+                                        $endpos = strpos($file, ".");
455
+                                        $languagename = substr($file, 0, $endpos);
456
+                                        $selectedtext = $languagename == $activelang ? "selected='selected'" : "";
457
+                                        ?>
458 458
 										<option value="<?php echo $languagename; ?>" <?php echo $selectedtext; ?>><?php echo ucwords(str_replace("_", " ", $languagename)); ?></option>
459 459
 										<?php
460 460
 
461
-									}
462
-								}
463
-								$dir->close();
464
-								?>
461
+                                    }
462
+                                }
463
+                                $dir->close();
464
+                                ?>
465 465
 							</select></td>
466 466
 					</tr>
467 467
 					<tr>
@@ -536,22 +536,22 @@  discard block
 block discarded – undo
536 536
 						<td><select name="manager_theme" class="inputBox" onChange="documentDirty=true;document.userform.theme_refresher.value = Date.parse(new Date());">
537 537
 								<option value=""></option>
538 538
 								<?php
539
-								$dir = dir("media/style/");
540
-								while($file = $dir->read()) {
541
-									if($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') {
542
-										$themename = $file;
543
-										if($themename === 'common') {
544
-											continue;
545
-										}
546
-										$attr = 'value="' . $themename . '" ';
547
-										if(isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) {
548
-											$attr .= 'selected="selected" ';
549
-										}
550
-										echo "\t\t<option " . rtrim($attr) . '>' . ucwords(str_replace("_", " ", $themename)) . "</option>\n";
551
-									}
552
-								}
553
-								$dir->close();
554
-								?>
539
+                                $dir = dir("media/style/");
540
+                                while($file = $dir->read()) {
541
+                                    if($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') {
542
+                                        $themename = $file;
543
+                                        if($themename === 'common') {
544
+                                            continue;
545
+                                        }
546
+                                        $attr = 'value="' . $themename . '" ';
547
+                                        if(isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) {
548
+                                            $attr .= 'selected="selected" ';
549
+                                        }
550
+                                        echo "\t\t<option " . rtrim($attr) . '>' . ucwords(str_replace("_", " ", $themename)) . "</option>\n";
551
+                                    }
552
+                                }
553
+                                $dir->close();
554
+                                ?>
555 555
 							</select>
556 556
 							<input type="hidden" name="theme_refresher" value=""></td>
557 557
 					</tr>
@@ -587,15 +587,15 @@  discard block
 block discarded – undo
587 587
 						<th><?php echo $_lang["which_browser_title"] ?></th>
588 588
 						<td><select name="which_browser" class="inputBox" onChange="documentDirty=true;">
589 589
 								<?php
590
-								$selected = 'default' == $usersettings['which_browser'] || !$usersettings['which_browser'] ? ' selected="selected"' : '';
591
-								echo '<option value="default"' . $selected . '>' . $_lang['option_default'] . "</option>\n";
592
-								foreach(glob("media/browser/*", GLOB_ONLYDIR) as $dir) {
593
-									$dir = str_replace('\\', '/', $dir);
594
-									$browser_name = substr($dir, strrpos($dir, '/') + 1);
595
-									$selected = $browser_name == $usersettings['which_browser'] ? ' selected="selected"' : '';
596
-									echo '<option value="' . $browser_name . '"' . $selected . '>' . "{$browser_name}</option>\n";
597
-								}
598
-								?>
590
+                                $selected = 'default' == $usersettings['which_browser'] || !$usersettings['which_browser'] ? ' selected="selected"' : '';
591
+                                echo '<option value="default"' . $selected . '>' . $_lang['option_default'] . "</option>\n";
592
+                                foreach(glob("media/browser/*", GLOB_ONLYDIR) as $dir) {
593
+                                    $dir = str_replace('\\', '/', $dir);
594
+                                    $browser_name = substr($dir, strrpos($dir, '/') + 1);
595
+                                    $selected = $browser_name == $usersettings['which_browser'] ? ' selected="selected"' : '';
596
+                                    echo '<option value="' . $browser_name . '"' . $selected . '>' . "{$browser_name}</option>\n";
597
+                                }
598
+                                ?>
599 599
 							</select></td>
600 600
 					</tr>
601 601
 					<tr>
@@ -672,17 +672,17 @@  discard block
 block discarded – undo
672 672
 								<option value=""></option>
673 673
 								<?php
674 674
 
675
-								$edt = isset ($usersettings["which_editor"]) ? $usersettings["which_editor"] : '';
676
-								// invoke OnRichTextEditorRegister event
677
-								$evtOut = $modx->invokeEvent("OnRichTextEditorRegister");
678
-								echo "<option value='none'" . ($edt == 'none' ? " selected='selected'" : "") . ">" . $_lang["none"] . "</option>\n";
679
-								if(is_array($evtOut)) {
680
-									for($i = 0; $i < count($evtOut); $i++) {
681
-										$editor = $evtOut[$i];
682
-										echo "<option value='$editor'" . ($edt == $editor ? " selected='selected'" : "") . ">$editor</option>\n";
683
-									}
684
-								}
685
-								?>
675
+                                $edt = isset ($usersettings["which_editor"]) ? $usersettings["which_editor"] : '';
676
+                                // invoke OnRichTextEditorRegister event
677
+                                $evtOut = $modx->invokeEvent("OnRichTextEditorRegister");
678
+                                echo "<option value='none'" . ($edt == 'none' ? " selected='selected'" : "") . ">" . $_lang["none"] . "</option>\n";
679
+                                if(is_array($evtOut)) {
680
+                                    for($i = 0; $i < count($evtOut); $i++) {
681
+                                        $editor = $evtOut[$i];
682
+                                        echo "<option value='$editor'" . ($edt == $editor ? " selected='selected'" : "") . ">$editor</option>\n";
683
+                                    }
684
+                                }
685
+                                ?>
686 686
 							</select></td>
687 687
 					</tr>
688 688
 					<tr id='editorRow1' style="display: <?php echo $use_editor == 1 ? $displayStyle : 'none'; ?>">
@@ -715,12 +715,12 @@  discard block
 block discarded – undo
715 715
 					</tr>
716 716
 				</table>
717 717
 				<?php
718
-				// invoke OnInterfaceSettingsRender event
719
-				$evtOut = $modx->invokeEvent("OnInterfaceSettingsRender");
720
-				if(is_array($evtOut)) {
721
-					echo implode("", $evtOut);
722
-				}
723
-				?>
718
+                // invoke OnInterfaceSettingsRender event
719
+                $evtOut = $modx->invokeEvent("OnInterfaceSettingsRender");
720
+                if(is_array($evtOut)) {
721
+                    echo implode("", $evtOut);
722
+                }
723
+                ?>
724 724
 			</div>
725 725
 
726 726
 			<!-- Photo -->
@@ -769,39 +769,39 @@  discard block
 block discarded – undo
769 769
 			</div>
770 770
 			<?php if($use_udperms == 1) {
771 771
 
772
-			$groupsarray = array();
773
-
774
-			if($modx->getManagerApi()->action == '12') { // only do this bit if the user is being edited
775
-				$rs = $modx->getDatabase()->select('user_group', $modx->getDatabase()->getFullTableName('member_groups'), "member='{$user}'");
776
-				$groupsarray = $modx->getDatabase()->getColumn('user_group', $rs);
777
-			}
778
-			// retain selected doc groups between post
779
-			if(is_array($_POST['user_groups'])) {
780
-				foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v;
781
-			}
782
-			?>
772
+            $groupsarray = array();
773
+
774
+            if($modx->getManagerApi()->action == '12') { // only do this bit if the user is being edited
775
+                $rs = $modx->getDatabase()->select('user_group', $modx->getDatabase()->getFullTableName('member_groups'), "member='{$user}'");
776
+                $groupsarray = $modx->getDatabase()->getColumn('user_group', $rs);
777
+            }
778
+            // retain selected doc groups between post
779
+            if(is_array($_POST['user_groups'])) {
780
+                foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v;
781
+            }
782
+            ?>
783 783
 			<div class="tab-page" id="tabAccess">
784 784
 				<h2 class="tab"><?php echo $_lang["access_permissions"] ?></h2>
785 785
 				<script type="text/javascript">tpUser.addTabPage(document.getElementById("tabAccess"));</script>
786 786
 				<p><?php echo $_lang['access_permissions_user_message'] ?></p>
787 787
 				<?php
788
-				$rs = $modx->getDatabase()->select('name, id', $modx->getDatabase()->getFullTableName('membergroup_names'), '', 'name');
789
-				while($row = $modx->getDatabase()->getRow($rs)) {
790
-					echo "<label><input type='checkbox' name='user_groups[]' value='" . $row['id'] . "'" . (in_array($row['id'], $groupsarray) ? " checked='checked'" : "") . " />" . $row['name'] . "</label><br />";
791
-				}
792
-				}
793
-				?>
788
+                $rs = $modx->getDatabase()->select('name, id', $modx->getDatabase()->getFullTableName('membergroup_names'), '', 'name');
789
+                while($row = $modx->getDatabase()->getRow($rs)) {
790
+                    echo "<label><input type='checkbox' name='user_groups[]' value='" . $row['id'] . "'" . (in_array($row['id'], $groupsarray) ? " checked='checked'" : "") . " />" . $row['name'] . "</label><br />";
791
+                }
792
+                }
793
+                ?>
794 794
 			</div>
795 795
 		</div>
796 796
 	</div>
797 797
 	<input type="submit" name="save" style="display:none">
798 798
 	<?php
799
-	// invoke OnUserFormRender event
800
-	$evtOut = $modx->invokeEvent("OnUserFormRender", array(
801
-		"id" => $user
802
-	));
803
-	if(is_array($evtOut)) {
804
-		echo implode("", $evtOut);
805
-	}
806
-	?>
799
+    // invoke OnUserFormRender event
800
+    $evtOut = $modx->invokeEvent("OnUserFormRender", array(
801
+        "id" => $user
802
+    ));
803
+    if(is_array($evtOut)) {
804
+        echo implode("", $evtOut);
805
+    }
806
+    ?>
807 807
 </form>
Please login to merge, or discard this patch.
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  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
-switch($modx->getManagerApi()->action) {
6
+switch ($modx->getManagerApi()->action) {
7 7
 	case 12:
8
-		if(!$modx->hasPermission('edit_user')) {
8
+		if (!$modx->hasPermission('edit_user')) {
9 9
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
10 10
 		}
11 11
 		break;
12 12
 	case 11:
13
-		if(!$modx->hasPermission('new_user')) {
13
+		if (!$modx->hasPermission('new_user')) {
14 14
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
15 15
 		}
16 16
 		break;
@@ -18,24 +18,24 @@  discard block
 block discarded – undo
18 18
 		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
19 19
 }
20 20
 
21
-$user = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
21
+$user = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
22 22
 
23 23
 // check to see the snippet editor isn't locked
24
-$rs = $modx->getDatabase()->select('username', $modx->getDatabase()->getFullTableName('active_users'), "action=12 AND id='{$user}' AND internalKey!='" . $modx->getLoginUserID() . "'");
25
-if($username = $modx->getDatabase()->getValue($rs)) {
24
+$rs = $modx->getDatabase()->select('username', $modx->getDatabase()->getFullTableName('active_users'), "action=12 AND id='{$user}' AND internalKey!='".$modx->getLoginUserID()."'");
25
+if ($username = $modx->getDatabase()->getValue($rs)) {
26 26
 	$modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "user"));
27 27
 }
28 28
 // end check for lock
29 29
 
30
-if($modx->getManagerApi()->action == '12') {
30
+if ($modx->getManagerApi()->action == '12') {
31 31
 	// get user attribute
32 32
 	$rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('user_attributes'), "internalKey = '{$user}'");
33 33
 	$userdata = $modx->getDatabase()->getRow($rs);
34
-	if(!$userdata) {
34
+	if (!$userdata) {
35 35
 		$modx->webAlertAndQuit("No user returned!");
36 36
 	}
37 37
 
38
-    if($_SESSION['mgrRole'] != 1 && $userdata['role'] == 1) {
38
+    if ($_SESSION['mgrRole'] != 1 && $userdata['role'] == 1) {
39 39
         $modx->webAlertAndQuit('Illegal attempt to create/modify administrator by non-administrator!');
40 40
     }
41 41
 
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
 	// get user settings
44 44
 	$rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('user_settings'), "user = '{$user}'");
45 45
 	$usersettings = array();
46
-	while($row = $modx->getDatabase()->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value'];
46
+	while ($row = $modx->getDatabase()->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value'];
47 47
 	// manually extract so that user display settings are not overwritten
48
-	foreach($usersettings as $k => $v) {
49
-		if($k != 'manager_language' && $k != 'manager_theme') {
48
+	foreach ($usersettings as $k => $v) {
49
+		if ($k != 'manager_language' && $k != 'manager_theme') {
50 50
 			${$k} = $v;
51 51
 		}
52 52
 	}
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	// get user name
55 55
 	$rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('manager_users'), "id = '{$user}'");
56 56
 	$usernamedata = $modx->getDatabase()->getRow($rs);
57
-	if(!$usernamedata) {
57
+	if (!$usernamedata) {
58 58
 		$modx->webAlertAndQuit("No user returned while getting username!");
59 59
 	}
60 60
 	$_SESSION['itemname'] = $usernamedata['username'];
@@ -66,14 +66,14 @@  discard block
 block discarded – undo
66 66
 }
67 67
 
68 68
 // avoid doubling htmlspecialchars (already encoded in DB)
69
-foreach($userdata as $key => $val) {
69
+foreach ($userdata as $key => $val) {
70 70
 	$userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']);
71 71
 };
72 72
 $usernamedata['username'] = html_entity_decode($usernamedata['username'], ENT_NOQUOTES, $modx->config['modx_charset']);
73 73
 
74 74
 // restore saved form
75 75
 $formRestored = false;
76
-if($modx->getManagerApi()->hasFormValues()) {
76
+if ($modx->getManagerApi()->hasFormValues()) {
77 77
 	$modx->getManagerApi()->loadFormValues();
78 78
 	// restore post values
79 79
 	$userdata = array_merge($userdata, $_POST);
@@ -88,13 +88,13 @@  discard block
 block discarded – undo
88 88
 // include the country list language file
89 89
 $_country_lang = array();
90 90
 include_once "lang/country/english_country.inc.php";
91
-if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) {
92
-	include_once "lang/country/" . $manager_language . "_country.inc.php";
91
+if ($manager_language != "english" && file_exists($modx->config['site_manager_path']."includes/lang/country/".$manager_language."_country.inc.php")) {
92
+	include_once "lang/country/".$manager_language."_country.inc.php";
93 93
 }
94 94
 asort($_country_lang);
95 95
 
96 96
 $displayStyle = ($_SESSION['browser'] === 'modern') ? 'table-row' : 'block';
97
-if($which_browser == 'default') {
97
+if ($which_browser == 'default') {
98 98
 	$which_browser = $modx->configGlobal['which_browser'] ? $modx->configGlobal['which_browser'] : $modx->config['which_browser'];
99 99
 }
100 100
 ?>
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 			document.userform.save.click();
187 187
 		},
188 188
 		delete: function() {
189
-			<?php if($_GET['id'] == $modx->getLoginUserID()) { ?>
189
+			<?php if ($_GET['id'] == $modx->getLoginUserID()) { ?>
190 190
 			alert("<?php echo $_lang['alert_delete_self']; ?>");
191 191
 			<?php } else { ?>
192 192
 			if(confirm("<?php echo $_lang['confirm_delete_user']; ?>") === true) {
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 	$evtOut = $modx->invokeEvent("OnUserFormPrerender", array(
210 210
 		"id" => $user
211 211
 	));
212
-	if(is_array($evtOut)) {
212
+	if (is_array($evtOut)) {
213 213
 		echo implode("", $evtOut);
214 214
 	}
215 215
 	?>
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 	<input type="hidden" name="blockedmode" value="<?php echo ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || ($userdata['blockedafter'] < time() && $userdata['blockedafter'] != 0) || $userdata['failedlogins'] > 3) ? "1" : "0" ?>" />
219 219
 
220 220
 	<h1>
221
-        <i class="fa fa fa-user"></i><?= ($usernamedata['username'] ? $usernamedata['username'] . '<small>(' . $usernamedata['id'] . ')</small>' : $_lang['user_title']) ?>
221
+        <i class="fa fa fa-user"></i><?= ($usernamedata['username'] ? $usernamedata['username'].'<small>('.$usernamedata['id'].')</small>' : $_lang['user_title']) ?>
222 222
     </h1>
223 223
 
224 224
 	<?php echo $_style['actionbuttons']['dynamic']['user'] ?>
@@ -236,13 +236,13 @@  discard block
 block discarded – undo
236 236
 				<table border="0" cellspacing="0" cellpadding="3" class="table table--edit table--editUser">
237 237
 					<tr>
238 238
 						<td colspan="3"><span id="blocked" class="warning">
239
-							<?php if($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || $userdata['failedlogins'] > 3) { ?>
239
+							<?php if ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || $userdata['failedlogins'] > 3) { ?>
240 240
 								<?php echo $_lang['user_is_blocked']; ?>
241 241
 							<?php } ?>
242 242
 							</span>
243 243
 							<br /></td>
244 244
 					</tr>
245
-					<?php if(!empty($userdata['id'])) { ?>
245
+					<?php if (!empty($userdata['id'])) { ?>
246 246
 						<tr id="showname" style="display: <?php echo ($modx->getManagerApi()->action == '12' && (!isset($usernamedata['oldusername']) || $usernamedata['oldusername'] == $usernamedata['username'])) ? $displayStyle : 'none'; ?> ">
247 247
 							<td colspan="3"><i class="<?php echo $_style["icons_user"] ?>"></i>&nbsp;<b><?php echo $modx->getPhpCompat()->htmlspecialchars(!empty($usernamedata['oldusername']) ? $usernamedata['oldusername'] : $usernamedata['username']); ?></b> - <span class="comment"><a href="javascript:;" onClick="changeName();return false;"><?php echo $_lang["change_name"]; ?></a></span>
248 248
 								<input type="hidden" name="oldusername" value="<?php echo $modx->getPhpCompat()->htmlspecialchars(!empty($usernamedata['oldusername']) ? $usernamedata['oldusername'] : $usernamedata['username']); ?>" />
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 						<td><input type="text" name="newusername" class="inputBox" value="<?php echo $modx->getPhpCompat()->htmlspecialchars($usernamedata['username']); ?>" onChange='documentDirty=true;' maxlength="100" /></td>
256 256
 					</tr>
257 257
 					<tr>
258
-						<th><?php echo $modx->getManagerApi()->action == '11' ? $_lang['password'] . ":" : $_lang['change_password_new'] . ":"; ?></th>
258
+						<th><?php echo $modx->getManagerApi()->action == '11' ? $_lang['password'].":" : $_lang['change_password_new'].":"; ?></th>
259 259
 						<td>&nbsp;</td>
260 260
 						<td><input name="newpasswordcheck" type="checkbox" onClick="changestate(document.userform.newpassword);changePasswordState(document.userform.newpassword);"<?php echo $modx->getManagerApi()->action == "11" ? " checked disabled" : ""; ?>>
261 261
 							<input type="hidden" name="newpassword" value="<?php echo $modx->getManagerApi()->action == "11" ? 1 : 0; ?>" onChange="documentDirty=true;" />
@@ -313,8 +313,8 @@  discard block
 block discarded – undo
313 313
 							?>
314 314
 							<select name="role" class="inputBox" onChange='documentDirty=true;' style="width:300px">
315 315
 								<?php
316
-								while($row = $modx->getDatabase()->getRow($rs)) {
317
-									if($modx->getManagerApi()->action == '11') {
316
+								while ($row = $modx->getDatabase()->getRow($rs)) {
317
+									if ($modx->getManagerApi()->action == '11') {
318 318
 										$selectedtext = $row['id'] == '1' ? ' selected="selected"' : '';
319 319
 									} else {
320 320
 										$selectedtext = $row['id'] == $userdata['role'] ? "selected='selected'" : '';
@@ -368,8 +368,8 @@  discard block
 block discarded – undo
368 368
 								<?php $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $userdata['country']; ?>
369 369
 								<option value="" <?php (!isset($chosenCountry) ? ' selected' : '') ?> >&nbsp;</option>
370 370
 								<?php
371
-								foreach($_country_lang as $key => $country) {
372
-									echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>";
371
+								foreach ($_country_lang as $key => $country) {
372
+									echo "<option value=\"$key\"".(isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '').">$country</option>";
373 373
 								}
374 374
 								?>
375 375
 							</select></td>
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 						<td>&nbsp;</td>
396 396
 						<td><textarea type="text" name="comment" class="inputBox" rows="5" onChange="documentDirty=true;"><?php echo $modx->getPhpCompat()->htmlspecialchars($userdata['comment']); ?></textarea></td>
397 397
 					</tr>
398
-					<?php if($modx->getManagerApi()->action == '12') { ?>
398
+					<?php if ($modx->getManagerApi()->action == '12') { ?>
399 399
 						<tr>
400 400
 							<th><?php echo $_lang['user_logincount']; ?>:</th>
401 401
 							<td>&nbsp;</td>
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 						</tr>
433 433
 					<?php } ?>
434 434
 				</table>
435
-				<?php if($_GET['id'] == $modx->getLoginUserID()) { ?>
435
+				<?php if ($_GET['id'] == $modx->getLoginUserID()) { ?>
436 436
 					<p><?php echo $_lang['user_edit_self_msg']; ?></p>
437 437
 				<?php } ?>
438 438
 			</div>
@@ -449,8 +449,8 @@  discard block
 block discarded – undo
449 449
 								<?php
450 450
 								$activelang = !empty($usersettings['manager_language']) ? $usersettings['manager_language'] : '';
451 451
 								$dir = dir("includes/lang");
452
-								while($file = $dir->read()) {
453
-									if(strpos($file, ".inc.php") > 0) {
452
+								while ($file = $dir->read()) {
453
+									if (strpos($file, ".inc.php") > 0) {
454 454
 										$endpos = strpos($file, ".");
455 455
 										$languagename = substr($file, 0, $endpos);
456 456
 										$selectedtext = $languagename == $activelang ? "selected='selected'" : "";
@@ -537,17 +537,17 @@  discard block
 block discarded – undo
537 537
 								<option value=""></option>
538 538
 								<?php
539 539
 								$dir = dir("media/style/");
540
-								while($file = $dir->read()) {
541
-									if($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') {
540
+								while ($file = $dir->read()) {
541
+									if ($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') {
542 542
 										$themename = $file;
543
-										if($themename === 'common') {
543
+										if ($themename === 'common') {
544 544
 											continue;
545 545
 										}
546
-										$attr = 'value="' . $themename . '" ';
547
-										if(isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) {
546
+										$attr = 'value="'.$themename.'" ';
547
+										if (isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) {
548 548
 											$attr .= 'selected="selected" ';
549 549
 										}
550
-										echo "\t\t<option " . rtrim($attr) . '>' . ucwords(str_replace("_", " ", $themename)) . "</option>\n";
550
+										echo "\t\t<option ".rtrim($attr).'>'.ucwords(str_replace("_", " ", $themename))."</option>\n";
551 551
 									}
552 552
 								}
553 553
 								$dir->close();
@@ -588,12 +588,12 @@  discard block
 block discarded – undo
588 588
 						<td><select name="which_browser" class="inputBox" onChange="documentDirty=true;">
589 589
 								<?php
590 590
 								$selected = 'default' == $usersettings['which_browser'] || !$usersettings['which_browser'] ? ' selected="selected"' : '';
591
-								echo '<option value="default"' . $selected . '>' . $_lang['option_default'] . "</option>\n";
592
-								foreach(glob("media/browser/*", GLOB_ONLYDIR) as $dir) {
591
+								echo '<option value="default"'.$selected.'>'.$_lang['option_default']."</option>\n";
592
+								foreach (glob("media/browser/*", GLOB_ONLYDIR) as $dir) {
593 593
 									$dir = str_replace('\\', '/', $dir);
594 594
 									$browser_name = substr($dir, strrpos($dir, '/') + 1);
595 595
 									$selected = $browser_name == $usersettings['which_browser'] ? ' selected="selected"' : '';
596
-									echo '<option value="' . $browser_name . '"' . $selected . '>' . "{$browser_name}</option>\n";
596
+									echo '<option value="'.$browser_name.'"'.$selected.'>'."{$browser_name}</option>\n";
597 597
 								}
598 598
 								?>
599 599
 							</select></td>
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
 					</tr>
621 621
 					<tr>
622 622
 						<td>&nbsp;</td>
623
-						<td class='comment'><?php echo $_lang["uploadable_images_message"] . $_lang["user_upload_message"] ?></td>
623
+						<td class='comment'><?php echo $_lang["uploadable_images_message"].$_lang["user_upload_message"] ?></td>
624 624
 					</tr>
625 625
 					<tr>
626 626
 						<th><?php echo $_lang["uploadable_media_title"] ?></th>
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
 					</tr>
633 633
 					<tr>
634 634
 						<td>&nbsp;</td>
635
-						<td class='comment'><?php echo $_lang["uploadable_media_message"] . $_lang["user_upload_message"] ?></td>
635
+						<td class='comment'><?php echo $_lang["uploadable_media_message"].$_lang["user_upload_message"] ?></td>
636 636
 					</tr>
637 637
 					<tr>
638 638
 						<th><?php echo $_lang["uploadable_flash_title"] ?></th>
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
 					</tr>
645 645
 					<tr>
646 646
 						<td>&nbsp;</td>
647
-						<td class='comment'><?php echo $_lang["uploadable_flash_message"] . $_lang["user_upload_message"] ?></td>
647
+						<td class='comment'><?php echo $_lang["uploadable_flash_message"].$_lang["user_upload_message"] ?></td>
648 648
 					</tr>
649 649
 					<tr>
650 650
 						<th><?php echo $_lang["uploadable_files_title"] ?></th>
@@ -656,7 +656,7 @@  discard block
 block discarded – undo
656 656
 					</tr>
657 657
 					<tr>
658 658
 						<td>&nbsp;</td>
659
-						<td class='comment'><?php echo $_lang["uploadable_files_message"] . $_lang["user_upload_message"] ?></td>
659
+						<td class='comment'><?php echo $_lang["uploadable_files_message"].$_lang["user_upload_message"] ?></td>
660 660
 					</tr>
661 661
 					<tr class='row2'>
662 662
 						<th><?php echo $_lang["upload_maxsize_title"] ?></th>
@@ -675,11 +675,11 @@  discard block
 block discarded – undo
675 675
 								$edt = isset ($usersettings["which_editor"]) ? $usersettings["which_editor"] : '';
676 676
 								// invoke OnRichTextEditorRegister event
677 677
 								$evtOut = $modx->invokeEvent("OnRichTextEditorRegister");
678
-								echo "<option value='none'" . ($edt == 'none' ? " selected='selected'" : "") . ">" . $_lang["none"] . "</option>\n";
679
-								if(is_array($evtOut)) {
680
-									for($i = 0; $i < count($evtOut); $i++) {
678
+								echo "<option value='none'".($edt == 'none' ? " selected='selected'" : "").">".$_lang["none"]."</option>\n";
679
+								if (is_array($evtOut)) {
680
+									for ($i = 0; $i < count($evtOut); $i++) {
681 681
 										$editor = $evtOut[$i];
682
-										echo "<option value='$editor'" . ($edt == $editor ? " selected='selected'" : "") . ">$editor</option>\n";
682
+										echo "<option value='$editor'".($edt == $editor ? " selected='selected'" : "").">$editor</option>\n";
683 683
 									}
684 684
 								}
685 685
 								?>
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
 				<?php
718 718
 				// invoke OnInterfaceSettingsRender event
719 719
 				$evtOut = $modx->invokeEvent("OnInterfaceSettingsRender");
720
-				if(is_array($evtOut)) {
720
+				if (is_array($evtOut)) {
721 721
 					echo implode("", $evtOut);
722 722
 				}
723 723
 				?>
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
 					function BrowseServer() {
745 745
 						var w = screen.width * 0.7;
746 746
 						var h = screen.height * 0.7;
747
-						OpenServerBrowser("<?php echo MODX_MANAGER_URL; ?>media/browser/<?php echo $which_browser;?>/browser.php?Type=images", w, h);
747
+						OpenServerBrowser("<?php echo MODX_MANAGER_URL; ?>media/browser/<?php echo $which_browser; ?>/browser.php?Type=images", w, h);
748 748
 					}
749 749
 
750 750
 					function SetUrl(url, width, height, alt) {
@@ -767,17 +767,17 @@  discard block
 block discarded – undo
767 767
 					</tr>
768 768
 				</table>
769 769
 			</div>
770
-			<?php if($use_udperms == 1) {
770
+			<?php if ($use_udperms == 1) {
771 771
 
772 772
 			$groupsarray = array();
773 773
 
774
-			if($modx->getManagerApi()->action == '12') { // only do this bit if the user is being edited
774
+			if ($modx->getManagerApi()->action == '12') { // only do this bit if the user is being edited
775 775
 				$rs = $modx->getDatabase()->select('user_group', $modx->getDatabase()->getFullTableName('member_groups'), "member='{$user}'");
776 776
 				$groupsarray = $modx->getDatabase()->getColumn('user_group', $rs);
777 777
 			}
778 778
 			// retain selected doc groups between post
779
-			if(is_array($_POST['user_groups'])) {
780
-				foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v;
779
+			if (is_array($_POST['user_groups'])) {
780
+				foreach ($_POST['user_groups'] as $n => $v) $groupsarray[] = $v;
781 781
 			}
782 782
 			?>
783 783
 			<div class="tab-page" id="tabAccess">
@@ -786,8 +786,8 @@  discard block
 block discarded – undo
786 786
 				<p><?php echo $_lang['access_permissions_user_message'] ?></p>
787 787
 				<?php
788 788
 				$rs = $modx->getDatabase()->select('name, id', $modx->getDatabase()->getFullTableName('membergroup_names'), '', 'name');
789
-				while($row = $modx->getDatabase()->getRow($rs)) {
790
-					echo "<label><input type='checkbox' name='user_groups[]' value='" . $row['id'] . "'" . (in_array($row['id'], $groupsarray) ? " checked='checked'" : "") . " />" . $row['name'] . "</label><br />";
789
+				while ($row = $modx->getDatabase()->getRow($rs)) {
790
+					echo "<label><input type='checkbox' name='user_groups[]' value='".$row['id']."'".(in_array($row['id'], $groupsarray) ? " checked='checked'" : "")." />".$row['name']."</label><br />";
791 791
 				}
792 792
 				}
793 793
 				?>
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
 	$evtOut = $modx->invokeEvent("OnUserFormRender", array(
801 801
 		"id" => $user
802 802
 	));
803
-	if(is_array($evtOut)) {
803
+	if (is_array($evtOut)) {
804 804
 		echo implode("", $evtOut);
805 805
 	}
806 806
 	?>
Please login to merge, or discard this patch.
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,7 +43,9 @@  discard block
 block discarded – undo
43 43
 	// get user settings
44 44
 	$rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('user_settings'), "user = '{$user}'");
45 45
 	$usersettings = array();
46
-	while($row = $modx->getDatabase()->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value'];
46
+	while($row = $modx->getDatabase()->getRow($rs)) {
47
+	    $usersettings[$row['setting_name']] = $row['setting_value'];
48
+	}
47 49
 	// manually extract so that user display settings are not overwritten
48 50
 	foreach($usersettings as $k => $v) {
49 51
 		if($k != 'manager_language' && $k != 'manager_theme') {
@@ -771,13 +773,16 @@  discard block
 block discarded – undo
771 773
 
772 774
 			$groupsarray = array();
773 775
 
774
-			if($modx->getManagerApi()->action == '12') { // only do this bit if the user is being edited
776
+			if($modx->getManagerApi()->action == '12') {
777
+// only do this bit if the user is being edited
775 778
 				$rs = $modx->getDatabase()->select('user_group', $modx->getDatabase()->getFullTableName('member_groups'), "member='{$user}'");
776 779
 				$groupsarray = $modx->getDatabase()->getColumn('user_group', $rs);
777 780
 			}
778 781
 			// retain selected doc groups between post
779 782
 			if(is_array($_POST['user_groups'])) {
780
-				foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v;
783
+				foreach($_POST['user_groups'] as $n => $v) {
784
+				    $groupsarray[] = $v;
785
+				}
781 786
 			}
782 787
 			?>
783 788
 			<div class="tab-page" id="tabAccess">
Please login to merge, or discard this patch.