Completed
Push — develop ( 48041c...eb8457 )
by Agel_Nash
06:16
created
manager/includes/functions/processors.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     }
37 37
 }
38 38
 
39
-if(!function_exists('duplicateDocument')) {
39
+if (!function_exists('duplicateDocument')) {
40 40
     /**
41 41
      * @param int $docid
42 42
      * @param null|int $parent
@@ -90,12 +90,12 @@  discard block
 block discarded – undo
90 90
             $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('pagetitle', $modx->getDatabase()->getFullTableName('site_content'),
91 91
                 "pagetitle LIKE '{$pagetitle} Duplicate%'"));
92 92
             if ($count >= 1) {
93
-                $count = ' ' . ($count + 1);
93
+                $count = ' '.($count + 1);
94 94
             } else {
95 95
                 $count = '';
96 96
             }
97 97
 
98
-            $content['pagetitle'] = $_lang['duplicated_el_suffix'] . $count . ' ' . $content['pagetitle'];
98
+            $content['pagetitle'] = $_lang['duplicated_el_suffix'].$count.' '.$content['pagetitle'];
99 99
             $content['alias'] = null;
100 100
         } elseif ($modx->config['friendly_urls'] == 0 || $modx->config['allow_duplicate_alias'] == 0) {
101 101
             $content['alias'] = null;
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
     }
154 154
 }
155 155
 
156
-if(!function_exists('duplicateTVs')) {
156
+if (!function_exists('duplicateTVs')) {
157 157
     /**
158 158
      * Duplicate Document TVs
159 159
      *
@@ -166,8 +166,8 @@  discard block
 block discarded – undo
166 166
 
167 167
         $tbltvc = $modx->getDatabase()->getFullTableName('site_tmplvar_contentvalues');
168 168
 
169
-        $newid = (int)$newid;
170
-        $oldid = (int)$oldid;
169
+        $newid = (int) $newid;
170
+        $oldid = (int) $oldid;
171 171
 
172 172
         $modx->getDatabase()->insert(
173 173
             array('contentid' => '', 'tmplvarid' => '', 'value' => ''), $tbltvc, // Insert into
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
     }
177 177
 }
178 178
 
179
-if(!function_exists('duplicateAccess')) {
179
+if (!function_exists('duplicateAccess')) {
180 180
     /**
181 181
      * Duplicate Document Access Permissions
182 182
      *
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
 
190 190
         $tbldg = $modx->getDatabase()->getFullTableName('document_groups');
191 191
 
192
-        $newid = (int)$newid;
193
-        $oldid = (int)$oldid;
192
+        $newid = (int) $newid;
193
+        $oldid = (int) $oldid;
194 194
 
195 195
         $modx->getDatabase()->insert(
196 196
             array('document' => '', 'document_group' => ''), $tbldg, // Insert into
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
     }
200 200
 }
201 201
 
202
-if(!function_exists('evalModule')) {
202
+if (!function_exists('evalModule')) {
203 203
     /**
204 204
      * evalModule
205 205
      *
@@ -235,17 +235,17 @@  discard block
 block discarded – undo
235 235
             }
236 236
             if ($modx->config['error_reporting'] === '99' || 2 < $error_level) {
237 237
                 $modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'],
238
-                    $_SESSION['itemname'] . ' - Module', $error_info['message'], $error_info['line'], $msg);
238
+                    $_SESSION['itemname'].' - Module', $error_info['message'], $error_info['line'], $msg);
239 239
                 $modx->event->alert("An error occurred while loading. Please see the event log for more information<p>{$msg}</p>");
240 240
             }
241 241
         }
242 242
         unset($modx->event->params);
243 243
 
244
-        return $mod . $msg;
244
+        return $mod.$msg;
245 245
     }
246 246
 }
247 247
 
248
-if(!function_exists('allChildren')) {
248
+if (!function_exists('allChildren')) {
249 249
     /**
250 250
      * @param int $currDocID
251 251
      * @return array
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
     }
266 266
 }
267 267
 
268
-if(!function_exists('jsAlert')) {
268
+if (!function_exists('jsAlert')) {
269 269
     /**
270 270
      * show javascript alert
271 271
      *
@@ -275,14 +275,14 @@  discard block
 block discarded – undo
275 275
     {
276 276
         $modx = evolutionCMS();
277 277
         if ($_POST['ajax'] != 1) {
278
-            echo "<script>window.setTimeout(\"alert('" . addslashes($modx->getDatabase()->escape($msg)) . "')\",10);history.go(-1)</script>";
278
+            echo "<script>window.setTimeout(\"alert('".addslashes($modx->getDatabase()->escape($msg))."')\",10);history.go(-1)</script>";
279 279
         } else {
280
-            echo $msg . "\n";
280
+            echo $msg."\n";
281 281
         }
282 282
     }
283 283
 }
284 284
 
285
-if(!function_exists('login')) {
285
+if (!function_exists('login')) {
286 286
     /**
287 287
      * @param string $username
288 288
      * @param string $givenPassword
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
     }
298 298
 }
299 299
 
300
-if(!function_exists('loginV1')) {
300
+if (!function_exists('loginV1')) {
301 301
     /**
302 302
      * @param int $internalKey
303 303
      * @param string $givenPassword
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
     }
331 331
 }
332 332
 
333
-if(!function_exists('loginMD5')) {
333
+if (!function_exists('loginMD5')) {
334 334
     /**
335 335
      * @param int $internalKey
336 336
      * @param string $givenPassword
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
     }
352 352
 }
353 353
 
354
-if(!function_exists('updateNewHash')) {
354
+if (!function_exists('updateNewHash')) {
355 355
     /**
356 356
      * @param string $username
357 357
      * @param string $password
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
     }
371 371
 }
372 372
 
373
-if(!function_exists('incrementFailedLoginCount')) {
373
+if (!function_exists('incrementFailedLoginCount')) {
374 374
     /**
375 375
      * @param int $internalKey
376 376
      * @param int $failedlogins
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 
398 398
         if ($failedlogins < $failed_allowed) {
399 399
             //sleep to help prevent brute force attacks
400
-            $sleep = (int)$failedlogins / 2;
400
+            $sleep = (int) $failedlogins / 2;
401 401
             if ($sleep > 5) {
402 402
                 $sleep = 5;
403 403
             }
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
     }
411 411
 }
412 412
 
413
-if(!function_exists('saveUserGroupAccessPermissons')) {
413
+if (!function_exists('saveUserGroupAccessPermissons')) {
414 414
     /**
415 415
      * saves module user group access
416 416
      */
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
     }
442 442
 }
443 443
 
444
-if(!function_exists('saveEventListeners')) {
444
+if (!function_exists('saveEventListeners')) {
445 445
 # Save Plugin Event Listeners
446 446
     function saveEventListeners($id, $sysevents, $mode)
447 447
     {
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
     }
512 512
 }
513 513
 
514
-if(!function_exists('getEventIdByName')) {
514
+if (!function_exists('getEventIdByName')) {
515 515
     /**
516 516
      * @param string $name
517 517
      * @return string|int
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
     }
538 538
 }
539 539
 
540
-if(!function_exists('saveTemplateAccess')) {
540
+if (!function_exists('saveTemplateAccess')) {
541 541
     /**
542 542
      * @param int $id
543 543
      */
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
     }
577 577
 }
578 578
 
579
-if(!function_exists('saveTemplateVarAccess')) {
579
+if (!function_exists('saveTemplateVarAccess')) {
580 580
     /**
581 581
      * @return void
582 582
      */
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
     }
616 616
 }
617 617
 
618
-if(!function_exists('saveDocumentAccessPermissons')) {
618
+if (!function_exists('saveDocumentAccessPermissons')) {
619 619
     function saveDocumentAccessPermissons()
620 620
     {
621 621
         global $id, $newid;
@@ -784,10 +784,10 @@  discard block
 block discarded – undo
784 784
         }
785 785
 
786 786
         foreach ($defaults as $k) {
787
-            if (isset($settings['default_' . $k]) && $settings['default_' . $k] == '1') {
787
+            if (isset($settings['default_'.$k]) && $settings['default_'.$k] == '1') {
788 788
                 unset($settings[$k]);
789 789
             }
790
-            unset($settings['default_' . $k]);
790
+            unset($settings['default_'.$k]);
791 791
         }
792 792
 
793 793
         $modx->getDatabase()->delete($tbl_user_settings, "user='{$id}'");
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
         global $id, $modx;
820 820
         $mode = $_POST['mode'];
821 821
         $modx->getManagerApi()->saveFormValues($mode);
822
-        $modx->webAlertAndQuit($msg, "index.php?a={$mode}" . ($mode === $action ? "&id={$id}" : ''));
822
+        $modx->webAlertAndQuit($msg, "index.php?a={$mode}".($mode === $action ? "&id={$id}" : ''));
823 823
     }
824 824
 }
825 825
 
@@ -835,7 +835,7 @@  discard block
 block discarded – undo
835 835
         global $deltime;
836 836
 
837 837
         $rs = $modx->getDatabase()->select('id', $modx->getDatabase()->getFullTableName('site_content'),
838
-            "parent='" . (int)$parent . "' AND deleted=1 AND deletedon='" . (int)$deltime . "'");
838
+            "parent='".(int) $parent."' AND deleted=1 AND deletedon='".(int) $deltime."'");
839 839
         // the document has children documents, we'll need to delete those too
840 840
         while ($row = $modx->getDatabase()->getRow($rs)) {
841 841
             $children[] = $row['id'];
Please login to merge, or discard this patch.
manager/includes/functions/nodes.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!function_exists('makeHTML')) {
3
+if (!function_exists('makeHTML')) {
4 4
     /**
5 5
      * @param int $indent
6 6
      * @param int $parent
@@ -37,14 +37,14 @@  discard block
 block discarded – undo
37 37
             case 'publishedon':
38 38
             case 'pub_date':
39 39
             case 'unpub_date':
40
-                $sortby = sprintf('CASE WHEN %s IS NULL THEN 1 ELSE 0 END, %s', 'sc.' . $_SESSION['tree_sortby'],
41
-                    'sc.' . $_SESSION['tree_sortby']);
40
+                $sortby = sprintf('CASE WHEN %s IS NULL THEN 1 ELSE 0 END, %s', 'sc.'.$_SESSION['tree_sortby'],
41
+                    'sc.'.$_SESSION['tree_sortby']);
42 42
                 break;
43 43
             default:
44
-                $sortby = 'sc.' . $_SESSION['tree_sortby'];
44
+                $sortby = 'sc.'.$_SESSION['tree_sortby'];
45 45
         };
46 46
 
47
-        $orderby = $modx->getDatabase()->escape($sortby . ' ' . $_SESSION['tree_sortdir']);
47
+        $orderby = $modx->getDatabase()->escape($sortby.' '.$_SESSION['tree_sortdir']);
48 48
 
49 49
         // Folder sorting gets special setup ;) Add menuindex and pagetitle
50 50
         if ($_SESSION['tree_sortby'] == 'isfolder') {
@@ -59,11 +59,11 @@  discard block
 block discarded – undo
59 59
             $_SESSION['mgrDocgroups']) : '';
60 60
         $showProtected = false;
61 61
         if (isset ($modx->config['tree_show_protected'])) {
62
-            $showProtected = (boolean)$modx->config['tree_show_protected'];
62
+            $showProtected = (boolean) $modx->config['tree_show_protected'];
63 63
         }
64
-        $mgrRole = (isset ($_SESSION['mgrRole']) && (string)$_SESSION['mgrRole'] === '1') ? '1' : '0';
64
+        $mgrRole = (isset ($_SESSION['mgrRole']) && (string) $_SESSION['mgrRole'] === '1') ? '1' : '0';
65 65
         if ($showProtected == false) {
66
-            $access = "AND (1={$mgrRole} OR sc.privatemgr=0" . (!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))");
66
+            $access = "AND (1={$mgrRole} OR sc.privatemgr=0".(!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))");
67 67
         } else {
68 68
             $access = '';
69 69
         }
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
             }
101 101
 
102 102
             $weblinkDisplay = $row['type'] == 'reference' ? sprintf('&nbsp;%s', $_style['tree_linkgo']) : '';
103
-            $pageIdDisplay = '<small>(' . ($modx_textdir ? '&rlm;' : '') . $row['id'] . ')</small>';
103
+            $pageIdDisplay = '<small>('.($modx_textdir ? '&rlm;' : '').$row['id'].')</small>';
104 104
 
105 105
             // Prepare displaying user-locks
106 106
             $lockedByUser = '';
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
                         'element_type' => $_lang["lock_element_type_7"],
112 112
                         'lasthit_df'   => $rowLock['lasthit_df']
113 113
                     ));
114
-                    $lockedByUser = '<span title="' . $title . '" class="editResource">' . $_style['tree_preview_resource'] . '</span>';
114
+                    $lockedByUser = '<span title="'.$title.'" class="editResource">'.$_style['tree_preview_resource'].'</span>';
115 115
                 } else {
116 116
                     $title = $modx->parseText($_lang["lock_element_locked_by"], array(
117 117
                         'element_type' => $_lang["lock_element_type_7"],
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
                         'lasthit_df'   => $rowLock['lasthit_df']
120 120
                     ));
121 121
                     if ($modx->hasPermission('remove_locks')) {
122
-                        $lockedByUser = '<span onclick="modx.tree.unlockElement(7, ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource">' . $_style['icons_secured'] . '</span>';
122
+                        $lockedByUser = '<span onclick="modx.tree.unlockElement(7, '.$row['id'].', this);return false;" title="'.$title.'" class="lockedResource">'.$_style['icons_secured'].'</span>';
123 123
                     } else {
124
-                        $lockedByUser = '<span title="' . $title . '" class="lockedResource">' . $_style['icons_secured'] . '</span>';
124
+                        $lockedByUser = '<span title="'.$title.'" class="lockedResource">'.$_style['icons_secured'].'</span>';
125 125
                     }
126 126
                 }
127 127
             }
@@ -130,22 +130,22 @@  discard block
 block discarded – undo
130 130
 
131 131
             $title = '';
132 132
             if (isDateNode($nodeNameSource)) {
133
-                $title = $_lang['pagetitle'] . ': ' . $row['pagetitle'] . '[+lf+]';
133
+                $title = $_lang['pagetitle'].': '.$row['pagetitle'].'[+lf+]';
134 134
             }
135
-            $title .= $_lang['id'] . ': ' . $row['id'];
136
-            $title .= '[+lf+]' . $_lang['resource_opt_menu_title'] . ': ' . $row['menutitle'];
137
-            $title .= '[+lf+]' . $_lang['resource_opt_menu_index'] . ': ' . $row['menuindex'];
138
-            $title .= '[+lf+]' . $_lang['alias'] . ': ' . (!empty($row['alias']) ? $row['alias'] : '-');
139
-            $title .= '[+lf+]' . $_lang['template'] . ': ' . $row['templatename'];
140
-            $title .= '[+lf+]' . $_lang['publish_date'] . ': ' . $modx->toDateFormat($row['pub_date']);
141
-            $title .= '[+lf+]' . $_lang['unpublish_date'] . ': ' . $modx->toDateFormat($row['unpub_date']);
142
-            $title .= '[+lf+]' . $_lang['page_data_web_access'] . ': ' . ($row['privateweb'] ? $_lang['private'] : $_lang['public']);
143
-            $title .= '[+lf+]' . $_lang['page_data_mgr_access'] . ': ' . ($row['privatemgr'] ? $_lang['private'] : $_lang['public']);
144
-            $title .= '[+lf+]' . $_lang['resource_opt_richtext'] . ': ' . ($row['richtext'] == 0 ? $_lang['no'] : $_lang['yes']);
145
-            $title .= '[+lf+]' . $_lang['page_data_searchable'] . ': ' . ($row['searchable'] == 0 ? $_lang['no'] : $_lang['yes']);
146
-            $title .= '[+lf+]' . $_lang['page_data_cacheable'] . ': ' . ($row['cacheable'] == 0 ? $_lang['no'] : $_lang['yes']);
135
+            $title .= $_lang['id'].': '.$row['id'];
136
+            $title .= '[+lf+]'.$_lang['resource_opt_menu_title'].': '.$row['menutitle'];
137
+            $title .= '[+lf+]'.$_lang['resource_opt_menu_index'].': '.$row['menuindex'];
138
+            $title .= '[+lf+]'.$_lang['alias'].': '.(!empty($row['alias']) ? $row['alias'] : '-');
139
+            $title .= '[+lf+]'.$_lang['template'].': '.$row['templatename'];
140
+            $title .= '[+lf+]'.$_lang['publish_date'].': '.$modx->toDateFormat($row['pub_date']);
141
+            $title .= '[+lf+]'.$_lang['unpublish_date'].': '.$modx->toDateFormat($row['unpub_date']);
142
+            $title .= '[+lf+]'.$_lang['page_data_web_access'].': '.($row['privateweb'] ? $_lang['private'] : $_lang['public']);
143
+            $title .= '[+lf+]'.$_lang['page_data_mgr_access'].': '.($row['privatemgr'] ? $_lang['private'] : $_lang['public']);
144
+            $title .= '[+lf+]'.$_lang['resource_opt_richtext'].': '.($row['richtext'] == 0 ? $_lang['no'] : $_lang['yes']);
145
+            $title .= '[+lf+]'.$_lang['page_data_searchable'].': '.($row['searchable'] == 0 ? $_lang['no'] : $_lang['yes']);
146
+            $title .= '[+lf+]'.$_lang['page_data_cacheable'].': '.($row['cacheable'] == 0 ? $_lang['no'] : $_lang['yes']);
147 147
             $title = $modx->getPhpCompat()->htmlspecialchars($title);
148
-            $title = str_replace('[+lf+]', ' &#13;', $title);   // replace line-breaks with empty space as fall-back
148
+            $title = str_replace('[+lf+]', ' &#13;', $title); // replace line-breaks with empty space as fall-back
149 149
 
150 150
             $data = array(
151 151
                 'id'               => $row['id'],
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
                 }
230 230
 
231 231
                 if ($ph['contextmenu']) {
232
-                    $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"';
232
+                    $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"';
233 233
                 }
234 234
 
235 235
                 if ($_SESSION['tree_show_only_folders']) {
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
                         }
288 288
 
289 289
                         if ($ph['contextmenu']) {
290
-                            $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"';
290
+                            $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"';
291 291
                         }
292 292
 
293 293
                         $node .= $modx->parseText($tpl, $ph);
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
                         }
326 326
 
327 327
                         if ($ph['contextmenu']) {
328
-                            $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"';
328
+                            $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"';
329 329
                         }
330 330
 
331 331
                         $node .= $modx->parseText($tpl, $ph);
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
                         }
377 377
 
378 378
                         if ($ph['contextmenu']) {
379
-                            $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"';
379
+                            $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"';
380 380
                         }
381 381
 
382 382
                         $node .= $modx->parseText($tpl, $ph);
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
                         }
419 419
 
420 420
                         if ($ph['contextmenu']) {
421
-                            $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"';
421
+                            $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"';
422 422
                         }
423 423
 
424 424
                         $node .= $modx->parseText($tpl, $ph);
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
     }
445 445
 }
446 446
 
447
-if(!function_exists('getIconInfo')) {
447
+if (!function_exists('getIconInfo')) {
448 448
     /**
449 449
      * @param array $_style
450 450
      * @return array
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
     }
479 479
 }
480 480
 
481
-if(!function_exists('getNodeTitle')) {
481
+if (!function_exists('getNodeTitle')) {
482 482
     /**
483 483
      * @param string $nodeNameSource
484 484
      * @param array $row
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
                         $nodetitle .= $modx->config['friendly_url_suffix'];
500 500
                     }
501 501
                 }
502
-                $nodetitle = $modx->config['friendly_url_prefix'] . $nodetitle;
502
+                $nodetitle = $modx->config['friendly_url_prefix'].$nodetitle;
503 503
                 break;
504 504
             case 'pagetitle':
505 505
                 $nodetitle = $row['pagetitle'];
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
     }
534 534
 }
535 535
 
536
-if(!function_exists('isDateNode')) {
536
+if (!function_exists('isDateNode')) {
537 537
     /**
538 538
      * @param string $nodeNameSource
539 539
      * @return bool
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
     }
554 554
 }
555 555
 
556
-if(!function_exists('checkIsFolder')) {
556
+if (!function_exists('checkIsFolder')) {
557 557
     /**
558 558
      * @param int $parent
559 559
      * @param int $isfolder
@@ -563,11 +563,11 @@  discard block
 block discarded – undo
563 563
     {
564 564
         $modx = evolutionCMS();
565 565
 
566
-        return (int)$modx->getDatabase()->getValue($modx->getDatabase()->query('SELECT count(*) FROM ' . $modx->getDatabase()->getFullTableName('site_content') . ' WHERE parent=' . $parent . ' AND isfolder=' . $isfolder . ' '));
566
+        return (int) $modx->getDatabase()->getValue($modx->getDatabase()->query('SELECT count(*) FROM '.$modx->getDatabase()->getFullTableName('site_content').' WHERE parent='.$parent.' AND isfolder='.$isfolder.' '));
567 567
     }
568 568
 }
569 569
 
570
-if(!function_exists('_htmlentities')) {
570
+if (!function_exists('_htmlentities')) {
571 571
     /**
572 572
      * @param mixed $array
573 573
      * @return string
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
     }
584 584
 }
585 585
 
586
-if(!function_exists('getTplSingleNode')) {
586
+if (!function_exists('getTplSingleNode')) {
587 587
     /**
588 588
      * @return string
589 589
      */
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
     }
614 614
 }
615 615
 
616
-if(!function_exists('getTplFolderNode')) {
616
+if (!function_exists('getTplFolderNode')) {
617 617
     /**
618 618
      * @return string
619 619
      */
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
         title="[+title+]">[+nodetitleDisplay+][+weblinkDisplay+]</span>[+pageIdDisplay+]</a><div>';
655 655
     }
656 656
 }
657
-if(!function_exists('getTplFolderNodeNotChildren')) {
657
+if (!function_exists('getTplFolderNodeNotChildren')) {
658 658
     /**
659 659
      * @return string
660 660
      */
Please login to merge, or discard this patch.
manager/includes/secure_web_documents.inc.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,14 +20,14 @@
 block discarded – undo
20 20
         ($docid > 0 ? "id='$docid'" : "privateweb = 1"));
21 21
     $rs = $modx->getDatabase()->select(
22 22
         'DISTINCT sc.id',
23
-        $modx->getDatabase()->getFullTableName("site_content") . " sc
24
-			LEFT JOIN " . $modx->getDatabase()->getFullTableName("document_groups") . " dg ON dg.document = sc.id
25
-			LEFT JOIN " . $modx->getDatabase()->getFullTableName("webgroup_access") . " wga ON wga.documentgroup = dg.document_group",
26
-        ($docid > 0 ? " sc.id='{$docid}' AND " : "") . "wga.id>0"
23
+        $modx->getDatabase()->getFullTableName("site_content")." sc
24
+			LEFT JOIN " . $modx->getDatabase()->getFullTableName("document_groups")." dg ON dg.document = sc.id
25
+			LEFT JOIN " . $modx->getDatabase()->getFullTableName("webgroup_access")." wga ON wga.documentgroup = dg.document_group",
26
+        ($docid > 0 ? " sc.id='{$docid}' AND " : "")."wga.id>0"
27 27
     );
28 28
     $ids = $modx->getDatabase()->getColumn("id", $rs);
29 29
     if (count($ids) > 0) {
30 30
         $modx->getDatabase()->update('privateweb = 1', $modx->getDatabase()->getFullTableName("site_content"),
31
-            "id IN (" . implode(", ", $ids) . ")");
31
+            "id IN (".implode(", ", $ids).")");
32 32
     }
33 33
 }
