Completed
Push — develop ( 6128e5...aad1a0 )
by Agel_Nash
08:50
created
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->getFullTableName('site_content') . ' WHERE parent=' . $parent . ' AND isfolder=' . $isfolder . ' '));
566
+        return (int) $modx->getDatabase()->getValue($modx->getDatabase()->query('SELECT count(*) FROM '.$modx->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/bootstrap.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * @see https://github.com/theseer/Autoload
4 4
  */
5 5
 spl_autoload_register(
6
-    function($class) {
6
+    function($class){
7 7
         static $classes = null;
8 8
         if ($classes === null) {
9 9
             $classes = array(
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         }
67 67
         $cn = strtolower($class);
68 68
         if (isset($classes[$cn])) {
69
-            require __DIR__ . $classes[$cn];
69
+            require __DIR__.$classes[$cn];
70 70
         }
71 71
     },
72 72
     true,
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
  * @see https://github.com/theseer/Autoload
4 4
  */
5 5
 spl_autoload_register(
6
-    function($class) {
6
+    function($class){
7 7
         static $classes = null;
8 8
         if ($classes === null) {
9 9
             $classes = array(
Please login to merge, or discard this patch.
manager/includes/messageCount.inc.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -4,15 +4,15 @@
 block discarded – undo
4 4
 }
5 5
 
6 6
 $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getFullTableName('user_messages'),
7
-    "recipient=" . $modx->getLoginUserID() . " AND messageread=0");
7
+    "recipient=".$modx->getLoginUserID()." AND messageread=0");
8 8
 $nrnewmessages = $modx->getDatabase()->getValue($rs);
9
-$rs = $modx->getDatabase()->select('COUNT(*)', $modx->getFullTableName('user_messages'), "recipient=" . $modx->getLoginUserID());
9
+$rs = $modx->getDatabase()->select('COUNT(*)', $modx->getFullTableName('user_messages'), "recipient=".$modx->getLoginUserID());
10 10
 $nrtotalmessages = $modx->getDatabase()->getValue($rs);
11 11
 $messagesallowed = $modx->hasPermission('messages');
12 12
 
13 13
 // ajax response
14 14
 if (isset($_POST['updateMsgCount'])) {
15 15
     header("Content-Type: application/json; charset=utf-8");
16
-    print $nrnewmessages . ',' . $nrtotalmessages;
16
+    print $nrnewmessages.','.$nrtotalmessages;
17 17
     exit;
18 18
 }
Please login to merge, or discard this patch.
manager/media/style/default/ajax.php 2 patches
Braces   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -7,11 +7,11 @@  discard block
 block discarded – undo
7 7
 
8 8
 $modx->getDatabase()->connect();
9 9
 
10
-if (empty ($modx->config)) {
10
+if (empty ($modx->config)) {
11 11
     $modx->getSettings();
12 12
 }
13 13
 
14
-if (!isset($_SESSION['mgrValidated']) || !isset($_SERVER['HTTP_X_REQUESTED_WITH']) || (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest') || ($_SERVER['REQUEST_METHOD'] != 'POST')) {
14
+if (!isset($_SESSION['mgrValidated']) || !isset($_SERVER['HTTP_X_REQUESTED_WITH']) || (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest') || ($_SERVER['REQUEST_METHOD'] != 'POST')) {
15 15
     $modx->sendErrorPage();
16 16
 }
17 17
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 
21 21
 $_lang = array();
22 22
 include_once MODX_MANAGER_PATH . '/includes/lang/english.inc.php';
23
-if ($modx->config['manager_language'] != 'english') {
23
+if ($modx->config['manager_language'] != 'english') {
24 24
     include_once MODX_MANAGER_PATH . '/includes/lang/' . $modx->config['manager_language'] . '.inc.php';
25 25
 }
26 26
 include_once MODX_MANAGER_PATH . '/media/style/' . $modx->config['manager_theme'] . '/style.php';
@@ -33,12 +33,12 @@  discard block
 block discarded – undo
33 33
 // set limit sql query
34 34
 $limit = !empty($modx->config['number_of_results']) ? (int) $modx->config['number_of_results'] : 100;
35 35
 
36
-if (isset($action)) {
37
-    switch ($action) {
36
+if (isset($action)) {
37
+    switch ($action) {
38 38
 
39 39
         case '1': {
40 40
 
41
-            switch ($frame) {
41
+            switch ($frame) {
42 42
                 case 'nodes':
43 43
                     include_once MODX_MANAGER_PATH . '/frames/nodes.php';
44 44
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
             $elements = isset($_REQUEST['elements']) && is_scalar($_REQUEST['elements']) ? htmlentities($_REQUEST['elements']) : '';
54 54
 
55
-            if ($elements) {
55
+            if ($elements) {
56 56
                 $output = '';
57 57
                 $items = '';
58 58
                 $sql = '';
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
                 $sqlLike = $filter ? 'WHERE t1.name LIKE "' . $modx->getDatabase()->escape($filter) . '%"' : '';
62 62
                 $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit;
63 63
 
64
-                switch ($elements) {
64
+                switch ($elements) {
65 65
                     case 'element_templates':
66 66
                         $a = 16;
67 67
                         $sqlLike = $filter ? 'WHERE t1.templatename LIKE "' . $modx->getDatabase()->escape($filter) . '%"' : '';
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
                         ORDER BY t1.templatename ASC
72 72
                         ' . $sqlLimit);
73 73
 
74
-                        if ($modx->hasPermission('new_template')) {
74
+                        if ($modx->hasPermission('new_template')) {
75 75
                             $output .= '<li><a id="a_19" href="index.php?a=19" target="main"><i class="fa fa-plus"></i>' . $_lang['new_template'] . '</a></li>';
76 76
                         }
77 77
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
                         ORDER BY t1.name ASC
88 88
                         ' . $sqlLimit);
89 89
 
90
-                        if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) {
90
+                        if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) {
91 91
                             $output .= '<li><a id="a_300" href="index.php?a=300" target="main"><i class="fa fa-plus"></i>' . $_lang['new_tmplvars'] . '</a></li>';
92 92
                         }
93 93
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
                         ORDER BY t1.name ASC
102 102
                         ' . $sqlLimit);
103 103
 
104
-                        if ($modx->hasPermission('new_chunk')) {
104
+                        if ($modx->hasPermission('new_chunk')) {
105 105
                             $output .= '<li><a id="a_77" href="index.php?a=77" target="main"><i class="fa fa-plus"></i>' . $_lang['new_htmlsnippet'] . '</a></li>';
106 106
                         }
107 107
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
                         ORDER BY t1.name ASC
116 116
                         ' . $sqlLimit);
117 117
 
118
-                        if ($modx->hasPermission('new_snippet')) {
118
+                        if ($modx->hasPermission('new_snippet')) {
119 119
                             $output .= '<li><a id="a_23" href="index.php?a=23" target="main"><i class="fa fa-plus"></i>' . $_lang['new_snippet'] . '</a></li>';
120 120
                         }
121 121
 
@@ -129,19 +129,19 @@  discard block
 block discarded – undo
129 129
                         ORDER BY t1.name ASC
130 130
                         ' . $sqlLimit);
131 131
 
132
-                        if ($modx->hasPermission('new_plugin')) {
132
+                        if ($modx->hasPermission('new_plugin')) {
133 133
                             $output .= '<li><a id="a_101" href="index.php?a=101" target="main"><i class="fa fa-plus"></i>' . $_lang['new_plugin'] . '</a></li>';
134 134
                         }
135 135
 
136 136
                         break;
137 137
                 }
138 138
 
139
-                if ($count = $modx->getDatabase()->getRecordCount($sql)) {
140
-                    if ($count == $limit) {
139
+                if ($count = $modx->getDatabase()->getRecordCount($sql)) {
140
+                    if ($count == $limit) {
141 141
                         $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>';
142 142
                     }
143
-                    while ($row = $modx->getDatabase()->getRow($sql)) {
144
-                        if (($row['disabled'] || $row['locked']) && $role != 1) {
143
+                    while ($row = $modx->getDatabase()->getRow($sql)) {
144
+                        if (($row['disabled'] || $row['locked']) && $role != 1) {
145 145
                             continue;
146 146
                         }
147 147
 
@@ -149,9 +149,9 @@  discard block
 block discarded – undo
149 149
                     }
150 150
                 }
151 151
 
152
-                if (isset($_REQUEST['filter'])) {
152
+                if (isset($_REQUEST['filter'])) {
153 153
                     $output = $items;
154
-                } else {
154
+                } else {
155 155
                     $output .= $items;
156 156
                 }
157 157
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
             $sqlLike = $filter ? 'WHERE t1.username LIKE "' . $modx->getDatabase()->escape($filter) . '%"' : '';
170 170
             $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit;
171 171
 
172
-            if(!$modx->hasPermission('save_role')) {
172
+            if(!$modx->hasPermission('save_role')) {
173 173
                 $sqlLike .= $sqlLike ? ' AND ' : 'WHERE ';
174 174
                 $sqlLike .= 't2.role != 1';
175 175
             }
@@ -181,22 +181,22 @@  discard block
 block discarded – undo
181 181
 				ORDER BY t1.username ASC
182 182
 				' . $sqlLimit);
183 183
 
184
-            if ($modx->hasPermission('new_user')) {
184
+            if ($modx->hasPermission('new_user')) {
185 185
                 $output .= '<li><a id="a_11" href="index.php?a=11" target="main"><i class="fa fa-plus"></i>' . $_lang['new_user'] . '</a></li>';
186 186
             }
187 187
 
188
-            if ($count = $modx->getDatabase()->getRecordCount($sql)) {
189
-                if ($count == $limit) {
188
+            if ($count = $modx->getDatabase()->getRecordCount($sql)) {
189
+                if ($count == $limit) {
190 190
                     $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>';
191 191
                 }
192
-                while ($row = $modx->getDatabase()->getRow($sql)) {
192
+                while ($row = $modx->getDatabase()->getRow($sql)) {
193 193
                     $items .= '<li class="item ' . ($row['blocked'] ? 'disabled' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>';
194 194
                 }
195 195
             }
196 196
 
197
-            if (isset($_REQUEST['filter'])) {
197
+            if (isset($_REQUEST['filter'])) {
198 198
                 $output = $items;
199
-            } else {
199
+            } else {
200 200
                 $output .= $items;
201 201
             }
202 202
 
@@ -220,22 +220,22 @@  discard block
 block discarded – undo
220 220
 				ORDER BY t1.username ASC
221 221
 				' . $sqlLimit);
222 222
 
223
-            if ($modx->hasPermission('new_web_user')) {
223
+            if ($modx->hasPermission('new_web_user')) {
224 224
                 $output .= '<li><a id="a_87" href="index.php?a=87" target="main"><i class="fa fa-plus"></i>' . $_lang['new_web_user'] . '</a></li>';
225 225
             }
226 226
 
227
-            if ($count = $modx->getDatabase()->getRecordCount($sql)) {
228
-                if ($count == $limit) {
227
+            if ($count = $modx->getDatabase()->getRecordCount($sql)) {
228
+                if ($count == $limit) {
229 229
                     $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>';
230 230
                 }
231
-                while ($row = $modx->getDatabase()->getRow($sql)) {
231
+                while ($row = $modx->getDatabase()->getRow($sql)) {
232 232
                     $items .= '<li class="item ' . ($row['blocked'] ? 'disabled' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>';
233 233
                 }
234 234
             }
235 235
 
236
-            if (isset($_REQUEST['filter'])) {
236
+            if (isset($_REQUEST['filter'])) {
237 237
                 $output = $items;
238
-            } else {
238
+            } else {
239 239
                 $output .= $items;
240 240
             }
241 241
 
@@ -249,8 +249,8 @@  discard block
 block discarded – undo
249 249
             $type = isset($_REQUEST['type']) && is_scalar($_REQUEST['type']) ? $modx->getDatabase()->escape($_REQUEST['type']) : false;
250 250
             $contextmenu = '';
251 251
 
252
-            if ($role && $name && $type) {
253
-                switch ($type) {
252
+            if ($role && $name && $type) {
253
+                switch ($type) {
254 254
                     case 'Snippet':
255 255
                     case 'SnippetNoCache': {
256 256
 
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 						WHERE name="' . $name . '"
260 260
 						LIMIT 1');
261 261
 
262
-                        if ($modx->getDatabase()->getRecordCount($sql)) {
262
+                        if ($modx->getDatabase()->getRecordCount($sql)) {
263 263
                             $row = $modx->getDatabase()->getRow($sql);
264 264
                             $contextmenu = array(
265 265
                                 'header' => array(
@@ -270,13 +270,13 @@  discard block
 block discarded – undo
270 270
                                     'url' => "index.php?a=22&id=" . $row['id']
271 271
                                 )
272 272
                             );
273
-                            if (!empty($row['description'])) {
273
+                            if (!empty($row['description'])) {
274 274
                                 $contextmenu['seperator'] = '';
275 275
                                 $contextmenu['description'] = array(
276 276
                                     'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
277 277
                                 );
278 278
                             }
279
-                        } else {
279
+                        } else {
280 280
                             $contextmenu = array(
281 281
                                 'header' => array(
282 282
                                     'innerHTML' => '<i class="fa fa-code"></i> ' . $name
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 						WHERE name="' . $name . '"
298 298
 						LIMIT 1');
299 299
 
300
-                        if ($modx->getDatabase()->getRecordCount($sql)) {
300
+                        if ($modx->getDatabase()->getRecordCount($sql)) {
301 301
                             $row = $modx->getDatabase()->getRow($sql);
302 302
                             $contextmenu = array(
303 303
                                 'header' => array(
@@ -308,13 +308,13 @@  discard block
 block discarded – undo
308 308
                                     'url' => "index.php?a=78&id=" . $row['id']
309 309
                                 )
310 310
                             );
311
-                            if (!empty($row['description'])) {
311
+                            if (!empty($row['description'])) {
312 312
                                 $contextmenu['seperator'] = '';
313 313
                                 $contextmenu['description'] = array(
314 314
                                     'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
315 315
                                 );
316 316
                             }
317
-                        } else {
317
+                        } else {
318 318
                             $contextmenu = array(
319 319
                                 'header' => array(
320 320
                                     'innerHTML' => '<i class="fa fa-th-large"></i> ' . $name
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 						WHERE name="' . $name . '"
335 335
 						LIMIT 1');
336 336
 
337
-                        if ($modx->getDatabase()->getRecordCount($sql)) {
337
+                        if ($modx->getDatabase()->getRecordCount($sql)) {
338 338
                             $row = $modx->getDatabase()->getRow($sql);
339 339
                             $contextmenu = array(
340 340
                                 'header' => array(
@@ -345,20 +345,20 @@  discard block
 block discarded – undo
345 345
                                     'url' => "index.php?a=78&id=" . $row['id']
346 346
                                 )
347 347
                             );
348
-                            if (!empty($row['description'])) {
348
+                            if (!empty($row['description'])) {
349 349
                                 $contextmenu['seperator'] = '';
350 350
                                 $contextmenu['description'] = array(
351 351
                                     'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
352 352
                                 );
353 353
                             }
354
-                        } else {
354
+                        } else {
355 355
 
356 356
                             $sql = $modx->getDatabase()->query('SELECT *
357 357
 							FROM ' . $modx->getFullTableName('site_snippets') . '
358 358
 							WHERE name="' . $name . '"
359 359
 							LIMIT 1');
360 360
 
361
-                            if ($modx->getDatabase()->getRecordCount($sql)) {
361
+                            if ($modx->getDatabase()->getRecordCount($sql)) {
362 362
                                 $row = $modx->getDatabase()->getRow($sql);
363 363
                                 $contextmenu = array(
364 364
                                     'header' => array(
@@ -369,13 +369,13 @@  discard block
 block discarded – undo
369 369
                                         'url' => "index.php?a=22&id=" . $row['id']
370 370
                                     )
371 371
                                 );
372
-                                if (!empty($row['description'])) {
372
+                                if (!empty($row['description'])) {
373 373
                                     $contextmenu['seperator'] = '';
374 374
                                     $contextmenu['description'] = array(
375 375
                                         'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
376 376
                                     );
377 377
                                 }
378
-                            } else {
378
+                            } else {
379 379
                                 $contextmenu = array(
380 380
                                     'header' => array(
381 381
                                         'innerHTML' => '<i class="fa fa-code"></i> ' . $name
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
                             'alias_visible'
438 438
                         );
439 439
 
440
-                        if (in_array($name, $default_field)) {
440
+                        if (in_array($name, $default_field)) {
441 441
                             return;
442 442
                         }
443 443
 
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
 						WHERE name="' . $name . '"
447 447
 						LIMIT 1');
448 448
 
449
-                        if ($modx->getDatabase()->getRecordCount($sql)) {
449
+                        if ($modx->getDatabase()->getRecordCount($sql)) {
450 450
                             $row = $modx->getDatabase()->getRow($sql);
451 451
                             $contextmenu = array(
452 452
                                 'header' => array(
@@ -457,13 +457,13 @@  discard block
 block discarded – undo
457 457
                                     'url' => "index.php?a=301&id=" . $row['id']
458 458
                                 )
459 459
                             );
460
-                            if (!empty($row['description'])) {
460
+                            if (!empty($row['description'])) {
461 461
                                 $contextmenu['seperator'] = '';
462 462
                                 $contextmenu['description'] = array(
463 463
                                     'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
464 464
                                 );
465 465
                             }
466
-                        } else {
466
+                        } else {
467 467
                             $contextmenu = array(
468 468
                                 'header' => array(
469 469
                                     'innerHTML' => '<i class="fa fa-list-alt"></i> ' . $name
@@ -488,13 +488,13 @@  discard block
 block discarded – undo
488 488
         case 'movedocument' : {
489 489
             $json = array();
490 490
 
491
-            if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) {
491
+            if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) {
492 492
                 $id = !empty($_REQUEST['id']) ? (int)$_REQUEST['id'] : '';
493 493
                 $parent = isset($_REQUEST['parent']) ? (int)$_REQUEST['parent'] : 0;
494 494
                 $menuindex = isset($_REQUEST['menuindex']) && is_scalar($_REQUEST['menuindex']) ? $_REQUEST['menuindex'] : 0;
495 495
 
496 496
                 // set parent
497
-                if ($id && $parent >= 0) {
497
+                if ($id && $parent >= 0) {
498 498
 
499 499
                     // find older parent
500 500
                     $parentOld = $modx->getDatabase()->getValue($modx->getDatabase()->select('parent', $modx->getFullTableName('site_content'), 'id=' . $id));
@@ -505,31 +505,31 @@  discard block
 block discarded – undo
505 505
                         'new_parent'  => $parent,
506 506
                     ]);
507 507
 
508
-                    if (is_array($eventOut) && count($eventOut) > 0) {
508
+                    if (is_array($eventOut) && count($eventOut) > 0) {
509 509
                         $eventParent = array_pop($eventOut);
510 510
 
511
-                        if ($eventParent == $parentOld) {
511
+                        if ($eventParent == $parentOld) {
512 512
                             $json['errors'] = $_lang['error_movedocument2'];
513
-                        } else {
513
+                        } else {
514 514
                             $parent = $eventParent;
515 515
                         }
516 516
                     }
517 517
 
518
-                    if (empty($json['errors'])) {
518
+                    if (empty($json['errors'])) {
519 519
                         // check privileges user for move docs
520
-                        if (!empty($modx->config['tree_show_protected']) && $role != 1) {
520
+                        if (!empty($modx->config['tree_show_protected']) && $role != 1) {
521 521
                             $sql = $modx->getDatabase()->select('*', $modx->getFullTableName('document_groups'), 'document IN(' . $id . ',' . $parent . ',' . $parentOld . ')');
522
-                            if ($modx->getDatabase()->getRecordCount($sql)) {
522
+                            if ($modx->getDatabase()->getRecordCount($sql)) {
523 523
                                 $document_groups = array();
524
-                                while ($row = $modx->getDatabase()->getRow($sql)) {
524
+                                while ($row = $modx->getDatabase()->getRow($sql)) {
525 525
                                     $document_groups[$row['document']]['groups'][] = $row['document_group'];
526 526
                                 }
527
-                                foreach ($document_groups as $key => $value) {
528
-                                    if (($key == $parent || $key == $parentOld || $key == $id) && !in_array($role, $value['groups'])) {
527
+                                foreach ($document_groups as $key => $value) {
528
+                                    if (($key == $parent || $key == $parentOld || $key == $id) && !in_array($role, $value['groups'])) {
529 529
                                         $json['errors'] = $_lang["error_no_privileges"];
530 530
                                     }
531 531
                                 }
532
-                                if ($json['errors']) {
532
+                                if ($json['errors']) {
533 533
                                     header('content-type: application/json');
534 534
                                     echo json_encode($json, JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE);
535 535
                                     break;
@@ -537,9 +537,9 @@  discard block
 block discarded – undo
537 537
                             }
538 538
                         }
539 539
 
540
-                        if ($parent == 0 && $parent != $parentOld && !$modx->config['udperms_allowroot'] && $role != 1) {
540
+                        if ($parent == 0 && $parent != $parentOld && !$modx->config['udperms_allowroot'] && $role != 1) {
541 541
                             $json['errors'] = $_lang["error_no_privileges"];
542
-                        } else {
542
+                        } else {
543 543
                             // set new parent
544 544
                             $modx->getDatabase()->update(array(
545 545
                                 'parent' => $parent
@@ -549,13 +549,13 @@  discard block
 block discarded – undo
549 549
                                 'isfolder' => 1
550 550
                             ), $modx->getFullTableName('site_content'), 'id=' . $parent);
551 551
 
552
-                            if ($parent != $parentOld) {
552
+                            if ($parent != $parentOld) {
553 553
                                 // check children docs and set parent isfolder
554
-                                if ($modx->getDatabase()->getRecordCount($modx->getDatabase()->select('id', $modx->getFullTableName('site_content'), 'parent=' . $parentOld))) {
554
+                                if ($modx->getDatabase()->getRecordCount($modx->getDatabase()->select('id', $modx->getFullTableName('site_content'), 'parent=' . $parentOld))) {
555 555
                                     $modx->getDatabase()->update(array(
556 556
                                         'isfolder' => 1
557 557
                                     ), $modx->getFullTableName('site_content'), 'id=' . $parentOld);
558
-                                } else {
558
+                                } else {
559 559
                                     $modx->getDatabase()->update(array(
560 560
                                         'isfolder' => 0
561 561
                                     ), $modx->getFullTableName('site_content'), 'id=' . $parentOld);
@@ -563,16 +563,16 @@  discard block
 block discarded – undo
563 563
                             }
564 564
 
565 565
                             // set menuindex
566
-                            if (!empty($menuindex)) {
566
+                            if (!empty($menuindex)) {
567 567
                                 $menuindex = explode(',', $menuindex);
568
-                                foreach ($menuindex as $key => $value) {
568
+                                foreach ($menuindex as $key => $value) {
569 569
                                     $modx->getDatabase()->query('UPDATE ' . $modx->getFullTableName('site_content') . ' SET menuindex=' . $key . ' WHERE id=' . $value);
570 570
                                 }
571
-                            } else {
571
+                            } else {
572 572
                                 // TODO: max(*) menuindex
573 573
                             }
574 574
 
575
-                            if (!$json['errors']) {
575
+                            if (!$json['errors']) {
576 576
                                 $json['success'] = $_lang["actioncomplete"];
577 577
 
578 578
                                 $modx->invokeEvent('onAfterMoveDocument', [
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
                         }
585 585
                     }
586 586
                 }
587
-            } else {
587
+            } else {
588 588
                 $json['errors'] = $_lang["error_no_privileges"];
589 589
             }
590 590
 
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
 
601 601
             $output = !!$modx->elementIsLocked($type, $id, true);
602 602
 
603
-            if (!$output) {
603
+            if (!$output) {
604 604
                 $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : '';
605 605
                 $docgrp_cond = $docgrp ? ' OR dg.document_group IN (' . $docgrp . ')' : '';
606 606
                 $sql = '
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
                     LEFT JOIN ' . $modx->getFullTableName('document_groups') . ' dg ON dg.document=sc.id
610 610
                     WHERE sc.id=' . $id . ' GROUP BY sc.id';
611 611
                 $sql = $modx->getDatabase()->query($sql);
612
-                if ($modx->getDatabase()->getRecordCount($sql)) {
612
+                if ($modx->getDatabase()->getRecordCount($sql)) {
613 613
                     $row = $modx->getDatabase()->getRow($sql);
614 614
                     $output = !!$row['locked'];
615 615
                 }
Please login to merge, or discard this patch.
Spacing   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -18,11 +18,11 @@  discard block
 block discarded – undo
18 18
 $modx->sid = session_id();
19 19
 
20 20
 $_lang = array();
21
-include_once MODX_MANAGER_PATH . '/includes/lang/english.inc.php';
21
+include_once MODX_MANAGER_PATH.'/includes/lang/english.inc.php';
22 22
 if ($modx->config['manager_language'] != 'english') {
23
-    include_once MODX_MANAGER_PATH . '/includes/lang/' . $modx->config['manager_language'] . '.inc.php';
23
+    include_once MODX_MANAGER_PATH.'/includes/lang/'.$modx->config['manager_language'].'.inc.php';
24 24
 }
25
-include_once MODX_MANAGER_PATH . '/media/style/' . $modx->config['manager_theme'] . '/style.php';
25
+include_once MODX_MANAGER_PATH.'/media/style/'.$modx->config['manager_theme'].'/style.php';
26 26
 
27 27
 $action = isset($_REQUEST['a']) ? $_REQUEST['a'] : '';
28 28
 $frame = isset($_REQUEST['f']) ? $_REQUEST['f'] : '';
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
             switch ($frame) {
41 41
                 case 'nodes':
42
-                    include_once MODX_MANAGER_PATH . '/frames/nodes.php';
42
+                    include_once MODX_MANAGER_PATH.'/frames/nodes.php';
43 43
 
44 44
                     break;
45 45
             }
@@ -57,21 +57,21 @@  discard block
 block discarded – undo
57 57
                 $sql = '';
58 58
                 $a = '';
59 59
                 $filter = !empty($_REQUEST['filter']) && is_scalar($_REQUEST['filter']) ? addcslashes(trim($_REQUEST['filter']), '%*_') : '';
60
-                $sqlLike = $filter ? 'WHERE t1.name LIKE "' . $modx->getDatabase()->escape($filter) . '%"' : '';
61
-                $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit;
60
+                $sqlLike = $filter ? 'WHERE t1.name LIKE "'.$modx->getDatabase()->escape($filter).'%"' : '';
61
+                $sqlLimit = $sqlLike ? '' : 'LIMIT '.$limit;
62 62
 
63 63
                 switch ($elements) {
64 64
                     case 'element_templates':
65 65
                         $a = 16;
66
-                        $sqlLike = $filter ? 'WHERE t1.templatename LIKE "' . $modx->getDatabase()->escape($filter) . '%"' : '';
66
+                        $sqlLike = $filter ? 'WHERE t1.templatename LIKE "'.$modx->getDatabase()->escape($filter).'%"' : '';
67 67
                         $sql = $modx->getDatabase()->query('SELECT t1.id, t1.templatename AS name, t1.locked, 0 AS disabled
68
-                        FROM ' . $modx->getFullTableName('site_templates') . ' AS t1
69
-                        ' . $sqlLike . '
68
+                        FROM ' . $modx->getFullTableName('site_templates').' AS t1
69
+                        ' . $sqlLike.'
70 70
                         ORDER BY t1.templatename ASC
71 71
                         ' . $sqlLimit);
72 72
 
73 73
                         if ($modx->hasPermission('new_template')) {
74
-                            $output .= '<li><a id="a_19" href="index.php?a=19" target="main"><i class="fa fa-plus"></i>' . $_lang['new_template'] . '</a></li>';
74
+                            $output .= '<li><a id="a_19" href="index.php?a=19" target="main"><i class="fa fa-plus"></i>'.$_lang['new_template'].'</a></li>';
75 75
                         }
76 76
 
77 77
                         break;
@@ -79,15 +79,15 @@  discard block
 block discarded – undo
79 79
                     case 'element_tplvars':
80 80
                         $a = 301;
81 81
                         $sql = $modx->getDatabase()->query('SELECT t1.id, t1.name, t1.locked, IF(MIN(t2.tmplvarid),0,1) AS disabled
82
-                        FROM ' . $modx->getFullTableName('site_tmplvars') . ' AS t1
83
-                        LEFT JOIN ' . $modx->getFullTableName('site_tmplvar_templates') . ' AS t2 ON t1.id=t2.tmplvarid
84
-                        ' . $sqlLike . '
82
+                        FROM ' . $modx->getFullTableName('site_tmplvars').' AS t1
83
+                        LEFT JOIN ' . $modx->getFullTableName('site_tmplvar_templates').' AS t2 ON t1.id=t2.tmplvarid
84
+                        ' . $sqlLike.'
85 85
                         GROUP BY t1.id
86 86
                         ORDER BY t1.name ASC
87 87
                         ' . $sqlLimit);
88 88
 
89 89
                         if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) {
90
-                            $output .= '<li><a id="a_300" href="index.php?a=300" target="main"><i class="fa fa-plus"></i>' . $_lang['new_tmplvars'] . '</a></li>';
90
+                            $output .= '<li><a id="a_300" href="index.php?a=300" target="main"><i class="fa fa-plus"></i>'.$_lang['new_tmplvars'].'</a></li>';
91 91
                         }
92 92
 
93 93
                         break;
@@ -95,13 +95,13 @@  discard block
 block discarded – undo
95 95
                     case 'element_htmlsnippets':
96 96
                         $a = 78;
97 97
                         $sql = $modx->getDatabase()->query('SELECT t1.id, t1.name, t1.locked, t1.disabled
98
-                        FROM ' . $modx->getFullTableName('site_htmlsnippets') . ' AS t1
99
-                        ' . $sqlLike . '
98
+                        FROM ' . $modx->getFullTableName('site_htmlsnippets').' AS t1
99
+                        ' . $sqlLike.'
100 100
                         ORDER BY t1.name ASC
101 101
                         ' . $sqlLimit);
102 102
 
103 103
                         if ($modx->hasPermission('new_chunk')) {
104
-                            $output .= '<li><a id="a_77" href="index.php?a=77" target="main"><i class="fa fa-plus"></i>' . $_lang['new_htmlsnippet'] . '</a></li>';
104
+                            $output .= '<li><a id="a_77" href="index.php?a=77" target="main"><i class="fa fa-plus"></i>'.$_lang['new_htmlsnippet'].'</a></li>';
105 105
                         }
106 106
 
107 107
                         break;
@@ -109,13 +109,13 @@  discard block
 block discarded – undo
109 109
                     case 'element_snippets':
110 110
                         $a = 22;
111 111
                         $sql = $modx->getDatabase()->query('SELECT t1.id, t1.name, t1.locked, t1.disabled
112
-                        FROM ' . $modx->getFullTableName('site_snippets') . ' AS t1
113
-                        ' . $sqlLike . '
112
+                        FROM ' . $modx->getFullTableName('site_snippets').' AS t1
113
+                        ' . $sqlLike.'
114 114
                         ORDER BY t1.name ASC
115 115
                         ' . $sqlLimit);
116 116
 
117 117
                         if ($modx->hasPermission('new_snippet')) {
118
-                            $output .= '<li><a id="a_23" href="index.php?a=23" target="main"><i class="fa fa-plus"></i>' . $_lang['new_snippet'] . '</a></li>';
118
+                            $output .= '<li><a id="a_23" href="index.php?a=23" target="main"><i class="fa fa-plus"></i>'.$_lang['new_snippet'].'</a></li>';
119 119
                         }
120 120
 
121 121
                         break;
@@ -123,13 +123,13 @@  discard block
 block discarded – undo
123 123
                     case 'element_plugins':
124 124
                         $a = 102;
125 125
                         $sql = $modx->getDatabase()->query('SELECT t1.id, t1.name, t1.locked, t1.disabled
126
-                        FROM ' . $modx->getFullTableName('site_plugins') . ' AS t1
127
-                        ' . $sqlLike . '
126
+                        FROM ' . $modx->getFullTableName('site_plugins').' AS t1
127
+                        ' . $sqlLike.'
128 128
                         ORDER BY t1.name ASC
129 129
                         ' . $sqlLimit);
130 130
 
131 131
                         if ($modx->hasPermission('new_plugin')) {
132
-                            $output .= '<li><a id="a_101" href="index.php?a=101" target="main"><i class="fa fa-plus"></i>' . $_lang['new_plugin'] . '</a></li>';
132
+                            $output .= '<li><a id="a_101" href="index.php?a=101" target="main"><i class="fa fa-plus"></i>'.$_lang['new_plugin'].'</a></li>';
133 133
                         }
134 134
 
135 135
                         break;
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
                             continue;
145 145
                         }
146 146
 
147
-                        $items .= '<li class="item ' . ($row['disabled'] ? 'disabled' : '') . ($row['locked'] ? ' locked' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main" data-parent-id="a_76__elements_' . $elements . '">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>' . "\n";
147
+                        $items .= '<li class="item '.($row['disabled'] ? 'disabled' : '').($row['locked'] ? ' locked' : '').'"><a id="a_'.$a.'__id_'.$row['id'].'" href="index.php?a='.$a.'&id='.$row['id'].'" target="main" data-parent-id="a_76__elements_'.$elements.'">'.$row['name'].' <small>('.$row['id'].')</small></a></li>'."\n";
148 148
                     }
149 149
                 }
150 150
 
@@ -165,23 +165,23 @@  discard block
 block discarded – undo
165 165
             $output = '';
166 166
             $items = '';
167 167
             $filter = !empty($_REQUEST['filter']) && is_scalar($_REQUEST['filter']) ? addcslashes(trim($_REQUEST['filter']), '\%*_') : '';
168
-            $sqlLike = $filter ? 'WHERE t1.username LIKE "' . $modx->getDatabase()->escape($filter) . '%"' : '';
169
-            $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit;
168
+            $sqlLike = $filter ? 'WHERE t1.username LIKE "'.$modx->getDatabase()->escape($filter).'%"' : '';
169
+            $sqlLimit = $sqlLike ? '' : 'LIMIT '.$limit;
170 170
 
171
-            if(!$modx->hasPermission('save_role')) {
171
+            if (!$modx->hasPermission('save_role')) {
172 172
                 $sqlLike .= $sqlLike ? ' AND ' : 'WHERE ';
173 173
                 $sqlLike .= 't2.role != 1';
174 174
             }
175 175
 
176 176
             $sql = $modx->getDatabase()->query('SELECT t1.*, t1.username AS name, t2.blocked
177
-				FROM ' . $modx->getFullTableName('manager_users') . ' AS t1
178
-				LEFT JOIN ' . $modx->getFullTableName('user_attributes') . ' AS t2 ON t1.id=t2.internalKey
179
-				' . $sqlLike . '
177
+				FROM ' . $modx->getFullTableName('manager_users').' AS t1
178
+				LEFT JOIN ' . $modx->getFullTableName('user_attributes').' AS t2 ON t1.id=t2.internalKey
179
+				' . $sqlLike.'
180 180
 				ORDER BY t1.username ASC
181 181
 				' . $sqlLimit);
182 182
 
183 183
             if ($modx->hasPermission('new_user')) {
184
-                $output .= '<li><a id="a_11" href="index.php?a=11" target="main"><i class="fa fa-plus"></i>' . $_lang['new_user'] . '</a></li>';
184
+                $output .= '<li><a id="a_11" href="index.php?a=11" target="main"><i class="fa fa-plus"></i>'.$_lang['new_user'].'</a></li>';
185 185
             }
186 186
 
187 187
             if ($count = $modx->getDatabase()->getRecordCount($sql)) {
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
                     $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>';
190 190
                 }
191 191
                 while ($row = $modx->getDatabase()->getRow($sql)) {
192
-                    $items .= '<li class="item ' . ($row['blocked'] ? 'disabled' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>';
192
+                    $items .= '<li class="item '.($row['blocked'] ? 'disabled' : '').'"><a id="a_'.$a.'__id_'.$row['id'].'" href="index.php?a='.$a.'&id='.$row['id'].'" target="main">'.$row['name'].' <small>('.$row['id'].')</small></a></li>';
193 193
                 }
194 194
             }
195 195
 
@@ -209,18 +209,18 @@  discard block
 block discarded – undo
209 209
             $output = '';
210 210
             $items = '';
211 211
             $filter = !empty($_REQUEST['filter']) && is_scalar($_REQUEST['filter']) ? addcslashes(trim($_REQUEST['filter']), '\%*_') : '';
212
-            $sqlLike = $filter ? 'WHERE t1.username LIKE "' . $modx->getDatabase()->escape($filter) . '%"' : '';
213
-            $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit;
212
+            $sqlLike = $filter ? 'WHERE t1.username LIKE "'.$modx->getDatabase()->escape($filter).'%"' : '';
213
+            $sqlLimit = $sqlLike ? '' : 'LIMIT '.$limit;
214 214
 
215 215
             $sql = $modx->getDatabase()->query('SELECT t1.*, t1.username AS name, t2.blocked
216
-				FROM ' . $modx->getFullTableName('web_users') . ' AS t1
217
-				LEFT JOIN ' . $modx->getFullTableName('web_user_attributes') . ' AS t2 ON t1.id=t2.internalKey
218
-				' . $sqlLike . '
216
+				FROM ' . $modx->getFullTableName('web_users').' AS t1
217
+				LEFT JOIN ' . $modx->getFullTableName('web_user_attributes').' AS t2 ON t1.id=t2.internalKey
218
+				' . $sqlLike.'
219 219
 				ORDER BY t1.username ASC
220 220
 				' . $sqlLimit);
221 221
 
222 222
             if ($modx->hasPermission('new_web_user')) {
223
-                $output .= '<li><a id="a_87" href="index.php?a=87" target="main"><i class="fa fa-plus"></i>' . $_lang['new_web_user'] . '</a></li>';
223
+                $output .= '<li><a id="a_87" href="index.php?a=87" target="main"><i class="fa fa-plus"></i>'.$_lang['new_web_user'].'</a></li>';
224 224
             }
225 225
 
226 226
             if ($count = $modx->getDatabase()->getRecordCount($sql)) {
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
                     $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>';
229 229
                 }
230 230
                 while ($row = $modx->getDatabase()->getRow($sql)) {
231
-                    $items .= '<li class="item ' . ($row['blocked'] ? 'disabled' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>';
231
+                    $items .= '<li class="item '.($row['blocked'] ? 'disabled' : '').'"><a id="a_'.$a.'__id_'.$row['id'].'" href="index.php?a='.$a.'&id='.$row['id'].'" target="main">'.$row['name'].' <small>('.$row['id'].')</small></a></li>';
232 232
                 }
233 233
             }
234 234
 
@@ -254,35 +254,35 @@  discard block
 block discarded – undo
254 254
                     case 'SnippetNoCache': {
255 255
 
256 256
                         $sql = $modx->getDatabase()->query('SELECT *
257
-						FROM ' . $modx->getFullTableName('site_snippets') . '
258
-						WHERE name="' . $name . '"
257
+						FROM ' . $modx->getFullTableName('site_snippets').'
258
+						WHERE name="' . $name.'"
259 259
 						LIMIT 1');
260 260
 
261 261
                         if ($modx->getDatabase()->getRecordCount($sql)) {
262 262
                             $row = $modx->getDatabase()->getRow($sql);
263 263
                             $contextmenu = array(
264 264
                                 'header' => array(
265
-                                    'innerHTML' => '<i class="fa fa-code"></i> ' . $row['name']
265
+                                    'innerHTML' => '<i class="fa fa-code"></i> '.$row['name']
266 266
                                 ),
267 267
                                 'item' => array(
268
-                                    'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'],
269
-                                    'url' => "index.php?a=22&id=" . $row['id']
268
+                                    'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'],
269
+                                    'url' => "index.php?a=22&id=".$row['id']
270 270
                                 )
271 271
                             );
272 272
                             if (!empty($row['description'])) {
273 273
                                 $contextmenu['seperator'] = '';
274 274
                                 $contextmenu['description'] = array(
275
-                                    'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
275
+                                    'innerHTML' => '<i class="fa fa-info"></i> '.$row['description']
276 276
                                 );
277 277
                             }
278 278
                         } else {
279 279
                             $contextmenu = array(
280 280
                                 'header' => array(
281
-                                    'innerHTML' => '<i class="fa fa-code"></i> ' . $name
281
+                                    'innerHTML' => '<i class="fa fa-code"></i> '.$name
282 282
                                 ),
283 283
                                 'item' => array(
284
-                                    'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_snippet'],
285
-                                    'url' => "index.php?a=23&itemname=" . $name
284
+                                    'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_snippet'],
285
+                                    'url' => "index.php?a=23&itemname=".$name
286 286
                                 )
287 287
                             );
288 288
                         }
@@ -292,35 +292,35 @@  discard block
 block discarded – undo
292 292
                     case 'Chunk' : {
293 293
 
294 294
                         $sql = $modx->getDatabase()->query('SELECT *
295
-						FROM ' . $modx->getFullTableName('site_htmlsnippets') . '
296
-						WHERE name="' . $name . '"
295
+						FROM ' . $modx->getFullTableName('site_htmlsnippets').'
296
+						WHERE name="' . $name.'"
297 297
 						LIMIT 1');
298 298
 
299 299
                         if ($modx->getDatabase()->getRecordCount($sql)) {
300 300
                             $row = $modx->getDatabase()->getRow($sql);
301 301
                             $contextmenu = array(
302 302
                                 'header' => array(
303
-                                    'innerHTML' => '<i class="fa fa-th-large"></i> ' . $row['name']
303
+                                    'innerHTML' => '<i class="fa fa-th-large"></i> '.$row['name']
304 304
                                 ),
305 305
                                 'item' => array(
306
-                                    'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'],
307
-                                    'url' => "index.php?a=78&id=" . $row['id']
306
+                                    'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'],
307
+                                    'url' => "index.php?a=78&id=".$row['id']
308 308
                                 )
309 309
                             );
310 310
                             if (!empty($row['description'])) {
311 311
                                 $contextmenu['seperator'] = '';
312 312
                                 $contextmenu['description'] = array(
313
-                                    'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
313
+                                    'innerHTML' => '<i class="fa fa-info"></i> '.$row['description']
314 314
                                 );
315 315
                             }
316 316
                         } else {
317 317
                             $contextmenu = array(
318 318
                                 'header' => array(
319
-                                    'innerHTML' => '<i class="fa fa-th-large"></i> ' . $name
319
+                                    'innerHTML' => '<i class="fa fa-th-large"></i> '.$name
320 320
                                 ),
321 321
                                 'item' => array(
322
-                                    'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_htmlsnippet'],
323
-                                    'url' => "index.php?a=77&itemname=" . $name
322
+                                    'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_htmlsnippet'],
323
+                                    'url' => "index.php?a=77&itemname=".$name
324 324
                                 )
325 325
                             );
326 326
                         }
@@ -329,8 +329,8 @@  discard block
 block discarded – undo
329 329
                     }
330 330
                     case 'AttributeValue': {
331 331
                         $sql = $modx->getDatabase()->query('SELECT *
332
-						FROM ' . $modx->getFullTableName('site_htmlsnippets') . '
333
-						WHERE name="' . $name . '"
332
+						FROM ' . $modx->getFullTableName('site_htmlsnippets').'
333
+						WHERE name="' . $name.'"
334 334
 						LIMIT 1');
335 335
 
336 336
                         if ($modx->getDatabase()->getRecordCount($sql)) {
@@ -340,52 +340,52 @@  discard block
 block discarded – undo
340 340
                                     'innerText' => $row['name']
341 341
                                 ),
342 342
                                 'item' => array(
343
-                                    'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'],
344
-                                    'url' => "index.php?a=78&id=" . $row['id']
343
+                                    'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'],
344
+                                    'url' => "index.php?a=78&id=".$row['id']
345 345
                                 )
346 346
                             );
347 347
                             if (!empty($row['description'])) {
348 348
                                 $contextmenu['seperator'] = '';
349 349
                                 $contextmenu['description'] = array(
350
-                                    'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
350
+                                    'innerHTML' => '<i class="fa fa-info"></i> '.$row['description']
351 351
                                 );
352 352
                             }
353 353
                         } else {
354 354
 
355 355
                             $sql = $modx->getDatabase()->query('SELECT *
356
-							FROM ' . $modx->getFullTableName('site_snippets') . '
357
-							WHERE name="' . $name . '"
356
+							FROM ' . $modx->getFullTableName('site_snippets').'
357
+							WHERE name="' . $name.'"
358 358
 							LIMIT 1');
359 359
 
360 360
                             if ($modx->getDatabase()->getRecordCount($sql)) {
361 361
                                 $row = $modx->getDatabase()->getRow($sql);
362 362
                                 $contextmenu = array(
363 363
                                     'header' => array(
364
-                                        'innerHTML' => '<i class="fa fa-code"></i> ' . $row['name']
364
+                                        'innerHTML' => '<i class="fa fa-code"></i> '.$row['name']
365 365
                                     ),
366 366
                                     'item' => array(
367
-                                        'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'],
368
-                                        'url' => "index.php?a=22&id=" . $row['id']
367
+                                        'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'],
368
+                                        'url' => "index.php?a=22&id=".$row['id']
369 369
                                     )
370 370
                                 );
371 371
                                 if (!empty($row['description'])) {
372 372
                                     $contextmenu['seperator'] = '';
373 373
                                     $contextmenu['description'] = array(
374
-                                        'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
374
+                                        'innerHTML' => '<i class="fa fa-info"></i> '.$row['description']
375 375
                                     );
376 376
                                 }
377 377
                             } else {
378 378
                                 $contextmenu = array(
379 379
                                     'header' => array(
380
-                                        'innerHTML' => '<i class="fa fa-code"></i> ' . $name
380
+                                        'innerHTML' => '<i class="fa fa-code"></i> '.$name
381 381
                                     ),
382 382
                                     'item' => array(
383
-                                        'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_htmlsnippet'],
384
-                                        'url' => "index.php?a=77&itemname=" . $name
383
+                                        'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_htmlsnippet'],
384
+                                        'url' => "index.php?a=77&itemname=".$name
385 385
                                     ),
386 386
                                     'item2' => array(
387
-                                        'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_snippet'],
388
-                                        'url' => "index.php?a=23&itemname=" . $name
387
+                                        'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_snippet'],
388
+                                        'url' => "index.php?a=23&itemname=".$name
389 389
                                     )
390 390
                                 );
391 391
                             }
@@ -441,35 +441,35 @@  discard block
 block discarded – undo
441 441
                         }
442 442
 
443 443
                         $sql = $modx->getDatabase()->query('SELECT *
444
-						FROM ' . $modx->getFullTableName('site_tmplvars') . '
445
-						WHERE name="' . $name . '"
444
+						FROM ' . $modx->getFullTableName('site_tmplvars').'
445
+						WHERE name="' . $name.'"
446 446
 						LIMIT 1');
447 447
 
448 448
                         if ($modx->getDatabase()->getRecordCount($sql)) {
449 449
                             $row = $modx->getDatabase()->getRow($sql);
450 450
                             $contextmenu = array(
451 451
                                 'header' => array(
452
-                                    'innerHTML' => '<i class="fa fa-list-alt"></i> ' . $row['name']
452
+                                    'innerHTML' => '<i class="fa fa-list-alt"></i> '.$row['name']
453 453
                                 ),
454 454
                                 'item' => array(
455
-                                    'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'],
456
-                                    'url' => "index.php?a=301&id=" . $row['id']
455
+                                    'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'],
456
+                                    'url' => "index.php?a=301&id=".$row['id']
457 457
                                 )
458 458
                             );
459 459
                             if (!empty($row['description'])) {
460 460
                                 $contextmenu['seperator'] = '';
461 461
                                 $contextmenu['description'] = array(
462
-                                    'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
462
+                                    'innerHTML' => '<i class="fa fa-info"></i> '.$row['description']
463 463
                                 );
464 464
                             }
465 465
                         } else {
466 466
                             $contextmenu = array(
467 467
                                 'header' => array(
468
-                                    'innerHTML' => '<i class="fa fa-list-alt"></i> ' . $name
468
+                                    'innerHTML' => '<i class="fa fa-list-alt"></i> '.$name
469 469
                                 ),
470 470
                                 'item' => array(
471
-                                    'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_tmplvars'],
472
-                                    'url' => "index.php?a=300&itemname=" . $name
471
+                                    'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_tmplvars'],
472
+                                    'url' => "index.php?a=300&itemname=".$name
473 473
                                 )
474 474
                             );
475 475
                         }
@@ -488,15 +488,15 @@  discard block
 block discarded – undo
488 488
             $json = array();
489 489
 
490 490
             if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) {
491
-                $id = !empty($_REQUEST['id']) ? (int)$_REQUEST['id'] : '';
492
-                $parent = isset($_REQUEST['parent']) ? (int)$_REQUEST['parent'] : 0;
491
+                $id = !empty($_REQUEST['id']) ? (int) $_REQUEST['id'] : '';
492
+                $parent = isset($_REQUEST['parent']) ? (int) $_REQUEST['parent'] : 0;
493 493
                 $menuindex = isset($_REQUEST['menuindex']) && is_scalar($_REQUEST['menuindex']) ? $_REQUEST['menuindex'] : 0;
494 494
 
495 495
                 // set parent
496 496
                 if ($id && $parent >= 0) {
497 497
 
498 498
                     // find older parent
499
-                    $parentOld = $modx->getDatabase()->getValue($modx->getDatabase()->select('parent', $modx->getFullTableName('site_content'), 'id=' . $id));
499
+                    $parentOld = $modx->getDatabase()->getValue($modx->getDatabase()->select('parent', $modx->getFullTableName('site_content'), 'id='.$id));
500 500
 
501 501
                     $eventOut = $modx->invokeEvent('onBeforeMoveDocument', [
502 502
                         'id_document' => $id,
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
                     if (empty($json['errors'])) {
518 518
                         // check privileges user for move docs
519 519
                         if (!empty($modx->config['tree_show_protected']) && $role != 1) {
520
-                            $sql = $modx->getDatabase()->select('*', $modx->getFullTableName('document_groups'), 'document IN(' . $id . ',' . $parent . ',' . $parentOld . ')');
520
+                            $sql = $modx->getDatabase()->select('*', $modx->getFullTableName('document_groups'), 'document IN('.$id.','.$parent.','.$parentOld.')');
521 521
                             if ($modx->getDatabase()->getRecordCount($sql)) {
522 522
                                 $document_groups = array();
523 523
                                 while ($row = $modx->getDatabase()->getRow($sql)) {
@@ -542,22 +542,22 @@  discard block
 block discarded – undo
542 542
                             // set new parent
543 543
                             $modx->getDatabase()->update(array(
544 544
                                 'parent' => $parent
545
-                            ), $modx->getFullTableName('site_content'), 'id=' . $id);
545
+                            ), $modx->getFullTableName('site_content'), 'id='.$id);
546 546
                             // set parent isfolder = 1
547 547
                             $modx->getDatabase()->update(array(
548 548
                                 'isfolder' => 1
549
-                            ), $modx->getFullTableName('site_content'), 'id=' . $parent);
549
+                            ), $modx->getFullTableName('site_content'), 'id='.$parent);
550 550
 
551 551
                             if ($parent != $parentOld) {
552 552
                                 // check children docs and set parent isfolder
553
-                                if ($modx->getDatabase()->getRecordCount($modx->getDatabase()->select('id', $modx->getFullTableName('site_content'), 'parent=' . $parentOld))) {
553
+                                if ($modx->getDatabase()->getRecordCount($modx->getDatabase()->select('id', $modx->getFullTableName('site_content'), 'parent='.$parentOld))) {
554 554
                                     $modx->getDatabase()->update(array(
555 555
                                         'isfolder' => 1
556
-                                    ), $modx->getFullTableName('site_content'), 'id=' . $parentOld);
556
+                                    ), $modx->getFullTableName('site_content'), 'id='.$parentOld);
557 557
                                 } else {
558 558
                                     $modx->getDatabase()->update(array(
559 559
                                         'isfolder' => 0
560
-                                    ), $modx->getFullTableName('site_content'), 'id=' . $parentOld);
560
+                                    ), $modx->getFullTableName('site_content'), 'id='.$parentOld);
561 561
                                 }
562 562
                             }
563 563
 
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
                             if (!empty($menuindex)) {
566 566
                                 $menuindex = explode(',', $menuindex);
567 567
                                 foreach ($menuindex as $key => $value) {
568
-                                    $modx->getDatabase()->query('UPDATE ' . $modx->getFullTableName('site_content') . ' SET menuindex=' . $key . ' WHERE id=' . $value);
568
+                                    $modx->getDatabase()->query('UPDATE '.$modx->getFullTableName('site_content').' SET menuindex='.$key.' WHERE id='.$value);
569 569
                                 }
570 570
                             } else {
571 571
                                 // TODO: max(*) menuindex
@@ -594,19 +594,19 @@  discard block
 block discarded – undo
594 594
         }
595 595
 
596 596
         case 'getLockedElements': {
597
-            $type = isset($_REQUEST['type']) ? (int)$_REQUEST['type'] : 0;
598
-            $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
597
+            $type = isset($_REQUEST['type']) ? (int) $_REQUEST['type'] : 0;
598
+            $id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
599 599
 
600 600
             $output = !!$modx->elementIsLocked($type, $id, true);
601 601
 
602 602
             if (!$output) {
603 603
                 $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : '';
604
-                $docgrp_cond = $docgrp ? ' OR dg.document_group IN (' . $docgrp . ')' : '';
604
+                $docgrp_cond = $docgrp ? ' OR dg.document_group IN ('.$docgrp.')' : '';
605 605
                 $sql = '
606
-                    SELECT MAX(IF(1=' . $role . ' OR sc.privatemgr=0' . $docgrp_cond . ', 0, 1)) AS locked
607
-                    FROM ' . $modx->getFullTableName('site_content') . ' AS sc 
608
-                    LEFT JOIN ' . $modx->getFullTableName('document_groups') . ' dg ON dg.document=sc.id
609
-                    WHERE sc.id=' . $id . ' GROUP BY sc.id';
606
+                    SELECT MAX(IF(1=' . $role.' OR sc.privatemgr=0'.$docgrp_cond.', 0, 1)) AS locked
607
+                    FROM ' . $modx->getFullTableName('site_content').' AS sc 
608
+                    LEFT JOIN ' . $modx->getFullTableName('document_groups').' dg ON dg.document=sc.id
609
+                    WHERE sc.id=' . $id.' GROUP BY sc.id';
610 610
                 $sql = $modx->getDatabase()->query($sql);
611 611
                 if ($modx->getDatabase()->getRecordCount($sql)) {
612 612
                     $row = $modx->getDatabase()->getRow($sql);
Please login to merge, or discard this patch.
manager/frames/tree.php 3 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3
-	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
3
+    die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 
6 6
 // invoke OnManagerTreeInit event
7 7
 $evtOut = $modx->invokeEvent('OnManagerTreeInit', $_REQUEST);
8 8
 if(is_array($evtOut)) {
9
-	echo implode("\n", $evtOut);
9
+    echo implode("\n", $evtOut);
10 10
 }
11 11
 ?>
12 12
 
@@ -52,23 +52,23 @@  discard block
 block discarded – undo
52 52
 
53 53
 	<div id="treeHolder">
54 54
 		<?php
55
-		// invoke OnManagerTreePrerender event
56
-		$evtOut = $modx->invokeEvent('OnManagerTreePrerender', $modx->getDatabase()->escape($_REQUEST));
57
-		if(is_array($evtOut)) {
58
-			echo implode("\n", $evtOut);
59
-		}
60
-		?>
55
+        // invoke OnManagerTreePrerender event
56
+        $evtOut = $modx->invokeEvent('OnManagerTreePrerender', $modx->getDatabase()->escape($_REQUEST));
57
+        if(is_array($evtOut)) {
58
+            echo implode("\n", $evtOut);
59
+        }
60
+        ?>
61 61
 		<div id="node0" class="rootNode"><a class="node" onclick="modx.tree.treeAction(event, 0)" data-id="0" data-title-esc="<?php $site_name = htmlspecialchars($site_name, ENT_QUOTES, $modx->config['modx_charset']);
62
-			echo $site_name; ?>"><span class="icon"><?php echo $_style['tree_showtree']; ?></span><span class="title"><?php echo $site_name; ?></span></a>
62
+            echo $site_name; ?>"><span class="icon"><?php echo $_style['tree_showtree']; ?></span><span class="title"><?php echo $site_name; ?></span></a>
63 63
 			<div id="treeloader"><i class="fa fa-cog fa-spin fa-3x fa-fw"></i></div>
64 64
 		</div>
65 65
 		<div id="treeRoot"></div>
66 66
 		<?php
67
-		// invoke OnManagerTreeRender event
68
-		$evtOut = $modx->invokeEvent('OnManagerTreeRender', $modx->getDatabase()->escape($_REQUEST));
69
-		if(is_array($evtOut)) {
70
-			echo implode("\n", $evtOut);
71
-		}
72
-		?>
67
+        // invoke OnManagerTreeRender event
68
+        $evtOut = $modx->invokeEvent('OnManagerTreeRender', $modx->getDatabase()->escape($_REQUEST));
69
+        if(is_array($evtOut)) {
70
+            echo implode("\n", $evtOut);
71
+        }
72
+        ?>
73 73
 	</div>
74 74
 </div>
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
 	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 
6 6
 // invoke OnManagerTreeInit event
7 7
 $evtOut = $modx->invokeEvent('OnManagerTreeInit', $_REQUEST);
8
-if(is_array($evtOut)) {
8
+if (is_array($evtOut)) {
9 9
 	echo implode("\n", $evtOut);
10 10
 }
11 11
 ?>
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
 		<a class="treeButton" id="treeMenu_collapsetree" onclick="modx.tree.collapseTree();" title="<?php echo $_lang['collapse_tree']; ?>"><?php echo $_style['collapse_tree']; ?></a>
19 19
 
20
-		<?php if($modx->hasPermission('new_document')) { ?>
20
+		<?php if ($modx->hasPermission('new_document')) { ?>
21 21
 			<a class="treeButton" id="treeMenu_addresource" onclick="modx.tabs({url:'<?= MODX_MANAGER_URL ?>?a=4', title: '<?php echo $_lang['add_resource']; ?>'});" title="<?php echo $_lang['add_resource']; ?>"><?php echo $_style['add_doc_tree']; ?></a>
22 22
 			<a class="treeButton" id="treeMenu_addweblink" onclick="modx.tabs({url:'<?= MODX_MANAGER_URL ?>?a=72', title: '<?php echo $_lang['add_weblink']; ?>'});" title="<?php echo $_lang['add_weblink']; ?>"><?php echo $_style['add_weblink_tree']; ?></a>
23 23
 		<?php } ?>
@@ -26,23 +26,23 @@  discard block
 block discarded – undo
26 26
 
27 27
 		<a class="treeButton" id="treeMenu_sortingtree" onclick="modx.tree.showSorter(event);" title="<?php echo $_lang['sort_tree']; ?>"><?php echo $_style['sort_tree']; ?></a>
28 28
 
29
-		<?php if($modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) { ?>
29
+		<?php if ($modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) { ?>
30 30
 			<a class="treeButton" id="treeMenu_sortingindex" onclick="modx.tabs({url: '<?= MODX_MANAGER_URL ?>?a=56&id=0', title: '<?php echo $_lang['sort_menuindex']; ?>'});" title="<?php echo $_lang['sort_menuindex']; ?>"><?php echo $_style['sort_menuindex']; ?></a>
31 31
 		<?php } ?>
32 32
 
33
-		<?php if($use_browser && $modx->hasPermission('assets_images')) { ?>
34
-			<a class="treeButton" id="treeMenu_openimages" title="<?php echo $_lang["images_management"] . "\n" . $_lang['em_button_shift'] ?>"><?php echo $_style['images_management']; ?></a>
33
+		<?php if ($use_browser && $modx->hasPermission('assets_images')) { ?>
34
+			<a class="treeButton" id="treeMenu_openimages" title="<?php echo $_lang["images_management"]."\n".$_lang['em_button_shift'] ?>"><?php echo $_style['images_management']; ?></a>
35 35
 		<?php } ?>
36 36
 
37
-		<?php if($use_browser && $modx->hasPermission('assets_files')) { ?>
38
-			<a class="treeButton" id="treeMenu_openfiles" title="<?php echo $_lang["files_management"] . "\n" . $_lang['em_button_shift'] ?>"><?php echo $_style['files_management']; ?></a>
37
+		<?php if ($use_browser && $modx->hasPermission('assets_files')) { ?>
38
+			<a class="treeButton" id="treeMenu_openfiles" title="<?php echo $_lang["files_management"]."\n".$_lang['em_button_shift'] ?>"><?php echo $_style['files_management']; ?></a>
39 39
 		<?php } ?>
40 40
 
41
-		<?php if($modx->hasPermission('edit_template') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_plugin')) { ?>
42
-			<a class="treeButton" id="treeMenu_openelements" title="<?php echo $_lang["element_management"] . "\n" . $_lang['em_button_shift'] ?>"><?php echo $_style['element_management']; ?></a>
41
+		<?php if ($modx->hasPermission('edit_template') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_plugin')) { ?>
42
+			<a class="treeButton" id="treeMenu_openelements" title="<?php echo $_lang["element_management"]."\n".$_lang['em_button_shift'] ?>"><?php echo $_style['element_management']; ?></a>
43 43
 		<?php } ?>
44 44
 
45
-		<?php if($modx->hasPermission('empty_trash')) { ?>
45
+		<?php if ($modx->hasPermission('empty_trash')) { ?>
46 46
 			<a class="treeButton treeButtonDisabled" id="treeMenu_emptytrash" title="<?php echo $_lang['empty_recycle_bin_empty']; ?>"><?php echo $_style['empty_recycle_bin_empty']; ?></a>
47 47
 		<?php } ?>
48 48
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 		<?php
55 55
 		// invoke OnManagerTreePrerender event
56 56
 		$evtOut = $modx->invokeEvent('OnManagerTreePrerender', $modx->getDatabase()->escape($_REQUEST));
57
-		if(is_array($evtOut)) {
57
+		if (is_array($evtOut)) {
58 58
 			echo implode("\n", $evtOut);
59 59
 		}
60 60
 		?>
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 		<?php
67 67
 		// invoke OnManagerTreeRender event
68 68
 		$evtOut = $modx->invokeEvent('OnManagerTreeRender', $modx->getDatabase()->escape($_REQUEST));
69
-		if(is_array($evtOut)) {
69
+		if (is_array($evtOut)) {
70 70
 			echo implode("\n", $evtOut);
71 71
 		}
72 72
 		?>
Please login to merge, or discard this patch.
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
 	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 
6 6
 // invoke OnManagerTreeInit event
7 7
 $evtOut = $modx->invokeEvent('OnManagerTreeInit', $_REQUEST);
8
-if(is_array($evtOut)) {
8
+if(is_array($evtOut)) {
9 9
 	echo implode("\n", $evtOut);
10 10
 }
11 11
 ?>
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 		<?php
55 55
 		// invoke OnManagerTreePrerender event
56 56
 		$evtOut = $modx->invokeEvent('OnManagerTreePrerender', $modx->getDatabase()->escape($_REQUEST));
57
-		if(is_array($evtOut)) {
57
+		if(is_array($evtOut)) {
58 58
 			echo implode("\n", $evtOut);
59 59
 		}
60 60
 		?>
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 		<?php
67 67
 		// invoke OnManagerTreeRender event
68 68
 		$evtOut = $modx->invokeEvent('OnManagerTreeRender', $modx->getDatabase()->escape($_REQUEST));
69
-		if(is_array($evtOut)) {
69
+		if(is_array($evtOut)) {
70 70
 			echo implode("\n", $evtOut);
71 71
 		}
72 72
 		?>
Please login to merge, or discard this patch.
manager/frames/mainmenu.php 3 patches
Indentation   +325 added lines, -325 removed lines patch added patch discarded remove patch
@@ -4,237 +4,237 @@  discard block
 block discarded – undo
4 4
 */
5 5
 
6 6
 $sitemenu['bars'] = array(
7
-	'bars',
8
-	'main',
9
-	'<i class="fa fa-bars"></i>',
10
-	'javascript:;',
11
-	$_lang['home'],
12
-	'modx.resizer.toggle(); return false;',
13
-	' return false;',
14
-	'',
15
-	0,
16
-	10,
17
-	''
7
+    'bars',
8
+    'main',
9
+    '<i class="fa fa-bars"></i>',
10
+    'javascript:;',
11
+    $_lang['home'],
12
+    'modx.resizer.toggle(); return false;',
13
+    ' return false;',
14
+    '',
15
+    0,
16
+    10,
17
+    ''
18 18
 );
19 19
 
20 20
 //mainMenu
21 21
 $sitemenu['site'] = array(
22
-	'site',
23
-	'main',
24
-	'<i class="fa fa-tachometer"></i><span class="menu-item-text">' . $_lang['home'] . '</span>',
25
-	'index.php?a=2',
26
-	$_lang['home'],
27
-	'',
28
-	'',
29
-	'main',
30
-	0,
31
-	10,
32
-	'active'
22
+    'site',
23
+    'main',
24
+    '<i class="fa fa-tachometer"></i><span class="menu-item-text">' . $_lang['home'] . '</span>',
25
+    'index.php?a=2',
26
+    $_lang['home'],
27
+    '',
28
+    '',
29
+    'main',
30
+    0,
31
+    10,
32
+    'active'
33 33
 );
34 34
 
35 35
 if($modx->hasPermission('edit_template') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('file_manager')) {
36
-	$sitemenu['elements'] = array(
37
-		'elements',
38
-		'main',
39
-		'<i class="fa fa-th"></i><span class="menu-item-text">' . $_lang['elements'] . '</span>',
40
-		'javascript:;',
41
-		$_lang['elements'],
42
-		' return false;',
43
-		'',
44
-		'',
45
-		0,
46
-		20,
47
-		''
48
-	);
36
+    $sitemenu['elements'] = array(
37
+        'elements',
38
+        'main',
39
+        '<i class="fa fa-th"></i><span class="menu-item-text">' . $_lang['elements'] . '</span>',
40
+        'javascript:;',
41
+        $_lang['elements'],
42
+        ' return false;',
43
+        '',
44
+        '',
45
+        0,
46
+        20,
47
+        ''
48
+    );
49 49
 }
50 50
 
51 51
 if($modx->hasPermission('exec_module')) {
52
-	$sitemenu['modules'] = array(
53
-		'modules',
54
-		'main',
55
-		'<i class="'.$_style['icons_modules'] .'"></i><span class="menu-item-text">' . $_lang['modules'] . '</span>',
56
-		'javascript:;',
57
-		$_lang['modules'],
58
-		' return false;',
59
-		'',
60
-		'',
61
-		0,
62
-		30,
63
-		''
64
-	);
52
+    $sitemenu['modules'] = array(
53
+        'modules',
54
+        'main',
55
+        '<i class="'.$_style['icons_modules'] .'"></i><span class="menu-item-text">' . $_lang['modules'] . '</span>',
56
+        'javascript:;',
57
+        $_lang['modules'],
58
+        ' return false;',
59
+        '',
60
+        '',
61
+        0,
62
+        30,
63
+        ''
64
+    );
65 65
 }
66 66
 
67 67
 if($modx->hasPermission('edit_user') || $modx->hasPermission('edit_web_user') || $modx->hasPermission('edit_role') || $modx->hasPermission('access_permissions') || $modx->hasPermission('web_access_permissions')) {
68
-	$sitemenu['users'] = array(
69
-		'users',
70
-		'main',
71
-		'<i class="fa fa-users"></i><span class="menu-item-text">' . $_lang['users'] . '</span>',
72
-		'javascript:;',
73
-		$_lang['users'],
74
-		' return false;',
75
-		'edit_user',
76
-		'',
77
-		0,
78
-		40,
79
-		''
80
-	);
68
+    $sitemenu['users'] = array(
69
+        'users',
70
+        'main',
71
+        '<i class="fa fa-users"></i><span class="menu-item-text">' . $_lang['users'] . '</span>',
72
+        'javascript:;',
73
+        $_lang['users'],
74
+        ' return false;',
75
+        'edit_user',
76
+        '',
77
+        0,
78
+        40,
79
+        ''
80
+    );
81 81
 }
82 82
 
83 83
 if($modx->hasPermission('empty_cache') || $modx->hasPermission('bk_manager') || $modx->hasPermission('remove_locks') || $modx->hasPermission('import_static') || $modx->hasPermission('export_static')) {
84
-	$sitemenu['tools'] = array(
85
-		'tools',
86
-		'main',
87
-		'<i class="fa fa-wrench"></i><span class="menu-item-text">' . $_lang['tools'] . '</span>',
88
-		'javascript:;',
89
-		$_lang['tools'],
90
-		' return false;',
91
-		'',
92
-		'',
93
-		0,
94
-		50,
95
-		''
96
-	);
84
+    $sitemenu['tools'] = array(
85
+        'tools',
86
+        'main',
87
+        '<i class="fa fa-wrench"></i><span class="menu-item-text">' . $_lang['tools'] . '</span>',
88
+        'javascript:;',
89
+        $_lang['tools'],
90
+        ' return false;',
91
+        '',
92
+        '',
93
+        0,
94
+        50,
95
+        ''
96
+    );
97 97
 }
98 98
 
99 99
 $tab = 0;
100 100
 if($modx->hasPermission('edit_template')) {
101
-	$sitemenu['element_templates'] = array(
102
-		'element_templates',
103
-		'elements',
104
-		'<i class="fa fa-newspaper-o"></i>' . $_lang['manage_templates'] . '<i class="fa fa-angle-right toggle"></i>',
105
-		'index.php?a=76&tab=' . $tab++,
106
-		$_lang['manage_templates'],
107
-		'',
108
-		'new_template,edit_template',
109
-		'main',
110
-		0,
111
-		10,
112
-		'dropdown-toggle'
113
-	);
101
+    $sitemenu['element_templates'] = array(
102
+        'element_templates',
103
+        'elements',
104
+        '<i class="fa fa-newspaper-o"></i>' . $_lang['manage_templates'] . '<i class="fa fa-angle-right toggle"></i>',
105
+        'index.php?a=76&tab=' . $tab++,
106
+        $_lang['manage_templates'],
107
+        '',
108
+        'new_template,edit_template',
109
+        'main',
110
+        0,
111
+        10,
112
+        'dropdown-toggle'
113
+    );
114 114
 }
115 115
 if($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) {
116
-	$sitemenu['element_tplvars'] = array(
117
-		'element_tplvars',
118
-		'elements',
119
-		'<i class="fa fa-list-alt"></i>' . $_lang['tmplvars'] . '<i class="fa fa-angle-right toggle"></i>',
120
-		'index.php?a=76&tab=' . $tab++,
121
-		$_lang['tmplvars'],
122
-		'',
123
-		'new_template,edit_template',
124
-		'main',
125
-		0,
126
-		20,
127
-		'dropdown-toggle'
128
-	);
116
+    $sitemenu['element_tplvars'] = array(
117
+        'element_tplvars',
118
+        'elements',
119
+        '<i class="fa fa-list-alt"></i>' . $_lang['tmplvars'] . '<i class="fa fa-angle-right toggle"></i>',
120
+        'index.php?a=76&tab=' . $tab++,
121
+        $_lang['tmplvars'],
122
+        '',
123
+        'new_template,edit_template',
124
+        'main',
125
+        0,
126
+        20,
127
+        'dropdown-toggle'
128
+    );
129 129
 }
130 130
 if($modx->hasPermission('edit_chunk')) {
131
-	$sitemenu['element_htmlsnippets'] = array(
132
-		'element_htmlsnippets',
133
-		'elements',
134
-		'<i class="fa fa-th-large"></i>' . $_lang['manage_htmlsnippets'] . '<i class="fa fa-angle-right toggle"></i>',
135
-		'index.php?a=76&tab=' . $tab++,
136
-		$_lang['manage_htmlsnippets'],
137
-		'',
138
-		'new_chunk,edit_chunk',
139
-		'main',
140
-		0,
141
-		30,
142
-		'dropdown-toggle'
143
-	);
131
+    $sitemenu['element_htmlsnippets'] = array(
132
+        'element_htmlsnippets',
133
+        'elements',
134
+        '<i class="fa fa-th-large"></i>' . $_lang['manage_htmlsnippets'] . '<i class="fa fa-angle-right toggle"></i>',
135
+        'index.php?a=76&tab=' . $tab++,
136
+        $_lang['manage_htmlsnippets'],
137
+        '',
138
+        'new_chunk,edit_chunk',
139
+        'main',
140
+        0,
141
+        30,
142
+        'dropdown-toggle'
143
+    );
144 144
 }
145 145
 if($modx->hasPermission('edit_snippet')) {
146
-	$sitemenu['element_snippets'] = array(
147
-		'element_snippets',
148
-		'elements',
149
-		'<i class="fa fa-code"></i>' . $_lang['manage_snippets'] . '<i class="fa fa-angle-right toggle"></i>',
150
-		'index.php?a=76&tab=' . $tab++,
151
-		$_lang['manage_snippets'],
152
-		'',
153
-		'new_snippet,edit_snippet',
154
-		'main',
155
-		0,
156
-		40,
157
-		'dropdown-toggle'
158
-	);
146
+    $sitemenu['element_snippets'] = array(
147
+        'element_snippets',
148
+        'elements',
149
+        '<i class="fa fa-code"></i>' . $_lang['manage_snippets'] . '<i class="fa fa-angle-right toggle"></i>',
150
+        'index.php?a=76&tab=' . $tab++,
151
+        $_lang['manage_snippets'],
152
+        '',
153
+        'new_snippet,edit_snippet',
154
+        'main',
155
+        0,
156
+        40,
157
+        'dropdown-toggle'
158
+    );
159 159
 }
160 160
 if($modx->hasPermission('edit_plugin')) {
161
-	$sitemenu['element_plugins'] = array(
162
-		'element_plugins',
163
-		'elements',
164
-		'<i class="fa fa-plug"></i>' . $_lang['manage_plugins'] . '<i class="fa fa-angle-right toggle"></i>',
165
-		'index.php?a=76&tab=' . $tab++,
166
-		$_lang['manage_plugins'],
167
-		'',
168
-		'new_plugin,edit_plugin',
169
-		'main',
170
-		0,
171
-		50,
172
-		'dropdown-toggle'
173
-	);
161
+    $sitemenu['element_plugins'] = array(
162
+        'element_plugins',
163
+        'elements',
164
+        '<i class="fa fa-plug"></i>' . $_lang['manage_plugins'] . '<i class="fa fa-angle-right toggle"></i>',
165
+        'index.php?a=76&tab=' . $tab++,
166
+        $_lang['manage_plugins'],
167
+        '',
168
+        'new_plugin,edit_plugin',
169
+        'main',
170
+        0,
171
+        50,
172
+        'dropdown-toggle'
173
+    );
174 174
 }
175 175
 //$sitemenu['element_categories']     = array('element_categories','elements',$_lang['element_categories'],'index.php?a=76&tab=5',$_lang['element_categories'],'','new_template,edit_template,new_snippet,edit_snippet,new_chunk,edit_chunk,new_plugin,edit_plugin','main',1,60,'');
176 176
 
177 177
 if($modx->hasPermission('file_manager')) {
178
-	$sitemenu['manage_files'] = array(
179
-		'manage_files',
180
-		'elements',
181
-		'<i class="fa fa-folder-open-o"></i>' . $_lang['manage_files'],
182
-		'index.php?a=31',
183
-		$_lang['manage_files'],
184
-		'',
185
-		'file_manager',
186
-		'main',
187
-		0,
188
-		80,
189
-		''
190
-	);
178
+    $sitemenu['manage_files'] = array(
179
+        'manage_files',
180
+        'elements',
181
+        '<i class="fa fa-folder-open-o"></i>' . $_lang['manage_files'],
182
+        'index.php?a=31',
183
+        $_lang['manage_files'],
184
+        '',
185
+        'file_manager',
186
+        'main',
187
+        0,
188
+        80,
189
+        ''
190
+    );
191 191
 }
192 192
 if($modx->hasPermission('category_manager')) {
193
-	$sitemenu['manage_categories'] = array(
194
-		'manage_categories',
195
-		'elements',
196
-		'<i class="fa fa-object-group"></i>' . $_lang['manage_categories'],
197
-		'index.php?a=120',
198
-		$_lang['manage_categories'],
199
-		'',
200
-		'category_manager',
201
-		'main',
202
-		0,
203
-		70,
204
-		''
205
-	);
193
+    $sitemenu['manage_categories'] = array(
194
+        'manage_categories',
195
+        'elements',
196
+        '<i class="fa fa-object-group"></i>' . $_lang['manage_categories'],
197
+        'index.php?a=120',
198
+        $_lang['manage_categories'],
199
+        '',
200
+        'category_manager',
201
+        'main',
202
+        0,
203
+        70,
204
+        ''
205
+    );
206 206
 }
207 207
 
208 208
 // Modules Menu Items
209 209
 if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module') || $modx->hasPermission('save_module')) {
210
-	$sitemenu['new_module'] = array(
211
-		'new_module',
212
-		'modules',
213
-		'<i class="'.$_style['icons_modules'] .'"></i>' . $_lang['module_management'],
214
-		'index.php?a=106',
215
-		$_lang['module_management'],
216
-		'',
217
-		'new_module,edit_module',
218
-		'main',
219
-		1,
220
-		0,
221
-		''
222
-	);
210
+    $sitemenu['new_module'] = array(
211
+        'new_module',
212
+        'modules',
213
+        '<i class="'.$_style['icons_modules'] .'"></i>' . $_lang['module_management'],
214
+        'index.php?a=106',
215
+        $_lang['module_management'],
216
+        '',
217
+        'new_module,edit_module',
218
+        'main',
219
+        1,
220
+        0,
221
+        ''
222
+    );
223 223
 }
224 224
 
225 225
 if($modx->hasPermission('exec_module')) {
226
-	if($_SESSION['mgrRole'] != 1 && !empty($modx->config['use_udperms'])) {
227
-		$rs = $modx->getDatabase()->query('SELECT DISTINCT sm.id, sm.name, sm.icon, mg.member
226
+    if($_SESSION['mgrRole'] != 1 && !empty($modx->config['use_udperms'])) {
227
+        $rs = $modx->getDatabase()->query('SELECT DISTINCT sm.id, sm.name, sm.icon, mg.member
228 228
 				FROM ' . $modx->getFullTableName('site_modules') . ' AS sm
229 229
 				LEFT JOIN ' . $modx->getFullTableName('site_module_access') . ' AS sma ON sma.module = sm.id
230 230
 				LEFT JOIN ' . $modx->getFullTableName('member_groups') . ' AS mg ON sma.usergroup = mg.user_group
231 231
                 WHERE (mg.member IS NULL OR mg.member = ' . $modx->getLoginUserID() . ') AND sm.disabled != 1 AND sm.locked != 1
232 232
                 ORDER BY sm.name');
233
-	} else {
234
-		$rs = $modx->getDatabase()->select('*', $modx->getFullTableName('site_modules'), 'disabled != 1', 'name');
235
-	}
236
-	if($modx->getDatabase()->getRecordCount($rs)) {
237
-	    while ($row = $modx->getDatabase()->getRow($rs)) {
233
+    } else {
234
+        $rs = $modx->getDatabase()->select('*', $modx->getFullTableName('site_modules'), 'disabled != 1', 'name');
235
+    }
236
+    if($modx->getDatabase()->getRecordCount($rs)) {
237
+        while ($row = $modx->getDatabase()->getRow($rs)) {
238 238
             $sitemenu['module' . $row['id']] = array(
239 239
                 'module' . $row['id'],
240 240
                 'modules',
@@ -255,83 +255,83 @@  discard block
 block discarded – undo
255 255
 // security menu items (users)
256 256
 
257 257
 if($modx->hasPermission('edit_user')) {
258
-	$sitemenu['user_management_title'] = array(
259
-		'user_management_title',
260
-		'users',
261
-		'<i class="fa fa fa-user"></i>' . $_lang['user_management_title'] . '<i class="fa fa-angle-right toggle"></i>',
262
-		'index.php?a=75',
263
-		$_lang['user_management_title'],
264
-		'',
265
-		'edit_user',
266
-		'main',
267
-		0,
268
-		10,
269
-		'dropdown-toggle'
270
-	);
258
+    $sitemenu['user_management_title'] = array(
259
+        'user_management_title',
260
+        'users',
261
+        '<i class="fa fa fa-user"></i>' . $_lang['user_management_title'] . '<i class="fa fa-angle-right toggle"></i>',
262
+        'index.php?a=75',
263
+        $_lang['user_management_title'],
264
+        '',
265
+        'edit_user',
266
+        'main',
267
+        0,
268
+        10,
269
+        'dropdown-toggle'
270
+    );
271 271
 }
272 272
 
273 273
 if($modx->hasPermission('edit_web_user')) {
274
-	$sitemenu['web_user_management_title'] = array(
275
-		'web_user_management_title',
276
-		'users',
277
-		'<i class="fa fa-users"></i>' . $_lang['web_user_management_title'] . '<i class="fa fa-angle-right toggle"></i>',
278
-		'index.php?a=99',
279
-		$_lang['web_user_management_title'],
280
-		'',
281
-		'edit_web_user',
282
-		'main',
283
-		0,
284
-		20,
285
-		'dropdown-toggle'
286
-	);
274
+    $sitemenu['web_user_management_title'] = array(
275
+        'web_user_management_title',
276
+        'users',
277
+        '<i class="fa fa-users"></i>' . $_lang['web_user_management_title'] . '<i class="fa fa-angle-right toggle"></i>',
278
+        'index.php?a=99',
279
+        $_lang['web_user_management_title'],
280
+        '',
281
+        'edit_web_user',
282
+        'main',
283
+        0,
284
+        20,
285
+        'dropdown-toggle'
286
+    );
287 287
 }
288 288
 
289 289
 if($modx->hasPermission('edit_role')) {
290
-	$sitemenu['role_management_title'] = array(
291
-		'role_management_title',
292
-		'users',
293
-		'<i class="fa fa-legal"></i>' . $_lang['role_management_title'],
294
-		'index.php?a=86',
295
-		$_lang['role_management_title'],
296
-		'',
297
-		'new_role,edit_role,delete_role',
298
-		'main',
299
-		0,
300
-		30,
301
-		''
302
-	);
290
+    $sitemenu['role_management_title'] = array(
291
+        'role_management_title',
292
+        'users',
293
+        '<i class="fa fa-legal"></i>' . $_lang['role_management_title'],
294
+        'index.php?a=86',
295
+        $_lang['role_management_title'],
296
+        '',
297
+        'new_role,edit_role,delete_role',
298
+        'main',
299
+        0,
300
+        30,
301
+        ''
302
+    );
303 303
 }
304 304
 
305 305
 if($modx->hasPermission('access_permissions')) {
306
-	$sitemenu['manager_permissions'] = array(
307
-		'manager_permissions',
308
-		'users',
309
-		'<i class="fa fa-male"></i>' . $_lang['manager_permissions'],
310
-		'index.php?a=40',
311
-		$_lang['manager_permissions'],
312
-		'',
313
-		'access_permissions',
314
-		'main',
315
-		0,
316
-		40,
317
-		''
318
-	);
306
+    $sitemenu['manager_permissions'] = array(
307
+        'manager_permissions',
308
+        'users',
309
+        '<i class="fa fa-male"></i>' . $_lang['manager_permissions'],
310
+        'index.php?a=40',
311
+        $_lang['manager_permissions'],
312
+        '',
313
+        'access_permissions',
314
+        'main',
315
+        0,
316
+        40,
317
+        ''
318
+    );
319 319
 }
320 320
 
321 321
 if($modx->hasPermission('web_access_permissions')) {
322
-	$sitemenu['web_permissions'] = array(
323
-		'web_permissions',
324
-		'users',
325
-		'<i class="fa fa-universal-access"></i>' . $_lang['web_permissions'],
326
-		'index.php?a=91',
327
-		$_lang['web_permissions'],
328
-		'',
329
-		'web_access_permissions',
330
-		'main',
331
-		0,
332
-		50,
333
-		''
334
-	);
322
+    $sitemenu['web_permissions'] = array(
323
+        'web_permissions',
324
+        'users',
325
+        '<i class="fa fa-universal-access"></i>' . $_lang['web_permissions'],
326
+        'index.php?a=91',
327
+        $_lang['web_permissions'],
328
+        '',
329
+        'web_access_permissions',
330
+        'main',
331
+        0,
332
+        50,
333
+        ''
334
+    );
335 335
 }
336 336
 
337 337
 // Tools Menu
@@ -361,104 +361,104 @@  discard block
 block discarded – undo
361 361
 );
362 362
 
363 363
 $sitemenu['search'] = array(
364
-	'search',
365
-	'tools',
366
-	'<i class="fa fa-search"></i>' . $_lang['search'],
367
-	'index.php?a=71',
368
-	$_lang['search'],
369
-	'',
370
-	'',
371
-	'main',
372
-	1,
373
-	9,
374
-	''
364
+    'search',
365
+    'tools',
366
+    '<i class="fa fa-search"></i>' . $_lang['search'],
367
+    'index.php?a=71',
368
+    $_lang['search'],
369
+    '',
370
+    '',
371
+    'main',
372
+    1,
373
+    9,
374
+    ''
375 375
 );
376 376
 
377 377
 if($modx->hasPermission('bk_manager')) {
378
-	$sitemenu['bk_manager'] = array(
379
-		'bk_manager',
380
-		'tools',
381
-		'<i class="fa fa-database"></i>' . $_lang['bk_manager'],
382
-		'index.php?a=93',
383
-		$_lang['bk_manager'],
384
-		'',
385
-		'bk_manager',
386
-		'main',
387
-		0,
388
-		10,
389
-		''
390
-	);
378
+    $sitemenu['bk_manager'] = array(
379
+        'bk_manager',
380
+        'tools',
381
+        '<i class="fa fa-database"></i>' . $_lang['bk_manager'],
382
+        'index.php?a=93',
383
+        $_lang['bk_manager'],
384
+        '',
385
+        'bk_manager',
386
+        'main',
387
+        0,
388
+        10,
389
+        ''
390
+    );
391 391
 }
392 392
 
393 393
 if($modx->hasPermission('remove_locks')) {
394
-	$sitemenu['remove_locks'] = array(
395
-		'remove_locks',
396
-		'tools',
397
-		'<i class="fa fa-hourglass"></i>' . $_lang['remove_locks'],
398
-		'javascript:modx.removeLocks();',
399
-		$_lang['remove_locks'],
400
-		'',
401
-		'remove_locks',
402
-		'',
403
-		0,
404
-		20,
405
-		''
406
-	);
394
+    $sitemenu['remove_locks'] = array(
395
+        'remove_locks',
396
+        'tools',
397
+        '<i class="fa fa-hourglass"></i>' . $_lang['remove_locks'],
398
+        'javascript:modx.removeLocks();',
399
+        $_lang['remove_locks'],
400
+        '',
401
+        'remove_locks',
402
+        '',
403
+        0,
404
+        20,
405
+        ''
406
+    );
407 407
 }
408 408
 
409 409
 if($modx->hasPermission('import_static')) {
410
-	$sitemenu['import_site'] = array(
411
-		'import_site',
412
-		'tools',
413
-		'<i class="fa fa-upload"></i>' . $_lang['import_site'],
414
-		'index.php?a=95',
415
-		$_lang['import_site'],
416
-		'',
417
-		'import_static',
418
-		'main',
419
-		0,
420
-		30,
421
-		''
422
-	);
410
+    $sitemenu['import_site'] = array(
411
+        'import_site',
412
+        'tools',
413
+        '<i class="fa fa-upload"></i>' . $_lang['import_site'],
414
+        'index.php?a=95',
415
+        $_lang['import_site'],
416
+        '',
417
+        'import_static',
418
+        'main',
419
+        0,
420
+        30,
421
+        ''
422
+    );
423 423
 }
424 424
 
425 425
 if($modx->hasPermission('export_static')) {
426
-	$sitemenu['export_site'] = array(
427
-		'export_site',
428
-		'tools',
429
-		'<i class="fa fa-download"></i>' . $_lang['export_site'],
430
-		'index.php?a=83',
431
-		$_lang['export_site'],
432
-		'',
433
-		'export_static',
434
-		'main',
435
-		1,
436
-		40,
437
-		''
438
-	);
426
+    $sitemenu['export_site'] = array(
427
+        'export_site',
428
+        'tools',
429
+        '<i class="fa fa-download"></i>' . $_lang['export_site'],
430
+        'index.php?a=83',
431
+        $_lang['export_site'],
432
+        '',
433
+        'export_static',
434
+        'main',
435
+        1,
436
+        40,
437
+        ''
438
+    );
439 439
 }
440 440
 
441 441
 $menu = $modx->invokeEvent("OnManagerMenuPrerender", array('menu' => $sitemenu));
442 442
 if(is_array($menu)) {
443
-	$newmenu = array();
444
-	foreach($menu as $item){
445
-		if(is_array(unserialize($item))){
446
-			$newmenu = array_merge($newmenu, unserialize($item));
447
-		}
448
-	}
449
-	if(count($newmenu)> 0) $sitemenu = $newmenu;
443
+    $newmenu = array();
444
+    foreach($menu as $item){
445
+        if(is_array(unserialize($item))){
446
+            $newmenu = array_merge($newmenu, unserialize($item));
447
+        }
448
+    }
449
+    if(count($newmenu)> 0) $sitemenu = $newmenu;
450 450
 }
451 451
 
452 452
 if(file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/includes/menu.class.inc.php')) {
453
-	include_once(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/includes/menu.class.inc.php');
453
+    include_once(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/includes/menu.class.inc.php');
454 454
 } else {
455
-	include_once(MODX_MANAGER_PATH . 'includes/menu.class.inc.php');
455
+    include_once(MODX_MANAGER_PATH . 'includes/menu.class.inc.php');
456 456
 }
457 457
 $menu = new EVOmenu();
458 458
 $menu->Build($sitemenu, array(
459
-	'outerClass' => 'nav',
460
-	'innerClass' => 'dropdown-menu',
461
-	'parentClass' => 'dropdown',
459
+    'outerClass' => 'nav',
460
+    'innerClass' => 'dropdown-menu',
461
+    'parentClass' => 'dropdown',
462 462
     'parentLinkClass' => 'dropdown-toggle',
463 463
     'parentLinkAttr' => '',
464 464
     'parentLinkIn' => ''
Please login to merge, or discard this patch.
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 $sitemenu['site'] = array(
22 22
 	'site',
23 23
 	'main',
24
-	'<i class="fa fa-tachometer"></i><span class="menu-item-text">' . $_lang['home'] . '</span>',
24
+	'<i class="fa fa-tachometer"></i><span class="menu-item-text">'.$_lang['home'].'</span>',
25 25
 	'index.php?a=2',
26 26
 	$_lang['home'],
27 27
 	'',
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
 	'active'
33 33
 );
34 34
 
35
-if($modx->hasPermission('edit_template') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('file_manager')) {
35
+if ($modx->hasPermission('edit_template') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('file_manager')) {
36 36
 	$sitemenu['elements'] = array(
37 37
 		'elements',
38 38
 		'main',
39
-		'<i class="fa fa-th"></i><span class="menu-item-text">' . $_lang['elements'] . '</span>',
39
+		'<i class="fa fa-th"></i><span class="menu-item-text">'.$_lang['elements'].'</span>',
40 40
 		'javascript:;',
41 41
 		$_lang['elements'],
42 42
 		' return false;',
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
 	);
49 49
 }
50 50
 
51
-if($modx->hasPermission('exec_module')) {
51
+if ($modx->hasPermission('exec_module')) {
52 52
 	$sitemenu['modules'] = array(
53 53
 		'modules',
54 54
 		'main',
55
-		'<i class="'.$_style['icons_modules'] .'"></i><span class="menu-item-text">' . $_lang['modules'] . '</span>',
55
+		'<i class="'.$_style['icons_modules'].'"></i><span class="menu-item-text">'.$_lang['modules'].'</span>',
56 56
 		'javascript:;',
57 57
 		$_lang['modules'],
58 58
 		' return false;',
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
 	);
65 65
 }
66 66
 
67
-if($modx->hasPermission('edit_user') || $modx->hasPermission('edit_web_user') || $modx->hasPermission('edit_role') || $modx->hasPermission('access_permissions') || $modx->hasPermission('web_access_permissions')) {
67
+if ($modx->hasPermission('edit_user') || $modx->hasPermission('edit_web_user') || $modx->hasPermission('edit_role') || $modx->hasPermission('access_permissions') || $modx->hasPermission('web_access_permissions')) {
68 68
 	$sitemenu['users'] = array(
69 69
 		'users',
70 70
 		'main',
71
-		'<i class="fa fa-users"></i><span class="menu-item-text">' . $_lang['users'] . '</span>',
71
+		'<i class="fa fa-users"></i><span class="menu-item-text">'.$_lang['users'].'</span>',
72 72
 		'javascript:;',
73 73
 		$_lang['users'],
74 74
 		' return false;',
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
 	);
81 81
 }
82 82
 
83
-if($modx->hasPermission('empty_cache') || $modx->hasPermission('bk_manager') || $modx->hasPermission('remove_locks') || $modx->hasPermission('import_static') || $modx->hasPermission('export_static')) {
83
+if ($modx->hasPermission('empty_cache') || $modx->hasPermission('bk_manager') || $modx->hasPermission('remove_locks') || $modx->hasPermission('import_static') || $modx->hasPermission('export_static')) {
84 84
 	$sitemenu['tools'] = array(
85 85
 		'tools',
86 86
 		'main',
87
-		'<i class="fa fa-wrench"></i><span class="menu-item-text">' . $_lang['tools'] . '</span>',
87
+		'<i class="fa fa-wrench"></i><span class="menu-item-text">'.$_lang['tools'].'</span>',
88 88
 		'javascript:;',
89 89
 		$_lang['tools'],
90 90
 		' return false;',
@@ -97,12 +97,12 @@  discard block
 block discarded – undo
97 97
 }
98 98
 
99 99
 $tab = 0;
100
-if($modx->hasPermission('edit_template')) {
100
+if ($modx->hasPermission('edit_template')) {
101 101
 	$sitemenu['element_templates'] = array(
102 102
 		'element_templates',
103 103
 		'elements',
104
-		'<i class="fa fa-newspaper-o"></i>' . $_lang['manage_templates'] . '<i class="fa fa-angle-right toggle"></i>',
105
-		'index.php?a=76&tab=' . $tab++,
104
+		'<i class="fa fa-newspaper-o"></i>'.$_lang['manage_templates'].'<i class="fa fa-angle-right toggle"></i>',
105
+		'index.php?a=76&tab='.$tab++,
106 106
 		$_lang['manage_templates'],
107 107
 		'',
108 108
 		'new_template,edit_template',
@@ -112,12 +112,12 @@  discard block
 block discarded – undo
112 112
 		'dropdown-toggle'
113 113
 	);
114 114
 }
115
-if($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) {
115
+if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) {
116 116
 	$sitemenu['element_tplvars'] = array(
117 117
 		'element_tplvars',
118 118
 		'elements',
119
-		'<i class="fa fa-list-alt"></i>' . $_lang['tmplvars'] . '<i class="fa fa-angle-right toggle"></i>',
120
-		'index.php?a=76&tab=' . $tab++,
119
+		'<i class="fa fa-list-alt"></i>'.$_lang['tmplvars'].'<i class="fa fa-angle-right toggle"></i>',
120
+		'index.php?a=76&tab='.$tab++,
121 121
 		$_lang['tmplvars'],
122 122
 		'',
123 123
 		'new_template,edit_template',
@@ -127,12 +127,12 @@  discard block
 block discarded – undo
127 127
 		'dropdown-toggle'
128 128
 	);
129 129
 }
130
-if($modx->hasPermission('edit_chunk')) {
130
+if ($modx->hasPermission('edit_chunk')) {
131 131
 	$sitemenu['element_htmlsnippets'] = array(
132 132
 		'element_htmlsnippets',
133 133
 		'elements',
134
-		'<i class="fa fa-th-large"></i>' . $_lang['manage_htmlsnippets'] . '<i class="fa fa-angle-right toggle"></i>',
135
-		'index.php?a=76&tab=' . $tab++,
134
+		'<i class="fa fa-th-large"></i>'.$_lang['manage_htmlsnippets'].'<i class="fa fa-angle-right toggle"></i>',
135
+		'index.php?a=76&tab='.$tab++,
136 136
 		$_lang['manage_htmlsnippets'],
137 137
 		'',
138 138
 		'new_chunk,edit_chunk',
@@ -142,12 +142,12 @@  discard block
 block discarded – undo
142 142
 		'dropdown-toggle'
143 143
 	);
144 144
 }
145
-if($modx->hasPermission('edit_snippet')) {
145
+if ($modx->hasPermission('edit_snippet')) {
146 146
 	$sitemenu['element_snippets'] = array(
147 147
 		'element_snippets',
148 148
 		'elements',
149
-		'<i class="fa fa-code"></i>' . $_lang['manage_snippets'] . '<i class="fa fa-angle-right toggle"></i>',
150
-		'index.php?a=76&tab=' . $tab++,
149
+		'<i class="fa fa-code"></i>'.$_lang['manage_snippets'].'<i class="fa fa-angle-right toggle"></i>',
150
+		'index.php?a=76&tab='.$tab++,
151 151
 		$_lang['manage_snippets'],
152 152
 		'',
153 153
 		'new_snippet,edit_snippet',
@@ -157,12 +157,12 @@  discard block
 block discarded – undo
157 157
 		'dropdown-toggle'
158 158
 	);
159 159
 }
160
-if($modx->hasPermission('edit_plugin')) {
160
+if ($modx->hasPermission('edit_plugin')) {
161 161
 	$sitemenu['element_plugins'] = array(
162 162
 		'element_plugins',
163 163
 		'elements',
164
-		'<i class="fa fa-plug"></i>' . $_lang['manage_plugins'] . '<i class="fa fa-angle-right toggle"></i>',
165
-		'index.php?a=76&tab=' . $tab++,
164
+		'<i class="fa fa-plug"></i>'.$_lang['manage_plugins'].'<i class="fa fa-angle-right toggle"></i>',
165
+		'index.php?a=76&tab='.$tab++,
166 166
 		$_lang['manage_plugins'],
167 167
 		'',
168 168
 		'new_plugin,edit_plugin',
@@ -174,11 +174,11 @@  discard block
 block discarded – undo
174 174
 }
175 175
 //$sitemenu['element_categories']     = array('element_categories','elements',$_lang['element_categories'],'index.php?a=76&tab=5',$_lang['element_categories'],'','new_template,edit_template,new_snippet,edit_snippet,new_chunk,edit_chunk,new_plugin,edit_plugin','main',1,60,'');
176 176
 
177
-if($modx->hasPermission('file_manager')) {
177
+if ($modx->hasPermission('file_manager')) {
178 178
 	$sitemenu['manage_files'] = array(
179 179
 		'manage_files',
180 180
 		'elements',
181
-		'<i class="fa fa-folder-open-o"></i>' . $_lang['manage_files'],
181
+		'<i class="fa fa-folder-open-o"></i>'.$_lang['manage_files'],
182 182
 		'index.php?a=31',
183 183
 		$_lang['manage_files'],
184 184
 		'',
@@ -189,11 +189,11 @@  discard block
 block discarded – undo
189 189
 		''
190 190
 	);
191 191
 }
192
-if($modx->hasPermission('category_manager')) {
192
+if ($modx->hasPermission('category_manager')) {
193 193
 	$sitemenu['manage_categories'] = array(
194 194
 		'manage_categories',
195 195
 		'elements',
196
-		'<i class="fa fa-object-group"></i>' . $_lang['manage_categories'],
196
+		'<i class="fa fa-object-group"></i>'.$_lang['manage_categories'],
197 197
 		'index.php?a=120',
198 198
 		$_lang['manage_categories'],
199 199
 		'',
@@ -206,11 +206,11 @@  discard block
 block discarded – undo
206 206
 }
207 207
 
208 208
 // Modules Menu Items
209
-if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module') || $modx->hasPermission('save_module')) {
209
+if ($modx->hasPermission('new_module') || $modx->hasPermission('edit_module') || $modx->hasPermission('save_module')) {
210 210
 	$sitemenu['new_module'] = array(
211 211
 		'new_module',
212 212
 		'modules',
213
-		'<i class="'.$_style['icons_modules'] .'"></i>' . $_lang['module_management'],
213
+		'<i class="'.$_style['icons_modules'].'"></i>'.$_lang['module_management'],
214 214
 		'index.php?a=106',
215 215
 		$_lang['module_management'],
216 216
 		'',
@@ -222,24 +222,24 @@  discard block
 block discarded – undo
222 222
 	);
223 223
 }
224 224
 
225
-if($modx->hasPermission('exec_module')) {
226
-	if($_SESSION['mgrRole'] != 1 && !empty($modx->config['use_udperms'])) {
225
+if ($modx->hasPermission('exec_module')) {
226
+	if ($_SESSION['mgrRole'] != 1 && !empty($modx->config['use_udperms'])) {
227 227
 		$rs = $modx->getDatabase()->query('SELECT DISTINCT sm.id, sm.name, sm.icon, mg.member
228
-				FROM ' . $modx->getFullTableName('site_modules') . ' AS sm
229
-				LEFT JOIN ' . $modx->getFullTableName('site_module_access') . ' AS sma ON sma.module = sm.id
230
-				LEFT JOIN ' . $modx->getFullTableName('member_groups') . ' AS mg ON sma.usergroup = mg.user_group
231
-                WHERE (mg.member IS NULL OR mg.member = ' . $modx->getLoginUserID() . ') AND sm.disabled != 1 AND sm.locked != 1
228
+				FROM ' . $modx->getFullTableName('site_modules').' AS sm
229
+				LEFT JOIN ' . $modx->getFullTableName('site_module_access').' AS sma ON sma.module = sm.id
230
+				LEFT JOIN ' . $modx->getFullTableName('member_groups').' AS mg ON sma.usergroup = mg.user_group
231
+                WHERE (mg.member IS NULL OR mg.member = ' . $modx->getLoginUserID().') AND sm.disabled != 1 AND sm.locked != 1
232 232
                 ORDER BY sm.name');
233 233
 	} else {
234 234
 		$rs = $modx->getDatabase()->select('*', $modx->getFullTableName('site_modules'), 'disabled != 1', 'name');
235 235
 	}
236
-	if($modx->getDatabase()->getRecordCount($rs)) {
236
+	if ($modx->getDatabase()->getRecordCount($rs)) {
237 237
 	    while ($row = $modx->getDatabase()->getRow($rs)) {
238
-            $sitemenu['module' . $row['id']] = array(
239
-                'module' . $row['id'],
238
+            $sitemenu['module'.$row['id']] = array(
239
+                'module'.$row['id'],
240 240
                 'modules',
241
-                ($row['icon'] != '' ? '<i class="'.$row['icon'].'"></i>' : '<i class="'.$_style['icons_module'].'"></i>') . $row['name'],
242
-                'index.php?a=112&id=' . $row['id'],
241
+                ($row['icon'] != '' ? '<i class="'.$row['icon'].'"></i>' : '<i class="'.$_style['icons_module'].'"></i>').$row['name'],
242
+                'index.php?a=112&id='.$row['id'],
243 243
                 $row['name'],
244 244
                 '',
245 245
                 '',
@@ -254,11 +254,11 @@  discard block
 block discarded – undo
254 254
 
255 255
 // security menu items (users)
256 256
 
257
-if($modx->hasPermission('edit_user')) {
257
+if ($modx->hasPermission('edit_user')) {
258 258
 	$sitemenu['user_management_title'] = array(
259 259
 		'user_management_title',
260 260
 		'users',
261
-		'<i class="fa fa fa-user"></i>' . $_lang['user_management_title'] . '<i class="fa fa-angle-right toggle"></i>',
261
+		'<i class="fa fa fa-user"></i>'.$_lang['user_management_title'].'<i class="fa fa-angle-right toggle"></i>',
262 262
 		'index.php?a=75',
263 263
 		$_lang['user_management_title'],
264 264
 		'',
@@ -270,11 +270,11 @@  discard block
 block discarded – undo
270 270
 	);
271 271
 }
272 272
 
273
-if($modx->hasPermission('edit_web_user')) {
273
+if ($modx->hasPermission('edit_web_user')) {
274 274
 	$sitemenu['web_user_management_title'] = array(
275 275
 		'web_user_management_title',
276 276
 		'users',
277
-		'<i class="fa fa-users"></i>' . $_lang['web_user_management_title'] . '<i class="fa fa-angle-right toggle"></i>',
277
+		'<i class="fa fa-users"></i>'.$_lang['web_user_management_title'].'<i class="fa fa-angle-right toggle"></i>',
278 278
 		'index.php?a=99',
279 279
 		$_lang['web_user_management_title'],
280 280
 		'',
@@ -286,11 +286,11 @@  discard block
 block discarded – undo
286 286
 	);
287 287
 }
288 288
 
289
-if($modx->hasPermission('edit_role')) {
289
+if ($modx->hasPermission('edit_role')) {
290 290
 	$sitemenu['role_management_title'] = array(
291 291
 		'role_management_title',
292 292
 		'users',
293
-		'<i class="fa fa-legal"></i>' . $_lang['role_management_title'],
293
+		'<i class="fa fa-legal"></i>'.$_lang['role_management_title'],
294 294
 		'index.php?a=86',
295 295
 		$_lang['role_management_title'],
296 296
 		'',
@@ -302,11 +302,11 @@  discard block
 block discarded – undo
302 302
 	);
303 303
 }
304 304
 
305
-if($modx->hasPermission('access_permissions')) {
305
+if ($modx->hasPermission('access_permissions')) {
306 306
 	$sitemenu['manager_permissions'] = array(
307 307
 		'manager_permissions',
308 308
 		'users',
309
-		'<i class="fa fa-male"></i>' . $_lang['manager_permissions'],
309
+		'<i class="fa fa-male"></i>'.$_lang['manager_permissions'],
310 310
 		'index.php?a=40',
311 311
 		$_lang['manager_permissions'],
312 312
 		'',
@@ -318,11 +318,11 @@  discard block
 block discarded – undo
318 318
 	);
319 319
 }
320 320
 
321
-if($modx->hasPermission('web_access_permissions')) {
321
+if ($modx->hasPermission('web_access_permissions')) {
322 322
 	$sitemenu['web_permissions'] = array(
323 323
 		'web_permissions',
324 324
 		'users',
325
-		'<i class="fa fa-universal-access"></i>' . $_lang['web_permissions'],
325
+		'<i class="fa fa-universal-access"></i>'.$_lang['web_permissions'],
326 326
 		'index.php?a=91',
327 327
 		$_lang['web_permissions'],
328 328
 		'',
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 $sitemenu['refresh_site'] = array(
340 340
     'refresh_site',
341 341
     'tools',
342
-    '<i class="fa fa-recycle"></i>' . $_lang['refresh_site'],
342
+    '<i class="fa fa-recycle"></i>'.$_lang['refresh_site'],
343 343
     'index.php?a=26',
344 344
     $_lang['refresh_site'],
345 345
     '',
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
             'a', // tag
354 354
             'javascript:;', // href
355 355
             'btn btn-secondary', // class or btn-success
356
-            'modx.popup({url:\'index.php?a=26\', title:\'' . $_lang['refresh_site'] . '\', icon: \'fa-recycle\', iframe: \'ajax\', selector: \'.tab-page>.container\', position: \'right top\', width: \'auto\', maxheight: \'50%\', wrap: \'body\' })', // onclick
356
+            'modx.popup({url:\'index.php?a=26\', title:\''.$_lang['refresh_site'].'\', icon: \'fa-recycle\', iframe: \'ajax\', selector: \'.tab-page>.container\', position: \'right top\', width: \'auto\', maxheight: \'50%\', wrap: \'body\' })', // onclick
357 357
             $_lang['refresh_site'], // title
358 358
             '<i class="fa fa-recycle"></i>' // innerHTML
359 359
         )
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 $sitemenu['search'] = array(
364 364
 	'search',
365 365
 	'tools',
366
-	'<i class="fa fa-search"></i>' . $_lang['search'],
366
+	'<i class="fa fa-search"></i>'.$_lang['search'],
367 367
 	'index.php?a=71',
368 368
 	$_lang['search'],
369 369
 	'',
@@ -374,11 +374,11 @@  discard block
 block discarded – undo
374 374
 	''
375 375
 );
376 376
 
377
-if($modx->hasPermission('bk_manager')) {
377
+if ($modx->hasPermission('bk_manager')) {
378 378
 	$sitemenu['bk_manager'] = array(
379 379
 		'bk_manager',
380 380
 		'tools',
381
-		'<i class="fa fa-database"></i>' . $_lang['bk_manager'],
381
+		'<i class="fa fa-database"></i>'.$_lang['bk_manager'],
382 382
 		'index.php?a=93',
383 383
 		$_lang['bk_manager'],
384 384
 		'',
@@ -390,11 +390,11 @@  discard block
 block discarded – undo
390 390
 	);
391 391
 }
392 392
 
393
-if($modx->hasPermission('remove_locks')) {
393
+if ($modx->hasPermission('remove_locks')) {
394 394
 	$sitemenu['remove_locks'] = array(
395 395
 		'remove_locks',
396 396
 		'tools',
397
-		'<i class="fa fa-hourglass"></i>' . $_lang['remove_locks'],
397
+		'<i class="fa fa-hourglass"></i>'.$_lang['remove_locks'],
398 398
 		'javascript:modx.removeLocks();',
399 399
 		$_lang['remove_locks'],
400 400
 		'',
@@ -406,11 +406,11 @@  discard block
 block discarded – undo
406 406
 	);
407 407
 }
408 408
 
409
-if($modx->hasPermission('import_static')) {
409
+if ($modx->hasPermission('import_static')) {
410 410
 	$sitemenu['import_site'] = array(
411 411
 		'import_site',
412 412
 		'tools',
413
-		'<i class="fa fa-upload"></i>' . $_lang['import_site'],
413
+		'<i class="fa fa-upload"></i>'.$_lang['import_site'],
414 414
 		'index.php?a=95',
415 415
 		$_lang['import_site'],
416 416
 		'',
@@ -422,11 +422,11 @@  discard block
 block discarded – undo
422 422
 	);
423 423
 }
424 424
 
425
-if($modx->hasPermission('export_static')) {
425
+if ($modx->hasPermission('export_static')) {
426 426
 	$sitemenu['export_site'] = array(
427 427
 		'export_site',
428 428
 		'tools',
429
-		'<i class="fa fa-download"></i>' . $_lang['export_site'],
429
+		'<i class="fa fa-download"></i>'.$_lang['export_site'],
430 430
 		'index.php?a=83',
431 431
 		$_lang['export_site'],
432 432
 		'',
@@ -439,20 +439,20 @@  discard block
 block discarded – undo
439 439
 }
440 440
 
441 441
 $menu = $modx->invokeEvent("OnManagerMenuPrerender", array('menu' => $sitemenu));
442
-if(is_array($menu)) {
442
+if (is_array($menu)) {
443 443
 	$newmenu = array();
444
-	foreach($menu as $item){
445
-		if(is_array(unserialize($item))){
444
+	foreach ($menu as $item) {
445
+		if (is_array(unserialize($item))) {
446 446
 			$newmenu = array_merge($newmenu, unserialize($item));
447 447
 		}
448 448
 	}
449
-	if(count($newmenu)> 0) $sitemenu = $newmenu;
449
+	if (count($newmenu) > 0) $sitemenu = $newmenu;
450 450
 }
451 451
 
452
-if(file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/includes/menu.class.inc.php')) {
453
-	include_once(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/includes/menu.class.inc.php');
452
+if (file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/includes/menu.class.inc.php')) {
453
+	include_once(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/includes/menu.class.inc.php');
454 454
 } else {
455
-	include_once(MODX_MANAGER_PATH . 'includes/menu.class.inc.php');
455
+	include_once(MODX_MANAGER_PATH.'includes/menu.class.inc.php');
456 456
 }
457 457
 $menu = new EVOmenu();
458 458
 $menu->Build($sitemenu, array(
Please login to merge, or discard this patch.
Braces   +35 added lines, -33 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	'active'
33 33
 );
34 34
 
35
-if($modx->hasPermission('edit_template') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('file_manager')) {
35
+if($modx->hasPermission('edit_template') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('file_manager')) {
36 36
 	$sitemenu['elements'] = array(
37 37
 		'elements',
38 38
 		'main',
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	);
49 49
 }
50 50
 
51
-if($modx->hasPermission('exec_module')) {
51
+if($modx->hasPermission('exec_module')) {
52 52
 	$sitemenu['modules'] = array(
53 53
 		'modules',
54 54
 		'main',
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	);
65 65
 }
66 66
 
67
-if($modx->hasPermission('edit_user') || $modx->hasPermission('edit_web_user') || $modx->hasPermission('edit_role') || $modx->hasPermission('access_permissions') || $modx->hasPermission('web_access_permissions')) {
67
+if($modx->hasPermission('edit_user') || $modx->hasPermission('edit_web_user') || $modx->hasPermission('edit_role') || $modx->hasPermission('access_permissions') || $modx->hasPermission('web_access_permissions')) {
68 68
 	$sitemenu['users'] = array(
69 69
 		'users',
70 70
 		'main',
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	);
81 81
 }
82 82
 
83
-if($modx->hasPermission('empty_cache') || $modx->hasPermission('bk_manager') || $modx->hasPermission('remove_locks') || $modx->hasPermission('import_static') || $modx->hasPermission('export_static')) {
83
+if($modx->hasPermission('empty_cache') || $modx->hasPermission('bk_manager') || $modx->hasPermission('remove_locks') || $modx->hasPermission('import_static') || $modx->hasPermission('export_static')) {
84 84
 	$sitemenu['tools'] = array(
85 85
 		'tools',
86 86
 		'main',
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 }
98 98
 
99 99
 $tab = 0;
100
-if($modx->hasPermission('edit_template')) {
100
+if($modx->hasPermission('edit_template')) {
101 101
 	$sitemenu['element_templates'] = array(
102 102
 		'element_templates',
103 103
 		'elements',
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 		'dropdown-toggle'
113 113
 	);
114 114
 }
115
-if($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) {
115
+if($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) {
116 116
 	$sitemenu['element_tplvars'] = array(
117 117
 		'element_tplvars',
118 118
 		'elements',
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 		'dropdown-toggle'
128 128
 	);
129 129
 }
130
-if($modx->hasPermission('edit_chunk')) {
130
+if($modx->hasPermission('edit_chunk')) {
131 131
 	$sitemenu['element_htmlsnippets'] = array(
132 132
 		'element_htmlsnippets',
133 133
 		'elements',
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 		'dropdown-toggle'
143 143
 	);
144 144
 }
145
-if($modx->hasPermission('edit_snippet')) {
145
+if($modx->hasPermission('edit_snippet')) {
146 146
 	$sitemenu['element_snippets'] = array(
147 147
 		'element_snippets',
148 148
 		'elements',
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 		'dropdown-toggle'
158 158
 	);
159 159
 }
160
-if($modx->hasPermission('edit_plugin')) {
160
+if($modx->hasPermission('edit_plugin')) {
161 161
 	$sitemenu['element_plugins'] = array(
162 162
 		'element_plugins',
163 163
 		'elements',
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 }
175 175
 //$sitemenu['element_categories']     = array('element_categories','elements',$_lang['element_categories'],'index.php?a=76&tab=5',$_lang['element_categories'],'','new_template,edit_template,new_snippet,edit_snippet,new_chunk,edit_chunk,new_plugin,edit_plugin','main',1,60,'');
176 176
 
177
-if($modx->hasPermission('file_manager')) {
177
+if($modx->hasPermission('file_manager')) {
178 178
 	$sitemenu['manage_files'] = array(
179 179
 		'manage_files',
180 180
 		'elements',
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 		''
190 190
 	);
191 191
 }
192
-if($modx->hasPermission('category_manager')) {
192
+if($modx->hasPermission('category_manager')) {
193 193
 	$sitemenu['manage_categories'] = array(
194 194
 		'manage_categories',
195 195
 		'elements',
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 }
207 207
 
208 208
 // Modules Menu Items
209
-if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module') || $modx->hasPermission('save_module')) {
209
+if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module') || $modx->hasPermission('save_module')) {
210 210
 	$sitemenu['new_module'] = array(
211 211
 		'new_module',
212 212
 		'modules',
@@ -222,19 +222,19 @@  discard block
 block discarded – undo
222 222
 	);
223 223
 }
224 224
 
225
-if($modx->hasPermission('exec_module')) {
226
-	if($_SESSION['mgrRole'] != 1 && !empty($modx->config['use_udperms'])) {
225
+if($modx->hasPermission('exec_module')) {
226
+	if($_SESSION['mgrRole'] != 1 && !empty($modx->config['use_udperms'])) {
227 227
 		$rs = $modx->getDatabase()->query('SELECT DISTINCT sm.id, sm.name, sm.icon, mg.member
228 228
 				FROM ' . $modx->getFullTableName('site_modules') . ' AS sm
229 229
 				LEFT JOIN ' . $modx->getFullTableName('site_module_access') . ' AS sma ON sma.module = sm.id
230 230
 				LEFT JOIN ' . $modx->getFullTableName('member_groups') . ' AS mg ON sma.usergroup = mg.user_group
231 231
                 WHERE (mg.member IS NULL OR mg.member = ' . $modx->getLoginUserID() . ') AND sm.disabled != 1 AND sm.locked != 1
232 232
                 ORDER BY sm.name');
233
-	} else {
233
+	} else {
234 234
 		$rs = $modx->getDatabase()->select('*', $modx->getFullTableName('site_modules'), 'disabled != 1', 'name');
235 235
 	}
236
-	if($modx->getDatabase()->getRecordCount($rs)) {
237
-	    while ($row = $modx->getDatabase()->getRow($rs)) {
236
+	if($modx->getDatabase()->getRecordCount($rs)) {
237
+	    while ($row = $modx->getDatabase()->getRow($rs)) {
238 238
             $sitemenu['module' . $row['id']] = array(
239 239
                 'module' . $row['id'],
240 240
                 'modules',
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 
255 255
 // security menu items (users)
256 256
 
257
-if($modx->hasPermission('edit_user')) {
257
+if($modx->hasPermission('edit_user')) {
258 258
 	$sitemenu['user_management_title'] = array(
259 259
 		'user_management_title',
260 260
 		'users',
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 	);
271 271
 }
272 272
 
273
-if($modx->hasPermission('edit_web_user')) {
273
+if($modx->hasPermission('edit_web_user')) {
274 274
 	$sitemenu['web_user_management_title'] = array(
275 275
 		'web_user_management_title',
276 276
 		'users',
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 	);
287 287
 }
288 288
 
289
-if($modx->hasPermission('edit_role')) {
289
+if($modx->hasPermission('edit_role')) {
290 290
 	$sitemenu['role_management_title'] = array(
291 291
 		'role_management_title',
292 292
 		'users',
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 	);
303 303
 }
304 304
 
305
-if($modx->hasPermission('access_permissions')) {
305
+if($modx->hasPermission('access_permissions')) {
306 306
 	$sitemenu['manager_permissions'] = array(
307 307
 		'manager_permissions',
308 308
 		'users',
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 	);
319 319
 }
320 320
 
321
-if($modx->hasPermission('web_access_permissions')) {
321
+if($modx->hasPermission('web_access_permissions')) {
322 322
 	$sitemenu['web_permissions'] = array(
323 323
 		'web_permissions',
324 324
 		'users',
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 	''
375 375
 );
376 376
 
377
-if($modx->hasPermission('bk_manager')) {
377
+if($modx->hasPermission('bk_manager')) {
378 378
 	$sitemenu['bk_manager'] = array(
379 379
 		'bk_manager',
380 380
 		'tools',
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 	);
391 391
 }
392 392
 
393
-if($modx->hasPermission('remove_locks')) {
393
+if($modx->hasPermission('remove_locks')) {
394 394
 	$sitemenu['remove_locks'] = array(
395 395
 		'remove_locks',
396 396
 		'tools',
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
 	);
407 407
 }
408 408
 
409
-if($modx->hasPermission('import_static')) {
409
+if($modx->hasPermission('import_static')) {
410 410
 	$sitemenu['import_site'] = array(
411 411
 		'import_site',
412 412
 		'tools',
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 	);
423 423
 }
424 424
 
425
-if($modx->hasPermission('export_static')) {
425
+if($modx->hasPermission('export_static')) {
426 426
 	$sitemenu['export_site'] = array(
427 427
 		'export_site',
428 428
 		'tools',
@@ -439,19 +439,21 @@  discard block
 block discarded – undo
439 439
 }
440 440
 
441 441
 $menu = $modx->invokeEvent("OnManagerMenuPrerender", array('menu' => $sitemenu));
442
-if(is_array($menu)) {
442
+if(is_array($menu)) {
443 443
 	$newmenu = array();
444
-	foreach($menu as $item){
445
-		if(is_array(unserialize($item))){
444
+	foreach($menu as $item) {
445
+		if(is_array(unserialize($item))) {
446 446
 			$newmenu = array_merge($newmenu, unserialize($item));
447 447
 		}
448 448
 	}
449
-	if(count($newmenu)> 0) $sitemenu = $newmenu;
450
-}
449
+	if(count($newmenu)> 0) {
450
+	    $sitemenu = $newmenu;
451
+	}
452
+	}
451 453
 
452
-if(file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/includes/menu.class.inc.php')) {
454
+if(file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/includes/menu.class.inc.php')) {
453 455
 	include_once(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/includes/menu.class.inc.php');
454
-} else {
456
+} else {
455 457
 	include_once(MODX_MANAGER_PATH . 'includes/menu.class.inc.php');
456 458
 }
457 459
 $menu = new EVOmenu();
Please login to merge, or discard this patch.
manager/actions/files.dynamic.php 1 patch
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 if (!$modx->hasPermission('file_manager')) {
@@ -9,15 +9,15 @@  discard block
 block discarded – undo
9 9
 $newToken = makeToken();
10 10
 
11 11
 // settings
12
-$theme_image_path = $modx->config['site_manager_url'] . 'media/style/' . $modx->config['manager_theme'] . '/images/';
12
+$theme_image_path = $modx->config['site_manager_url'].'media/style/'.$modx->config['manager_theme'].'/images/';
13 13
 $excludes = array(
14 14
     '.',
15 15
     '..',
16 16
     '.svn'
17 17
 );
18
-$alias_suffix = (!empty($friendly_url_suffix)) ? ',' . ltrim($friendly_url_suffix, '.') : '';
19
-$editablefiles = explode(',', 'txt,php,tpl,less,sass,shtml,html,htm,xml,js,css,pageCache,htaccess,json,ini' . $alias_suffix);
20
-$inlineviewablefiles = explode(',', 'txt,php,tpl,less,sass,html,htm,xml,js,css,pageCache,htaccess,json,ini' . $alias_suffix);
18
+$alias_suffix = (!empty($friendly_url_suffix)) ? ','.ltrim($friendly_url_suffix, '.') : '';
19
+$editablefiles = explode(',', 'txt,php,tpl,less,sass,shtml,html,htm,xml,js,css,pageCache,htaccess,json,ini'.$alias_suffix);
20
+$inlineviewablefiles = explode(',', 'txt,php,tpl,less,sass,html,htm,xml,js,css,pageCache,htaccess,json,ini'.$alias_suffix);
21 21
 $viewablefiles = explode(',', 'jpg,gif,png,ico');
22 22
 
23 23
 $editablefiles = add_dot($editablefiles);
@@ -30,31 +30,31 @@  discard block
 block discarded – undo
30 30
 {
31 31
 */
32 32
 $protected_path[] = $modx->config['site_manager_path'];
33
-$protected_path[] = $modx->config['base_path'] . 'temp/backup';
34
-$protected_path[] = $modx->config['base_path'] . 'assets/backup';
33
+$protected_path[] = $modx->config['base_path'].'temp/backup';
34
+$protected_path[] = $modx->config['base_path'].'assets/backup';
35 35
 
36 36
 if (!$modx->hasPermission('save_plugin')) {
37
-    $protected_path[] = $modx->config['base_path'] . 'assets/plugins';
37
+    $protected_path[] = $modx->config['base_path'].'assets/plugins';
38 38
 }
39 39
 if (!$modx->hasPermission('save_snippet')) {
40
-    $protected_path[] = $modx->config['base_path'] . 'assets/snippets';
40
+    $protected_path[] = $modx->config['base_path'].'assets/snippets';
41 41
 }
42 42
 if (!$modx->hasPermission('save_template')) {
43
-    $protected_path[] = $modx->config['base_path'] . 'assets/templates';
43
+    $protected_path[] = $modx->config['base_path'].'assets/templates';
44 44
 }
45 45
 if (!$modx->hasPermission('save_module')) {
46
-    $protected_path[] = $modx->config['base_path'] . 'assets/modules';
46
+    $protected_path[] = $modx->config['base_path'].'assets/modules';
47 47
 }
48 48
 if (!$modx->hasPermission('empty_cache')) {
49
-    $protected_path[] = $modx->config['base_path'] . 'assets/cache';
49
+    $protected_path[] = $modx->config['base_path'].'assets/cache';
50 50
 }
51 51
 if (!$modx->hasPermission('import_static')) {
52
-    $protected_path[] = $modx->config['base_path'] . 'temp/import';
53
-    $protected_path[] = $modx->config['base_path'] . 'assets/import';
52
+    $protected_path[] = $modx->config['base_path'].'temp/import';
53
+    $protected_path[] = $modx->config['base_path'].'assets/import';
54 54
 }
55 55
 if (!$modx->hasPermission('export_static')) {
56
-    $protected_path[] = $modx->config['base_path'] . 'temp/export';
57
-    $protected_path[] = $modx->config['base_path'] . 'assets/export';
56
+    $protected_path[] = $modx->config['base_path'].'temp/export';
57
+    $protected_path[] = $modx->config['base_path'].'assets/export';
58 58
 }
59 59
 /*
60 60
 }
@@ -96,15 +96,15 @@  discard block
 block discarded – undo
96 96
 $rw = realpath('../');
97 97
 $webstart_path = str_replace('\\', '/', str_replace($rw, '', $rf));
98 98
 if (substr($webstart_path, 0, 1) == '/') {
99
-    $webstart_path = '..' . $webstart_path;
99
+    $webstart_path = '..'.$webstart_path;
100 100
 } else {
101
-    $webstart_path = '../' . $webstart_path;
101
+    $webstart_path = '../'.$webstart_path;
102 102
 }
103 103
 
104 104
 ?>
105 105
     <script type="text/javascript">
106 106
 
107
-        var current_path = '<?= $startpath;?>';
107
+        var current_path = '<?= $startpath; ?>';
108 108
 
109 109
         function viewfile (url)
110 110
         {
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
         function unzipFile (file)
141 141
         {
142 142
             if (confirmUnzip()) {
143
-                window.location.href = "index.php?a=31&mode=unzip&path=" + current_path + '/&file=' + file + "&token=<?= $newToken;?>";
143
+                window.location.href = "index.php?a=31&mode=unzip&path=" + current_path + '/&file=' + file + "&token=<?= $newToken; ?>";
144 144
                 return false;
145 145
             }
146 146
         }
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
         function deleteFolder (folder, status)
163 163
         {
164 164
             if (confirmDeleteFolder(status)) {
165
-                window.location.href = "index.php?a=31&mode=deletefolder&path=" + current_path + "&folderpath=" + current_path + '/' + folder + "&token=<?= $newToken;?>";
165
+                window.location.href = "index.php?a=31&mode=deletefolder&path=" + current_path + "&folderpath=" + current_path + '/' + folder + "&token=<?= $newToken; ?>";
166 166
                 return false;
167 167
             }
168 168
         }
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
         function deleteFile (file)
171 171
         {
172 172
             if (confirmDelete()) {
173
-                window.location.href = "index.php?a=31&mode=delete&path=" + current_path + '/' + file + "&token=<?= $newToken;?>";
173
+                window.location.href = "index.php?a=31&mode=delete&path=" + current_path + '/' + file + "&token=<?= $newToken; ?>";
174 174
                 return false;
175 175
             }
176 176
         }
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
         {
180 180
             var newFilename = prompt("<?= $_lang["files_dynamic_new_file_name"] ?>", file);
181 181
             if (newFilename !== null && newFilename !== file) {
182
-                window.location.href = "index.php?a=31&mode=duplicate&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken;?>";
182
+                window.location.href = "index.php?a=31&mode=duplicate&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken; ?>";
183 183
             }
184 184
         }
185 185
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
         {
188 188
             var newDirname = prompt("<?= $_lang["files_dynamic_new_folder_name"] ?>", dir);
189 189
             if (newDirname !== null && newDirname !== dir) {
190
-                window.location.href = "index.php?a=31&mode=renameFolder&path=" + current_path + '&dirname=' + dir + "&newDirname=" + newDirname + "&token=<?= $newToken;?>";
190
+                window.location.href = "index.php?a=31&mode=renameFolder&path=" + current_path + '&dirname=' + dir + "&newDirname=" + newDirname + "&token=<?= $newToken; ?>";
191 191
             }
192 192
         }
193 193
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
         {
196 196
             var newFilename = prompt("<?= $_lang["files_dynamic_new_file_name"] ?>", file);
197 197
             if (newFilename !== null && newFilename !== file) {
198
-                window.location.href = "index.php?a=31&mode=renameFile&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken;?>";
198
+                window.location.href = "index.php?a=31&mode=renameFile&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken; ?>";
199 199
             }
200 200
         }
201 201
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
             <?php endif ?>
215 215
             <?php
216 216
             if (isset($_GET['mode']) && $_GET['mode'] !== 'drill') {
217
-                $href = 'a=31&path=' . urlencode($_REQUEST['path']);
217
+                $href = 'a=31&path='.urlencode($_REQUEST['path']);
218 218
             } else {
219 219
                 $href = 'a=2';
220 220
             }
@@ -224,12 +224,12 @@  discard block
 block discarded – undo
224 224
                 $tpl = '<a class="btn btn-secondary" href="[+href+]" onclick="return getFolderName(this);"><i class="[+image+]"></i><span>[+subject+]</span></a>';
225 225
                 $ph['image'] = $_style['files_folder-open'];
226 226
                 $ph['subject'] = $_lang['add_folder'];
227
-                $ph['href'] = 'index.php?a=31&mode=newfolder&path=' . urlencode($startpath) . '&name=';
227
+                $ph['href'] = 'index.php?a=31&mode=newfolder&path='.urlencode($startpath).'&name=';
228 228
                 $_ = parsePlaceholder($tpl, $ph);
229 229
 
230
-                $tpl = '<a class="btn btn-secondary" href="[+href+]" onclick="return getFileName(this);"><i class="[+image+]"></i><span>' . $_lang['files.dynamic.php1'] . '</span></a>';
230
+                $tpl = '<a class="btn btn-secondary" href="[+href+]" onclick="return getFileName(this);"><i class="[+image+]"></i><span>'.$_lang['files.dynamic.php1'].'</span></a>';
231 231
                 $ph['image'] = $_style['files_page_html'];
232
-                $ph['href'] = 'index.php?a=31&mode=newfile&path=' . urlencode($startpath) . '&name=';
232
+                $ph['href'] = 'index.php?a=31&mode=newfile&path='.urlencode($startpath).'&name=';
233 233
                 $_ .= parsePlaceholder($tpl, $ph);
234 234
                 echo $_;
235 235
             }
@@ -259,12 +259,12 @@  discard block
 block discarded – undo
259 259
             $ph = array();
260 260
             $ph['style_path'] = $theme_image_path;
261 261
             // To Top Level with folder icon to the left
262
-            if ($startpath == $filemanager_path || $startpath . '/' == $filemanager_path) {
263
-                $ph['image'] = '' . $_style['files_top'] . '';
262
+            if ($startpath == $filemanager_path || $startpath.'/' == $filemanager_path) {
263
+                $ph['image'] = ''.$_style['files_top'].'';
264 264
                 $ph['subject'] = '<span>Top</span>';
265 265
             } else {
266
-                $ph['image'] = '' . $_style['files_top'] . '';
267
-                $ph['subject'] = '<a href="index.php?a=31&mode=drill&path=' . $filemanager_path . '">Top</a>/';
266
+                $ph['image'] = ''.$_style['files_top'].'';
267
+                $ph['subject'] = '<a href="index.php?a=31&mode=drill&path='.$filemanager_path.'">Top</a>/';
268 268
             }
269 269
 
270 270
             echo parsePlaceholder($tpl, $ph);
@@ -281,12 +281,12 @@  discard block
 block discarded – undo
281 281
                     if (empty($v)) {
282 282
                         continue;
283 283
                     }
284
-                    $path .= rtrim($v, '/') . '/';
284
+                    $path .= rtrim($v, '/').'/';
285 285
                     if (1 < $count) {
286
-                        $href = 'index.php?a=31&mode=drill&path=' . urlencode($filemanager_path . $path);
287
-                        $pieces[$i] = '<a href="' . $href . '">' . trim($v, '/') . '</a>';
286
+                        $href = 'index.php?a=31&mode=drill&path='.urlencode($filemanager_path.$path);
287
+                        $pieces[$i] = '<a href="'.$href.'">'.trim($v, '/').'</a>';
288 288
                     } else {
289
-                        $pieces[$i] = '<span>' . trim($v, '/') . '</span>';
289
+                        $pieces[$i] = '<span>'.trim($v, '/').'</span>';
290 290
                     }
291 291
                     $count--;
292 292
                 }
@@ -299,16 +299,16 @@  discard block
 block discarded – undo
299 299
         </div>
300 300
         <?php
301 301
         // check to see user isn't trying to move below the document_root
302
-        if (substr(strtolower(str_replace('//', '/', $startpath . "/")), 0, $len) != strtolower(str_replace('//', '/', $filemanager_path . '/'))) {
302
+        if (substr(strtolower(str_replace('//', '/', $startpath."/")), 0, $len) != strtolower(str_replace('//', '/', $filemanager_path.'/'))) {
303 303
             $modx->webAlertAndQuit($_lang["files_access_denied"]);
304 304
         }
305 305
 
306 306
         // Unzip .zip files - by Raymond
307 307
         if ($enablefileunzip && $_REQUEST['mode'] == 'unzip' && is_writable($startpath)) {
308
-            if (!$err = unzip(realpath("{$startpath}/" . $_REQUEST['file']), realpath($startpath))) {
309
-                echo '<span class="warning"><b>' . $_lang['file_unzip_fail'] . ($err === 0 ? 'Missing zip library (php_zip.dll / zip.so)' : '') . '</b></span><br /><br />';
308
+            if (!$err = unzip(realpath("{$startpath}/".$_REQUEST['file']), realpath($startpath))) {
309
+                echo '<span class="warning"><b>'.$_lang['file_unzip_fail'].($err === 0 ? 'Missing zip library (php_zip.dll / zip.so)' : '').'</b></span><br /><br />';
310 310
             } else {
311
-                echo '<span class="success"><b>' . $_lang['file_unzip'] . '</b></span><br /><br />';
311
+                echo '<span class="success"><b>'.$_lang['file_unzip'].'</b></span><br /><br />';
312 312
             }
313 313
         }
314 314
         // End Unzip - Raymond
@@ -320,9 +320,9 @@  discard block
 block discarded – undo
320 320
             if ($_REQUEST['mode'] == 'deletefolder') {
321 321
                 $folder = $_REQUEST['folderpath'];
322 322
                 if (!$token_check || !@rrmdir($folder)) {
323
-                    echo '<span class="warning"><b>' . $_lang['file_folder_not_deleted'] . '</b></span><br /><br />';
323
+                    echo '<span class="warning"><b>'.$_lang['file_folder_not_deleted'].'</b></span><br /><br />';
324 324
                 } else {
325
-                    echo '<span class="success"><b>' . $_lang['file_folder_deleted'] . '</b></span><br /><br />';
325
+                    echo '<span class="success"><b>'.$_lang['file_folder_deleted'].'</b></span><br /><br />';
326 326
                 }
327 327
             }
328 328
 
@@ -333,10 +333,10 @@  discard block
 block discarded – undo
333 333
                 if (!mkdirs("{$startpath}/{$foldername}", 0777)) {
334 334
                     echo '<span class="warning"><b>', $_lang['file_folder_not_created'], '</b></span><br /><br />';
335 335
                 } else {
336
-                    if (!@chmod($startpath . '/' . $foldername, $newfolderaccessmode)) {
337
-                        echo '<span class="warning"><b>' . $_lang['file_folder_chmod_error'] . '</b></span><br /><br />';
336
+                    if (!@chmod($startpath.'/'.$foldername, $newfolderaccessmode)) {
337
+                        echo '<span class="warning"><b>'.$_lang['file_folder_chmod_error'].'</b></span><br /><br />';
338 338
                     } else {
339
-                        echo '<span class="success"><b>' . $_lang['file_folder_created'] . '</b></span><br /><br />';
339
+                        echo '<span class="success"><b>'.$_lang['file_folder_created'].'</b></span><br /><br />';
340 340
                     }
341 341
                 }
342 342
                 umask($old_umask);
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
                 $filename = $modx->getDatabase()->escape($filename);
349 349
 
350 350
                 if (!checkExtension($filename)) {
351
-                    echo '<span class="warning"><b>' . $_lang['files_filetype_notok'] . '</b></span><br /><br />';
351
+                    echo '<span class="warning"><b>'.$_lang['files_filetype_notok'].'</b></span><br /><br />';
352 352
                 } elseif (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $filename) !== 0) {
353 353
                     echo $_lang['files.dynamic.php3'];
354 354
                 } else {
@@ -370,11 +370,11 @@  discard block
 block discarded – undo
370 370
                 $newFilename = $modx->getDatabase()->escape($newFilename);
371 371
 
372 372
                 if (!checkExtension($newFilename)) {
373
-                    echo '<span class="warning"><b>' . $_lang['files_filetype_notok'] . '</b></span><br /><br />';
373
+                    echo '<span class="warning"><b>'.$_lang['files_filetype_notok'].'</b></span><br /><br />';
374 374
                 } elseif (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $newFilename) !== 0) {
375 375
                     echo $_lang['files.dynamic.php3'];
376 376
                 } else {
377
-                    if (!copy($filename, MODX_BASE_PATH . $newFilename)) {
377
+                    if (!copy($filename, MODX_BASE_PATH.$newFilename)) {
378 378
                         echo $_lang['files.dynamic.php5'];
379 379
                     }
380 380
                     umask($old_umask);
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
             // Rename folder here
384 384
             if ($_REQUEST['mode'] == 'renameFolder') {
385 385
                 $old_umask = umask(0);
386
-                $dirname = $_REQUEST['path'] . '/' . $_REQUEST['dirname'];
386
+                $dirname = $_REQUEST['path'].'/'.$_REQUEST['dirname'];
387 387
                 $dirname = $modx->getDatabase()->escape($dirname);
388 388
                 $newDirname = str_replace(array(
389 389
                     '..\\',
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 
396 396
                 if (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $newDirname) !== 0) {
397 397
                     echo $_lang['files.dynamic.php3'];
398
-                } else if (!rename($dirname, $_REQUEST['path'] . '/' . $newDirname)) {
398
+                } else if (!rename($dirname, $_REQUEST['path'].'/'.$newDirname)) {
399 399
                     echo '<span class="warning"><b>', $_lang['file_folder_not_created'], '</b></span><br /><br />';
400 400
                 }
401 401
                 umask($old_umask);
@@ -415,11 +415,11 @@  discard block
 block discarded – undo
415 415
                 $newFilename = $modx->getDatabase()->escape($newFilename);
416 416
 
417 417
                 if (!checkExtension($newFilename)) {
418
-                    echo '<span class="warning"><b>' . $_lang['files_filetype_notok'] . '</b></span><br /><br />';
418
+                    echo '<span class="warning"><b>'.$_lang['files_filetype_notok'].'</b></span><br /><br />';
419 419
                 } elseif (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $newFilename) !== 0) {
420 420
                     echo $_lang['files.dynamic.php3'];
421 421
                 } else {
422
-                    if (!rename($filename, $path . '/' . $newFilename)) {
422
+                    if (!rename($filename, $path.'/'.$newFilename)) {
423 423
                         echo $_lang['files.dynamic.php5'];
424 424
                     }
425 425
                     umask($old_umask);
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
                 ls($startpath);
453 453
                 echo "\n\n\n";
454 454
                 if ($folders == 0 && $files == 0) {
455
-                    echo '<tr><td colspan="4"><i class="' . $_style['files_deleted_folder'] . ' FilesDeletedFolder"></i> <span style="color:#888;cursor:default;"> ' . $_lang['files_directory_is_empty'] . ' </span></td></tr>';
455
+                    echo '<tr><td colspan="4"><i class="'.$_style['files_deleted_folder'].' FilesDeletedFolder"></i> <span style="color:#888;cursor:default;"> '.$_lang['files_directory_is_empty'].' </span></td></tr>';
456 456
                 }
457 457
                 ?>
458 458
             </table>
@@ -461,10 +461,10 @@  discard block
 block discarded – undo
461 461
         <div class="container">
462 462
             <p>
463 463
                 <?php
464
-                echo $_lang['files_directories'] . ': <b>' . $folders . '</b> ';
465
-                echo $_lang['files_files'] . ': <b>' . $files . '</b> ';
466
-                echo $_lang['files_data'] . ': <b><span dir="ltr">' . $modx->nicesize($filesizes) . '</span></b> ';
467
-                echo $_lang['files_dirwritable'] . ' <b>' . (is_writable($startpath) == 1 ? $_lang['yes'] . '.' : $_lang['no']) . '.</b>'
464
+                echo $_lang['files_directories'].': <b>'.$folders.'</b> ';
465
+                echo $_lang['files_files'].': <b>'.$files.'</b> ';
466
+                echo $_lang['files_data'].': <b><span dir="ltr">'.$modx->nicesize($filesizes).'</span></b> ';
467
+                echo $_lang['files_dirwritable'].' <b>'.(is_writable($startpath) == 1 ? $_lang['yes'].'.' : $_lang['no']).'.</b>'
468 468
                 ?>
469 469
             </p>
470 470
 
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
                 </form>
490 490
                 <?php
491 491
             } else {
492
-                echo "<p>" . $_lang['files_upload_inhibited_msg'] . "</p>";
492
+                echo "<p>".$_lang['files_upload_inhibited_msg']."</p>";
493 493
             }
494 494
             ?>
495 495
             <div id="imageviewer"></div>
Please login to merge, or discard this patch.
manager/actions/mutate_menuindex_sort.dynamic.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 if (!$modx->hasPermission('edit_document') || !$modx->hasPermission('save_document')) {
6 6
     $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9
-$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : null;
9
+$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : null;
10 10
 $reset = isset($_POST['reset']) && $_POST['reset'] == 'true' ? 1 : 0;
11 11
 $items = isset($_POST['list']) ? $_POST['list'] : '';
12 12
 $ressourcelist = '';
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 }
24 24
 
25 25
 if (isset($_POST['listSubmitted'])) {
26
-    $updateMsg .= '<div class="text-success" id="updated">' . $_lang['sort_updated'] . '</div>';
26
+    $updateMsg .= '<div class="text-success" id="updated">'.$_lang['sort_updated'].'</div>';
27 27
     if (strlen($items) > 0) {
28 28
         $items = explode(';', $items);
29 29
         foreach ($items as $key => $value) {
@@ -43,15 +43,15 @@  discard block
 block discarded – undo
43 43
     $tblsc = $modx->getFullTableName('site_content');
44 44
     $tbldg = $modx->getFullTableName('document_groups');
45 45
 
46
-    $rs = $modx->getDatabase()->select('pagetitle', $tblsc, 'id=' . $id . '');
46
+    $rs = $modx->getDatabase()->select('pagetitle', $tblsc, 'id='.$id.'');
47 47
     $pagetitle = $modx->getDatabase()->getValue($rs);
48 48
 
49 49
     $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : '';
50 50
     $docgrp_cond = $docgrp ? "OR dg.document_group IN ({$docgrp})" : '';
51
-    $mgrRole = (isset ($_SESSION['mgrRole']) && (string)$_SESSION['mgrRole'] === '1') ? '1' : '0';
52
-    $access = " AND (1={$mgrRole} OR sc.privatemgr=0" . (!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))");
51
+    $mgrRole = (isset ($_SESSION['mgrRole']) && (string) $_SESSION['mgrRole'] === '1') ? '1' : '0';
52
+    $access = " AND (1={$mgrRole} OR sc.privatemgr=0".(!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))");
53 53
 
54
-    $rs = $modx->getDatabase()->select('sc.id, sc.pagetitle, sc.parent, sc.menuindex, sc.published, sc.hidemenu, sc.deleted, sc.isfolder', $tblsc . 'AS sc LEFT JOIN ' . $tbldg . ' dg ON dg.document=sc.id', 'sc.parent=' . $id . $access . ' GROUP BY sc.id', 'menuindex ASC');
54
+    $rs = $modx->getDatabase()->select('sc.id, sc.pagetitle, sc.parent, sc.menuindex, sc.published, sc.hidemenu, sc.deleted, sc.isfolder', $tblsc.'AS sc LEFT JOIN '.$tbldg.' dg ON dg.document=sc.id', 'sc.parent='.$id.$access.' GROUP BY sc.id', 'menuindex ASC');
55 55
 
56 56
     if ($modx->getDatabase()->getRecordCount($rs)) {
57 57
         $ressourcelist .= '<div class="clearfix"><ul id="sortlist" class="sortableList">';
@@ -60,12 +60,12 @@  discard block
 block discarded – undo
60 60
             $classes .= ($row['hidemenu']) ? ' notInMenuNode ' : ' inMenuNode';
61 61
             $classes .= ($row['published']) ? ' publishedNode ' : ' unpublishedNode ';
62 62
             $classes = ($row['deleted']) ? ' deletedNode ' : $classes;
63
-            $icon = $row['isfolder'] ? '<i class="' . $_style['files_folder'] . '"></i> ' : ' <i class="' . $_style['files_page_html'] . '"></i> ';
64
-            $ressourcelist .= '<li id="item_' . $row['id'] . '" class="' . $classes . '">' . $icon . $row['pagetitle'] . ' <small>(' . $row['id'] . ')</small></li>';
63
+            $icon = $row['isfolder'] ? '<i class="'.$_style['files_folder'].'"></i> ' : ' <i class="'.$_style['files_page_html'].'"></i> ';
64
+            $ressourcelist .= '<li id="item_'.$row['id'].'" class="'.$classes.'">'.$icon.$row['pagetitle'].' <small>('.$row['id'].')</small></li>';
65 65
         }
66 66
         $ressourcelist .= '</ul></div>';
67 67
     } else {
68
-        $updateMsg = '<p class="text-danger">' . $_lang['sort_nochildren'] . '</p>';
68
+        $updateMsg = '<p class="text-danger">'.$_lang['sort_nochildren'].'</p>';
69 69
     }
70 70
 }
71 71
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 </script>
149 149
 
150 150
 <h1>
151
-    <i class="fa fa-sort-numeric-asc"></i><?= ($pagetitle ? $pagetitle . '<small>(' . $id . ')</small>' : $_lang['sort_menuindex']) ?>
151
+    <i class="fa fa-sort-numeric-asc"></i><?= ($pagetitle ? $pagetitle.'<small>('.$id.')</small>' : $_lang['sort_menuindex']) ?>
152 152
 </h1>
153 153
 
154 154
 <?= $_style['actionbuttons']['dynamic']['save'] ?>
Please login to merge, or discard this patch.
manager/actions/mutate_content.dynamic.php 3 patches
Indentation   +371 added lines, -371 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3
-	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
3
+    die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 
6 6
 /********************/
@@ -12,29 +12,29 @@  discard block
 block discarded – undo
12 12
 
13 13
 // check permissions
14 14
 switch($modx->getManagerApi()->action) {
15
-	case 27:
16
-		if(!$modx->hasPermission('edit_document')) {
17
-			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
18
-		}
19
-		break;
20
-	case 85:
21
-	case 72:
22
-	case 4:
23
-		if(!$modx->hasPermission('new_document')) {
24
-			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
25
-		} elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') {
26
-			// check user has permissions for parent
27
-			$udperms = new EvolutionCMS\Legacy\Permissions();
28
-			$udperms->user = $modx->getLoginUserID();
29
-			$udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid'];
30
-			$udperms->role = $_SESSION['mgrRole'];
31
-			if(!$udperms->checkPermissions()) {
32
-				$modx->webAlertAndQuit($_lang["access_permission_denied"]);
33
-			}
34
-		}
35
-		break;
36
-	default:
37
-		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
15
+    case 27:
16
+        if(!$modx->hasPermission('edit_document')) {
17
+            $modx->webAlertAndQuit($_lang["error_no_privileges"]);
18
+        }
19
+        break;
20
+    case 85:
21
+    case 72:
22
+    case 4:
23
+        if(!$modx->hasPermission('new_document')) {
24
+            $modx->webAlertAndQuit($_lang["error_no_privileges"]);
25
+        } elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') {
26
+            // check user has permissions for parent
27
+            $udperms = new EvolutionCMS\Legacy\Permissions();
28
+            $udperms->user = $modx->getLoginUserID();
29
+            $udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid'];
30
+            $udperms->role = $_SESSION['mgrRole'];
31
+            if(!$udperms->checkPermissions()) {
32
+                $modx->webAlertAndQuit($_lang["access_permission_denied"]);
33
+            }
34
+        }
35
+        break;
36
+    default:
37
+        $modx->webAlertAndQuit($_lang["error_no_privileges"]);
38 38
 }
39 39
 
40 40
 $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
@@ -53,21 +53,21 @@  discard block
 block discarded – undo
53 53
 $tbl_site_tmplvars = $modx->getFullTableName('site_tmplvars');
54 54
 
55 55
 if($modx->getManagerApi()->action == 27) {
56
-	//editing an existing document
57
-	// check permissions on the document
58
-	$udperms = new EvolutionCMS\Legacy\Permissions();
59
-	$udperms->user = $modx->getLoginUserID();
60
-	$udperms->document = $id;
61
-	$udperms->role = $_SESSION['mgrRole'];
62
-
63
-	if(!$udperms->checkPermissions()) {
64
-		$modx->webAlertAndQuit($_lang["access_permission_denied"]);
65
-	}
56
+    //editing an existing document
57
+    // check permissions on the document
58
+    $udperms = new EvolutionCMS\Legacy\Permissions();
59
+    $udperms->user = $modx->getLoginUserID();
60
+    $udperms->document = $id;
61
+    $udperms->role = $_SESSION['mgrRole'];
62
+
63
+    if(!$udperms->checkPermissions()) {
64
+        $modx->webAlertAndQuit($_lang["access_permission_denied"]);
65
+    }
66 66
 }
67 67
 
68 68
 // check to see if resource isn't locked
69 69
 if($lockedEl = $modx->elementIsLocked(7, $id)) {
70
-	$modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource']));
70
+    $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource']));
71 71
 }
72 72
 // end check for lock
73 73
 
@@ -76,74 +76,74 @@  discard block
 block discarded – undo
76 76
 
77 77
 // get document groups for current user
78 78
 if($_SESSION['mgrDocgroups']) {
79
-	$docgrp = implode(',', $_SESSION['mgrDocgroups']);
79
+    $docgrp = implode(',', $_SESSION['mgrDocgroups']);
80 80
 }
81 81
 
82 82
 if(!empty ($id)) {
83
-	$access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']);
84
-	if($docgrp) {
85
-		$access .= " OR dg.document_group IN ({$docgrp})";
86
-	}
87
-	$rs = $modx->getDatabase()->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})");
88
-	$content = array();
89
-	$content = $modx->getDatabase()->getRow($rs);
90
-	$modx->documentObject = &$content;
91
-	if(!$content) {
92
-		$modx->webAlertAndQuit($_lang["access_permission_denied"]);
93
-	}
94
-	$_SESSION['itemname'] = $content['pagetitle'];
83
+    $access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']);
84
+    if($docgrp) {
85
+        $access .= " OR dg.document_group IN ({$docgrp})";
86
+    }
87
+    $rs = $modx->getDatabase()->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})");
88
+    $content = array();
89
+    $content = $modx->getDatabase()->getRow($rs);
90
+    $modx->documentObject = &$content;
91
+    if(!$content) {
92
+        $modx->webAlertAndQuit($_lang["access_permission_denied"]);
93
+    }
94
+    $_SESSION['itemname'] = $content['pagetitle'];
95 95
 } else {
96
-	$content = array();
96
+    $content = array();
97 97
 
98
-	if(isset($_REQUEST['newtemplate'])) {
99
-		$content['template'] = $_REQUEST['newtemplate'];
100
-	} else {
101
-		$content['template'] = getDefaultTemplate();
102
-	}
98
+    if(isset($_REQUEST['newtemplate'])) {
99
+        $content['template'] = $_REQUEST['newtemplate'];
100
+    } else {
101
+        $content['template'] = getDefaultTemplate();
102
+    }
103 103
 
104
-	$_SESSION['itemname'] = $_lang["new_resource"];
104
+    $_SESSION['itemname'] = $_lang["new_resource"];
105 105
 }
106 106
 
107 107
 // restore saved form
108 108
 $formRestored = $modx->getManagerApi()->loadFormValues();
109 109
 if(isset($_REQUEST['newtemplate'])) {
110
-	$formRestored = true;
110
+    $formRestored = true;
111 111
 }
112 112
 
113 113
 // retain form values if template was changed
114 114
 // edited to convert pub_date and unpub_date
115 115
 // sottwell 02-09-2006
116 116
 if($formRestored == true) {
117
-	$content = array_merge($content, $_POST);
118
-	$content['content'] = $_POST['ta'];
119
-	if(empty ($content['pub_date'])) {
120
-		unset ($content['pub_date']);
121
-	} else {
122
-		$content['pub_date'] = $modx->toTimeStamp($content['pub_date']);
123
-	}
124
-	if(empty ($content['unpub_date'])) {
125
-		unset ($content['unpub_date']);
126
-	} else {
127
-		$content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']);
128
-	}
117
+    $content = array_merge($content, $_POST);
118
+    $content['content'] = $_POST['ta'];
119
+    if(empty ($content['pub_date'])) {
120
+        unset ($content['pub_date']);
121
+    } else {
122
+        $content['pub_date'] = $modx->toTimeStamp($content['pub_date']);
123
+    }
124
+    if(empty ($content['unpub_date'])) {
125
+        unset ($content['unpub_date']);
126
+    } else {
127
+        $content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']);
128
+    }
129 129
 }
130 130
 
131 131
 // increase menu index if this is a new document
132 132
 if(!isset ($_REQUEST['id'])) {
133
-	if(!isset ($modx->config['auto_menuindex'])) {
134
-		$modx->config['auto_menuindex'] = 1;
135
-	}
136
-	if($modx->config['auto_menuindex']) {
137
-		$pid = (int)$_REQUEST['pid'];
138
-		$rs = $modx->getDatabase()->select('count(*)', $tbl_site_content, "parent='{$pid}'");
139
-		$content['menuindex'] = $modx->getDatabase()->getValue($rs);
140
-	} else {
141
-		$content['menuindex'] = 0;
142
-	}
133
+    if(!isset ($modx->config['auto_menuindex'])) {
134
+        $modx->config['auto_menuindex'] = 1;
135
+    }
136
+    if($modx->config['auto_menuindex']) {
137
+        $pid = (int)$_REQUEST['pid'];
138
+        $rs = $modx->getDatabase()->select('count(*)', $tbl_site_content, "parent='{$pid}'");
139
+        $content['menuindex'] = $modx->getDatabase()->getValue($rs);
140
+    } else {
141
+        $content['menuindex'] = 0;
142
+    }
143 143
 }
144 144
 
145 145
 if(isset ($_POST['which_editor'])) {
146
-	$modx->config['which_editor'] = $_POST['which_editor'];
146
+    $modx->config['which_editor'] = $_POST['which_editor'];
147 147
 }
148 148
 
149 149
 // Add lock-element JS-Script
@@ -543,23 +543,23 @@  discard block
 block discarded – undo
543 543
 
544 544
 	<form name="mutate" id="mutate" class="content" method="post" enctype="multipart/form-data" action="index.php" onsubmit="documentDirty=false;">
545 545
 		<?php
546
-		// invoke OnDocFormPrerender event
547
-		$evtOut = $modx->invokeEvent('OnDocFormPrerender', array(
548
-			'id' => $id,
549
-			'template' => $content['template']
550
-		));
551
-
552
-		if(is_array($evtOut)) {
553
-			echo implode('', $evtOut);
554
-		}
555
-
556
-		/*************************/
557
-		$dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : '';
558
-		$sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'createdon';
559
-		$page = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : '';
560
-		/*************************/
561
-
562
-		?>
546
+        // invoke OnDocFormPrerender event
547
+        $evtOut = $modx->invokeEvent('OnDocFormPrerender', array(
548
+            'id' => $id,
549
+            'template' => $content['template']
550
+        ));
551
+
552
+        if(is_array($evtOut)) {
553
+            echo implode('', $evtOut);
554
+        }
555
+
556
+        /*************************/
557
+        $dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : '';
558
+        $sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'createdon';
559
+        $page = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : '';
560
+        /*************************/
561
+
562
+        ?>
563 563
 		<input type="hidden" name="a" value="5" />
564 564
 		<input type="hidden" name="id" value="<?= $content['id'] ?>" />
565 565
 		<input type="hidden" name="mode" value="<?= $modx->getManagerApi()->action ?>" />
@@ -574,54 +574,54 @@  discard block
 block discarded – undo
574 574
 
575 575
 			<h1>
576 576
 				<i class="fa fa-pencil-square-o"></i><?php if(isset($_REQUEST['id'])) {
577
-					echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>';
578
-				} else {
579
-				    if ($modx->getManagerApi()->action == '4') {
577
+                    echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>';
578
+                } else {
579
+                    if ($modx->getManagerApi()->action == '4') {
580 580
                         echo $_lang['add_resource'];
581 581
                     } else if ($modx->getManagerApi()->action == '72') {
582 582
                         echo $_lang['add_weblink'];
583 583
                     } else {
584 584
                         echo $_lang['create_resource_title'];
585 585
                     }
586
-				} ?>
586
+                } ?>
587 587
 			</h1>
588 588
 
589 589
 			<?= $_style['actionbuttons']['dynamic']['document'] ?>
590 590
 
591 591
 			<?php
592
-			// breadcrumbs
593
-			if($modx->config['use_breadcrumbs']) {
594
-				$temp = array();
595
-				$title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title'];
596
-
597
-				if(isset($_REQUEST['id']) && $content['parent'] != 0) {
598
-					$bID = (int) $_REQUEST['id'];
599
-					$temp = $modx->getParentIds($bID);
600
-				} else if(isset($_REQUEST['pid'])) {
601
-					$bID = (int) $_REQUEST['pid'];
602
-					$temp = $modx->getParentIds($bID);
603
-					array_unshift($temp, $bID);
604
-				}
605
-
606
-				if($temp) {
607
-					$parents = implode(',', $temp);
608
-
609
-					if(!empty($parents)) {
610
-						$where = "FIND_IN_SET(id,'{$parents}') DESC";
611
-						$rs = $modx->getDatabase()->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where);
612
-						while($row = $modx->getDatabase()->getRow($rs)) {
613
-							$out .= '<li class="breadcrumbs__li">
592
+            // breadcrumbs
593
+            if($modx->config['use_breadcrumbs']) {
594
+                $temp = array();
595
+                $title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title'];
596
+
597
+                if(isset($_REQUEST['id']) && $content['parent'] != 0) {
598
+                    $bID = (int) $_REQUEST['id'];
599
+                    $temp = $modx->getParentIds($bID);
600
+                } else if(isset($_REQUEST['pid'])) {
601
+                    $bID = (int) $_REQUEST['pid'];
602
+                    $temp = $modx->getParentIds($bID);
603
+                    array_unshift($temp, $bID);
604
+                }
605
+
606
+                if($temp) {
607
+                    $parents = implode(',', $temp);
608
+
609
+                    if(!empty($parents)) {
610
+                        $where = "FIND_IN_SET(id,'{$parents}') DESC";
611
+                        $rs = $modx->getDatabase()->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where);
612
+                        while($row = $modx->getDatabase()->getRow($rs)) {
613
+                            $out .= '<li class="breadcrumbs__li">
614 614
                                 <a href="index.php?a=27&id=' . $row['id'] . '" class="breadcrumbs__a">' . htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']) . '</a>
615 615
                                 <span class="breadcrumbs__sep">&gt;</span>
616 616
                             </li>';
617
-						}
618
-					}
619
-				}
617
+                        }
618
+                    }
619
+                }
620 620
 
621
-				$out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>';
622
-				echo '<ul class="breadcrumbs">' . $out . '</ul>';
623
-			}
624
-			?>
621
+                $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>';
622
+                echo '<ul class="breadcrumbs">' . $out . '</ul>';
623
+            }
624
+            ?>
625 625
 
626 626
 			<!-- start main wrapper -->
627 627
 			<div class="sectionBody">
@@ -633,13 +633,13 @@  discard block
 block discarded – undo
633 633
 
634 634
 					<!-- General -->
635 635
 					<?php
636
-					$evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array(
637
-						'id' => $id
638
-					));
639
-					if(is_array($evtOut)) {
640
-						echo implode('', $evtOut);
641
-					} else {
642
-						?>
636
+                    $evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array(
637
+                        'id' => $id
638
+                    ));
639
+                    if(is_array($evtOut)) {
640
+                        echo implode('', $evtOut);
641
+                    } else {
642
+                        ?>
643 643
 						<div class="tab-page" id="tabGeneral">
644 644
 							<h2 class="tab"><?= $_lang['settings_general'] ?></h2>
645 645
 							<script type="text/javascript">tpSettings.addTabPage(document.getElementById("tabGeneral"));</script>
@@ -724,36 +724,36 @@  discard block
 block discarded – undo
724 724
 										<select id="template" name="template" class="inputBox" onchange="templateWarning();">
725 725
 											<option value="0">(blank)</option>
726 726
 											<?php
727
-											$field = "t.templatename, t.selectable, t.id, c.category";
728
-											$from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id";
729
-											$rs = $modx->getDatabase()->select($field, $from, '', 'c.category, t.templatename ASC');
730
-											$currentCategory = '';
731
-											while($row = $modx->getDatabase()->getRow($rs)) {
732
-												if($row['selectable'] != 1 && $row['id'] != $content['template']) {
733
-													continue;
734
-												};
735
-												// Skip if not selectable but show if selected!
736
-												$thisCategory = $row['category'];
737
-												if($thisCategory == null) {
738
-													$thisCategory = $_lang["no_category"];
739
-												}
740
-												if($thisCategory != $currentCategory) {
741
-													if($closeOptGroup) {
742
-														echo "\t\t\t\t\t</optgroup>\n";
743
-													}
744
-													echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n";
745
-													$closeOptGroup = true;
746
-												}
727
+                                            $field = "t.templatename, t.selectable, t.id, c.category";
728
+                                            $from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id";
729
+                                            $rs = $modx->getDatabase()->select($field, $from, '', 'c.category, t.templatename ASC');
730
+                                            $currentCategory = '';
731
+                                            while($row = $modx->getDatabase()->getRow($rs)) {
732
+                                                if($row['selectable'] != 1 && $row['id'] != $content['template']) {
733
+                                                    continue;
734
+                                                };
735
+                                                // Skip if not selectable but show if selected!
736
+                                                $thisCategory = $row['category'];
737
+                                                if($thisCategory == null) {
738
+                                                    $thisCategory = $_lang["no_category"];
739
+                                                }
740
+                                                if($thisCategory != $currentCategory) {
741
+                                                    if($closeOptGroup) {
742
+                                                        echo "\t\t\t\t\t</optgroup>\n";
743
+                                                    }
744
+                                                    echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n";
745
+                                                    $closeOptGroup = true;
746
+                                                }
747 747
 
748
-												$selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : '';
748
+                                                $selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : '';
749 749
 
750
-												echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n";
751
-												$currentCategory = $thisCategory;
752
-											}
753
-											if($thisCategory != '') {
754
-												echo "\t\t\t\t\t</optgroup>\n";
755
-											}
756
-											?>
750
+                                                echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n";
751
+                                                $currentCategory = $thisCategory;
752
+                                            }
753
+                                            if($thisCategory != '') {
754
+                                                echo "\t\t\t\t\t</optgroup>\n";
755
+                                            }
756
+                                            ?>
757 757
 										</select>
758 758
 									</td>
759 759
 								</tr>
@@ -793,37 +793,37 @@  discard block
 block discarded – undo
793 793
 									</td>
794 794
 									<td valign="top">
795 795
 										<?php
796
-										$parentlookup = false;
797
-										if(isset ($_REQUEST['id'])) {
798
-											if($content['parent'] == 0) {
799
-												$parentname = $site_name;
800
-											} else {
801
-												$parentlookup = $content['parent'];
802
-											}
803
-										} elseif(isset ($_REQUEST['pid'])) {
804
-											if($_REQUEST['pid'] == 0) {
805
-												$parentname = $site_name;
806
-											} else {
807
-												$parentlookup = $_REQUEST['pid'];
808
-											}
809
-										} elseif(isset($_POST['parent'])) {
810
-											if($_POST['parent'] == 0) {
811
-												$parentname = $site_name;
812
-											} else {
813
-												$parentlookup = $_POST['parent'];
814
-											}
815
-										} else {
816
-											$parentname = $site_name;
817
-											$content['parent'] = 0;
818
-										}
819
-										if($parentlookup !== false && is_numeric($parentlookup)) {
820
-											$rs = $modx->getDatabase()->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'");
821
-											$parentname = $modx->getDatabase()->getValue($rs);
822
-											if(!$parentname) {
823
-												$modx->webAlertAndQuit($_lang["error_no_parent"]);
824
-											}
825
-										}
826
-										?>
796
+                                        $parentlookup = false;
797
+                                        if(isset ($_REQUEST['id'])) {
798
+                                            if($content['parent'] == 0) {
799
+                                                $parentname = $site_name;
800
+                                            } else {
801
+                                                $parentlookup = $content['parent'];
802
+                                            }
803
+                                        } elseif(isset ($_REQUEST['pid'])) {
804
+                                            if($_REQUEST['pid'] == 0) {
805
+                                                $parentname = $site_name;
806
+                                            } else {
807
+                                                $parentlookup = $_REQUEST['pid'];
808
+                                            }
809
+                                        } elseif(isset($_POST['parent'])) {
810
+                                            if($_POST['parent'] == 0) {
811
+                                                $parentname = $site_name;
812
+                                            } else {
813
+                                                $parentlookup = $_POST['parent'];
814
+                                            }
815
+                                        } else {
816
+                                            $parentname = $site_name;
817
+                                            $content['parent'] = 0;
818
+                                        }
819
+                                        if($parentlookup !== false && is_numeric($parentlookup)) {
820
+                                            $rs = $modx->getDatabase()->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'");
821
+                                            $parentname = $modx->getDatabase()->getValue($rs);
822
+                                            if(!$parentname) {
823
+                                                $modx->webAlertAndQuit($_lang["error_no_parent"]);
824
+                                            }
825
+                                        }
826
+                                        ?>
827 827
 										<i id="plock" class="<?= $_style["actions_folder"] ?>" onclick="enableParentSelection(!allowParentSelection);"></i>
828 828
 										<b><span id="parentName"><?= (isset($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']) ?> (<?= $parentname ?>)</span></b>
829 829
 										<input type="hidden" name="parent" value="<?= (isset($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']) ?>" onchange="documentDirty=true;" />
@@ -831,7 +831,7 @@  discard block
 block discarded – undo
831 831
 								</tr>
832 832
 								<tr></tr>
833 833
 								<?php
834
-								/*
834
+                                /*
835 835
 								if($content['type'] == 'reference' || $modx->getManagerApi()->action == '72') {
836 836
 									?>
837 837
 									<tr>
@@ -859,7 +859,7 @@  discard block
 block discarded – undo
859 859
 									</tr>
860 860
 									<?php
861 861
 								}*/
862
-								?>
862
+                                ?>
863 863
 
864 864
 								<?php if($content['type'] == 'document' || $modx->getManagerApi()->action == '4') { ?>
865 865
 									<tr>
@@ -872,36 +872,36 @@  discard block
 block discarded – undo
872 872
 													<select id="which_editor" class="form-control form-control-sm" size="1" name="which_editor" onchange="changeRTE();">
873 873
 													<option value="none"><?= $_lang['none'] ?></option>
874 874
 														<?php
875
-														// invoke OnRichTextEditorRegister event
876
-														$evtOut = $modx->invokeEvent("OnRichTextEditorRegister");
877
-														if(is_array($evtOut)) {
878
-															for($i = 0; $i < count($evtOut); $i++) {
879
-																$editor = $evtOut[$i];
880
-																echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n";
881
-															}
882
-														}
883
-														?>
875
+                                                        // invoke OnRichTextEditorRegister event
876
+                                                        $evtOut = $modx->invokeEvent("OnRichTextEditorRegister");
877
+                                                        if(is_array($evtOut)) {
878
+                                                            for($i = 0; $i < count($evtOut); $i++) {
879
+                                                                $editor = $evtOut[$i];
880
+                                                                echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n";
881
+                                                            }
882
+                                                        }
883
+                                                        ?>
884 884
 													</select>
885 885
 												</label>
886 886
 											</div>
887 887
 											<div id="content_body">
888 888
 												<?php
889
-												if(($content['richtext'] == 1 || $modx->getManagerApi()->action == '4') && $use_editor == 1) {
890
-													$htmlContent = $content['content'];
891
-													?>
889
+                                                if(($content['richtext'] == 1 || $modx->getManagerApi()->action == '4') && $use_editor == 1) {
890
+                                                    $htmlContent = $content['content'];
891
+                                                    ?>
892 892
 													<div class="section-editor clearfix">
893 893
 														<textarea id="ta" name="ta" onchange="documentDirty=true;"><?= $modx->getPhpCompat()->htmlspecialchars($htmlContent) ?></textarea>
894 894
 													</div>
895 895
 													<?php
896
-													// Richtext-[*content*]
897
-													$richtexteditorIds = array();
898
-													$richtexteditorOptions = array();
899
-													$richtexteditorIds[$modx->config['which_editor']][] = 'ta';
900
-													$richtexteditorOptions[$modx->config['which_editor']]['ta'] = '';
901
-												} else {
902
-													echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->getPhpCompat()->htmlspecialchars($content['content']), '</textarea></div>' . "\n";
903
-												}
904
-												?>
896
+                                                    // Richtext-[*content*]
897
+                                                    $richtexteditorIds = array();
898
+                                                    $richtexteditorOptions = array();
899
+                                                    $richtexteditorIds[$modx->config['which_editor']][] = 'ta';
900
+                                                    $richtexteditorOptions[$modx->config['which_editor']]['ta'] = '';
901
+                                                } else {
902
+                                                    echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->getPhpCompat()->htmlspecialchars($content['content']), '</textarea></div>' . "\n";
903
+                                                }
904
+                                                ?>
905 905
 											</div>
906 906
 										</td>
907 907
 									</tr>
@@ -1207,8 +1207,8 @@  discard block
 block discarded – undo
1207 1207
 
1208 1208
 								<?php
1209 1209
 
1210
-								if($_SESSION['mgrRole'] == 1 || $modx->getManagerApi()->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) {
1211
-									?>
1210
+                                if($_SESSION['mgrRole'] == 1 || $modx->getManagerApi()->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) {
1211
+                                    ?>
1212 1212
 									<tr>
1213 1213
 										<td>
1214 1214
 											<span class="warning"><?= $_lang['resource_type'] ?></span>
@@ -1230,15 +1230,15 @@  discard block
 block discarded – undo
1230 1230
 										<td>
1231 1231
 											<select name="contentType" class="inputBox" onchange="documentDirty=true;">
1232 1232
 												<?php
1233
-												if(!$content['contentType']) {
1234
-													$content['contentType'] = 'text/html';
1235
-												}
1236
-												$custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml");
1237
-												$ct = explode(",", $custom_contenttype);
1238
-												for($i = 0; $i < count($ct); $i++) {
1239
-													echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n";
1240
-												}
1241
-												?>
1233
+                                                if(!$content['contentType']) {
1234
+                                                    $content['contentType'] = 'text/html';
1235
+                                                }
1236
+                                                $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml");
1237
+                                                $ct = explode(",", $custom_contenttype);
1238
+                                                for($i = 0; $i < count($ct); $i++) {
1239
+                                                    echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n";
1240
+                                                }
1241
+                                                ?>
1242 1242
 											</select>
1243 1243
 										</td>
1244 1244
 									</tr>
@@ -1261,23 +1261,23 @@  discard block
 block discarded – undo
1261 1261
 										</td>
1262 1262
 									</tr>
1263 1263
 									<?php
1264
-								} else {
1265
-									if($content['type'] != 'reference' && $modx->getManagerApi()->action != '72') {
1266
-										// non-admin managers creating or editing a document resource
1267
-										?>
1264
+                                } else {
1265
+                                    if($content['type'] != 'reference' && $modx->getManagerApi()->action != '72') {
1266
+                                        // non-admin managers creating or editing a document resource
1267
+                                        ?>
1268 1268
 										<input type="hidden" name="contentType" value="<?= (isset($content['contentType']) ? $content['contentType'] : "text/html") ?>" />
1269 1269
 										<input type="hidden" name="type" value="document" />
1270 1270
 										<input type="hidden" name="content_dispo" value="<?= (isset($content['content_dispo']) ? $content['content_dispo'] : '0') ?>" />
1271 1271
 										<?php
1272
-									} else {
1273
-										// non-admin managers creating or editing a reference (weblink) resource
1274
-										?>
1272
+                                    } else {
1273
+                                        // non-admin managers creating or editing a reference (weblink) resource
1274
+                                        ?>
1275 1275
 										<input type="hidden" name="type" value="reference" />
1276 1276
 										<input type="hidden" name="contentType" value="text/html" />
1277 1277
 										<?php
1278
-									}
1279
-								}//if mgrRole
1280
-								?>
1278
+                                    }
1279
+                                }//if mgrRole
1280
+                                ?>
1281 1281
 
1282 1282
 								<tr>
1283 1283
 									<td>
@@ -1360,112 +1360,112 @@  discard block
 block discarded – undo
1360 1360
                     ?>
1361 1361
 
1362 1362
 						<?php
1363
-					/*******************************
1363
+                    /*******************************
1364 1364
 					 * Document Access Permissions */
1365
-					if($use_udperms == 1) {
1366
-						$groupsarray = array();
1367
-						$sql = '';
1368
-
1369
-						$documentId = ($modx->getManagerApi()->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']));
1370
-						if($documentId > 0) {
1371
-							// Load up, the permissions from the parent (if new document) or existing document
1372
-							$rs = $modx->getDatabase()->select('id, document_group', $tbl_document_groups, "document='{$documentId}'");
1373
-							while($currentgroup = $modx->getDatabase()->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id'];
1374
-
1375
-							// Load up the current permissions and names
1376
-							$vs = array(
1377
-								$tbl_document_group_names,
1378
-								$tbl_document_groups,
1379
-								$documentId
1380
-							);
1381
-							$from = vsprintf("%s AS dgn LEFT JOIN %s AS groups ON groups.document_group=dgn.id AND groups.document='%s'", $vs);
1382
-							$rs = $modx->getDatabase()->select('dgn.*, groups.id AS link_id', $from, '', 'name');
1383
-						} else {
1384
-							// Just load up the names, we're starting clean
1385
-							$rs = $modx->getDatabase()->select('*, NULL AS link_id', $tbl_document_group_names, '', 'name');
1386
-						}
1387
-
1388
-						// retain selected doc groups between post
1389
-						if(isset($_POST['docgroups'])) {
1390
-							$groupsarray = array_merge($groupsarray, $_POST['docgroups']);
1391
-						}
1365
+                    if($use_udperms == 1) {
1366
+                        $groupsarray = array();
1367
+                        $sql = '';
1368
+
1369
+                        $documentId = ($modx->getManagerApi()->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']));
1370
+                        if($documentId > 0) {
1371
+                            // Load up, the permissions from the parent (if new document) or existing document
1372
+                            $rs = $modx->getDatabase()->select('id, document_group', $tbl_document_groups, "document='{$documentId}'");
1373
+                            while($currentgroup = $modx->getDatabase()->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id'];
1374
+
1375
+                            // Load up the current permissions and names
1376
+                            $vs = array(
1377
+                                $tbl_document_group_names,
1378
+                                $tbl_document_groups,
1379
+                                $documentId
1380
+                            );
1381
+                            $from = vsprintf("%s AS dgn LEFT JOIN %s AS groups ON groups.document_group=dgn.id AND groups.document='%s'", $vs);
1382
+                            $rs = $modx->getDatabase()->select('dgn.*, groups.id AS link_id', $from, '', 'name');
1383
+                        } else {
1384
+                            // Just load up the names, we're starting clean
1385
+                            $rs = $modx->getDatabase()->select('*, NULL AS link_id', $tbl_document_group_names, '', 'name');
1386
+                        }
1387
+
1388
+                        // retain selected doc groups between post
1389
+                        if(isset($_POST['docgroups'])) {
1390
+                            $groupsarray = array_merge($groupsarray, $_POST['docgroups']);
1391
+                        }
1392
+
1393
+                        $isManager = $modx->hasPermission('access_permissions');
1394
+                        $isWeb = $modx->hasPermission('web_access_permissions');
1395
+
1396
+                        // Setup Basic attributes for each Input box
1397
+                        $inputAttributes = array(
1398
+                            'type' => 'checkbox',
1399
+                            'class' => 'checkbox',
1400
+                            'name' => 'docgroups[]',
1401
+                            'onclick' => 'makePublic(false);',
1402
+                        );
1403
+                        $permissions = array(); // New Permissions array list (this contains the HTML)
1404
+                        $permissions_yes = 0; // count permissions the current mgr user has
1405
+                        $permissions_no = 0; // count permissions the current mgr user doesn't have
1406
+
1407
+                        // Loop through the permissions list
1408
+                        while($row = $modx->getDatabase()->getRow($rs)) {
1409
+
1410
+                            // Create an inputValue pair (group ID and group link (if it exists))
1411
+                            $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new');
1412
+                            $inputId = 'group-' . $row['id'];
1413
+
1414
+                            $checked = in_array($inputValue, $groupsarray);
1415
+                            if($checked) {
1416
+                                $notPublic = true;
1417
+                            } // Mark as private access (either web or manager)
1418
+
1419
+                            // Skip the access permission if the user doesn't have access...
1420
+                            if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) {
1421
+                                continue;
1422
+                            }
1392 1423
 
1393
-						$isManager = $modx->hasPermission('access_permissions');
1394
-						$isWeb = $modx->hasPermission('web_access_permissions');
1395
-
1396
-						// Setup Basic attributes for each Input box
1397
-						$inputAttributes = array(
1398
-							'type' => 'checkbox',
1399
-							'class' => 'checkbox',
1400
-							'name' => 'docgroups[]',
1401
-							'onclick' => 'makePublic(false);',
1402
-						);
1403
-						$permissions = array(); // New Permissions array list (this contains the HTML)
1404
-						$permissions_yes = 0; // count permissions the current mgr user has
1405
-						$permissions_no = 0; // count permissions the current mgr user doesn't have
1406
-
1407
-						// Loop through the permissions list
1408
-						while($row = $modx->getDatabase()->getRow($rs)) {
1409
-
1410
-							// Create an inputValue pair (group ID and group link (if it exists))
1411
-							$inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new');
1412
-							$inputId = 'group-' . $row['id'];
1413
-
1414
-							$checked = in_array($inputValue, $groupsarray);
1415
-							if($checked) {
1416
-								$notPublic = true;
1417
-							} // Mark as private access (either web or manager)
1418
-
1419
-							// Skip the access permission if the user doesn't have access...
1420
-							if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) {
1421
-								continue;
1422
-							}
1423
-
1424
-							// Setup attributes for this Input box
1425
-							$inputAttributes['id'] = $inputId;
1426
-							$inputAttributes['value'] = $inputValue;
1427
-							if($checked) {
1428
-								$inputAttributes['checked'] = 'checked';
1429
-							} else {
1430
-								unset($inputAttributes['checked']);
1431
-							}
1432
-
1433
-							// Create attribute string list
1434
-							$inputString = array();
1435
-							foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"';
1436
-
1437
-							// Make the <input> HTML
1438
-							$inputHTML = '<input ' . implode(' ', $inputString) . ' />';
1439
-
1440
-							// does user have this permission?
1441
-							$from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg";
1442
-							$vs = array(
1443
-								$row['id'],
1444
-								$_SESSION['mgrInternalKey']
1445
-							);
1446
-							$where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs);
1447
-							$rsp = $modx->getDatabase()->select('COUNT(mg.id)', $from, $where);
1448
-							$count = $modx->getDatabase()->getValue($rsp);
1449
-							if($count > 0) {
1450
-								++$permissions_yes;
1451
-							} else {
1452
-								++$permissions_no;
1453
-							}
1454
-							$permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>';
1455
-						}
1456
-						// if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public
1457
-						if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) {
1458
-							$permissions = array();
1459
-						}
1424
+                            // Setup attributes for this Input box
1425
+                            $inputAttributes['id'] = $inputId;
1426
+                            $inputAttributes['value'] = $inputValue;
1427
+                            if($checked) {
1428
+                                $inputAttributes['checked'] = 'checked';
1429
+                            } else {
1430
+                                unset($inputAttributes['checked']);
1431
+                            }
1460 1432
 
1461
-						// See if the Access Permissions section is worth displaying...
1462
-						if(!empty($permissions)) {
1463
-							// Add the "All Document Groups" item if we have rights in both contexts
1464
-							if($isManager && $isWeb) {
1465
-								array_unshift($permissions, "\t\t" . '<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true);" /><label for="groupall" class="warning">' . $_lang['all_doc_groups'] . '</label></li>');
1466
-							}
1467
-							// Output the permissions list...
1468
-							?>
1433
+                            // Create attribute string list
1434
+                            $inputString = array();
1435
+                            foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"';
1436
+
1437
+                            // Make the <input> HTML
1438
+                            $inputHTML = '<input ' . implode(' ', $inputString) . ' />';
1439
+
1440
+                            // does user have this permission?
1441
+                            $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg";
1442
+                            $vs = array(
1443
+                                $row['id'],
1444
+                                $_SESSION['mgrInternalKey']
1445
+                            );
1446
+                            $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs);
1447
+                            $rsp = $modx->getDatabase()->select('COUNT(mg.id)', $from, $where);
1448
+                            $count = $modx->getDatabase()->getValue($rsp);
1449
+                            if($count > 0) {
1450
+                                ++$permissions_yes;
1451
+                            } else {
1452
+                                ++$permissions_no;
1453
+                            }
1454
+                            $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>';
1455
+                        }
1456
+                        // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public
1457
+                        if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) {
1458
+                            $permissions = array();
1459
+                        }
1460
+
1461
+                        // See if the Access Permissions section is worth displaying...
1462
+                        if(!empty($permissions)) {
1463
+                            // Add the "All Document Groups" item if we have rights in both contexts
1464
+                            if($isManager && $isWeb) {
1465
+                                array_unshift($permissions, "\t\t" . '<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true);" /><label for="groupall" class="warning">' . $_lang['all_doc_groups'] . '</label></li>');
1466
+                            }
1467
+                            // Output the permissions list...
1468
+                            ?>
1469 1469
 							<!-- Access Permissions -->
1470 1470
 							<div class="tab-page" id="tabAccess">
1471 1471
 								<h2 class="tab" id="tab_access_header"><?= $_lang['access_permissions'] ?></h2>
@@ -1499,31 +1499,31 @@  discard block
 block discarded – undo
1499 1499
 								</ul>
1500 1500
 							</div><!--div class="tab-page" id="tabAccess"-->
1501 1501
 							<?php
1502
-						} // !empty($permissions)
1503
-						elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) {
1504
-							?>
1502
+                        } // !empty($permissions)
1503
+                        elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) {
1504
+                            ?>
1505 1505
 							<p><?= $_lang["access_permissions_docs_collision"] ?></p>
1506 1506
 							<?php
1507 1507
 
1508
-						}
1509
-					}
1510
-					/* End Document Access Permissions *
1508
+                        }
1509
+                    }
1510
+                    /* End Document Access Permissions *
1511 1511
 					 ***********************************/
1512
-					?>
1512
+                    ?>
1513 1513
 
1514 1514
 					<input type="submit" name="save" style="display:none" />
1515 1515
 					<?php
1516 1516
 
1517
-					// invoke OnDocFormRender event
1518
-					$evtOut = $modx->invokeEvent('OnDocFormRender', array(
1519
-						'id' => $id,
1520
-						'template' => $content['template']
1521
-					));
1517
+                    // invoke OnDocFormRender event
1518
+                    $evtOut = $modx->invokeEvent('OnDocFormRender', array(
1519
+                        'id' => $id,
1520
+                        'template' => $content['template']
1521
+                    ));
1522 1522
 
1523
-					if(is_array($evtOut)) {
1524
-						echo implode('', $evtOut);
1525
-					}
1526
-					?>
1523
+                    if(is_array($evtOut)) {
1524
+                        echo implode('', $evtOut);
1525
+                    }
1526
+                    ?>
1527 1527
 				</div><!--div class="tab-pane" id="documentPane"-->
1528 1528
 			</div><!--div class="sectionBody"-->
1529 1529
 		</fieldset>
@@ -1534,17 +1534,17 @@  discard block
 block discarded – undo
1534 1534
 	</script>
1535 1535
 <?php
1536 1536
 if(($content['richtext'] == 1 || $modx->getManagerApi()->action == '4' || $modx->getManagerApi()->action == '72') && $use_editor == 1) {
1537
-	if(is_array($richtexteditorIds)) {
1538
-		foreach($richtexteditorIds as $editor => $elements) {
1539
-			// invoke OnRichTextEditorInit event
1540
-			$evtOut = $modx->invokeEvent('OnRichTextEditorInit', array(
1541
-				'editor' => $editor,
1542
-				'elements' => $elements,
1543
-				'options' => $richtexteditorOptions[$editor]
1544
-			));
1545
-			if(is_array($evtOut)) {
1546
-				echo implode('', $evtOut);
1547
-			}
1548
-		}
1549
-	}
1537
+    if(is_array($richtexteditorIds)) {
1538
+        foreach($richtexteditorIds as $editor => $elements) {
1539
+            // invoke OnRichTextEditorInit event
1540
+            $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array(
1541
+                'editor' => $editor,
1542
+                'elements' => $elements,
1543
+                'options' => $richtexteditorOptions[$editor]
1544
+            ));
1545
+            if(is_array($evtOut)) {
1546
+                echo implode('', $evtOut);
1547
+            }
1548
+        }
1549
+    }
1550 1550
 }
Please login to merge, or discard this patch.
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -476,7 +476,8 @@  discard block
 block discarded – undo
476 476
 			return s;
477 477
 		}
478 478
 
479
-		<?php if ($content['type'] == 'reference' || $modx->getManagerApi()->action == '72') { // Web Link specific ?>
479
+		<?php if ($content['type'] == 'reference' || $modx->getManagerApi()->action == '72') {
480
+// Web Link specific ?>
480 481
 		var lastImageCtrl;
481 482
 		var lastFileCtrl;
482 483
 
@@ -692,7 +693,8 @@  discard block
 block discarded – undo
692 693
 									</td>
693 694
 								</tr>
694 695
 
695
-								<?php if($content['type'] == 'reference' || $modx->getManagerApi()->action == '72') { // Web Link specific ?>
696
+								<?php if($content['type'] == 'reference' || $modx->getManagerApi()->action == '72') {
697
+// Web Link specific ?>
696 698
 
697 699
 									<tr>
698 700
 										<td><span class="warning"><?= $_lang['weblink'] ?></span>
@@ -1370,7 +1372,9 @@  discard block
 block discarded – undo
1370 1372
 						if($documentId > 0) {
1371 1373
 							// Load up, the permissions from the parent (if new document) or existing document
1372 1374
 							$rs = $modx->getDatabase()->select('id, document_group', $tbl_document_groups, "document='{$documentId}'");
1373
-							while($currentgroup = $modx->getDatabase()->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id'];
1375
+							while($currentgroup = $modx->getDatabase()->getRow($rs)) {
1376
+							    $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id'];
1377
+							}
1374 1378
 
1375 1379
 							// Load up the current permissions and names
1376 1380
 							$vs = array(
@@ -1432,7 +1436,9 @@  discard block
 block discarded – undo
1432 1436
 
1433 1437
 							// Create attribute string list
1434 1438
 							$inputString = array();
1435
-							foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"';
1439
+							foreach($inputAttributes as $k => $v) {
1440
+							    $inputString[] = $k . '="' . $v . '"';
1441
+							}
1436 1442
 
1437 1443
 							// Make the <input> HTML
1438 1444
 							$inputHTML = '<input ' . implode(' ', $inputString) . ' />';
Please login to merge, or discard this patch.
Spacing   +133 added lines, -133 removed lines patch added patch discarded remove patch
@@ -1,34 +1,34 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
 	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 
6 6
 /********************/
7
-$sd = isset($_REQUEST['dir']) ? '&dir=' . $_REQUEST['dir'] : '&dir=DESC';
8
-$sb = isset($_REQUEST['sort']) ? '&sort=' . $_REQUEST['sort'] : '&sort=createdon';
9
-$pg = isset($_REQUEST['page']) ? '&page=' . (int) $_REQUEST['page'] : '';
10
-$add_path = $sd . $sb . $pg;
7
+$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC';
8
+$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon';
9
+$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : '';
10
+$add_path = $sd.$sb.$pg;
11 11
 /*******************/
12 12
 
13 13
 // check permissions
14
-switch($modx->getManagerApi()->action) {
14
+switch ($modx->getManagerApi()->action) {
15 15
 	case 27:
16
-		if(!$modx->hasPermission('edit_document')) {
16
+		if (!$modx->hasPermission('edit_document')) {
17 17
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
18 18
 		}
19 19
 		break;
20 20
 	case 85:
21 21
 	case 72:
22 22
 	case 4:
23
-		if(!$modx->hasPermission('new_document')) {
23
+		if (!$modx->hasPermission('new_document')) {
24 24
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
25
-		} elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') {
25
+		} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') {
26 26
 			// check user has permissions for parent
27 27
 			$udperms = new EvolutionCMS\Legacy\Permissions();
28 28
 			$udperms->user = $modx->getLoginUserID();
29 29
 			$udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid'];
30 30
 			$udperms->role = $_SESSION['mgrRole'];
31
-			if(!$udperms->checkPermissions()) {
31
+			if (!$udperms->checkPermissions()) {
32 32
 				$modx->webAlertAndQuit($_lang["access_permission_denied"]);
33 33
 			}
34 34
 		}
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
38 38
 }
39 39
 
40
-$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
40
+$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
41 41
 
42 42
 // Get table names (alphabetical)
43 43
 $tbl_categories = $modx->getFullTableName('categories');
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 $tbl_site_tmplvar_templates = $modx->getFullTableName('site_tmplvar_templates');
53 53
 $tbl_site_tmplvars = $modx->getFullTableName('site_tmplvars');
54 54
 
55
-if($modx->getManagerApi()->action == 27) {
55
+if ($modx->getManagerApi()->action == 27) {
56 56
 	//editing an existing document
57 57
 	// check permissions on the document
58 58
 	$udperms = new EvolutionCMS\Legacy\Permissions();
@@ -60,13 +60,13 @@  discard block
 block discarded – undo
60 60
 	$udperms->document = $id;
61 61
 	$udperms->role = $_SESSION['mgrRole'];
62 62
 
63
-	if(!$udperms->checkPermissions()) {
63
+	if (!$udperms->checkPermissions()) {
64 64
 		$modx->webAlertAndQuit($_lang["access_permission_denied"]);
65 65
 	}
66 66
 }
67 67
 
68 68
 // check to see if resource isn't locked
69
-if($lockedEl = $modx->elementIsLocked(7, $id)) {
69
+if ($lockedEl = $modx->elementIsLocked(7, $id)) {
70 70
 	$modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource']));
71 71
 }
72 72
 // end check for lock
@@ -75,27 +75,27 @@  discard block
 block discarded – undo
75 75
 $modx->lockElement(7, $id);
76 76
 
77 77
 // get document groups for current user
78
-if($_SESSION['mgrDocgroups']) {
78
+if ($_SESSION['mgrDocgroups']) {
79 79
 	$docgrp = implode(',', $_SESSION['mgrDocgroups']);
80 80
 }
81 81
 
82
-if(!empty ($id)) {
82
+if (!empty ($id)) {
83 83
 	$access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']);
84
-	if($docgrp) {
84
+	if ($docgrp) {
85 85
 		$access .= " OR dg.document_group IN ({$docgrp})";
86 86
 	}
87 87
 	$rs = $modx->getDatabase()->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})");
88 88
 	$content = array();
89 89
 	$content = $modx->getDatabase()->getRow($rs);
90 90
 	$modx->documentObject = &$content;
91
-	if(!$content) {
91
+	if (!$content) {
92 92
 		$modx->webAlertAndQuit($_lang["access_permission_denied"]);
93 93
 	}
94 94
 	$_SESSION['itemname'] = $content['pagetitle'];
95 95
 } else {
96 96
 	$content = array();
97 97
 
98
-	if(isset($_REQUEST['newtemplate'])) {
98
+	if (isset($_REQUEST['newtemplate'])) {
99 99
 		$content['template'] = $_REQUEST['newtemplate'];
100 100
 	} else {
101 101
 		$content['template'] = getDefaultTemplate();
@@ -106,22 +106,22 @@  discard block
 block discarded – undo
106 106
 
107 107
 // restore saved form
108 108
 $formRestored = $modx->getManagerApi()->loadFormValues();
109
-if(isset($_REQUEST['newtemplate'])) {
109
+if (isset($_REQUEST['newtemplate'])) {
110 110
 	$formRestored = true;
111 111
 }
112 112
 
113 113
 // retain form values if template was changed
114 114
 // edited to convert pub_date and unpub_date
115 115
 // sottwell 02-09-2006
116
-if($formRestored == true) {
116
+if ($formRestored == true) {
117 117
 	$content = array_merge($content, $_POST);
118 118
 	$content['content'] = $_POST['ta'];
119
-	if(empty ($content['pub_date'])) {
119
+	if (empty ($content['pub_date'])) {
120 120
 		unset ($content['pub_date']);
121 121
 	} else {
122 122
 		$content['pub_date'] = $modx->toTimeStamp($content['pub_date']);
123 123
 	}
124
-	if(empty ($content['unpub_date'])) {
124
+	if (empty ($content['unpub_date'])) {
125 125
 		unset ($content['unpub_date']);
126 126
 	} else {
127 127
 		$content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']);
@@ -129,12 +129,12 @@  discard block
 block discarded – undo
129 129
 }
130 130
 
131 131
 // increase menu index if this is a new document
132
-if(!isset ($_REQUEST['id'])) {
133
-	if(!isset ($modx->config['auto_menuindex'])) {
132
+if (!isset ($_REQUEST['id'])) {
133
+	if (!isset ($modx->config['auto_menuindex'])) {
134 134
 		$modx->config['auto_menuindex'] = 1;
135 135
 	}
136
-	if($modx->config['auto_menuindex']) {
137
-		$pid = (int)$_REQUEST['pid'];
136
+	if ($modx->config['auto_menuindex']) {
137
+		$pid = (int) $_REQUEST['pid'];
138 138
 		$rs = $modx->getDatabase()->select('count(*)', $tbl_site_content, "parent='{$pid}'");
139 139
 		$content['menuindex'] = $modx->getDatabase()->getValue($rs);
140 140
 	} else {
@@ -142,14 +142,14 @@  discard block
 block discarded – undo
142 142
 	}
143 143
 }
144 144
 
145
-if(isset ($_POST['which_editor'])) {
145
+if (isset ($_POST['which_editor'])) {
146 146
 	$modx->config['which_editor'] = $_POST['which_editor'];
147 147
 }
148 148
 
149 149
 // Add lock-element JS-Script
150 150
 $lockElementId = $id;
151 151
 $lockElementType = 7;
152
-require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php');
152
+require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php');
153 153
 ?>
154 154
 	<script type="text/javascript">
155 155
 		/* <![CDATA[ */
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 			},
180 180
 			cancel: function() {
181 181
 				documentDirty = false;
182
-				document.location.href = 'index.php?<?=($id == 0 ? 'a=2' : 'a=3&r=1&id=' . $id . $add_path) ?>';
182
+				document.location.href = 'index.php?<?=($id == 0 ? 'a=2' : 'a=3&r=1&id='.$id.$add_path) ?>';
183 183
 			},
184 184
 			duplicate: function() {
185 185
 				if(confirm("<?= $_lang['confirm_resource_duplicate']?>") === true) {
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 				}
188 188
 			},
189 189
 			view: function() {
190
-				window.open('<?= ($modx->config['friendly_urls'] == '1') ? $modx->makeUrl($id) : $modx->config['site_url'] . 'index.php?id=' . $id ?>', 'previeWin');
190
+				window.open('<?= ($modx->config['friendly_urls'] == '1') ? $modx->makeUrl($id) : $modx->config['site_url'].'index.php?id='.$id ?>', 'previeWin');
191 191
 			}
192 192
 		};
193 193
 
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
 			'template' => $content['template']
550 550
 		));
551 551
 
552
-		if(is_array($evtOut)) {
552
+		if (is_array($evtOut)) {
553 553
 			echo implode('', $evtOut);
554 554
 		}
555 555
 
@@ -573,8 +573,8 @@  discard block
 block discarded – undo
573 573
 		<fieldset id="create_edit">
574 574
 
575 575
 			<h1>
576
-				<i class="fa fa-pencil-square-o"></i><?php if(isset($_REQUEST['id'])) {
577
-					echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>';
576
+				<i class="fa fa-pencil-square-o"></i><?php if (isset($_REQUEST['id'])) {
577
+					echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']).(iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '').'<small>('.$_REQUEST['id'].')</small>';
578 578
 				} else {
579 579
 				    if ($modx->getManagerApi()->action == '4') {
580 580
                         echo $_lang['add_resource'];
@@ -590,36 +590,36 @@  discard block
 block discarded – undo
590 590
 
591 591
 			<?php
592 592
 			// breadcrumbs
593
-			if($modx->config['use_breadcrumbs']) {
593
+			if ($modx->config['use_breadcrumbs']) {
594 594
 				$temp = array();
595 595
 				$title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title'];
596 596
 
597
-				if(isset($_REQUEST['id']) && $content['parent'] != 0) {
597
+				if (isset($_REQUEST['id']) && $content['parent'] != 0) {
598 598
 					$bID = (int) $_REQUEST['id'];
599 599
 					$temp = $modx->getParentIds($bID);
600
-				} else if(isset($_REQUEST['pid'])) {
600
+				} else if (isset($_REQUEST['pid'])) {
601 601
 					$bID = (int) $_REQUEST['pid'];
602 602
 					$temp = $modx->getParentIds($bID);
603 603
 					array_unshift($temp, $bID);
604 604
 				}
605 605
 
606
-				if($temp) {
606
+				if ($temp) {
607 607
 					$parents = implode(',', $temp);
608 608
 
609
-					if(!empty($parents)) {
609
+					if (!empty($parents)) {
610 610
 						$where = "FIND_IN_SET(id,'{$parents}') DESC";
611 611
 						$rs = $modx->getDatabase()->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where);
612
-						while($row = $modx->getDatabase()->getRow($rs)) {
612
+						while ($row = $modx->getDatabase()->getRow($rs)) {
613 613
 							$out .= '<li class="breadcrumbs__li">
614
-                                <a href="index.php?a=27&id=' . $row['id'] . '" class="breadcrumbs__a">' . htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']) . '</a>
614
+                                <a href="index.php?a=27&id=' . $row['id'].'" class="breadcrumbs__a">'.htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']).'</a>
615 615
                                 <span class="breadcrumbs__sep">&gt;</span>
616 616
                             </li>';
617 617
 						}
618 618
 					}
619 619
 				}
620 620
 
621
-				$out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>';
622
-				echo '<ul class="breadcrumbs">' . $out . '</ul>';
621
+				$out .= '<li class="breadcrumbs__li breadcrumbs__li_current">'.$title.'</li>';
622
+				echo '<ul class="breadcrumbs">'.$out.'</ul>';
623 623
 			}
624 624
 			?>
625 625
 
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
 					$evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array(
637 637
 						'id' => $id
638 638
 					));
639
-					if(is_array($evtOut)) {
639
+					if (is_array($evtOut)) {
640 640
 						echo implode('', $evtOut);
641 641
 					} else {
642 642
 						?>
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
 									</td>
693 693
 								</tr>
694 694
 
695
-								<?php if($content['type'] == 'reference' || $modx->getManagerApi()->action == '72') { // Web Link specific ?>
695
+								<?php if ($content['type'] == 'reference' || $modx->getManagerApi()->action == '72') { // Web Link specific ?>
696 696
 
697 697
 									<tr>
698 698
 										<td><span class="warning"><?= $_lang['weblink'] ?></span>
@@ -728,17 +728,17 @@  discard block
 block discarded – undo
728 728
 											$from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id";
729 729
 											$rs = $modx->getDatabase()->select($field, $from, '', 'c.category, t.templatename ASC');
730 730
 											$currentCategory = '';
731
-											while($row = $modx->getDatabase()->getRow($rs)) {
732
-												if($row['selectable'] != 1 && $row['id'] != $content['template']) {
731
+											while ($row = $modx->getDatabase()->getRow($rs)) {
732
+												if ($row['selectable'] != 1 && $row['id'] != $content['template']) {
733 733
 													continue;
734 734
 												};
735 735
 												// Skip if not selectable but show if selected!
736 736
 												$thisCategory = $row['category'];
737
-												if($thisCategory == null) {
737
+												if ($thisCategory == null) {
738 738
 													$thisCategory = $_lang["no_category"];
739 739
 												}
740
-												if($thisCategory != $currentCategory) {
741
-													if($closeOptGroup) {
740
+												if ($thisCategory != $currentCategory) {
741
+													if ($closeOptGroup) {
742 742
 														echo "\t\t\t\t\t</optgroup>\n";
743 743
 													}
744 744
 													echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n";
@@ -747,10 +747,10 @@  discard block
 block discarded – undo
747 747
 
748 748
 												$selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : '';
749 749
 
750
-												echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n";
750
+												echo "\t\t\t\t\t".'<option value="'.$row['id'].'"'.$selectedtext.'>'.$row['templatename']."</option>\n";
751 751
 												$currentCategory = $thisCategory;
752 752
 											}
753
-											if($thisCategory != '') {
753
+											if ($thisCategory != '') {
754 754
 												echo "\t\t\t\t\t</optgroup>\n";
755 755
 											}
756 756
 											?>
@@ -794,20 +794,20 @@  discard block
 block discarded – undo
794 794
 									<td valign="top">
795 795
 										<?php
796 796
 										$parentlookup = false;
797
-										if(isset ($_REQUEST['id'])) {
798
-											if($content['parent'] == 0) {
797
+										if (isset ($_REQUEST['id'])) {
798
+											if ($content['parent'] == 0) {
799 799
 												$parentname = $site_name;
800 800
 											} else {
801 801
 												$parentlookup = $content['parent'];
802 802
 											}
803
-										} elseif(isset ($_REQUEST['pid'])) {
804
-											if($_REQUEST['pid'] == 0) {
803
+										} elseif (isset ($_REQUEST['pid'])) {
804
+											if ($_REQUEST['pid'] == 0) {
805 805
 												$parentname = $site_name;
806 806
 											} else {
807 807
 												$parentlookup = $_REQUEST['pid'];
808 808
 											}
809
-										} elseif(isset($_POST['parent'])) {
810
-											if($_POST['parent'] == 0) {
809
+										} elseif (isset($_POST['parent'])) {
810
+											if ($_POST['parent'] == 0) {
811 811
 												$parentname = $site_name;
812 812
 											} else {
813 813
 												$parentlookup = $_POST['parent'];
@@ -816,10 +816,10 @@  discard block
 block discarded – undo
816 816
 											$parentname = $site_name;
817 817
 											$content['parent'] = 0;
818 818
 										}
819
-										if($parentlookup !== false && is_numeric($parentlookup)) {
819
+										if ($parentlookup !== false && is_numeric($parentlookup)) {
820 820
 											$rs = $modx->getDatabase()->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'");
821 821
 											$parentname = $modx->getDatabase()->getValue($rs);
822
-											if(!$parentname) {
822
+											if (!$parentname) {
823 823
 												$modx->webAlertAndQuit($_lang["error_no_parent"]);
824 824
 											}
825 825
 										}
@@ -861,7 +861,7 @@  discard block
 block discarded – undo
861 861
 								}*/
862 862
 								?>
863 863
 
864
-								<?php if($content['type'] == 'document' || $modx->getManagerApi()->action == '4') { ?>
864
+								<?php if ($content['type'] == 'document' || $modx->getManagerApi()->action == '4') { ?>
865 865
 									<tr>
866 866
 										<td colspan="2">
867 867
 											<hr>
@@ -874,8 +874,8 @@  discard block
 block discarded – undo
874 874
 														<?php
875 875
 														// invoke OnRichTextEditorRegister event
876 876
 														$evtOut = $modx->invokeEvent("OnRichTextEditorRegister");
877
-														if(is_array($evtOut)) {
878
-															for($i = 0; $i < count($evtOut); $i++) {
877
+														if (is_array($evtOut)) {
878
+															for ($i = 0; $i < count($evtOut); $i++) {
879 879
 																$editor = $evtOut[$i];
880 880
 																echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n";
881 881
 															}
@@ -886,7 +886,7 @@  discard block
 block discarded – undo
886 886
 											</div>
887 887
 											<div id="content_body">
888 888
 												<?php
889
-												if(($content['richtext'] == 1 || $modx->getManagerApi()->action == '4') && $use_editor == 1) {
889
+												if (($content['richtext'] == 1 || $modx->getManagerApi()->action == '4') && $use_editor == 1) {
890 890
 													$htmlContent = $content['content'];
891 891
 													?>
892 892
 													<div class="section-editor clearfix">
@@ -899,7 +899,7 @@  discard block
 block discarded – undo
899 899
 													$richtexteditorIds[$modx->config['which_editor']][] = 'ta';
900 900
 													$richtexteditorOptions[$modx->config['which_editor']]['ta'] = '';
901 901
 												} else {
902
-													echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->getPhpCompat()->htmlspecialchars($content['content']), '</textarea></div>' . "\n";
902
+													echo "\t".'<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->getPhpCompat()->htmlspecialchars($content['content']), '</textarea></div>'."\n";
903 903
 												}
904 904
 												?>
905 905
 											</div>
@@ -915,7 +915,7 @@  discard block
 block discarded – undo
915 915
 
916 916
                             if (($content['type'] == 'document' || $modx->getManagerApi()->action == '4') || ($content['type'] == 'reference' || $modx->getManagerApi()->action == 72)) {
917 917
                                 $template = $default_template;
918
-                                $group_tvs = empty($modx->config['group_tvs']) ? 0 : (int)$modx->config['group_tvs'];
918
+                                $group_tvs = empty($modx->config['group_tvs']) ? 0 : (int) $modx->config['group_tvs'];
919 919
                                 if (isset ($_REQUEST['newtemplate'])) {
920 920
                                     $template = $_REQUEST['newtemplate'];
921 921
                                 } else {
@@ -943,10 +943,10 @@  discard block
 block discarded – undo
943 943
                                 );
944 944
                                 $sort = 'tvtpl.rank,tv.rank, tv.id';
945 945
                                 if ($group_tvs) {
946
-                                    $field .= ', IFNULL(tv.category,0) as category_id, IFNULL(cat.category,"' . $_lang['no_category'] . '") AS category, IFNULL(cat.rank,0) AS category_rank';
946
+                                    $field .= ', IFNULL(tv.category,0) as category_id, IFNULL(cat.category,"'.$_lang['no_category'].'") AS category, IFNULL(cat.rank,0) AS category_rank';
947 947
                                     $from .= '
948
-                                    LEFT JOIN ' . $tbl_categories . ' AS cat ON cat.id=tv.category';
949
-                                    $sort = 'cat.rank,cat.id,' . $sort;
948
+                                    LEFT JOIN ' . $tbl_categories.' AS cat ON cat.id=tv.category';
949
+                                    $sort = 'cat.rank,cat.id,'.$sort;
950 950
                                 }
951 951
                                 $where = vsprintf("tvtpl.templateid='%s' AND (1='%s' OR ISNULL(tva.documentgroup) %s)", $vs);
952 952
                                 $rs = $modx->getDatabase()->select($field, $from, $where, $sort);
@@ -964,8 +964,8 @@  discard block
 block discarded – undo
964 964
                                                 if ($group_tvs == 1 || $group_tvs == 3) {
965 965
                                                     if ($i === 0) {
966 966
                                                         $templateVariablesOutput .= '
967
-                            <div class="tab-section" id="tabTV_' . $row['category_id'] . '">
968
-                                <div class="tab-header">' . $row['category'] . '</div>
967
+                            <div class="tab-section" id="tabTV_' . $row['category_id'].'">
968
+                                <div class="tab-header">' . $row['category'].'</div>
969 969
                                 <div class="tab-body tmplvars">
970 970
                                     <table>' . "\n";
971 971
                                                     } else {
@@ -974,17 +974,17 @@  discard block
 block discarded – undo
974 974
                                 </div>
975 975
                             </div>
976 976
                             
977
-                            <div class="tab-section" id="tabTV_' . $row['category_id'] . '">
978
-                                <div class="tab-header">' . $row['category'] . '</div>
977
+                            <div class="tab-section" id="tabTV_' . $row['category_id'].'">
978
+                                <div class="tab-header">' . $row['category'].'</div>
979 979
                                 <div class="tab-body tmplvars">
980 980
                                     <table>';
981 981
                                                     }
982 982
                                                 } else if ($group_tvs == 2 || $group_tvs == 4) {
983 983
                                                     if ($i === 0) {
984 984
                                                         $templateVariablesOutput .= '
985
-                            <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars">
986
-                                <h2 class="tab">' . $row['category'] . '</h2>
987
-                                <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script>
985
+                            <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars">
986
+                                <h2 class="tab">' . $row['category'].'</h2>
987
+                                <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script>
988 988
                                 
989 989
                                 <div class="tab-body tmplvars">
990 990
                                     <table>';
@@ -994,9 +994,9 @@  discard block
 block discarded – undo
994 994
                                 </div>
995 995
                             </div>
996 996
                             
997
-                            <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars">
998
-                                <h2 class="tab">' . $row['category'] . '</h2>
999
-                                <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script>
997
+                            <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars">
998
+                                <h2 class="tab">' . $row['category'].'</h2>
999
+                                <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script>
1000 1000
                                 
1001 1001
                                 <div class="tab-body tmplvars">
1002 1002
                                     <table>';
@@ -1004,18 +1004,18 @@  discard block
 block discarded – undo
1004 1004
                                                 } else if ($group_tvs == 5) {
1005 1005
                                                     if ($i === 0) {
1006 1006
                                                         $templateVariablesOutput .= '
1007
-                                <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars">
1008
-                                    <h2 class="tab">' . $row['category'] . '</h2>
1009
-                                    <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script>
1007
+                                <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars">
1008
+                                    <h2 class="tab">' . $row['category'].'</h2>
1009
+                                    <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script>
1010 1010
                                     <table>';
1011 1011
                                                     } else {
1012 1012
                                                         $templateVariablesOutput .= '
1013 1013
                                     </table>
1014 1014
                                 </div>
1015 1015
                                 
1016
-                                <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars">
1017
-                                    <h2 class="tab">' . $row['category'] . '</h2>
1018
-                                    <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script>
1016
+                                <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars">
1017
+                                    <h2 class="tab">' . $row['category'].'</h2>
1018
+                                    <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script>
1019 1019
                                     
1020 1020
                                     <table>';
1021 1021
                                                     }
@@ -1035,8 +1035,8 @@  discard block
 block discarded – undo
1035 1035
                                                 $editor = isset($tvOptions['editor']) ? $tvOptions['editor'] : $modx->config['which_editor'];
1036 1036
                                             };
1037 1037
                                             // Add richtext editor to the list
1038
-                                            $richtexteditorIds[$editor][] = "tv" . $row['id'];
1039
-                                            $richtexteditorOptions[$editor]["tv" . $row['id']] = $tvOptions;
1038
+                                            $richtexteditorIds[$editor][] = "tv".$row['id'];
1039
+                                            $richtexteditorOptions[$editor]["tv".$row['id']] = $tvOptions;
1040 1040
                                         }
1041 1041
 
1042 1042
                                         $templateVariablesTmp = '';
@@ -1053,24 +1053,24 @@  discard block
 block discarded – undo
1053 1053
                                         }
1054 1054
 
1055 1055
                                         // post back value
1056
-                                        if (array_key_exists('tv' . $row['id'], $_POST)) {
1057
-                                            if (is_array($_POST['tv' . $row['id']])) {
1058
-                                                $tvPBV = implode('||', $_POST['tv' . $row['id']]);
1056
+                                        if (array_key_exists('tv'.$row['id'], $_POST)) {
1057
+                                            if (is_array($_POST['tv'.$row['id']])) {
1058
+                                                $tvPBV = implode('||', $_POST['tv'.$row['id']]);
1059 1059
                                             } else {
1060
-                                                $tvPBV = $_POST['tv' . $row['id']];
1060
+                                                $tvPBV = $_POST['tv'.$row['id']];
1061 1061
                                             }
1062 1062
                                         } else {
1063 1063
                                             $tvPBV = $row['value'];
1064 1064
                                         }
1065 1065
 
1066
-                                        $tvDescription = (!empty($row['description'])) ? '<br /><span class="comment">' . $row['description'] . '</span>' : '';
1067
-                                        $tvInherited = (substr($tvPBV, 0, 8) == '@INHERIT') ? '<br /><span class="comment inherited">(' . $_lang['tmplvars_inherited'] . ')</span>' : '';
1068
-                                        $tvName = $modx->hasPermission('edit_template') ? '<br/><small class="protectedNode">[*' . $row['name'] . '*]</small>' : '';
1066
+                                        $tvDescription = (!empty($row['description'])) ? '<br /><span class="comment">'.$row['description'].'</span>' : '';
1067
+                                        $tvInherited = (substr($tvPBV, 0, 8) == '@INHERIT') ? '<br /><span class="comment inherited">('.$_lang['tmplvars_inherited'].')</span>' : '';
1068
+                                        $tvName = $modx->hasPermission('edit_template') ? '<br/><small class="protectedNode">[*'.$row['name'].'*]</small>' : '';
1069 1069
 
1070 1070
                                         $templateVariablesTmp .= '
1071 1071
                                         <tr>
1072
-                                            <td><span class="warning">' . $row['caption'] . $tvName . '</span>' . $tvDescription . $tvInherited . '</td>
1073
-                                            <td><div style="position:relative;' . ($row['type'] == 'date' ? '' : '') . '">' . renderFormElement($row['type'], $row['id'], $row['default_text'], $row['elements'], $tvPBV, '', $row, $tvsArray) . '</div></td>
1072
+                                            <td><span class="warning">' . $row['caption'].$tvName.'</span>'.$tvDescription.$tvInherited.'</td>
1073
+                                            <td><div style="position:relative;' . ($row['type'] == 'date' ? '' : '').'">'.renderFormElement($row['type'], $row['id'], $row['default_text'], $row['elements'], $tvPBV, '', $row, $tvsArray).'</div></td>
1074 1074
                                         </tr>';
1075 1075
 
1076 1076
                                         if ($group_tvs && $row['category_id'] == 0) {
@@ -1084,37 +1084,37 @@  discard block
 block discarded – undo
1084 1084
                                     }
1085 1085
 
1086 1086
                                     if ($templateVariablesGeneral) {
1087
-                                        echo '<table id="tabTV_0" class="tmplvars"><tbody>' . $templateVariablesGeneral . '</tbody></table>';
1087
+                                        echo '<table id="tabTV_0" class="tmplvars"><tbody>'.$templateVariablesGeneral.'</tbody></table>';
1088 1088
                                     }
1089 1089
 
1090 1090
                                     $templateVariables .= '
1091 1091
                         <!-- Template Variables -->' . "\n";
1092 1092
                                     if (!$group_tvs) {
1093 1093
                                         $templateVariables .= '
1094
-                                    <div class="sectionHeader" id="tv_header">' . $_lang['settings_templvars'] . '</div>
1094
+                                    <div class="sectionHeader" id="tv_header">' . $_lang['settings_templvars'].'</div>
1095 1095
                                         <div class="sectionBody tmplvars">
1096 1096
                                             <table>';
1097 1097
                                     } else if ($group_tvs == 2) {
1098 1098
                                         $templateVariables .= '
1099 1099
                     <div class="tab-section">
1100
-                        <div class="tab-header" id="tv_header">' . $_lang['settings_templvars'] . '</div>
1100
+                        <div class="tab-header" id="tv_header">' . $_lang['settings_templvars'].'</div>
1101 1101
                         <div class="tab-pane" id="paneTemplateVariables">
1102 1102
                             <script type="text/javascript">
1103
-                                tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . ');
1103
+                                tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').');
1104 1104
                             </script>';
1105 1105
                                     } else if ($group_tvs == 3) {
1106 1106
                                         $templateVariables .= '
1107 1107
                         <div id="templateVariables" class="tab-page tmplvars">
1108
-                            <h2 class="tab">' . $_lang['settings_templvars'] . '</h2>
1108
+                            <h2 class="tab">' . $_lang['settings_templvars'].'</h2>
1109 1109
                             <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'templateVariables\'));</script>';
1110 1110
                                     } else if ($group_tvs == 4) {
1111 1111
                                         $templateVariables .= '
1112 1112
                     <div id="templateVariables" class="tab-page tmplvars">
1113
-                        <h2 class="tab">' . $_lang['settings_templvars'] . '</h2>
1113
+                        <h2 class="tab">' . $_lang['settings_templvars'].'</h2>
1114 1114
                         <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'templateVariables\'));</script>
1115 1115
                         <div class="tab-pane" id="paneTemplateVariables">
1116 1116
                             <script type="text/javascript">
1117
-                                tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . ');
1117
+                                tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').');
1118 1118
                             </script>';
1119 1119
                                     }
1120 1120
                                     if ($templateVariablesOutput) {
@@ -1208,7 +1208,7 @@  discard block
 block discarded – undo
1208 1208
 
1209 1209
 								<?php
1210 1210
 
1211
-								if($_SESSION['mgrRole'] == 1 || $modx->getManagerApi()->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) {
1211
+								if ($_SESSION['mgrRole'] == 1 || $modx->getManagerApi()->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) {
1212 1212
 									?>
1213 1213
 									<tr>
1214 1214
 										<td>
@@ -1231,13 +1231,13 @@  discard block
 block discarded – undo
1231 1231
 										<td>
1232 1232
 											<select name="contentType" class="inputBox" onchange="documentDirty=true;">
1233 1233
 												<?php
1234
-												if(!$content['contentType']) {
1234
+												if (!$content['contentType']) {
1235 1235
 													$content['contentType'] = 'text/html';
1236 1236
 												}
1237 1237
 												$custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml");
1238 1238
 												$ct = explode(",", $custom_contenttype);
1239
-												for($i = 0; $i < count($ct); $i++) {
1240
-													echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n";
1239
+												for ($i = 0; $i < count($ct); $i++) {
1240
+													echo "\t\t\t\t\t".'<option value="'.$ct[$i].'"'.($content['contentType'] == $ct[$i] ? ' selected="selected"' : '').'>'.$ct[$i]."</option>\n";
1241 1241
 												}
1242 1242
 												?>
1243 1243
 											</select>
@@ -1263,7 +1263,7 @@  discard block
 block discarded – undo
1263 1263
 									</tr>
1264 1264
 									<?php
1265 1265
 								} else {
1266
-									if($content['type'] != 'reference' && $modx->getManagerApi()->action != '72') {
1266
+									if ($content['type'] != 'reference' && $modx->getManagerApi()->action != '72') {
1267 1267
 										// non-admin managers creating or editing a document resource
1268 1268
 										?>
1269 1269
 										<input type="hidden" name="contentType" value="<?= (isset($content['contentType']) ? $content['contentType'] : "text/html") ?>" />
@@ -1363,15 +1363,15 @@  discard block
 block discarded – undo
1363 1363
 						<?php
1364 1364
 					/*******************************
1365 1365
 					 * Document Access Permissions */
1366
-					if($use_udperms == 1) {
1366
+					if ($use_udperms == 1) {
1367 1367
 						$groupsarray = array();
1368 1368
 						$sql = '';
1369 1369
 
1370 1370
 						$documentId = ($modx->getManagerApi()->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']));
1371
-						if($documentId > 0) {
1371
+						if ($documentId > 0) {
1372 1372
 							// Load up, the permissions from the parent (if new document) or existing document
1373 1373
 							$rs = $modx->getDatabase()->select('id, document_group', $tbl_document_groups, "document='{$documentId}'");
1374
-							while($currentgroup = $modx->getDatabase()->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id'];
1374
+							while ($currentgroup = $modx->getDatabase()->getRow($rs)) $groupsarray[] = $currentgroup['document_group'].','.$currentgroup['id'];
1375 1375
 
1376 1376
 							// Load up the current permissions and names
1377 1377
 							$vs = array(
@@ -1387,7 +1387,7 @@  discard block
 block discarded – undo
1387 1387
 						}
1388 1388
 
1389 1389
 						// retain selected doc groups between post
1390
-						if(isset($_POST['docgroups'])) {
1390
+						if (isset($_POST['docgroups'])) {
1391 1391
 							$groupsarray = array_merge($groupsarray, $_POST['docgroups']);
1392 1392
 						}
1393 1393
 
@@ -1406,26 +1406,26 @@  discard block
 block discarded – undo
1406 1406
 						$permissions_no = 0; // count permissions the current mgr user doesn't have
1407 1407
 
1408 1408
 						// Loop through the permissions list
1409
-						while($row = $modx->getDatabase()->getRow($rs)) {
1409
+						while ($row = $modx->getDatabase()->getRow($rs)) {
1410 1410
 
1411 1411
 							// Create an inputValue pair (group ID and group link (if it exists))
1412
-							$inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new');
1413
-							$inputId = 'group-' . $row['id'];
1412
+							$inputValue = $row['id'].','.($row['link_id'] ? $row['link_id'] : 'new');
1413
+							$inputId = 'group-'.$row['id'];
1414 1414
 
1415 1415
 							$checked = in_array($inputValue, $groupsarray);
1416
-							if($checked) {
1416
+							if ($checked) {
1417 1417
 								$notPublic = true;
1418 1418
 							} // Mark as private access (either web or manager)
1419 1419
 
1420 1420
 							// Skip the access permission if the user doesn't have access...
1421
-							if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) {
1421
+							if ((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) {
1422 1422
 								continue;
1423 1423
 							}
1424 1424
 
1425 1425
 							// Setup attributes for this Input box
1426 1426
 							$inputAttributes['id'] = $inputId;
1427 1427
 							$inputAttributes['value'] = $inputValue;
1428
-							if($checked) {
1428
+							if ($checked) {
1429 1429
 								$inputAttributes['checked'] = 'checked';
1430 1430
 							} else {
1431 1431
 								unset($inputAttributes['checked']);
@@ -1433,10 +1433,10 @@  discard block
 block discarded – undo
1433 1433
 
1434 1434
 							// Create attribute string list
1435 1435
 							$inputString = array();
1436
-							foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"';
1436
+							foreach ($inputAttributes as $k => $v) $inputString[] = $k.'="'.$v.'"';
1437 1437
 
1438 1438
 							// Make the <input> HTML
1439
-							$inputHTML = '<input ' . implode(' ', $inputString) . ' />';
1439
+							$inputHTML = '<input '.implode(' ', $inputString).' />';
1440 1440
 
1441 1441
 							// does user have this permission?
1442 1442
 							$from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg";
@@ -1447,23 +1447,23 @@  discard block
 block discarded – undo
1447 1447
 							$where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs);
1448 1448
 							$rsp = $modx->getDatabase()->select('COUNT(mg.id)', $from, $where);
1449 1449
 							$count = $modx->getDatabase()->getValue($rsp);
1450
-							if($count > 0) {
1450
+							if ($count > 0) {
1451 1451
 								++$permissions_yes;
1452 1452
 							} else {
1453 1453
 								++$permissions_no;
1454 1454
 							}
1455
-							$permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>';
1455
+							$permissions[] = "\t\t".'<li>'.$inputHTML.'<label for="'.$inputId.'">'.$row['name'].'</label></li>';
1456 1456
 						}
1457 1457
 						// if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public
1458
-						if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) {
1458
+						if ($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) {
1459 1459
 							$permissions = array();
1460 1460
 						}
1461 1461
 
1462 1462
 						// See if the Access Permissions section is worth displaying...
1463
-						if(!empty($permissions)) {
1463
+						if (!empty($permissions)) {
1464 1464
 							// Add the "All Document Groups" item if we have rights in both contexts
1465
-							if($isManager && $isWeb) {
1466
-								array_unshift($permissions, "\t\t" . '<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true);" /><label for="groupall" class="warning">' . $_lang['all_doc_groups'] . '</label></li>');
1465
+							if ($isManager && $isWeb) {
1466
+								array_unshift($permissions, "\t\t".'<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"'.(!$notPublic ? ' checked="checked"' : '').' onclick="makePublic(true);" /><label for="groupall" class="warning">'.$_lang['all_doc_groups'].'</label></li>');
1467 1467
 							}
1468 1468
 							// Output the permissions list...
1469 1469
 							?>
@@ -1496,12 +1496,12 @@  discard block
 block discarded – undo
1496 1496
 								</script>
1497 1497
 								<p><?= $_lang['access_permissions_docs_message'] ?></p>
1498 1498
 								<ul>
1499
-									<?= implode("\n", $permissions) . "\n" ?>
1499
+									<?= implode("\n", $permissions)."\n" ?>
1500 1500
 								</ul>
1501 1501
 							</div><!--div class="tab-page" id="tabAccess"-->
1502 1502
 							<?php
1503 1503
 						} // !empty($permissions)
1504
-						elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) {
1504
+						elseif ($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) {
1505 1505
 							?>
1506 1506
 							<p><?= $_lang["access_permissions_docs_collision"] ?></p>
1507 1507
 							<?php
@@ -1521,7 +1521,7 @@  discard block
 block discarded – undo
1521 1521
 						'template' => $content['template']
1522 1522
 					));
1523 1523
 
1524
-					if(is_array($evtOut)) {
1524
+					if (is_array($evtOut)) {
1525 1525
 						echo implode('', $evtOut);
1526 1526
 					}
1527 1527
 					?>
@@ -1534,16 +1534,16 @@  discard block
 block discarded – undo
1534 1534
 		storeCurTemplate();
1535 1535
 	</script>
1536 1536
 <?php
1537
-if(($content['richtext'] == 1 || $modx->getManagerApi()->action == '4' || $modx->getManagerApi()->action == '72') && $use_editor == 1) {
1538
-	if(is_array($richtexteditorIds)) {
1539
-		foreach($richtexteditorIds as $editor => $elements) {
1537
+if (($content['richtext'] == 1 || $modx->getManagerApi()->action == '4' || $modx->getManagerApi()->action == '72') && $use_editor == 1) {
1538
+	if (is_array($richtexteditorIds)) {
1539
+		foreach ($richtexteditorIds as $editor => $elements) {
1540 1540
 			// invoke OnRichTextEditorInit event
1541 1541
 			$evtOut = $modx->invokeEvent('OnRichTextEditorInit', array(
1542 1542
 				'editor' => $editor,
1543 1543
 				'elements' => $elements,
1544 1544
 				'options' => $richtexteditorOptions[$editor]
1545 1545
 			));
1546
-			if(is_array($evtOut)) {
1546
+			if (is_array($evtOut)) {
1547 1547
 				echo implode('', $evtOut);
1548 1548
 			}
1549 1549
 		}
Please login to merge, or discard this patch.