Completed
Pull Request — develop (#713)
by
unknown
08:07
created
manager/media/style/default/ajax.php 1 patch
Spacing   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -19,11 +19,11 @@  discard block
 block discarded – undo
19 19
 $modx->loadExtension("ManagerAPI");
20 20
 
21 21
 $_lang = array();
22
-include_once MODX_MANAGER_PATH . '/includes/lang/english.inc.php';
22
+include_once MODX_MANAGER_PATH.'/includes/lang/english.inc.php';
23 23
 if ($modx->config['manager_language'] != 'english') {
24
-    include_once MODX_MANAGER_PATH . '/includes/lang/' . $modx->config['manager_language'] . '.inc.php';
24
+    include_once MODX_MANAGER_PATH.'/includes/lang/'.$modx->config['manager_language'].'.inc.php';
25 25
 }
26
-include_once MODX_MANAGER_PATH . '/media/style/' . $modx->config['manager_theme'] . '/style.php';
26
+include_once MODX_MANAGER_PATH.'/media/style/'.$modx->config['manager_theme'].'/style.php';
27 27
 
28 28
 $action = isset($_REQUEST['a']) ? $_REQUEST['a'] : '';
29 29
 $frame = isset($_REQUEST['f']) ? $_REQUEST['f'] : '';
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
             switch ($frame) {
42 42
                 case 'nodes':
43
-                    include_once MODX_MANAGER_PATH . '/frames/nodes.php';
43
+                    include_once MODX_MANAGER_PATH.'/frames/nodes.php';
44 44
 
45 45
                     break;
46 46
             }
@@ -58,21 +58,21 @@  discard block
 block discarded – undo
58 58
                 $sql = '';
59 59
                 $a = '';
60 60
                 $filter = !empty($_REQUEST['filter']) && is_scalar($_REQUEST['filter']) ? addcslashes(trim($_REQUEST['filter']), '%*_') : '';
61
-                $sqlLike = $filter ? 'WHERE t1.name LIKE "' . $modx->db->escape($filter) . '%"' : '';
62
-                $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit;
61
+                $sqlLike = $filter ? 'WHERE t1.name LIKE "'.$modx->db->escape($filter).'%"' : '';
62
+                $sqlLimit = $sqlLike ? '' : 'LIMIT '.$limit;
63 63
 
64 64
                 switch ($elements) {
65 65
                     case 'element_templates':
66 66
                         $a = 16;
67
-                        $sqlLike = $filter ? 'WHERE t1.templatename LIKE "' . $modx->db->escape($filter) . '%"' : '';
67
+                        $sqlLike = $filter ? 'WHERE t1.templatename LIKE "'.$modx->db->escape($filter).'%"' : '';
68 68
                         $sql = $modx->db->query('SELECT t1.*, t1.templatename AS name
69
-                        FROM ' . $modx->getFullTableName('site_templates') . ' AS t1
70
-                        ' . $sqlLike . '
69
+                        FROM ' . $modx->getFullTableName('site_templates').' AS t1
70
+                        ' . $sqlLike.'
71 71
                         ORDER BY t1.templatename ASC
72 72
                         ' . $sqlLimit);
73 73
 
74 74
                         if ($modx->hasPermission('new_template')) {
75
-                            $output .= '<li><a id="a_19" href="index.php?a=19" target="main"><i class="fa fa-plus"></i>' . $_lang['new_template'] . '</a></li>';
75
+                            $output .= '<li><a id="a_19" href="index.php?a=19" target="main"><i class="fa fa-plus"></i>'.$_lang['new_template'].'</a></li>';
76 76
                         }
77 77
 
78 78
                         break;
@@ -80,15 +80,15 @@  discard block
 block discarded – undo
80 80
                     case 'element_tplvars':
81 81
                         $a = 301;
82 82
                         $sql = $modx->db->query('SELECT t1.id,t1.name,t1.locked, IF(MIN(t2.tmplvarid),0,1) AS disabled
83
-                        FROM ' . $modx->getFullTableName('site_tmplvars') . ' AS t1
84
-                        LEFT JOIN ' . $modx->getFullTableName('site_tmplvar_templates') . ' AS t2 ON t1.id=t2.tmplvarid
85
-                        ' . $sqlLike . '
83
+                        FROM ' . $modx->getFullTableName('site_tmplvars').' AS t1
84
+                        LEFT JOIN ' . $modx->getFullTableName('site_tmplvar_templates').' AS t2 ON t1.id=t2.tmplvarid
85
+                        ' . $sqlLike.'
86 86
                         GROUP BY t1.id
87 87
                         ORDER BY t1.name ASC
88 88
                         ' . $sqlLimit);
89 89
 
90 90
                         if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) {
91
-                            $output .= '<li><a id="a_300" href="index.php?a=300" target="main"><i class="fa fa-plus"></i>' . $_lang['new_tmplvars'] . '</a></li>';
91
+                            $output .= '<li><a id="a_300" href="index.php?a=300" target="main"><i class="fa fa-plus"></i>'.$_lang['new_tmplvars'].'</a></li>';
92 92
                         }
93 93
 
94 94
                         break;
@@ -96,13 +96,13 @@  discard block
 block discarded – undo
96 96
                     case 'element_htmlsnippets':
97 97
                         $a = 78;
98 98
                         $sql = $modx->db->query('SELECT t1.*
99
-                        FROM ' . $modx->getFullTableName('site_htmlsnippets') . ' AS t1
100
-                        ' . $sqlLike . '
99
+                        FROM ' . $modx->getFullTableName('site_htmlsnippets').' AS t1
100
+                        ' . $sqlLike.'
101 101
                         ORDER BY t1.name ASC
102 102
                         ' . $sqlLimit);
103 103
 
104 104
                         if ($modx->hasPermission('new_chunk')) {
105
-                            $output .= '<li><a id="a_77" href="index.php?a=77" target="main"><i class="fa fa-plus"></i>' . $_lang['new_htmlsnippet'] . '</a></li>';
105
+                            $output .= '<li><a id="a_77" href="index.php?a=77" target="main"><i class="fa fa-plus"></i>'.$_lang['new_htmlsnippet'].'</a></li>';
106 106
                         }
107 107
 
108 108
                         break;
@@ -110,13 +110,13 @@  discard block
 block discarded – undo
110 110
                     case 'element_snippets':
111 111
                         $a = 22;
112 112
                         $sql = $modx->db->query('SELECT t1.*
113
-                        FROM ' . $modx->getFullTableName('site_snippets') . ' AS t1
114
-                        ' . $sqlLike . '
113
+                        FROM ' . $modx->getFullTableName('site_snippets').' AS t1
114
+                        ' . $sqlLike.'
115 115
                         ORDER BY t1.name ASC
116 116
                         ' . $sqlLimit);
117 117
 
118 118
                         if ($modx->hasPermission('new_snippet')) {
119
-                            $output .= '<li><a id="a_23" href="index.php?a=23" target="main"><i class="fa fa-plus"></i>' . $_lang['new_snippet'] . '</a></li>';
119
+                            $output .= '<li><a id="a_23" href="index.php?a=23" target="main"><i class="fa fa-plus"></i>'.$_lang['new_snippet'].'</a></li>';
120 120
                         }
121 121
 
122 122
                         break;
@@ -124,13 +124,13 @@  discard block
 block discarded – undo
124 124
                     case 'element_plugins':
125 125
                         $a = 102;
126 126
                         $sql = $modx->db->query('SELECT t1.*
127
-                        FROM ' . $modx->getFullTableName('site_plugins') . ' AS t1
128
-                        ' . $sqlLike . '
127
+                        FROM ' . $modx->getFullTableName('site_plugins').' AS t1
128
+                        ' . $sqlLike.'
129 129
                         ORDER BY t1.name ASC
130 130
                         ' . $sqlLimit);
131 131
 
132 132
                         if ($modx->hasPermission('new_plugin')) {
133
-                            $output .= '<li><a id="a_101" href="index.php?a=101" target="main"><i class="fa fa-plus"></i>' . $_lang['new_plugin'] . '</a></li>';
133
+                            $output .= '<li><a id="a_101" href="index.php?a=101" target="main"><i class="fa fa-plus"></i>'.$_lang['new_plugin'].'</a></li>';
134 134
                         }
135 135
 
136 136
                         break;
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
                             continue;
146 146
                         }
147 147
 
148
-                        $items .= '<li class="item ' . ($row['disabled'] ? 'disabled' : '') . ($row['locked'] ? ' locked' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main" data-parent-id="a_76__elements_' . $elements . '">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>' . "\n";
148
+                        $items .= '<li class="item '.($row['disabled'] ? 'disabled' : '').($row['locked'] ? ' locked' : '').'"><a id="a_'.$a.'__id_'.$row['id'].'" href="index.php?a='.$a.'&id='.$row['id'].'" target="main" data-parent-id="a_76__elements_'.$elements.'">'.$row['name'].' <small>('.$row['id'].')</small></a></li>'."\n";
149 149
                     }
150 150
                 }
151 151
 
@@ -166,18 +166,18 @@  discard block
 block discarded – undo
166 166
             $output = '';
167 167
             $items = '';
168 168
             $filter = !empty($_REQUEST['filter']) && is_scalar($_REQUEST['filter']) ? addcslashes(trim($_REQUEST['filter']), '\%*_') : '';
169
-            $sqlLike = $filter ? 'WHERE t1.username LIKE "' . $modx->db->escape($filter) . '%"' : '';
170
-            $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit;
169
+            $sqlLike = $filter ? 'WHERE t1.username LIKE "'.$modx->db->escape($filter).'%"' : '';
170
+            $sqlLimit = $sqlLike ? '' : 'LIMIT '.$limit;
171 171
 
172 172
             $sql = $modx->db->query('SELECT t1.*, t1.username AS name, t2.blocked
173
-				FROM ' . $modx->getFullTableName('manager_users') . ' AS t1
174
-				LEFT JOIN ' . $modx->getFullTableName('user_attributes') . ' AS t2 ON t1.id=t2.internalKey
175
-				' . $sqlLike . '
173
+				FROM ' . $modx->getFullTableName('manager_users').' AS t1
174
+				LEFT JOIN ' . $modx->getFullTableName('user_attributes').' AS t2 ON t1.id=t2.internalKey
175
+				' . $sqlLike.'
176 176
 				ORDER BY t1.username ASC
177 177
 				' . $sqlLimit);
178 178
 
179 179
             if ($modx->hasPermission('new_user')) {
180
-                $output .= '<li><a id="a_11" href="index.php?a=11" target="main"><i class="fa fa-plus"></i>' . $_lang['new_user'] . '</a></li>';
180
+                $output .= '<li><a id="a_11" href="index.php?a=11" target="main"><i class="fa fa-plus"></i>'.$_lang['new_user'].'</a></li>';
181 181
             }
182 182
 
183 183
             if ($count = $modx->db->getRecordCount($sql)) {
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
                     $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>';
186 186
                 }
187 187
                 while ($row = $modx->db->getRow($sql)) {
188
-                    $items .= '<li class="item ' . ($row['blocked'] ? 'disabled' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>';
188
+                    $items .= '<li class="item '.($row['blocked'] ? 'disabled' : '').'"><a id="a_'.$a.'__id_'.$row['id'].'" href="index.php?a='.$a.'&id='.$row['id'].'" target="main">'.$row['name'].' <small>('.$row['id'].')</small></a></li>';
189 189
                 }
190 190
             }
191 191
 
@@ -205,18 +205,18 @@  discard block
 block discarded – undo
205 205
             $output = '';
206 206
             $items = '';
207 207
             $filter = !empty($_REQUEST['filter']) && is_scalar($_REQUEST['filter']) ? addcslashes(trim($_REQUEST['filter']), '\%*_') : '';
208
-            $sqlLike = $filter ? 'WHERE t1.username LIKE "' . $modx->db->escape($filter) . '%"' : '';
209
-            $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit;
208
+            $sqlLike = $filter ? 'WHERE t1.username LIKE "'.$modx->db->escape($filter).'%"' : '';
209
+            $sqlLimit = $sqlLike ? '' : 'LIMIT '.$limit;
210 210
 
211 211
             $sql = $modx->db->query('SELECT t1.*, t1.username AS name, t2.blocked
212
-				FROM ' . $modx->getFullTableName('web_users') . ' AS t1
213
-				LEFT JOIN ' . $modx->getFullTableName('web_user_attributes') . ' AS t2 ON t1.id=t2.internalKey
214
-				' . $sqlLike . '
212
+				FROM ' . $modx->getFullTableName('web_users').' AS t1
213
+				LEFT JOIN ' . $modx->getFullTableName('web_user_attributes').' AS t2 ON t1.id=t2.internalKey
214
+				' . $sqlLike.'
215 215
 				ORDER BY t1.username ASC
216 216
 				' . $sqlLimit);
217 217
 
218 218
             if ($modx->hasPermission('new_web_user')) {
219
-                $output .= '<li><a id="a_87" href="index.php?a=87" target="main"><i class="fa fa-plus"></i>' . $_lang['new_web_user'] . '</a></li>';
219
+                $output .= '<li><a id="a_87" href="index.php?a=87" target="main"><i class="fa fa-plus"></i>'.$_lang['new_web_user'].'</a></li>';
220 220
             }
221 221
 
222 222
             if ($count = $modx->db->getRecordCount($sql)) {
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
                     $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>';
225 225
                 }
226 226
                 while ($row = $modx->db->getRow($sql)) {
227
-                    $items .= '<li class="item ' . ($row['blocked'] ? 'disabled' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>';
227
+                    $items .= '<li class="item '.($row['blocked'] ? 'disabled' : '').'"><a id="a_'.$a.'__id_'.$row['id'].'" href="index.php?a='.$a.'&id='.$row['id'].'" target="main">'.$row['name'].' <small>('.$row['id'].')</small></a></li>';
228 228
                 }
229 229
             }
230 230
 
@@ -250,35 +250,35 @@  discard block
 block discarded – undo
250 250
                     case 'SnippetNoCache': {
251 251
 
252 252
                         $sql = $modx->db->query('SELECT *
253
-						FROM ' . $modx->getFullTableName('site_snippets') . '
254
-						WHERE name="' . $name . '"
253
+						FROM ' . $modx->getFullTableName('site_snippets').'
254
+						WHERE name="' . $name.'"
255 255
 						LIMIT 1');
256 256
 
257 257
                         if ($modx->db->getRecordCount($sql)) {
258 258
                             $row = $modx->db->getRow($sql);
259 259
                             $contextmenu = array(
260 260
                                 'header' => array(
261
-                                    'innerHTML' => '<i class="fa fa-code"></i> ' . $row['name']
261
+                                    'innerHTML' => '<i class="fa fa-code"></i> '.$row['name']
262 262
                                 ),
263 263
                                 'item' => array(
264
-                                    'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'],
265
-                                    'url' => "index.php?a=22&id=" . $row['id']
264
+                                    'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'],
265
+                                    'url' => "index.php?a=22&id=".$row['id']
266 266
                                 )
267 267
                             );
268 268
                             if (!empty($row['description'])) {
269 269
                                 $contextmenu['seperator'] = '';
270 270
                                 $contextmenu['description'] = array(
271
-                                    'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
271
+                                    'innerHTML' => '<i class="fa fa-info"></i> '.$row['description']
272 272
                                 );
273 273
                             }
274 274
                         } else {
275 275
                             $contextmenu = array(
276 276
                                 'header' => array(
277
-                                    'innerHTML' => '<i class="fa fa-code"></i> ' . $name
277
+                                    'innerHTML' => '<i class="fa fa-code"></i> '.$name
278 278
                                 ),
279 279
                                 'item' => array(
280
-                                    'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_snippet'],
281
-                                    'url' => "index.php?a=23&itemname=" . $name
280
+                                    'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_snippet'],
281
+                                    'url' => "index.php?a=23&itemname=".$name
282 282
                                 )
283 283
                             );
284 284
                         }
@@ -288,35 +288,35 @@  discard block
 block discarded – undo
288 288
                     case 'Chunk' : {
289 289
 
290 290
                         $sql = $modx->db->query('SELECT *
291
-						FROM ' . $modx->getFullTableName('site_htmlsnippets') . '
292
-						WHERE name="' . $name . '"
291
+						FROM ' . $modx->getFullTableName('site_htmlsnippets').'
292
+						WHERE name="' . $name.'"
293 293
 						LIMIT 1');
294 294
 
295 295
                         if ($modx->db->getRecordCount($sql)) {
296 296
                             $row = $modx->db->getRow($sql);
297 297
                             $contextmenu = array(
298 298
                                 'header' => array(
299
-                                    'innerHTML' => '<i class="fa fa-th-large"></i> ' . $row['name']
299
+                                    'innerHTML' => '<i class="fa fa-th-large"></i> '.$row['name']
300 300
                                 ),
301 301
                                 'item' => array(
302
-                                    'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'],
303
-                                    'url' => "index.php?a=78&id=" . $row['id']
302
+                                    'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'],
303
+                                    'url' => "index.php?a=78&id=".$row['id']
304 304
                                 )
305 305
                             );
306 306
                             if (!empty($row['description'])) {
307 307
                                 $contextmenu['seperator'] = '';
308 308
                                 $contextmenu['description'] = array(
309
-                                    'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
309
+                                    'innerHTML' => '<i class="fa fa-info"></i> '.$row['description']
310 310
                                 );
311 311
                             }
312 312
                         } else {
313 313
                             $contextmenu = array(
314 314
                                 'header' => array(
315
-                                    'innerHTML' => '<i class="fa fa-th-large"></i> ' . $name
315
+                                    'innerHTML' => '<i class="fa fa-th-large"></i> '.$name
316 316
                                 ),
317 317
                                 'item' => array(
318
-                                    'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_htmlsnippet'],
319
-                                    'url' => "index.php?a=77&itemname=" . $name
318
+                                    'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_htmlsnippet'],
319
+                                    'url' => "index.php?a=77&itemname=".$name
320 320
                                 )
321 321
                             );
322 322
                         }
@@ -325,8 +325,8 @@  discard block
 block discarded – undo
325 325
                     }
326 326
                     case 'AttributeValue': {
327 327
                         $sql = $modx->db->query('SELECT *
328
-						FROM ' . $modx->getFullTableName('site_htmlsnippets') . '
329
-						WHERE name="' . $name . '"
328
+						FROM ' . $modx->getFullTableName('site_htmlsnippets').'
329
+						WHERE name="' . $name.'"
330 330
 						LIMIT 1');
331 331
 
332 332
                         if ($modx->db->getRecordCount($sql)) {
@@ -336,52 +336,52 @@  discard block
 block discarded – undo
336 336
                                     'innerText' => $row['name']
337 337
                                 ),
338 338
                                 'item' => array(
339
-                                    'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'],
340
-                                    'url' => "index.php?a=78&id=" . $row['id']
339
+                                    'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'],
340
+                                    'url' => "index.php?a=78&id=".$row['id']
341 341
                                 )
342 342
                             );
343 343
                             if (!empty($row['description'])) {
344 344
                                 $contextmenu['seperator'] = '';
345 345
                                 $contextmenu['description'] = array(
346
-                                    'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
346
+                                    'innerHTML' => '<i class="fa fa-info"></i> '.$row['description']
347 347
                                 );
348 348
                             }
349 349
                         } else {
350 350
 
351 351
                             $sql = $modx->db->query('SELECT *
352
-							FROM ' . $modx->getFullTableName('site_snippets') . '
353
-							WHERE name="' . $name . '"
352
+							FROM ' . $modx->getFullTableName('site_snippets').'
353
+							WHERE name="' . $name.'"
354 354
 							LIMIT 1');
355 355
 
356 356
                             if ($modx->db->getRecordCount($sql)) {
357 357
                                 $row = $modx->db->getRow($sql);
358 358
                                 $contextmenu = array(
359 359
                                     'header' => array(
360
-                                        'innerHTML' => '<i class="fa fa-code"></i> ' . $row['name']
360
+                                        'innerHTML' => '<i class="fa fa-code"></i> '.$row['name']
361 361
                                     ),
362 362
                                     'item' => array(
363
-                                        'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'],
364
-                                        'url' => "index.php?a=22&id=" . $row['id']
363
+                                        'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'],
364
+                                        'url' => "index.php?a=22&id=".$row['id']
365 365
                                     )
366 366
                                 );
367 367
                                 if (!empty($row['description'])) {
368 368
                                     $contextmenu['seperator'] = '';
369 369
                                     $contextmenu['description'] = array(
370
-                                        'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
370
+                                        'innerHTML' => '<i class="fa fa-info"></i> '.$row['description']
371 371
                                     );
372 372
                                 }
373 373
                             } else {
374 374
                                 $contextmenu = array(
375 375
                                     'header' => array(
376
-                                        'innerHTML' => '<i class="fa fa-code"></i> ' . $name
376
+                                        'innerHTML' => '<i class="fa fa-code"></i> '.$name
377 377
                                     ),
378 378
                                     'item' => array(
379
-                                        'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_htmlsnippet'],
380
-                                        'url' => "index.php?a=77&itemname=" . $name
379
+                                        'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_htmlsnippet'],
380
+                                        'url' => "index.php?a=77&itemname=".$name
381 381
                                     ),
382 382
                                     'item2' => array(
383
-                                        'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_snippet'],
384
-                                        'url' => "index.php?a=23&itemname=" . $name
383
+                                        'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_snippet'],
384
+                                        'url' => "index.php?a=23&itemname=".$name
385 385
                                     )
386 386
                                 );
387 387
                             }
@@ -437,35 +437,35 @@  discard block
 block discarded – undo
437 437
                         }
438 438
 
439 439
                         $sql = $modx->db->query('SELECT *
440
-						FROM ' . $modx->getFullTableName('site_tmplvars') . '
441
-						WHERE name="' . $name . '"
440
+						FROM ' . $modx->getFullTableName('site_tmplvars').'
441
+						WHERE name="' . $name.'"
442 442
 						LIMIT 1');
443 443
 
444 444
                         if ($modx->db->getRecordCount($sql)) {
445 445
                             $row = $modx->db->getRow($sql);
446 446
                             $contextmenu = array(
447 447
                                 'header' => array(
448
-                                    'innerHTML' => '<i class="fa fa-list-alt"></i> ' . $row['name']
448
+                                    'innerHTML' => '<i class="fa fa-list-alt"></i> '.$row['name']
449 449
                                 ),
450 450
                                 'item' => array(
451
-                                    'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'],
452
-                                    'url' => "index.php?a=301&id=" . $row['id']
451
+                                    'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'],
452
+                                    'url' => "index.php?a=301&id=".$row['id']
453 453
                                 )
454 454
                             );
455 455
                             if (!empty($row['description'])) {
456 456
                                 $contextmenu['seperator'] = '';
457 457
                                 $contextmenu['description'] = array(
458
-                                    'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
458
+                                    'innerHTML' => '<i class="fa fa-info"></i> '.$row['description']
459 459
                                 );
460 460
                             }
461 461
                         } else {
462 462
                             $contextmenu = array(
463 463
                                 'header' => array(
464
-                                    'innerHTML' => '<i class="fa fa-list-alt"></i> ' . $name
464
+                                    'innerHTML' => '<i class="fa fa-list-alt"></i> '.$name
465 465
                                 ),
466 466
                                 'item' => array(
467
-                                    'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_tmplvars'],
468
-                                    'url' => "index.php?a=300&itemname=" . $name
467
+                                    'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_tmplvars'],
468
+                                    'url' => "index.php?a=300&itemname=".$name
469 469
                                 )
470 470
                             );
471 471
                         }
@@ -484,15 +484,15 @@  discard block
 block discarded – undo
484 484
             $json = array();
485 485
 