Please login to merge, or discard this patch.
manager/includes/accesscontrol.inc.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -18,13 +18,13 @@  discard block
 block discarded – undo
18 18
 }
19 19
 
20 20
 // andrazk 20070416 - if installer is running, destroy active sessions
21
-if (file_exists(MODX_BASE_PATH . 'assets/cache/installProc.inc.php')) {
22
-    include_once(MODX_BASE_PATH . 'assets/cache/installProc.inc.php');
21
+if (file_exists(MODX_BASE_PATH.'assets/cache/installProc.inc.php')) {
22
+    include_once(MODX_BASE_PATH.'assets/cache/installProc.inc.php');
23 23
     if (isset($installStartTime)) {
24 24
         if ((time() - $installStartTime) > 5 * 60) { // if install flag older than 5 minutes, discard
25 25
             unset($installStartTime);
26
-            @ chmod(MODX_BASE_PATH . 'assets/cache/installProc.inc.php', 0755);
27
-            unlink(MODX_BASE_PATH . 'assets/cache/installProc.inc.php');
26
+            @ chmod(MODX_BASE_PATH.'assets/cache/installProc.inc.php', 0755);
27
+            unlink(MODX_BASE_PATH.'assets/cache/installProc.inc.php');
28 28
         } else {
29 29
             if ($_SERVER['REQUEST_METHOD'] != 'POST') {
30 30
                 if (isset($_COOKIE[session_name()])) {
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
                         //						setcookie(session_name(), '', 0, MODX_BASE_URL);
51 51
                     }
52 52
                     header('HTTP/1.0 307 Redirect');
53
-                    header('Location: ' . MODX_MANAGER_URL . 'index.php?installGoingOn=2');
53
+                    header('Location: '.MODX_MANAGER_URL.'index.php?installGoingOn=2');
54 54
                 }
55 55
             }
56 56
         }
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
         // establish fallback to English default
63 63
         include_once "lang/english.inc.php";
64 64
         // include localized overrides
65
-        include_once "lang/" . $manager_language . ".inc.php";
65
+        include_once "lang/".$manager_language.".inc.php";
66 66
     } else {
67 67
         include_once "lang/english.inc.php";
68 68
     }
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
     $modx->setPlaceholder('modx_charset', $modx_manager_charset);
71 71
     $modx->setPlaceholder('theme', $manager_theme);
72 72
     $modx->setPlaceholder('favicon',
73
-        (file_exists(MODX_BASE_PATH . 'favicon.ico') ? MODX_SITE_URL . 'favicon.ico' : 'media/style/' . $modx->config['manager_theme'] . '/images/favicon.ico'));
73
+        (file_exists(MODX_BASE_PATH.'favicon.ico') ? MODX_SITE_URL . 'favicon.ico' : 'media/style/'.$modx->config['manager_theme'].'/images/favicon.ico'));
74 74
 
75 75
     // invoke OnManagerLoginFormPrerender event
76 76
     $evtOut = $modx->invokeEvent('OnManagerLoginFormPrerender');
@@ -81,25 +81,25 @@  discard block
 block discarded – undo
81 81
     $modx->setPlaceholder('manager_path', MGR_DIR);
82 82
     $modx->setPlaceholder('logo_slogan', $_lang["logo_slogan"]);
83 83
     $modx->setPlaceholder('login_message', $_lang["login_message"]);
84
-    $modx->setPlaceholder('manager_theme_url', MODX_MANAGER_URL . 'media/style/' . $modx->config['manager_theme'] . '/');
84
+    $modx->setPlaceholder('manager_theme_url', MODX_MANAGER_URL.'media/style/'.$modx->config['manager_theme'].'/');
85 85
     $modx->setPlaceholder('year', date('Y'));
86 86
 
87 87
     // set login logo image
88
-    if ( !empty($modx->config['login_logo']) ) {
89
-        $modx->setPlaceholder('login_logo', MODX_SITE_URL . $modx->config['login_logo']);
88
+    if (!empty($modx->config['login_logo'])) {
89
+        $modx->setPlaceholder('login_logo', MODX_SITE_URL.$modx->config['login_logo']);
90 90
     } else {
91
-        $modx->setPlaceholder('login_logo', MODX_MANAGER_URL . 'media/style/' . $modx->config['manager_theme'] . '/images/login/default/login-logo.png');
91
+        $modx->setPlaceholder('login_logo', MODX_MANAGER_URL.'media/style/'.$modx->config['manager_theme'].'/images/login/default/login-logo.png');
92 92
     }
93 93
 
94 94
     // set login background image
95
-    if ( !empty($modx->config['login_bg']) ) {
96
-        $modx->setPlaceholder('login_bg', MODX_SITE_URL . $modx->config['login_bg']);
95
+    if (!empty($modx->config['login_bg'])) {
96
+        $modx->setPlaceholder('login_bg', MODX_SITE_URL.$modx->config['login_bg']);
97 97
     } else {
98
-        $modx->setPlaceholder('login_bg', MODX_MANAGER_URL . 'media/style/' . $modx->config['manager_theme'] . '/images/login/default/login-background.jpg');
98
+        $modx->setPlaceholder('login_bg', MODX_MANAGER_URL.'media/style/'.$modx->config['manager_theme'].'/images/login/default/login-background.jpg');
99 99
     }
100 100
 
101 101
     // set form position css class
102
-    $modx->setPlaceholder('login_form_position_class', 'loginbox-' . $modx->config['login_form_position']);
102
+    $modx->setPlaceholder('login_form_position_class', 'loginbox-'.$modx->config['login_form_position']);
103 103
 
104 104
     switch ($modx->config['manager_theme_mode']) {
105 105
       case '1':
@@ -124,11 +124,11 @@  discard block
 block discarded – undo
124 124
         switch ($installGoingOn) {
125 125
             case 1 :
126 126
                 $modx->setPlaceholder('login_message',
127
-                    "<p><span class=\"fail\">" . $_lang["login_cancelled_install_in_progress"] . "</p><p>" . $_lang["login_message"] . "</p>");
127
+                    "<p><span class=\"fail\">".$_lang["login_cancelled_install_in_progress"]."</p><p>".$_lang["login_message"]."</p>");
128 128
                 break;
129 129
             case 2 :
130 130
                 $modx->setPlaceholder('login_message',
131
-                    "<p><span class=\"fail\">" . $_lang["login_cancelled_site_was_updated"] . "</p><p>" . $_lang["login_message"] . "</p>");
131
+                    "<p><span class=\"fail\">".$_lang["login_cancelled_site_was_updated"]."</p><p>".$_lang["login_message"]."</p>");
132 132
                 break;
133 133
         }
134 134
     }
@@ -136,9 +136,9 @@  discard block
 block discarded – undo
136 136
     if ($modx->config['use_captcha'] == 1) {
137 137
         $modx->setPlaceholder('login_captcha_message', $_lang["login_captcha_message"]);
138 138
         $modx->setPlaceholder('captcha_image',
139
-            '<a href="' . MODX_MANAGER_URL . '" class="loginCaptcha"><img id="captcha_image" src="' . MODX_MANAGER_URL . 'captcha.php?rand=' . rand() . '" alt="' . $_lang["login_captcha_message"] . '" /></a>');
139
+            '<a href="'.MODX_MANAGER_URL.'" class="loginCaptcha"><img id="captcha_image" src="'.MODX_MANAGER_URL.'captcha.php?rand='.rand().'" alt="'.$_lang["login_captcha_message"].'" /></a>');
140 140
         $modx->setPlaceholder('captcha_input',
141
-            '<label>' . $_lang["captcha_code"] . '</label> <input type="text" name="captcha_code" tabindex="3" value="" />');
141
+            '<label>'.$_lang["captcha_code"].'</label> <input type="text" name="captcha_code" tabindex="3" value="" />');
142 142
     }
143 143
 
144 144
     // login info
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 
157 157
     // invoke OnManagerLoginFormRender event
158 158
     $evtOut = $modx->invokeEvent('OnManagerLoginFormRender');
159
-    $html = is_array($evtOut) ? '<div id="onManagerLoginFormRender">' . implode('', $evtOut) . '</div>' : '';
159
+    $html = is_array($evtOut) ? '<div id="onManagerLoginFormRender">'.implode('', $evtOut).'</div>' : '';
160 160
     $modx->setPlaceholder('OnManagerLoginFormRender', $html);
161 161
 
162 162
     // load template
@@ -174,29 +174,29 @@  discard block
 block discarded – undo
174 174
             $login_tpl = file_get_contents($target);
175 175
         }