486 486
             if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) {
487
-                $id = !empty($_REQUEST['id']) ? (int)$_REQUEST['id'] : '';
488
-                $parent = isset($_REQUEST['parent']) ? (int)$_REQUEST['parent'] : 0;
487
+                $id = !empty($_REQUEST['id']) ? (int) $_REQUEST['id'] : '';
488
+                $parent = isset($_REQUEST['parent']) ? (int) $_REQUEST['parent'] : 0;
489 489
                 $menuindex = isset($_REQUEST['menuindex']) && is_scalar($_REQUEST['menuindex']) ? $_REQUEST['menuindex'] : 0;
490 490
 
491 491
                 // set parent
492 492
                 if ($id && $parent >= 0) {
493 493
 
494 494
                     // find older parent
495
-                    $parentOld = $modx->db->getValue($modx->db->select('parent', $modx->getFullTableName('site_content'), 'id=' . $id));
495
+                    $parentOld = $modx->db->getValue($modx->db->select('parent', $modx->getFullTableName('site_content'), 'id='.$id));
496 496
 
497 497
                     $eventOut = $modx->invokeEvent('onBeforeMoveDocument', [
498 498
                         'id_document' => $id,
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
                     if (empty($json['errors'])) {
514 514
                         // check privileges user for move docs
515 515
                         if (!empty($modx->config['tree_show_protected']) && $role != 1) {
516
-                            $sql = $modx->db->select('*', $modx->getFullTableName('document_groups'), 'document IN(' . $id . ',' . $parent . ',' . $parentOld . ')');
516
+                            $sql = $modx->db->select('*', $modx->getFullTableName('document_groups'), 'document IN('.$id.','.$parent.','.$parentOld.')');
517 517
                             if ($modx->db->getRecordCount($sql)) {
518 518
                                 $document_groups = array();
519 519
                                 while ($row = $modx->db->getRow($sql)) {
@@ -538,22 +538,22 @@  discard block
 block discarded – undo
538 538
                             // set new parent
539 539
                             $modx->db->update(array(
540 540
                                 'parent' => $parent
541
-                            ), $modx->getFullTableName('site_content'), 'id=' . $id);
541
+                            ), $modx->getFullTableName('site_content'), 'id='.$id);
542 542
                             // set parent isfolder = 1
543 543
                             $modx->db->update(array(
544 544
                                 'isfolder' => 1
545
-                            ), $modx->getFullTableName('site_content'), 'id=' . $parent);
545
+                            ), $modx->getFullTableName('site_content'), 'id='.$parent);
546 546
 
547 547
                             if ($parent != $parentOld) {
548 548
                                 // check children docs and set parent isfolder
549
-                                if ($modx->db->getRecordCount($modx->db->select('id', $modx->getFullTableName('site_content'), 'parent=' . $parentOld))) {
549
+                                if ($modx->db->getRecordCount($modx->db->select('id', $modx->getFullTableName('site_content'), 'parent='.$parentOld))) {
550 550
                                     $modx->db->update(array(
551 551
                                         'isfolder' => 1
552
-                                    ), $modx->getFullTableName('site_content'), 'id=' . $parentOld);
552
+                                    ), $modx->getFullTableName('site_content'), 'id='.$parentOld);
553 553
                                 } else {
554 554
                                     $modx->db->update(array(
555 555
                                         'isfolder' => 0
556
-                                    ), $modx->getFullTableName('site_content'), 'id=' . $parentOld);
556
+                                    ), $modx->getFullTableName('site_content'), 'id='.$parentOld);
557 557
                                 }
558 558
                             }
559 559
 
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
                             if (!empty($menuindex)) {
562 562
                                 $menuindex = explode(',', $menuindex);
563 563
                                 foreach ($menuindex as $key => $value) {
564
-                                    $modx->db->query('UPDATE ' . $modx->getFullTableName('site_content') . ' SET menuindex=' . $key . ' WHERE id=' . $value);
564
+                                    $modx->db->query('UPDATE '.$modx->getFullTableName('site_content').' SET menuindex='.$key.' WHERE id='.$value);
565 565
                                 }
566 566
                             } else {
567 567
                                 // TODO: max(*) menuindex
@@ -590,19 +590,19 @@  discard block
 block discarded – undo
590 590
         }
591 591
 
592 592
         case 'getLockedElements': {
593
-            $type = isset($_REQUEST['type']) ? (int)$_REQUEST['type'] : 0;
594
-            $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
593
+            $type = isset($_REQUEST['type']) ? (int) $_REQUEST['type'] : 0;
594
+            $id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
595 595
 
596 596
             $output = !!$modx->elementIsLocked($type, $id, true);
597 597
 
598 598
             if (!$output) {
599 599
                 $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : '';
600
-                $docgrp_cond = $docgrp ? ' OR dg.document_group IN (' . $docgrp . ')' : '';
600
+                $docgrp_cond = $docgrp ? ' OR dg.document_group IN ('.$docgrp.')' : '';
601 601
                 $sql = '
602
-                    SELECT MAX(IF(1=' . $role . ' OR sc.privatemgr=0' . $docgrp_cond . ', 0, 1)) AS locked
603
-                    FROM ' . $modx->getFullTableName('site_content') . ' AS sc 
604
-                    LEFT JOIN ' . $modx->getFullTableName('document_groups') . ' dg ON dg.document=sc.id
605
-                    WHERE sc.id=' . $id . ' GROUP BY sc.id';
602
+                    SELECT MAX(IF(1=' . $role.' OR sc.privatemgr=0'.$docgrp_cond.', 0, 1)) AS locked
603
+                    FROM ' . $modx->getFullTableName('site_content').' AS sc 
604
+                    LEFT JOIN ' . $modx->getFullTableName('document_groups').' dg ON dg.document=sc.id
605
+                    WHERE sc.id=' . $id.' GROUP BY sc.id';
606 606
                 $sql = $modx->db->query($sql);
607 607
                 if ($modx->db->getRecordCount($sql)) {
608 608
                     $row = $modx->db->getRow($sql);
Please login to merge, or discard this patch.
manager/actions/mutate_settings/tab3_user_settings.inc.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@  discard block
 block discarded – undo
6 6
   <tr>
7 7
     <td nowrap class="warning"><?php echo $_lang['udperms_title'] ?><br><small>[(use_udperms)]</small></td>
8 8
     <td>
9
-        <?php echo wrap_label($_lang['yes'],form_radio('use_udperms', 1, 'id="udPermsOn"'));?><br />
10
-        <?php echo wrap_label($_lang['no'], form_radio('use_udperms', 0, 'id="udPermsOff"'));?>
9
+        <?php echo wrap_label($_lang['yes'], form_radio('use_udperms', 1, 'id="udPermsOn"')); ?><br />
10
+        <?php echo wrap_label($_lang['no'], form_radio('use_udperms', 0, 'id="udPermsOff"')); ?>
11 11
     </td>
12 12
   </tr>
13 13
   <tr>
@@ -17,16 +17,16 @@  discard block
 block discarded – undo
17 17
   <tr>
18 18
     <td colspan="2"><div class="split"></div></td>
19 19
   </tr>
20
-  <tr class="udPerms" <?php echo showHide($use_udperms==1);?>>
20
+  <tr class="udPerms" <?php echo showHide($use_udperms == 1); ?>>
21 21
     <td nowrap class="warning"><?php echo $_lang['udperms_allowroot_title'] ?><br><small>[(udperms_allowroot)]</small></td>
22 22
     <td>
23
-      <label><input type="radio" name="udperms_allowroot" value="1" <?php echo $udperms_allowroot=='1' ? 'checked="checked"' : "" ; ?> />
23
+      <label><input type="radio" name="udperms_allowroot" value="1" <?php echo $udperms_allowroot == '1' ? 'checked="checked"' : ""; ?> />
24 24
       <?php echo $_lang['yes']?></label><br />
25
-      <label><input type="radio" name="udperms_allowroot" value="0" <?php echo $udperms_allowroot=='0' ? 'checked="checked"' : "" ; ?> />
25
+      <label><input type="radio" name="udperms_allowroot" value="0" <?php echo $udperms_allowroot == '0' ? 'checked="checked"' : ""; ?> />
26 26
       <?php echo $_lang['no']?></label>
27 27
     </td>
28 28
   </tr>
29
-  <tr class="udPerms" <?php echo showHide($use_udperms==1);?>>
29
+  <tr class="udPerms" <?php echo showHide($use_udperms == 1); ?>>
30 30
     <td width="200">&nbsp;</td>
31 31
     <td class="comment"><?php echo $_lang['udperms_allowroot_message'] ?></td>
32 32
   </tr>
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
   <tr>
38 38
     <td nowrap class="warning"><?php echo $_lang['email_sender_method'] ?><br><small>[(email_sender_method)]</small></td>
39 39
     <td>
40
-      <label><input type="radio" name="email_sender_method" value="1" <?php echo $email_sender_method=='1' ? 'checked="checked"' : "" ; ?> />
40
+      <label><input type="radio" name="email_sender_method" value="1" <?php echo $email_sender_method == '1' ? 'checked="checked"' : ""; ?> />
41 41
       <?php echo $_lang['auto']?></label><br />
42
-      <label><input type="radio" name="email_sender_method" value="0" <?php echo $email_sender_method=='0' ? 'checked="checked"' : "" ; ?> />
42
+      <label><input type="radio" name="email_sender_method" value="0" <?php echo $email_sender_method == '0' ? 'checked="checked"' : ""; ?> />
43 43
       <?php echo $_lang['use_emailsender']?></label>
44 44
     </td>
45 45
   </tr>
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
   <tr>
56 56
     <td nowrap class="warning"><?php echo $_lang['email_method_title'] ?><br><small>[(email_method)]</small></td>
57 57
     <td>
58
-        <?php echo wrap_label($_lang['email_method_mail'],form_radio('email_method','mail','id="useMail"'));?><br />
59
-        <?php echo wrap_label($_lang['email_method_smtp'],form_radio('email_method','smtp','id="useSmtp"'));?>
60
-        <div class="smtpRow" <?php echo showHide($email_method=='smtp');?>>
61
-            <?php include_once(MODX_MANAGER_PATH . 'actions/mutate_settings/snippet_smtp.inc.php'); ?>
58
+        <?php echo wrap_label($_lang['email_method_mail'], form_radio('email_method', 'mail', 'id="useMail"')); ?><br />
59
+        <?php echo wrap_label($_lang['email_method_smtp'], form_radio('email_method', 'smtp', 'id="useSmtp"')); ?>
60
+        <div class="smtpRow" <?php echo showHide($email_method == 'smtp'); ?>>
61
+            <?php include_once(MODX_MANAGER_PATH.'actions/mutate_settings/snippet_smtp.inc.php'); ?>
62 62
         </div>
63 63
     </td>
64 64
   </tr>
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
       <br />
71 71
       <p><?php echo $_lang['update_settings_from_language']; ?></p>
72 72
       <select name="reload_emailsubject" id="reload_emailsubject_select" onchange="confirmLangChange(this, 'emailsubject_default', 'emailsubject_field');">
73
-<?php echo get_lang_options('emailsubject_default');?>
73
+<?php echo get_lang_options('emailsubject_default'); ?>
74 74
       </select>
75 75
     </td>
76 76
     <td ><input id="emailsubject_field" name="emailsubject" onchange="documentDirty=true;" type="text" maxlength="255" style="width: 250px;" value="<?php echo $emailsubject; ?>" />
77
-        <input type="hidden" name="emailsubject_default" id="emailsubject_default_hidden" value="<?php echo addslashes($_lang['emailsubject_default']);?>" />
77
+        <input type="hidden" name="emailsubject_default" id="emailsubject_default_hidden" value="<?php echo addslashes($_lang['emailsubject_default']); ?>" />
78 78
     </td>
79 79
   </tr>
80 80
   <tr>
@@ -89,11 +89,11 @@  discard block
 block discarded – undo
89 89
       <br />
90 90
       <p><?php echo $_lang['update_settings_from_language']; ?></p>
91 91
       <select name="reload_signupemail_message" id="reload_signupemail_message_select" onchange="confirmLangChange(this, 'system_email_signup', 'signupemail_message_textarea');">
92
-<?php echo get_lang_options('system_email_signup');?>
92
+<?php echo get_lang_options('system_email_signup'); ?>
93 93
       </select>
94 94
     </td>
95 95
     <td> <textarea id="signupemail_message_textarea" name="signupemail_message" style="width:100%; height: 120px;"><?php echo $signupemail_message; ?></textarea>
96
-        <input type="hidden" name="system_email_signup_default" id="system_email_signup_hidden" value="<?php echo addslashes($_lang['system_email_signup']);?>" />
96
+        <input type="hidden" name="system_email_signup_default" id="system_email_signup_hidden" value="<?php echo addslashes($_lang['system_email_signup']); ?>" />
97 97
     </td>
98 98
   </tr>
99 99
   <tr>
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
       <br />
109 109
       <p><?php echo $_lang['update_settings_from_language']; ?></p>
110 110
       <select name="reload_websignupemail_message" id="reload_websignupemail_message_select" onchange="confirmLangChange(this, 'system_email_websignup', 'websignupemail_message_textarea');">
111
-<?php echo get_lang_options('system_email_websignup');?>
111
+<?php echo get_lang_options('system_email_websignup'); ?>
112 112
       </select>
113 113
     </td>
114 114
     <td> <textarea id="websignupemail_message_textarea" name="websignupemail_message" style="width:100%; height: 120px;"><?php echo $websignupemail_message; ?></textarea>
115
-        <input type="hidden" name="system_email_websignup_default" id="system_email_websignup_hidden" value="<?php echo addslashes($_lang['system_email_websignup']);?>" />
115
+        <input type="hidden" name="system_email_websignup_default" id="system_email_websignup_hidden" value="<?php echo addslashes($_lang['system_email_websignup']); ?>" />
116 116
     </td>
117 117
   </tr>
118 118
   <tr>
@@ -127,11 +127,11 @@  discard block
 block discarded – undo
127 127
       <br />
128 128
       <p><?php echo $_lang['update_settings_from_language']; ?></p>
129 129
       <select name="reload_system_email_webreminder_message" id="reload_system_email_webreminder_select" onchange="confirmLangChange(this, 'system_email_webreminder', 'system_email_webreminder_textarea');">
130
-<?php echo get_lang_options('system_email_webreminder');?>
130
+<?php echo get_lang_options('system_email_webreminder'); ?>
131 131
       </select>
132 132
     </td>
133 133
     <td> <textarea id="system_email_webreminder_textarea" name="webpwdreminder_message" style="width:100%; height: 120px;"><?php echo $webpwdreminder_message; ?></textarea>
134
-        <input type="hidden" name="system_email_webreminder_default" id="system_email_webreminder_hidden" value="<?php echo addslashes($_lang['system_email_webreminder']);?>" />
134
+        <input type="hidden" name="system_email_webreminder_default" id="system_email_webreminder_hidden" value="<?php echo addslashes($_lang['system_email_webreminder']); ?>" />
135 135
     </td>
136 136
   </tr>
137 137
   <tr>
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
   <tr>
145 145
     <td nowrap class="warning" valign="top"><?php echo $_lang['allow_multiple_emails_title'] ?><br><small>[(allow_multiple_emails)]</small></td>
146 146
     <td>
147
-      <?php echo wrap_label($_lang['yes'],form_radio('allow_multiple_emails','1'));?><br />
148
-      <?php echo wrap_label($_lang['no'], form_radio('allow_multiple_emails','0'));?>
147
+      <?php echo wrap_label($_lang['yes'], form_radio('allow_multiple_emails', '1')); ?><br />
148
+      <?php echo wrap_label($_lang['no'], form_radio('allow_multiple_emails', '0')); ?>
149 149
     </td>
150 150
   </tr>
151 151
   <tr>
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
         <?php
158 158
             // invoke OnUserSettingsRender event
159 159
             $evtOut = $modx->invokeEvent('OnUserSettingsRender');
160
-            if(is_array($evtOut)) echo implode("",$evtOut);
160
+            if (is_array($evtOut)) echo implode("", $evtOut);
161 161
         ?>
162 162
     </td>
163 163
   </tr>
Please login to merge, or discard this patch.
manager/actions/mutate_settings/tab5_security_settings.inc.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
     $MODX_SITE_HOSTNAMES = MODX_SITE_HOSTNAMES; // Fix for PHP 5.4
3
-    if(empty($valid_hostnames) && empty($MODX_SITE_HOSTNAMES)) {
3
+    if (empty($valid_hostnames) && empty($MODX_SITE_HOSTNAMES)) {
4 4
         $valid_hostnames = $_SERVER['HTTP_HOST'];
5 5
     } else {
6 6
         $valid_hostnames = $MODX_SITE_HOSTNAMES;
@@ -15,10 +15,10 @@  discard block
 block discarded – undo
15 15
 <tr>
16 16
 <th><?php echo $_lang['allow_eval_title']; ?><br><small>[(allow_eval)]</small></th>
17 17
 <td>
18
-<?php echo wrap_label($_lang['allow_eval_with_scan']         , form_radio('allow_eval','with_scan'));?><br />
19
-<?php echo wrap_label($_lang['allow_eval_with_scan_at_post'] , form_radio('allow_eval','with_scan_at_post'));?><br />
20
-<?php echo wrap_label($_lang['allow_eval_everytime_eval']    , form_radio('allow_eval','everytime_eval'));?><br />
21
-<?php echo wrap_label($_lang['allow_eval_dont_eval']         , form_radio('allow_eval','dont_eval'));?>
18
+<?php echo wrap_label($_lang['allow_eval_with_scan'], form_radio('allow_eval', 'with_scan')); ?><br />
19
+<?php echo wrap_label($_lang['allow_eval_with_scan_at_post'], form_radio('allow_eval', 'with_scan_at_post')); ?><br />
20
+<?php echo wrap_label($_lang['allow_eval_everytime_eval'], form_radio('allow_eval', 'everytime_eval')); ?><br />
21
+<?php echo wrap_label($_lang['allow_eval_dont_eval'], form_radio('allow_eval', 'dont_eval')); ?>
22 22
     <div class="comment">
23 23
         <?php echo $_lang['allow_eval_msg'] ?>
24 24
     </div>
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 <tr>
44 44
     <th><?php echo $_lang['check_files_onlogin_title'] ?><br><small>[(check_files_onlogin)]</small></th>
45 45
     <td>
46
-      <textarea name="check_files_onlogin"><?php echo $check_files_onlogin;?></textarea><br />
46
+      <textarea name="check_files_onlogin"><?php echo $check_files_onlogin; ?></textarea><br />
47 47
         
48 48
 </td>
49 49
 </tr>
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
     <tr>
54 54
       <td nowrap class="warning"><?php echo $_lang['validate_referer_title'] ?><br><small>[(validate_referer)]</small></td>
55 55
       <td>
56
-        <?php echo wrap_label($_lang['yes'],form_radio('validate_referer', 1));?><br />
57
-        <?php echo wrap_label($_lang['no'], form_radio('validate_referer', 0));?>
56
+        <?php echo wrap_label($_lang['yes'], form_radio('validate_referer', 1)); ?><br />
57
+        <?php echo wrap_label($_lang['no'], form_radio('validate_referer', 0)); ?>
58 58
       </td>
59 59
     </tr>
60 60
     <tr>
@@ -89,25 +89,25 @@  discard block
 block discarded – undo
89 89
   <tr>
90 90
 <th><?php echo $_lang['a17_error_reporting_title']; ?><br><small>[(error_reporting)]</small></th>
91 91
 <td>
92
-<?php echo wrap_label($_lang['a17_error_reporting_opt0'], form_radio('error_reporting','0'));?><br />
93
-<?php echo wrap_label($_lang['a17_error_reporting_opt1'], form_radio('error_reporting','1'));?><br />
94
-<?php echo wrap_label($_lang['a17_error_reporting_opt2'], form_radio('error_reporting','2'));?><br />
95
-<?php echo wrap_label($_lang['a17_error_reporting_opt99'],form_radio('error_reporting','99'));?>
92
+<?php echo wrap_label($_lang['a17_error_reporting_opt0'], form_radio('error_reporting', '0')); ?><br />
93
+<?php echo wrap_label($_lang['a17_error_reporting_opt1'], form_radio('error_reporting', '1')); ?><br />
94
+<?php echo wrap_label($_lang['a17_error_reporting_opt2'], form_radio('error_reporting', '2')); ?><br />
95
+<?php echo wrap_label($_lang['a17_error_reporting_opt99'], form_radio('error_reporting', '99')); ?>
96 96
 </td>
97 97
 </tr>
98 98
 <tr>
99 99
     <td width="200">&nbsp;</td>
100
-    <td class="comment"> <?php echo $_lang['a17_error_reporting_msg'];?></td>
100
+    <td class="comment"> <?php echo $_lang['a17_error_reporting_msg']; ?></td>
101 101
 </tr>
102 102
 <tr><td colspan="2"><div class="split"></div></td></tr>
103 103
 <tr>
104 104
 <th><?php echo $_lang['mutate_settings.dynamic.php6']; ?><br><small>[(send_errormail)]</small></th>
105 105
 <td>
106
-<?php echo wrap_label($_lang['mutate_settings.dynamic.php7'],form_radio('send_errormail','0'));?><br />
107
-<?php echo wrap_label('error',form_radio('send_errormail','3'));?><br />
108
-<?php echo wrap_label('error + warning',form_radio('send_errormail','2'));?><br />
109
-<?php echo wrap_label('error + warning + information',form_radio('send_errormail','1'));?><br />
110
-<?php echo parseText($_lang['mutate_settings.dynamic.php8'],array('emailsender'=>$modx->config['emailsender']));?></td>
106
+<?php echo wrap_label($_lang['mutate_settings.dynamic.php7'], form_radio('send_errormail', '0')); ?><br />
107
+<?php echo wrap_label('error', form_radio('send_errormail', '3')); ?><br />
108
+<?php echo wrap_label('error + warning', form_radio('send_errormail', '2')); ?><br />
109
+<?php echo wrap_label('error + warning + information', form_radio('send_errormail', '1')); ?><br />
110
+<?php echo parseText($_lang['mutate_settings.dynamic.php8'], array('emailsender'=>$modx->config['emailsender'])); ?></td>
111 111
 </tr>
112 112
    <tr>
113 113
     <td colspan="2"><div class="split"></div></td>
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
 <tr>
116 116
 <th><?php echo $_lang['enable_bindings_title'] ?><br><small>[(enable_bindings)]</small></th>
117 117
 <td>
118
-<?php echo wrap_label($_lang['yes'],form_radio('enable_bindings','1'));?><br />
119
-<?php echo wrap_label($_lang['no'], form_radio('enable_bindings','0'));?>
118
+<?php echo wrap_label($_lang['yes'], form_radio('enable_bindings', '1')); ?><br />
119
+<?php echo wrap_label($_lang['no'], form_radio('enable_bindings', '0')); ?>
120 120
 
121 121
 </td>
122 122
 </tr>
@@ -157,20 +157,20 @@  discard block
 block discarded – undo
157 157
 <th><?php echo $_lang['pwd_hash_algo_title'] ?><br><small>[(pwd_hash_algo)]</small></th>
158 158
 <td>
159 159
 <?php
160
-if(empty($pwd_hash_algo)) $phm['sel']['UNCRYPT'] = 1;
161
-$phm['e']['BLOWFISH_Y'] = $modx->manager->checkHashAlgorithm('BLOWFISH_Y') ? 0:1;
162
-$phm['e']['BLOWFISH_A'] = $modx->manager->checkHashAlgorithm('BLOWFISH_A') ? 0:1;
163
-$phm['e']['SHA512']     = $modx->manager->checkHashAlgorithm('SHA512') ? 0:1;
164
-$phm['e']['SHA256']     = $modx->manager->checkHashAlgorithm('SHA256') ? 0:1;
165
-$phm['e']['MD5']        = $modx->manager->checkHashAlgorithm('MD5') ? 0:1;
166
-$phm['e']['UNCRYPT']    = $modx->manager->checkHashAlgorithm('UNCRYPT') ? 0:1;
160
+if (empty($pwd_hash_algo)) $phm['sel']['UNCRYPT'] = 1;
161
+$phm['e']['BLOWFISH_Y'] = $modx->manager->checkHashAlgorithm('BLOWFISH_Y') ? 0 : 1;
162
+$phm['e']['BLOWFISH_A'] = $modx->manager->checkHashAlgorithm('BLOWFISH_A') ? 0 : 1;
163
+$phm['e']['SHA512']     = $modx->manager->checkHashAlgorithm('SHA512') ? 0 : 1;
164
+$phm['e']['SHA256']     = $modx->manager->checkHashAlgorithm('SHA256') ? 0 : 1;
165
+$phm['e']['MD5']        = $modx->manager->checkHashAlgorithm('MD5') ? 0 : 1;
166
+$phm['e']['UNCRYPT']    = $modx->manager->checkHashAlgorithm('UNCRYPT') ? 0 : 1;
167 167
 ?>
168
-<?php echo wrap_label('CRYPT_BLOWFISH_Y (salt &amp; stretch)',form_radio('pwd_hash_algo','BLOWFISH_Y', '', $phm['e']['BLOWFISH_Y']));?><br />
169
-<?php echo wrap_label('CRYPT_BLOWFISH_A (salt &amp; stretch)',form_radio('pwd_hash_algo','BLOWFISH_A', '', $phm['e']['BLOWFISH_A']));?><br />
170
-<?php echo wrap_label('CRYPT_SHA512 (salt &amp; stretch)'    ,form_radio('pwd_hash_algo','SHA512'    , '', $phm['e']['SHA512']));?><br />
171
-<?php echo wrap_label('CRYPT_SHA256 (salt &amp; stretch)'    ,form_radio('pwd_hash_algo','SHA256'    , '', $phm['e']['SHA256']));?><br />
172
-<?php echo wrap_label('CRYPT_MD5 (salt &amp; stretch)'       ,form_radio('pwd_hash_algo','MD5'       , '', $phm['e']['MD5']));?><br />
173
-<?php echo wrap_label('UNCRYPT(32 chars salt + SHA-1 hash)'  ,form_radio('pwd_hash_algo','UNCRYPT'  , '', $phm['e']['UNCRYPT']));?>
168
+<?php echo wrap_label('CRYPT_BLOWFISH_Y (salt &amp; stretch)', form_radio('pwd_hash_algo', 'BLOWFISH_Y', '', $phm['e']['BLOWFISH_Y'])); ?><br />
169
+<?php echo wrap_label('CRYPT_BLOWFISH_A (salt &amp; stretch)', form_radio('pwd_hash_algo', 'BLOWFISH_A', '', $phm['e']['BLOWFISH_A'])); ?><br />
170
+<?php echo wrap_label('CRYPT_SHA512 (salt &amp; stretch)', form_radio('pwd_hash_algo', 'SHA512', '', $phm['e']['SHA512'])); ?><br />
171
+<?php echo wrap_label('CRYPT_SHA256 (salt &amp; stretch)', form_radio('pwd_hash_algo', 'SHA256', '', $phm['e']['SHA256'])); ?><br />
172
+<?php echo wrap_label('CRYPT_MD5 (salt &amp; stretch)', form_radio('pwd_hash_algo', 'MD5', '', $phm['e']['MD5'])); ?><br />
173
+<?php echo wrap_label('UNCRYPT(32 chars salt + SHA-1 hash)', form_radio('pwd_hash_algo', 'UNCRYPT', '', $phm['e']['UNCRYPT'])); ?>
174 174
 </td>
175 175
 </tr>
176 176
 <tr>
@@ -186,13 +186,13 @@  discard block
 block discarded – undo
186 186
   ?>
187 187
 <?php
188 188
 $gdAvailable = extension_loaded('gd');
189
-if(!$gdAvailable) $use_captcha = 0;
189
+if (!$gdAvailable) $use_captcha = 0;
190 190
 ?>
191 191
   <tr>
192 192
     <td nowrap class="warning"><?php echo $_lang['captcha_title'] ?><br><small>[(use_captcha)]</small></td>
193
-    <td> <label><input type="radio" id="captchaOn" name="use_captcha" value="1" <?php echo ($use_captcha==1) ? 'checked="checked"' : "" ; echo (!$gdAvailable)? ' readonly="readonly"' : ''; ?> />
193
+    <td> <label><input type="radio" id="captchaOn" name="use_captcha" value="1" <?php echo ($use_captcha == 1) ? 'checked="checked"' : ""; echo (!$gdAvailable) ? ' readonly="readonly"' : ''; ?> />
194 194
       <?php echo $_lang['yes']?></label><br />
195
-      <label><input type="radio" id="captchaOff" name="use_captcha" value="0" <?php echo ($use_captcha==0) ? 'checked="checked"' : "" ; echo (!$gdAvailable)? ' readonly="readonly"' : '';?> />
195
+      <label><input type="radio" id="captchaOff" name="use_captcha" value="0" <?php echo ($use_captcha == 0) ? 'checked="checked"' : ""; echo (!$gdAvailable) ? ' readonly="readonly"' : ''; ?> />
196 196
       <?php echo $_lang['no']?></label> </td>
197 197
   </tr>
198 198
   <tr>
@@ -202,23 +202,23 @@  discard block
 block discarded – undo
202 202
   <tr>
203 203
     <td colspan="2"><div class="split"></div></td>
204 204
   </tr>
205
-  <tr class="captchaRow" <?php echo showHide($use_captcha==1);?>>
205
+  <tr class="captchaRow" <?php echo showHide($use_captcha == 1); ?>>
206 206
     <td nowrap class="warning"><?php echo $_lang['captcha_words_title'] ?><br><small>[(captcha_words)]</small>
207 207
       <br />
208 208
       <p><?php echo $_lang['update_settings_from_language']; ?></p>
209 209
       <select name="reload_captcha_words" id="reload_captcha_words_select" onchange="confirmLangChange(this, 'captcha_words_default', 'captcha_words_input');">
210
-<?php echo get_lang_options('captcha_words_default');?>
210
+<?php echo get_lang_options('captcha_words_default'); ?>
211 211
       </select>
212 212
     </td>
213 213
     <td><input type="text" id="captcha_words_input" name="captcha_words" style="width:250px" value="<?php echo $captcha_words; ?>" />
214
-        <input type="hidden" name="captcha_words_default" id="captcha_words_default_hidden" value="<?php echo addslashes($_lang['captcha_words_default']);?>" />
214
+        <input type="hidden" name="captcha_words_default" id="captcha_words_default_hidden" value="<?php echo addslashes($_lang['captcha_words_default']); ?>" />
215 215
     </td>
216 216
   </tr>
217
-  <tr class="captchaRow" <?php echo showHide($use_captcha==1);?>>
217
+  <tr class="captchaRow" <?php echo showHide($use_captcha == 1); ?>>
218 218
     <td width="200">&nbsp;</td>
219 219
     <td class="comment"><?php echo $_lang['captcha_words_message'] ?></td>
220 220
   </tr>
221
-  <tr class="captchaRow" <?php echo showHide($use_captcha==1);?>>
221
+  <tr class="captchaRow" <?php echo showHide($use_captcha == 1); ?>>
222 222
     <td colspan="2"><div class="split"></div></td>
223 223
   </tr>
224 224
   <tr>
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
         <?php
227 227
             // invoke OnMiscSettingsRender event
228 228
             $evtOut = $modx->invokeEvent('OnSecuritySettingsRender');
229
-            if(is_array($evtOut)) echo implode("",$evtOut);
229
+            if (is_array($evtOut)) echo implode("", $evtOut);
230 230
         ?>
231 231
     </td>
232 232
   </tr>
Please login to merge, or discard this patch.
manager/actions/mutate_settings/tab6_filemanager_settings.inc.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@
 block discarded – undo
113 113
         <?php
114 114
             // invoke OnMiscSettingsRender event
115 115
             $evtOut = $modx->invokeEvent('OnFileManagerSettingsRender');
116
-            if(is_array($evtOut)) echo implode("",$evtOut);
116
+            if (is_array($evtOut)) echo implode("", $evtOut);
117 117
         ?>
118 118
     </td>
119 119
   </tr>
Please login to merge, or discard this patch.
manager/actions/mutate_content.dynamic.php 1 patch
Spacing   +146 added lines, -146 removed lines patch added patch discarded remove patch
@@ -1,35 +1,35 @@  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
 /********************/
7
-$sd = isset($_REQUEST['dir']) ? '&dir=' . $_REQUEST['dir'] : '&dir=DESC';
8
-$sb = isset($_REQUEST['sort']) ? '&sort=' . $_REQUEST['sort'] : '&sort=createdon';
9
-$pg = isset($_REQUEST['page']) ? '&page=' . (int) $_REQUEST['page'] : '';
10
-$add_path = $sd . $sb . $pg;
7
+$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC';
8
+$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon';
9
+$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : '';
10
+$add_path = $sd.$sb.$pg;
11 11
 /*******************/
12 12
 
13 13
 // check permissions
14
-switch($modx->manager->action) {
14
+switch ($modx->manager->action) {
15 15
 	case 27:
16
-		if(!$modx->hasPermission('edit_document')) {
16
+		if (!$modx->hasPermission('edit_document')) {
17 17
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
18 18
 		}
19 19
 		break;
20 20
 	case 85:
21 21
 	case 72:
22 22
 	case 4:
23
-		if(!$modx->hasPermission('new_document')) {
23
+		if (!$modx->hasPermission('new_document')) {
24 24
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
25
-		} elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') {
25
+		} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') {
26 26
 			// check user has permissions for parent
27
-			include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php');
27
+			include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php');
28 28
 			$udperms = new udperms();
29 29
 			$udperms->user = $modx->getLoginUserID();
30 30
 			$udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid'];
31 31
 			$udperms->role = $_SESSION['mgrRole'];
32
-			if(!$udperms->checkPermissions()) {
32
+			if (!$udperms->checkPermissions()) {
33 33
 				$modx->webAlertAndQuit($_lang["access_permission_denied"]);
34 34
 			}
35 35
 		}
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
39 39
 }
40 40
 
41
-$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
41
+$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
42 42
 
43 43
 // Get table names (alphabetical)
44 44
 $tbl_categories = $modx->getFullTableName('categories');
@@ -53,22 +53,22 @@  discard block
 block discarded – undo
53 53
 $tbl_site_tmplvar_templates = $modx->getFullTableName('site_tmplvar_templates');
54 54
 $tbl_site_tmplvars = $modx->getFullTableName('site_tmplvars');
55 55
 
56
-if($modx->manager->action == 27) {
56
+if ($modx->manager->action == 27) {
57 57
 	//editing an existing document
58 58
 	// check permissions on the document
59
-	include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php');
59
+	include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php');
60 60
 	$udperms = new udperms();
61 61
 	$udperms->user = $modx->getLoginUserID();
62 62
 	$udperms->document = $id;
63 63
 	$udperms->role = $_SESSION['mgrRole'];
64 64
 
65
-	if(!$udperms->checkPermissions()) {
65
+	if (!$udperms->checkPermissions()) {
66 66
 		$modx->webAlertAndQuit($_lang["access_permission_denied"]);
67 67
 	}
68 68
 }
69 69
 
70 70
 // check to see if resource isn't locked
71
-if($lockedEl = $modx->elementIsLocked(7, $id)) {
71
+if ($lockedEl = $modx->elementIsLocked(7, $id)) {
72 72
 	$modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource']));
73 73
 }
74 74
 // end check for lock
@@ -77,27 +77,27 @@  discard block
 block discarded – undo
77 77
 $modx->lockElement(7, $id);
78 78
 
79 79
 // get document groups for current user
80
-if($_SESSION['mgrDocgroups']) {
80
+if ($_SESSION['mgrDocgroups']) {
81 81
 	$docgrp = implode(',', $_SESSION['mgrDocgroups']);
82 82
 }
83 83
 
84
-if(!empty ($id)) {
84
+if (!empty ($id)) {
85 85
 	$access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']);
86
-	if($docgrp) {
86
+	if ($docgrp) {
87 87
 		$access .= " OR dg.document_group IN ({$docgrp})";
88 88
 	}
89 89
 	$rs = $modx->db->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})");
90 90
 	$content = array();
91 91
 	$content = $modx->db->getRow($rs);
92 92
 	$modx->documentObject = &$content;
93
-	if(!$content) {
93
+	if (!$content) {
94 94
 		$modx->webAlertAndQuit($_lang["access_permission_denied"]);
95 95
 	}
96 96
 	$_SESSION['itemname'] = $content['pagetitle'];
97 97
 } else {
98 98
 	$content = array();
99 99
 
100
-	if(isset($_REQUEST['newtemplate'])) {
100
+	if (isset($_REQUEST['newtemplate'])) {
101 101
 		$content['template'] = $_REQUEST['newtemplate'];
102 102
 	} else {
103 103
 		$content['template'] = getDefaultTemplate();
@@ -108,22 +108,22 @@  discard block
 block discarded – undo
108 108
 
109 109
 // restore saved form
110 110
 $formRestored = $modx->manager->loadFormValues();
111
-if(isset($_REQUEST['newtemplate'])) {
111
+if (isset($_REQUEST['newtemplate'])) {
112 112
 	$formRestored = true;
113 113
 }
114 114
 
115 115
 // retain form values if template was changed
116 116
 // edited to convert pub_date and unpub_date
117 117
 // sottwell 02-09-2006
118
-if($formRestored == true) {
118
+if ($formRestored == true) {
119 119
 	$content = array_merge($content, $_POST);
120 120
 	$content['content'] = $_POST['ta'];
121
-	if(empty ($content['pub_date'])) {
121
+	if (empty ($content['pub_date'])) {
122 122
 		unset ($content['pub_date']);
123 123
 	} else {
124 124
 		$content['pub_date'] = $modx->toTimeStamp($content['pub_date']);
125 125
 	}
126
-	if(empty ($content['unpub_date'])) {
126
+	if (empty ($content['unpub_date'])) {
127 127
 		unset ($content['unpub_date']);
128 128
 	} else {
129 129
 		$content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']);
@@ -131,12 +131,12 @@  discard block
 block discarded – undo
131 131
 }
132 132
 
133 133
 // increase menu index if this is a new document
134
-if(!isset ($_REQUEST['id'])) {
135
-	if(!isset ($modx->config['auto_menuindex'])) {
134
+if (!isset ($_REQUEST['id'])) {
135
+	if (!isset ($modx->config['auto_menuindex'])) {
136 136
 		$modx->config['auto_menuindex'] = 1;
137 137
 	}
138
-	if($modx->config['auto_menuindex']) {
139
-		$pid = (int)$_REQUEST['pid'];
138
+	if ($modx->config['auto_menuindex']) {
139
+		$pid = (int) $_REQUEST['pid'];
140 140
 		$rs = $modx->db->select('count(*)', $tbl_site_content, "parent='{$pid}'");
141 141
 		$content['menuindex'] = $modx->db->getValue($rs);
142 142
 	} else {
@@ -144,14 +144,14 @@  discard block
 block discarded – undo
144 144
 	}
145 145
 }
146 146
 
147
-if(isset ($_POST['which_editor'])) {
147
+if (isset ($_POST['which_editor'])) {
148 148
 	$modx->config['which_editor'] = $_POST['which_editor'];
149 149
 }
150 150
 
151 151
 // Add lock-element JS-Script
152 152
 $lockElementId = $id;
153 153
 $lockElementType = 7;
154
-require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php');
154
+require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php');
155 155
 ?>
156 156
 	<script type="text/javascript">
157 157
 		/* <![CDATA[ */
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 			},
182 182
 			cancel: function() {
183 183
 				documentDirty = false;
184
-				document.location.href = 'index.php?<?=($id == 0 ? 'a=2' : 'a=3&r=1&id=' . $id . $add_path) ?>';
184
+				document.location.href = 'index.php?<?=($id == 0 ? 'a=2' : 'a=3&r=1&id='.$id.$add_path) ?>';
185 185
 			},
186 186
 			duplicate: function() {
187 187
 				if(confirm("<?= $_lang['confirm_resource_duplicate']?>") === true) {
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 				}
190 190
 			},
191 191
 			view: function() {
192
-				window.open('<?= ($modx->config['friendly_urls'] == '1') ? $modx->makeUrl($id) : $modx->config['site_url'] . 'index.php?id=' . $id ?>', 'previeWin');
192
+				window.open('<?= ($modx->config['friendly_urls'] == '1') ? $modx->makeUrl($id) : $modx->config['site_url'].'index.php?id='.$id ?>', 'previeWin');
193 193
 			}
194 194
 		};
195 195
 
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 			'template' => $content['template']
552 552
 		));
553 553
 
554
-		if(is_array($evtOut)) {
554
+		if (is_array($evtOut)) {
555 555
 			echo implode('', $evtOut);
556 556
 		}
557 557
 
@@ -575,8 +575,8 @@  discard block
 block discarded – undo
575 575
 		<fieldset id="create_edit">
576 576
 
577 577
 			<h1>
578
-				<i class="fa fa-pencil-square-o"></i><?php if(isset($_REQUEST['id'])) {
579
-					echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>';
578
+				<i class="fa fa-pencil-square-o"></i><?php if (isset($_REQUEST['id'])) {
579
+					echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']).(iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '').'<small>('.$_REQUEST['id'].')</small>';
580 580
 				} else {
581 581
 				    if ($modx->manager->action == '4') {
582 582
                         echo $_lang['add_resource'];
@@ -592,36 +592,36 @@  discard block
 block discarded – undo
592 592
 
593 593
 			<?php
594 594
 			// breadcrumbs
595
-			if($modx->config['use_breadcrumbs']) {
595
+			if ($modx->config['use_breadcrumbs']) {
596 596
 				$temp = array();
597 597
 				$title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title'];
598 598
 
599
-				if(isset($_REQUEST['id']) && $content['parent'] != 0) {
599
+				if (isset($_REQUEST['id']) && $content['parent'] != 0) {
600 600
 					$bID = (int) $_REQUEST['id'];
601 601
 					$temp = $modx->getParentIds($bID);
602
-				} else if(isset($_REQUEST['pid'])) {
602
+				} else if (isset($_REQUEST['pid'])) {
603 603
 					$bID = (int) $_REQUEST['pid'];
604 604
 					$temp = $modx->getParentIds($bID);
605 605
 					array_unshift($temp, $bID);
606 606
 				}
607 607
 
608
-				if($temp) {
608
+				if ($temp) {
609 609
 					$parents = implode(',', $temp);
610 610
 
611
-					if(!empty($parents)) {
611
+					if (!empty($parents)) {
612 612
 						$where = "FIND_IN_SET(id,'{$parents}') DESC";
613 613
 						$rs = $modx->db->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where);
614
-						while($row = $modx->db->getRow($rs)) {
614
+						while ($row = $modx->db->getRow($rs)) {
615 615
 							$out .= '<li class="breadcrumbs__li">
616
-                                <a href="index.php?a=27&id=' . $row['id'] . '" class="breadcrumbs__a">' . htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']) . '</a>
616
+                                <a href="index.php?a=27&id=' . $row['id'].'" class="breadcrumbs__a">'.htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']).'</a>
617 617
                                 <span class="breadcrumbs__sep">&gt;</span>
618 618
                             </li>';
619 619
 						}
620 620
 					}
621 621
 				}
622 622
 
623
-				$out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>';
624
-				echo '<ul class="breadcrumbs">' . $out . '</ul>';
623
+				$out .= '<li class="breadcrumbs__li breadcrumbs__li_current">'.$title.'</li>';
624
+				echo '<ul class="breadcrumbs">'.$out.'</ul>';
625 625
 			}
626 626
 			?>
627 627
 
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
 					$evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array(
639 639
 						'id' => $id
640 640
 					));
641
-					if(is_array($evtOut)) {
641
+					if (is_array($evtOut)) {
642 642
 						echo implode('', $evtOut);
643 643
 					} else {
644 644
 						?>
@@ -694,7 +694,7 @@  discard block
 block discarded – undo
694 694
 									</td>
695 695
 								</tr>
696 696
 
697
-								<?php if($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?>
697
+								<?php if ($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?>
698 698
 
699 699
 									<tr>
700 700
 										<td><span class="warning"><?= $_lang['weblink'] ?></span>
@@ -730,17 +730,17 @@  discard block
 block discarded – undo
730 730
 											$from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id";
731 731
 											$rs = $modx->db->select($field, $from, '', 'c.category, t.templatename ASC');
732 732
 											$currentCategory = '';
733
-											while($row = $modx->db->getRow($rs)) {
734
-												if($row['selectable'] != 1 && $row['id'] != $content['template']) {
733
+											while ($row = $modx->db->getRow($rs)) {
734
+												if ($row['selectable'] != 1 && $row['id'] != $content['template']) {
735 735
 													continue;
736 736
 												};
737 737
 												// Skip if not selectable but show if selected!
738 738
 												$thisCategory = $row['category'];
739
-												if($thisCategory == null) {
739
+												if ($thisCategory == null) {
740 740
 													$thisCategory = $_lang["no_category"];
741 741
 												}
742
-												if($thisCategory != $currentCategory) {
743
-													if($closeOptGroup) {
742
+												if ($thisCategory != $currentCategory) {
743
+													if ($closeOptGroup) {
744 744
 														echo "\t\t\t\t\t</optgroup>\n";
745 745
 													}
746 746
 													echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n";
@@ -749,10 +749,10 @@  discard block
 block discarded – undo
749 749
 
750 750
 												$selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : '';
751 751
 
752
-												echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n";
752
+												echo "\t\t\t\t\t".'<option value="'.$row['id'].'"'.$selectedtext.'>'.$row['templatename']."</option>\n";
753 753
 												$currentCategory = $thisCategory;
754 754
 											}
755
-											if($thisCategory != '') {
755
+											if ($thisCategory != '') {
756 756
 												echo "\t\t\t\t\t</optgroup>\n";
757 757
 											}
758 758
 											?>
@@ -796,20 +796,20 @@  discard block
 block discarded – undo
796 796
 									<td valign="top">
797 797
 										<?php
798 798
 										$parentlookup = false;
799
-										if(isset ($_REQUEST['id'])) {
800
-											if($content['parent'] == 0) {
799
+										if (isset ($_REQUEST['id'])) {
800
+											if ($content['parent'] == 0) {
801 801
 												$parentname = $site_name;
802 802
 											} else {
803 803
 												$parentlookup = $content['parent'];
804 804
 											}
805
-										} elseif(isset ($_REQUEST['pid'])) {
806
-											if($_REQUEST['pid'] == 0) {
805
+										} elseif (isset ($_REQUEST['pid'])) {
806
+											if ($_REQUEST['pid'] == 0) {
807 807
 												$parentname = $site_name;
808 808
 											} else {
809 809
 												$parentlookup = $_REQUEST['pid'];
810 810
 											}
811
-										} elseif(isset($_POST['parent'])) {
812
-											if($_POST['parent'] == 0) {
811
+										} elseif (isset($_POST['parent'])) {
812
+											if ($_POST['parent'] == 0) {
813 813
 												$parentname = $site_name;
814 814
 											} else {
815 815
 												$parentlookup = $_POST['parent'];
@@ -818,10 +818,10 @@  discard block
 block discarded – undo
818 818
 											$parentname = $site_name;
819 819
 											$content['parent'] = 0;
820 820
 										}
821
-										if($parentlookup !== false && is_numeric($parentlookup)) {
821
+										if ($parentlookup !== false && is_numeric($parentlookup)) {
822 822
 											$rs = $modx->db->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'");
823 823
 											$parentname = $modx->db->getValue($rs);
824
-											if(!$parentname) {
824
+											if (!$parentname) {
825 825
 												$modx->webAlertAndQuit($_lang["error_no_parent"]);
826 826
 											}
827 827
 										}
@@ -863,7 +863,7 @@  discard block
 block discarded – undo
863 863
 								}*/
864 864
 								?>
865 865
 
866
-								<?php if($content['type'] == 'document' || $modx->manager->action == '4') { ?>
866
+								<?php if ($content['type'] == 'document' || $modx->manager->action == '4') { ?>
867 867
 									<tr>
868 868
 										<td colspan="2">
869 869
 											<hr>
@@ -876,8 +876,8 @@  discard block
 block discarded – undo
876 876
 														<?php
877 877
 														// invoke OnRichTextEditorRegister event
878 878
 														$evtOut = $modx->invokeEvent("OnRichTextEditorRegister");
879
-														if(is_array($evtOut)) {
880
-															for($i = 0; $i < count($evtOut); $i++) {
879
+														if (is_array($evtOut)) {
880
+															for ($i = 0; $i < count($evtOut); $i++) {
881 881
 																$editor = $evtOut[$i];
882 882
 																echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n";
883 883
 															}
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
 											</div>
889 889
 											<div id="content_body">
890 890
 												<?php
891
-												if(($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) {
891
+												if (($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) {
892 892
 													$htmlContent = $content['content'];
893 893
 													?>
894 894
 													<div class="section-editor clearfix">
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
 													$richtexteditorIds[$modx->config['which_editor']][] = 'ta';
902 902
 													$richtexteditorOptions[$modx->config['which_editor']]['ta'] = '';
903 903
 												} else {
904
-													echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>' . "\n";
904
+													echo "\t".'<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>'."\n";
905 905
 												}
906 906
 												?>
907 907
 											</div>
@@ -917,7 +917,7 @@  discard block
 block discarded – undo
917 917
 
918 918
                             if (($content['type'] == 'document' || $modx->manager->action == '4') || ($content['type'] == 'reference' || $modx->manager->action == 72)) {
919 919
                                 $template = $default_template;
920
-                                $group_tvs = empty($modx->config['group_tvs']) ? 0 : (int)$modx->config['group_tvs'];
920
+                                $group_tvs = empty($modx->config['group_tvs']) ? 0 : (int) $modx->config['group_tvs'];
921 921
                                 if (isset ($_REQUEST['newtemplate'])) {
922 922
                                     $template = $_REQUEST['newtemplate'];
923 923
                                 } else {
@@ -945,17 +945,17 @@  discard block
 block discarded – undo
945 945
                                 );
946 946
                                 $sort = 'tvtpl.rank,tv.rank, tv.id';
947 947
                                 if ($group_tvs) {
948
-                                    $field .= ', IFNULL(tv.category,0) as category_id, IFNULL(cat.category,"' . $_lang['no_category'] . '") AS category, IFNULL(cat.rank,0) AS category_rank';
948
+                                    $field .= ', IFNULL(tv.category,0) as category_id, IFNULL(cat.category,"'.$_lang['no_category'].'") AS category, IFNULL(cat.rank,0) AS category_rank';
949 949
                                     $from .= '
950
-                                    LEFT JOIN ' . $tbl_categories . ' AS cat ON cat.id=tv.category';
951
-                                    $sort = 'cat.rank,cat.id,' . $sort;
950
+                                    LEFT JOIN ' . $tbl_categories.' AS cat ON cat.id=tv.category';
951
+                                    $sort = 'cat.rank,cat.id,'.$sort;
952 952
                                 }
953 953
                                 $where = vsprintf("tvtpl.templateid='%s' AND (1='%s' OR ISNULL(tva.documentgroup) %s)", $vs);
954 954
                                 $rs = $modx->db->select($field, $from, $where, $sort);
955 955
                                 if ($modx->db->getRecordCount($rs)) {
956 956
                                     $tvsArray = $modx->db->makeArray($rs, 'name');
957
-                                    require_once(MODX_MANAGER_PATH . 'includes/tmplvars.inc.php');
958
-                                    require_once(MODX_MANAGER_PATH . 'includes/tmplvars.commands.inc.php');
957
+                                    require_once(MODX_MANAGER_PATH.'includes/tmplvars.inc.php');
958
+                                    require_once(MODX_MANAGER_PATH.'includes/tmplvars.commands.inc.php');
959 959
 
960 960
                                     $templateVariablesOutput = '';
961 961
                                     $templateVariablesGeneral = '';
@@ -969,8 +969,8 @@  discard block
 block discarded – undo
969 969
                                                 if ($group_tvs == 1 || $group_tvs == 3) {
970 970
                                                     if ($i === 0) {
971 971
                                                         $templateVariablesOutput .= '
972
-                            <div class="tab-section" id="tabTV_' . $row['category_id'] . '">
973
-                                <div class="tab-header">' . $row['category'] . '</div>
972
+                            <div class="tab-section" id="tabTV_' . $row['category_id'].'">
973
+                                <div class="tab-header">' . $row['category'].'</div>
974 974
                                 <div class="tab-body tmplvars">
975 975
                                     <table>' . "\n";
976 976
                                                     } else {
@@ -979,17 +979,17 @@  discard block
 block discarded – undo
979 979
                                 </div>
980 980
                             </div>
981 981
                             
982
-                            <div class="tab-section" id="tabTV_' . $row['category_id'] . '">
983
-                                <div class="tab-header">' . $row['category'] . '</div>
982
+                            <div class="tab-section" id="tabTV_' . $row['category_id'].'">
983
+                                <div class="tab-header">' . $row['category'].'</div>
984 984
                                 <div class="tab-body tmplvars">
985 985
                                     <table>';
986 986
                                                     }
987 987
                                                 } else if ($group_tvs == 2 || $group_tvs == 4) {
988 988
                                                     if ($i === 0) {
989 989
                                                         $templateVariablesOutput .= '
990
-                            <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars">
991
-                                <h2 class="tab">' . $row['category'] . '</h2>
992
-                                <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script>
990
+                            <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars">
991
+                                <h2 class="tab">' . $row['category'].'</h2>
992
+                                <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script>
993 993
                                 
994 994
                                 <div class="tab-body tmplvars">
995 995
                                     <table>';
@@ -999,9 +999,9 @@  discard block
 block discarded – undo
999 999
                                 </div>
1000 1000
                             </div>
1001 1001
                             
1002
-                            <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars">
1003
-                                <h2 class="tab">' . $row['category'] . '</h2>
1004
-                                <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script>
1002
+                            <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars">
1003
+                                <h2 class="tab">' . $row['category'].'</h2>
1004
+                                <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script>
1005 1005
                                 
1006 1006
                                 <div class="tab-body tmplvars">
1007 1007
                                     <table>';
@@ -1009,18 +1009,18 @@  discard block
 block discarded – undo
1009 1009
                                                 } else if ($group_tvs == 5) {
1010 1010
                                                     if ($i === 0) {
1011 1011
                                                         $templateVariablesOutput .= '
1012
-                                <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars">
1013
-                                    <h2 class="tab">' . $row['category'] . '</h2>
1014
-                                    <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script>
1012
+                                <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars">
1013
+                                    <h2 class="tab">' . $row['category'].'</h2>
1014
+                                    <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script>
1015 1015
                                     <table>';
1016 1016
                                                     } else {
1017 1017
                                                         $templateVariablesOutput .= '
1018 1018
                                     </table>
1019 1019
                                 </div>
1020 1020
                                 
1021
-                                <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars">
1022
-                                    <h2 class="tab">' . $row['category'] . '</h2>
1023
-                                    <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script>
1021
+                                <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars">
1022
+                                    <h2 class="tab">' . $row['category'].'</h2>
1023
+                                    <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script>
1024 1024
                                     
1025 1025
                                     <table>';
1026 1026
                                                     }
@@ -1040,8 +1040,8 @@  discard block
 block discarded – undo
1040 1040
                                                 $editor = isset($tvOptions['editor']) ? $tvOptions['editor'] : $modx->config['which_editor'];
1041 1041
                                             };
1042 1042
                                             // Add richtext editor to the list
1043
-                                            $richtexteditorIds[$editor][] = "tv" . $row['id'];
1044
-                                            $richtexteditorOptions[$editor]["tv" . $row['id']] = $tvOptions;
1043
+                                            $richtexteditorIds[$editor][] = "tv".$row['id'];
1044
+                                            $richtexteditorOptions[$editor]["tv".$row['id']] = $tvOptions;
1045 1045
                                         }
1046 1046
 
1047 1047
                                         $templateVariablesTmp = '';
@@ -1058,24 +1058,24 @@  discard block
 block discarded – undo
1058 1058
                                         }
1059 1059
 
1060 1060
                                         // post back value
1061
-                                        if (array_key_exists('tv' . $row['id'], $_POST)) {
1062
-                                            if (is_array($_POST['tv' . $row['id']])) {
1063
-                                                $tvPBV = implode('||', $_POST['tv' . $row['id']]);
1061
+                                        if (array_key_exists('tv'.$row['id'], $_POST)) {
1062
+                                            if (is_array($_POST['tv'.$row['id']])) {
1063
+                                                $tvPBV = implode('||', $_POST['tv'.$row['id']]);
1064 1064
                                             } else {
1065
-                                                $tvPBV = $_POST['tv' . $row['id']];
1065
+                                                $tvPBV = $_POST['tv'.$row['id']];
1066 1066
                                             }
1067 1067
                                         } else {
1068 1068
                                             $tvPBV = $row['value'];
1069 1069
                                         }
1070 1070
 
1071
-                                        $tvDescription = (!empty($row['description'])) ? '<br /><span class="comment">' . $row['description'] . '</span>' : '';
1072
-                                        $tvInherited = (substr($tvPBV, 0, 8) == '@INHERIT') ? '<br /><span class="comment inherited">(' . $_lang['tmplvars_inherited'] . ')</span>' : '';
1073
-                                        $tvName = $modx->hasPermission('edit_template') ? '<br/><small class="protectedNode">[*' . $row['name'] . '*]</small>' : '';
1071
+                                        $tvDescription = (!empty($row['description'])) ? '<br /><span class="comment">'.$row['description'].'</span>' : '';
1072
+                                        $tvInherited = (substr($tvPBV, 0, 8) == '@INHERIT') ? '<br /><span class="comment inherited">('.$_lang['tmplvars_inherited'].')</span>' : '';
1073
+                                        $tvName = $modx->hasPermission('edit_template') ? '<br/><small class="protectedNode">[*'.$row['name'].'*]</small>' : '';
1074 1074
 
1075 1075
                                         $templateVariablesTmp .= '
1076 1076
                                         <tr>
1077
-                                            <td><span class="warning">' . $row['caption'] . $tvName . '</span>' . $tvDescription . $tvInherited . '</td>
1078
-                                            <td><div style="position:relative;' . ($row['type'] == 'date' ? '' : '') . '">' . renderFormElement($row['type'], $row['id'], $row['default_text'], $row['elements'], $tvPBV, '', $row, $tvsArray) . '</div></td>
1077
+                                            <td><span class="warning">' . $row['caption'].$tvName.'</span>'.$tvDescription.$tvInherited.'</td>
1078
+                                            <td><div style="position:relative;' . ($row['type'] == 'date' ? '' : '').'">'.renderFormElement($row['type'], $row['id'], $row['default_text'], $row['elements'], $tvPBV, '', $row, $tvsArray).'</div></td>
1079 1079
                                         </tr>';
1080 1080
 
1081 1081
                                         if ($group_tvs && $row['category_id'] == 0) {
@@ -1089,38 +1089,38 @@  discard block
 block discarded – undo
1089 1089
                                     }
1090 1090
 
1091 1091
                                     if ($templateVariablesGeneral) {
1092
-                                        echo '<table id="tabTV_0" class="tmplvars"><tbody>' . $templateVariablesGeneral . '</tbody></table>';
1092
+                                        echo '<table id="tabTV_0" class="tmplvars"><tbody>'.$templateVariablesGeneral.'</tbody></table>';
1093 1093
                                     }
1094 1094
 
1095 1095
                                     $templateVariables .= '
1096 1096
                         <!-- Template Variables -->' . "\n";
1097 1097
                                     if (!$group_tvs) {
1098 1098
                                         $templateVariables .= '
1099
-                                    <div class="sectionHeader" id="tv_header">' . $_lang['settings_templvars'] . '</div>
1099
+                                    <div class="sectionHeader" id="tv_header">' . $_lang['settings_templvars'].'</div>
1100 1100
                                         <div class="sectionBody tmplvars">
1101 1101
                                             <table>';
1102 1102
                                     } else if ($group_tvs == 2) {
1103 1103
                                         $templateVariables .= '
1104 1104
                     <div class="tab-section">
1105
-                        <div class="tab-header" id="tv_header">' . $_lang['settings_templvars'] . '</div>
1105
+                        <div class="tab-header" id="tv_header">' . $_lang['settings_templvars'].'</div>
1106 1106
                         <div class="tab-pane" id="paneTemplateVariables">
1107 1107
                             <script type="text/javascript">
1108
-                                tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . ');
1108
+                                tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').');
1109 1109
                             </script>';
1110 1110
                                     } else if ($group_tvs == 3) {
1111 1111
                                         $templateVariables .= '
1112 1112
                         <div id="templateVariables" class="tab-page tmplvars">
1113
-                            <h2 class="tab">' . $_lang['settings_templvars'] . '</h2>
1113
+                            <h2 class="tab">' . $_lang['settings_templvars'].'</h2>
1114 1114
                             <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'templateVariables\'));</script>';
1115 1115
                                     } else if ($group_tvs == 4) {
1116 1116
                                         $templateVariables .= '
1117 1117
                     <div id="templateVariables" class="tab-page tmplvars">
1118
-                        <h2 class="tab">' . $_lang['settings_templvars'] . '</h2>
1118
+                        <h2 class="tab">' . $_lang['settings_templvars'].'</h2>
1119 1119
                         <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'templateVariables\'));</script>
1120 1120
                         
1121 1121
                         <div class="tab-pane" id="paneTemplateVariables">
1122 1122
                             <script type="text/javascript">
1123
-                                tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . ');
1123
+                                tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').');
1124 1124
                             </script>';
1125 1125
                                     }
1126 1126
                                     $templateVariables .= $templateVariablesOutput;
@@ -1212,7 +1212,7 @@  discard block
 block discarded – undo
1212 1212
 
1213 1213
 								<?php
1214 1214
 
1215
-								if($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) {
1215
+								if ($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) {
1216 1216
 									?>
1217 1217
 									<tr>
1218 1218
 										<td>
@@ -1235,13 +1235,13 @@  discard block
 block discarded – undo
1235 1235
 										<td>
1236 1236
 											<select name="contentType" class="inputBox" onchange="documentDirty=true;">
1237 1237
 												<?php
1238
-												if(!$content['contentType']) {
1238
+												if (!$content['contentType']) {
1239 1239
 													$content['contentType'] = 'text/html';
1240 1240
 												}
1241 1241
 												$custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml");
1242 1242
 												$ct = explode(",", $custom_contenttype);
1243
-												for($i = 0; $i < count($ct); $i++) {
1244
-													echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n";
1243
+												for ($i = 0; $i < count($ct); $i++) {
1244
+													echo "\t\t\t\t\t".'<option value="'.$ct[$i].'"'.($content['contentType'] == $ct[$i] ? ' selected="selected"' : '').'>'.$ct[$i]."</option>\n";
1245 1245
 												}
1246 1246
 												?>
1247 1247
 											</select>
@@ -1267,7 +1267,7 @@  discard block
 block discarded – undo
1267 1267
 									</tr>
1268 1268
 									<?php
1269 1269
 								} else {
1270
-									if($content['type'] != 'reference' && $modx->manager->action != '72') {
1270
+									if ($content['type'] != 'reference' && $modx->manager->action != '72') {
1271 1271
 										// non-admin managers creating or editing a document resource
1272 1272
 										?>
1273 1273
 										<input type="hidden" name="contentType" value="<?= (isset($content['contentType']) ? $content['contentType'] : "text/html") ?>" />
@@ -1367,15 +1367,15 @@  discard block
 block discarded – undo
1367 1367
 						<?php
1368 1368
 					/*******************************
1369 1369
 					 * Document Access Permissions */
1370
-					if($use_udperms == 1) {
1370
+					if ($use_udperms == 1) {
1371 1371
 						$groupsarray = array();
1372 1372
 						$sql = '';
1373 1373
 
1374 1374
 						$documentId = ($modx->manager->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']));
1375
-						if($documentId > 0) {
1375
+						if ($documentId > 0) {
1376 1376
 							// Load up, the permissions from the parent (if new document) or existing document
1377 1377
 							$rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'");
1378
-							while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id'];
1378
+							while ($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'].','.$currentgroup['id'];
1379 1379
 
1380 1380
 							// Load up the current permissions and names
1381 1381
 							$vs = array(
@@ -1391,7 +1391,7 @@  discard block
 block discarded – undo
1391 1391
 						}
1392 1392
 
1393 1393
 						// retain selected doc groups between post
1394
-						if(isset($_POST['docgroups'])) {
1394
+						if (isset($_POST['docgroups'])) {
1395 1395
 							$groupsarray = array_merge($groupsarray, $_POST['docgroups']);
1396 1396
 						}
1397 1397
 
@@ -1410,26 +1410,26 @@  discard block
 block discarded – undo
1410 1410
 						$permissions_no = 0; // count permissions the current mgr user doesn't have
1411 1411
 
1412 1412
 						// Loop through the permissions list
1413
-						while($row = $modx->db->getRow($rs)) {
1413
+						while ($row = $modx->db->getRow($rs)) {
1414 1414
 
1415 1415
 							// Create an inputValue pair (group ID and group link (if it exists))
1416
-							$inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new');
1417
-							$inputId = 'group-' . $row['id'];
1416
+							$inputValue = $row['id'].','.($row['link_id'] ? $row['link_id'] : 'new');
1417
+							$inputId = 'group-'.$row['id'];
1418 1418
 
1419 1419
 							$checked = in_array($inputValue, $groupsarray);
1420
-							if($checked) {
1420
+							if ($checked) {
1421 1421
 								$notPublic = true;
1422 1422
 							} // Mark as private access (either web or manager)
1423 1423
 
1424 1424
 							// Skip the access permission if the user doesn't have access...
1425
-							if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) {
1425
+							if ((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) {
1426 1426
 								continue;
1427 1427
 							}
1428 1428
 
1429 1429
 							// Setup attributes for this Input box
1430 1430
 							$inputAttributes['id'] = $inputId;
1431 1431
 							$inputAttributes['value'] = $inputValue;
1432
-							if($checked) {
1432
+							if ($checked) {
1433 1433
 								$inputAttributes['checked'] = 'checked';
1434 1434
 							} else {
1435 1435
 								unset($inputAttributes['checked']);
@@ -1437,10 +1437,10 @@  discard block
 block discarded – undo
1437 1437
 
1438 1438
 							// Create attribute string list
1439 1439
 							$inputString = array();
1440
-							foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"';
1440
+							foreach ($inputAttributes as $k => $v) $inputString[] = $k.'="'.$v.'"';
1441 1441
 
1442 1442
 							// Make the <input> HTML
1443
-							$inputHTML = '<input ' . implode(' ', $inputString) . ' />';
1443
+							$inputHTML = '<input '.implode(' ', $inputString).' />';
1444 1444
 
1445 1445
 							// does user have this permission?
1446 1446
 							$from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg";
@@ -1451,23 +1451,23 @@  discard block
 block discarded – undo
1451 1451
 							$where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs);
1452 1452
 							$rsp = $modx->db->select('COUNT(mg.id)', $from, $where);
1453 1453
 							$count = $modx->db->getValue($rsp);
1454
-							if($count > 0) {
1454
+							if ($count > 0) {
1455 1455
 								++$permissions_yes;
1456 1456
 							} else {
1457 1457
 								++$permissions_no;
1458 1458
 							}
1459
-							$permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>';
1459
+							$permissions[] = "\t\t".'<li>'.$inputHTML.'<label for="'.$inputId.'">'.$row['name'].'</label></li>';
1460 1460
 						}
1461 1461
 						// if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public
1462
-						if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) {
1462
+						if ($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) {
1463 1463
 							$permissions = array();
1464 1464
 						}
1465 1465
 
1466 1466
 						// See if the Access Permissions section is worth displaying...
1467
-						if(!empty($permissions)) {
1467
+						if (!empty($permissions)) {
1468 1468
 							// Add the "All Document Groups" item if we have rights in both contexts
1469
-							if($isManager && $isWeb) {
1470
-								array_unshift($permissions, "\t\t" . '<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true);" /><label for="groupall" class="warning">' . $_lang['all_doc_groups'] . '</label></li>');
1469
+							if ($isManager && $isWeb) {
1470
+								array_unshift($permissions, "\t\t".'<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"'.(!$notPublic ? ' checked="checked"' : '').' onclick="makePublic(true);" /><label for="groupall" class="warning">'.$_lang['all_doc_groups'].'</label></li>');
1471 1471
 							}
1472 1472
 							// Output the permissions list...
1473 1473
 							?>
@@ -1500,12 +1500,12 @@  discard block
 block discarded – undo
1500 1500
 								</script>
1501 1501
 								<p><?= $_lang['access_permissions_docs_message'] ?></p>
1502 1502
 								<ul>
1503
-									<?= implode("\n", $permissions) . "\n" ?>
1503
+									<?= implode("\n", $permissions)."\n" ?>
1504 1504
 								</ul>
1505 1505
 							</div><!--div class="tab-page" id="tabAccess"-->
1506 1506
 							<?php
1507 1507
 						} // !empty($permissions)
1508
-						elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) {
1508
+						elseif ($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) {
1509 1509
 							?>
1510 1510
 							<p><?= $_lang["access_permissions_docs_collision"] ?></p>
1511 1511
 							<?php
@@ -1525,7 +1525,7 @@  discard block
 block discarded – undo
1525 1525
 						'template' => $content['template']
1526 1526
 					));
1527 1527
 
1528
-					if(is_array($evtOut)) {
1528
+					if (is_array($evtOut)) {
1529 1529
 						echo implode('', $evtOut);
1530 1530
 					}
1531 1531
 					?>
@@ -1538,16 +1538,16 @@  discard block
 block discarded – undo
1538 1538
 		storeCurTemplate();
1539 1539
 	</script>
1540 1540
 <?php
1541
-if(($content['richtext'] == 1 || $modx->manager->action == '4' || $modx->manager->action == '72') && $use_editor == 1) {
1542
-	if(is_array($richtexteditorIds)) {
1543
-		foreach($richtexteditorIds as $editor => $elements) {
1541
+if (($content['richtext'] == 1 || $modx->manager->action == '4' || $modx->manager->action == '72') && $use_editor == 1) {
1542
+	if (is_array($richtexteditorIds)) {
1543
+		foreach ($richtexteditorIds as $editor => $elements) {
1544 1544
 			// invoke OnRichTextEditorInit event
1545 1545
 			$evtOut = $modx->invokeEvent('OnRichTextEditorInit', array(
1546 1546
 				'editor' => $editor,
1547 1547
 				'elements' => $elements,
1548 1548
 				'options' => $richtexteditorOptions[$editor]
1549 1549
 			));
1550
-			if(is_array($evtOut)) {
1550
+			if (is_array($evtOut)) {
1551 1551
 				echo implode('', $evtOut);
1552 1552
 			}
1553 1553
 		}
@@ -1557,37 +1557,37 @@  discard block
 block discarded – undo
1557 1557
 /**
1558 1558
  * @return string
1559 1559
  */
1560
-function getDefaultTemplate() {
1560
+function getDefaultTemplate(){
1561 1561
 	$modx = evolutionCMS();
1562 1562
 
1563 1563
     $default_template = '';
1564
-	switch($modx->config['auto_template_logic']) {
1564
+	switch ($modx->config['auto_template_logic']) {
1565 1565
 		case 'sibling':
1566
-			if(!isset($_GET['pid']) || empty($_GET['pid'])) {
1566
+			if (!isset($_GET['pid']) || empty($_GET['pid'])) {
1567 1567
 				$site_start = $modx->config['site_start'];
1568 1568
 				$where = "sc.isfolder=0 AND sc.id!='{$site_start}'";
1569 1569
 				$sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', $where, 'menuindex', 'ASC', 1);
1570
-				if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') {
1570
+				if (isset($sibl[0]['template']) && $sibl[0]['template'] !== '') {
1571 1571
 					$default_template = $sibl[0]['template'];
1572 1572
 				}
1573 1573
 			} else {
1574 1574
 				$sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1);
1575
-				if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') {
1575
+				if (isset($sibl[0]['template']) && $sibl[0]['template'] !== '') {
1576 1576
 					$default_template = $sibl[0]['template'];
1577 1577
 				} else {
1578 1578
 					$sibl = $modx->getDocumentChildren($_REQUEST['pid'], 0, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1);
1579
-					if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') {
1579
+					if (isset($sibl[0]['template']) && $sibl[0]['template'] !== '') {
1580 1580
 						$default_template = $sibl[0]['template'];
1581 1581
 					}
1582 1582
 				}
1583 1583
 			}
1584
-			if(isset($default_template)) {
1584
+			if (isset($default_template)) {
1585 1585
 				break;
1586 1586
 			} // If $default_template could not be determined, fall back / through to "parent"-mode
1587 1587
 		case 'parent':
1588
-			if(isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) {
1588
+			if (isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) {
1589 1589
 				$parent = $modx->getPageInfo($_REQUEST['pid'], 0, 'template');
1590
-				if(isset($parent['template'])) {
1590
+				if (isset($parent['template'])) {
1591 1591
 					$default_template = $parent['template'];
1592 1592
 				}
1593 1593
 			}
Please login to merge, or discard this patch.
manager/processors/save_settings.processor.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -1,46 +1,46 @@  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('settings')) {
5
+if (!$modx->hasPermission('settings')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 $data = $_POST;
9 9
 // lose the POST now, gets rid of quirky issue with Safari 3 - see FS#972
10 10
 unset($_POST);
11 11
 
12
-if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false)
12
+if ($data['friendly_urls'] === '1' && strpos($_SERVER['SERVER_SOFTWARE'], 'IIS') === false)
13 13
 {
14
-	$htaccess        = $modx->config['base_path'] . '.htaccess';
15
-	$sample_htaccess = $modx->config['base_path'] . 'ht.access';
16
-	$dir = '/' . trim($modx->config['base_url'],'/');
17
-	if(is_file($htaccess))
14
+	$htaccess        = $modx->config['base_path'].'.htaccess';
15
+	$sample_htaccess = $modx->config['base_path'].'ht.access';
16
+	$dir = '/'.trim($modx->config['base_url'], '/');
17
+	if (is_file($htaccess))
18 18
 	{
19 19
 		$_ = file_get_contents($htaccess);
20
-		if(strpos($_,'RewriteBase')===false)
20
+		if (strpos($_, 'RewriteBase') === false)
21 21
 		{
22 22
 			$warnings[] = $_lang["settings_friendlyurls_alert2"];
23 23
 		}
24
-		elseif(is_writable($htaccess))
24
+		elseif (is_writable($htaccess))
25 25
 		{
26
-			$_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_);
27
-			if(!@file_put_contents($htaccess,$_))
26
+			$_ = preg_replace('@RewriteBase.+@', "RewriteBase {$dir}", $_);
27
+			if (!@file_put_contents($htaccess, $_))
28 28
 			{
29 29
 				$warnings[] = $_lang["settings_friendlyurls_alert2"];
30 30
 			}
31 31
 		}
32 32
 	}
33
-	elseif(is_file($sample_htaccess))
33
+	elseif (is_file($sample_htaccess))
34 34
 	{
35
-		if(!@rename($sample_htaccess,$htaccess))
35
+		if (!@rename($sample_htaccess, $htaccess))
36 36
         {
37 37
         	$warnings[] = $_lang["settings_friendlyurls_alert"];
38 38
 		}
39
-		elseif($modx->config['base_url']!=='/')
39
+		elseif ($modx->config['base_url'] !== '/')
40 40
 		{
41 41
 			$_ = file_get_contents($htaccess);
42
-			$_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_);
43
-			if(!@file_put_contents($htaccess,$_))
42
+			$_ = preg_replace('@RewriteBase.+@', "RewriteBase {$dir}", $_);
43
+			if (!@file_put_contents($htaccess, $_))
44 44
 			{
45 45
 				$warnings[] = $_lang["settings_friendlyurls_alert2"];
46 46
 			}
@@ -48,17 +48,17 @@  discard block
 block discarded – undo
48 48
 	}
49 49
 }
50 50
 
51
-if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) {
52
-    unlink(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css');
51
+if (file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css')) {
52
+    unlink(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css');
53 53
 }
54 54
 
55
-$data['filemanager_path'] = str_replace('[(base_path)]',MODX_BASE_PATH,$data['filemanager_path']);
56
-$data['rb_base_dir']      = str_replace('[(base_path)]',MODX_BASE_PATH,$data['rb_base_dir']);
55
+$data['filemanager_path'] = str_replace('[(base_path)]', MODX_BASE_PATH, $data['filemanager_path']);
56
+$data['rb_base_dir']      = str_replace('[(base_path)]', MODX_BASE_PATH, $data['rb_base_dir']);
57 57
 
58 58
 if (isset($data) && count($data) > 0) {
59
-	if(isset($data['manager_language'])) {
60
-		$lang_path = MODX_MANAGER_PATH . 'includes/lang/' . $data['manager_language'] . '.inc.php';
61
-		if(is_file($lang_path)) {
59
+	if (isset($data['manager_language'])) {
60
+		$lang_path = MODX_MANAGER_PATH.'includes/lang/'.$data['manager_language'].'.inc.php';
61
+		if (is_file($lang_path)) {
62 62
 			include($lang_path);
63 63
             global $modx_lang_attribute;
64 64
             $data['lang_code'] = !$modx_lang_attribute ? 'en' : $modx_lang_attribute;
@@ -66,15 +66,15 @@  discard block
 block discarded – undo
66 66
 	}
67 67
 	$savethese = array();
68 68
 	$data['sys_files_checksum'] = $modx->manager->getSystemChecksum($data['check_files_onlogin']);
69
-	$data['mail_check_timeperiod'] = (int)$data['mail_check_timeperiod'] < 60 ? 60 : $data['mail_check_timeperiod']; // updateMail() in mainMenu no faster than every minute
69
+	$data['mail_check_timeperiod'] = (int) $data['mail_check_timeperiod'] < 60 ? 60 : $data['mail_check_timeperiod']; // updateMail() in mainMenu no faster than every minute
70 70
 	foreach ($data as $k => $v) {
71 71
 		switch ($k) {
72 72
 			case 'site_name':
73 73
 				$v = htmlspecialchars($v);
74 74
 				break;
75 75
             case 'settings_version':{
76
-                if($modx->getVersionData('version')!=$data['settings_version']){
77
-                    $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version');
76
+                if ($modx->getVersionData('version') != $data['settings_version']) {
77
+                    $modx->logEvent(17, 2, '<pre>'.var_export($data['settings_version'], true).'</pre>', 'fake settings_version');
78 78
                     $v = $modx->getVersionData('version');
79 79
                 }
80 80
                 break;
@@ -95,21 +95,21 @@  discard block
 block discarded – undo
95 95
 			case 'rb_base_url':
96 96
 			case 'filemanager_path':
97 97
 				$v = trim($v);
98
-				$v = rtrim($v,'/') . '/';
98
+				$v = rtrim($v, '/').'/';
99 99
 				break;
100 100
             case 'manager_language':
101
-                $langDir = realpath(MODX_MANAGER_PATH . 'includes/lang');
102
-                $langFile = realpath(MODX_MANAGER_PATH . 'includes/lang/' . $v . '.inc.php');
101
+                $langDir = realpath(MODX_MANAGER_PATH.'includes/lang');
102
+                $langFile = realpath(MODX_MANAGER_PATH.'includes/lang/'.$v.'.inc.php');
103 103
                 $langFileDir = dirname($langFile);
104
-                if($langDir !== $langFileDir || !file_exists($langFile)) {
104
+                if ($langDir !== $langFileDir || !file_exists($langFile)) {
105 105
                     $v = 'english';
106 106
                 }
107 107
 				break;
108 108
 			case 'smtppw':
109 109
 				if ($v !== '********************' && $v !== '') {
110 110
 					$v = trim($v);
111
-					$v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7);
112
-					$v = str_replace('=','%',$v);
111
+					$v = base64_encode($v).substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7);
112
+					$v = str_replace('=', '%', $v);
113 113
 				} elseif ($v === '********************') {
114 114
 					$k = '';
115 115
 				}
@@ -118,14 +118,14 @@  discard block
 block discarded – undo
118 118
 				$v = str_replace(array(' ,', ', '), ',', $v);
119 119
 				if ($v !== ',') {
120 120
 					$v = ($v != 'MODX_SITE_HOSTNAMES') ? $v : '';
121
-					$configString = '<?php' . "\n" . 'define(\'MODX_SITE_HOSTNAMES\', \'' . $v . '\');' . "\n";
122
-					@file_put_contents(MODX_BASE_PATH . 'assets/cache/siteHostnames.php', $configString);
121
+					$configString = '<?php'."\n".'define(\'MODX_SITE_HOSTNAMES\', \''.$v.'\');'."\n";
122
+					@file_put_contents(MODX_BASE_PATH.'assets/cache/siteHostnames.php', $configString);
123 123
 				}
124 124
 				$k = '';
125 125
 				break;
126 126
 			case 'session_timeout':
127 127
 				$mail_check_timeperiod = $data['mail_check_timeperiod'];
128
-				$v = (int)$v < ($data['mail_check_timeperiod']/60+1) ? ($data['mail_check_timeperiod']/60+1) : $v; // updateMail() in mainMenu pings as per mail_check_timeperiod, so +1min is minimum
128
+				$v = (int) $v < ($data['mail_check_timeperiod'] / 60 + 1) ? ($data['mail_check_timeperiod'] / 60 + 1) : $v; // updateMail() in mainMenu pings as per mail_check_timeperiod, so +1min is minimum
129 129
 				break;
130 130
 			default:
131 131
 			break;
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 
135 135
 		$modx->config[$k] = $v;
136 136
 
137
-		if(!empty($k)) $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')';
137
+		if (!empty($k)) $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')';
138 138
 	}
139 139
 
140 140
 	// Run a single query to save all the values
@@ -144,16 +144,16 @@  discard block
 block discarded – undo
144 144
 
145 145
 	// Reset Template Pages
146 146
 	if (isset($data['reset_template'])) {
147
-		$newtemplate = (int)$data['default_template'];
148
-		$oldtemplate = (int)$data['old_template'];
147
+		$newtemplate = (int) $data['default_template'];
148
+		$oldtemplate = (int) $data['old_template'];
149 149
 		$tbl = $modx->getFullTableName('site_content');
150 150
 		$reset = $data['reset_template'];
151
-		if($reset==1) $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'");
152
-		else if($reset==2) $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'");
151
+		if ($reset == 1) $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'");
152
+		else if ($reset == 2) $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'");
153 153
 	}
154 154
 
155 155
 	// empty cache
156 156
 	$modx->clearCache('full');
157 157
 }
158
-$header="Location: index.php?a=7&r=10";
158
+$header = "Location: index.php?a=7&r=10";
159 159
 header($header);
Please login to merge, or discard this patch.
manager/actions/mutate_user.dynamic.php 1 patch
Spacing   +58 added lines, -58 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->manager->action) {
6
+switch ($modx->manager->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,20 +18,20 @@  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->db->select('username', $modx->getFullTableName('active_users'), "action=12 AND id='{$user}' AND internalKey!='" . $modx->getLoginUserID() . "'");
25
-if($username = $modx->db->getValue($rs)) {
24
+$rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=12 AND id='{$user}' AND internalKey!='".$modx->getLoginUserID()."'");
25
+if ($username = $modx->db->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->manager->action == '12') {
30
+if ($modx->manager->action == '12') {
31 31
 	// get user attribute
32 32
 	$rs = $modx->db->select('*', $modx->getFullTableName('user_attributes'), "internalKey = '{$user}'");
33 33
 	$userdata = $modx->db->getRow($rs);
34
-	if(!$userdata) {
34
+	if (!$userdata) {
35 35
 		$modx->webAlertAndQuit("No user returned!");
36 36
 	}
37 37
 
@@ -39,10 +39,10 @@  discard block
 block discarded – undo
39 39
 	// get user settings
40 40
 	$rs = $modx->db->select('*', $modx->getFullTableName('user_settings'), "user = '{$user}'");
41 41
 	$usersettings = array();
42
-	while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value'];
42
+	while ($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value'];
43 43
 	// manually extract so that user display settings are not overwritten
44
-	foreach($usersettings as $k => $v) {
45
-		if($k != 'manager_language' && $k != 'manager_theme') {
44
+	foreach ($usersettings as $k => $v) {
45
+		if ($k != 'manager_language' && $k != 'manager_theme') {
46 46
 			${$k} = $v;
47 47
 		}
48 48
 	}
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	// get user name
51 51
 	$rs = $modx->db->select('*', $modx->getFullTableName('manager_users'), "id = '{$user}'");
52 52
 	$usernamedata = $modx->db->getRow($rs);
53
-	if(!$usernamedata) {
53
+	if (!$usernamedata) {
54 54
 		$modx->webAlertAndQuit("No user returned while getting username!");
55 55
 	}
56 56
 	$_SESSION['itemname'] = $usernamedata['username'];
@@ -62,14 +62,14 @@  discard block
 block discarded – undo
62 62
 }
63 63
 
64 64
 // avoid doubling htmlspecialchars (already encoded in DB)
65
-foreach($userdata as $key => $val) {
65
+foreach ($userdata as $key => $val) {
66 66
 	$userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']);
67 67
 };
68 68
 $usernamedata['username'] = html_entity_decode($usernamedata['username'], ENT_NOQUOTES, $modx->config['modx_charset']);
69 69
 
70 70
 // restore saved form
71 71
 $formRestored = false;
72
-if($modx->manager->hasFormValues()) {
72
+if ($modx->manager->hasFormValues()) {
73 73
 	$modx->manager->loadFormValues();
74 74
 	// restore post values
75 75
 	$userdata = array_merge($userdata, $_POST);
@@ -84,13 +84,13 @@  discard block
 block discarded – undo
84 84
 // include the country list language file
85 85
 $_country_lang = array();
86 86
 include_once "lang/country/english_country.inc.php";
87
-if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) {
88
-	include_once "lang/country/" . $manager_language . "_country.inc.php";
87
+if ($manager_language != "english" && file_exists($modx->config['site_manager_path']."includes/lang/country/".$manager_language."_country.inc.php")) {
88
+	include_once "lang/country/".$manager_language."_country.inc.php";
89 89
 }
90 90
 asort($_country_lang);
91 91
 
92 92
 $displayStyle = ($_SESSION['browser'] === 'modern') ? 'table-row' : 'block';
93
-if($which_browser == 'default') {
93
+if ($which_browser == 'default') {
94 94
 	$which_browser = $modx->configGlobal['which_browser'] ? $modx->configGlobal['which_browser'] : $modx->config['which_browser'];
95 95
 }
96 96
 ?>
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 			document.userform.save.click();
183 183
 		},
184 184
 		delete: function() {
185
-			<?php if($_GET['id'] == $modx->getLoginUserID()) { ?>
185
+			<?php if ($_GET['id'] == $modx->getLoginUserID()) { ?>
186 186
 			alert("<?php echo $_lang['alert_delete_self']; ?>");
187 187
 			<?php } else { ?>
188 188
 			if(confirm("<?php echo $_lang['confirm_delete_user']; ?>") === true) {
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 	$evtOut = $modx->invokeEvent("OnUserFormPrerender", array(
206 206
 		"id" => $user
207 207
 	));
208
-	if(is_array($evtOut)) {
208
+	if (is_array($evtOut)) {
209 209
 		echo implode("", $evtOut);
210 210
 	}
211 211
 	?>
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	<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" ?>" />
215 215
 
216 216
 	<h1>
217
-        <i class="fa fa fa-user"></i><?= ($usernamedata['username'] ? $usernamedata['username'] . '<small>(' . $usernamedata['id'] . ')</small>' : $_lang['user_title']) ?>
217
+        <i class="fa fa fa-user"></i><?= ($usernamedata['username'] ? $usernamedata['username'].'<small>('.$usernamedata['id'].')</small>' : $_lang['user_title']) ?>
218 218
     </h1>
219 219
 
220 220
 	<?php echo $_style['actionbuttons']['dynamic']['user'] ?>
@@ -232,13 +232,13 @@  discard block
 block discarded – undo
232 232
 				<table border="0" cellspacing="0" cellpadding="3" class="table table--edit table--editUser">
233 233
 					<tr>
234 234
 						<td colspan="3"><span id="blocked" class="warning">
235
-							<?php if($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || $userdata['failedlogins'] > 3) { ?>
235
+							<?php if ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || $userdata['failedlogins'] > 3) { ?>
236 236
 								<?php echo $_lang['user_is_blocked']; ?>
237 237
 							<?php } ?>
238 238
 							</span>
239 239
 							<br /></td>
240 240
 					</tr>
241
-					<?php if(!empty($userdata['id'])) { ?>
241
+					<?php if (!empty($userdata['id'])) { ?>
242 242
 						<tr id="showname" style="display: <?php echo ($modx->manager->action == '12' && (!isset($usernamedata['oldusername']) || $usernamedata['oldusername'] == $usernamedata['username'])) ? $displayStyle : 'none'; ?> ">
243 243
 							<td colspan="3"><i class="<?php echo $_style["icons_user"] ?>"></i>&nbsp;<b><?php echo $modx->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>
244 244
 								<input type="hidden" name="oldusername" value="<?php echo $modx->htmlspecialchars(!empty($usernamedata['oldusername']) ? $usernamedata['oldusername'] : $usernamedata['username']); ?>" />
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 						<td><input type="text" name="newusername" class="inputBox" value="<?php echo $modx->htmlspecialchars($usernamedata['username']); ?>" onChange='documentDirty=true;' maxlength="100" /></td>
252 252
 					</tr>
253 253
 					<tr>
254
-						<th><?php echo $modx->manager->action == '11' ? $_lang['password'] . ":" : $_lang['change_password_new'] . ":"; ?></th>
254
+						<th><?php echo $modx->manager->action == '11' ? $_lang['password'].":" : $_lang['change_password_new'].":"; ?></th>
255 255
 						<td>&nbsp;</td>
256 256
 						<td><input name="newpasswordcheck" type="checkbox" onClick="changestate(document.userform.newpassword);changePasswordState(document.userform.newpassword);"<?php echo $modx->manager->action == "11" ? " checked disabled" : ""; ?>>
257 257
 							<input type="hidden" name="newpassword" value="<?php echo $modx->manager->action == "11" ? 1 : 0; ?>" onChange="documentDirty=true;" />
@@ -305,8 +305,8 @@  discard block
 block discarded – undo
305 305
 							?>
306 306
 							<select name="role" class="inputBox" onChange='documentDirty=true;' style="width:300px">
307 307
 								<?php
308
-								while($row = $modx->db->getRow($rs)) {
309
-									if($modx->manager->action == '11') {
308
+								while ($row = $modx->db->getRow($rs)) {
309
+									if ($modx->manager->action == '11') {
310 310
 										$selectedtext = $row['id'] == '1' ? ' selected="selected"' : '';
311 311
 									} else {
312 312
 										$selectedtext = $row['id'] == $userdata['role'] ? "selected='selected'" : '';
@@ -360,8 +360,8 @@  discard block
 block discarded – undo
360 360
 								<?php $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $userdata['country']; ?>
361 361
 								<option value="" <?php (!isset($chosenCountry) ? ' selected' : '') ?> >&nbsp;</option>
362 362
 								<?php
363
-								foreach($_country_lang as $key => $country) {
364
-									echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>";
363
+								foreach ($_country_lang as $key => $country) {
364
+									echo "<option value=\"$key\"".(isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '').">$country</option>";
365 365
 								}
366 366
 								?>
367 367
 							</select></td>
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 						<td>&nbsp;</td>
388 388
 						<td><textarea type="text" name="comment" class="inputBox" rows="5" onChange="documentDirty=true;"><?php echo $modx->htmlspecialchars($userdata['comment']); ?></textarea></td>
389 389
 					</tr>
390
-					<?php if($modx->manager->action == '12') { ?>
390
+					<?php if ($modx->manager->action == '12') { ?>
391 391
 						<tr>
392 392
 							<th><?php echo $_lang['user_logincount']; ?>:</th>
393 393
 							<td>&nbsp;</td>
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 						</tr>
425 425
 					<?php } ?>
426 426
 				</table>
427
-				<?php if($_GET['id'] == $modx->getLoginUserID()) { ?>
427
+				<?php if ($_GET['id'] == $modx->getLoginUserID()) { ?>
428 428
 					<p><?php echo $_lang['user_edit_self_msg']; ?></p>
429 429
 				<?php } ?>
430 430
 			</div>
@@ -441,8 +441,8 @@  discard block
 block discarded – undo
441 441
 								<?php
442 442
 								$activelang = !empty($usersettings['manager_language']) ? $usersettings['manager_language'] : '';
443 443
 								$dir = dir("includes/lang");
444
-								while($file = $dir->read()) {
445
-									if(strpos($file, ".inc.php") > 0) {
444
+								while ($file = $dir->read()) {
445
+									if (strpos($file, ".inc.php") > 0) {
446 446
 										$endpos = strpos($file, ".");
447 447
 										$languagename = substr($file, 0, $endpos);
448 448
 										$selectedtext = $languagename == $activelang ? "selected='selected'" : "";
@@ -529,17 +529,17 @@  discard block
 block discarded – undo
529 529
 								<option value=""></option>
530 530
 								<?php
531 531
 								$dir = dir("media/style/");
532
-								while($file = $dir->read()) {
533
-									if($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') {
532
+								while ($file = $dir->read()) {
533
+									if ($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') {
534 534
 										$themename = $file;
535
-										if($themename === 'common') {
535
+										if ($themename === 'common') {
536 536
 											continue;
537 537
 										}
538
-										$attr = 'value="' . $themename . '" ';
539
-										if(isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) {
538
+										$attr = 'value="'.$themename.'" ';
539
+										if (isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) {
540 540
 											$attr .= 'selected="selected" ';
541 541
 										}
542
-										echo "\t\t<option " . rtrim($attr) . '>' . ucwords(str_replace("_", " ", $themename)) . "</option>\n";
542
+										echo "\t\t<option ".rtrim($attr).'>'.ucwords(str_replace("_", " ", $themename))."</option>\n";
543 543
 									}
544 544
 								}
545 545
 								$dir->close();
@@ -580,12 +580,12 @@  discard block
 block discarded – undo
580 580
 						<td><select name="which_browser" class="inputBox" onChange="documentDirty=true;">
581 581
 								<?php
582 582
 								$selected = 'default' == $usersettings['which_browser'] || !$usersettings['which_browser'] ? ' selected="selected"' : '';
583
-								echo '<option value="default"' . $selected . '>' . $_lang['option_default'] . "</option>\n";
584
-								foreach(glob("media/browser/*", GLOB_ONLYDIR) as $dir) {
583
+								echo '<option value="default"'.$selected.'>'.$_lang['option_default']."</option>\n";
584
+								foreach (glob("media/browser/*", GLOB_ONLYDIR) as $dir) {
585 585
 									$dir = str_replace('\\', '/', $dir);
586 586
 									$browser_name = substr($dir, strrpos($dir, '/') + 1);
587 587
 									$selected = $browser_name == $usersettings['which_browser'] ? ' selected="selected"' : '';
588
-									echo '<option value="' . $browser_name . '"' . $selected . '>' . "{$browser_name}</option>\n";
588
+									echo '<option value="'.$browser_name.'"'.$selected.'>'."{$browser_name}</option>\n";
589 589
 								}
590 590
 								?>
591 591
 							</select></td>
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
 					</tr>
613 613
 					<tr>
614 614
 						<td>&nbsp;</td>
615
-						<td class='comment'><?php echo $_lang["uploadable_images_message"] . $_lang["user_upload_message"] ?></td>
615
+						<td class='comment'><?php echo $_lang["uploadable_images_message"].$_lang["user_upload_message"] ?></td>
616 616
 					</tr>
617 617
 					<tr>
618 618
 						<th><?php echo $_lang["uploadable_media_title"] ?></th>
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
 					</tr>
625 625
 					<tr>
626 626
 						<td>&nbsp;</td>
627
-						<td class='comment'><?php echo $_lang["uploadable_media_message"] . $_lang["user_upload_message"] ?></td>
627
+						<td class='comment'><?php echo $_lang["uploadable_media_message"].$_lang["user_upload_message"] ?></td>
628 628
 					</tr>
629 629
 					<tr>
630 630
 						<th><?php echo $_lang["uploadable_flash_title"] ?></th>
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
 					</tr>
637 637
 					<tr>
638 638
 						<td>&nbsp;</td>
639
-						<td class='comment'><?php echo $_lang["uploadable_flash_message"] . $_lang["user_upload_message"] ?></td>
639
+						<td class='comment'><?php echo $_lang["uploadable_flash_message"].$_lang["user_upload_message"] ?></td>
640 640
 					</tr>
641 641
 					<tr>
642 642
 						<th><?php echo $_lang["uploadable_files_title"] ?></th>
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
 					</tr>
649 649
 					<tr>
650 650
 						<td>&nbsp;</td>
651
-						<td class='comment'><?php echo $_lang["uploadable_files_message"] . $_lang["user_upload_message"] ?></td>
651
+						<td class='comment'><?php echo $_lang["uploadable_files_message"].$_lang["user_upload_message"] ?></td>
652 652
 					</tr>
653 653
 					<tr class='row2'>
654 654
 						<th><?php echo $_lang["upload_maxsize_title"] ?></th>
@@ -667,11 +667,11 @@  discard block
 block discarded – undo
667 667
 								$edt = isset ($usersettings["which_editor"]) ? $usersettings["which_editor"] : '';
668 668
 								// invoke OnRichTextEditorRegister event
669 669
 								$evtOut = $modx->invokeEvent("OnRichTextEditorRegister");
670
-								echo "<option value='none'" . ($edt == 'none' ? " selected='selected'" : "") . ">" . $_lang["none"] . "</option>\n";
671
-								if(is_array($evtOut)) {
672
-									for($i = 0; $i < count($evtOut); $i++) {
670
+								echo "<option value='none'".($edt == 'none' ? " selected='selected'" : "").">".$_lang["none"]."</option>\n";
671
+								if (is_array($evtOut)) {
672
+									for ($i = 0; $i < count($evtOut); $i++) {
673 673
 										$editor = $evtOut[$i];
674
-										echo "<option value='$editor'" . ($edt == $editor ? " selected='selected'" : "") . ">$editor</option>\n";
674
+										echo "<option value='$editor'".($edt == $editor ? " selected='selected'" : "").">$editor</option>\n";
675 675
 									}
676 676
 								}
677 677
 								?>
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
 				<?php
710 710
 				// invoke OnInterfaceSettingsRender event
711 711
 				$evtOut = $modx->invokeEvent("OnInterfaceSettingsRender");
712
-				if(is_array($evtOut)) {
712
+				if (is_array($evtOut)) {
713 713
 					echo implode("", $evtOut);
714 714
 				}
715 715
 				?>
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
 					function BrowseServer() {
737 737
 						var w = screen.width * 0.7;
738 738
 						var h = screen.height * 0.7;
739
-						OpenServerBrowser("<?php echo MODX_MANAGER_URL; ?>media/browser/<?php echo $which_browser;?>/browser.php?Type=images", w, h);
739
+						OpenServerBrowser("<?php echo MODX_MANAGER_URL; ?>media/browser/<?php echo $which_browser; ?>/browser.php?Type=images", w, h);
740 740
 					}
741 741
 
742 742
 					function SetUrl(url, width, height, alt) {
@@ -759,17 +759,17 @@  discard block
 block discarded – undo
759 759
 					</tr>
760 760
 				</table>
761 761
 			</div>
762
-			<?php if($use_udperms == 1) {
762
+			<?php if ($use_udperms == 1) {
763 763
 
764 764
 			$groupsarray = array();
765 765
 
766
-			if($modx->manager->action == '12') { // only do this bit if the user is being edited
766
+			if ($modx->manager->action == '12') { // only do this bit if the user is being edited
767 767
 				$rs = $modx->db->select('user_group', $modx->getFullTableName('member_groups'), "member='{$user}'");
768 768
 				$groupsarray = $modx->db->getColumn('user_group', $rs);
769 769
 			}
770 770
 			// retain selected doc groups between post
771
-			if(is_array($_POST['user_groups'])) {
772
-				foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v;
771
+			if (is_array($_POST['user_groups'])) {
772
+				foreach ($_POST['user_groups'] as $n => $v) $groupsarray[] = $v;
773 773
 			}
774 774
 			?>
775 775
 			<div class="tab-page" id="tabAccess">
@@ -778,8 +778,8 @@  discard block
 block discarded – undo
778 778
 				<p><?php echo $_lang['access_permissions_user_message'] ?></p>
779 779
 				<?php
780 780
 				$rs = $modx->db->select('name, id', $modx->getFullTableName('membergroup_names'), '', 'name');
781
-				while($row = $modx->db->getRow($rs)) {
782
-					echo "<label><input type='checkbox' name='user_groups[]' value='" . $row['id'] . "'" . (in_array($row['id'], $groupsarray) ? " checked='checked'" : "") . " />" . $row['name'] . "</label><br />";
781
+				while ($row = $modx->db->getRow($rs)) {
782
+					echo "<label><input type='checkbox' name='user_groups[]' value='".$row['id']."'".(in_array($row['id'], $groupsarray) ? " checked='checked'" : "")." />".$row['name']."</label><br />";
783 783
 				}
784 784
 				}
785 785
 				?>
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
 	$evtOut = $modx->invokeEvent("OnUserFormRender", array(
793 793
 		"id" => $user
794 794
 	));
795
-	if(is_array($evtOut)) {
795
+	if (is_array($evtOut)) {
796 796
 		echo implode("", $evtOut);
797 797
 	}
798 798
 	?>
Please login to merge, or discard this patch.
manager/includes/header.inc.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -20,28 +20,28 @@  discard block
 block discarded – undo
20 20
 $body_class = '';
21 21
 $theme_modes = array('', 'lightness', 'light', 'dark', 'darkness');
22 22
 if (!empty($theme_modes[$_COOKIE['MODX_themeMode']])) {
23
-    $body_class .= ' ' . $theme_modes[$_COOKIE['MODX_themeMode']];
23
+    $body_class .= ' '.$theme_modes[$_COOKIE['MODX_themeMode']];
24 24
 } elseif (!empty($theme_modes[$modx->config['manager_theme_mode']])) {
25
-    $body_class .= ' ' . $theme_modes[$modx->config['manager_theme_mode']];
25
+    $body_class .= ' '.$theme_modes[$modx->config['manager_theme_mode']];
26 26
 }
27 27
 
28
-$css = 'media/style/' . $modx->config['manager_theme'] . '/style.css?v=' . $lastInstallTime;
28
+$css = 'media/style/'.$modx->config['manager_theme'].'/style.css?v='.$lastInstallTime;
29 29
 
30 30
 if ($modx->config['manager_theme'] == 'default') {
31
-    if (!file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')
32
-        && is_writable(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css')) {
31
+    if (!file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css')
32
+        && is_writable(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css')) {
33 33
         $files = array(
34
-            'bootstrap' => MODX_MANAGER_PATH . 'media/style/common/bootstrap/css/bootstrap.min.css',
35
-            'font-awesome' => MODX_MANAGER_PATH . 'media/style/common/font-awesome/css/font-awesome.min.css',
36
-            'fonts' => MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/fonts.css',
37
-            'forms' => MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/forms.css',
38
-            'mainmenu' => MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/mainmenu.css',
39
-            'tree' => MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/tree.css',
40
-            'custom' => MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/custom.css',
41
-            'tabpane' => MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/tabpane.css',
42
-            'contextmenu' => MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/contextmenu.css',
43
-            'index' => MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/index.css',
44
-            'main' => MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/main.css'
34
+            'bootstrap' => MODX_MANAGER_PATH.'media/style/common/bootstrap/css/bootstrap.min.css',
35
+            'font-awesome' => MODX_MANAGER_PATH.'media/style/common/font-awesome/css/font-awesome.min.css',
36
+            'fonts' => MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/fonts.css',
37
+            'forms' => MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/forms.css',
38
+            'mainmenu' => MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/mainmenu.css',
39
+            'tree' => MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/tree.css',
40
+            'custom' => MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/custom.css',
41
+            'tabpane' => MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/tabpane.css',
42
+            'contextmenu' => MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/contextmenu.css',
43
+            'index' => MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/index.css',
44
+            'main' => MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/main.css'
45 45
         );
46 46
         $evtOut = $modx->invokeEvent('OnBeforeMinifyCss', array(
47 47
             'files' => $files,
@@ -58,16 +58,16 @@  discard block
 block discarded – undo
58 58
             default:
59 59
                 $modx->webAlertAndQuit(sprintf($_lang['invalid_event_response'], 'OnBeforeMinifyManagerCss'));
60 60
         }
61
-        require_once MODX_BASE_PATH . 'assets/lib/Formatter/CSSMinify.php';
61
+        require_once MODX_BASE_PATH.'assets/lib/Formatter/CSSMinify.php';
62 62
         $minifier = new Formatter\CSSMinify($files);
63 63
         $css = $minifier->minify();
64 64
         file_put_contents(
65
-            MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css',
65
+            MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css',
66 66
             $css
67 67
         );
68 68
     }
69
-    if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) {
70
-        $css = 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css?v=' . $lastInstallTime;
69
+    if (file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css')) {
70
+        $css = 'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css?v='.$lastInstallTime;
71 71
     }
72 72
 }
73 73
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
83 83
     <link rel="stylesheet" type="text/css" href="<?= $css ?>"/>
84 84
     <script type="text/javascript" src="media/script/tabpane.js"></script>
85
-    <?= sprintf('<script type="text/javascript" src="%s"></script>' . "\n", $modx->config['mgr_jquery_path']) ?>
85
+    <?= sprintf('<script type="text/javascript" src="%s"></script>'."\n", $modx->config['mgr_jquery_path']) ?>
86 86
     <?php if ($modx->config['show_picker'] != "0") { ?>
87 87
         <script src="media/style/<?= $modx->config['manager_theme'] ?>/js/color.switcher.js"
88 88
                 type="text/javascript"></script>
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     <?php } ?>
96 96
 
97 97
     <!-- OnManagerMainFrameHeaderHTMLBlock -->
98
-    <?= $onManagerMainFrameHeaderHTMLBlock . "\n" ?>
98
+    <?= $onManagerMainFrameHeaderHTMLBlock."\n" ?>
99 99
 
100 100
     <script type="text/javascript">
101 101
       if (!evo) {
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     <script>
126 126
         <?php
127 127
         if (isset($_REQUEST['r']) && preg_match('@^[0-9]+$@', $_REQUEST['r'])) {
128
-            echo 'doRefresh(' . $_REQUEST['r'] . ");\n";
128
+            echo 'doRefresh('.$_REQUEST['r'].");\n";
129 129
         }
130 130
         ?>
131 131
     </script>
Please login to merge, or discard this patch.
manager/includes/document.parser.class.inc.php 1 patch
Spacing   +269 added lines, -269 removed lines patch added patch discarded remove patch
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
      */
226 226
     function __call($method_name, $arguments)
227 227
     {
228
-        include_once(MODX_MANAGER_PATH . 'includes/extenders/deprecated.functions.inc.php');
228
+        include_once(MODX_MANAGER_PATH.'includes/extenders/deprecated.functions.inc.php');
229 229
         if (method_exists($this->old, $method_name)) {
230 230
             $error_type = 1;
231 231
         } else {
@@ -243,12 +243,12 @@  discard block
 block discarded – undo
243 243
             $info = debug_backtrace();
244 244
             $m[] = $msg;
245 245
             if (!empty($this->currentSnippet)) {
246
-                $m[] = 'Snippet - ' . $this->currentSnippet;
246
+                $m[] = 'Snippet - '.$this->currentSnippet;
247 247
             } elseif (!empty($this->event->activePlugin)) {
248
-                $m[] = 'Plugin - ' . $this->event->activePlugin;
248
+                $m[] = 'Plugin - '.$this->event->activePlugin;
249 249
             }
250 250
             $m[] = $this->decoded_request_uri;
251
-            $m[] = str_replace('\\', '/', $info[0]['file']) . '(line:' . $info[0]['line'] . ')';
251
+            $m[] = str_replace('\\', '/', $info[0]['file']).'(line:'.$info[0]['line'].')';
252 252
             $msg = implode('<br />', $m);
253 253
             $this->logEvent(0, $error_type, $msg, $title);
254 254
         }
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
     {
266 266
         $flag = false;
267 267
         if (is_scalar($connector) && !empty($connector) && isset($this->{$connector}) && $this->{$connector} instanceof DBAPI) {
268
-            $flag = (bool)$this->{$connector}->conn;
268
+            $flag = (bool) $this->{$connector}->conn;
269 269
         }
270 270
         return $flag;
271 271
     }
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
         }
293 293
         if (!$out && $flag) {
294 294
             $extname = trim(str_replace(array('..', '/', '\\'), '', strtolower($extname)));
295
-            $filename = MODX_MANAGER_PATH . "includes/extenders/ex_{$extname}.inc.php";
295
+            $filename = MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php";
296 296
             $out = is_file($filename) ? include $filename : false;
297 297
         }
298 298
         if ($out && !in_array($extname, $this->extensions)) {
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
     public function getMicroTime()
310 310
     {
311 311
         list ($usec, $sec) = explode(' ', microtime());
312
-        return ((float)$usec + (float)$sec);
312
+        return ((float) $usec + (float) $sec);
313 313
     }
314 314
 
315 315
     /**
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
             // append the redirect count string to the url
334 334
             $currentNumberOfRedirects = isset ($_REQUEST['err']) ? $_REQUEST['err'] : 0;
335 335
             if ($currentNumberOfRedirects > 3) {
336
-                $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>' . $url . '</i></p>');
336
+                $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>'.$url.'</i></p>');
337 337
             } else {
338 338
                 $currentNumberOfRedirects += 1;
339 339
                 if (strpos($url, "?") > 0) {
@@ -344,9 +344,9 @@  discard block
 block discarded – undo
344 344
             }
345 345
         }
346 346
         if ($type == 'REDIRECT_REFRESH') {
347
-            $header = 'Refresh: 0;URL=' . $url;
347
+            $header = 'Refresh: 0;URL='.$url;
348 348
         } elseif ($type == 'REDIRECT_META') {
349
-            $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=' . $url . '" />';
349
+            $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL='.$url.'" />';
350 350
             echo $header;
351 351
             exit;
352 352
         } elseif ($type == 'REDIRECT_HEADER' || empty ($type)) {
@@ -354,10 +354,10 @@  discard block
 block discarded – undo
354 354
             global $base_url, $site_url;
355 355
             if (substr($url, 0, strlen($base_url)) == $base_url) {
356 356
                 // append $site_url to make it work with Location:
357
-                $url = $site_url . substr($url, strlen($base_url));
357
+                $url = $site_url.substr($url, strlen($base_url));
358 358
             }
359 359
             if (strpos($url, "\n") === false) {
360
-                $header = 'Location: ' . $url;
360
+                $header = 'Location: '.$url;
361 361
             } else {
362 362
                 $this->messageQuit('No newline allowed in redirect url.');
363 363
             }
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
             header($responseCode);
367 367
         }
368 368
 
369
-        if(!empty($header)) {
369
+        if (!empty($header)) {
370 370
             header($header);
371 371
         }
372 372
 
@@ -471,8 +471,8 @@  discard block
 block discarded – undo
471 471
 
472 472
     private function recoverySiteCache()
473 473
     {
474
-        $site_cache_dir = MODX_BASE_PATH . $this->getCacheFolder();
475
-        $site_cache_path = $site_cache_dir . 'siteCache.idx.php';
474
+        $site_cache_dir = MODX_BASE_PATH.$this->getCacheFolder();
475
+        $site_cache_path = $site_cache_dir.'siteCache.idx.php';
476 476
 
477 477
         if (is_file($site_cache_path)) {
478 478
             include($site_cache_path);
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
             return;
482 482
         }
483 483
 
484
-        include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php');
484
+        include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php');
485 485
         $cache = new synccache();
486 486
         $cache->setCachepath($site_cache_dir);
487 487
         $cache->setReport(false);
@@ -533,8 +533,8 @@  discard block
 block discarded – undo
533 533
                 $this->invokeEvent("OnBeforeManagerPageInit");
534 534
             }
535 535
 
536
-            if (isset ($_SESSION[$usrType . 'UsrConfigSet'])) {
537
-                $usrSettings = &$_SESSION[$usrType . 'UsrConfigSet'];
536
+            if (isset ($_SESSION[$usrType.'UsrConfigSet'])) {
537
+                $usrSettings = &$_SESSION[$usrType.'UsrConfigSet'];
538 538
             } else {
539 539
                 if ($usrType == 'web') {
540 540
                     $from = $tbl_web_user_settings;
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
                     $usrSettings[$row['setting_name']] = $row['setting_value'];
555 555
                 }
556 556
                 if (isset ($usrType)) {
557
-                    $_SESSION[$usrType . 'UsrConfigSet'] = $usrSettings;
557
+                    $_SESSION[$usrType.'UsrConfigSet'] = $usrSettings;
558 558
                 } // store user settings in session
559 559
             }
560 560
         }
@@ -699,10 +699,10 @@  discard block
 block discarded – undo
699 699
         $suf = $this->config['friendly_url_suffix'];
700 700
         $pre = preg_quote($pre, '/');
701 701
         $suf = preg_quote($suf, '/');
702
-        if ($pre && preg_match('@^' . $pre . '(.*)$@', $q, $_)) {
702
+        if ($pre && preg_match('@^'.$pre.'(.*)$@', $q, $_)) {
703 703
             $q = $_[1];
704 704
         }
705
-        if ($suf && preg_match('@(.*)' . $suf . '$@', $q, $_)) {
705
+        if ($suf && preg_match('@(.*)'.$suf.'$@', $q, $_)) {
706 706
             $q = $_[1];
707 707
         }
708 708
 
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
         if (preg_match('@^[1-9][0-9]*$@', $q) && !isset($this->documentListing[$q])) { /* we got an ID returned, check to make sure it's not an alias */
725 725
             /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */
726 726
             if ($this->config['use_alias_path'] == 1) {
727
-                if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir . '/' . $q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q, $this->getChildIds($this->documentListing[$this->virtualDir], 1))) || ($this->virtualDir == '' && in_array($q, $this->getChildIds(0, 1))))) {
727
+                if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir.'/'.$q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q, $this->getChildIds($this->documentListing[$this->virtualDir], 1))) || ($this->virtualDir == '' && in_array($q, $this->getChildIds(0, 1))))) {
728 728
                     $this->documentMethod = 'id';
729 729
                     return $q;
730 730
                 } else { /* not a valid id in terms of virtualDir, treat as alias */
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
      */
759 759
     public function getHashFile($key)
760 760
     {
761
-        return $this->getCacheFolder() . "docid_" . $key . ".pageCache.php";
761
+        return $this->getCacheFolder()."docid_".$key.".pageCache.php";
762 762
     }
763 763
 
764 764
     /**
@@ -769,9 +769,9 @@  discard block
 block discarded – undo
769 769
         $hash = $id;
770 770
         $tmp = null;
771 771
         $params = array();
772
-        if(!empty($this->systemCacheKey)){
772
+        if (!empty($this->systemCacheKey)) {
773 773
             $hash = $this->systemCacheKey;
774
-        }else {
774
+        } else {
775 775
             if (!empty($_GET)) {
776 776
                 // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID.
777 777
                 $params = $_GET;
@@ -779,8 +779,8 @@  discard block
 block discarded – undo
779 779
                 $hash .= '_'.md5(http_build_query($params));
780 780
             }
781 781
         }
782
-        $evtOut = $this->invokeEvent("OnMakePageCacheKey", array ("hash" => $hash, "id" => $id, 'params' => $params));
783
-        if (is_array($evtOut) && count($evtOut) > 0){
782
+        $evtOut = $this->invokeEvent("OnMakePageCacheKey", array("hash" => $hash, "id" => $id, 'params' => $params));
783
+        if (is_array($evtOut) && count($evtOut) > 0) {
784 784
             $tmp = array_pop($evtOut);
785 785
         }
786 786
         return empty($tmp) ? $hash : $tmp;
@@ -922,12 +922,12 @@  discard block
 block discarded – undo
922 922
         if ($js = $this->getRegisteredClientStartupScripts()) {
923 923
             // change to just before closing </head>
924 924
             // $this->documentContent = preg_replace("/(<head[^>]*>)/i", "\\1\n".$js, $this->documentContent);
925
-            $this->documentOutput = preg_replace("/(<\/head>)/i", $js . "\n\\1", $this->documentOutput);
925
+            $this->documentOutput = preg_replace("/(<\/head>)/i", $js."\n\\1", $this->documentOutput);
926 926
         }
927 927
 
928 928
         // Insert jscripts & html block into template - template must have a </body> tag
929 929
         if ($js = $this->getRegisteredClientScripts()) {
930
-            $this->documentOutput = preg_replace("/(<\/body>)/i", $js . "\n\\1", $this->documentOutput);
930
+            $this->documentOutput = preg_replace("/(<\/body>)/i", $js."\n\\1", $this->documentOutput);
931 931
         }
932 932
         // End fix by sirlancelot
933 933
 
@@ -938,7 +938,7 @@  discard block
 block discarded – undo
938 938
         // send out content-type and content-disposition headers
939 939
         if (IN_PARSER_MODE == "true") {
940 940
             $type = !empty ($this->contentTypes[$this->documentIdentifier]) ? $this->contentTypes[$this->documentIdentifier] : "text/html";
941
-            header('Content-Type: ' . $type . '; charset=' . $this->config['modx_charset']);
941
+            header('Content-Type: '.$type.'; charset='.$this->config['modx_charset']);
942 942
             //            if (($this->documentIdentifier == $this->config['error_page']) || $redirect_error)
943 943
             //                header('HTTP/1.0 404 Not Found');
944 944
             if (!$this->checkPreview() && $this->documentObject['content_dispo'] == 1) {
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
                     $name = preg_replace('|-+|', '-', $name);
957 957
                     $name = trim($name, '-');
958 958
                 }
959
-                $header = 'Content-Disposition: attachment; filename=' . $name;
959
+                $header = 'Content-Disposition: attachment; filename='.$name;
960 960
                 header($header);
961 961
             }
962 962
         }
@@ -964,7 +964,7 @@  discard block
 block discarded – undo
964 964
 
965 965
         $stats = $this->getTimerStats($this->tstart);
966 966
 
967
-        $out =& $this->documentOutput;
967
+        $out = & $this->documentOutput;
968 968
         $out = str_replace("[^q^]", $stats['queries'], $out);
969 969
         $out = str_replace("[^qt^]", $stats['queryTime'], $out);
970 970
         $out = str_replace("[^p^]", $stats['phpTime'], $out);
@@ -1003,17 +1003,17 @@  discard block
 block discarded – undo
1003 1003
                 $sc .= sprintf("%s. %s (%s)<br>", $s, $sname, sprintf("%2.2f ms", $t)); // currentSnippet
1004 1004
                 $tt += $t;
1005 1005
             }
1006
-            echo "<fieldset><legend><b>Snippets</b> (" . count($this->snippetsTime) . " / " . sprintf("%2.2f ms", $tt) . ")</legend>{$sc}</fieldset><br />";
1006
+            echo "<fieldset><legend><b>Snippets</b> (".count($this->snippetsTime)." / ".sprintf("%2.2f ms", $tt).")</legend>{$sc}</fieldset><br />";
1007 1007
             echo $this->snippetsCode;
1008 1008
         }
1009 1009
         if ($this->dumpPlugins) {
1010 1010
             $ps = "";
1011 1011
             $tt = 0;
1012 1012
             foreach ($this->pluginsTime as $s => $t) {
1013
-                $ps .= "$s (" . sprintf("%2.2f ms", $t * 1000) . ")<br>";
1013
+                $ps .= "$s (".sprintf("%2.2f ms", $t * 1000).")<br>";
1014 1014
                 $tt += $t;
1015 1015
             }
1016
-            echo "<fieldset><legend><b>Plugins</b> (" . count($this->pluginsTime) . " / " . sprintf("%2.2f ms", $tt * 1000) . ")</legend>{$ps}</fieldset><br />";
1016
+            echo "<fieldset><legend><b>Plugins</b> (".count($this->pluginsTime)." / ".sprintf("%2.2f ms", $tt * 1000).")</legend>{$ps}</fieldset><br />";
1017 1017
             echo $this->pluginsCode;
1018 1018
         }
1019 1019
 
@@ -1039,7 +1039,7 @@  discard block
 block discarded – undo
1039 1039
         $srcTags = explode(',', $tags);
1040 1040
         $repTags = array();
1041 1041
         foreach ($srcTags as $tag) {
1042
-            $repTags[] = '\\' . $tag[0] . '\\' . $tag[1];
1042
+            $repTags[] = '\\'.$tag[0].'\\'.$tag[1];
1043 1043
         }
1044 1044
         return array($srcTags, $repTags);
1045 1045
     }
@@ -1061,7 +1061,7 @@  discard block
 block discarded – undo
1061 1061
         $stats['phpTime'] = sprintf("%2.4f s", $stats['phpTime']);
1062 1062
         $stats['source'] = $this->documentGenerated == 1 ? "database" : "cache";
1063 1063
         $stats['queries'] = isset ($this->executedQueries) ? $this->executedQueries : 0;
1064
-        $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024) . " mb";
1064
+        $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024)." mb";
1065 1065
 
1066 1066
         return $stats;
1067 1067
     }
@@ -1094,7 +1094,7 @@  discard block
 block discarded – undo
1094 1094
     {
1095 1095
         $cacheRefreshTime = 0;
1096 1096
         $recent_update = 0;
1097
-        @include(MODX_BASE_PATH . $this->getCacheFolder() . 'sitePublishing.idx.php');
1097
+        @include(MODX_BASE_PATH.$this->getCacheFolder().'sitePublishing.idx.php');
1098 1098
         $this->recentUpdate = $recent_update;
1099 1099
 
1100 1100
         $timeNow = $_SERVER['REQUEST_TIME'] + $this->config['server_offset_time'];
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
         // now, check for documents that need publishing
1106 1106
         $field = array('published' => 1, 'publishedon' => $timeNow);
1107 1107
         $where = "pub_date <= {$timeNow} AND pub_date!=0 AND published=0";
1108
-        $result_pub = $this->db->select( 'id', '[+prefix+]site_content',  $where);
1108
+        $result_pub = $this->db->select('id', '[+prefix+]site_content', $where);
1109 1109
         $this->db->update($field, '[+prefix+]site_content', $where);
1110 1110
         if ($this->db->getRecordCount($result_pub) >= 1) { //Event unPublished doc
1111 1111
             while ($row_pub = $this->db->getRow($result_pub)) {
@@ -1118,7 +1118,7 @@  discard block
 block discarded – undo
1118 1118
         // now, check for documents that need un-publishing
1119 1119
         $field = array('published' => 0, 'publishedon' => 0);
1120 1120
         $where = "unpub_date <= {$timeNow} AND unpub_date!=0 AND published=1";
1121
-        $result_unpub = $this->db->select( 'id', '[+prefix+]site_content',  $where);
1121
+        $result_unpub = $this->db->select('id', '[+prefix+]site_content', $where);
1122 1122
         $this->db->update($field, '[+prefix+]site_content', $where);
1123 1123
         if ($this->db->getRecordCount($result_unpub) >= 1) { //Event unPublished doc
1124 1124
             while ($row_unpub = $this->db->getRow($result_unpub)) {
@@ -1164,8 +1164,8 @@  discard block
 block discarded – undo
1164 1164
                 }
1165 1165
 
1166 1166
                 $docObjSerial = serialize($this->documentObject);
1167
-                $cacheContent = $docObjSerial . "<!--__MODxCacheSpliter__-->" . $this->documentContent;
1168
-                $page_cache_path = MODX_BASE_PATH . $this->getHashFile($this->cacheKey);
1167
+                $cacheContent = $docObjSerial."<!--__MODxCacheSpliter__-->".$this->documentContent;
1168
+                $page_cache_path = MODX_BASE_PATH.$this->getHashFile($this->cacheKey);
1169 1169
                 file_put_contents($page_cache_path, "<?php die('Unauthorized access.'); ?>$cacheContent");
1170 1170
             }
1171 1171
         }
@@ -1207,16 +1207,16 @@  discard block
 block discarded – undo
1207 1207
             return array();
1208 1208
         }
1209 1209
         $spacer = md5('<<<EVO>>>');
1210
-        if($left==='{{' && strpos($content,';}}')!==false)  $content = str_replace(';}}', sprintf(';}%s}',   $spacer),$content);
1211
-        if($left==='{{' && strpos($content,'{{}}')!==false) $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content);
1212
-        if($left==='[[' && strpos($content,']]]]')!==false) $content = str_replace(']]]]',sprintf(']]%s]]',  $spacer),$content);
1213
-        if($left==='[[' && strpos($content,']]]')!==false)  $content = str_replace(']]]', sprintf(']%s]]',   $spacer),$content);
1210
+        if ($left === '{{' && strpos($content, ';}}') !== false)  $content = str_replace(';}}', sprintf(';}%s}', $spacer), $content);
1211
+        if ($left === '{{' && strpos($content, '{{}}') !== false) $content = str_replace('{{}}', sprintf('{%$1s{}%$1s}', $spacer), $content);
1212
+        if ($left === '[[' && strpos($content, ']]]]') !== false) $content = str_replace(']]]]', sprintf(']]%s]]', $spacer), $content);
1213
+        if ($left === '[[' && strpos($content, ']]]') !== false)  $content = str_replace(']]]', sprintf(']%s]]', $spacer), $content);
1214 1214
 
1215 1215
         $pos['<![CDATA['] = strpos($content, '<![CDATA[');
1216 1216
         $pos[']]>'] = strpos($content, ']]>');
1217 1217
 
1218 1218
         if ($pos['<![CDATA['] !== false && $pos[']]>'] !== false) {
1219
-            $content = substr($content, 0, $pos['<![CDATA[']) . substr($content, $pos[']]>'] + 3);
1219
+            $content = substr($content, 0, $pos['<![CDATA[']).substr($content, $pos[']]>'] + 3);
1220 1220
         }
1221 1221
 
1222 1222
         $lp = explode($left, $content);
@@ -1280,8 +1280,8 @@  discard block
 block discarded – undo
1280 1280
                 }
1281 1281
             }
1282 1282
         }
1283
-        foreach($tags as $i=>$tag) {
1284
-            if(strpos($tag,$spacer)!==false) $tags[$i] = str_replace($spacer, '', $tag);
1283
+        foreach ($tags as $i=>$tag) {
1284
+            if (strpos($tag, $spacer) !== false) $tags[$i] = str_replace($spacer, '', $tag);
1285 1285
         }
1286 1286
         return $tags;
1287 1287
     }
@@ -1321,7 +1321,7 @@  discard block
 block discarded – undo
1321 1321
         }
1322 1322
 
1323 1323
         foreach ($matches[1] as $i => $key) {
1324
-            if(strpos($key,'[+')!==false) continue; // Allow chunk {{chunk?&param=`xxx`}} with [*tv_name_[+param+]*] as content
1324
+            if (strpos($key, '[+') !== false) continue; // Allow chunk {{chunk?&param=`xxx`}} with [*tv_name_[+param+]*] as content
1325 1325
             if (substr($key, 0, 1) == '#') {
1326 1326
                 $key = substr($key, 1);
1327 1327
             } // remove # for QuickEdit format
@@ -1341,8 +1341,8 @@  discard block
 block discarded – undo
1341 1341
             }
1342 1342
 
1343 1343
             if (is_array($value)) {
1344
-                include_once(MODX_MANAGER_PATH . 'includes/tmplvars.format.inc.php');
1345
-                include_once(MODX_MANAGER_PATH . 'includes/tmplvars.commands.inc.php');
1344
+                include_once(MODX_MANAGER_PATH.'includes/tmplvars.format.inc.php');
1345
+                include_once(MODX_MANAGER_PATH.'includes/tmplvars.commands.inc.php');
1346 1346
                 $value = getTVDisplayFormat($value[0], $value[1], $value[2], $value[3], $value[4]);
1347 1347
             }
1348 1348
 
@@ -1353,8 +1353,8 @@  discard block
 block discarded – undo
1353 1353
 
1354 1354
             if (strpos($content, $s) !== false) {
1355 1355
                 $content = str_replace($s, $value, $content);
1356
-            } elseif($this->debug) {
1357
-                $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1356
+            } elseif ($this->debug) {
1357
+                $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1358 1358
             }
1359 1359
         }
1360 1360
 
@@ -1521,8 +1521,8 @@  discard block
 block discarded – undo
1521 1521
             $s = &$matches[0][$i];
1522 1522
             if (strpos($content, $s) !== false) {
1523 1523
                 $content = str_replace($s, $value, $content);
1524
-            } elseif($this->debug) {
1525
-                $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1524
+            } elseif ($this->debug) {
1525
+                $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1526 1526
             }
1527 1527
         }
1528 1528
         return $content;
@@ -1575,7 +1575,7 @@  discard block
 block discarded – undo
1575 1575
             }
1576 1576
 
1577 1577
             $value = $this->parseText($value, $params); // parse local scope placeholers for ConditionalTags
1578
-            $value = $this->mergePlaceholderContent($value, $params);  // parse page global placeholers
1578
+            $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers
1579 1579
             if ($this->config['enable_at_syntax']) {
1580 1580
                 $value = $this->mergeConditionalTagsContent($value);
1581 1581
             }
@@ -1590,8 +1590,8 @@  discard block
 block discarded – undo
1590 1590
             $s = &$matches[0][$i];
1591 1591
             if (strpos($content, $s) !== false) {
1592 1592
                 $content = str_replace($s, $value, $content);
1593
-            } elseif($this->debug) {
1594
-                $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1593
+            } elseif ($this->debug) {
1594
+                $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1595 1595
             }
1596 1596
         }
1597 1597
         return $content;
@@ -1649,8 +1649,8 @@  discard block
 block discarded – undo
1649 1649
             $s = &$matches[0][$i];
1650 1650
             if (strpos($content, $s) !== false) {
1651 1651
                 $content = str_replace($s, $value, $content);
1652
-            } elseif($this->debug) {
1653
-                $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1652
+            } elseif ($this->debug) {
1653
+                $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1654 1654
             }
1655 1655
         }
1656 1656
         return $content;
@@ -1674,7 +1674,7 @@  discard block
 block discarded – undo
1674 1674
             return $content;
1675 1675
         }
1676 1676
 
1677
-        $sp = '#' . md5('ConditionalTags' . $_SERVER['REQUEST_TIME']) . '#';
1677
+        $sp = '#'.md5('ConditionalTags'.$_SERVER['REQUEST_TIME']).'#';
1678 1678
         $content = str_replace(array('<?php', '<?=', '<?', '?>'), array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), $content);
1679 1679
 
1680 1680
         $pieces = explode('<@IF:', $content);
@@ -1685,7 +1685,7 @@  discard block
 block discarded – undo
1685 1685
             }
1686 1686
             list($cmd, $text) = explode('>', $split, 2);
1687 1687
             $cmd = str_replace("'", "\'", $cmd);
1688
-            $content .= "<?php if(\$this->_parseCTagCMD('" . $cmd . "')): ?>";
1688
+            $content .= "<?php if(\$this->_parseCTagCMD('".$cmd."')): ?>";
1689 1689
             $content .= $text;
1690 1690
         }
1691 1691
         $pieces = explode('<@ELSEIF:', $content);
@@ -1696,13 +1696,13 @@  discard block
 block discarded – undo
1696 1696
             }
1697 1697
             list($cmd, $text) = explode('>', $split, 2);
1698 1698
             $cmd = str_replace("'", "\'", $cmd);
1699
-            $content .= "<?php elseif(\$this->_parseCTagCMD('" . $cmd . "')): ?>";
1699
+            $content .= "<?php elseif(\$this->_parseCTagCMD('".$cmd."')): ?>";
1700 1700
             $content .= $text;
1701 1701
         }
1702 1702
 
1703 1703
         $content = str_replace(array('<@ELSE>', '<@ENDIF>'), array('<?php else:?>', '<?php endif;?>'), $content);
1704 1704
         ob_start();
1705
-        $content = eval('?>' . $content);
1705
+        $content = eval('?>'.$content);
1706 1706
         $content = ob_get_clean();
1707 1707
         $content = str_replace(array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), array('<?php', '<?=', '<?', '?>'), $content);
1708 1708
 
@@ -1827,7 +1827,7 @@  discard block
 block discarded – undo
1827 1827
         $matches = $this->getTagsFromContent($content, $left, $right);
1828 1828
         if (!empty($matches)) {
1829 1829
             foreach ($matches[0] as $i => $v) {
1830
-                $addBreakMatches[$i] = $v . "\n";
1830
+                $addBreakMatches[$i] = $v."\n";
1831 1831
             }
1832 1832
             $content = str_replace($addBreakMatches, '', $content);
1833 1833
             if (strpos($content, $left) !== false) {
@@ -1860,8 +1860,8 @@  discard block
 block discarded – undo
1860 1860
             $s = &$matches[0][$i];
1861 1861
             if (strpos($content, $s) !== false) {
1862 1862
                 $content = str_replace($s, $v, $content);
1863
-            } elseif($this->debug) {
1864
-                $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1863
+            } elseif ($this->debug) {
1864
+                $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1865 1865
             }
1866 1866
         }
1867 1867
         return $content;
@@ -1925,7 +1925,7 @@  discard block
 block discarded – undo
1925 1925
                 $msg = ($msg === false) ? 'ob_get_contents() error' : $msg;
1926 1926
                 $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Plugin', $error_info['message'], $error_info['line'], $msg);
1927 1927
                 if ($this->isBackend()) {
1928
-                    $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>' . $msg . '</p>');
1928
+                    $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>'.$msg.'</p>');
1929 1929
                 }
1930 1930
             }
1931 1931
         } else {
@@ -1971,7 +1971,7 @@  discard block
 block discarded – undo
1971 1971
                 $echo = ($echo === false) ? 'ob_get_contents() error' : $echo;
1972 1972
                 $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Snippet', $error_info['message'], $error_info['line'], $echo);
1973 1973
                 if ($this->isBackend()) {
1974
-                    $this->event->alert('An error occurred while loading. Please see the event log for more information<p>' . $echo . $return . '</p>');
1974
+                    $this->event->alert('An error occurred while loading. Please see the event log for more information<p>'.$echo.$return.'</p>');
1975 1975
                 }
1976 1976
             }
1977 1977
         }
@@ -1979,7 +1979,7 @@  discard block
 block discarded – undo
1979 1979
         if (is_array($return) || is_object($return)) {
1980 1980
             return $return;
1981 1981
         } else {
1982
-            return $echo . $return;
1982
+            return $echo.$return;
1983 1983
         }
1984 1984
     }
1985 1985
 
@@ -2017,8 +2017,8 @@  discard block
 block discarded – undo
2017 2017
                 }
2018 2018
                 if (strpos($content, $s) !== false) {
2019 2019
                     $content = str_replace($s, $value, $content);
2020
-                } elseif($this->debug) {
2021
-                    $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'] . $s, 2);
2020
+                } elseif ($this->debug) {
2021
+                    $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'].$s, 2);
2022 2022
                 }
2023 2023
                 continue;
2024 2024
             }
@@ -2029,8 +2029,8 @@  discard block
 block discarded – undo
2029 2029
 
2030 2030
             if (strpos($content, $s) !== false) {
2031 2031
                 $content = str_replace($s, $value, $content);
2032
-            } elseif($this->debug) {
2033
-                $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'] . $s, 2);
2032
+            } elseif ($this->debug) {
2033
+                $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'].$s, 2);
2034 2034
             }
2035 2035
         }
2036 2036
 
@@ -2121,7 +2121,7 @@  discard block
 block discarded – undo
2121 2121
             $eventtime = sprintf('%2.2f ms', $eventtime * 1000);
2122 2122
             $code = str_replace("\t", '  ', $this->htmlspecialchars($value));
2123 2123
             $piece = str_replace("\t", '  ', $this->htmlspecialchars($piece));
2124
-            $print_r_params = str_replace("\t", '  ', $this->htmlspecialchars('$modx->event->params = ' . print_r($params, true)));
2124
+            $print_r_params = str_replace("\t", '  ', $this->htmlspecialchars('$modx->event->params = '.print_r($params, true)));
2125 2125
             $this->snippetsCode .= sprintf('<fieldset style="margin:1em;"><legend><b>%s</b>(%s)</legend><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">[[%s]]</pre><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">%s</pre><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">%s</pre></fieldset>', $snippetObject['name'], $eventtime, $piece, $print_r_params, $code);
2126 2126
             $this->snippetsTime[] = array('sname' => $key, 'time' => $eventtime);
2127 2127
         }
@@ -2366,7 +2366,7 @@  discard block
 block discarded – undo
2366 2366
             $rs = $this->db->select('name,snippet,properties', '[+prefix+]site_snippets', $where);
2367 2367
             $count = $this->db->getRecordCount($rs);
2368 2368
             if (1 < $count) {
2369
-                exit('Error $modx->_getSnippetObject()' . $snip_name);
2369
+                exit('Error $modx->_getSnippetObject()'.$snip_name);
2370 2370
             }
2371 2371
             if ($count) {
2372 2372
                 $row = $this->db->getRow($rs);
@@ -2392,7 +2392,7 @@  discard block
 block discarded – undo
2392 2392
     public function toAlias($text)
2393 2393
     {
2394 2394
         $suff = $this->config['friendly_url_suffix'];
2395
-        return str_replace(array('.xml' . $suff, '.rss' . $suff, '.js' . $suff, '.css' . $suff, '.txt' . $suff, '.json' . $suff, '.pdf' . $suff), array('.xml', '.rss', '.js', '.css', '.txt', '.json', '.pdf'), $text);
2395
+        return str_replace(array('.xml'.$suff, '.rss'.$suff, '.js'.$suff, '.css'.$suff, '.txt'.$suff, '.json'.$suff, '.pdf'.$suff), array('.xml', '.rss', '.js', '.css', '.txt', '.json', '.pdf'), $text);
2396 2396
     }
2397 2397
 
2398 2398
     /**
@@ -2424,7 +2424,7 @@  discard block
 block discarded – undo
2424 2424
                 $suff = '/';
2425 2425
             }
2426 2426
 
2427
-            $url = ($dir != '' ? $dir . '/' : '') . $pre . $alias . $suff;
2427
+            $url = ($dir != '' ? $dir.'/' : '').$pre.$alias.$suff;
2428 2428
         }
2429 2429
 
2430 2430
         $evtOut = $this->invokeEvent('OnMakeDocUrl', array(
@@ -2461,7 +2461,7 @@  discard block
 block discarded – undo
2461 2461
                 preg_match_all('!\[\~([0-9]+)\~\]!ise', $documentSource, $match);
2462 2462
                 $ids = implode(',', array_unique($match['1']));
2463 2463
                 if ($ids) {
2464
-                    $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (" . $ids . ") AND isfolder = '0'");
2464
+                    $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (".$ids.") AND isfolder = '0'");
2465 2465
                     while ($row = $this->db->getRow($res)) {
2466 2466
                         if ($this->config['use_alias_path'] == '1' && $row['parent'] != 0) {
2467 2467
                             $parent = $row['parent'];
@@ -2472,7 +2472,7 @@  discard block
 block discarded – undo
2472 2472
                                 $parent = $this->aliasListing[$parent]['parent'];
2473 2473
                             }
2474 2474
 
2475
-                            $aliases[$row['id']] = $path . '/' . $row['alias'];
2475
+                            $aliases[$row['id']] = $path.'/'.$row['alias'];
2476 2476
                         } else {
2477 2477
                             $aliases[$row['id']] = $row['alias'];
2478 2478
                         }
@@ -2484,7 +2484,7 @@  discard block
 block discarded – undo
2484 2484
             $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0);
2485 2485
             $pref = $this->config['friendly_url_prefix'];
2486 2486
             $suff = $this->config['friendly_url_suffix'];
2487
-            $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) {
2487
+            $documentSource = preg_replace_callback($in, function($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) {
2488 2488
                 global $modx;
2489 2489
                 $thealias = $aliases[$m[1]];
2490 2490
                 $thefolder = $isfolder[$m[1]];
@@ -2500,7 +2500,7 @@  discard block
 block discarded – undo
2500 2500
 
2501 2501
         } else {
2502 2502
             $in = '!\[\~([0-9]+)\~\]!is';
2503
-            $out = "index.php?id=" . '\1';
2503
+            $out = "index.php?id=".'\1';
2504 2504
             $documentSource = preg_replace($in, $out, $documentSource);
2505 2505
         }
2506 2506
 
@@ -2521,7 +2521,7 @@  discard block
 block discarded – undo
2521 2521
         $scheme = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
2522 2522
         $len_base_url = strlen($this->config['base_url']);
2523 2523
 
2524
-        $url_path = $q;//LANG
2524
+        $url_path = $q; //LANG
2525 2525
 
2526 2526
         if (substr($url_path, 0, $len_base_url) === $this->config['base_url']) {
2527 2527
             $url_path = substr($url_path, $len_base_url);
@@ -2533,7 +2533,7 @@  discard block
 block discarded – undo
2533 2533
             $strictURL = substr($strictURL, $len_base_url);
2534 2534
         }
2535 2535
         $http_host = $_SERVER['HTTP_HOST'];
2536
-        $requestedURL = "{$scheme}://{$http_host}" . '/' . $q; //LANG
2536
+        $requestedURL = "{$scheme}://{$http_host}".'/'.$q; //LANG
2537 2537
 
2538 2538
         $site_url = $this->config['site_url'];
2539 2539
         $url_query_string = explode('?', $_SERVER['REQUEST_URI']);
@@ -2551,7 +2551,7 @@  discard block
 block discarded – undo
2551 2551
                 }
2552 2552
                 if ($this->config['base_url'] != $_SERVER['REQUEST_URI']) {
2553 2553
                     if (empty($_POST)) {
2554
-                        if (($this->config['base_url'] . '?' . $qstring) != $_SERVER['REQUEST_URI']) {
2554
+                        if (($this->config['base_url'].'?'.$qstring) != $_SERVER['REQUEST_URI']) {
2555 2555
                             $this->sendRedirect($url, 0, 'REDIRECT_HEADER', 'HTTP/1.0 301 Moved Permanently');
2556 2556
                             exit(0);
2557 2557
                         }
@@ -2610,7 +2610,7 @@  discard block
 block discarded – undo
2610 2610
                 $docgrp = implode(",", $docgrp);
2611 2611
             }
2612 2612
             // get document
2613
-            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
2613
+            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
2614 2614
             $rs = $this->db->select('sc.*', "{$tblsc} sc
2615 2615
                 LEFT JOIN {$tbldg} dg ON dg.document = sc.id", "sc.{$method} = '{$identifier}' AND ({$access})", "", 1);
2616 2616
             if ($this->db->getRecordCount($rs) < 1) {
@@ -2646,9 +2646,9 @@  discard block
 block discarded – undo
2646 2646
             }
2647 2647
             if ($documentObject['template']) {
2648 2648
                 // load TVs and merge with document - Orig by Apodigm - Docvars
2649
-                $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars") . " tv
2650
-                INNER JOIN " . $this->getFullTableName("site_tmplvar_templates") . " tvtpl ON tvtpl.tmplvarid = tv.id
2651
-                LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues") . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'");
2649
+                $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars")." tv
2650
+                INNER JOIN " . $this->getFullTableName("site_tmplvar_templates")." tvtpl ON tvtpl.tmplvarid = tv.id
2651
+                LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues")." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'");
2652 2652
                 $tmplvars = array();
2653 2653
                 while ($row = $this->db->getRow($rs)) {
2654 2654
                     $tmplvars[$row['name']] = array(
@@ -2694,7 +2694,7 @@  discard block
 block discarded – undo
2694 2694
                 $st = md5($source);
2695 2695
             }
2696 2696
             if ($this->dumpSnippets == 1) {
2697
-                $this->snippetsCode .= "<fieldset><legend><b style='color: #821517;'>PARSE PASS " . ($i + 1) . "</b></legend><p>The following snippets (if any) were parsed during this pass.</p>";
2697
+                $this->snippetsCode .= "<fieldset><legend><b style='color: #821517;'>PARSE PASS ".($i + 1)."</b></legend><p>The following snippets (if any) were parsed during this pass.</p>";
2698 2698
             }
2699 2699
 
2700 2700
             // invoke OnParseDocument event
@@ -2736,7 +2736,7 @@  discard block
 block discarded – undo
2736 2736
      */
2737 2737
     public function executeParser()
2738 2738
     {
2739
-        if(MODX_CLI) {
2739
+        if (MODX_CLI) {
2740 2740
             throw new RuntimeException('Call DocumentParser::executeParser on CLI mode');
2741 2741
         }
2742 2742
 
@@ -2782,7 +2782,7 @@  discard block
 block discarded – undo
2782 2782
 
2783 2783
             // Check use_alias_path and check if $this->virtualDir is set to anything, then parse the path
2784 2784
             if ($this->config['use_alias_path'] == 1) {
2785
-                $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir . '/' : '') . $this->documentIdentifier;
2785
+                $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir.'/' : '').$this->documentIdentifier;
2786 2786
                 if (isset($this->documentListing[$alias])) {
2787 2787
                     $this->documentIdentifier = $this->documentListing[$alias];
2788 2788
                 } else {
@@ -2843,7 +2843,7 @@  discard block
 block discarded – undo
2843 2843
                 } else {
2844 2844
                     $docAlias = $this->db->escape($this->documentIdentifier);
2845 2845
                     $rs = $this->db->select('id', $this->getFullTableName('site_content'), "deleted=0 and alias='{$docAlias}'");
2846
-                    $this->documentIdentifier = (int)$this->db->getValue($rs);
2846
+                    $this->documentIdentifier = (int) $this->db->getValue($rs);
2847 2847
                 }
2848 2848
             }
2849 2849
             $this->documentMethod = 'id';
@@ -2900,7 +2900,7 @@  discard block
 block discarded – undo
2900 2900
                 $_REQUEST[$n] = $_GET[$n] = $v;
2901 2901
             }
2902 2902
         }
2903
-        $_SERVER['PHP_SELF'] = $this->config['base_url'] . $qp['path'];
2903
+        $_SERVER['PHP_SELF'] = $this->config['base_url'].$qp['path'];
2904 2904
         $this->q = $qp['path'];
2905 2905
         return $qp['path'];
2906 2906
     }
@@ -2994,7 +2994,7 @@  discard block
 block discarded – undo
2994 2994
             $this->sendErrorPage();
2995 2995
         } else {
2996 2996
             // Inculde the necessary files to check document permissions
2997
-            include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php');
2997
+            include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php');
2998 2998
             $udperms = new udperms();
2999 2999
             $udperms->user = $this->getLoginUserID();
3000 3000
             $udperms->document = $this->documentIdentifier;
@@ -3048,7 +3048,7 @@  discard block
 block discarded – undo
3048 3048
         while ($id && $height--) {
3049 3049
             $thisid = $id;
3050 3050
             if ($this->config['aliaslistingfolder'] == 1) {
3051
-                $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->db->getValue("SELECT `parent` FROM " . $this->getFullTableName("site_content") . " WHERE `id` = '{$id}' LIMIT 0,1");
3051
+                $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->db->getValue("SELECT `parent` FROM ".$this->getFullTableName("site_content")." WHERE `id` = '{$id}' LIMIT 0,1");
3052 3052
                 if (!$id || $id == '0') {
3053 3053
                     break;
3054 3054
                 }
@@ -3099,15 +3099,15 @@  discard block
 block discarded – undo
3099 3099
 
3100 3100
         if ($this->config['aliaslistingfolder'] == 1) {
3101 3101
 
3102
-            $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (" . $id . ") AND deleted = '0'");
3102
+            $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (".$id.") AND deleted = '0'");
3103 3103
             $idx = array();
3104 3104
             while ($row = $this->db->getRow($res)) {
3105 3105
                 $pAlias = '';
3106 3106
                 if (isset($this->aliasListing[$row['parent']])) {
3107
-                    $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'] . '/' : '';
3108
-                    $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'] . '/' : '';
3107
+                    $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'].'/' : '';
3108
+                    $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'].'/' : '';
3109 3109
                 };
3110
-                $children[$pAlias . $row['alias']] = $row['id'];
3110
+                $children[$pAlias.$row['alias']] = $row['id'];
3111 3111
                 if ($row['isfolder'] == 1) {
3112 3112
                     $idx[] = $row['id'];
3113 3113
                 }
@@ -3139,7 +3139,7 @@  discard block
 block discarded – undo
3139 3139
                 $depth--;
3140 3140
 
3141 3141
                 foreach ($documentMap_cache[$id] as $childId) {
3142
-                    $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '') . $this->aliasListing[$childId]['alias'];
3142
+                    $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '').$this->aliasListing[$childId]['alias'];
3143 3143
                     if (!strlen($pkey)) {
3144 3144
                         $pkey = "{$childId}";
3145 3145
                     }
@@ -3176,7 +3176,7 @@  discard block
 block discarded – undo
3176 3176
                 $fnc = 'history.back(-1);';
3177 3177
                 break;
3178 3178
             default:
3179
-                $fnc = "window.location.href='" . addslashes($url) . "';";
3179
+                $fnc = "window.location.href='".addslashes($url)."';";
3180 3180
         }
3181 3181
 
3182 3182
         echo "<html><head>
@@ -3208,9 +3208,9 @@  discard block
 block discarded – undo
3208 3208
         $state = 0;
3209 3209
         $pms = $_SESSION['mgrPermissions'];
3210 3210
         if ($pms) {
3211
-            $state = ((bool)$pms[$pm] === true);
3211
+            $state = ((bool) $pms[$pm] === true);
3212 3212
         }
3213
-        return (int)$state;
3213
+        return (int) $state;
3214 3214
     }
3215 3215
 
3216 3216
     /**
@@ -3223,8 +3223,8 @@  discard block
 block discarded – undo
3223 3223
      */
3224 3224
     public function elementIsLocked($type, $id, $includeThisUser = false)
3225 3225
     {
3226
-        $id = (int)$id;
3227
-        $type = (int)$type;
3226
+        $id = (int) $id;
3227
+        $type = (int) $type;
3228 3228
         if (!$type || !$id) {
3229 3229
             return null;
3230 3230
         }
@@ -3274,7 +3274,7 @@  discard block
 block discarded – undo
3274 3274
             return $lockedElements;
3275 3275
         }
3276 3276
 
3277
-        $type = (int)$type;
3277
+        $type = (int) $type;
3278 3278
         if (isset($lockedElements[$type])) {
3279 3279
             return $lockedElements[$type];
3280 3280
         } else {
@@ -3291,7 +3291,7 @@  discard block
 block discarded – undo
3291 3291
             $this->lockedElements = array();
3292 3292
             $this->cleanupExpiredLocks();
3293 3293
 
3294
-            $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks') . " ul
3294
+            $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks')." ul
3295 3295
                 LEFT JOIN {$this->getFullTableName('manager_users')} mu on ul.internalKey = mu.id");
3296 3296
             while ($row = $this->db->getRow($rs)) {
3297 3297
                 $this->lockedElements[$row['elementType']][$row['elementId']] = array(
@@ -3314,7 +3314,7 @@  discard block
 block discarded – undo
3314 3314
     public function cleanupExpiredLocks()
3315 3315
     {
3316 3316
         // Clean-up active_user_sessions first
3317
-        $timeout = (int)$this->config['session_timeout'] < 2 ? 120 : $this->config['session_timeout'] * 60; // session.js pings every 10min, updateMail() in mainMenu pings every minute, so 2min is minimum
3317
+        $timeout = (int) $this->config['session_timeout'] < 2 ? 120 : $this->config['session_timeout'] * 60; // session.js pings every 10min, updateMail() in mainMenu pings every minute, so 2min is minimum
3318 3318
         $validSessionTimeLimit = $this->time - $timeout;
3319 3319
         $this->db->delete($this->getFullTableName('active_user_sessions'), "lasthit < {$validSessionTimeLimit}");
3320 3320
 
@@ -3327,7 +3327,7 @@  discard block
 block discarded – undo
3327 3327
             foreach ($rs as $row) {
3328 3328
                 $userSids[] = $row['sid'];
3329 3329
             }
3330
-            $userSids = "'" . implode("','", $userSids) . "'";
3330
+            $userSids = "'".implode("','", $userSids)."'";
3331 3331
             $this->db->delete($this->getFullTableName('active_user_locks'), "sid NOT IN({$userSids})");
3332 3332
         } else {
3333 3333
             $this->db->delete($this->getFullTableName('active_user_locks'));
@@ -3411,8 +3411,8 @@  discard block
 block discarded – undo
3411 3411
     public function lockElement($type, $id)
3412 3412
     {
3413 3413
         $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0;
3414
-        $type = (int)$type;
3415
-        $id = (int)$id;
3414
+        $type = (int) $type;
3415
+        $id = (int) $id;
3416 3416
         if (!$type || !$id || !$userId) {
3417 3417
             return false;
3418 3418
         }
@@ -3433,8 +3433,8 @@  discard block
 block discarded – undo
3433 3433
     public function unlockElement($type, $id, $includeAllUsers = false)
3434 3434
     {
3435 3435
         $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0;
3436
-        $type = (int)$type;
3437
-        $id = (int)$id;
3436
+        $type = (int) $type;
3437
+        $id = (int) $id;
3438 3438
         if (!$type || !$id) {
3439 3439
             return false;
3440 3440
         }
@@ -3501,8 +3501,8 @@  discard block
 block discarded – undo
3501 3501
         }
3502 3502
 
3503 3503
         $usertype = $this->isFrontend() ? 1 : 0;
3504
-        $evtid = (int)$evtid;
3505
-        $type = (int)$type;
3504
+        $evtid = (int) $evtid;
3505
+        $type = (int) $type;
3506 3506
 
3507 3507
         // Types: 1 = information, 2 = warning, 3 = error
3508 3508
         if ($type < 1) {
@@ -3524,8 +3524,8 @@  discard block
 block discarded – undo
3524 3524
         if (isset($this->config['send_errormail']) && $this->config['send_errormail'] !== '0') {
3525 3525
             if ($this->config['send_errormail'] <= $type) {
3526 3526
                 $this->sendmail(array(
3527
-                    'subject' => 'MODX System Error on ' . $this->config['site_name'],
3528
-                    'body' => 'Source: ' . $source . ' - The details of the error could be seen in the MODX system events log.',
3527
+                    'subject' => 'MODX System Error on '.$this->config['site_name'],
3528
+                    'body' => 'Source: '.$source.' - The details of the error could be seen in the MODX system events log.',
3529 3529
                     'type' => 'text'
3530 3530
                 ));
3531 3531
             }
@@ -3573,7 +3573,7 @@  discard block
 block discarded – undo
3573 3573
             $p['fromname'] = $userinfo['username'];
3574 3574
         }
3575 3575
         if ($msg === '' && !isset($p['body'])) {
3576
-            $p['body'] = $_SERVER['REQUEST_URI'] . "\n" . $_SERVER['HTTP_USER_AGENT'] . "\n" . $_SERVER['HTTP_REFERER'];
3576
+            $p['body'] = $_SERVER['REQUEST_URI']."\n".$_SERVER['HTTP_USER_AGENT']."\n".$_SERVER['HTTP_REFERER'];
3577 3577
         } elseif (is_string($msg) && 0 < strlen($msg)) {
3578 3578
             $p['body'] = $msg;
3579 3579
         }
@@ -3613,8 +3613,8 @@  discard block
 block discarded – undo
3613 3613
             $files = array();
3614 3614
         }
3615 3615
         foreach ($files as $f) {
3616
-            if (file_exists(MODX_BASE_PATH . $f) && is_file(MODX_BASE_PATH . $f) && is_readable(MODX_BASE_PATH . $f)) {
3617
-                $this->mail->AddAttachment(MODX_BASE_PATH . $f);
3616
+            if (file_exists(MODX_BASE_PATH.$f) && is_file(MODX_BASE_PATH.$f) && is_readable(MODX_BASE_PATH.$f)) {
3617
+                $this->mail->AddAttachment(MODX_BASE_PATH.$f);
3618 3618
             }
3619 3619
         }
3620 3620
         $rs = $this->mail->send();
@@ -3659,7 +3659,7 @@  discard block
 block discarded – undo
3659 3659
      */
3660 3660
     public function isFrontend()
3661 3661
     {
3662
-        return ! $this->isBackend();
3662
+        return !$this->isBackend();
3663 3663
     }
3664 3664
 
3665 3665
     /**
@@ -3684,14 +3684,14 @@  discard block
 block discarded – undo
3684 3684
         $tblsc = $this->getFullTableName("site_content");
3685 3685
         $tbldg = $this->getFullTableName("document_groups");
3686 3686
         // modify field names to use sc. table reference
3687
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3688
-        $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3687
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3688
+        $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3689 3689
         // get document groups for current user
3690 3690
         if ($docgrp = $this->getUserDocGroups()) {
3691 3691
             $docgrp = implode(",", $docgrp);
3692 3692
         }
3693 3693
         // build query
3694
-        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3694
+        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3695 3695
         $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3696 3696
                 LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}");
3697 3697
         $resourceArray = $this->db->makeArray($result);
@@ -3721,14 +3721,14 @@  discard block
 block discarded – undo
3721 3721
         $tbldg = $this->getFullTableName("document_groups");
3722 3722
 
3723 3723
         // modify field names to use sc. table reference
3724
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3725
-        $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3724
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3725
+        $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3726 3726
         // get document groups for current user
3727 3727
         if ($docgrp = $this->getUserDocGroups()) {
3728 3728
             $docgrp = implode(",", $docgrp);
3729 3729
         }
3730 3730
         // build query
3731
-        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3731
+        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3732 3732
         $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3733 3733
                 LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND sc.published=1 AND sc.deleted=0 AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}");
3734 3734
         $resourceArray = $this->db->makeArray($result);
@@ -3763,16 +3763,16 @@  discard block
 block discarded – undo
3763 3763
             return $this->tmpCache[__FUNCTION__][$cacheKey];
3764 3764
         }
3765 3765
 
3766
-        $published = ($published !== 'all') ? 'AND sc.published = ' . $published : '';
3767
-        $deleted = ($deleted !== 'all') ? 'AND sc.deleted = ' . $deleted : '';
3766
+        $published = ($published !== 'all') ? 'AND sc.published = '.$published : '';
3767
+        $deleted = ($deleted !== 'all') ? 'AND sc.deleted = '.$deleted : '';
3768 3768
 
3769 3769
         if ($where != '') {
3770
-            $where = 'AND ' . $where;
3770
+            $where = 'AND '.$where;
3771 3771
         }
3772 3772
 
3773 3773
         // modify field names to use sc. table reference
3774
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3775
-        $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3774
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3775
+        $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3776 3776
 
3777 3777
         // get document groups for current user
3778 3778
         if ($docgrp = $this->getUserDocGroups()) {
@@ -3780,7 +3780,7 @@  discard block
 block discarded – undo
3780 3780
         }
3781 3781
 
3782 3782
         // build query
3783
-        $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')');
3783
+        $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')');
3784 3784
 
3785 3785
         $tblsc = $this->getFullTableName('site_content');
3786 3786
         $tbldg = $this->getFullTableName('document_groups');
@@ -3832,10 +3832,10 @@  discard block
 block discarded – undo
3832 3832
             return false;
3833 3833
         } else {
3834 3834
             // modify field names to use sc. table reference
3835
-            $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3836
-            $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3835
+            $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3836
+            $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3837 3837
             if ($where != '') {
3838
-                $where = 'AND ' . $where;
3838
+                $where = 'AND '.$where;
3839 3839
             }
3840 3840
 
3841 3841
             $published = ($published !== 'all') ? "AND sc.published = '{$published}'" : '';
@@ -3846,13 +3846,13 @@  discard block
 block discarded – undo
3846 3846
                 $docgrp = implode(',', $docgrp);
3847 3847
             }
3848 3848
 
3849
-            $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')');
3849
+            $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')');
3850 3850
 
3851 3851
             $tblsc = $this->getFullTableName('site_content');
3852 3852
             $tbldg = $this->getFullTableName('document_groups');
3853 3853
 
3854 3854
             $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3855
-                    LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (" . implode(',', $ids) . ") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id", ($sort ? "{$sort} {$dir}" : ""), $limit);
3855
+                    LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (".implode(',', $ids).") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id", ($sort ? "{$sort} {$dir}" : ""), $limit);
3856 3856
 
3857 3857
             $resourceArray = $this->db->makeArray($result);
3858 3858
 
@@ -3957,12 +3957,12 @@  discard block
 block discarded – undo
3957 3957
             $tbldg = $this->getFullTableName("document_groups");
3958 3958
             $activeSql = $active == 1 ? "AND sc.published=1 AND sc.deleted=0" : "";
3959 3959
             // modify field names to use sc. table reference
3960
-            $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3960
+            $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3961 3961
             // get document groups for current user
3962 3962
             if ($docgrp = $this->getUserDocGroups()) {
3963 3963
                 $docgrp = implode(",", $docgrp);
3964 3964
             }
3965
-            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3965
+            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3966 3966
             $result = $this->db->select($fields, "{$tblsc} sc LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id='{$pageid}' {$activeSql}) AND ({$access})", "", 1);
3967 3967
             $pageInfo = $this->db->getRow($result);
3968 3968
 
@@ -4009,7 +4009,7 @@  discard block
 block discarded – undo
4009 4009
     {
4010 4010
         if ($this->currentSnippet) {
4011 4011
             $tbl = $this->getFullTableName("site_snippets");
4012
-            $rs = $this->db->select('id', $tbl, "name='" . $this->db->escape($this->currentSnippet) . "'", '', 1);
4012
+            $rs = $this->db->select('id', $tbl, "name='".$this->db->escape($this->currentSnippet)."'", '', 1);
4013 4013
             if ($snippetId = $this->db->getValue($rs)) {
4014 4014
                 return $snippetId;
4015 4015
             }
@@ -4036,23 +4036,23 @@  discard block
 block discarded – undo
4036 4036
      */
4037 4037
     public function clearCache($type = '', $report = false)
4038 4038
     {
4039
-        $cache_dir = MODX_BASE_PATH . $this->getCacheFolder();
4039
+        $cache_dir = MODX_BASE_PATH.$this->getCacheFolder();
4040 4040
         if (is_array($type)) {
4041 4041
             foreach ($type as $_) {
4042 4042
                 $this->clearCache($_, $report);
4043 4043
             }
4044 4044
         } elseif ($type == 'full') {
4045
-            include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php');
4045
+            include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php');
4046 4046
             $sync = new synccache();
4047 4047
             $sync->setCachepath($cache_dir);
4048 4048
             $sync->setReport($report);
4049 4049
             $sync->emptyCache();
4050 4050
         } elseif (preg_match('@^[1-9][0-9]*$@', $type)) {
4051 4051
             $key = ($this->config['cache_type'] == 2) ? $this->makePageCacheKey($type) : $type;
4052
-            $file_name = "docid_" . $key . "_*.pageCache.php";
4053
-            $cache_path = $cache_dir . $file_name;
4052
+            $file_name = "docid_".$key."_*.pageCache.php";
4053
+            $cache_path = $cache_dir.$file_name;
4054 4054
             $files = glob($cache_path);
4055
-            $files[] = $cache_dir . "docid_" . $key . ".pageCache.php";
4055
+            $files[] = $cache_dir."docid_".$key.".pageCache.php";
4056 4056
             foreach ($files as $file) {
4057 4057
                 if (!is_file($file)) {
4058 4058
                     continue;
@@ -4060,7 +4060,7 @@  discard block
 block discarded – undo
4060 4060
                 unlink($file);
4061 4061
             }
4062 4062
         } else {
4063
-            $files = glob($cache_dir . '*');
4063
+            $files = glob($cache_dir.'*');
4064 4064
             foreach ($files as $file) {
4065 4065
                 $name = basename($file);
4066 4066
                 if (strpos($name, '.pageCache.php') === false) {
@@ -4129,7 +4129,7 @@  discard block
 block discarded – undo
4129 4129
                         $f_url_suffix = '/';
4130 4130
                     }
4131 4131
 
4132
-                    $alPath = !empty ($al['path']) ? $al['path'] . '/' : '';
4132
+                    $alPath = !empty ($al['path']) ? $al['path'].'/' : '';
4133 4133
 
4134 4134
                     if ($al && $al['alias']) {
4135 4135
                         $alias = $al['alias'];
@@ -4137,7 +4137,7 @@  discard block
 block discarded – undo
4137 4137
 
4138 4138
                 }
4139 4139
 
4140
-                $alias = $alPath . $f_url_prefix . $alias . $f_url_suffix;
4140
+                $alias = $alPath.$f_url_prefix.$alias.$f_url_suffix;
4141 4141
                 $url = "{$alias}{$args}";
4142 4142
             } else {
4143 4143
                 $url = "index.php?id={$id}{$args}";
@@ -4156,7 +4156,7 @@  discard block
 block discarded – undo
4156 4156
             }
4157 4157
 
4158 4158
             //TODO: check to make sure that $site_url incudes the url :port (e.g. :8080)
4159
-            $host = $scheme == 'full' ? $this->config['site_url'] : $scheme . '://' . $_SERVER['HTTP_HOST'] . $host;
4159
+            $host = $scheme == 'full' ? $this->config['site_url'] : $scheme.'://'.$_SERVER['HTTP_HOST'].$host;
4160 4160
         }
4161 4161
 
4162 4162
         //fix strictUrl by Bumkaka
@@ -4165,9 +4165,9 @@  discard block
 block discarded – undo
4165 4165
         }
4166 4166
 
4167 4167
         if ($this->config['xhtml_urls']) {
4168
-            $url = preg_replace("/&(?!amp;)/", "&amp;", $host . $virtualDir . $url);
4168
+            $url = preg_replace("/&(?!amp;)/", "&amp;", $host.$virtualDir.$url);
4169 4169
         } else {
4170
-            $url = $host . $virtualDir . $url;
4170
+            $url = $host.$virtualDir.$url;
4171 4171
         }
4172 4172
 
4173 4173
         $evtOut = $this->invokeEvent('OnMakeDocUrl', array(
@@ -4191,21 +4191,21 @@  discard block
 block discarded – undo
4191 4191
         if (isset($this->aliasListing[$id])) {
4192 4192
             $out = $this->aliasListing[$id];
4193 4193
         } else {
4194
-            $q = $this->db->query("SELECT id,alias,isfolder,parent FROM " . $this->getFullTableName("site_content") . " WHERE id=" . (int)$id);
4194
+            $q = $this->db->query("SELECT id,alias,isfolder,parent FROM ".$this->getFullTableName("site_content")." WHERE id=".(int) $id);
4195 4195
             if ($this->db->getRecordCount($q) == '1') {
4196 4196
                 $q = $this->db->getRow($q);
4197 4197
                 $this->aliasListing[$id] = array(
4198
-                    'id' => (int)$q['id'],
4198
+                    'id' => (int) $q['id'],
4199 4199
                     'alias' => $q['alias'] == '' ? $q['id'] : $q['alias'],
4200
-                    'parent' => (int)$q['parent'],
4201
-                    'isfolder' => (int)$q['isfolder'],
4200
+                    'parent' => (int) $q['parent'],
4201
+                    'isfolder' => (int) $q['isfolder'],
4202 4202
                 );
4203 4203
                 if ($this->aliasListing[$id]['parent'] > 0) {
4204 4204
                     //fix alias_path_usage
4205 4205
                     if ($this->config['use_alias_path'] == '1') {
4206 4206
                         //&& $tmp['path'] != '' - fix error slash with epty path
4207 4207
                         $tmp = $this->getAliasListing($this->aliasListing[$id]['parent']);
4208
-                        $this->aliasListing[$id]['path'] = $tmp['path'] . ($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '') . $tmp['alias'] : '');
4208
+                        $this->aliasListing[$id]['path'] = $tmp['path'].($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '').$tmp['alias'] : '');
4209 4209
                     } else {
4210 4210
                         $this->aliasListing[$id]['path'] = '';
4211 4211
                     }
@@ -4246,7 +4246,7 @@  discard block
 block discarded – undo
4246 4246
         $out = array();
4247 4247
         if (empty($this->version) || !is_array($this->version)) {
4248 4248
             //include for compatibility modx version < 1.0.10
4249
-            include MODX_MANAGER_PATH . "includes/version.inc.php";
4249
+            include MODX_MANAGER_PATH."includes/version.inc.php";
4250 4250
             $this->version = array();
4251 4251
             $this->version['version'] = isset($modx_version) ? $modx_version : '';
4252 4252
             $this->version['branch'] = isset($modx_branch) ? $modx_branch : '';
@@ -4268,18 +4268,18 @@  discard block
 block discarded – undo
4268 4268
     {
4269 4269
         if (isset ($this->snippetCache[$snippetName])) {
4270 4270
             $snippet = $this->snippetCache[$snippetName];
4271
-            $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : '';
4271
+            $properties = !empty($this->snippetCache[$snippetName."Props"]) ? $this->snippetCache[$snippetName."Props"] : '';
4272 4272
         } else { // not in cache so let's check the db
4273
-            $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM " . $this->getFullTableName("site_snippets") . " as ss LEFT JOIN " . $this->getFullTableName('site_modules') . " as sm on sm.guid=ss.moduleguid WHERE ss.`name`='" . $this->db->escape($snippetName) . "'  AND ss.disabled=0;";
4273
+            $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM ".$this->getFullTableName("site_snippets")." as ss LEFT JOIN ".$this->getFullTableName('site_modules')." as sm on sm.guid=ss.moduleguid WHERE ss.`name`='".$this->db->escape($snippetName)."'  AND ss.disabled=0;";
4274 4274
             $result = $this->db->query($sql);
4275 4275
             if ($this->db->getRecordCount($result) == 1) {
4276 4276
                 $row = $this->db->getRow($result);
4277 4277
                 $snippet = $this->snippetCache[$snippetName] = $row['snippet'];
4278 4278
                 $mergedProperties = array_merge($this->parseProperties($row['properties']), $this->parseProperties($row['sharedproperties']));
4279
-                $properties = $this->snippetCache[$snippetName . "Props"] = json_encode($mergedProperties);
4279
+                $properties = $this->snippetCache[$snippetName."Props"] = json_encode($mergedProperties);
4280 4280
             } else {
4281 4281
                 $snippet = $this->snippetCache[$snippetName] = "return false;";
4282
-                $properties = $this->snippetCache[$snippetName . "Props"] = '';
4282
+                $properties = $this->snippetCache[$snippetName."Props"] = '';
4283 4283
             }
4284 4284
         }
4285 4285
         // load default params/properties
@@ -4379,8 +4379,8 @@  discard block
 block discarded – undo
4379 4379
             }
4380 4380
             if (strpos($tpl, $s) !== false) {
4381 4381
                 $tpl = str_replace($s, $value, $tpl);
4382
-            } elseif($this->debug) {
4383
-                $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'] . $s, 2);
4382
+            } elseif ($this->debug) {
4383
+                $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'].$s, 2);
4384 4384
             }
4385 4385
         }
4386 4386
 
@@ -4429,7 +4429,7 @@  discard block
 block discarded – undo
4429 4429
             case 'CODE':
4430 4430
                 break;
4431 4431
             case 'FILE':
4432
-                $template = file_get_contents(MODX_BASE_PATH . $template);
4432
+                $template = file_get_contents(MODX_BASE_PATH.$template);
4433 4433
                 break;
4434 4434
             case 'CHUNK':
4435 4435
                 $template = $this->getChunk($template);
@@ -4462,7 +4462,7 @@  discard block
 block discarded – undo
4462 4462
         if ($mode !== 'formatOnly' && empty($timestamp)) {
4463 4463
             return '-';
4464 4464
         }
4465
-        $timestamp = (int)$timestamp;
4465
+        $timestamp = (int) $timestamp;
4466 4466
 
4467 4467
         switch ($this->config['datetime_format']) {
4468 4468
             case 'YYYY/mm/dd':
@@ -4482,7 +4482,7 @@  discard block
 block discarded – undo
4482 4482
         }
4483 4483
 
4484 4484
         if (empty($mode)) {
4485
-            $strTime = strftime($dateFormat . " %H:%M:%S", $timestamp);
4485
+            $strTime = strftime($dateFormat." %H:%M:%S", $timestamp);
4486 4486
         } elseif ($mode == 'dateOnly') {
4487 4487
             $strTime = strftime($dateFormat, $timestamp);
4488 4488
         } elseif ($mode == 'formatOnly') {
@@ -4536,7 +4536,7 @@  discard block
 block discarded – undo
4536 4536
             $S = 0;
4537 4537
         }
4538 4538
         $timeStamp = mktime($H, $M, $S, $m, $d, $Y);
4539
-        $timeStamp = (int)$timeStamp;
4539
+        $timeStamp = (int) $timeStamp;
4540 4540
         return $timeStamp;
4541 4541
     }
4542 4542
 
@@ -4578,7 +4578,7 @@  discard block
 block discarded – undo
4578 4578
                     if ($v === 'value') {
4579 4579
                         unset($_[$i]);
4580 4580
                     } else {
4581
-                        $_[$i] = 'tv.' . $v;
4581
+                        $_[$i] = 'tv.'.$v;
4582 4582
                     }
4583 4583
                 }
4584 4584
                 $fields = implode(',', $_);
@@ -4587,12 +4587,12 @@  discard block
 block discarded – undo
4587 4587
             }
4588 4588
 
4589 4589
             if ($tvsort != '') {
4590
-                $tvsort = 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort))));
4590
+                $tvsort = 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort))));
4591 4591
             }
4592 4592
             if ($tvidnames == "*") {
4593 4593
                 $query = "tv.id<>0";
4594 4594
             } else {
4595
-                $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name") . " IN ('" . implode("','", $tvidnames) . "')";
4595
+                $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name")." IN ('".implode("','", $tvidnames)."')";
4596 4596
             }
4597 4597
 
4598 4598
             $this->getUserDocGroups();
@@ -4736,7 +4736,7 @@  discard block
 block discarded – undo
4736 4736
             return $this->tmpCache[__FUNCTION__][$cacheKey];
4737 4737
         }
4738 4738
 
4739
-        if (($idnames != '*' && !is_array($idnames)) || empty($idnames) ) {
4739
+        if (($idnames != '*' && !is_array($idnames)) || empty($idnames)) {
4740 4740
             return false;
4741 4741
         } else {
4742 4742
 
@@ -4754,23 +4754,23 @@  discard block
 block discarded – undo
4754 4754
             }
4755 4755
 
4756 4756
             // get user defined template variables
4757
-            $fields = ($fields == '') ? 'tv.*' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $fields))));
4758
-            $sort = ($sort == '') ? '' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $sort))));
4757
+            $fields = ($fields == '') ? 'tv.*' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $fields))));
4758
+            $sort = ($sort == '') ? '' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $sort))));
4759 4759
 
4760 4760
             if ($idnames == '*') {
4761 4761
                 $query = 'tv.id<>0';
4762 4762
             } else {
4763
-                $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name') . " IN ('" . implode("','", $idnames) . "')";
4763
+                $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name')." IN ('".implode("','", $idnames)."')";
4764 4764
             }
4765 4765
 
4766
-            $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars') . " tv
4767
-                    INNER JOIN " . $this->getFullTableName('site_tmplvar_templates') . " tvtpl ON tvtpl.tmplvarid = tv.id
4768
-                    LEFT JOIN " . $this->getFullTableName('site_tmplvar_contentvalues') . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'", "{$query} AND tvtpl.templateid = '{$docRow['template']}'", ($sort ? "{$sort} {$dir}" : ""));
4766
+            $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars')." tv
4767
+                    INNER JOIN " . $this->getFullTableName('site_tmplvar_templates')." tvtpl ON tvtpl.tmplvarid = tv.id
4768
+                    LEFT JOIN " . $this->getFullTableName('site_tmplvar_contentvalues')." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'", "{$query} AND tvtpl.templateid = '{$docRow['template']}'", ($sort ? "{$sort} {$dir}" : ""));
4769 4769
 
4770 4770
             $result = $this->db->makeArray($rs);
4771 4771
 
4772 4772
             // get default/built-in template variables
4773
-            if(is_array($docRow)){
4773
+            if (is_array($docRow)) {
4774 4774
                 ksort($docRow);
4775 4775
 
4776 4776
                 foreach ($docRow as $key => $value) {
@@ -4808,22 +4808,22 @@  discard block
 block discarded – undo
4808 4808
      */
4809 4809
     public function getTemplateVarOutput($idnames = array(), $docid = '', $published = 1, $sep = '')
4810 4810
     {
4811
-        if (is_array($idnames) && empty($idnames) ) {
4811
+        if (is_array($idnames) && empty($idnames)) {
4812 4812
             return false;
4813 4813
         } else {
4814 4814
             $output = array();
4815 4815
             $vars = ($idnames == '*' || is_array($idnames)) ? $idnames : array($idnames);
4816 4816
 
4817
-            $docid = (int)$docid > 0 ? (int)$docid : $this->documentIdentifier;
4817
+            $docid = (int) $docid > 0 ? (int) $docid : $this->documentIdentifier;
4818 4818
             // remove sort for speed
4819 4819
             $result = $this->getTemplateVars($vars, '*', $docid, $published, '', '');
4820 4820
 
4821 4821
             if ($result == false) {
4822 4822
                 return false;
4823 4823
             } else {
4824
-                $baspath = MODX_MANAGER_PATH . 'includes';
4825
-                include_once $baspath . '/tmplvars.format.inc.php';
4826
-                include_once $baspath . '/tmplvars.commands.inc.php';
4824
+                $baspath = MODX_MANAGER_PATH.'includes';
4825
+                include_once $baspath.'/tmplvars.format.inc.php';
4826
+                include_once $baspath.'/tmplvars.commands.inc.php';
4827 4827
 
4828 4828
                 for ($i = 0; $i < count($result); $i++) {
4829 4829
                     $row = $result[$i];
@@ -4848,7 +4848,7 @@  discard block
 block discarded – undo
4848 4848
      */
4849 4849
     public function getFullTableName($tbl)
4850 4850
     {
4851
-        return $this->db->config['dbase'] . ".`" . $this->db->config['table_prefix'] . $tbl . "`";
4851
+        return $this->db->config['dbase'].".`".$this->db->config['table_prefix'].$tbl."`";
4852 4852
     }
4853 4853
 
4854 4854
     /**
@@ -4927,7 +4927,7 @@  discard block
 block discarded – undo
4927 4927
     public function getCachePath()
4928 4928
     {
4929 4929
         global $base_url;
4930
-        $pth = $base_url . $this->getCacheFolder();
4930
+        $pth = $base_url.$this->getCacheFolder();
4931 4931
         return $pth;
4932 4932
     }
4933 4933
 
@@ -4979,8 +4979,8 @@  discard block
 block discarded – undo
4979 4979
         $out = false;
4980 4980
 
4981 4981
         if (!empty($context)) {
4982
-            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
4983
-                $out = $_SESSION[$context . 'InternalKey'];
4982
+            if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) {
4983
+                $out = $_SESSION[$context.'InternalKey'];
4984 4984
             }
4985 4985
         } else {
4986 4986
             switch (true) {
@@ -5008,8 +5008,8 @@  discard block
 block discarded – undo
5008 5008
         $out = false;
5009 5009
 
5010 5010
         if (!empty($context)) {
5011
-            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
5012
-                $out = $_SESSION[$context . 'Shortname'];
5011
+            if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) {
5012
+                $out = $_SESSION[$context.'Shortname'];
5013 5013
             }
5014 5014
         } else {
5015 5015
             switch (true) {
@@ -5080,8 +5080,8 @@  discard block
 block discarded – undo
5080 5080
      */
5081 5081
     public function getWebUserInfo($uid)
5082 5082
     {
5083
-        $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users") . " wu
5084
-                INNER JOIN " . $this->getFullTableName("web_user_attributes") . " wua ON wua.internalkey=wu.id", "wu.id='{$uid}'");
5083
+        $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users")." wu
5084
+                INNER JOIN " . $this->getFullTableName("web_user_attributes")." wua ON wua.internalkey=wu.id", "wu.id='{$uid}'");
5085 5085
         if ($row = $this->db->getRow($rs)) {
5086 5086
             if (!isset($row['usertype']) or !$row["usertype"]) {
5087 5087
                 $row["usertype"] = "web";
@@ -5117,7 +5117,7 @@  discard block
 block discarded – undo
5117 5117
         } else if (is_array($dg)) {
5118 5118
             // resolve ids to names
5119 5119
             $dgn = array();
5120
-            $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (" . implode(",", $dg) . ")");
5120
+            $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (".implode(",", $dg).")");
5121 5121
             while ($row = $this->db->getRow($ds)) {
5122 5122
                 $dgn[] = $row['name'];
5123 5123
             }
@@ -5145,7 +5145,7 @@  discard block
 block discarded – undo
5145 5145
         $rt = false;
5146 5146
         if ($_SESSION["webValidated"] == 1) {
5147 5147
             $tbl = $this->getFullTableName("web_users");
5148
-            $ds = $this->db->select('id, username, password', $tbl, "id='" . $this->getLoginUserID() . "'");
5148
+            $ds = $this->db->select('id, username, password', $tbl, "id='".$this->getLoginUserID()."'");
5149 5149
             if ($row = $this->db->getRow($ds)) {
5150 5150
                 if ($row["password"] == md5($oldPwd)) {
5151 5151
                     if (strlen($newPwd) < 6) {
@@ -5155,7 +5155,7 @@  discard block
 block discarded – undo
5155 5155
                     } else {
5156 5156
                         $this->db->update(array(
5157 5157
                             'password' => $this->db->escape($newPwd),
5158
-                        ), $tbl, "id='" . $this->getLoginUserID() . "'");
5158
+                        ), $tbl, "id='".$this->getLoginUserID()."'");
5159 5159
                         // invoke OnWebChangePassword event
5160 5160
                         $this->invokeEvent("OnWebChangePassword", array(
5161 5161
                             "userid" => $row["id"],
@@ -5186,8 +5186,8 @@  discard block
 block discarded – undo
5186 5186
         // check cache
5187 5187
         $grpNames = isset ($_SESSION['webUserGroupNames']) ? $_SESSION['webUserGroupNames'] : false;
5188 5188
         if (!is_array($grpNames)) {
5189
-            $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names") . " wgn
5190
-                    INNER JOIN " . $this->getFullTableName("web_groups") . " wg ON wg.webgroup=wgn.id AND wg.webuser='" . $this->getLoginUserID() . "'");
5189
+            $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names")." wgn
5190
+                    INNER JOIN " . $this->getFullTableName("web_groups")." wg ON wg.webgroup=wgn.id AND wg.webuser='".$this->getLoginUserID()."'");
5191 5191
             $grpNames = $this->db->getColumn("name", $rs);
5192 5192
             // save to cache
5193 5193
             $_SESSION['webUserGroupNames'] = $grpNames;
@@ -5220,7 +5220,7 @@  discard block
 block discarded – undo
5220 5220
         if (strpos(strtolower($src), "<style") !== false || strpos(strtolower($src), "<link") !== false) {
5221 5221
             $this->sjscripts[$nextpos] = $src;
5222 5222
         } else {
5223
-            $this->sjscripts[$nextpos] = "\t" . '<link rel="stylesheet" type="text/css" href="' . $src . '" ' . ($media ? 'media="' . $media . '" ' : '') . '/>';
5223
+            $this->sjscripts[$nextpos] = "\t".'<link rel="stylesheet" type="text/css" href="'.$src.'" '.($media ? 'media="'.$media.'" ' : '').'/>';
5224 5224
         }
5225 5225
     }
5226 5226
 
@@ -5299,7 +5299,7 @@  discard block
 block discarded – undo
5299 5299
         }
5300 5300
 
5301 5301
         if ($useThisVer && $plaintext != true && (strpos(strtolower($src), "<script") === false)) {
5302
-            $src = "\t" . '<script type="text/javascript" src="' . $src . '"></script>';
5302
+            $src = "\t".'<script type="text/javascript" src="'.$src.'"></script>';
5303 5303
         }
5304 5304
         if ($startup) {
5305 5305
             $pos = isset($overwritepos) ? $overwritepos : max(array_merge(array(0), array_keys($this->sjscripts))) + 1;
@@ -5446,7 +5446,7 @@  discard block
 block discarded – undo
5446 5446
                 $eventtime = $this->getMicroTime() - $eventtime;
5447 5447
                 $this->pluginsCode .= sprintf('<fieldset><legend><b>%s / %s</b> (%2.2f ms)</legend>', $evtName, $pluginName, $eventtime * 1000);
5448 5448
                 foreach ($parameter as $k => $v) {
5449
-                    $this->pluginsCode .= "{$k} => " . print_r($v, true) . '<br>';
5449
+                    $this->pluginsCode .= "{$k} => ".print_r($v, true).'<br>';
5450 5450
                 }
5451 5451
                 $this->pluginsCode .= '</fieldset><br />';
5452 5452
                 $this->pluginsTime["{$evtName} / {$pluginName}"] += $eventtime;
@@ -5474,13 +5474,13 @@  discard block
 block discarded – undo
5474 5474
         $plugin = array();
5475 5475
         if (isset ($this->pluginCache[$pluginName])) {
5476 5476
             $pluginCode = $this->pluginCache[$pluginName];
5477
-            $pluginProperties = isset($this->pluginCache[$pluginName . "Props"]) ? $this->pluginCache[$pluginName . "Props"] : '';
5477
+            $pluginProperties = isset($this->pluginCache[$pluginName."Props"]) ? $this->pluginCache[$pluginName."Props"] : '';
5478 5478
         } else {
5479 5479
             $pluginName = $this->db->escape($pluginName);
5480 5480
             $result = $this->db->select('name, plugincode, properties', $this->getFullTableName("site_plugins"), "name='{$pluginName}' AND disabled=0");
5481 5481
             if ($row = $this->db->getRow($result)) {
5482 5482
                 $pluginCode = $this->pluginCache[$row['name']] = $row['plugincode'];
5483
-                $pluginProperties = $this->pluginCache[$row['name'] . "Props"] = $row['properties'];
5483
+                $pluginProperties = $this->pluginCache[$row['name']."Props"] = $row['properties'];
5484 5484
             } else {
5485 5485
                 $pluginCode = $this->pluginCache[$pluginName] = "return false;";
5486 5486
                 $pluginProperties = '';
@@ -5583,7 +5583,7 @@  discard block
 block discarded – undo
5583 5583
     public function parseDocBlockFromFile($element_dir, $filename, $escapeValues = false)
5584 5584
     {
5585 5585
         $params = array();
5586
-        $fullpath = $element_dir . '/' . $filename;
5586
+        $fullpath = $element_dir.'/'.$filename;
5587 5587
         if (is_readable($fullpath)) {
5588 5588
             $tpl = @fopen($fullpath, "r");
5589 5589
             if ($tpl) {
@@ -5750,8 +5750,8 @@  discard block
 block discarded – undo
5750 5750
         $ph = array('site_url' => MODX_SITE_URL);
5751 5751
         $regexUrl = "/((http|https|ftp|ftps)\:\/\/[^\/]+(\/[^\s]+[^,.?!:;\s])?)/";
5752 5752
         $regexEmail = '#([0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-wyz][a-z](fo|g|l|m|mes|o|op|pa|ro|seum|t|u|v|z)?)#i';
5753
-        $emailSubject = isset($parsed['name']) ? '?subject=' . $parsed['name'] : '';
5754
-        $emailSubject .= isset($parsed['version']) ? ' v' . $parsed['version'] : '';
5753
+        $emailSubject = isset($parsed['name']) ? '?subject='.$parsed['name'] : '';
5754
+        $emailSubject .= isset($parsed['version']) ? ' v'.$parsed['version'] : '';
5755 5755
         foreach ($parsed as $key => $val) {
5756 5756
             if (is_array($val)) {
5757 5757
                 foreach ($val as $key2 => $val2) {
@@ -5760,7 +5760,7 @@  discard block
 block discarded – undo
5760 5760
                         $val2 = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val2);
5761 5761
                     }
5762 5762
                     if (preg_match($regexEmail, $val2, $url)) {
5763
-                        $val2 = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val2);
5763
+                        $val2 = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val2);
5764 5764
                     }
5765 5765
                     $parsed[$key][$key2] = $val2;
5766 5766
                 }
@@ -5770,7 +5770,7 @@  discard block
 block discarded – undo
5770 5770
                     $val = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val);
5771 5771
                 }
5772 5772
                 if (preg_match($regexEmail, $val, $url)) {
5773
-                    $val = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val);
5773
+                    $val = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val);
5774 5774
                 }
5775 5775
                 $parsed[$key] = $val;
5776 5776
             }
@@ -5784,32 +5784,32 @@  discard block
 block discarded – undo
5784 5784
         );
5785 5785
 
5786 5786
         $nl = "\n";
5787
-        $list = isset($parsed['logo']) ? '<img src="' . $this->config['base_url'] . ltrim($parsed['logo'], "/") . '" style="float:right;max-width:100px;height:auto;" />' . $nl : '';
5788
-        $list .= '<p>' . $nl;
5789
-        $list .= isset($parsed['name']) ? '<strong>' . $parsed['name'] . '</strong><br/>' . $nl : '';
5790
-        $list .= isset($parsed['description']) ? $parsed['description'] . $nl : '';
5791
-        $list .= '</p><br/>' . $nl;
5792
-        $list .= isset($parsed['version']) ? '<p><strong>' . $_lang['version'] . ':</strong> ' . $parsed['version'] . '</p>' . $nl : '';
5793
-        $list .= isset($parsed['license']) ? '<p><strong>' . $_lang['license'] . ':</strong> ' . $parsed['license'] . '</p>' . $nl : '';
5794
-        $list .= isset($parsed['lastupdate']) ? '<p><strong>' . $_lang['last_update'] . ':</strong> ' . $parsed['lastupdate'] . '</p>' . $nl : '';
5795
-        $list .= '<br/>' . $nl;
5787
+        $list = isset($parsed['logo']) ? '<img src="'.$this->config['base_url'].ltrim($parsed['logo'], "/").'" style="float:right;max-width:100px;height:auto;" />'.$nl : '';
5788
+        $list .= '<p>'.$nl;
5789
+        $list .= isset($parsed['name']) ? '<strong>'.$parsed['name'].'</strong><br/>'.$nl : '';
5790
+        $list .= isset($parsed['description']) ? $parsed['description'].$nl : '';
5791
+        $list .= '</p><br/>'.$nl;
5792
+        $list .= isset($parsed['version']) ? '<p><strong>'.$_lang['version'].':</strong> '.$parsed['version'].'</p>'.$nl : '';
5793
+        $list .= isset($parsed['license']) ? '<p><strong>'.$_lang['license'].':</strong> '.$parsed['license'].'</p>'.$nl : '';
5794
+        $list .= isset($parsed['lastupdate']) ? '<p><strong>'.$_lang['last_update'].':</strong> '.$parsed['lastupdate'].'</p>'.$nl : '';
5795
+        $list .= '<br/>'.$nl;
5796 5796
         $first = true;
5797 5797
         foreach ($arrayParams as $param => $label) {
5798 5798
             if (isset($parsed[$param])) {
5799 5799
                 if ($first) {
5800
-                    $list .= '<p><strong>' . $_lang['references'] . '</strong></p>' . $nl;
5801
-                    $list .= '<ul class="docBlockList">' . $nl;
5800
+                    $list .= '<p><strong>'.$_lang['references'].'</strong></p>'.$nl;
5801
+                    $list .= '<ul class="docBlockList">'.$nl;
5802 5802
                     $first = false;
5803 5803
                 }
5804
-                $list .= '    <li><strong>' . $label . '</strong>' . $nl;
5805
-                $list .= '        <ul>' . $nl;
5804
+                $list .= '    <li><strong>'.$label.'</strong>'.$nl;
5805
+                $list .= '        <ul>'.$nl;
5806 5806
                 foreach ($parsed[$param] as $val) {
5807
-                    $list .= '            <li>' . $val . '</li>' . $nl;
5807
+                    $list .= '            <li>'.$val.'</li>'.$nl;
5808 5808
                 }
5809
-                $list .= '        </ul></li>' . $nl;
5809
+                $list .= '        </ul></li>'.$nl;
5810 5810
             }
5811 5811
         }
5812
-        $list .= !$first ? '</ul>' . $nl : '';
5812
+        $list .= !$first ? '</ul>'.$nl : '';
5813 5813
 
5814 5814
         return $list;
5815 5815
     }
@@ -5885,7 +5885,7 @@  discard block
 block discarded – undo
5885 5885
      */
5886 5886
     public function addSnippet($name, $phpCode)
5887 5887
     {
5888
-        $this->snippetCache['#' . $name] = $phpCode;
5888
+        $this->snippetCache['#'.$name] = $phpCode;
5889 5889
     }
5890 5890
 
5891 5891
     /**
@@ -5894,7 +5894,7 @@  discard block
 block discarded – undo
5894 5894
      */
5895 5895
     public function addChunk($name, $text)
5896 5896
     {
5897
-        $this->chunkCache['#' . $name] = $text;
5897
+        $this->chunkCache['#'.$name] = $text;
5898 5898
     }
5899 5899
 
5900 5900
     /**
@@ -5930,7 +5930,7 @@  discard block
 block discarded – undo
5930 5930
         }
5931 5931
 
5932 5932
         if (!$isSafe) {
5933
-            $msg = $phpcode . "\n" . $this->currentSnippet . "\n" . print_r($_SERVER, true);
5933
+            $msg = $phpcode."\n".$this->currentSnippet."\n".print_r($_SERVER, true);
5934 5934
             $title = sprintf('Unknown eval was executed (%s)', $this->htmlspecialchars(substr(trim($phpcode), 0, 50)));
5935 5935
             $this->messageQuit($title, '', true, '', '', 'Parser', $msg);
5936 5936
             return;
@@ -5944,7 +5944,7 @@  discard block
 block discarded – undo
5944 5944
             return 'array()';
5945 5945
         }
5946 5946
 
5947
-        $output = $echo . $return;
5947
+        $output = $echo.$return;
5948 5948
         modx_sanitize_gpc($output);
5949 5949
         return $this->htmlspecialchars($output); // Maybe, all html tags are dangerous
5950 5950
     }
@@ -5962,8 +5962,8 @@  discard block
 block discarded – undo
5962 5962
 
5963 5963
         $safe = explode(',', $safe_functions);
5964 5964
 
5965
-        $phpcode = rtrim($phpcode, ';') . ';';
5966
-        $tokens = token_get_all('<?php ' . $phpcode);
5965
+        $phpcode = rtrim($phpcode, ';').';';
5966
+        $tokens = token_get_all('<?php '.$phpcode);
5967 5967
         foreach ($tokens as $i => $token) {
5968 5968
             if (!is_array($token)) {
5969 5969
                 continue;
@@ -5999,7 +5999,7 @@  discard block
 block discarded – undo
5999 5999
     public function atBindFileContent($str = '')
6000 6000
     {
6001 6001
 
6002
-        $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'] . 'files/', '');
6002
+        $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'].'files/', '');
6003 6003
 
6004 6004
         if (stripos($str, '@FILE') !== 0) {
6005 6005
             return $str;
@@ -6022,7 +6022,7 @@  discard block
 block discarded – undo
6022 6022
         $errorMsg = sprintf("Could not retrieve string '%s'.", $str);
6023 6023
 
6024 6024
         foreach ($search_path as $path) {
6025
-            $file_path = MODX_BASE_PATH . $path . $str;
6025
+            $file_path = MODX_BASE_PATH.$path.$str;
6026 6026
             if (strpos($file_path, MODX_MANAGER_PATH) === 0) {
6027 6027
                 return $errorMsg;
6028 6028
             } elseif (is_file($file_path)) {
@@ -6036,7 +6036,7 @@  discard block
 block discarded – undo
6036 6036
             return $errorMsg;
6037 6037
         }
6038 6038
 
6039
-        $content = (string)file_get_contents($file_path);
6039
+        $content = (string) file_get_contents($file_path);
6040 6040
         if ($content === false) {
6041 6041
             return $errorMsg;
6042 6042
         }
@@ -6149,22 +6149,22 @@  discard block
 block discarded – undo
6149 6149
 
6150 6150
         $version = isset ($GLOBALS['modx_version']) ? $GLOBALS['modx_version'] : '';
6151 6151
         $release_date = isset ($GLOBALS['release_date']) ? $GLOBALS['release_date'] : '';
6152
-        $request_uri = "http://" . $_SERVER['HTTP_HOST'] . ($_SERVER["SERVER_PORT"] == 80 ? "" : (":" . $_SERVER["SERVER_PORT"])) . $_SERVER['REQUEST_URI'];
6152
+        $request_uri = "http://".$_SERVER['HTTP_HOST'].($_SERVER["SERVER_PORT"] == 80 ? "" : (":".$_SERVER["SERVER_PORT"])).$_SERVER['REQUEST_URI'];
6153 6153
         $request_uri = $this->htmlspecialchars($request_uri, ENT_QUOTES, $this->config['modx_charset']);
6154 6154
         $ua = $this->htmlspecialchars($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, $this->config['modx_charset']);
6155 6155
         $referer = $this->htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_QUOTES, $this->config['modx_charset']);
6156 6156
         if ($is_error) {
6157 6157
             $str = '<h2 style="color:red">&laquo; Evo Parse Error &raquo;</h2>';
6158 6158
             if ($msg != 'PHP Parse Error') {
6159
-                $str .= '<h3 style="color:red">' . $msg . '</h3>';
6159
+                $str .= '<h3 style="color:red">'.$msg.'</h3>';
6160 6160
             }
6161 6161
         } else {
6162 6162
             $str = '<h2 style="color:#003399">&laquo; Evo Debug/ stop message &raquo;</h2>';
6163
-            $str .= '<h3 style="color:#003399">' . $msg . '</h3>';
6163
+            $str .= '<h3 style="color:#003399">'.$msg.'</h3>';
6164 6164
         }
6165 6165
 
6166 6166
         if (!empty ($query)) {
6167
-            $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">SQL &gt; <span id="sqlHolder">' . $query . '</span></div>';
6167
+            $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">SQL &gt; <span id="sqlHolder">'.$query.'</span></div>';
6168 6168
         }
6169 6169
 
6170 6170
         $errortype = array(
@@ -6187,13 +6187,13 @@  discard block
 block discarded – undo
6187 6187
 
6188 6188
         if (!empty($nr) || !empty($file)) {
6189 6189
             if ($text != '') {
6190
-                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : ' . $text . '</div>';
6190
+                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : '.$text.'</div>';
6191 6191
             }
6192 6192
             if ($output != '') {
6193
-                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">' . $output . '</div>';
6193
+                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">'.$output.'</div>';
6194 6194
             }
6195 6195
             if ($nr !== '') {
6196
-                $table[] = array('ErrorType[num]', $errortype [$nr] . "[" . $nr . "]");
6196
+                $table[] = array('ErrorType[num]', $errortype [$nr]."[".$nr."]");
6197 6197
             }
6198 6198
             if ($file) {
6199 6199
                 $table[] = array('File', $file);
@@ -6213,7 +6213,7 @@  discard block
 block discarded – undo
6213 6213
         }
6214 6214
 
6215 6215
         if (!empty($this->event->activePlugin)) {
6216
-            $table[] = array('Current Plugin', $this->event->activePlugin . '(' . $this->event->name . ')');
6216
+            $table[] = array('Current Plugin', $this->event->activePlugin.'('.$this->event->name.')');
6217 6217
         }
6218 6218
 
6219 6219
         $str .= $MakeTable->create($table, array('Error information', ''));
@@ -6223,17 +6223,17 @@  discard block
 block discarded – undo
6223 6223
         $table[] = array('REQUEST_URI', $request_uri);
6224 6224
 
6225 6225
         if ($this->manager->action) {
6226
-            include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
6226
+            include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php');
6227 6227
             global $action_list;
6228 6228
             $actionName = (isset($action_list[$this->manager->action])) ? " - {$action_list[$this->manager->action]}" : '';
6229 6229
 
6230
-            $table[] = array('Manager action', $this->manager->action . $actionName);
6230
+            $table[] = array('Manager action', $this->manager->action.$actionName);
6231 6231
         }
6232 6232
 
6233 6233
         if (preg_match('@^[0-9]+@', $this->documentIdentifier)) {
6234 6234
             $resource = $this->getDocumentObject('id', $this->documentIdentifier);
6235 6235
             $url = $this->makeUrl($this->documentIdentifier, '', '', 'full');
6236
-            $table[] = array('Resource', '[' . $this->documentIdentifier . '] <a href="' . $url . '" target="_blank">' . $resource['pagetitle'] . '</a>');
6236
+            $table[] = array('Resource', '['.$this->documentIdentifier.'] <a href="'.$url.'" target="_blank">'.$resource['pagetitle'].'</a>');
6237 6237
         }
6238 6238
         $table[] = array('Referer', $referer);
6239 6239
         $table[] = array('User Agent', $ua);
@@ -6254,7 +6254,7 @@  discard block
 block discarded – undo
6254 6254
 
6255 6255
         $mem = memory_get_peak_usage(true);
6256 6256
         $total_mem = $mem - $this->mstart;
6257
-        $total_mem = ($total_mem / 1024 / 1024) . ' mb';
6257
+        $total_mem = ($total_mem / 1024 / 1024).' mb';
6258 6258
 
6259 6259
         $queryTime = $this->queryTime;
6260 6260
         $phpTime = $totalTime - $queryTime;
@@ -6275,18 +6275,18 @@  discard block
 block discarded – undo
6275 6275
         $str .= $this->get_backtrace(debug_backtrace());
6276 6276
         // Log error
6277 6277
         if (!empty($this->currentSnippet)) {
6278
-            $source = 'Snippet - ' . $this->currentSnippet;
6278
+            $source = 'Snippet - '.$this->currentSnippet;
6279 6279
         } elseif (!empty($this->event->activePlugin)) {
6280
-            $source = 'Plugin - ' . $this->event->activePlugin;
6280
+            $source = 'Plugin - '.$this->event->activePlugin;
6281 6281
         } elseif ($source !== '') {
6282
-            $source = 'Parser - ' . $source;
6282
+            $source = 'Parser - '.$source;
6283 6283
         } elseif ($query !== '') {
6284 6284
             $source = 'SQL Query';
6285 6285
         } else {
6286 6286
             $source = 'Parser';
6287 6287
         }
6288 6288
         if ($msg) {
6289
-            $source .= ' / ' . $msg;
6289
+            $source .= ' / '.$msg;
6290 6290
         }
6291 6291
         if (isset($actionName) && !empty($actionName)) {
6292 6292
             $source .= $actionName;
@@ -6318,12 +6318,12 @@  discard block
 block discarded – undo
6318 6318
 
6319 6319
         // Display error
6320 6320
         if (isset($_SESSION['mgrValidated'])) {
6321
-            echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html><head><title>EVO Content Manager ' . $version . ' &raquo; ' . $release_date . '</title>
6321
+            echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html><head><title>EVO Content Manager '.$version.' &raquo; '.$release_date.'</title>
6322 6322
                  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6323
-                 <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'] . 'media/style/' . $this->config['manager_theme'] . '/style.css" />
6323
+                 <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'].'media/style/'.$this->config['manager_theme'].'/style.css" />
6324 6324
                  <style type="text/css">body { padding:10px; } td {font:inherit;}</style>
6325 6325
                  </head><body>
6326
-                 ' . $str . '</body></html>';
6326
+                 ' . $str.'</body></html>';
6327 6327
 
6328 6328
         } else {
6329 6329
             echo 'Error';
@@ -6361,7 +6361,7 @@  discard block
 block discarded – undo
6361 6361
             switch ($val['type']) {
6362 6362
                 case '->':
6363 6363
                 case '::':
6364
-                    $functionName = $val['function'] = $val['class'] . $val['type'] . $val['function'];
6364
+                    $functionName = $val['function'] = $val['class'].$val['type'].$val['function'];
6365 6365
                     break;
6366 6366
                 default:
6367 6367
                     $functionName = $val['function'];
@@ -6371,7 +6371,7 @@  discard block
 block discarded – undo
6371 6371
             $args = array_pad(array(), $_, '$var');
6372 6372
             $args = implode(", ", $args);
6373 6373
             $modx = &$this;
6374
-            $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) {
6374
+            $args = preg_replace_callback('/\$var/', function() use ($modx, &$tmp, $val) {
6375 6375
                 $arg = $val['args'][$tmp - 1];
6376 6376
                 switch (true) {
6377 6377
                     case is_null($arg): {
@@ -6383,7 +6383,7 @@  discard block
 block discarded – undo
6383 6383
                         break;
6384 6384
                     }
6385 6385
                     case is_scalar($arg): {
6386
-                        $out = strlen($arg) > 20 ? 'string $var' . $tmp : ("'" . $this->htmlspecialchars(str_replace("'", "\\'", $arg)) . "'");
6386
+                        $out = strlen($arg) > 20 ? 'string $var'.$tmp : ("'".$this->htmlspecialchars(str_replace("'", "\\'", $arg))."'");
6387 6387
                         break;
6388 6388
                     }
6389 6389
                     case is_bool($arg): {
@@ -6391,23 +6391,23 @@  discard block
 block discarded – undo
6391 6391
                         break;
6392 6392
                     }
6393 6393
                     case is_array($arg): {
6394
-                        $out = 'array $var' . $tmp;
6394
+                        $out = 'array $var'.$tmp;
6395 6395
                         break;
6396 6396
                     }
6397 6397
                     case is_object($arg): {
6398
-                        $out = get_class($arg) . ' $var' . $tmp;
6398
+                        $out = get_class($arg).' $var'.$tmp;
6399 6399
                         break;
6400 6400
                     }
6401 6401
                     default: {
6402
-                        $out = '$var' . $tmp;
6402
+                        $out = '$var'.$tmp;
6403 6403
                     }
6404 6404
                 }
6405 6405
                 $tmp++;
6406 6406
                 return $out;
6407 6407
             }, $args);
6408 6408
             $line = array(
6409
-                "<strong>" . $functionName . "</strong>(" . $args . ")",
6410
-                $path . " on line " . $val['line']
6409
+                "<strong>".$functionName."</strong>(".$args.")",
6410
+                $path." on line ".$val['line']
6411 6411
             );
6412 6412
             $table[] = array(implode("<br />", $line));
6413 6413
         }
@@ -6448,7 +6448,7 @@  discard block
 block discarded – undo
6448 6448
             $alias = strip_tags($alias); // strip HTML
6449 6449
             $alias = preg_replace('/[^\.A-Za-z0-9 _-]/', '', $alias); // strip non-alphanumeric characters
6450 6450
             $alias = preg_replace('/\s+/', '-', $alias); // convert white-space to dash
6451
-            $alias = preg_replace('/-+/', '-', $alias);  // convert multiple dashes to one
6451
+            $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one
6452 6452
             $alias = trim($alias, '-'); // trim excess
6453 6453
             return $alias;
6454 6454
         }
@@ -6464,7 +6464,7 @@  discard block
 block discarded – undo
6464 6464
         $precisions = count($sizes) - 1;
6465 6465
         foreach ($sizes as $unit => $bytes) {
6466 6466
             if ($size >= $bytes) {
6467
-                return number_format($size / $bytes, $precisions) . ' ' . $unit;
6467
+                return number_format($size / $bytes, $precisions).' '.$unit;
6468 6468
             }
6469 6469
             $precisions--;
6470 6470
         }
@@ -6568,10 +6568,10 @@  discard block
 block discarded – undo
6568 6568
 
6569 6569
         if (strpos($str, MODX_MANAGER_PATH) === 0) {
6570 6570
             return false;
6571
-        } elseif (is_file(MODX_BASE_PATH . $str)) {
6572
-            $file_path = MODX_BASE_PATH . $str;
6573
-        } elseif (is_file(MODX_BASE_PATH . "{$tpl_dir}{$str}")) {
6574
-            $file_path = MODX_BASE_PATH . $tpl_dir . $str;
6571
+        } elseif (is_file(MODX_BASE_PATH.$str)) {
6572
+            $file_path = MODX_BASE_PATH.$str;
6573
+        } elseif (is_file(MODX_BASE_PATH."{$tpl_dir}{$str}")) {
6574
+            $file_path = MODX_BASE_PATH.$tpl_dir.$str;
6575 6575
         } else {
6576 6576
             return false;
6577 6577
         }
@@ -6697,7 +6697,7 @@  discard block
 block discarded – undo
6697 6697
             $title = 'no title';
6698 6698
         }
6699 6699
         if (is_array($msg)) {
6700
-            $msg = '<pre>' . print_r($msg, true) . '</pre>';
6700
+            $msg = '<pre>'.print_r($msg, true).'</pre>';
6701 6701
         } elseif ($msg === '') {
6702 6702
             $msg = $_SERVER['REQUEST_URI'];
6703 6703
         }
@@ -6742,7 +6742,7 @@  discard block
 block discarded – undo
6742 6742
         if (is_array($SystemAlertMsgQueque)) {
6743 6743
             $title = '';
6744 6744
             if ($this->name && $this->activePlugin) {
6745
-                $title = "<div><b>" . $this->activePlugin . "</b> - <span style='color:maroon;'>" . $this->name . "</span></div>";
6745
+                $title = "<div><b>".$this->activePlugin."</b> - <span style='color:maroon;'>".$this->name."</span></div>";
6746 6746
             }
6747 6747
             $SystemAlertMsgQueque[] = "$title<div style='margin-left:10px;margin-top:3px;'>$msg</div>";
6748 6748
         }
Please login to merge, or discard this patch.