176 176
     } else {
177
-        $theme_path = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/';
178
-        if (is_file($theme_path . 'style.php')) {
179
-            include($theme_path . 'style.php');
177
+        $theme_path = MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/';
178
+        if (is_file($theme_path.'style.php')) {
179
+            include($theme_path.'style.php');
180 180
         }
181 181
         $chunk = $modx->getChunk($target);
182 182
         if ($chunk !== false && !empty($chunk)) {
183 183
             $login_tpl = $chunk;
184
-        } elseif (is_file(MODX_BASE_PATH . $target)) {
185
-            $target = MODX_BASE_PATH . $target;
184
+        } elseif (is_file(MODX_BASE_PATH.$target)) {
185
+            $target = MODX_BASE_PATH.$target;
186 186
             $login_tpl = file_get_contents($target);
187 187
         } elseif (is_file($target)) {
188 188
             $login_tpl = file_get_contents($target);
189
-        } elseif (is_file($theme_path . 'login.tpl')) {
190
-            $target = $theme_path . 'login.tpl';
189
+        } elseif (is_file($theme_path.'login.tpl')) {
190
+            $target = $theme_path.'login.tpl';
191 191
             $login_tpl = file_get_contents($target);
192
-        } elseif (is_file($theme_path . 'templates/actions/login.tpl')) {
193
-            $target = $theme_path . 'templates/actions/login.tpl';
192
+        } elseif (is_file($theme_path.'templates/actions/login.tpl')) {
193
+            $target = $theme_path.'templates/actions/login.tpl';
194 194
             $login_tpl = file_get_contents($target);
195
-        } elseif (is_file($theme_path . 'html/login.html')) { // ClipperCMS compatible
196
-            $target = $theme_path . 'html/login.html';
195
+        } elseif (is_file($theme_path.'html/login.html')) { // ClipperCMS compatible
196
+            $target = $theme_path.'html/login.html';
197 197
             $login_tpl = file_get_contents($target);
198 198
         } else {
199
-            $target = MODX_MANAGER_PATH . 'media/style/common/login.tpl';
199
+            $target = MODX_MANAGER_PATH.'media/style/common/login.tpl';
200 200
             $login_tpl = file_get_contents($target);
201 201
         }
202 202
     }
@@ -216,17 +216,17 @@  discard block
 block discarded – undo
216 216
     $modx->updateValidatedUserSession();
217 217
 
218 218
     // Update last action in table active_users
219
-    $itemid = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : '';
219
+    $itemid = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : '';
220 220
     $lasthittime = time();
221
-    $action = isset($_REQUEST['a']) ? (int)$_REQUEST['a'] : 1;
221
+    $action = isset($_REQUEST['a']) ? (int) $_REQUEST['a'] : 1;
222 222
 
223 223
     if ($action !== 1) {
224
-        if ((int)$itemid <= 0) {
224
+        if ((int) $itemid <= 0) {
225 225
             $itemid = null;
226 226
         }
227 227
         $sql = sprintf("REPLACE INTO %s (sid, internalKey, username, lasthit, action, id) VALUES ('%s', %d, '%s', %d, '%s', %s)",
228 228
             $modx->getDatabase()->getFullTableName('active_users') // Table
229
-            , session_id(), $modx->getLoginUserID(), $_SESSION['mgrShortname'], $lasthittime, (string)$action,
229
+            , session_id(), $modx->getLoginUserID(), $_SESSION['mgrShortname'], $lasthittime, (string) $action,
230 230
             $itemid == null ? var_export(null, true) : $itemid);
231 231
         $modx->getDatabase()->query($sql);
232 232
     }
Please login to merge, or discard this patch.
manager/includes/config_check.inc.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  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
 // PROCESSOR FIRST
7
-if($_SESSION['mgrRole'] == 1) {
8
-	if($_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) {
7
+if ($_SESSION['mgrRole'] == 1) {
8
+	if ($_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) {
9 9
 		$current = $modx->getManagerApi()->getSystemChecksum($modx->config['check_files_onlogin']);
10
-		if(!empty($current)) {
10
+		if (!empty($current)) {
11 11
 			$modx->getManagerApi()->setSystemChecksum($current);
12 12
 			$modx->clearCache('full');
13 13
 			$modx->config['sys_files_checksum'] = $current;
@@ -19,14 +19,14 @@  discard block
 block discarded – undo
19 19
 $warningspresent = 0;
20 20
 
21 21
 $sysfiles_check = $modx->getManagerApi()->checkSystemChecksum();
22
-if ($sysfiles_check!=='0'){
22
+if ($sysfiles_check !== '0') {
23 23
       $warningspresent = 1;
24 24
       $warnings[] = array($_lang['configcheck_sysfiles_mod']);
25 25
 }
26 26
 
27
-if (is_writable("includes/config.inc.php")){
27
+if (is_writable("includes/config.inc.php")) {
28 28
     // Warn if world writable
29
-    if(@fileperms('includes/config.inc.php') & 0x0002) {
29
+    if (@fileperms('includes/config.inc.php') & 0x0002) {
30 30
       $warningspresent = 1;
31 31
       $warnings[] = array($_lang['configcheck_configinc']);
32 32
     }
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
     $warnings[] = array($_lang['configcheck_php_gdzip']);
43 43
 }
44 44
 
45
-if(!isset($modx->config['_hide_configcheck_validate_referer']) || $modx->config['_hide_configcheck_validate_referer'] !== '1') {
46
-    if(isset($_SESSION['mgrPermissions']['settings']) && $_SESSION['mgrPermissions']['settings'] == '1') {
45
+if (!isset($modx->config['_hide_configcheck_validate_referer']) || $modx->config['_hide_configcheck_validate_referer'] !== '1') {
46
+    if (isset($_SESSION['mgrPermissions']['settings']) && $_SESSION['mgrPermissions']['settings'] == '1') {
47 47
         if ($modx->getDatabase()->getValue($modx->getDatabase()->select('COUNT(setting_value)', $modx->getDatabase()->getFullTableName('system_settings'), "setting_name='validate_referer' AND setting_value='0'"))) {
48 48
             $warningspresent = 1;
49 49
             $warnings[] = array($_lang['configcheck_validate_referer']);
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
 }
53 53
 
54 54
 // check for Template Switcher plugin
55
-if(!isset($modx->config['_hide_configcheck_templateswitcher_present']) || $modx->config['_hide_configcheck_templateswitcher_present'] !== '1') {
56
-    if(isset($_SESSION['mgrPermissions']['edit_plugin']) && $_SESSION['mgrPermissions']['edit_plugin'] == '1') {
55
+if (!isset($modx->config['_hide_configcheck_templateswitcher_present']) || $modx->config['_hide_configcheck_templateswitcher_present'] !== '1') {
56
+    if (isset($_SESSION['mgrPermissions']['edit_plugin']) && $_SESSION['mgrPermissions']['edit_plugin'] == '1') {
57 57
         $rs = $modx->getDatabase()->select('name, disabled', $modx->getDatabase()->getFullTableName('site_plugins'), "name IN ('TemplateSwitcher', 'Template Switcher', 'templateswitcher', 'template_switcher', 'template switcher') OR plugincode LIKE '%TemplateSwitcher%'");
58 58
         $row = $modx->getDatabase()->getRow($rs);
59
-        if($row && $row['disabled'] == 0) {
59
+        if ($row && $row['disabled'] == 0) {
60 60
             $warningspresent = 1;
61 61
             $warnings[] = array($_lang['configcheck_templateswitcher_present']);
62 62
             $tplName = $row['name'];
@@ -120,36 +120,36 @@  discard block
 block discarded – undo
120 120
     /**
121 121
      * @return bool
122 122
      */
123
-    function checkSiteCache() {
123
+    function checkSiteCache(){
124 124
         $modx = evolutionCMS();
125
-        $checked= true;
126
-        if (file_exists($modx->config['base_path'] . 'assets/cache/siteCache.idx.php')) {
127
-            $checked= @include_once ($modx->config['base_path'] . 'assets/cache/siteCache.idx.php');
125
+        $checked = true;
126
+        if (file_exists($modx->config['base_path'].'assets/cache/siteCache.idx.php')) {
127
+            $checked = @include_once ($modx->config['base_path'].'assets/cache/siteCache.idx.php');
128 128
         }
129 129
         return $checked;
130 130
     }
131 131
 }
132 132
 
133
-if (!is_writable(MODX_BASE_PATH . "assets/cache/")) {
133
+if (!is_writable(MODX_BASE_PATH."assets/cache/")) {
134 134
     $warningspresent = 1;
135 135
     $warnings[] = array($_lang['configcheck_cache']);
136 136
 }
137 137
 
138 138
 if (!checkSiteCache()) {
139 139
     $warningspresent = 1;
140
-    $warnings[]= array($lang['configcheck_sitecache_integrity']);
140
+    $warnings[] = array($lang['configcheck_sitecache_integrity']);
141 141
 }
142 142
 
143
-if (!is_writable(MODX_BASE_PATH . "assets/images/")) {
143
+if (!is_writable(MODX_BASE_PATH."assets/images/")) {
144 144
     $warningspresent = 1;
145 145
     $warnings[] = array($_lang['configcheck_images']);
146 146
 }
147 147
 
148
-if(strpos($modx->config['rb_base_dir'],MODX_BASE_PATH)!==0) {
148
+if (strpos($modx->config['rb_base_dir'], MODX_BASE_PATH) !== 0) {
149 149
     $warningspresent = 1;
150 150
     $warnings[] = array($_lang['configcheck_rb_base_dir']);
151 151
 }
152
-if(strpos($modx->config['filemanager_path'],MODX_BASE_PATH)!==0) {
152
+if (strpos($modx->config['filemanager_path'], MODX_BASE_PATH) !== 0) {
153 153
     $warningspresent = 1;
154 154
     $warnings[] = array($_lang['configcheck_filemanager_path']);
155 155
 }
@@ -157,36 +157,36 @@  discard block
 block discarded – undo
157 157
 // clear file info cache
158 158
 clearstatcache();
159 159
 
160
-if ($warningspresent==1) {
160
+if ($warningspresent == 1) {
161 161
 
162
-if(!isset($modx->config['send_errormail'])) $modx->config['send_errormail']='3';
162
+if (!isset($modx->config['send_errormail'])) $modx->config['send_errormail'] = '3';
163 163
 $config_check_results = "<h3>".$_lang['configcheck_notok']."</h3>";
164 164
 
165
-for ($i=0;$i<count($warnings);$i++) {
165
+for ($i = 0; $i < count($warnings); $i++) {
166 166
     switch ($warnings[$i][0]) {
167 167
         case $_lang['configcheck_configinc'];
168 168
             $warnings[$i][1] = $_lang['configcheck_configinc_msg'];
169
-            if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_configinc']);
169
+            if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 3, $warnings[$i][1], $_lang['configcheck_configinc']);
170 170
             break;
171 171
         case $_lang['configcheck_installer'] :
172 172
             $warnings[$i][1] = $_lang['configcheck_installer_msg'];
173
-            if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_installer']);
173
+            if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 3, $warnings[$i][1], $_lang['configcheck_installer']);
174 174
             break;
175 175
         case $_lang['configcheck_cache'] :
176 176
             $warnings[$i][1] = $_lang['configcheck_cache_msg'];
177
-            if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_cache']);
177
+            if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 2, $warnings[$i][1], $_lang['configcheck_cache']);
178 178
             break;
179 179
         case $_lang['configcheck_images'] :
180 180
             $warnings[$i][1] = $_lang['configcheck_images_msg'];
181
-            if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_images']);
181
+            if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 2, $warnings[$i][1], $_lang['configcheck_images']);
182 182
             break;
183 183
         case $_lang['configcheck_sysfiles_mod']:
184 184
             $warnings[$i][1] = $_lang["configcheck_sysfiles_mod_msg"];
185
-			$warnings[$i][2] = '<ul><li>'. implode('</li><li>', $sysfiles_check) .'</li></ul>';
186
-			if($modx->hasPermission('settings')) {
187
-				$warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\'' . $_lang["reset_sysfiles_checksum_alert"] . '\')">' . $_lang["reset_sysfiles_checksum_button"] . '</a></li></ul>';
185
+			$warnings[$i][2] = '<ul><li>'.implode('</li><li>', $sysfiles_check).'</li></ul>';
186
+			if ($modx->hasPermission('settings')) {
187
+				$warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\''.$_lang["reset_sysfiles_checksum_alert"].'\')">'.$_lang["reset_sysfiles_checksum_button"].'</a></li></ul>';
188 188
 			}
189
-            if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1]." ".implode(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']);
189
+            if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 3, $warnings[$i][1]." ".implode(', ', $sysfiles_check), $_lang['configcheck_sysfiles_mod']);
190 190
             break;
191 191
         case $_lang['configcheck_lang_difference'] :
192 192
             $warnings[$i][1] = $_lang['configcheck_lang_difference_msg'];
@@ -208,18 +208,18 @@  discard block
 block discarded – undo
208 208
             break;
209 209
         case $_lang['configcheck_validate_referer'] :
210 210
             $msg = $_lang['configcheck_validate_referer_msg'];
211
-            $msg .= '<br />' . sprintf($_lang["configcheck_hide_warning"], 'validate_referer');
211
+            $msg .= '<br />'.sprintf($_lang["configcheck_hide_warning"], 'validate_referer');
212 212
             $warnings[$i][1] = "<span id=\"validate_referer_warning_wrapper\">{$msg}</span>\n";
213 213
             break;
214 214
         case $_lang['configcheck_templateswitcher_present'] :
215 215
             $msg = $_lang["configcheck_templateswitcher_present_msg"];
216
-            if(isset($_SESSION['mgrPermissions']['save_plugin']) && $_SESSION['mgrPermissions']['save_plugin'] == '1') {
217
-                $msg .= '<br />' . $_lang["configcheck_templateswitcher_present_disable"];
216
+            if (isset($_SESSION['mgrPermissions']['save_plugin']) && $_SESSION['mgrPermissions']['save_plugin'] == '1') {
217
+                $msg .= '<br />'.$_lang["configcheck_templateswitcher_present_disable"];
218 218
             }
219
-            if(isset($_SESSION['mgrPermissions']['delete_plugin']) && $_SESSION['mgrPermissions']['delete_plugin'] == '1') {
220
-                $msg .= '<br />' . $_lang["configcheck_templateswitcher_present_delete"];
219
+            if (isset($_SESSION['mgrPermissions']['delete_plugin']) && $_SESSION['mgrPermissions']['delete_plugin'] == '1') {
220
+                $msg .= '<br />'.$_lang["configcheck_templateswitcher_present_delete"];
221 221
             }
222
-            $msg .= '<br />' . sprintf($_lang["configcheck_hide_warning"], 'templateswitcher_present');
222
+            $msg .= '<br />'.sprintf($_lang["configcheck_hide_warning"], 'templateswitcher_present');
223 223
             $warnings[$i][1] = "<span id=\"templateswitcher_present_warning_wrapper\">{$msg}</span>\n";
224 224
             break;
225 225
         case $_lang['configcheck_rb_base_dir'] :
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
             $warnings[$i][1] = $_lang['configcheck_default_msg'];
233 233
     }
234 234
 
235
-    $admin_warning = $_SESSION['mgrRole']!=1 ? $_lang['configcheck_admin'] : "" ;
235
+    $admin_warning = $_SESSION['mgrRole'] != 1 ? $_lang['configcheck_admin'] : "";
236 236
     $config_check_results .= "
237 237
             <fieldset>
238 238
             <p><strong>".$_lang['configcheck_warning']."</strong> '".$warnings[$i][0]."'</p>
@@ -241,11 +241,11 @@  discard block
 block discarded – undo
241 241
             ".(isset($warnings[$i][2]) ? '<div style="padding-left:1em">'.$warnings[$i][2].'</div>' : '')."
242 242
             </fieldset>
243 243
 ";
244
-        if ($i!=count($warnings)-1) {
244
+        if ($i != count($warnings) - 1) {
245 245
             $config_check_results .= "<br />";
246 246
         }
247 247
     }
248
-    $_SESSION["mgrConfigCheck"]=true;
248
+    $_SESSION["mgrConfigCheck"] = true;
249 249
 } else {
250 250
     $config_check_results = $_lang['configcheck_ok'];
251 251
 }
Please login to merge, or discard this patch.
manager/includes/mutate_settings.ajax.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
7 7
 }
8 8
 
9
-require_once(dirname(__FILE__) . '/protect.inc.php');
9
+require_once(dirname(__FILE__).'/protect.inc.php');
10 10
 
11 11
 $action = preg_replace('/[^A-Za-z0-9_\-\.\/]/', '', $_POST['action']);
12 12
 $lang = preg_replace('/[^A-Za-z0-9_\s\+\-\.\/]/', '', $_POST['lang']);
@@ -23,13 +23,13 @@  discard block
 block discarded – undo
23 23
 
24 24
 switch (true) {
25 25
     case ($action == 'get' && preg_match('/^[A-z0-9_-]+$/',
26
-            $lang) && file_exists(dirname(__FILE__) . '/lang/' . $lang . '.inc.php')): {
27
-        include(dirname(__FILE__) . '/lang/' . $lang . '.inc.php');
26
+            $lang) && file_exists(dirname(__FILE__).'/lang/'.$lang.'.inc.php')): {
27
+        include(dirname(__FILE__).'/lang/'.$lang.'.inc.php');
28 28
         $str = isset($key, $_lang, $_lang[$key]) ? $_lang[$key] : "";
29 29
         break;
30 30
     }
31 31
     case ($action == 'setsetting' && !empty($key) && !empty($value)): {
32
-        $sql = "REPLACE INTO " . $modx->getDatabase()->getFullTableName("system_settings") . " (setting_name, setting_value) VALUES('{$key}', '{$value}');";
32
+        $sql = "REPLACE INTO ".$modx->getDatabase()->getFullTableName("system_settings")." (setting_name, setting_value) VALUES('{$key}', '{$value}');";
33 33
         $str = "true";
34 34
         $modx->getDatabase()->query($sql);
35 35
         $emptyCache = true;
Please login to merge, or discard this patch.
manager/includes/extenders/modifiers/mdf_memberof.inc.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -2,29 +2,29 @@
 block discarded – undo
2 2
 $userID = abs($modx->getLoginUserID('web'));
3 3
 $modx->qs_hash = md5($modx->qs_hash."^{$userID}^");
4 4
 
5
-$groupNames = ($this->strlen($opt) > 0 ) ? explode(',',$opt) : array();
5
+$groupNames = ($this->strlen($opt) > 0) ? explode(',', $opt) : array();
6 6
 
7 7
 // if $groupNames is not an array return false
8
-if(!is_array($groupNames)) return 0;
8
+if (!is_array($groupNames)) return 0;
9 9
 
10 10
 // Creates an array with all webgroups the user id is in
11 11
 if (isset($modx->getModifiers()->cache['mo'][$userID])) $grpNames = $modx->getModifiers()->cache['mo'][$userID];
12 12
 else {
13 13
     $from = sprintf(
14
-        $modx->getDatabase()->getFullTableName('webgroup_names') .
15
-        " wgn INNER JOIN " .
16
-        $modx->getDatabase()->getFullTableName('web_groups') .
14
+        $modx->getDatabase()->getFullTableName('webgroup_names').
15
+        " wgn INNER JOIN ".
16
+        $modx->getDatabase()->getFullTableName('web_groups').
17 17
         " wg ON wg.webgroup=wgn.id AND wg.webuser='%s'",
18 18
 
19 19
         $userID
20 20
     );
21
-    $rs = $modx->getDatabase()->select('wgn.name',$from);
22
-    $modx->getModifiers()->cache['mo'][$userID] = $grpNames = $modx->getDatabase()->getColumn('name',$rs);
21
+    $rs = $modx->getDatabase()->select('wgn.name', $from);
22
+    $modx->getModifiers()->cache['mo'][$userID] = $grpNames = $modx->getDatabase()->getColumn('name', $rs);
23 23
 }
24 24
 
25 25
 // Check if a supplied group matches a webgroup from the array we just created
26
-foreach($groupNames as $k=>$v) {
27
-    if(in_array(trim($v),$grpNames)) return 1;
26
+foreach ($groupNames as $k=>$v) {
27
+    if (in_array(trim($v), $grpNames)) return 1;
28 28
 }
29 29
 
30 30
 // If we get here the above logic did not find a match, so return false
Please login to merge, or discard this patch.
manager/includes/categories.inc.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
     $newCat = $modx->getDatabase()->escape($newCat);
35 35
     $cats = $modx->getDatabase()->select('id', $modx->getDatabase()->getFullTableName('categories'), "category='{$newCat}'");
36 36
     if ($cat = $modx->getDatabase()->getValue($cats)) {
37
-        return (int)$cat;
37
+        return (int) $cat;
38 38
     }
39 39
 
40 40
     return 0;
Please login to merge, or discard this patch.
manager/includes/src/Core.php 1 patch
Spacing   +274 added lines, -274 removed lines patch added patch discarded remove patch
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
         if (empty($services)) {
173 173
             $services   = include EVO_SERVICES_FILE;
174 174
         }
175
-        $this->services     =  $services;
175
+        $this->services = $services;
176 176
 
177 177
         $this->initialize();
178 178
     }
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 
237 237
     private function checkServiceAlias($name){
238 238
         foreach ($this->providerAliases as $alias => $interface) {
239
-            if($name === $interface) {
239
+            if ($name === $interface) {
240 240
                 return $alias;
241 241
             }
242 242
         }
@@ -415,8 +415,8 @@  discard block
 block discarded – undo
415 415
         if (isset($this->providerAliases[$name])) {
416 416
             if ($this->getConfig('error_reporting', 0) > 1) {
417 417
                 trigger_error(
418
-                    'Property $' . $name . ' is deprecated and should no longer be used. ' .
419
-                    'Alternative ->getService(' . $this->providerAliases[$name] . '::class)',
418
+                    'Property $'.$name.' is deprecated and should no longer be used. '.
419
+                    'Alternative ->getService('.$this->providerAliases[$name].'::class)',
420 420
                     E_USER_DEPRECATED
421 421
                 );
422 422
             }
@@ -452,12 +452,12 @@  discard block
 block discarded – undo
452 452
             $info = debug_backtrace();
453 453
             $m[] = $msg;
454 454
             if (!empty($this->currentSnippet)) {
455
-                $m[] = 'Snippet - ' . $this->currentSnippet;
455
+                $m[] = 'Snippet - '.$this->currentSnippet;
456 456
             } elseif (!empty($this->event->activePlugin)) {
457
-                $m[] = 'Plugin - ' . $this->event->activePlugin;
457
+                $m[] = 'Plugin - '.$this->event->activePlugin;
458 458
             }
459 459
             $m[] = $this->decoded_request_uri;
460
-            $m[] = str_replace('\\', '/', $info[0]['file']) . '(line:' . $info[0]['line'] . ')';
460
+            $m[] = str_replace('\\', '/', $info[0]['file']).'(line:'.$info[0]['line'].')';
461 461
             $msg = implode('<br />', $m);
462 462
             $this->logEvent(0, $error_type, $msg, $title);
463 463
         }
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
     {
475 475
         $flag = false;
476 476
         if (is_scalar($connector) && !empty($connector) && isset($this->{$connector}) && $this->{$connector} instanceof Interfaces\DatabaseInterface) {
477
-            $flag = (bool)$this->{$connector}->conn;
477
+            $flag = (bool) $this->{$connector}->conn;
478 478
         }
479 479
         return $flag;
480 480
     }
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
             }
506 506
             if (!$out && $flag) {
507 507
                 $extname = trim(str_replace(array('..', '/', '\\'), '', strtolower($extname)));
508
-                $filename = MODX_MANAGER_PATH . "includes/extenders/ex_{$extname}.inc.php";
508
+                $filename = MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php";
509 509
                 $out = is_file($filename) ? include $filename : false;
510 510
             }
511 511
             if ($out && !in_array($extname, $this->extensions)) {
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
     public function getMicroTime()
524 524
     {
525 525
         list ($usec, $sec) = explode(' ', microtime());
526
-        return ((float)$usec + (float)$sec);
526
+        return ((float) $usec + (float) $sec);
527 527
     }
528 528
 
529 529
     /**
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
             // append the redirect count string to the url
548 548
             $currentNumberOfRedirects = isset ($_REQUEST['err']) ? $_REQUEST['err'] : 0;
549 549
             if ($currentNumberOfRedirects > 3) {
550
-                $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>' . $url . '</i></p>');
550
+                $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>'.$url.'</i></p>');
551 551
             } else {
552 552
                 $currentNumberOfRedirects += 1;
553 553
                 if (strpos($url, "?") > 0) {
@@ -558,9 +558,9 @@  discard block
 block discarded – undo
558 558
             }
559 559
         }
560 560
         if ($type == 'REDIRECT_REFRESH') {
561
-            $header = 'Refresh: 0;URL=' . $url;
561
+            $header = 'Refresh: 0;URL='.$url;
562 562
         } elseif ($type == 'REDIRECT_META') {
563
-            $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=' . $url . '" />';
563
+            $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL='.$url.'" />';
564 564
             echo $header;
565 565
             exit;
566 566
         } elseif ($type == 'REDIRECT_HEADER' || empty ($type)) {
@@ -568,10 +568,10 @@  discard block
 block discarded – undo
568 568
             global $base_url, $site_url;
569 569
             if (substr($url, 0, strlen($base_url)) == $base_url) {
570 570
                 // append $site_url to make it work with Location:
571
-                $url = $site_url . substr($url, strlen($base_url));
571
+                $url = $site_url.substr($url, strlen($base_url));
572 572
             }
573 573
             if (strpos($url, "\n") === false) {
574
-                $header = 'Location: ' . $url;
574
+                $header = 'Location: '.$url;
575 575
             } else {
576 576
                 $this->messageQuit('No newline allowed in redirect url.');
577 577
             }
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
             header($responseCode);
581 581
         }
582 582
 
583
-        if(!empty($header)) {
583
+        if (!empty($header)) {
584 584
             header($header);
585 585
         }
586 586
 
@@ -685,8 +685,8 @@  discard block
 block discarded – undo
685 685
 
686 686
     private function recoverySiteCache()
687 687
     {
688
-        $site_cache_dir = MODX_BASE_PATH . $this->getCacheFolder();
689
-        $site_cache_path = $site_cache_dir . 'siteCache.idx.php';
688
+        $site_cache_dir = MODX_BASE_PATH.$this->getCacheFolder();
689
+        $site_cache_path = $site_cache_dir.'siteCache.idx.php';
690 690
 
691 691
         if (is_file($site_cache_path)) {
692 692
             include($site_cache_path);
@@ -749,8 +749,8 @@  discard block
 block discarded – undo
749 749
                 $this->invokeEvent("OnBeforeManagerPageInit");
750 750
             }
751 751
 
752
-            if (isset ($_SESSION[$usrType . 'UsrConfigSet'])) {
753
-                $usrSettings = &$_SESSION[$usrType . 'UsrConfigSet'];
752
+            if (isset ($_SESSION[$usrType.'UsrConfigSet'])) {
753
+                $usrSettings = &$_SESSION[$usrType.'UsrConfigSet'];
754 754
             } else {
755 755
                 if ($usrType == 'web') {
756 756
                     $from = $tbl_web_user_settings;
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
                     $usrSettings[$row['setting_name']] = $row['setting_value'];
771 771
                 }
772 772
                 if (isset ($usrType)) {
773
-                    $_SESSION[$usrType . 'UsrConfigSet'] = $usrSettings;
773
+                    $_SESSION[$usrType.'UsrConfigSet'] = $usrSettings;
774 774
                 } // store user settings in session
775 775
             }
776 776
         }
@@ -915,10 +915,10 @@  discard block
 block discarded – undo
915 915
         $suf = $this->config['friendly_url_suffix'];
916 916
         $pre = preg_quote($pre, '/');
917 917
         $suf = preg_quote($suf, '/');
918
-        if ($pre && preg_match('@^' . $pre . '(.*)$@', $q, $_)) {
918
+        if ($pre && preg_match('@^'.$pre.'(.*)$@', $q, $_)) {
919 919
             $q = $_[1];
920 920
         }
921
-        if ($suf && preg_match('@(.*)' . $suf . '$@', $q, $_)) {
921
+        if ($suf && preg_match('@(.*)'.$suf.'$@', $q, $_)) {
922 922
             $q = $_[1];
923 923
         }
924 924
 
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
         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 */
941 941
             /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */
942 942
             if ($this->config['use_alias_path'] == 1) {
943
-                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))))) {
943
+                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))))) {
944 944
                     $this->documentMethod = 'id';
945 945
                     return $q;
946 946
                 } else { /* not a valid id in terms of virtualDir, treat as alias */
@@ -974,7 +974,7 @@  discard block
 block discarded – undo
974 974
      */
975 975
     public function getHashFile($key)
976 976
     {
977
-        return $this->getCacheFolder() . "docid_" . $key . ".pageCache.php";
977
+        return $this->getCacheFolder()."docid_".$key.".pageCache.php";
978 978
     }
979 979
 
980 980
     /**
@@ -985,9 +985,9 @@  discard block
 block discarded – undo
985 985
         $hash = $id;
986 986
         $tmp = null;
987 987
         $params = array();
988
-        if(!empty($this->systemCacheKey)){
988
+        if (!empty($this->systemCacheKey)) {
989 989
             $hash = $this->systemCacheKey;
990
-        }else {
990
+        } else {
991 991
             if (!empty($_GET)) {
992 992
                 // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID.
993 993
                 $params = $_GET;
@@ -995,8 +995,8 @@  discard block
 block discarded – undo
995 995
                 $hash .= '_'.md5(http_build_query($params));
996 996
             }
997 997
         }
998
-        $evtOut = $this->invokeEvent("OnMakePageCacheKey", array ("hash" => $hash, "id" => $id, 'params' => $params));
999
-        if (is_array($evtOut) && count($evtOut) > 0){
998
+        $evtOut = $this->invokeEvent("OnMakePageCacheKey", array("hash" => $hash, "id" => $id, 'params' => $params));
999
+        if (is_array($evtOut) && count($evtOut) > 0) {
1000 1000
             $tmp = array_pop($evtOut);
1001 1001
         }
1002 1002
         return empty($tmp) ? $hash : $tmp;
@@ -1144,12 +1144,12 @@  discard block
 block discarded – undo
1144 1144
         if ($js = $this->getRegisteredClientStartupScripts()) {
1145 1145
             // change to just before closing </head>
1146 1146
             // $this->documentContent = preg_replace("/(<head[^>]*>)/i", "\\1\n".$js, $this->documentContent);
1147
-            $this->documentOutput = preg_replace("/(<\/head>)/i", $js . "\n\\1", $this->documentOutput);
1147
+            $this->documentOutput = preg_replace("/(<\/head>)/i", $js."\n\\1", $this->documentOutput);
1148 1148
         }
1149 1149
 
1150 1150
         // Insert jscripts & html block into template - template must have a </body> tag
1151 1151
         if ($js = $this->getRegisteredClientScripts()) {
1152
-            $this->documentOutput = preg_replace("/(<\/body>)/i", $js . "\n\\1", $this->documentOutput);
1152
+            $this->documentOutput = preg_replace("/(<\/body>)/i", $js."\n\\1", $this->documentOutput);
1153 1153
         }
1154 1154
         // End fix by sirlancelot
1155 1155
 
@@ -1160,7 +1160,7 @@  discard block
 block discarded – undo
1160 1160
         // send out content-type and content-disposition headers
1161 1161
         if (IN_PARSER_MODE == "true") {
1162 1162
             $type = !empty ($this->contentTypes[$this->documentIdentifier]) ? $this->contentTypes[$this->documentIdentifier] : "text/html";
1163
-            header('Content-Type: ' . $type . '; charset=' . $this->config['modx_charset']);
1163
+            header('Content-Type: '.$type.'; charset='.$this->config['modx_charset']);
1164 1164
             //            if (($this->documentIdentifier == $this->config['error_page']) || $redirect_error)
1165 1165
             //                header('HTTP/1.0 404 Not Found');
1166 1166
             if (!$this->checkPreview() && $this->documentObject['content_dispo'] == 1) {
@@ -1178,7 +1178,7 @@  discard block
 block discarded – undo
1178 1178
                     $name = preg_replace('|-+|', '-', $name);
1179 1179
                     $name = trim($name, '-');
1180 1180
                 }
1181
-                $header = 'Content-Disposition: attachment; filename=' . $name;
1181
+                $header = 'Content-Disposition: attachment; filename='.$name;
1182 1182
                 header($header);
1183 1183
             }
1184 1184
         }
@@ -1186,7 +1186,7 @@  discard block
 block discarded – undo
1186 1186
 
1187 1187
         $stats = $this->getTimerStats($this->tstart);
1188 1188
 
1189
-        $out =& $this->documentOutput;
1189
+        $out = & $this->documentOutput;
1190 1190
         $out = str_replace("[^q^]", $stats['queries'], $out);
1191 1191
         $out = str_replace("[^qt^]", $stats['queryTime'], $out);
1192 1192
         $out = str_replace("[^p^]", $stats['phpTime'], $out);
@@ -1225,17 +1225,17 @@  discard block
 block discarded – undo
1225 1225
                 $sc .= sprintf("%s. %s (%s)<br>", $s, $sname, sprintf("%2.2f ms", $t)); // currentSnippet
1226 1226
                 $tt += $t;
1227 1227
             }
1228
-            echo "<fieldset><legend><b>Snippets</b> (" . count($this->snippetsTime) . " / " . sprintf("%2.2f ms", $tt) . ")</legend>{$sc}</fieldset><br />";
1228
+            echo "<fieldset><legend><b>Snippets</b> (".count($this->snippetsTime)." / ".sprintf("%2.2f ms", $tt).")</legend>{$sc}</fieldset><br />";
1229 1229
             echo $this->snippetsCode;
1230 1230
         }
1231 1231
         if ($this->dumpPlugins) {
1232 1232
             $ps = "";
1233 1233
             $tt = 0;
1234 1234
             foreach ($this->pluginsTime as $s => $t) {
1235
-                $ps .= "$s (" . sprintf("%2.2f ms", $t * 1000) . ")<br>";
1235
+                $ps .= "$s (".sprintf("%2.2f ms", $t * 1000).")<br>";
1236 1236
                 $tt += $t;
1237 1237
             }
1238
-            echo "<fieldset><legend><b>Plugins</b> (" . count($this->pluginsTime) . " / " . sprintf("%2.2f ms", $tt * 1000) . ")</legend>{$ps}</fieldset><br />";
1238
+            echo "<fieldset><legend><b>Plugins</b> (".count($this->pluginsTime)." / ".sprintf("%2.2f ms", $tt * 1000).")</legend>{$ps}</fieldset><br />";
1239 1239
             echo $this->pluginsCode;
1240 1240
         }
1241 1241
 
@@ -1261,7 +1261,7 @@  discard block
 block discarded – undo
1261 1261
         $srcTags = explode(',', $tags);
1262 1262
         $repTags = array();
1263 1263
         foreach ($srcTags as $tag) {
1264
-            $repTags[] = '\\' . $tag[0] . '\\' . $tag[1];
1264
+            $repTags[] = '\\'.$tag[0].'\\'.$tag[1];
1265 1265
         }
1266 1266
         return array($srcTags, $repTags);
1267 1267
     }
@@ -1283,7 +1283,7 @@  discard block
 block discarded – undo
1283 1283
         $stats['phpTime'] = sprintf("%2.4f s", $stats['phpTime']);
1284 1284
         $stats['source'] = $this->documentGenerated == 1 ? "database" : "cache";
1285 1285
         $stats['queries'] = isset ($this->executedQueries) ? $this->executedQueries : 0;
1286
-        $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024) . " mb";
1286
+        $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024)." mb";
1287 1287
 
1288 1288
         return $stats;
1289 1289
     }
@@ -1316,7 +1316,7 @@  discard block
 block discarded – undo
1316 1316
     {
1317 1317
         $cacheRefreshTime = 0;
1318 1318
         $recent_update = 0;
1319
-        @include(MODX_BASE_PATH . $this->getCacheFolder() . 'sitePublishing.idx.php');
1319
+        @include(MODX_BASE_PATH.$this->getCacheFolder().'sitePublishing.idx.php');
1320 1320
         $this->recentUpdate = $recent_update;
1321 1321
 
1322 1322
         $timeNow = $_SERVER['REQUEST_TIME'] + $this->config['server_offset_time'];
@@ -1398,8 +1398,8 @@  discard block
 block discarded – undo
1398 1398
                 }
1399 1399
 
1400 1400
                 $docObjSerial = serialize($this->documentObject);
1401
-                $cacheContent = $docObjSerial . "<!--__MODxCacheSpliter__-->" . $this->documentContent;
1402
-                $page_cache_path = MODX_BASE_PATH . $this->getHashFile($this->cacheKey);
1401
+                $cacheContent = $docObjSerial."<!--__MODxCacheSpliter__-->".$this->documentContent;
1402
+                $page_cache_path = MODX_BASE_PATH.$this->getHashFile($this->cacheKey);
1403 1403
                 file_put_contents($page_cache_path, "<?php die('Unauthorized access.'); ?>$cacheContent");
1404 1404
             }
1405 1405
         }
@@ -1441,16 +1441,16 @@  discard block
 block discarded – undo
1441 1441
             return array();
1442 1442
         }
1443 1443
         $spacer = md5('<<<EVO>>>');
1444
-        if($left==='{{' && strpos($content,';}}')!==false)  $content = str_replace(';}}', sprintf(';}%s}',   $spacer),$content);
1445
-        if($left==='{{' && strpos($content,'{{}}')!==false) $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content);
1446
-        if($left==='[[' && strpos($content,']]]]')!==false) $content = str_replace(']]]]',sprintf(']]%s]]',  $spacer),$content);
1447
-        if($left==='[[' && strpos($content,']]]')!==false)  $content = str_replace(']]]', sprintf(']%s]]',   $spacer),$content);
1444
+        if ($left === '{{' && strpos($content, ';}}') !== false)  $content = str_replace(';}}', sprintf(';}%s}', $spacer), $content);
1445
+        if ($left === '{{' && strpos($content, '{{}}') !== false) $content = str_replace('{{}}', sprintf('{%$1s{}%$1s}', $spacer), $content);
1446
+        if ($left === '[[' && strpos($content, ']]]]') !== false) $content = str_replace(']]]]', sprintf(']]%s]]', $spacer), $content);
1447
+        if ($left === '[[' && strpos($content, ']]]') !== false)  $content = str_replace(']]]', sprintf(']%s]]', $spacer), $content);
1448 1448
 
1449 1449
         $pos['<![CDATA['] = strpos($content, '<![CDATA[');
1450 1450
         $pos[']]>'] = strpos($content, ']]>');
1451 1451
 
1452 1452
         if ($pos['<![CDATA['] !== false && $pos[']]>'] !== false) {
1453
-            $content = substr($content, 0, $pos['<![CDATA[']) . substr($content, $pos[']]>'] + 3);
1453
+            $content = substr($content, 0, $pos['<![CDATA[']).substr($content, $pos[']]>'] + 3);
1454 1454
         }
1455 1455
 
1456 1456
         $lp = explode($left, $content);
@@ -1514,8 +1514,8 @@  discard block
 block discarded – undo
1514 1514
                 }
1515 1515
             }
1516 1516
         }
1517
-        foreach($tags as $i=>$tag) {
1518
-            if(strpos($tag,$spacer)!==false) $tags[$i] = str_replace($spacer, '', $tag);
1517
+        foreach ($tags as $i=>$tag) {
1518
+            if (strpos($tag, $spacer) !== false) $tags[$i] = str_replace($spacer, '', $tag);
1519 1519
         }
1520 1520
         return $tags;
1521 1521
     }
@@ -1555,7 +1555,7 @@  discard block
 block discarded – undo
1555 1555
         }
1556 1556
 
1557 1557
         foreach ($matches[1] as $i => $key) {
1558
-            if(strpos($key,'[+')!==false) continue; // Allow chunk {{chunk?&param=`xxx`}} with [*tv_name_[+param+]*] as content
1558
+            if (strpos($key, '[+') !== false) continue; // Allow chunk {{chunk?&param=`xxx`}} with [*tv_name_[+param+]*] as content
1559 1559
             if (substr($key, 0, 1) == '#') {
1560 1560
                 $key = substr($key, 1);
1561 1561
             } // remove # for QuickEdit format
@@ -1585,8 +1585,8 @@  discard block
 block discarded – undo
1585 1585
 
1586 1586
             if (strpos($content, $s) !== false) {
1587 1587
                 $content = str_replace($s, $value, $content);
1588
-            } elseif($this->debug) {
1589
-                $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1588
+            } elseif ($this->debug) {
1589
+                $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1590 1590
             }
1591 1591
         }
1592 1592
 
@@ -1753,8 +1753,8 @@  discard block
 block discarded – undo
1753 1753
             $s = &$matches[0][$i];
1754 1754
             if (strpos($content, $s) !== false) {
1755 1755
                 $content = str_replace($s, $value, $content);
1756
-            } elseif($this->debug) {
1757
-                $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1756
+            } elseif ($this->debug) {
1757
+                $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1758 1758
             }
1759 1759
         }
1760 1760
         return $content;
@@ -1807,7 +1807,7 @@  discard block
 block discarded – undo
1807 1807
             }
1808 1808
 
1809 1809
             $value = $this->parseText($value, $params); // parse local scope placeholers for ConditionalTags
1810
-            $value = $this->mergePlaceholderContent($value, $params);  // parse page global placeholers
1810
+            $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers
1811 1811
             if ($this->config['enable_at_syntax']) {
1812 1812
                 $value = $this->mergeConditionalTagsContent($value);
1813 1813
             }
@@ -1822,8 +1822,8 @@  discard block
 block discarded – undo
1822 1822
             $s = &$matches[0][$i];
1823 1823
             if (strpos($content, $s) !== false) {
1824 1824
                 $content = str_replace($s, $value, $content);
1825
-            } elseif($this->debug) {
1826
-                $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1825
+            } elseif ($this->debug) {
1826
+                $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1827 1827
             }
1828 1828
         }
1829 1829
         return $content;
@@ -1881,8 +1881,8 @@  discard block
 block discarded – undo
1881 1881
             $s = &$matches[0][$i];
1882 1882
             if (strpos($content, $s) !== false) {
1883 1883
                 $content = str_replace($s, $value, $content);
1884
-            } elseif($this->debug) {
1885
-                $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1884
+            } elseif ($this->debug) {
1885
+                $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1886 1886
             }
1887 1887
         }
1888 1888
         return $content;
@@ -1906,7 +1906,7 @@  discard block
 block discarded – undo
1906 1906
             return $content;
1907 1907
         }
1908 1908
 
1909
-        $sp = '#' . md5('ConditionalTags' . $_SERVER['REQUEST_TIME']) . '#';
1909
+        $sp = '#'.md5('ConditionalTags'.$_SERVER['REQUEST_TIME']).'#';
1910 1910
         $content = str_replace(array('<?php', '<?=', '<?', '?>'), array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), $content);
1911 1911
 
1912 1912
         $pieces = explode('<@IF:', $content);
@@ -1917,7 +1917,7 @@  discard block
 block discarded – undo
1917 1917
             }
1918 1918
             list($cmd, $text) = explode('>', $split, 2);
1919 1919
             $cmd = str_replace("'", "\'", $cmd);
1920
-            $content .= "<?php if(\$this->_parseCTagCMD('" . $cmd . "')): ?>";
1920
+            $content .= "<?php if(\$this->_parseCTagCMD('".$cmd."')): ?>";
1921 1921
             $content .= $text;
1922 1922
         }
1923 1923
         $pieces = explode('<@ELSEIF:', $content);
@@ -1928,13 +1928,13 @@  discard block
 block discarded – undo
1928 1928
             }
1929 1929
             list($cmd, $text) = explode('>', $split, 2);
1930 1930
             $cmd = str_replace("'", "\'", $cmd);
1931
-            $content .= "<?php elseif(\$this->_parseCTagCMD('" . $cmd . "')): ?>";
1931
+            $content .= "<?php elseif(\$this->_parseCTagCMD('".$cmd."')): ?>";
1932 1932
             $content .= $text;
1933 1933
         }
1934 1934
 
1935 1935
         $content = str_replace(array('<@ELSE>', '<@ENDIF>'), array('<?php else:?>', '<?php endif;?>'), $content);
1936 1936
         ob_start();
1937
-        $content = eval('?>' . $content);
1937
+        $content = eval('?>'.$content);
1938 1938
         $content = ob_get_clean();
1939 1939
         $content = str_replace(array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), array('<?php', '<?=', '<?', '?>'), $content);
1940 1940
 
@@ -2059,7 +2059,7 @@  discard block
 block discarded – undo
2059 2059
         $matches = $this->getTagsFromContent($content, $left, $right);
2060 2060
         if (!empty($matches)) {
2061 2061
             foreach ($matches[0] as $i => $v) {
2062
-                $addBreakMatches[$i] = $v . "\n";
2062
+                $addBreakMatches[$i] = $v."\n";
2063 2063
             }
2064 2064
             $content = str_replace($addBreakMatches, '', $content);
2065 2065
             if (strpos($content, $left) !== false) {
@@ -2092,8 +2092,8 @@  discard block
 block discarded – undo
2092 2092
             $s = &$matches[0][$i];
2093 2093
             if (strpos($content, $s) !== false) {
2094 2094
                 $content = str_replace($s, $v, $content);
2095
-            } elseif($this->debug) {
2096
-                $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
2095
+            } elseif ($this->debug) {
2096
+                $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
2097 2097
             }
2098 2098
         }
2099 2099
         return $content;
@@ -2157,7 +2157,7 @@  discard block
 block discarded – undo
2157 2157
                 $msg = ($msg === false) ? 'ob_get_contents() error' : $msg;
2158 2158
                 $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Plugin', $error_info['message'], $error_info['line'], $msg);
2159 2159
                 if ($this->isBackend()) {
2160
-                    $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>' . $msg . '</p>');
2160
+                    $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>'.$msg.'</p>');
2161 2161
                 }
2162 2162
             }
2163 2163
         } else {
@@ -2206,7 +2206,7 @@  discard block
 block discarded – undo
2206 2206
                 $echo = ($echo === false) ? 'ob_get_contents() error' : $echo;
2207 2207
                 $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Snippet', $error_info['message'], $error_info['line'], $echo);
2208 2208
                 if ($this->isBackend()) {
2209
-                    $this->event->alert('An error occurred while loading. Please see the event log for more information<p>' . $echo . $return . '</p>');
2209
+                    $this->event->alert('An error occurred while loading. Please see the event log for more information<p>'.$echo.$return.'</p>');
2210 2210
                 }
2211 2211
             }
2212 2212
         }
@@ -2214,7 +2214,7 @@  discard block
 block discarded – undo
2214 2214
         if (is_array($return) || is_object($return)) {
2215 2215
             return $return;
2216 2216
         } else {
2217
-            return $echo . $return;
2217
+            return $echo.$return;
2218 2218
         }
2219 2219
     }
2220 2220
 
@@ -2252,8 +2252,8 @@  discard block
 block discarded – undo
2252 2252
                 }
2253 2253
                 if (strpos($content, $s) !== false) {
2254 2254
                     $content = str_replace($s, $value, $content);
2255
-                } elseif($this->debug) {
2256
-                    $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'] . $s, 2);
2255
+                } elseif ($this->debug) {
2256
+                    $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'].$s, 2);
2257 2257
                 }
2258 2258
                 continue;
2259 2259
             }
@@ -2264,8 +2264,8 @@  discard block
 block discarded – undo
2264 2264
 
2265 2265
             if (strpos($content, $s) !== false) {
2266 2266
                 $content = str_replace($s, $value, $content);
2267
-            } elseif($this->debug) {
2268
-                $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'] . $s, 2);
2267
+            } elseif ($this->debug) {
2268
+                $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'].$s, 2);
2269 2269
             }
2270 2270
         }
2271 2271
 
@@ -2356,7 +2356,7 @@  discard block
 block discarded – undo
2356 2356
             $eventtime = sprintf('%2.2f ms', $eventtime * 1000);
2357 2357
             $code = str_replace("\t", '  ', $this->getPhpCompat()->htmlspecialchars($value));
2358 2358
             $piece = str_replace("\t", '  ', $this->getPhpCompat()->htmlspecialchars($piece));
2359
-            $print_r_params = str_replace("\t", '  ', $this->getPhpCompat()->htmlspecialchars('$modx->event->params = ' . print_r($params, true)));
2359
+            $print_r_params = str_replace("\t", '  ', $this->getPhpCompat()->htmlspecialchars('$modx->event->params = '.print_r($params, true)));
2360 2360
             $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);
2361 2361
             $this->snippetsTime[] = array('sname' => $key, 'time' => $eventtime);
2362 2362
         }
@@ -2605,7 +2605,7 @@  discard block
 block discarded – undo
2605 2605
             );
2606 2606
             $count = $this->getDatabase()->getRecordCount($rs);
2607 2607
             if (1 < $count) {
2608
-                exit('Error $modx->_getSnippetObject()' . $snip_name);
2608
+                exit('Error $modx->_getSnippetObject()'.$snip_name);
2609 2609
             }
2610 2610
             if ($count) {
2611 2611
                 $row = $this->getDatabase()->getRow($rs);
@@ -2631,7 +2631,7 @@  discard block
 block discarded – undo
2631 2631
     public function toAlias($text)
2632 2632
     {
2633 2633
         $suff = $this->config['friendly_url_suffix'];
2634
-        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);
2634
+        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);
2635 2635
     }
2636 2636
 
2637 2637
     /**
@@ -2663,7 +2663,7 @@  discard block
 block discarded – undo
2663 2663
                 $suff = '/';
2664 2664
             }
2665 2665
 
2666
-            $url = ($dir != '' ? $dir . '/' : '') . $pre . $alias . $suff;
2666
+            $url = ($dir != '' ? $dir.'/' : '').$pre.$alias.$suff;
2667 2667
         }
2668 2668
 
2669 2669
         $evtOut = $this->invokeEvent('OnMakeDocUrl', array(
@@ -2700,7 +2700,7 @@  discard block
 block discarded – undo
2700 2700
                 preg_match_all('!\[\~([0-9]+)\~\]!ise', $documentSource, $match);
2701 2701
                 $ids = implode(',', array_unique($match['1']));
2702 2702
                 if ($ids) {
2703
-                    $res = $this->getDatabase()->select("id,alias,isfolder,parent,alias_visible", $this->getDatabase()->getFullTableName('site_content'), "id IN (" . $ids . ") AND isfolder = '0'");
2703
+                    $res = $this->getDatabase()->select("id,alias,isfolder,parent,alias_visible", $this->getDatabase()->getFullTableName('site_content'), "id IN (".$ids.") AND isfolder = '0'");
2704 2704
                     while ($row = $this->getDatabase()->getRow($res)) {
2705 2705
                         if ($this->config['use_alias_path'] == '1' && $row['parent'] != 0) {
2706 2706
                             $parent = $row['parent'];
@@ -2711,7 +2711,7 @@  discard block
 block discarded – undo
2711 2711
                                 $parent = $this->aliasListing[$parent]['parent'];
2712 2712
                             }
2713 2713
 
2714
-                            $aliases[$row['id']] = $path . '/' . $row['alias'];
2714
+                            $aliases[$row['id']] = $path.'/'.$row['alias'];
2715 2715
                         } else {
2716 2716
                             $aliases[$row['id']] = $row['alias'];
2717 2717
                         }
@@ -2723,7 +2723,7 @@  discard block
 block discarded – undo
2723 2723
             $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0);
2724 2724
             $pref = $this->config['friendly_url_prefix'];
2725 2725
             $suff = $this->config['friendly_url_suffix'];
2726
-            $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) {
2726
+            $documentSource = preg_replace_callback($in, function($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) {
2727 2727
                 global $modx;
2728 2728
                 $thealias = $aliases[$m[1]];
2729 2729
                 $thefolder = $isfolder[$m[1]];
@@ -2739,7 +2739,7 @@  discard block
 block discarded – undo
2739 2739
 
2740 2740
         } else {
2741 2741
             $in = '!\[\~([0-9]+)\~\]!is';
2742
-            $out = "index.php?id=" . '\1';
2742
+            $out = "index.php?id=".'\1';
2743 2743
             $documentSource = preg_replace($in, $out, $documentSource);
2744 2744
         }
2745 2745
 
@@ -2760,7 +2760,7 @@  discard block
 block discarded – undo
2760 2760
         $scheme = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
2761 2761
         $len_base_url = strlen($this->config['base_url']);
2762 2762
 
2763
-        $url_path = $q;//LANG
2763
+        $url_path = $q; //LANG
2764 2764
 
2765 2765
         if (substr($url_path, 0, $len_base_url) === $this->config['base_url']) {
2766 2766
             $url_path = substr($url_path, $len_base_url);
@@ -2772,7 +2772,7 @@  discard block
 block discarded – undo
2772 2772
             $strictURL = substr($strictURL, $len_base_url);
2773 2773
         }
2774 2774
         $http_host = $_SERVER['HTTP_HOST'];
2775
-        $requestedURL = "{$scheme}://{$http_host}" . '/' . $q; //LANG
2775
+        $requestedURL = "{$scheme}://{$http_host}".'/'.$q; //LANG
2776 2776
 
2777 2777
         $site_url = $this->config['site_url'];
2778 2778
         $url_query_string = explode('?', $_SERVER['REQUEST_URI']);
@@ -2790,7 +2790,7 @@  discard block
 block discarded – undo
2790 2790
                 }
2791 2791
                 if ($this->config['base_url'] != $_SERVER['REQUEST_URI']) {
2792 2792
                     if (empty($_POST)) {
2793
-                        if (($this->config['base_url'] . '?' . $qstring) != $_SERVER['REQUEST_URI']) {
2793
+                        if (($this->config['base_url'].'?'.$qstring) != $_SERVER['REQUEST_URI']) {
2794 2794
                             $this->sendRedirect($url, 0, 'REDIRECT_HEADER', 'HTTP/1.0 301 Moved Permanently');
2795 2795
                             exit(0);
2796 2796
                         }
@@ -2849,7 +2849,7 @@  discard block
 block discarded – undo
2849 2849
                 $docgrp = implode(",", $docgrp);
2850 2850
             }
2851 2851
             // get document
2852
-            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
2852
+            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
2853 2853
             $rs = $this->getDatabase()->select('sc.*', "{$tblsc} sc
2854 2854
                 LEFT JOIN {$tbldg} dg ON dg.document = sc.id", "sc.{$method} = '{$identifier}' AND ({$access})", "", 1);
2855 2855
             if ($this->getDatabase()->getRecordCount($rs) < 1) {
@@ -2885,9 +2885,9 @@  discard block
 block discarded – undo
2885 2885
             }
2886 2886
             if ($documentObject['template']) {
2887 2887
                 // load TVs and merge with document - Orig by Apodigm - Docvars
2888
-                $rs = $this->getDatabase()->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getDatabase()->getFullTableName("site_tmplvars") . " tv
2889
-                INNER JOIN " . $this->getDatabase()->getFullTableName("site_tmplvar_templates") . " tvtpl ON tvtpl.tmplvarid = tv.id
2890
-                LEFT JOIN " . $this->getDatabase()->getFullTableName("site_tmplvar_contentvalues") . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'");
2888
+                $rs = $this->getDatabase()->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getDatabase()->getFullTableName("site_tmplvars")." tv
2889
+                INNER JOIN " . $this->getDatabase()->getFullTableName("site_tmplvar_templates")." tvtpl ON tvtpl.tmplvarid = tv.id
2890
+                LEFT JOIN " . $this->getDatabase()->getFullTableName("site_tmplvar_contentvalues")." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'");
2891 2891
                 $tmplvars = array();
2892 2892
                 while ($row = $this->getDatabase()->getRow($rs)) {
2893 2893
                     $tmplvars[$row['name']] = array(
@@ -2933,7 +2933,7 @@  discard block
 block discarded – undo
2933 2933
                 $st = md5($source);
2934 2934
             }
2935 2935
             if ($this->dumpSnippets == 1) {
2936
-                $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>";
2936
+                $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>";
2937 2937
             }
2938 2938
 
2939 2939
             // invoke OnParseDocument event
@@ -2975,7 +2975,7 @@  discard block
 block discarded – undo
2975 2975
      */
2976 2976
     public function executeParser()
2977 2977
     {
2978
-        if(MODX_CLI) {
2978
+        if (MODX_CLI) {
2979 2979
             throw new \RuntimeException('Call DocumentParser::executeParser on CLI mode');
2980 2980
         }
2981 2981
 
@@ -3021,7 +3021,7 @@  discard block
 block discarded – undo
3021 3021
 
3022 3022
             // Check use_alias_path and check if $this->virtualDir is set to anything, then parse the path
3023 3023
             if ($this->config['use_alias_path'] == 1) {
3024
-                $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir . '/' : '') . $this->documentIdentifier;
3024
+                $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir.'/' : '').$this->documentIdentifier;
3025 3025
                 if (isset($this->documentListing[$alias])) {
3026 3026
                     $this->documentIdentifier = $this->documentListing[$alias];
3027 3027
                 } else {
@@ -3082,7 +3082,7 @@  discard block
 block discarded – undo
3082 3082
                 } else {
3083 3083
                     $docAlias = $this->getDatabase()->escape($this->documentIdentifier);
3084 3084
                     $rs = $this->getDatabase()->select('id', $this->getDatabase()->getFullTableName('site_content'), "deleted=0 and alias='{$docAlias}'");
3085
-                    $this->documentIdentifier = (int)$this->getDatabase()->getValue($rs);
3085
+                    $this->documentIdentifier = (int) $this->getDatabase()->getValue($rs);
3086 3086
                 }
3087 3087
             }
3088 3088
             $this->documentMethod = 'id';
@@ -3139,7 +3139,7 @@  discard block
 block discarded – undo
3139 3139
                 $_REQUEST[$n] = $_GET[$n] = $v;
3140 3140
             }
3141 3141
         }
3142
-        $_SERVER['PHP_SELF'] = $this->config['base_url'] . $qp['path'];
3142
+        $_SERVER['PHP_SELF'] = $this->config['base_url'].$qp['path'];
3143 3143
         $this->q = $qp['path'];
3144 3144
         return $qp['path'];
3145 3145
     }
@@ -3289,7 +3289,7 @@  discard block
 block discarded – undo
3289 3289
         while ($id && $height--) {
3290 3290
             $thisid = $id;
3291 3291
             if ($this->config['aliaslistingfolder'] == 1) {
3292
-                $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->getDatabase()->getValue("SELECT `parent` FROM " . $this->getDatabase()->getFullTableName("site_content") . " WHERE `id` = '{$id}' LIMIT 0,1");
3292
+                $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->getDatabase()->getValue("SELECT `parent` FROM ".$this->getDatabase()->getFullTableName("site_content")." WHERE `id` = '{$id}' LIMIT 0,1");
3293 3293
                 if (!$id || $id == '0') {
3294 3294
                     break;
3295 3295
                 }
@@ -3340,15 +3340,15 @@  discard block
 block discarded – undo
3340 3340
 
3341 3341
         if ($this->config['aliaslistingfolder'] == 1) {
3342 3342
 
3343
-            $res = $this->getDatabase()->select("id,alias,isfolder,parent", $this->getDatabase()->getFullTableName('site_content'), "parent IN (" . $id . ") AND deleted = '0'");
3343
+            $res = $this->getDatabase()->select("id,alias,isfolder,parent", $this->getDatabase()->getFullTableName('site_content'), "parent IN (".$id.") AND deleted = '0'");
3344 3344
             $idx = array();
3345 3345
             while ($row = $this->getDatabase()->getRow($res)) {
3346 3346
                 $pAlias = '';
3347 3347
                 if (isset($this->aliasListing[$row['parent']])) {
3348
-                    $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'] . '/' : '';
3349
-                    $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'] . '/' : '';
3348
+                    $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'].'/' : '';
3349
+                    $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'].'/' : '';
3350 3350
                 };
3351
-                $children[$pAlias . $row['alias']] = $row['id'];
3351
+                $children[$pAlias.$row['alias']] = $row['id'];
3352 3352
                 if ($row['isfolder'] == 1) {
3353 3353
                     $idx[] = $row['id'];
3354 3354
                 }
@@ -3380,7 +3380,7 @@  discard block
 block discarded – undo
3380 3380
                 $depth--;
3381 3381
 
3382 3382
                 foreach ($documentMap_cache[$id] as $childId) {
3383
-                    $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '') . $this->aliasListing[$childId]['alias'];
3383
+                    $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '').$this->aliasListing[$childId]['alias'];
3384 3384
                     if (!strlen($pkey)) {
3385 3385
                         $pkey = "{$childId}";
3386 3386
                     }
@@ -3417,7 +3417,7 @@  discard block
 block discarded – undo
3417 3417
                 $fnc = 'history.back(-1);';
3418 3418
                 break;
3419 3419
             default:
3420
-                $fnc = "window.location.href='" . addslashes($url) . "';";
3420
+                $fnc = "window.location.href='".addslashes($url)."';";
3421 3421
         }
3422 3422
 
3423 3423
         echo "<html><head>
@@ -3449,9 +3449,9 @@  discard block
 block discarded – undo
3449 3449
         $state = 0;
3450 3450
         $pms = $_SESSION['mgrPermissions'];
3451 3451
         if ($pms) {
3452
-            $state = ((bool)$pms[$pm] === true);
3452
+            $state = ((bool) $pms[$pm] === true);
3453 3453
         }
3454
-        return (int)$state;
3454
+        return (int) $state;
3455 3455
     }
3456 3456
 
3457 3457
     /**
@@ -3464,8 +3464,8 @@  discard block
 block discarded – undo
3464 3464
      */
3465 3465
     public function elementIsLocked($type, $id, $includeThisUser = false)
3466 3466
     {
3467
-        $id = (int)$id;
3468
-        $type = (int)$type;
3467
+        $id = (int) $id;
3468
+        $type = (int) $type;
3469 3469
         if (!$type || !$id) {
3470 3470
             return null;
3471 3471
         }
@@ -3515,7 +3515,7 @@  discard block
 block discarded – undo
3515 3515
             return $lockedElements;
3516 3516
         }
3517 3517
 
3518
-        $type = (int)$type;
3518
+        $type = (int) $type;
3519 3519
         if (isset($lockedElements[$type])) {
3520 3520
             return $lockedElements[$type];
3521 3521
         } else {
@@ -3532,7 +3532,7 @@  discard block
 block discarded – undo
3532 3532
             $this->lockedElements = array();
3533 3533
             $this->cleanupExpiredLocks();
3534 3534
 
3535
-            $rs = $this->getDatabase()->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getDatabase()->getFullTableName('active_user_locks') . " ul
3535
+            $rs = $this->getDatabase()->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getDatabase()->getFullTableName('active_user_locks')." ul
3536 3536
                 LEFT JOIN {$this->getDatabase()->getFullTableName('manager_users')} mu on ul.internalKey = mu.id");
3537 3537
             while ($row = $this->getDatabase()->getRow($rs)) {
3538 3538
                 $this->lockedElements[$row['elementType']][$row['elementId']] = array(
@@ -3555,7 +3555,7 @@  discard block
 block discarded – undo
3555 3555
     public function cleanupExpiredLocks()
3556 3556
     {
3557 3557
         // Clean-up active_user_sessions first
3558
-        $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
3558
+        $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
3559 3559
         $validSessionTimeLimit = $this->time - $timeout;
3560 3560
         $this->getDatabase()->delete($this->getDatabase()->getFullTableName('active_user_sessions'), "lasthit < {$validSessionTimeLimit}");
3561 3561
 
@@ -3568,7 +3568,7 @@  discard block
 block discarded – undo
3568 3568
             foreach ($rs as $row) {
3569 3569
                 $userSids[] = $row['sid'];
3570 3570
             }
3571
-            $userSids = "'" . implode("','", $userSids) . "'";
3571
+            $userSids = "'".implode("','", $userSids)."'";
3572 3572
             $this->getDatabase()->delete($this->getDatabase()->getFullTableName('active_user_locks'), "sid NOT IN({$userSids})");
3573 3573
         } else {
3574 3574
             $this->getDatabase()->delete($this->getDatabase()->getFullTableName('active_user_locks'));
@@ -3652,8 +3652,8 @@  discard block
 block discarded – undo
3652 3652
     public function lockElement($type, $id)
3653 3653
     {
3654 3654
         $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0;
3655
-        $type = (int)$type;
3656
-        $id = (int)$id;
3655
+        $type = (int) $type;
3656
+        $id = (int) $id;
3657 3657
         if (!$type || !$id || !$userId) {
3658 3658
             return false;
3659 3659
         }
@@ -3674,8 +3674,8 @@  discard block
 block discarded – undo
3674 3674
     public function unlockElement($type, $id, $includeAllUsers = false)
3675 3675
     {
3676 3676
         $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0;
3677
-        $type = (int)$type;
3678
-        $id = (int)$id;
3677
+        $type = (int) $type;
3678
+        $id = (int) $id;
3679 3679
         if (!$type || !$id) {
3680 3680
             return false;
3681 3681
         }
@@ -3742,8 +3742,8 @@  discard block
 block discarded – undo
3742 3742
         }
3743 3743
 
3744 3744
         $usertype = $this->isFrontend() ? 1 : 0;
3745
-        $evtid = (int)$evtid;
3746
-        $type = (int)$type;
3745
+        $evtid = (int) $evtid;
3746
+        $type = (int) $type;
3747 3747
 
3748 3748
         // Types: 1 = information, 2 = warning, 3 = error
3749 3749
         if ($type < 1) {
@@ -3765,8 +3765,8 @@  discard block
 block discarded – undo
3765 3765
         if (isset($this->config['send_errormail']) && $this->config['send_errormail'] !== '0') {
3766 3766
             if ($this->config['send_errormail'] <= $type) {
3767 3767
                 $this->sendmail(array(
3768
-                    'subject' => 'MODX System Error on ' . $this->config['site_name'],
3769
-                    'body' => 'Source: ' . $source . ' - The details of the error could be seen in the MODX system events log.',
3768
+                    'subject' => 'MODX System Error on '.$this->config['site_name'],
3769
+                    'body' => 'Source: '.$source.' - The details of the error could be seen in the MODX system events log.',
3770 3770
                     'type' => 'text'
3771 3771
                 ));
3772 3772
             }
@@ -3815,7 +3815,7 @@  discard block
 block discarded – undo
3815 3815
             $p['fromname'] = $userinfo['username'];
3816 3816
         }
3817 3817
         if ($msg === '' && !isset($p['body'])) {
3818
-            $p['body'] = $_SERVER['REQUEST_URI'] . "\n" . $_SERVER['HTTP_USER_AGENT'] . "\n" . $_SERVER['HTTP_REFERER'];
3818
+            $p['body'] = $_SERVER['REQUEST_URI']."\n".$_SERVER['HTTP_USER_AGENT']."\n".$_SERVER['HTTP_REFERER'];
3819 3819
         } elseif (is_string($msg) && 0 < strlen($msg)) {
3820 3820
             $p['body'] = $msg;
3821 3821
         }
@@ -3856,8 +3856,8 @@  discard block
 block discarded – undo
3856 3856
             $files = array();
3857 3857
         }
3858 3858
         foreach ($files as $f) {
3859
-            if (file_exists(MODX_BASE_PATH . $f) && is_file(MODX_BASE_PATH . $f) && is_readable(MODX_BASE_PATH . $f)) {
3860
-                $this->getMail()->AddAttachment(MODX_BASE_PATH . $f);
3859
+            if (file_exists(MODX_BASE_PATH.$f) && is_file(MODX_BASE_PATH.$f) && is_readable(MODX_BASE_PATH.$f)) {
3860
+                $this->getMail()->AddAttachment(MODX_BASE_PATH.$f);
3861 3861
             }
3862 3862
         }
3863 3863
         return $this->getMail()->send();
@@ -3901,7 +3901,7 @@  discard block
 block discarded – undo
3901 3901
      */
3902 3902
     public function isFrontend()
3903 3903
     {
3904
-        return ! $this->isBackend();
3904
+        return !$this->isBackend();
3905 3905
     }
3906 3906
 
3907 3907
     /**
@@ -3926,14 +3926,14 @@  discard block
 block discarded – undo
3926 3926
         $tblsc = $this->getDatabase()->getFullTableName("site_content");
3927 3927
         $tbldg = $this->getDatabase()->getFullTableName("document_groups");
3928 3928
         // modify field names to use sc. table reference
3929
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3930
-        $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3929
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3930
+        $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3931 3931
         // get document groups for current user
3932 3932
         if ($docgrp = $this->getUserDocGroups()) {
3933 3933
             $docgrp = implode(",", $docgrp);
3934 3934
         }
3935 3935
         // build query
3936
-        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3936
+        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3937 3937
         $result = $this->getDatabase()->select("DISTINCT {$fields}", "{$tblsc} sc
3938 3938
                 LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}");
3939 3939
         $resourceArray = $this->getDatabase()->makeArray($result);
@@ -3963,14 +3963,14 @@  discard block
 block discarded – undo
3963 3963
         $tbldg = $this->getDatabase()->getFullTableName("document_groups");
3964 3964
 
3965 3965
         // modify field names to use sc. table reference
3966
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3967
-        $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3966
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3967
+        $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3968 3968
         // get document groups for current user
3969 3969
         if ($docgrp = $this->getUserDocGroups()) {
3970 3970
             $docgrp = implode(",", $docgrp);
3971 3971
         }
3972 3972
         // build query
3973
-        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3973
+        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3974 3974
         $result = $this->getDatabase()->select("DISTINCT {$fields}", "{$tblsc} sc
3975 3975
                 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}");
3976 3976
         $resourceArray = $this->getDatabase()->makeArray($result);
@@ -4005,16 +4005,16 @@  discard block
 block discarded – undo
4005 4005
             return $this->tmpCache[__FUNCTION__][$cacheKey];
4006 4006
         }
4007 4007
 
4008
-        $published = ($published !== 'all') ? 'AND sc.published = ' . $published : '';
4009
-        $deleted = ($deleted !== 'all') ? 'AND sc.deleted = ' . $deleted : '';
4008
+        $published = ($published !== 'all') ? 'AND sc.published = '.$published : '';
4009
+        $deleted = ($deleted !== 'all') ? 'AND sc.deleted = '.$deleted : '';
4010 4010
 
4011 4011
         if ($where != '') {
4012
-            $where = 'AND ' . $where;
4012
+            $where = 'AND '.$where;
4013 4013
         }
4014 4014
 
4015 4015
         // modify field names to use sc. table reference
4016
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
4017
-        $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
4016
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
4017
+        $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
4018 4018
 
4019 4019
         // get document groups for current user
4020 4020
         if ($docgrp = $this->getUserDocGroups()) {
@@ -4022,7 +4022,7 @@  discard block
 block discarded – undo
4022 4022
         }
4023 4023
 
4024 4024
         // build query
4025
-        $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')');
4025
+        $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')');
4026 4026
 
4027 4027
         $tblsc = $this->getDatabase()->getFullTableName('site_content');
4028 4028
         $tbldg = $this->getDatabase()->getFullTableName('document_groups');
@@ -4074,10 +4074,10 @@  discard block
 block discarded – undo
4074 4074
             return false;
4075 4075
         } else {
4076 4076
             // modify field names to use sc. table reference
4077
-            $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
4078
-            $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
4077
+            $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
4078
+            $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
4079 4079
             if ($where != '') {
4080
-                $where = 'AND ' . $where;
4080
+                $where = 'AND '.$where;
4081 4081
             }
4082 4082
 
4083 4083
             $published = ($published !== 'all') ? "AND sc.published = '{$published}'" : '';
@@ -4088,13 +4088,13 @@  discard block
 block discarded – undo
4088 4088
                 $docgrp = implode(',', $docgrp);
4089 4089
             }
4090 4090
 
4091
-            $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')');
4091
+            $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')');
4092 4092
 
4093 4093
             $tblsc = $this->getDatabase()->getFullTableName('site_content');
4094 4094
             $tbldg = $this->getDatabase()->getFullTableName('document_groups');
4095 4095
 
4096 4096
             $result = $this->getDatabase()->select("DISTINCT {$fields}", "{$tblsc} sc
4097
-                    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);
4097
+                    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);
4098 4098
 
4099 4099
             $resourceArray = $this->getDatabase()->makeArray($result);
4100 4100
 
@@ -4199,12 +4199,12 @@  discard block
 block discarded – undo
4199 4199
             $tbldg = $this->getDatabase()->getFullTableName("document_groups");
4200 4200
             $activeSql = $active == 1 ? "AND sc.published=1 AND sc.deleted=0" : "";
4201 4201
             // modify field names to use sc. table reference
4202
-            $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
4202
+            $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
4203 4203
             // get document groups for current user
4204 4204
             if ($docgrp = $this->getUserDocGroups()) {
4205 4205
                 $docgrp = implode(",", $docgrp);
4206 4206
             }
4207
-            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
4207
+            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
4208 4208
             $result = $this->getDatabase()->select($fields, "{$tblsc} sc LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id='{$pageid}' {$activeSql}) AND ({$access})", "", 1);
4209 4209
             $pageInfo = $this->getDatabase()->getRow($result);
4210 4210
 
@@ -4251,7 +4251,7 @@  discard block
 block discarded – undo
4251 4251
     {
4252 4252
         if ($this->currentSnippet) {
4253 4253
             $tbl = $this->getDatabase()->getFullTableName("site_snippets");
4254
-            $rs = $this->getDatabase()->select('id', $tbl, "name='" . $this->getDatabase()->escape($this->currentSnippet) . "'", '', 1);
4254
+            $rs = $this->getDatabase()->select('id', $tbl, "name='".$this->getDatabase()->escape($this->currentSnippet)."'", '', 1);
4255 4255
             if ($snippetId = $this->getDatabase()->getValue($rs)) {
4256 4256
                 return $snippetId;
4257 4257
             }
@@ -4278,7 +4278,7 @@  discard block
 block discarded – undo
4278 4278
      */
4279 4279
     public function clearCache($type = '', $report = false)
4280 4280
     {
4281
-        $cache_dir = MODX_BASE_PATH . $this->getCacheFolder();
4281
+        $cache_dir = MODX_BASE_PATH.$this->getCacheFolder();
4282 4282
         if (is_array($type)) {
4283 4283
             foreach ($type as $_) {
4284 4284
                 $this->clearCache($_, $report);
@@ -4290,10 +4290,10 @@  discard block
 block discarded – undo
4290 4290
             $sync->emptyCache();
4291 4291
         } elseif (preg_match('@^[1-9][0-9]*$@', $type)) {
4292 4292
             $key = ($this->config['cache_type'] == 2) ? $this->makePageCacheKey($type) : $type;
4293
-            $file_name = "docid_" . $key . "_*.pageCache.php";
4294
-            $cache_path = $cache_dir . $file_name;
4293
+            $file_name = "docid_".$key."_*.pageCache.php";
4294
+            $cache_path = $cache_dir.$file_name;
4295 4295
             $files = glob($cache_path);
4296
-            $files[] = $cache_dir . "docid_" . $key . ".pageCache.php";
4296
+            $files[] = $cache_dir."docid_".$key.".pageCache.php";
4297 4297
             foreach ($files as $file) {
4298 4298
                 if (!is_file($file)) {
4299 4299
                     continue;
@@ -4301,7 +4301,7 @@  discard block
 block discarded – undo
4301 4301
                 unlink($file);
4302 4302
             }
4303 4303
         } else {
4304
-            $files = glob($cache_dir . '*');
4304
+            $files = glob($cache_dir.'*');
4305 4305
             foreach ($files as $file) {
4306 4306
                 $name = basename($file);
4307 4307
                 if (strpos($name, '.pageCache.php') === false) {
@@ -4370,7 +4370,7 @@  discard block
 block discarded – undo
4370 4370
                         $f_url_suffix = '/';
4371 4371
                     }
4372 4372
 
4373
-                    $alPath = !empty ($al['path']) ? $al['path'] . '/' : '';
4373
+                    $alPath = !empty ($al['path']) ? $al['path'].'/' : '';
4374 4374
 
4375 4375
                     if ($al && $al['alias']) {
4376 4376
                         $alias = $al['alias'];
@@ -4378,7 +4378,7 @@  discard block
 block discarded – undo
4378 4378
 
4379 4379
                 }
4380 4380
 
4381
-                $alias = $alPath . $f_url_prefix . $alias . $f_url_suffix;
4381
+                $alias = $alPath.$f_url_prefix.$alias.$f_url_suffix;
4382 4382
                 $url = "{$alias}{$args}";
4383 4383
             } else {
4384 4384
                 $url = "index.php?id={$id}{$args}";
@@ -4397,7 +4397,7 @@  discard block
 block discarded – undo
4397 4397
             }
4398 4398
 
4399 4399
             //TODO: check to make sure that $site_url incudes the url :port (e.g. :8080)
4400
-            $host = $scheme == 'full' ? $this->config['site_url'] : $scheme . '://' . $_SERVER['HTTP_HOST'] . $host;
4400
+            $host = $scheme == 'full' ? $this->config['site_url'] : $scheme.'://'.$_SERVER['HTTP_HOST'].$host;
4401 4401
         }
4402 4402
 
4403 4403
         //fix strictUrl by Bumkaka
@@ -4406,9 +4406,9 @@  discard block
 block discarded – undo
4406 4406
         }
4407 4407
 
4408 4408
         if ($this->config['xhtml_urls']) {
4409
-            $url = preg_replace("/&(?!amp;)/", "&amp;", $host . $virtualDir . $url);
4409
+            $url = preg_replace("/&(?!amp;)/", "&amp;", $host.$virtualDir.$url);
4410 4410
         } else {
4411
-            $url = $host . $virtualDir . $url;
4411
+            $url = $host.$virtualDir.$url;
4412 4412
         }
4413 4413
 
4414 4414
         $evtOut = $this->invokeEvent('OnMakeDocUrl', array(
@@ -4432,21 +4432,21 @@  discard block
 block discarded – undo
4432 4432
         if (isset($this->aliasListing[$id])) {
4433 4433
             $out = $this->aliasListing[$id];
4434 4434
         } else {
4435
-            $q = $this->getDatabase()->query("SELECT id,alias,isfolder,parent FROM " . $this->getDatabase()->getFullTableName("site_content") . " WHERE id=" . (int)$id);
4435
+            $q = $this->getDatabase()->query("SELECT id,alias,isfolder,parent FROM ".$this->getDatabase()->getFullTableName("site_content")." WHERE id=".(int) $id);
4436 4436
             if ($this->getDatabase()->getRecordCount($q) == '1') {
4437 4437
                 $q = $this->getDatabase()->getRow($q);
4438 4438
                 $this->aliasListing[$id] = array(
4439
-                    'id' => (int)$q['id'],
4439
+                    'id' => (int) $q['id'],
4440 4440
                     'alias' => $q['alias'] == '' ? $q['id'] : $q['alias'],
4441
-                    'parent' => (int)$q['parent'],
4442
-                    'isfolder' => (int)$q['isfolder'],
4441
+                    'parent' => (int) $q['parent'],
4442
+                    'isfolder' => (int) $q['isfolder'],
4443 4443
                 );
4444 4444
                 if ($this->aliasListing[$id]['parent'] > 0) {
4445 4445
                     //fix alias_path_usage
4446 4446
                     if ($this->config['use_alias_path'] == '1') {
4447 4447
                         //&& $tmp['path'] != '' - fix error slash with epty path
4448 4448
                         $tmp = $this->getAliasListing($this->aliasListing[$id]['parent']);
4449
-                        $this->aliasListing[$id]['path'] = $tmp['path'] . ($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '') . $tmp['alias'] : '');
4449
+                        $this->aliasListing[$id]['path'] = $tmp['path'].($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '').$tmp['alias'] : '');
4450 4450
                     } else {
4451 4451
                         $this->aliasListing[$id]['path'] = '';
4452 4452
                     }
@@ -4484,7 +4484,7 @@  discard block
 block discarded – undo
4484 4484
         $out = array();
4485 4485
         if (empty($this->version) || !is_array($this->version)) {
4486 4486
             //include for compatibility modx version < 1.0.10
4487
-            include MODX_MANAGER_PATH . "includes/version.inc.php";
4487
+            include MODX_MANAGER_PATH."includes/version.inc.php";
4488 4488
             $this->version = array();
4489 4489
             $this->version['version'] = isset($modx_version) ? $modx_version : '';
4490 4490
             $this->version['branch'] = isset($modx_branch) ? $modx_branch : '';
@@ -4506,18 +4506,18 @@  discard block
 block discarded – undo
4506 4506
     {
4507 4507
         if (isset ($this->snippetCache[$snippetName])) {
4508 4508
             $snippet = $this->snippetCache[$snippetName];
4509
-            $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : '';
4509
+            $properties = !empty($this->snippetCache[$snippetName."Props"]) ? $this->snippetCache[$snippetName."Props"] : '';
4510 4510
         } else { // not in cache so let's check the db
4511
-            $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM " . $this->getDatabase()->getFullTableName("site_snippets") . " as ss LEFT JOIN " . $this->getDatabase()->getFullTableName('site_modules') . " as sm on sm.guid=ss.moduleguid WHERE ss.`name`='" . $this->getDatabase()->escape($snippetName) . "'  AND ss.disabled=0;";
4511
+            $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM ".$this->getDatabase()->getFullTableName("site_snippets")." as ss LEFT JOIN ".$this->getDatabase()->getFullTableName('site_modules')." as sm on sm.guid=ss.moduleguid WHERE ss.`name`='".$this->getDatabase()->escape($snippetName)."'  AND ss.disabled=0;";
4512 4512
             $result = $this->getDatabase()->query($sql);
4513 4513
             if ($this->getDatabase()->getRecordCount($result) == 1) {
4514 4514
                 $row = $this->getDatabase()->getRow($result);
4515 4515
                 $snippet = $this->snippetCache[$snippetName] = $row['snippet'];
4516 4516
                 $mergedProperties = array_merge($this->parseProperties($row['properties']), $this->parseProperties($row['sharedproperties']));
4517
-                $properties = $this->snippetCache[$snippetName . "Props"] = json_encode($mergedProperties);
4517
+                $properties = $this->snippetCache[$snippetName."Props"] = json_encode($mergedProperties);
4518 4518
             } else {
4519 4519
                 $snippet = $this->snippetCache[$snippetName] = "return false;";
4520
-                $properties = $this->snippetCache[$snippetName . "Props"] = '';
4520
+                $properties = $this->snippetCache[$snippetName."Props"] = '';
4521 4521
             }
4522 4522
         }
4523 4523
         // load default params/properties
@@ -4621,8 +4621,8 @@  discard block
 block discarded – undo
4621 4621
             }
4622 4622
             if (strpos($tpl, $s) !== false) {
4623 4623
                 $tpl = str_replace($s, $value, $tpl);
4624
-            } elseif($this->debug) {
4625
-                $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'] . $s, 2);
4624
+            } elseif ($this->debug) {
4625
+                $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'].$s, 2);
4626 4626
             }
4627 4627
         }
4628 4628
 
@@ -4671,7 +4671,7 @@  discard block
 block discarded – undo
4671 4671
             case 'CODE':
4672 4672
                 break;
4673 4673
             case 'FILE':
4674
-                $template = file_get_contents(MODX_BASE_PATH . $template);
4674
+                $template = file_get_contents(MODX_BASE_PATH.$template);
4675 4675
                 break;
4676 4676
             case 'CHUNK':
4677 4677
                 $template = $this->getChunk($template);
@@ -4704,7 +4704,7 @@  discard block
 block discarded – undo
4704 4704
         if ($mode !== 'formatOnly' && empty($timestamp)) {
4705 4705
             return '-';
4706 4706
         }
4707
-        $timestamp = (int)$timestamp;
4707
+        $timestamp = (int) $timestamp;
4708 4708
 
4709 4709
         switch ($this->config['datetime_format']) {
4710 4710
             case 'YYYY/mm/dd':
@@ -4724,7 +4724,7 @@  discard block
 block discarded – undo
4724 4724
         }
4725 4725
 
4726 4726
         if (empty($mode)) {
4727
-            $strTime = strftime($dateFormat . " %H:%M:%S", $timestamp);
4727
+            $strTime = strftime($dateFormat." %H:%M:%S", $timestamp);
4728 4728
         } elseif ($mode == 'dateOnly') {
4729 4729
             $strTime = strftime($dateFormat, $timestamp);
4730 4730
         } elseif ($mode == 'formatOnly') {
@@ -4778,7 +4778,7 @@  discard block
 block discarded – undo
4778 4778
             $S = 0;
4779 4779
         }
4780 4780
         $timeStamp = mktime($H, $M, $S, $m, $d, $Y);
4781
-        $timeStamp = (int)$timeStamp;
4781
+        $timeStamp = (int) $timeStamp;
4782 4782
         return $timeStamp;
4783 4783
     }
4784 4784
 
@@ -4820,7 +4820,7 @@  discard block
 block discarded – undo
4820 4820
                     if ($v === 'value') {
4821 4821
                         unset($_[$i]);
4822 4822
                     } else {
4823
-                        $_[$i] = 'tv.' . $v;
4823
+                        $_[$i] = 'tv.'.$v;
4824 4824
                     }
4825 4825
                 }
4826 4826
                 $fields = implode(',', $_);
@@ -4829,12 +4829,12 @@  discard block
 block discarded – undo
4829 4829
             }
4830 4830
 
4831 4831
             if ($tvsort != '') {
4832
-                $tvsort = 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort))));
4832
+                $tvsort = 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort))));
4833 4833
             }
4834 4834
             if ($tvidnames == "*") {
4835 4835
                 $query = "tv.id<>0";
4836 4836
             } else {
4837
-                $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name") . " IN ('" . implode("','", $tvidnames) . "')";
4837
+                $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name")." IN ('".implode("','", $tvidnames)."')";
4838 4838
             }
4839 4839
 
4840 4840
             $this->getUserDocGroups();
@@ -4846,10 +4846,10 @@  discard block
 block discarded – undo
4846 4846
                 $rs = $this->getDatabase()->select(
4847 4847
                     "{$fields}, IF(tvc.value!='',tvc.value,tv.default_text) as value ",
4848 4848
 
4849
-                    $this->getDatabase()->getFullTableName("site_tmplvars") .
4850
-                    " tv INNER JOIN " . $this->getDatabase()->getFullTableName("site_tmplvar_templates") .
4851
-                    " tvtpl ON tvtpl.tmplvarid = tv.id LEFT JOIN " .
4852
-                    $this->getDatabase()->getFullTableName("site_tmplvar_contentvalues") .
4849
+                    $this->getDatabase()->getFullTableName("site_tmplvars").
4850
+                    " tv INNER JOIN ".$this->getDatabase()->getFullTableName("site_tmplvar_templates").
4851
+                    " tvtpl ON tvtpl.tmplvarid = tv.id LEFT JOIN ".
4852
+                    $this->getDatabase()->getFullTableName("site_tmplvar_contentvalues").
4853 4853
                     " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid='{$docid}'",
4854 4854
 
4855 4855
                     "{$query} AND tvtpl.templateid = '{$doc['template']}'",
@@ -4987,7 +4987,7 @@  discard block
 block discarded – undo
4987 4987
             return $this->tmpCache[__FUNCTION__][$cacheKey];
4988 4988
         }
4989 4989
 
4990
-        if (($idnames != '*' && !is_array($idnames)) || empty($idnames) ) {
4990
+        if (($idnames != '*' && !is_array($idnames)) || empty($idnames)) {
4991 4991
             return false;
4992 4992
         } else {
4993 4993
 
@@ -5005,23 +5005,23 @@  discard block
 block discarded – undo
5005 5005
             }
5006 5006
 
5007 5007
             // get user defined template variables
5008
-            $fields = ($fields == '') ? 'tv.*' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $fields))));
5009
-            $sort = ($sort == '') ? '' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $sort))));
5008
+            $fields = ($fields == '') ? 'tv.*' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $fields))));
5009
+            $sort = ($sort == '') ? '' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $sort))));
5010 5010
 
5011 5011
             if ($idnames == '*') {
5012 5012
                 $query = 'tv.id<>0';
5013 5013
             } else {
5014
-                $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name') . " IN ('" . implode("','", $idnames) . "')";
5014
+                $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name')." IN ('".implode("','", $idnames)."')";
5015 5015
             }
5016 5016
 
5017
-            $rs = $this->getDatabase()->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getDatabase()->getFullTableName('site_tmplvars') . " tv
5018
-                    INNER JOIN " . $this->getDatabase()->getFullTableName('site_tmplvar_templates') . " tvtpl ON tvtpl.tmplvarid = tv.id
5019
-                    LEFT JOIN " . $this->getDatabase()->getFullTableName('site_tmplvar_contentvalues') . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'", "{$query} AND tvtpl.templateid = '{$docRow['template']}'", ($sort ? "{$sort} {$dir}" : ""));
5017
+            $rs = $this->getDatabase()->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getDatabase()->getFullTableName('site_tmplvars')." tv
5018
+                    INNER JOIN " . $this->getDatabase()->getFullTableName('site_tmplvar_templates')." tvtpl ON tvtpl.tmplvarid = tv.id
5019
+                    LEFT JOIN " . $this->getDatabase()->getFullTableName('site_tmplvar_contentvalues')." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'", "{$query} AND tvtpl.templateid = '{$docRow['template']}'", ($sort ? "{$sort} {$dir}" : ""));
5020 5020
 
5021 5021
             $result = $this->getDatabase()->makeArray($rs);
5022 5022
 
5023 5023
             // get default/built-in template variables
5024
-            if(is_array($docRow)){
5024
+            if (is_array($docRow)) {
5025 5025
                 ksort($docRow);
5026 5026
 
5027 5027
                 foreach ($docRow as $key => $value) {
@@ -5059,13 +5059,13 @@  discard block
 block discarded – undo
5059 5059
      */
5060 5060
     public function getTemplateVarOutput($idnames = array(), $docid = '', $published = 1, $sep = '')
5061 5061
     {
5062
-        if (is_array($idnames) && empty($idnames) ) {
5062
+        if (is_array($idnames) && empty($idnames)) {
5063 5063
             return false;
5064 5064
         } else {
5065 5065
             $output = array();
5066 5066
             $vars = ($idnames == '*' || is_array($idnames)) ? $idnames : array($idnames);
5067 5067
 
5068
-            $docid = (int)$docid > 0 ? (int)$docid : $this->documentIdentifier;
5068
+            $docid = (int) $docid > 0 ? (int) $docid : $this->documentIdentifier;
5069 5069
             // remove sort for speed
5070 5070
             $result = $this->getTemplateVars($vars, '*', $docid, $published, '', '');
5071 5071
 
@@ -5175,7 +5175,7 @@  discard block
 block discarded – undo
5175 5175
     public function getCachePath()
5176 5176
     {
5177 5177
         global $base_url;
5178
-        $pth = $base_url . $this->getCacheFolder();
5178
+        $pth = $base_url.$this->getCacheFolder();
5179 5179
         return $pth;
5180 5180
     }
5181 5181
 
@@ -5227,8 +5227,8 @@  discard block
 block discarded – undo
5227 5227
         $out = false;
5228 5228
 
5229 5229
         if (!empty($context)) {
5230
-            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
5231
-                $out = $_SESSION[$context . 'InternalKey'];
5230
+            if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) {
5231
+                $out = $_SESSION[$context.'InternalKey'];
5232 5232
             }
5233 5233
         } else {
5234 5234
             switch (true) {
@@ -5256,8 +5256,8 @@  discard block
 block discarded – undo
5256 5256
         $out = false;
5257 5257
 
5258 5258
         if (!empty($context)) {
5259
-            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
5260
-                $out = $_SESSION[$context . 'Shortname'];
5259
+            if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) {
5260
+                $out = $_SESSION[$context.'Shortname'];
5261 5261
             }
5262 5262
         } else {
5263 5263
             switch (true) {
@@ -5302,8 +5302,8 @@  discard block
 block discarded – undo
5302 5302
             return $this->tmpCache[__FUNCTION__][$uid];
5303 5303
         }
5304 5304
 
5305
-        $from = $this->getDatabase()->getFullTableName('manager_users') . ' mu INNER JOIN ' .
5306
-            $this->getDatabase()->getFullTableName('user_attributes'). ' mua ON mua.internalkey=mu.id';
5305
+        $from = $this->getDatabase()->getFullTableName('manager_users').' mu INNER JOIN '.
5306
+            $this->getDatabase()->getFullTableName('user_attributes').' mua ON mua.internalkey=mu.id';
5307 5307
         $where = sprintf("mu.id='%s'", $this->getDatabase()->escape($uid));
5308 5308
         $rs = $this->getDatabase()->select('mu.username, mu.password, mua.*', $from, $where, '', 1);
5309 5309
 
@@ -5329,8 +5329,8 @@  discard block
 block discarded – undo
5329 5329
      */
5330 5330
     public function getWebUserInfo($uid)
5331 5331
     {
5332
-        $rs = $this->getDatabase()->select('wu.username, wu.password, wua.*', $this->getDatabase()->getFullTableName("web_users") . " wu
5333
-                INNER JOIN " . $this->getDatabase()->getFullTableName("web_user_attributes") . " wua ON wua.internalkey=wu.id", "wu.id='{$uid}'");
5332
+        $rs = $this->getDatabase()->select('wu.username, wu.password, wua.*', $this->getDatabase()->getFullTableName("web_users")." wu
5333
+                INNER JOIN " . $this->getDatabase()->getFullTableName("web_user_attributes")." wua ON wua.internalkey=wu.id", "wu.id='{$uid}'");
5334 5334
         if ($row = $this->getDatabase()->getRow($rs)) {
5335 5335
             if (!isset($row['usertype']) or !$row["usertype"]) {
5336 5336
                 $row["usertype"] = "web";
@@ -5366,7 +5366,7 @@  discard block
 block discarded – undo
5366 5366
         } else if (is_array($dg)) {
5367 5367
             // resolve ids to names
5368 5368
             $dgn = array();
5369
-            $ds = $this->getDatabase()->select('name', $this->getDatabase()->getFullTableName("documentgroup_names"), "id IN (" . implode(",", $dg) . ")");
5369
+            $ds = $this->getDatabase()->select('name', $this->getDatabase()->getFullTableName("documentgroup_names"), "id IN (".implode(",", $dg).")");
5370 5370
             while ($row = $this->getDatabase()->getRow($ds)) {
5371 5371
                 $dgn[] = $row['name'];
5372 5372
             }
@@ -5394,7 +5394,7 @@  discard block
 block discarded – undo
5394 5394
         $rt = false;
5395 5395
         if ($_SESSION["webValidated"] == 1) {
5396 5396
             $tbl = $this->getDatabase()->getFullTableName("web_users");
5397
-            $ds = $this->getDatabase()->select('id, username, password', $tbl, "id='" . $this->getLoginUserID() . "'");
5397
+            $ds = $this->getDatabase()->select('id, username, password', $tbl, "id='".$this->getLoginUserID()."'");
5398 5398
             if ($row = $this->getDatabase()->getRow($ds)) {
5399 5399
                 if ($row["password"] == md5($oldPwd)) {
5400 5400
                     if (strlen($newPwd) < 6) {
@@ -5404,7 +5404,7 @@  discard block
 block discarded – undo
5404 5404
                     } else {
5405 5405
                         $this->getDatabase()->update(array(
5406 5406
                             'password' => $this->getDatabase()->escape($newPwd),
5407
-                        ), $tbl, "id='" . $this->getLoginUserID() . "'");
5407
+                        ), $tbl, "id='".$this->getLoginUserID()."'");
5408 5408
                         // invoke OnWebChangePassword event
5409 5409
                         $this->invokeEvent("OnWebChangePassword", array(
5410 5410
                             "userid" => $row["id"],
@@ -5435,8 +5435,8 @@  discard block
 block discarded – undo
5435 5435
         // check cache
5436 5436
         $grpNames = isset ($_SESSION['webUserGroupNames']) ? $_SESSION['webUserGroupNames'] : false;
5437 5437
         if (!is_array($grpNames)) {
5438
-            $rs = $this->getDatabase()->select('wgn.name', $this->getDatabase()->getFullTableName("webgroup_names") . " wgn
5439
-                    INNER JOIN " . $this->getDatabase()->getFullTableName("web_groups") . " wg ON wg.webgroup=wgn.id AND wg.webuser='" . $this->getLoginUserID() . "'");
5438
+            $rs = $this->getDatabase()->select('wgn.name', $this->getDatabase()->getFullTableName("webgroup_names")." wgn
5439
+                    INNER JOIN " . $this->getDatabase()->getFullTableName("web_groups")." wg ON wg.webgroup=wgn.id AND wg.webuser='".$this->getLoginUserID()."'");
5440 5440
             $grpNames = $this->getDatabase()->getColumn("name", $rs);
5441 5441
             // save to cache
5442 5442
             $_SESSION['webUserGroupNames'] = $grpNames;
@@ -5469,7 +5469,7 @@  discard block
 block discarded – undo
5469 5469
         if (strpos(strtolower($src), "<style") !== false || strpos(strtolower($src), "<link") !== false) {
5470 5470
             $this->sjscripts[$nextpos] = $src;
5471 5471
         } else {
5472
-            $this->sjscripts[$nextpos] = "\t" . '<link rel="stylesheet" type="text/css" href="' . $src . '" ' . ($media ? 'media="' . $media . '" ' : '') . '/>';
5472
+            $this->sjscripts[$nextpos] = "\t".'<link rel="stylesheet" type="text/css" href="'.$src.'" '.($media ? 'media="'.$media.'" ' : '').'/>';
5473 5473
         }
5474 5474
     }
5475 5475
 
@@ -5548,7 +5548,7 @@  discard block
 block discarded – undo
5548 5548
         }
5549 5549
 
5550 5550
         if ($useThisVer && $plaintext != true && (strpos(strtolower($src), "<script") === false)) {
5551
-            $src = "\t" . '<script type="text/javascript" src="' . $src . '"></script>';
5551
+            $src = "\t".'<script type="text/javascript" src="'.$src.'"></script>';
5552 5552
         }
5553 5553
         if ($startup) {
5554 5554
             $pos = isset($overwritepos) ? $overwritepos : max(array_merge(array(0), array_keys($this->sjscripts))) + 1;
@@ -5695,7 +5695,7 @@  discard block
 block discarded – undo
5695 5695
                 $eventtime = $this->getMicroTime() - $eventtime;
5696 5696
                 $this->pluginsCode .= sprintf('<fieldset><legend><b>%s / %s</b> (%2.2f ms)</legend>', $evtName, $pluginName, $eventtime * 1000);
5697 5697
                 foreach ($parameter as $k => $v) {
5698
-                    $this->pluginsCode .= "{$k} => " . print_r($v, true) . '<br>';
5698
+                    $this->pluginsCode .= "{$k} => ".print_r($v, true).'<br>';
5699 5699
                 }
5700 5700
                 $this->pluginsCode .= '</fieldset><br />';
5701 5701
                 $this->pluginsTime["{$evtName} / {$pluginName}"] += $eventtime;
@@ -5723,13 +5723,13 @@  discard block
 block discarded – undo
5723 5723
         $plugin = array();
5724 5724
         if (isset ($this->pluginCache[$pluginName])) {
5725 5725
             $pluginCode = $this->pluginCache[$pluginName];
5726
-            $pluginProperties = isset($this->pluginCache[$pluginName . "Props"]) ? $this->pluginCache[$pluginName . "Props"] : '';
5726
+            $pluginProperties = isset($this->pluginCache[$pluginName."Props"]) ? $this->pluginCache[$pluginName."Props"] : '';
5727 5727
         } else {
5728 5728
             $pluginName = $this->getDatabase()->escape($pluginName);
5729 5729
             $result = $this->getDatabase()->select('name, plugincode, properties', $this->getDatabase()->getFullTableName("site_plugins"), "name='{$pluginName}' AND disabled=0");
5730 5730
             if ($row = $this->getDatabase()->getRow($result)) {
5731 5731
                 $pluginCode = $this->pluginCache[$row['name']] = $row['plugincode'];
5732
-                $pluginProperties = $this->pluginCache[$row['name'] . "Props"] = $row['properties'];
5732
+                $pluginProperties = $this->pluginCache[$row['name']."Props"] = $row['properties'];
5733 5733
             } else {
5734 5734
                 $pluginCode = $this->pluginCache[$pluginName] = "return false;";
5735 5735
                 $pluginProperties = '';
@@ -5753,7 +5753,7 @@  discard block
 block discarded – undo
5753 5753
     {
5754 5754
         $property = array();
5755 5755
 
5756
-        if(\is_scalar($propertyString)) {
5756
+        if (\is_scalar($propertyString)) {
5757 5757
             $propertyString = trim($propertyString);
5758 5758
             $propertyString = str_replace('{}', '', $propertyString);
5759 5759
             $propertyString = str_replace('} {', ',', $propertyString);
@@ -5807,7 +5807,7 @@  discard block
 block discarded – undo
5807 5807
                 }
5808 5808
             }
5809 5809
         }
5810
-        elseif(\is_array($propertyString)) {
5810
+        elseif (\is_array($propertyString)) {
5811 5811
             $property = $propertyString;
5812 5812
         }
5813 5813
         if (!empty($elementName) && !empty($elementType)) {
@@ -5838,7 +5838,7 @@  discard block
 block discarded – undo
5838 5838
     public function parseDocBlockFromFile($element_dir, $filename, $escapeValues = false)
5839 5839
     {
5840 5840
         $params = array();
5841
-        $fullpath = $element_dir . '/' . $filename;
5841
+        $fullpath = $element_dir.'/'.$filename;
5842 5842
         if (is_readable($fullpath)) {
5843 5843
             $tpl = @fopen($fullpath, "r");
5844 5844
             if ($tpl) {
@@ -6005,8 +6005,8 @@  discard block
 block discarded – undo
6005 6005
         $ph = array('site_url' => MODX_SITE_URL);
6006 6006
         $regexUrl = "/((http|https|ftp|ftps)\:\/\/[^\/]+(\/[^\s]+[^,.?!:;\s])?)/";
6007 6007
         $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';
6008
-        $emailSubject = isset($parsed['name']) ? '?subject=' . $parsed['name'] : '';
6009
-        $emailSubject .= isset($parsed['version']) ? ' v' . $parsed['version'] : '';
6008
+        $emailSubject = isset($parsed['name']) ? '?subject='.$parsed['name'] : '';
6009
+        $emailSubject .= isset($parsed['version']) ? ' v'.$parsed['version'] : '';
6010 6010
         foreach ($parsed as $key => $val) {
6011 6011
             if (is_array($val)) {
6012 6012
                 foreach ($val as $key2 => $val2) {
@@ -6015,7 +6015,7 @@  discard block
 block discarded – undo
6015 6015
                         $val2 = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val2);
6016 6016
                     }
6017 6017
                     if (preg_match($regexEmail, $val2, $url)) {
6018
-                        $val2 = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val2);
6018
+                        $val2 = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val2);
6019 6019
                     }
6020 6020
                     $parsed[$key][$key2] = $val2;
6021 6021
                 }
@@ -6025,7 +6025,7 @@  discard block
 block discarded – undo
6025 6025
                     $val = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val);
6026 6026
                 }
6027 6027
                 if (preg_match($regexEmail, $val, $url)) {
6028
-                    $val = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val);
6028
+                    $val = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val);
6029 6029
                 }
6030 6030
                 $parsed[$key] = $val;
6031 6031
             }
@@ -6039,32 +6039,32 @@  discard block
 block discarded – undo
6039 6039
         );
6040 6040
 
6041 6041
         $nl = "\n";
6042
-        $list = isset($parsed['logo']) ? '<img src="' . $this->config['base_url'] . ltrim($parsed['logo'], "/") . '" style="float:right;max-width:100px;height:auto;" />' . $nl : '';
6043
-        $list .= '<p>' . $nl;
6044
-        $list .= isset($parsed['name']) ? '<strong>' . $parsed['name'] . '</strong><br/>' . $nl : '';
6045
-        $list .= isset($parsed['description']) ? $parsed['description'] . $nl : '';
6046
-        $list .= '</p><br/>' . $nl;
6047
-        $list .= isset($parsed['version']) ? '<p><strong>' . $_lang['version'] . ':</strong> ' . $parsed['version'] . '</p>' . $nl : '';
6048
-        $list .= isset($parsed['license']) ? '<p><strong>' . $_lang['license'] . ':</strong> ' . $parsed['license'] . '</p>' . $nl : '';
6049
-        $list .= isset($parsed['lastupdate']) ? '<p><strong>' . $_lang['last_update'] . ':</strong> ' . $parsed['lastupdate'] . '</p>' . $nl : '';
6050
-        $list .= '<br/>' . $nl;
6042
+        $list = isset($parsed['logo']) ? '<img src="'.$this->config['base_url'].ltrim($parsed['logo'], "/").'" style="float:right;max-width:100px;height:auto;" />'.$nl : '';
6043
+        $list .= '<p>'.$nl;
6044
+        $list .= isset($parsed['name']) ? '<strong>'.$parsed['name'].'</strong><br/>'.$nl : '';
6045
+        $list .= isset($parsed['description']) ? $parsed['description'].$nl : '';
6046
+        $list .= '</p><br/>'.$nl;
6047
+        $list .= isset($parsed['version']) ? '<p><strong>'.$_lang['version'].':</strong> '.$parsed['version'].'</p>'.$nl : '';
6048
+        $list .= isset($parsed['license']) ? '<p><strong>'.$_lang['license'].':</strong> '.$parsed['license'].'</p>'.$nl : '';
6049
+        $list .= isset($parsed['lastupdate']) ? '<p><strong>'.$_lang['last_update'].':</strong> '.$parsed['lastupdate'].'</p>'.$nl : '';
6050
+        $list .= '<br/>'.$nl;
6051 6051
         $first = true;
6052 6052
         foreach ($arrayParams as $param => $label) {
6053 6053
             if (isset($parsed[$param])) {
6054 6054
                 if ($first) {
6055
-                    $list .= '<p><strong>' . $_lang['references'] . '</strong></p>' . $nl;
6056
-                    $list .= '<ul class="docBlockList">' . $nl;
6055
+                    $list .= '<p><strong>'.$_lang['references'].'</strong></p>'.$nl;
6056
+                    $list .= '<ul class="docBlockList">'.$nl;
6057 6057
                     $first = false;
6058 6058
                 }
6059
-                $list .= '    <li><strong>' . $label . '</strong>' . $nl;
6060
-                $list .= '        <ul>' . $nl;
6059
+                $list .= '    <li><strong>'.$label.'</strong>'.$nl;
6060
+                $list .= '        <ul>'.$nl;
6061 6061
                 foreach ($parsed[$param] as $val) {
6062
-                    $list .= '            <li>' . $val . '</li>' . $nl;
6062
+                    $list .= '            <li>'.$val.'</li>'.$nl;
6063 6063
                 }
6064
-                $list .= '        </ul></li>' . $nl;
6064
+                $list .= '        </ul></li>'.$nl;
6065 6065
             }
6066 6066
         }
6067
-        $list .= !$first ? '</ul>' . $nl : '';
6067
+        $list .= !$first ? '</ul>'.$nl : '';
6068 6068
 
6069 6069
         return $list;
6070 6070
     }
@@ -6139,8 +6139,8 @@  discard block
 block discarded – undo
6139 6139
      */
6140 6140
     public function addSnippet($name, $phpCode, $namespace = '#', array $defaultParams = array())
6141 6141
     {
6142
-        $this->snippetCache[$namespace . $name] = $phpCode;
6143
-        $this->snippetCache[$namespace . $name . 'Props'] = $defaultParams;
6142
+        $this->snippetCache[$namespace.$name] = $phpCode;
6143
+        $this->snippetCache[$namespace.$name.'Props'] = $defaultParams;
6144 6144
     }
6145 6145
 
6146 6146
     /**
@@ -6148,7 +6148,7 @@  discard block
 block discarded – undo
6148 6148
      */
6149 6149
     public function addChunk($name, $text, $namespace = '#')
6150 6150
     {
6151
-        $this->chunkCache[$namespace . $name] = $text;
6151
+        $this->chunkCache[$namespace.$name] = $text;
6152 6152
     }
6153 6153
 
6154 6154
     /**
@@ -6158,7 +6158,7 @@  discard block
 block discarded – undo
6158 6158
     {
6159 6159
         $out = array();
6160 6160
 
6161
-        if (! is_dir($scanPath) || empty($ext)) {
6161
+        if (!is_dir($scanPath) || empty($ext)) {
6162 6162
             return $out;
6163 6163
         }
6164 6164
         $iterator = new \RecursiveIteratorIterator(
@@ -6170,22 +6170,22 @@  discard block
 block discarded – undo
6170 6170
              * @var \SplFileInfo $item
6171 6171
              */
6172 6172
             if ($item->isFile() && $item->isReadable() && \in_array($item->getExtension(), $ext)) {
6173
-                $name = $item->getBasename('.' . $item->getExtension());
6173
+                $name = $item->getBasename('.'.$item->getExtension());
6174 6174
                 $path = ltrim(str_replace(
6175 6175
                     array(rtrim($scanPath, '//'), '/'),
6176 6176
                     array('', '\\'),
6177
-                    $item->getPath() . '/'
6177
+                    $item->getPath().'/'
6178 6178
                 ), '\\');
6179 6179
 
6180 6180
                 if (!empty($path)) {
6181
-                    $name = $path . $name;
6181
+                    $name = $path.$name;
6182 6182
                 }
6183 6183
                 switch ($type) {
6184 6184
                     case 'chunk':
6185 6185
                         $out[$name] = file_get_contents($item->getRealPath());
6186 6186
                         break;
6187 6187
                     case 'snippet':
6188
-                        $out[$name] = "return require '" . $item->getRealPath() . "';";
6188
+                        $out[$name] = "return require '".$item->getRealPath()."';";
6189 6189
                         break;
6190 6190
                     default:
6191 6191
                         throw new \Exception;
@@ -6229,7 +6229,7 @@  discard block
 block discarded – undo
6229 6229
         }
6230 6230
 
6231 6231
         if (!$isSafe) {
6232
-            $msg = $phpcode . "\n" . $this->currentSnippet . "\n" . print_r($_SERVER, true);
6232
+            $msg = $phpcode."\n".$this->currentSnippet."\n".print_r($_SERVER, true);
6233 6233
             $title = sprintf('Unknown eval was executed (%s)', $this->getPhpCompat()->htmlspecialchars(substr(trim($phpcode), 0, 50)));
6234 6234
             $this->messageQuit($title, '', true, '', '', 'Parser', $msg);
6235 6235
             return;
@@ -6243,7 +6243,7 @@  discard block
 block discarded – undo
6243 6243
             return 'array()';
6244 6244
         }
6245 6245
 
6246
-        $output = $echo . $return;
6246
+        $output = $echo.$return;
6247 6247
         modx_sanitize_gpc($output);
6248 6248
         return $this->getPhpCompat()->htmlspecialchars($output); // Maybe, all html tags are dangerous
6249 6249
     }
@@ -6261,8 +6261,8 @@  discard block
 block discarded – undo
6261 6261
 
6262 6262
         $safe = explode(',', $safe_functions);
6263 6263
 
6264
-        $phpcode = rtrim($phpcode, ';') . ';';
6265
-        $tokens = token_get_all('<?php ' . $phpcode);
6264
+        $phpcode = rtrim($phpcode, ';').';';
6265
+        $tokens = token_get_all('<?php '.$phpcode);
6266 6266
         foreach ($tokens as $i => $token) {
6267 6267
             if (!is_array($token)) {
6268 6268
                 continue;
@@ -6298,7 +6298,7 @@  discard block
 block discarded – undo
6298 6298
     public function atBindFileContent($str = '')
6299 6299
     {
6300 6300
 
6301
-        $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'] . 'files/', '');
6301
+        $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'].'files/', '');
6302 6302
 
6303 6303
         if (stripos($str, '@FILE') !== 0) {
6304 6304
             return $str;
@@ -6321,7 +6321,7 @@  discard block
 block discarded – undo
6321 6321
         $errorMsg = sprintf("Could not retrieve string '%s'.", $str);
6322 6322
 
6323 6323
         foreach ($search_path as $path) {
6324
-            $file_path = MODX_BASE_PATH . $path . $str;
6324
+            $file_path = MODX_BASE_PATH.$path.$str;
6325 6325
             if (strpos($file_path, MODX_MANAGER_PATH) === 0) {
6326 6326
                 return $errorMsg;
6327 6327
             } elseif (is_file($file_path)) {
@@ -6335,7 +6335,7 @@  discard block
 block discarded – undo
6335 6335
             return $errorMsg;
6336 6336
         }
6337 6337
 
6338
-        $content = (string)file_get_contents($file_path);
6338
+        $content = (string) file_get_contents($file_path);
6339 6339
         if ($content === false) {
6340 6340
             return $errorMsg;
6341 6341
         }
@@ -6444,22 +6444,22 @@  discard block
 block discarded – undo
6444 6444
 
6445 6445
         $version = isset ($GLOBALS['modx_version']) ? $GLOBALS['modx_version'] : '';
6446 6446
         $release_date = isset ($GLOBALS['release_date']) ? $GLOBALS['release_date'] : '';
6447
-        $request_uri = "http://" . $_SERVER['HTTP_HOST'] . ($_SERVER["SERVER_PORT"] == 80 ? "" : (":" . $_SERVER["SERVER_PORT"])) . $_SERVER['REQUEST_URI'];
6447
+        $request_uri = "http://".$_SERVER['HTTP_HOST'].($_SERVER["SERVER_PORT"] == 80 ? "" : (":".$_SERVER["SERVER_PORT"])).$_SERVER['REQUEST_URI'];
6448 6448
         $request_uri = $this->getPhpCompat()->htmlspecialchars($request_uri, ENT_QUOTES, $this->config['modx_charset']);
6449 6449
         $ua = $this->getPhpCompat()->htmlspecialchars($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, $this->config['modx_charset']);
6450 6450
         $referer = $this->getPhpCompat()->htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_QUOTES, $this->config['modx_charset']);
6451 6451
         if ($is_error) {
6452 6452
             $str = '<h2 style="color:red">&laquo; Evo Parse Error &raquo;</h2>';
6453 6453
             if ($msg != 'PHP Parse Error') {
6454
-                $str .= '<h3 style="color:red">' . $msg . '</h3>';
6454
+                $str .= '<h3 style="color:red">'.$msg.'</h3>';
6455 6455
             }
6456 6456
         } else {
6457 6457
             $str = '<h2 style="color:#003399">&laquo; Evo Debug/ stop message &raquo;</h2>';
6458
-            $str .= '<h3 style="color:#003399">' . $msg . '</h3>';
6458
+            $str .= '<h3 style="color:#003399">'.$msg.'</h3>';
6459 6459
         }
6460 6460
 
6461 6461
         if (!empty ($query)) {
6462
-            $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>';
6462
+            $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>';
6463 6463
         }
6464 6464
 
6465 6465
         $errortype = array(
@@ -6482,13 +6482,13 @@  discard block
 block discarded – undo
6482 6482
 
6483 6483
         if (!empty($nr) || !empty($file)) {
6484 6484
             if ($text != '') {
6485
-                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : ' . $text . '</div>';
6485
+                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : '.$text.'</div>';
6486 6486
             }
6487 6487
             if ($output != '') {
6488
-                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">' . $output . '</div>';
6488
+                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">'.$output.'</div>';
6489 6489
             }
6490 6490
             if ($nr !== '') {
6491
-                $table[] = array('ErrorType[num]', $errortype [$nr] . "[" . $nr . "]");
6491
+                $table[] = array('ErrorType[num]', $errortype [$nr]."[".$nr."]");
6492 6492
             }
6493 6493
             if ($file) {
6494 6494
                 $table[] = array('File', $file);
@@ -6508,7 +6508,7 @@  discard block
 block discarded – undo
6508 6508
         }
6509 6509
 
6510 6510
         if (!empty($this->event->activePlugin)) {
6511
-            $table[] = array('Current Plugin', $this->event->activePlugin . '(' . $this->event->name . ')');
6511
+            $table[] = array('Current Plugin', $this->event->activePlugin.'('.$this->event->name.')');
6512 6512
         }
6513 6513
 
6514 6514
         $str .= $MakeTable->create($table, array('Error information', ''));
@@ -6518,17 +6518,17 @@  discard block
 block discarded – undo
6518 6518
         $table[] = array('REQUEST_URI', $request_uri);
6519 6519
 
6520 6520
         if ($this->getManagerApi()->action) {
6521
-            include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
6521
+            include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php');
6522 6522
             global $action_list;
6523 6523
             $actionName = (isset($action_list[$this->getManagerApi()->action])) ? " - {$action_list[$this->getManagerApi()->action]}" : '';
6524 6524
 
6525
-            $table[] = array('Manager action', $this->getManagerApi()->action . $actionName);
6525
+            $table[] = array('Manager action', $this->getManagerApi()->action.$actionName);
6526 6526
         }
6527 6527
 
6528 6528
         if (preg_match('@^[0-9]+@', $this->documentIdentifier)) {
6529 6529
             $resource = $this->getDocumentObject('id', $this->documentIdentifier);
6530 6530
             $url = $this->makeUrl($this->documentIdentifier, '', '', 'full');
6531
-            $table[] = array('Resource', '[' . $this->documentIdentifier . '] <a href="' . $url . '" target="_blank">' . $resource['pagetitle'] . '</a>');
6531
+            $table[] = array('Resource', '['.$this->documentIdentifier.'] <a href="'.$url.'" target="_blank">'.$resource['pagetitle'].'</a>');
6532 6532
         }
6533 6533
         $table[] = array('Referer', $referer);
6534 6534
         $table[] = array('User Agent', $ua);
@@ -6549,7 +6549,7 @@  discard block
 block discarded – undo
6549 6549
 
6550 6550
         $mem = memory_get_peak_usage(true);
6551 6551
         $total_mem = $mem - $this->mstart;
6552
-        $total_mem = ($total_mem / 1024 / 1024) . ' mb';
6552
+        $total_mem = ($total_mem / 1024 / 1024).' mb';
6553 6553
 
6554 6554
         $queryTime = $this->queryTime;
6555 6555
         $phpTime = $totalTime - $queryTime;
@@ -6570,18 +6570,18 @@  discard block
 block discarded – undo
6570 6570
         $str .= $this->get_backtrace(debug_backtrace());
6571 6571
         // Log error
6572 6572
         if (!empty($this->currentSnippet)) {
6573
-            $source = 'Snippet - ' . $this->currentSnippet;
6573
+            $source = 'Snippet - '.$this->currentSnippet;
6574 6574
         } elseif (!empty($this->event->activePlugin)) {
6575
-            $source = 'Plugin - ' . $this->event->activePlugin;
6575
+            $source = 'Plugin - '.$this->event->activePlugin;
6576 6576
         } elseif ($source !== '') {
6577
-            $source = 'Parser - ' . $source;
6577
+            $source = 'Parser - '.$source;
6578 6578
         } elseif ($query !== '') {
6579 6579
             $source = 'SQL Query';
6580 6580
         } else {
6581 6581
             $source = 'Parser';
6582 6582
         }
6583 6583
         if ($msg) {
6584
-            $source .= ' / ' . $msg;
6584
+            $source .= ' / '.$msg;
6585 6585
         }
6586 6586
         if (isset($actionName) && !empty($actionName)) {
6587 6587
             $source .= $actionName;
@@ -6613,12 +6613,12 @@  discard block
 block discarded – undo
6613 6613
 
6614 6614
         // Display error
6615 6615
         if (isset($_SESSION['mgrValidated'])) {
6616
-            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>
6616
+            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>
6617 6617
                  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6618
-                 <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'] . 'media/style/' . $this->config['manager_theme'] . '/style.css" />
6618
+                 <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'].'media/style/'.$this->config['manager_theme'].'/style.css" />
6619 6619
                  <style type="text/css">body { padding:10px; } td {font:inherit;}</style>
6620 6620
                  </head><body>
6621
-                 ' . $str . '</body></html>';
6621
+                 ' . $str.'</body></html>';
6622 6622
 
6623 6623
         } else {
6624 6624
             echo 'Error';
@@ -6653,7 +6653,7 @@  discard block
 block discarded – undo
6653 6653
             switch ($val['type']) {
6654 6654
                 case '->':
6655 6655
                 case '::':
6656
-                    $functionName = $val['function'] = $val['class'] . $val['type'] . $val['function'];
6656
+                    $functionName = $val['function'] = $val['class'].$val['type'].$val['function'];
6657 6657
                     break;
6658 6658
                 default:
6659 6659
                     $functionName = $val['function'];
@@ -6663,7 +6663,7 @@  discard block
 block discarded – undo
6663 6663
             $args = array_pad(array(), $_, '$var');
6664 6664
             $args = implode(", ", $args);
6665 6665
             $modx = &$this;
6666
-            $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) {
6666
+            $args = preg_replace_callback('/\$var/', function() use ($modx, &$tmp, $val) {
6667 6667
                 $arg = $val['args'][$tmp - 1];
6668 6668
                 switch (true) {
6669 6669
                     case is_null($arg): {
@@ -6675,7 +6675,7 @@  discard block
 block discarded – undo
6675 6675
                         break;
6676 6676
                     }
6677 6677
                     case is_scalar($arg): {
6678
-                        $out = strlen($arg) > 20 ? 'string $var' . $tmp : ("'" . $this->getPhpCompat()->htmlspecialchars(str_replace("'", "\\'", $arg)) . "'");
6678
+                        $out = strlen($arg) > 20 ? 'string $var'.$tmp : ("'".$this->getPhpCompat()->htmlspecialchars(str_replace("'", "\\'", $arg))."'");
6679 6679
                         break;
6680 6680
                     }
6681 6681
                     case is_bool($arg): {
@@ -6683,23 +6683,23 @@  discard block
 block discarded – undo
6683 6683
                         break;
6684 6684
                     }
6685 6685
                     case is_array($arg): {
6686
-                        $out = 'array $var' . $tmp;
6686
+                        $out = 'array $var'.$tmp;
6687 6687
                         break;
6688 6688
                     }
6689 6689
                     case is_object($arg): {
6690
-                        $out = get_class($arg) . ' $var' . $tmp;
6690
+                        $out = get_class($arg).' $var'.$tmp;
6691 6691
                         break;
6692 6692
                     }
6693 6693
                     default: {
6694
-                        $out = '$var' . $tmp;
6694
+                        $out = '$var'.$tmp;
6695 6695
                     }
6696 6696
                 }
6697 6697
                 $tmp++;
6698 6698
                 return $out;
6699 6699
             }, $args);
6700 6700
             $line = array(
6701
-                "<strong>" . $functionName . "</strong>(" . $args . ")",
6702
-                $path . " on line " . $val['line']
6701
+                "<strong>".$functionName."</strong>(".$args.")",
6702
+                $path." on line ".$val['line']
6703 6703
             );
6704 6704
             $table[] = array(implode("<br />", $line));
6705 6705
         }
@@ -6740,7 +6740,7 @@  discard block
 block discarded – undo
6740 6740
             $alias = strip_tags($alias); // strip HTML
6741 6741
             $alias = preg_replace('/[^\.A-Za-z0-9 _-]/', '', $alias); // strip non-alphanumeric characters
6742 6742
             $alias = preg_replace('/\s+/', '-', $alias); // convert white-space to dash
6743
-            $alias = preg_replace('/-+/', '-', $alias);  // convert multiple dashes to one
6743
+            $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one
6744 6744
             $alias = trim($alias, '-'); // trim excess
6745 6745
             return $alias;
6746 6746
         }
@@ -6756,7 +6756,7 @@  discard block
 block discarded – undo
6756 6756
         $precisions = count($sizes) - 1;
6757 6757
         foreach ($sizes as $unit => $bytes) {
6758 6758
             if ($size >= $bytes) {
6759
-                return number_format($size / $bytes, $precisions) . ' ' . $unit;
6759
+                return number_format($size / $bytes, $precisions).' '.$unit;
6760 6760
             }
6761 6761
             $precisions--;
6762 6762
         }
@@ -6860,10 +6860,10 @@  discard block
 block discarded – undo
6860 6860
 
6861 6861
         if (strpos($str, MODX_MANAGER_PATH) === 0) {
6862 6862
             return false;
6863
-        } elseif (is_file(MODX_BASE_PATH . $str)) {
6864
-            $file_path = MODX_BASE_PATH . $str;
6865
-        } elseif (is_file(MODX_BASE_PATH . "{$tpl_dir}{$str}")) {
6866
-            $file_path = MODX_BASE_PATH . $tpl_dir . $str;
6863
+        } elseif (is_file(MODX_BASE_PATH.$str)) {
6864
+            $file_path = MODX_BASE_PATH.$str;
6865
+        } elseif (is_file(MODX_BASE_PATH."{$tpl_dir}{$str}")) {
6866
+            $file_path = MODX_BASE_PATH.$tpl_dir.$str;
6867 6867
         } else {
6868 6868
             return false;
6869 6869
         }
@@ -6987,7 +6987,7 @@  discard block
 block discarded – undo
6987 6987
             $title = 'no title';
6988 6988
         }
6989 6989
         if (is_array($msg)) {
6990
-            $msg = '<pre>' . print_r($msg, true) . '</pre>';
6990
+            $msg = '<pre>'.print_r($msg, true).'</pre>';
6991 6991
         } elseif ($msg === '') {
6992 6992
             $msg = $_SERVER['REQUEST_URI'];
6993 6993
         }
Please login to merge, or discard this patch.