Completed
Push — develop ( 4e806c...6a553b )
by Agel_Nash
10:03
created
manager/actions/mutate_role.dynamic.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 
6
-switch ((int)$modx->getManagerApi()->action) {
6
+switch ((int) $modx->getManagerApi()->action) {
7 7
     case 35:
8 8
         if (!$modx->hasPermission('edit_role')) {
9 9
             $modx->webAlertAndQuit($_lang["error_no_privileges"]);
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
         $modx->webAlertAndQuit($_lang["error_no_privileges"]);
19 19
 }
20 20
 
21
-$role = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
21
+$role = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
22 22
 
23 23
 $tbl_user_roles = $modx->getDatabase()->getFullTableName('user_roles');
24 24
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 // Add lock-element JS-Script
47 47
 $lockElementId = $role;
48 48
 $lockElementType = 8;
49
-require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php');
49
+require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php');
50 50
 ?>
51 51
 <script type="text/javascript">
52 52
     function changestate(element) {
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     <input type="hidden" name="id" value="<?= $_GET['id'] ?>">
83 83
 
84 84
     <h1>
85
-        <i class="fa fa-legal"></i><?= ($roledata['name'] ? $roledata['name'] . '<small>(' . $roledata['id'] . ')</small>' : $_lang['role_title']) ?>
85
+        <i class="fa fa-legal"></i><?= ($roledata['name'] ? $roledata['name'].'<small>('.$roledata['id'].')</small>' : $_lang['role_title']) ?>
86 86
     </h1>
87 87
 
88 88
     <?= $_style['actionbuttons']['dynamic']['savedelete'] ?>
Please login to merge, or discard this patch.
manager/actions/modules.static.php 2 patches
Spacing   +11 added lines, -11 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('new_module') || $modx->hasPermission('edit_module') || $modx->hasPermission('exec_module'))) {
@@ -107,22 +107,22 @@  discard block
 block discarded – undo
107 107
     <div class="table-responsive">
108 108
         <?php
109 109
         if ($_SESSION['mgrRole'] != 1 && !empty($modx->config['use_udperms'])) {
110
-            $rs = $modx->getDatabase()->query('SELECT DISTINCT sm.id, sm.name, sm.description, mg.member, IF(disabled,"' . $_lang['yes'] . '","-") as disabled, IF(sm.icon<>"",sm.icon,"' . $_style['icons_modules'] . '") as icon
111
-				FROM ' . $modx->getDatabase()->getFullTableName('site_modules') . ' AS sm
112
-				LEFT JOIN ' . $modx->getDatabase()->getFullTableName('site_module_access') . ' AS sma ON sma.module = sm.id
113
-				LEFT JOIN ' . $modx->getDatabase()->getFullTableName('member_groups') . ' AS mg ON sma.usergroup = mg.user_group
114
-                WHERE (mg.member IS NULL OR mg.member = ' . $modx->getLoginUserID() . ') AND sm.disabled != 1 AND sm.locked != 1
110
+            $rs = $modx->getDatabase()->query('SELECT DISTINCT sm.id, sm.name, sm.description, mg.member, IF(disabled,"'.$_lang['yes'].'","-") as disabled, IF(sm.icon<>"",sm.icon,"'.$_style['icons_modules'].'") as icon
111
+				FROM ' . $modx->getDatabase()->getFullTableName('site_modules').' AS sm
112
+				LEFT JOIN ' . $modx->getDatabase()->getFullTableName('site_module_access').' AS sma ON sma.module = sm.id
113
+				LEFT JOIN ' . $modx->getDatabase()->getFullTableName('member_groups').' AS mg ON sma.usergroup = mg.user_group
114
+                WHERE (mg.member IS NULL OR mg.member = ' . $modx->getLoginUserID().') AND sm.disabled != 1 AND sm.locked != 1
115 115
                 ORDER BY sm.name');
116 116
             if ($modx->hasPermission('edit_module')) {
117
-                $title = "<a href='index.php?a=108&id=[+id+]' title='" . $_lang["module_edit_click_title"] . "'>[+value+]</a>";
117
+                $title = "<a href='index.php?a=108&id=[+id+]' title='".$_lang["module_edit_click_title"]."'>[+value+]</a>";
118 118
             } else if ($modx->hasPermission('exec_module')) {
119
-                $title = "<a href='index.php?a=112&id=[+id+]' title='" . $_lang["module_edit_click_title"] . "'>[+value+]</a>";
119
+                $title = "<a href='index.php?a=112&id=[+id+]' title='".$_lang["module_edit_click_title"]."'>[+value+]</a>";
120 120
             } else {
121 121
                 $title = '[+value+]';
122 122
             }
123 123
         } else {
124 124
             $rs = $modx->getDatabase()->select("id, name, description, IF(locked,'{$_lang['yes']}','-') as locked, IF(disabled,'{$_lang['yes']}','-') as disabled, IF(icon<>'',icon,'{$_style['icons_module']}') as icon", $modx->getDatabase()->getFullTableName("site_modules"), (!empty($sqlQuery) ? "(name LIKE '%{$sqlQuery}%') OR (description LIKE '%{$sqlQuery}%')" : ""), "name");
125
-            $title = "<a href='index.php?a=108&id=[+id+]' title='" . $_lang["module_edit_click_title"] . "'>[+value+]</a>";
125
+            $title = "<a href='index.php?a=108&id=[+id+]' title='".$_lang["module_edit_click_title"]."'>[+value+]</a>";
126 126
         }
127 127
         $grd = new \EvolutionCMS\Support\DataGrid('', $rs, $number_of_results); // set page size to 0 t show all items
128 128
         $grd->noRecordMsg = $_lang["no_records_found"];
@@ -131,10 +131,10 @@  discard block
 block discarded – undo
131 131
         $grd->itemClass = "tableItem";
132 132
         $grd->altItemClass = "tableAltItem";
133 133
         $grd->fields = "icon,name,description,locked,disabled";
134
-        $grd->columns = $_lang["icon"] . " ," . $_lang["name"] . " ," . $_lang["description"] . " ," . $_lang["locked"] . " ," . $_lang["disabled"];
134
+        $grd->columns = $_lang["icon"]." ,".$_lang["name"]." ,".$_lang["description"]." ,".$_lang["locked"]." ,".$_lang["disabled"];
135 135
         $grd->colWidths = "34,,,60,60";
136 136
         $grd->colAligns = "center,,,center,center";
137
-        $grd->colTypes = "template:<a class='tableRowIcon' href='javascript:;' onclick='return showContentMenu([+id+],event);' title='" . $_lang["click_to_context"] . "'><i class='[+value+]'></i></a>||template:" . $title;
137
+        $grd->colTypes = "template:<a class='tableRowIcon' href='javascript:;' onclick='return showContentMenu([+id+],event);' title='".$_lang["click_to_context"]."'><i class='[+value+]'></i></a>||template:".$title;
138 138
         if ($listmode == '1') {
139 139
             $grd->pageSize = 0;
140 140
         }
Please login to merge, or discard this patch.
Braces   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5
-if (!($modx->hasPermission('new_module') || $modx->hasPermission('edit_module') || $modx->hasPermission('exec_module'))) {
5
+if (!($modx->hasPermission('new_module') || $modx->hasPermission('edit_module') || $modx->hasPermission('exec_module'))) {
6 6
     $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
@@ -10,10 +10,10 @@  discard block
 block discarded – undo
10 10
 $modx->getManagerApi()->initPageViewState();
11 11
 
12 12
 // get and save search string
13
-if ($_REQUEST['op'] == 'reset') {
13
+if ($_REQUEST['op'] == 'reset') {
14 14
     $query = '';
15 15
     $_PAGE['vs']['search'] = '';
16
-} else {
16
+} else {
17 17
     $query = isset($_REQUEST['search']) ? $_REQUEST['search'] : $_PAGE['vs']['search'];
18 18
     $sqlQuery = $modx->getDatabase()->escape($query);
19 19
     $_PAGE['vs']['search'] = $query;
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 // context menu
28 28
 $cm = new \EvolutionCMS\Support\ContextMenu("cntxm", 150);
29 29
 $cm->addItem($_lang["run_module"], "js:menuAction(1)", $_style['actions_run'], (!$modx->hasPermission('exec_module') ? 1 : 0));
30
-if ($modx->hasPermission('edit_module') || $modx->hasPermission('new_module') || $modx->hasPermission('delete_module')) {
30
+if ($modx->hasPermission('edit_module') || $modx->hasPermission('new_module') || $modx->hasPermission('delete_module')) {
31 31
     $cm->addSeparator();
32 32
 }
33 33
 $cm->addItem($_lang["edit"], "js:menuAction(2)", $_style['actions_edit'], (!$modx->hasPermission('edit_module') ? 1 : 0));
@@ -106,21 +106,21 @@  discard block
 block discarded – undo
106 106
 <div class="tab-page">
107 107
     <div class="table-responsive">
108 108
         <?php
109
-        if ($_SESSION['mgrRole'] != 1 && !empty($modx->config['use_udperms'])) {
109
+        if ($_SESSION['mgrRole'] != 1 && !empty($modx->config['use_udperms'])) {
110 110
             $rs = $modx->getDatabase()->query('SELECT DISTINCT sm.id, sm.name, sm.description, mg.member, IF(disabled,"' . $_lang['yes'] . '","-") as disabled, IF(sm.icon<>"",sm.icon,"' . $_style['icons_modules'] . '") as icon
111 111
 				FROM ' . $modx->getDatabase()->getFullTableName('site_modules') . ' AS sm
112 112
 				LEFT JOIN ' . $modx->getDatabase()->getFullTableName('site_module_access') . ' AS sma ON sma.module = sm.id
113 113
 				LEFT JOIN ' . $modx->getDatabase()->getFullTableName('member_groups') . ' AS mg ON sma.usergroup = mg.user_group
114 114
                 WHERE (mg.member IS NULL OR mg.member = ' . $modx->getLoginUserID() . ') AND sm.disabled != 1 AND sm.locked != 1
115 115
                 ORDER BY sm.name');
116
-            if ($modx->hasPermission('edit_module')) {
116
+            if ($modx->hasPermission('edit_module')) {
117 117
                 $title = "<a href='index.php?a=108&id=[+id+]' title='" . $_lang["module_edit_click_title"] . "'>[+value+]</a>";
118
-            } else if ($modx->hasPermission('exec_module')) {
118
+            } else if ($modx->hasPermission('exec_module')) {
119 119
                 $title = "<a href='index.php?a=112&id=[+id+]' title='" . $_lang["module_edit_click_title"] . "'>[+value+]</a>";
120
-            } else {
120
+            } else {
121 121
                 $title = '[+value+]';
122 122
             }
123
-        } else {
123
+        } else {
124 124
             $rs = $modx->getDatabase()->select("id, name, description, IF(locked,'{$_lang['yes']}','-') as locked, IF(disabled,'{$_lang['yes']}','-') as disabled, IF(icon<>'',icon,'{$_style['icons_module']}') as icon", $modx->getDatabase()->getFullTableName("site_modules"), (!empty($sqlQuery) ? "(name LIKE '%{$sqlQuery}%') OR (description LIKE '%{$sqlQuery}%')" : ""), "name");
125 125
             $title = "<a href='index.php?a=108&id=[+id+]' title='" . $_lang["module_edit_click_title"] . "'>[+value+]</a>";
126 126
         }
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
         $grd->colWidths = "34,,,60,60";
136 136
         $grd->colAligns = "center,,,center,center";
137 137
         $grd->colTypes = "template:<a class='tableRowIcon' href='javascript:;' onclick='return showContentMenu([+id+],event);' title='" . $_lang["click_to_context"] . "'><i class='[+value+]'></i></a>||template:" . $title;
138
-        if ($listmode == '1') {
138
+        if ($listmode == '1') {
139 139
             $grd->pageSize = 0;
140 140
         }
141
-        if ($_REQUEST['op'] == 'reset') {
141
+        if ($_REQUEST['op'] == 'reset') {
142 142
             $grd->pageNumber = 1;
143 143
         }
144 144
         // render grid
Please login to merge, or discard this patch.
manager/actions/messages.static.php 1 patch
Spacing   +15 added lines, -15 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('messages')) {
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
         <div class="container container-body" id="lyr3">
17 17
             <b><?= $_lang['messages_read_message'] ?></b>
18 18
             <?php
19
-            $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('user_messages'), "id='" . (int)$_REQUEST['id'] . "'");
19
+            $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('user_messages'), "id='".(int) $_REQUEST['id']."'");
20 20
             $message = $modx->getDatabase()->getRow($rs);
21 21
             if (!$message) {
22 22
                 echo "Wrong number of messages returned!";
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
         <p><b><?= $_lang['messages_inbox'] ?></b></p>
88 88
         <?php
89 89
         // Get  number of rows
90
-        $rs = $modx->getDatabase()->select('count(id)', $modx->getDatabase()->getFullTableName('user_messages'), "recipient=" . $modx->getLoginUserID() . "");
90
+        $rs = $modx->getDatabase()->select('count(id)', $modx->getDatabase()->getFullTableName('user_messages'), "recipient=".$modx->getLoginUserID()."");
91 91
         $num_rows = $modx->getDatabase()->getValue($rs);
92 92
 
93 93
         // ==============================================================
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         if (!isset($_REQUEST['int_cur_position']) || $_REQUEST['int_cur_position'] == 0) {
101 101
             $int_cur_position = 0;
102 102
         } else {
103
-            $int_cur_position = (int)$_REQUEST['int_cur_position'];
103
+            $int_cur_position = (int) $_REQUEST['int_cur_position'];
104 104
         }
105 105
 
106 106
         // Number of result to display on the page, will be in the LIMIT of the sql query also
@@ -116,21 +116,21 @@  discard block
 block discarded – undo
116 116
         $array_row_paging = $p->getPagingRowArray();
117 117
 
118 118
         // Display the result as you like...
119
-        $pager .= $_lang['showing'] . " " . $array_paging['lower'];
120
-        $pager .= " " . $_lang['to'] . " " . $array_paging['upper'];
121
-        $pager .= " (" . $array_paging['total'] . " " . $_lang['total'] . ")";
122
-        $pager .= "<br />" . $array_paging['previous_link'] . "&lt;&lt;" . (isset($array_paging['previous_link']) ? "</a> " : " ");
119
+        $pager .= $_lang['showing']." ".$array_paging['lower'];
120
+        $pager .= " ".$_lang['to']." ".$array_paging['upper'];
121
+        $pager .= " (".$array_paging['total']." ".$_lang['total'].")";
122
+        $pager .= "<br />".$array_paging['previous_link']."&lt;&lt;".(isset($array_paging['previous_link']) ? "</a> " : " ");
123 123
         for ($i = 0; $i < sizeof($array_row_paging); $i++) {
124
-            $pager .= $array_row_paging[$i] . "&nbsp;";
124
+            $pager .= $array_row_paging[$i]."&nbsp;";
125 125
         }
126
-        $pager .= $array_paging['next_link'] . "&gt;&gt;" . (isset($array_paging['next_link']) ? "</a>" : "");
126
+        $pager .= $array_paging['next_link']."&gt;&gt;".(isset($array_paging['next_link']) ? "</a>" : "");
127 127
 
128 128
         // The above exemple print somethings like:
129 129
         // Results 1 to 20 of 597  <<< 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 >>>
130 130
         // Of course you can now play with array_row_paging in order to print
131 131
         // only the results you would like...
132 132
 
133
-        $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('user_messages'), "recipient=" . $modx->getLoginUserID() . "", 'postdate DESC', "{$int_cur_position}, {$int_num_result}");
133
+        $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('user_messages'), "recipient=".$modx->getLoginUserID()."", 'postdate DESC', "{$int_cur_position}, {$int_num_result}");
134 134
         $limit = $modx->getDatabase()->getRecordCount($rs);
135 135
         if ($limit < 1) {
136 136
             echo $_lang['messages_no_messages'];
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
         <p><b><?= $_lang['messages_compose'] ?></b></p>
189 189
         <?php
190 190
         if (($_REQUEST['m'] == 'rp' || $_REQUEST['m'] == 'f') && isset($_REQUEST['id'])) {
191
-            $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('user_messages'), "id='" . $_REQUEST['id'] . "'");
191
+            $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('user_messages'), "id='".$_REQUEST['id']."'");
192 192
             $message = $modx->getDatabase()->getRow($rs);
193 193
             if (!$message) {
194 194
                 echo "Wrong number of messages returned!";
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
                     }
208 208
                     $subjecttext = $_REQUEST['m'] == 'rp' ? "Re: " : "Fwd: ";
209 209
                     $subjecttext .= $message['subject'];
210
-                    $messagetext = "\n\n\n-----\n" . $_lang['messages_from'] . ": $sendername\n" . $_lang['messages_sent'] . ": " . $modx->toDateFormat($message['postdate'] + $server_offset_time) . "\n" . $_lang['messages_subject'] . ": " . $message['subject'] . "\n\n" . $message['message'];
210
+                    $messagetext = "\n\n\n-----\n".$_lang['messages_from'].": $sendername\n".$_lang['messages_sent'].": ".$modx->toDateFormat($message['postdate'] + $server_offset_time)."\n".$_lang['messages_subject'].": ".$message['subject']."\n\n".$message['message'];
211 211
                     if ($_REQUEST['m'] == 'rp') {
212 212
                         $recipientindex = $message['sender'];
213 213
                     }
@@ -294,9 +294,9 @@  discard block
 block discarded – undo
294 294
 
295 295
 <?php
296 296
 // count messages again, as any action on the messages page may have altered the message count
297
-$rs = $modx->getDatabase()->select('COUNT(*)', $modx->getDatabase()->getFullTableName('user_messages'), "recipient=" . $modx->getLoginUserID() . " and messageread=0");
297
+$rs = $modx->getDatabase()->select('COUNT(*)', $modx->getDatabase()->getFullTableName('user_messages'), "recipient=".$modx->getLoginUserID()." and messageread=0");
298 298
 $_SESSION['nrnewmessages'] = $modx->getDatabase()->getValue($rs);
299
-$rs = $modx->getDatabase()->select('COUNT(*)', $modx->getDatabase()->getFullTableName('user_messages'), "recipient=" . $modx->getLoginUserID() . "");
299
+$rs = $modx->getDatabase()->select('COUNT(*)', $modx->getDatabase()->getFullTableName('user_messages'), "recipient=".$modx->getLoginUserID()."");
300 300
 $_SESSION['nrtotalmessages'] = $modx->getDatabase()->getValue($rs);
301 301
 $messagesallowed = $modx->hasPermission('messages');
302 302
 ?>
Please login to merge, or discard this patch.
manager/actions/search.static.php 2 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -113,31 +113,31 @@
 block discarded – undo
113 113
     // Handle Input "Search in main fields"
114 114
     if ($searchfields != '') {
115 115
 
116
-		/*start search by TV. Added Rising13*/
117
-		$tbl_site_tmplvar_contentvalues = $modx->getDatabase()->getFullTableName('site_tmplvar_contentvalues');
118
-		$articul_query = "SELECT `contentid` FROM {$tbl_site_tmplvar_contentvalues} WHERE `value` LIKE '%{$searchfields}%'";
119
-		$articul_result = $modx->getDatabase()->query($articul_query);
120
-		$articul_id_array = $modx->getDatabase()->makeArray($articul_result);
121
-		if(count($articul_id_array)>0){
122
-			$articul_id = '';
123
-			$i = 1;
124
-			foreach( $articul_id_array as $articul ) {
125
-				$articul_id.=$articul['contentid'];
126
-				if($i !== count($articul_id_array)){
127
-					$articul_id.=',';
128
-				}
129
-				$i++;
130
-			}
131
-		$articul_id_query = " OR sc.id IN ({$articul_id})";
132
-		}else{
133
-			$articul_id_query = '';
134
-		}
135
-		/*end search by TV*/
116
+        /*start search by TV. Added Rising13*/
117
+        $tbl_site_tmplvar_contentvalues = $modx->getDatabase()->getFullTableName('site_tmplvar_contentvalues');
118
+        $articul_query = "SELECT `contentid` FROM {$tbl_site_tmplvar_contentvalues} WHERE `value` LIKE '%{$searchfields}%'";
119
+        $articul_result = $modx->getDatabase()->query($articul_query);
120
+        $articul_id_array = $modx->getDatabase()->makeArray($articul_result);
121
+        if(count($articul_id_array)>0){
122
+            $articul_id = '';
123
+            $i = 1;
124
+            foreach( $articul_id_array as $articul ) {
125
+                $articul_id.=$articul['contentid'];
126
+                if($i !== count($articul_id_array)){
127
+                    $articul_id.=',';
128
+                }
129
+                $i++;
130
+            }
131
+        $articul_id_query = " OR sc.id IN ({$articul_id})";
132
+        }else{
133
+            $articul_id_query = '';
134
+        }
135
+        /*end search by TV*/
136 136
 
137 137
         if (ctype_digit($searchfields)) {
138 138
             $sqladd .= "sc.id='{$searchfields}'";
139 139
             if (strlen($searchfields) > 3) {
140
-				$sqladd .= $articul_id_query;//search by TV
140
+                $sqladd .= $articul_id_query;//search by TV
141 141
                 $sqladd .= " OR sc.pagetitle LIKE '%{$searchfields}%'";
142 142
             }
143 143
         }
Please login to merge, or discard this patch.
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     exit();
4 4
 }
5 5
 unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
                         <?php
42 42
                         $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('site_templates'));
43 43
                         $option[] = '<option value="">No selected</option>';
44
-                        $templateid = (isset($_REQUEST['templateid']) && $_REQUEST['templateid'] !== '') ? (int)$_REQUEST['templateid'] : '';
44
+                        $templateid = (isset($_REQUEST['templateid']) && $_REQUEST['templateid'] !== '') ? (int) $_REQUEST['templateid'] : '';
45 45
                         $selected = $templateid === 0 ? ' selected="selected"' : '';
46
-                        $option[] = '<option value="0"' . $selected . '>(blank)</option>';
46
+                        $option[] = '<option value="0"'.$selected.'>(blank)</option>';
47 47
                         while ($row = $modx->getDatabase()->getRow($rs)) {
48 48
                             $templatename = htmlspecialchars($row['templatename'], ENT_QUOTES, $modx->config['modx_charset']);
49 49
                             $selected = $row['id'] == $templateid ? ' selected="selected"' : '';
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     $searchfields = htmlentities(trim($_POST['searchfields']), ENT_QUOTES, $modx_manager_charset);
87 87
     $searchlongtitle = $modx->getDatabase()->escape(trim($_REQUEST['searchfields']));
88 88
     $search_alias = $modx->getDatabase()->escape(trim($_REQUEST['searchfields']));
89
-    $templateid = isset($_REQUEST['templateid']) && $_REQUEST['templateid'] !== '' ? (int)$_REQUEST['templateid'] : '';
89
+    $templateid = isset($_REQUEST['templateid']) && $_REQUEST['templateid'] !== '' ? (int) $_REQUEST['templateid'] : '';
90 90
     $searchcontent = $modx->getDatabase()->escape($_REQUEST['content']);
91 91
 
92 92
     $fields = 'DISTINCT sc.id, contenttype, pagetitle, longtitle, description, introtext, menutitle, deleted, published, isfolder, type';
@@ -100,12 +100,12 @@  discard block
 block discarded – undo
100 100
         $friendly_url_suffix = $modx->config['friendly_url_suffix'];
101 101
         $base_url = $modx->config['base_url'];
102 102
         $site_url = $modx->config['site_url'];
103
-        $url = preg_replace('@' . $friendly_url_suffix . '$@', '', $url);
103
+        $url = preg_replace('@'.$friendly_url_suffix.'$@', '', $url);
104 104
         if ($url[0] === '/') {
105
-            $url = preg_replace('@^' . $base_url . '@', '', $url);
105
+            $url = preg_replace('@^'.$base_url.'@', '', $url);
106 106
         }
107 107
         if (substr($url, 0, 4) === 'http') {
108
-            $url = preg_replace('@^' . $site_url . '@', '', $url);
108
+            $url = preg_replace('@^'.$site_url.'@', '', $url);
109 109
         }
110 110
         $idFromAlias = $modx->getIdFromAlias($url);
111 111
     }
@@ -118,18 +118,18 @@  discard block
 block discarded – undo
118 118
 		$articul_query = "SELECT `contentid` FROM {$tbl_site_tmplvar_contentvalues} WHERE `value` LIKE '%{$searchfields}%'";
119 119
 		$articul_result = $modx->getDatabase()->query($articul_query);
120 120
 		$articul_id_array = $modx->getDatabase()->makeArray($articul_result);
121
-		if(count($articul_id_array)>0){
121
+		if (count($articul_id_array) > 0) {
122 122
 			$articul_id = '';
123 123
 			$i = 1;
124
-			foreach( $articul_id_array as $articul ) {
125
-				$articul_id.=$articul['contentid'];
126
-				if($i !== count($articul_id_array)){
127
-					$articul_id.=',';
124
+			foreach ($articul_id_array as $articul) {
125
+				$articul_id .= $articul['contentid'];
126
+				if ($i !== count($articul_id_array)) {
127
+					$articul_id .= ',';
128 128
 				}
129 129
 				$i++;
130 130
 			}
131 131
 		$articul_id_query = " OR sc.id IN ({$articul_id})";
132
-		}else{
132
+		} else {
133 133
 			$articul_id_query = '';
134 134
 		}
135 135
 		/*end search by TV*/
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
         if (ctype_digit($searchfields)) {
138 138
             $sqladd .= "sc.id='{$searchfields}'";
139 139
             if (strlen($searchfields) > 3) {
140
-				$sqladd .= $articul_id_query;//search by TV
140
+				$sqladd .= $articul_id_query; //search by TV
141 141
                 $sqladd .= " OR sc.pagetitle LIKE '%{$searchfields}%'";
142 142
             }
143 143
         }
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
             $sqladd .= " OR sc.introtext LIKE '%{$searchlongtitle}%'";
158 158
             $sqladd .= " OR sc.menutitle LIKE '%{$searchlongtitle}%'";
159 159
             $sqladd .= " OR sc.alias LIKE '%{$search_alias}%'";
160
-            $sqladd .= $articul_id_query;//search by TV
160
+            $sqladd .= $articul_id_query; //search by TV
161 161
             $sqladd .= ")";
162 162
         }
163 163
     } else if ($idFromAlias) {
@@ -181,8 +181,8 @@  discard block
 block discarded – undo
181 181
         $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : '';
182 182
         $mgrRole = (isset ($_SESSION['mgrRole']) && $_SESSION['mgrRole'] == 1) ? 1 : 0;
183 183
         $docgrp_cond = $docgrp ? " OR dg.document_group IN ({$docgrp})" : '';
184
-        $fields .= ', MAX(IF(1=' . $mgrRole . ' OR sc.privatemgr=0' . $docgrp_cond . ',1,0)) AS hasAccess';
185
-        $sqladd = '(' . $sqladd . ") AND (1={$mgrRole} OR sc.privatemgr=0" . (!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))");
184
+        $fields .= ', MAX(IF(1='.$mgrRole.' OR sc.privatemgr=0'.$docgrp_cond.',1,0)) AS hasAccess';
185
+        $sqladd = '('.$sqladd.") AND (1={$mgrRole} OR sc.privatemgr=0".(!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))");
186 186
     }
187 187
 
188 188
     if ($sqladd) {
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
     $where = $sqladd;
193 193
 
194 194
     if ($where) {
195
-        $rs = $modx->getDatabase()->select($fields, $tbl_site_content . ' AS sc LEFT JOIN ' . $tbldg . ' AS dg ON dg.document=sc.id', $where, 'sc.id');
195
+        $rs = $modx->getDatabase()->select($fields, $tbl_site_content.' AS sc LEFT JOIN '.$tbldg.' AS dg ON dg.document=sc.id', $where, 'sc.id');
196 196
         $limit = $modx->getDatabase()->getRecordCount($rs);
197 197
     } else {
198 198
         $limit = 0;
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
                 if ($limit < 1) {
212 212
                     echo $_lang['search_empty'];
213 213
                 } else {
214
-                    printf('<p>' . $_lang['search_results_returned_msg'] . '</p>', $limit);
214
+                    printf('<p>'.$_lang['search_results_returned_msg'].'</p>', $limit);
215 215
                     ?>
216 216
                     <script type="text/javascript" src="media/script/tablesort.js"></script>
217 217
                     <table class="grid sortabletable sortable-onload-2 rowstyle-even" id="table-1">
@@ -271,14 +271,14 @@  discard block
 block discarded – undo
271 271
                                 if (function_exists('mb_strlen') && function_exists('mb_substr')) {
272 272
                                     ?>
273 273
                                     <td<?= $tdClass ?>>
274
-                                        <a href="index.php?a=27&id=<?= $row['id'] ?>"><?= mb_strlen($row['pagetitle'], $modx_manager_charset) > 70 ? mb_substr($row['pagetitle'], 0, 70, $modx_manager_charset) . "..." : $row['pagetitle'] ?></a>
274
+                                        <a href="index.php?a=27&id=<?= $row['id'] ?>"><?= mb_strlen($row['pagetitle'], $modx_manager_charset) > 70 ? mb_substr($row['pagetitle'], 0, 70, $modx_manager_charset)."..." : $row['pagetitle'] ?></a>
275 275
                                     </td>
276
-                                    <td<?= $tdClass ?>><?= mb_strlen($row['description'], $modx_manager_charset) > 70 ? mb_substr($row['description'], 0, 70, $modx_manager_charset) . "..." : $row['description'] ?></td>
276
+                                    <td<?= $tdClass ?>><?= mb_strlen($row['description'], $modx_manager_charset) > 70 ? mb_substr($row['description'], 0, 70, $modx_manager_charset)."..." : $row['description'] ?></td>
277 277
                                     <?php
278 278
                                 } else {
279 279
                                     ?>
280
-                                    <td<?= $tdClass ?>><?= strlen($row['pagetitle']) > 20 ? substr($row['pagetitle'], 0, 20) . '...' : $row['pagetitle'] ?></td>
281
-                                    <td<?= $tdClass ?>><?= strlen($row['description']) > 35 ? substr($row['description'], 0, 35) . '...' : $row['description'] ?></td>
280
+                                    <td<?= $tdClass ?>><?= strlen($row['pagetitle']) > 20 ? substr($row['pagetitle'], 0, 20).'...' : $row['pagetitle'] ?></td>
281
+                                    <td<?= $tdClass ?>><?= strlen($row['description']) > 35 ? substr($row['description'], 0, 35).'...' : $row['description'] ?></td>
282 282
                                     <?php
283 283
                                 }
284 284
                                 ?>
@@ -298,115 +298,115 @@  discard block
 block discarded – undo
298 298
                 if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) {
299 299
                     $docscounts = $modx->getDatabase()->getRecordCount($rs);
300 300
                     if ($docscounts > 0) {
301
-                        $output .= '<li><b><i class="fa fa-sitemap"></i> ' . $_lang["manage_documents"] . ' (' . $docscounts . ')</b></li>';
301
+                        $output .= '<li><b><i class="fa fa-sitemap"></i> '.$_lang["manage_documents"].' ('.$docscounts.')</b></li>';
302 302
                         while ($row = $modx->getDatabase()->getRow($rs)) {
303
-                            $output .= '<li' . addClassForItemList('', !$row['published'], $row['deleted']) . '><a href="index.php?a=27&id=' . $row['id'] . '" id="content_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['pagetitle'] . ' <small>(' . $row['id'] . ')</small>', $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>';
303
+                            $output .= '<li'.addClassForItemList('', !$row['published'], $row['deleted']).'><a href="index.php?a=27&id='.$row['id'].'" id="content_'.$row['id'].'" target="main">'.highlightingCoincidence($row['pagetitle'].' <small>('.$row['id'].')</small>', $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>';
304 304
                         }
305 305
                     }
306 306
                 }
307 307
 
308 308
                 //templates
309 309
                 if ($modx->hasPermission('edit_template')) {
310
-                    $rs = $modx->getDatabase()->select("id,templatename,locked", $modx->getDatabase()->getFullTableName('site_templates'), "`id` like '%" . $searchfields . "%' 
311
-					OR `templatename` like '%" . $searchfields . "%' 
312
-					OR `description` like '%" . $searchfields . "%' 
313
-					OR `content` like '%" . $searchfields . "%'");
310
+                    $rs = $modx->getDatabase()->select("id,templatename,locked", $modx->getDatabase()->getFullTableName('site_templates'), "`id` like '%".$searchfields."%' 
311
+					OR `templatename` like '%" . $searchfields."%' 
312
+					OR `description` like '%" . $searchfields."%' 
313
+					OR `content` like '%" . $searchfields."%'");
314 314
                     $templatecounts = $modx->getDatabase()->getRecordCount($rs);
315 315
                     if ($templatecounts > 0) {
316
-                        $output .= '<li><b><i class="fa fa-newspaper-o"></i> ' . $_lang["manage_templates"] . ' (' . $templatecounts . ')</b></li>';
316
+                        $output .= '<li><b><i class="fa fa-newspaper-o"></i> '.$_lang["manage_templates"].' ('.$templatecounts.')</b></li>';
317 317
                         while ($row = $modx->getDatabase()->getRow($rs)) {
318
-                            $output .= '<li' . addClassForItemList($row['locked']) . '><a href="index.php?a=16&id=' . $row['id'] . '" id="templates_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['templatename'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>';
318
+                            $output .= '<li'.addClassForItemList($row['locked']).'><a href="index.php?a=16&id='.$row['id'].'" id="templates_'.$row['id'].'" target="main">'.highlightingCoincidence($row['templatename'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>';
319 319
                         }
320 320
                     }
321 321
                 }
322 322
 
323 323
                 //tvs
324 324
                 if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) {
325
-                    $rs = $modx->getDatabase()->select("id,name,locked", $modx->getDatabase()->getFullTableName('site_tmplvars'), "`id` like '%" . $searchfields . "%' 
326
-					OR `name` like '%" . $searchfields . "%' 
327
-					OR `description` like '%" . $searchfields . "%' 
328
-					OR `type` like '%" . $searchfields . "%' 
329
-					OR `elements` like '%" . $searchfields . "%' 
330
-					OR `display` like '%" . $searchfields . "%' 
331
-					OR `display_params` like '%" . $searchfields . "%' 
332
-					OR `default_text` like '%" . $searchfields . "%'");
325
+                    $rs = $modx->getDatabase()->select("id,name,locked", $modx->getDatabase()->getFullTableName('site_tmplvars'), "`id` like '%".$searchfields."%' 
326
+					OR `name` like '%" . $searchfields."%' 
327
+					OR `description` like '%" . $searchfields."%' 
328
+					OR `type` like '%" . $searchfields."%' 
329
+					OR `elements` like '%" . $searchfields."%' 
330
+					OR `display` like '%" . $searchfields."%' 
331
+					OR `display_params` like '%" . $searchfields."%' 
332
+					OR `default_text` like '%" . $searchfields."%'");
333 333
                     $tvscounts = $modx->getDatabase()->getRecordCount($rs);
334 334
                     if ($tvscounts > 0) {
335
-                        $output .= '<li><b><i class="fa fa-list-alt"></i> ' . $_lang["settings_templvars"] . ' (' . $tvscounts . ')</b></li>';
335
+                        $output .= '<li><b><i class="fa fa-list-alt"></i> '.$_lang["settings_templvars"].' ('.$tvscounts.')</b></li>';
336 336
                         while ($row = $modx->getDatabase()->getRow($rs)) {
337
-                            $output .= '<li' . addClassForItemList($row['locked']) . '><a href="index.php?a=301&id=' . $row['id'] . '" id="tmplvars_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>';
337
+                            $output .= '<li'.addClassForItemList($row['locked']).'><a href="index.php?a=301&id='.$row['id'].'" id="tmplvars_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>';
338 338
                         }
339 339
                     }
340 340
                 }
341 341
 
342 342
                 //Chunks
343 343
                 if ($modx->hasPermission('edit_chunk')) {
344
-                    $rs = $modx->getDatabase()->select("id,name,locked,disabled", $modx->getDatabase()->getFullTableName('site_htmlsnippets'), "`id` like '%" . $searchfields . "%' 
345
-					OR `name` like '%" . $searchfields . "%' 
346
-					OR `description` like '%" . $searchfields . "%'     
347
-					OR `snippet` like '%" . $searchfields . "%'");
344
+                    $rs = $modx->getDatabase()->select("id,name,locked,disabled", $modx->getDatabase()->getFullTableName('site_htmlsnippets'), "`id` like '%".$searchfields."%' 
345
+					OR `name` like '%" . $searchfields."%' 
346
+					OR `description` like '%" . $searchfields."%'     
347
+					OR `snippet` like '%" . $searchfields."%'");
348 348
                     $chunkscounts = $modx->getDatabase()->getRecordCount($rs);
349 349
                     if ($chunkscounts > 0) {
350
-                        $output .= '<li><b><i class="fa fa-th-large"></i> ' . $_lang["manage_htmlsnippets"] . ' (' . $chunkscounts . ')</b></li>';
350
+                        $output .= '<li><b><i class="fa fa-th-large"></i> '.$_lang["manage_htmlsnippets"].' ('.$chunkscounts.')</b></li>';
351 351
                         while ($row = $modx->getDatabase()->getRow($rs)) {
352
-                            $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=78&id=' . $row['id'] . '" id="htmlsnippets_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>';
352
+                            $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=78&id='.$row['id'].'" id="htmlsnippets_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>';
353 353
                         }
354 354
                     }
355 355
                 }
356 356
 
357 357
                 //Snippets
358 358
                 if ($modx->hasPermission('edit_snippet')) {
359
-                    $rs = $modx->getDatabase()->select("id,name,locked,disabled", $modx->getDatabase()->getFullTableName('site_snippets'), "`id` like '%" . $searchfields . "%' 
360
-					OR `name` like '%" . $searchfields . "%' 
361
-					OR `description` like '%" . $searchfields . "%' 
362
-					OR `snippet` like '%" . $searchfields . "%'  
363
-					OR `properties` like '%" . $searchfields . "%'      
364
-					OR `moduleguid` like '%" . $searchfields . "%'");
359
+                    $rs = $modx->getDatabase()->select("id,name,locked,disabled", $modx->getDatabase()->getFullTableName('site_snippets'), "`id` like '%".$searchfields."%' 
360
+					OR `name` like '%" . $searchfields."%' 
361
+					OR `description` like '%" . $searchfields."%' 
362
+					OR `snippet` like '%" . $searchfields."%'  
363
+					OR `properties` like '%" . $searchfields."%'      
364
+					OR `moduleguid` like '%" . $searchfields."%'");
365 365
                     $snippetscounts = $modx->getDatabase()->getRecordCount($rs);
366 366
                     if ($snippetscounts > 0) {
367
-                        $output .= '<li><b><i class="fa fa-code"></i> ' . $_lang["manage_snippets"] . ' (' . $snippetscounts . ')</b></li>';
367
+                        $output .= '<li><b><i class="fa fa-code"></i> '.$_lang["manage_snippets"].' ('.$snippetscounts.')</b></li>';
368 368
                         while ($row = $modx->getDatabase()->getRow($rs)) {
369
-                            $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=22&id=' . $row['id'] . '" id="snippets_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>';
369
+                            $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=22&id='.$row['id'].'" id="snippets_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>';
370 370
                         }
371 371
                     }
372 372
                 }
373 373
 
374 374
                 //plugins
375 375
                 if ($modx->hasPermission('edit_plugin')) {
376
-                    $rs = $modx->getDatabase()->select("id,name,locked,disabled", $modx->getDatabase()->getFullTableName('site_plugins'), "`id` like '%" . $searchfields . "%' 
377
-					OR `name` like '%" . $searchfields . "%' 
378
-					OR `description` like '%" . $searchfields . "%' 
379
-					OR `plugincode` like '%" . $searchfields . "%'  
380
-					OR `properties` like '%" . $searchfields . "%'      
381
-					OR `moduleguid` like '%" . $searchfields . "%'");
376
+                    $rs = $modx->getDatabase()->select("id,name,locked,disabled", $modx->getDatabase()->getFullTableName('site_plugins'), "`id` like '%".$searchfields."%' 
377
+					OR `name` like '%" . $searchfields."%' 
378
+					OR `description` like '%" . $searchfields."%' 
379
+					OR `plugincode` like '%" . $searchfields."%'  
380
+					OR `properties` like '%" . $searchfields."%'      
381
+					OR `moduleguid` like '%" . $searchfields."%'");
382 382
                     $pluginscounts = $modx->getDatabase()->getRecordCount($rs);
383 383
                     if ($pluginscounts > 0) {
384
-                        $output .= '<li><b><i class="fa fa-plug"></i> ' . $_lang["manage_plugins"] . ' (' . $pluginscounts . ')</b></li>';
384
+                        $output .= '<li><b><i class="fa fa-plug"></i> '.$_lang["manage_plugins"].' ('.$pluginscounts.')</b></li>';
385 385
                         while ($row = $modx->getDatabase()->getRow($rs)) {
386
-                            $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=102&id=' . $row['id'] . '" id="plugins_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>';
386
+                            $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=102&id='.$row['id'].'" id="plugins_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>';
387 387
                         }
388 388
                     }
389 389
                 }
390 390
 
391 391
                 //modules
392 392
                 if ($modx->hasPermission('edit_module')) {
393
-                    $rs = $modx->getDatabase()->select("id,name,locked,disabled", $modx->getDatabase()->getFullTableName('site_modules'), "`id` like '%" . $searchfields . "%' 
394
-                    OR `name` like '%" . $searchfields . "%' 
395
-                    OR `description` like '%" . $searchfields . "%' 
396
-                    OR `modulecode` like '%" . $searchfields . "%'  
397
-                    OR `properties` like '%" . $searchfields . "%'  
398
-                    OR `guid` like '%" . $searchfields . "%'      
399
-                    OR `resourcefile` like '%" . $searchfields . "%'");
393
+                    $rs = $modx->getDatabase()->select("id,name,locked,disabled", $modx->getDatabase()->getFullTableName('site_modules'), "`id` like '%".$searchfields."%' 
394
+                    OR `name` like '%" . $searchfields."%' 
395
+                    OR `description` like '%" . $searchfields."%' 
396
+                    OR `modulecode` like '%" . $searchfields."%'  
397
+                    OR `properties` like '%" . $searchfields."%'  
398
+                    OR `guid` like '%" . $searchfields."%'      
399
+                    OR `resourcefile` like '%" . $searchfields."%'");
400 400
                     $modulescounts = $modx->getDatabase()->getRecordCount($rs);
401 401
                     if ($modulescounts > 0) {
402
-                        $output .= '<li><b><i class="fa fa-cogs"></i> ' . $_lang["modules"] . ' (' . $modulescounts . ')</b></li>';
402
+                        $output .= '<li><b><i class="fa fa-cogs"></i> '.$_lang["modules"].' ('.$modulescounts.')</b></li>';
403 403
                         while ($row = $modx->getDatabase()->getRow($rs)) {
404
-                            $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=108&id=' . $row['id'] . '" id="modules_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>';
404
+                            $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=108&id='.$row['id'].'" id="modules_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>';
405 405
                         }
406 406
                     }
407 407
                 }
408 408
 
409
-                echo $output ? '<div class="ajaxSearchResults"><ul>' . $output . '</ul></div>' : '1';
409
+                echo $output ? '<div class="ajaxSearchResults"><ul>'.$output.'</ul></div>' : '1';
410 410
             }
411 411
 
412 412
             ?>
Please login to merge, or discard this patch.
manager/actions/user_management.static.php 2 patches
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3
-	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
3
+    die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 if(!$modx->hasPermission('edit_user')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 // initialize page view state - the $_PAGE object
@@ -11,12 +11,12 @@  discard block
 block discarded – undo
11 11
 
12 12
 // get and save search string
13 13
 if($_REQUEST['op'] == 'reset') {
14
-	$query = '';
15
-	$_PAGE['vs']['search'] = '';
14
+    $query = '';
15
+    $_PAGE['vs']['search'] = '';
16 16
 } else {
17
-	$query = isset($_REQUEST['search']) ? $_REQUEST['search'] : $_PAGE['vs']['search'];
18
-	$sqlQuery = $modx->getDatabase()->escape($query);
19
-	$_PAGE['vs']['search'] = $query;
17
+    $query = isset($_REQUEST['search']) ? $_REQUEST['search'] : $_PAGE['vs']['search'];
18
+    $sqlQuery = $modx->getDatabase()->escape($query);
19
+    $_PAGE['vs']['search'] = $query;
20 20
 }
21 21
 
22 22
 // get & save listmode
@@ -119,54 +119,54 @@  discard block
 block discarded – undo
119 119
 			<div class="row">
120 120
 				<div class="table-responsive">
121 121
 					<?php
122
-					$where = "";
123
-					if(!$modx->hasPermission('save_role')) {
124
-						$where .= (empty($where) ? "" : " AND ") . "mua.role != 1";
125
-					}
126
-					if(!empty($sqlQuery)) {
127
-						$where .= (empty($where) ? "" : " AND ") . "((mu.username LIKE '{$sqlQuery}%') OR (mua.fullname LIKE '%{$sqlQuery}%') OR (mua.email LIKE '{$sqlQuery}%'))";
128
-					}
129
-					$ds = $modx->getDatabase()->select("mu.id, mu.username, rname.name AS role, mua.fullname, mua.email, IF(mua.blocked,'{$_lang['yes']}','-') as blocked, mua.thislogin, mua.logincount", $modx->getDatabase()->getFullTableName('manager_users') . " AS mu 
122
+                    $where = "";
123
+                    if(!$modx->hasPermission('save_role')) {
124
+                        $where .= (empty($where) ? "" : " AND ") . "mua.role != 1";
125
+                    }
126
+                    if(!empty($sqlQuery)) {
127
+                        $where .= (empty($where) ? "" : " AND ") . "((mu.username LIKE '{$sqlQuery}%') OR (mua.fullname LIKE '%{$sqlQuery}%') OR (mua.email LIKE '{$sqlQuery}%'))";
128
+                    }
129
+                    $ds = $modx->getDatabase()->select("mu.id, mu.username, rname.name AS role, mua.fullname, mua.email, IF(mua.blocked,'{$_lang['yes']}','-') as blocked, mua.thislogin, mua.logincount", $modx->getDatabase()->getFullTableName('manager_users') . " AS mu 
130 130
 			INNER JOIN " . $modx->getDatabase()->getFullTableName('user_attributes') . " AS mua ON mua.internalKey=mu.id 
131 131
 			LEFT JOIN " . $modx->getDatabase()->getFullTableName('user_roles') . " AS rname ON mua.role=rname.id", $where, 'mua.blocked ASC, mua.thislogin DESC');
132
-					$grd = new \EvolutionCMS\Support\DataGrid('', $ds, $modx->config['number_of_results']); // set page size to 0 t show all items
133
-					$grd->noRecordMsg = $_lang["no_records_found"];
134
-					$grd->cssClass = "table data";
135
-					$grd->columnHeaderClass = "tableHeader";
136
-					$grd->itemClass = "tableItem";
137
-					$grd->altItemClass = "tableAltItem";
138
-					$grd->fields = "id,username,fullname,role,email,thislogin,logincount,blocked";
139
-					$grd->columns = implode(',', array(
140
-						$_lang["icon"],
141
-						$_lang["name"],
142
-						$_lang["user_full_name"],
143
-						$_lang['role'],
144
-						$_lang["email"],
145
-						$_lang["user_prevlogin"],
146
-						$_lang["user_logincount"],
147
-						$_lang["user_block"]
148
-					));
149
-					$grd->colWidths = "1%,,,,,1%,1%,1%";
150
-					$grd->colAligns = "center,,,,,right' nowrap='nowrap,right,center";
151
-					$grd->colTypes = implode('||', array(
152
-						'template:<a class="gridRowIcon" href="javascript:;" onclick="return showContentMenu([+id+],event);" title="' . $_lang['click_to_context'] . '"><i class="' . $_style['icons_user'] . '"></i></a>',
153
-						'template:<a href="index.php?a=12&id=[+id+]" title="' . $_lang['click_to_edit_title'] . '">[+value+]</a>',
154
-						'template:[+fullname+]',
155
-						'template:[+role+]',
156
-						'template:[+email+]',
157
-						'date: ' . $modx->toDateFormat('[+thislogin+]', 'formatOnly') . ' %H:%M',
158
-						'template:[+logincount+]',
159
-						'template:[+blocked+]'
160
-					));
161
-					if($listmode == '1') {
162
-						$grd->pageSize = 0;
163
-					}
164
-					if($_REQUEST['op'] == 'reset') {
165
-						$grd->pageNumber = 1;
166
-					}
167
-					// render grid
168
-					echo $grd->render();
169
-					?>
132
+                    $grd = new \EvolutionCMS\Support\DataGrid('', $ds, $modx->config['number_of_results']); // set page size to 0 t show all items
133
+                    $grd->noRecordMsg = $_lang["no_records_found"];
134
+                    $grd->cssClass = "table data";
135
+                    $grd->columnHeaderClass = "tableHeader";
136
+                    $grd->itemClass = "tableItem";
137
+                    $grd->altItemClass = "tableAltItem";
138
+                    $grd->fields = "id,username,fullname,role,email,thislogin,logincount,blocked";
139
+                    $grd->columns = implode(',', array(
140
+                        $_lang["icon"],
141
+                        $_lang["name"],
142
+                        $_lang["user_full_name"],
143
+                        $_lang['role'],
144
+                        $_lang["email"],
145
+                        $_lang["user_prevlogin"],
146
+                        $_lang["user_logincount"],
147
+                        $_lang["user_block"]
148
+                    ));
149
+                    $grd->colWidths = "1%,,,,,1%,1%,1%";
150
+                    $grd->colAligns = "center,,,,,right' nowrap='nowrap,right,center";
151
+                    $grd->colTypes = implode('||', array(
152
+                        'template:<a class="gridRowIcon" href="javascript:;" onclick="return showContentMenu([+id+],event);" title="' . $_lang['click_to_context'] . '"><i class="' . $_style['icons_user'] . '"></i></a>',
153
+                        'template:<a href="index.php?a=12&id=[+id+]" title="' . $_lang['click_to_edit_title'] . '">[+value+]</a>',
154
+                        'template:[+fullname+]',
155
+                        'template:[+role+]',
156
+                        'template:[+email+]',
157
+                        'date: ' . $modx->toDateFormat('[+thislogin+]', 'formatOnly') . ' %H:%M',
158
+                        'template:[+logincount+]',
159
+                        'template:[+blocked+]'
160
+                    ));
161
+                    if($listmode == '1') {
162
+                        $grd->pageSize = 0;
163
+                    }
164
+                    if($_REQUEST['op'] == 'reset') {
165
+                        $grd->pageNumber = 1;
166
+                    }
167
+                    // render grid
168
+                    echo $grd->render();
169
+                    ?>
170 170
 				</div>
171 171
 			</div>
172 172
 		</div>
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
 	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5
-if(!$modx->hasPermission('edit_user')) {
5
+if (!$modx->hasPermission('edit_user')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 $modx->getManagerApi()->initPageViewState();
11 11
 
12 12
 // get and save search string
13
-if($_REQUEST['op'] == 'reset') {
13
+if ($_REQUEST['op'] == 'reset') {
14 14
 	$query = '';
15 15
 	$_PAGE['vs']['search'] = '';
16 16
 } else {
@@ -120,15 +120,15 @@  discard block
 block discarded – undo
120 120
 				<div class="table-responsive">
121 121
 					<?php
122 122
 					$where = "";
123
-					if(!$modx->hasPermission('save_role')) {
124
-						$where .= (empty($where) ? "" : " AND ") . "mua.role != 1";
123
+					if (!$modx->hasPermission('save_role')) {
124
+						$where .= (empty($where) ? "" : " AND ")."mua.role != 1";
125 125
 					}
126
-					if(!empty($sqlQuery)) {
127
-						$where .= (empty($where) ? "" : " AND ") . "((mu.username LIKE '{$sqlQuery}%') OR (mua.fullname LIKE '%{$sqlQuery}%') OR (mua.email LIKE '{$sqlQuery}%'))";
126
+					if (!empty($sqlQuery)) {
127
+						$where .= (empty($where) ? "" : " AND ")."((mu.username LIKE '{$sqlQuery}%') OR (mua.fullname LIKE '%{$sqlQuery}%') OR (mua.email LIKE '{$sqlQuery}%'))";
128 128
 					}
129
-					$ds = $modx->getDatabase()->select("mu.id, mu.username, rname.name AS role, mua.fullname, mua.email, IF(mua.blocked,'{$_lang['yes']}','-') as blocked, mua.thislogin, mua.logincount", $modx->getDatabase()->getFullTableName('manager_users') . " AS mu 
130
-			INNER JOIN " . $modx->getDatabase()->getFullTableName('user_attributes') . " AS mua ON mua.internalKey=mu.id 
131
-			LEFT JOIN " . $modx->getDatabase()->getFullTableName('user_roles') . " AS rname ON mua.role=rname.id", $where, 'mua.blocked ASC, mua.thislogin DESC');
129
+					$ds = $modx->getDatabase()->select("mu.id, mu.username, rname.name AS role, mua.fullname, mua.email, IF(mua.blocked,'{$_lang['yes']}','-') as blocked, mua.thislogin, mua.logincount", $modx->getDatabase()->getFullTableName('manager_users')." AS mu 
130
+			INNER JOIN " . $modx->getDatabase()->getFullTableName('user_attributes')." AS mua ON mua.internalKey=mu.id 
131
+			LEFT JOIN " . $modx->getDatabase()->getFullTableName('user_roles')." AS rname ON mua.role=rname.id", $where, 'mua.blocked ASC, mua.thislogin DESC');
132 132
 					$grd = new \EvolutionCMS\Support\DataGrid('', $ds, $modx->config['number_of_results']); // set page size to 0 t show all items
133 133
 					$grd->noRecordMsg = $_lang["no_records_found"];
134 134
 					$grd->cssClass = "table data";
@@ -149,19 +149,19 @@  discard block
 block discarded – undo
149 149
 					$grd->colWidths = "1%,,,,,1%,1%,1%";
150 150
 					$grd->colAligns = "center,,,,,right' nowrap='nowrap,right,center";
151 151
 					$grd->colTypes = implode('||', array(
152
-						'template:<a class="gridRowIcon" href="javascript:;" onclick="return showContentMenu([+id+],event);" title="' . $_lang['click_to_context'] . '"><i class="' . $_style['icons_user'] . '"></i></a>',
153
-						'template:<a href="index.php?a=12&id=[+id+]" title="' . $_lang['click_to_edit_title'] . '">[+value+]</a>',
152
+						'template:<a class="gridRowIcon" href="javascript:;" onclick="return showContentMenu([+id+],event);" title="'.$_lang['click_to_context'].'"><i class="'.$_style['icons_user'].'"></i></a>',
153
+						'template:<a href="index.php?a=12&id=[+id+]" title="'.$_lang['click_to_edit_title'].'">[+value+]</a>',
154 154
 						'template:[+fullname+]',
155 155
 						'template:[+role+]',
156 156
 						'template:[+email+]',
157
-						'date: ' . $modx->toDateFormat('[+thislogin+]', 'formatOnly') . ' %H:%M',
157
+						'date: '.$modx->toDateFormat('[+thislogin+]', 'formatOnly').' %H:%M',
158 158
 						'template:[+logincount+]',
159 159
 						'template:[+blocked+]'
160 160
 					));
161
-					if($listmode == '1') {
161
+					if ($listmode == '1') {
162 162
 						$grd->pageSize = 0;
163 163
 					}
164
-					if($_REQUEST['op'] == 'reset') {
164
+					if ($_REQUEST['op'] == 'reset') {
165 165
 						$grd->pageNumber = 1;
166 166
 					}
167 167
 					// render grid
Please login to merge, or discard this patch.
manager/actions/logging.static.php 2 patches
Spacing   +27 added lines, -27 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('logs')) {
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
                             $logs_user = record_sort(array_unique_multi($logs, 'internalKey'), 'username');
29 29
                             foreach ($logs_user as $row) {
30 30
                                 $selectedtext = $row['internalKey'] == $_REQUEST['searchuser'] ? ' selected="selected"' : '';
31
-                                echo "\t\t" . '<option value="' . $row['internalKey'] . '"' . $selectedtext . '>' . $row['username'] . "</option>\n";
31
+                                echo "\t\t".'<option value="'.$row['internalKey'].'"'.$selectedtext.'>'.$row['username']."</option>\n";
32 32
                             }
33 33
                             ?>
34 34
                         </select>
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
                                     continue;
50 50
                                 }
51 51
                                 $selectedtext = $row['action'] == $_REQUEST['action'] ? ' selected="selected"' : '';
52
-                                echo "\t\t" . '<option value="' . $row['action'] . '"' . $selectedtext . '>' . $row['action'] . ' - ' . $action . "</option>\n";
52
+                                echo "\t\t".'<option value="'.$row['action'].'"'.$selectedtext.'>'.$row['action'].' - '.$action."</option>\n";
53 53
                             }
54 54
                             ?>
55 55
                         </select>
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
                             $logs_items = record_sort(array_unique_multi($logs, 'itemid'), 'itemid');
66 66
                             foreach ($logs_items as $row) {
67 67
                                 $selectedtext = $row['itemid'] == $_REQUEST['itemid'] ? ' selected="selected"' : '';
68
-                                echo "\t\t" . '<option value="' . $row['itemid'] . '"' . $selectedtext . '>' . $row['itemid'] . "</option>\n";
68
+                                echo "\t\t".'<option value="'.$row['itemid'].'"'.$selectedtext.'>'.$row['itemid']."</option>\n";
69 69
                             }
70 70
                             ?>
71 71
                         </select>
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
                             $logs_names = record_sort(array_unique_multi($logs, 'itemname'), 'itemname');
82 82
                             foreach ($logs_names as $row) {
83 83
                                 $selectedtext = $row['itemname'] == $_REQUEST['itemname'] ? ' selected="selected"' : '';
84
-                                echo "\t\t" . '<option value="' . $row['itemname'] . '"' . $selectedtext . '>' . $row['itemname'] . "</option>\n";
84
+                                echo "\t\t".'<option value="'.$row['itemname'].'"'.$selectedtext.'>'.$row['itemname']."</option>\n";
85 85
                             }
86 86
                             ?>
87 87
                         </select>
@@ -139,26 +139,26 @@  discard block
 block discarded – undo
139 139
     // get the selections the user made.
140 140
     $sqladd = array();
141 141
     if ($_REQUEST['searchuser'] != 0) {
142
-        $sqladd[] = "internalKey='" . (int)$_REQUEST['searchuser'] . "'";
142
+        $sqladd[] = "internalKey='".(int) $_REQUEST['searchuser']."'";
143 143
     }
144 144
     if ($_REQUEST['action'] != 0) {
145
-        $sqladd[] = "action=" . (int)$_REQUEST['action'];
145
+        $sqladd[] = "action=".(int) $_REQUEST['action'];
146 146
     }
147 147
     if ($_REQUEST['itemid'] != 0 || $_REQUEST['itemid'] == "-") {
148
-        $sqladd[] = "itemid='" . $_REQUEST['itemid'] . "'";
148
+        $sqladd[] = "itemid='".$_REQUEST['itemid']."'";
149 149
     }
150 150
     if ($_REQUEST['itemname'] != '0') {
151
-        $sqladd[] = "itemname='" . $modx->getDatabase()->escape($_REQUEST['itemname']) . "'";
151
+        $sqladd[] = "itemname='".$modx->getDatabase()->escape($_REQUEST['itemname'])."'";
152 152
     }
153 153
     if ($_REQUEST['message'] != "") {
154
-        $sqladd[] = "message LIKE '%" . $modx->getDatabase()->escape($_REQUEST['message']) . "%'";
154
+        $sqladd[] = "message LIKE '%".$modx->getDatabase()->escape($_REQUEST['message'])."%'";
155 155
     }
156 156
     // date stuff
157 157
     if ($_REQUEST['datefrom'] != "") {
158
-        $sqladd[] = "timestamp>" . $modx->toTimeStamp($_REQUEST['datefrom']);
158
+        $sqladd[] = "timestamp>".$modx->toTimeStamp($_REQUEST['datefrom']);
159 159
     }
160 160
     if ($_REQUEST['dateto'] != "") {
161
-        $sqladd[] = "timestamp<" . $modx->toTimeStamp($_REQUEST['dateto']);
161
+        $sqladd[] = "timestamp<".$modx->toTimeStamp($_REQUEST['dateto']);
162 162
     }
163 163
 
164 164
     // If current position is not set, set it to zero
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
     // Number of result to display on the page, will be in the LIMIT of the sql query also
172 172
     $int_num_result = is_numeric($_REQUEST['nrresults']) ? $_REQUEST['nrresults'] : $number_of_logs;
173 173
 
174
-    $extargv = "&a=13&searchuser=" . $_REQUEST['searchuser'] . "&action=" . $_REQUEST['action'] . "&itemid=" . $_REQUEST['itemid'] . "&itemname=" . $_REQUEST['itemname'] . "&message=" . $_REQUEST['message'] . "&dateto=" . $_REQUEST['dateto'] . "&datefrom=" . $_REQUEST['datefrom'] . "&nrresults=" . $int_num_result . "&log_submit=" . $_REQUEST['log_submit']; // extra argv here (could be anything depending on your page)
174
+    $extargv = "&a=13&searchuser=".$_REQUEST['searchuser']."&action=".$_REQUEST['action']."&itemid=".$_REQUEST['itemid']."&itemname=".$_REQUEST['itemname']."&message=".$_REQUEST['message']."&dateto=".$_REQUEST['dateto']."&datefrom=".$_REQUEST['datefrom']."&nrresults=".$int_num_result."&log_submit=".$_REQUEST['log_submit']; // extra argv here (could be anything depending on your page)
175 175
 
176 176
     // build the sql
177 177
     $limit = $num_rows = $modx->getDatabase()->getValue($modx->getDatabase()->select('COUNT(*)', $modx->getDatabase()->getFullTableName('manager_log'), (!empty($sqladd) ? implode(' AND ', $sqladd) : '')));
@@ -179,9 +179,9 @@  discard block
 block discarded – undo
179 179
     $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('manager_log'), (!empty($sqladd) ? implode(' AND ', $sqladd) : ''), 'timestamp DESC, id DESC', "{$int_cur_position}, {$int_num_result}");
180 180
 
181 181
 if ($limit < 1) {
182
-    echo '<p>' . $_lang["mgrlog_emptysrch"] . '</p>';
182
+    echo '<p>'.$_lang["mgrlog_emptysrch"].'</p>';
183 183
 } else {
184
-    echo '<p>' . $_lang["mgrlog_sortinst"] . '</p>';
184
+    echo '<p>'.$_lang["mgrlog_sortinst"].'</p>';
185 185
 
186 186
     // New instance of the Paging class, you can modify the color and the width of the html table
187 187
     $p = new EvolutionCMS\Support\Paginate($num_rows, $int_cur_position, $int_num_result, $extargv);
@@ -192,11 +192,11 @@  discard block
 block discarded – undo
192 192
     $current_row = $int_cur_position / $int_num_result;
193 193
 
194 194
     // Display the result as you like...
195
-    print "<p>" . $_lang["paging_showing"] . " " . $array_paging['lower'];
196
-    print " " . $_lang["paging_to"] . " " . $array_paging['upper'];
197
-    print " (" . $array_paging['total'] . " " . $_lang["paging_total"] . ")<br />";
198
-    $paging = $array_paging['first_link'] . $_lang["paging_first"] . (isset($array_paging['first_link']) ? "</a> " : " ");
199
-    $paging .= $array_paging['previous_link'] . $_lang["paging_prev"] . (isset($array_paging['previous_link']) ? "</a> " : " ");
195
+    print "<p>".$_lang["paging_showing"]." ".$array_paging['lower'];
196
+    print " ".$_lang["paging_to"]." ".$array_paging['upper'];
197
+    print " (".$array_paging['total']." ".$_lang["paging_total"].")<br />";
198
+    $paging = $array_paging['first_link'].$_lang["paging_first"].(isset($array_paging['first_link']) ? "</a> " : " ");
199
+    $paging .= $array_paging['previous_link'].$_lang["paging_prev"].(isset($array_paging['previous_link']) ? "</a> " : " ");
200 200
     $pagesfound = sizeof($array_row_paging);
201 201
     if ($pagesfound > 6) {
202 202
         $paging .= $array_row_paging[$current_row - 2]; // ."&nbsp;";
@@ -206,11 +206,11 @@  discard block
 block discarded – undo
206 206
         $paging .= $array_row_paging[$current_row + 2]; // ."&nbsp;";
207 207
     } else {
208 208
         for ($i = 0; $i < $pagesfound; $i++) {
209
-            $paging .= $array_row_paging[$i] . "&nbsp;";
209
+            $paging .= $array_row_paging[$i]."&nbsp;";
210 210
         }
211 211
     }
212
-    $paging .= $array_paging['next_link'] . $_lang["paging_next"] . (isset($array_paging['next_link']) ? "</a> " : " ") . " ";
213
-    $paging .= $array_paging['last_link'] . $_lang["paging_last"] . (isset($array_paging['last_link']) ? "</a> " : " ") . " ";
212
+    $paging .= $array_paging['next_link'].$_lang["paging_next"].(isset($array_paging['next_link']) ? "</a> " : " ")." ";
213
+    $paging .= $array_paging['last_link'].$_lang["paging_last"].(isset($array_paging['last_link']) ? "</a> " : " ")." ";
214 214
     // The above exemple print somethings like:
215 215
     // Results 1 to 20 of 597  <<< 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 >>>
216 216
     // Of course you can now play with array_row_paging in order to print
@@ -246,16 +246,16 @@  discard block
 block discarded – undo
246 246
                     if (!preg_match("/^[0-9]+$/", $logentry['itemid'])) {
247 247
                         $item = '<div style="text-align:center;">-</div>';
248 248
                     } elseif ($logentry['action'] == 3 || $logentry['action'] == 27 || $logentry['action'] == 5) {
249
-                        $item = '<a href="index.php?a=3&amp;id=' . $logentry['itemid'] . '">' . $logentry['itemname'] . '</a>';
249
+                        $item = '<a href="index.php?a=3&amp;id='.$logentry['itemid'].'">'.$logentry['itemname'].'</a>';
250 250
                     } else {
251 251
                         $item = $logentry['itemname'];
252 252
                     }
253 253
                     //index.php?a=13&searchuser=' . $logentry['internalKey'] . '&action=' . $logentry['action'] . '&itemname=' . $logentry['itemname'] . '&log_submit=true'
254
-                    $user_drill = 'index.php?a=13&searchuser=' . $logentry['internalKey'] . '&itemname=0&log_submit=true';
254
+                    $user_drill = 'index.php?a=13&searchuser='.$logentry['internalKey'].'&itemname=0&log_submit=true';
255 255
                     ?>
256 256
                     <tr>
257
-                        <td><?= '<a href="' . $user_drill . '">' . $logentry['username'] . '</a>' ?></td>
258
-                        <td class="text-nowrap"><?= '[' . $logentry['action'] . '] ' . $logentry['message'] ?></td>
257
+                        <td><?= '<a href="'.$user_drill.'">'.$logentry['username'].'</a>' ?></td>
258
+                        <td class="text-nowrap"><?= '['.$logentry['action'].'] '.$logentry['message'] ?></td>
259 259
                         <td class="text-xs-right"><?= $logentry['itemid'] ?></td>
260 260
                         <td><?= $item ?></td>
261 261
                         <td class="text-nowrap"><?= $modx->toDateFormat($logentry['timestamp'] + $server_offset_time) ?></td>
Please login to merge, or discard this patch.
Braces   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5
-if (!$modx->hasPermission('logs')) {
5
+if (!$modx->hasPermission('logs')) {
6 6
     $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
                             <?php
27 27
                             // get all users currently in the log
28 28
                             $logs_user = record_sort(array_unique_multi($logs, 'internalKey'), 'username');
29
-                            foreach ($logs_user as $row) {
29
+                            foreach ($logs_user as $row) {
30 30
                                 $selectedtext = $row['internalKey'] == $_REQUEST['searchuser'] ? ' selected="selected"' : '';
31 31
                                 echo "\t\t" . '<option value="' . $row['internalKey'] . '"' . $selectedtext . '>' . $row['username'] . "</option>\n";
32 32
                             }
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
                             // get all available actions in the log
44 44
                             include_once "actionlist.inc.php";
45 45
                             $logs_actions = record_sort(array_unique_multi($logs, 'action'), 'action');
46
-                            foreach ($logs_actions as $row) {
46
+                            foreach ($logs_actions as $row) {
47 47
                                 $action = getAction($row['action']);
48
-                                if ($action == 'Idle') {
48
+                                if ($action == 'Idle') {
49 49
                                     continue;
50 50
                                 }
51 51
                                 $selectedtext = $row['action'] == $_REQUEST['action'] ? ' selected="selected"' : '';
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
                             <?php
64 64
                             // get all itemid currently in logging
65 65
                             $logs_items = record_sort(array_unique_multi($logs, 'itemid'), 'itemid');
66
-                            foreach ($logs_items as $row) {
66
+                            foreach ($logs_items as $row) {
67 67
                                 $selectedtext = $row['itemid'] == $_REQUEST['itemid'] ? ' selected="selected"' : '';
68 68
                                 echo "\t\t" . '<option value="' . $row['itemid'] . '"' . $selectedtext . '>' . $row['itemid'] . "</option>\n";
69 69
                             }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
                             <?php
80 80
                             // get all itemname currently in logging
81 81
                             $logs_names = record_sort(array_unique_multi($logs, 'itemname'), 'itemname');
82
-                            foreach ($logs_names as $row) {
82
+                            foreach ($logs_names as $row) {
83 83
                                 $selectedtext = $row['itemname'] == $_REQUEST['itemname'] ? ' selected="selected"' : '';
84 84
                                 echo "\t\t" . '<option value="' . $row['itemname'] . '"' . $selectedtext . '>' . $row['itemname'] . "</option>\n";
85 85
                             }
@@ -135,36 +135,36 @@  discard block
 block discarded – undo
135 135
     <div class="container container-body">
136 136
 
137 137
 <?php
138
-if (isset($_REQUEST['log_submit'])) {
138
+if (isset($_REQUEST['log_submit'])) {
139 139
     // get the selections the user made.
140 140
     $sqladd = array();
141
-    if ($_REQUEST['searchuser'] != 0) {
141
+    if ($_REQUEST['searchuser'] != 0) {
142 142
         $sqladd[] = "internalKey='" . (int)$_REQUEST['searchuser'] . "'";
143 143
     }
144
-    if ($_REQUEST['action'] != 0) {
144
+    if ($_REQUEST['action'] != 0) {
145 145
         $sqladd[] = "action=" . (int)$_REQUEST['action'];
146 146
     }
147
-    if ($_REQUEST['itemid'] != 0 || $_REQUEST['itemid'] == "-") {
147
+    if ($_REQUEST['itemid'] != 0 || $_REQUEST['itemid'] == "-") {
148 148
         $sqladd[] = "itemid='" . $_REQUEST['itemid'] . "'";
149 149
     }
150
-    if ($_REQUEST['itemname'] != '0') {
150
+    if ($_REQUEST['itemname'] != '0') {
151 151
         $sqladd[] = "itemname='" . $modx->getDatabase()->escape($_REQUEST['itemname']) . "'";
152 152
     }
153
-    if ($_REQUEST['message'] != "") {
153
+    if ($_REQUEST['message'] != "") {
154 154
         $sqladd[] = "message LIKE '%" . $modx->getDatabase()->escape($_REQUEST['message']) . "%'";
155 155
     }
156 156
     // date stuff
157
-    if ($_REQUEST['datefrom'] != "") {
157
+    if ($_REQUEST['datefrom'] != "") {
158 158
         $sqladd[] = "timestamp>" . $modx->toTimeStamp($_REQUEST['datefrom']);
159 159
     }
160
-    if ($_REQUEST['dateto'] != "") {
160
+    if ($_REQUEST['dateto'] != "") {
161 161
         $sqladd[] = "timestamp<" . $modx->toTimeStamp($_REQUEST['dateto']);
162 162
     }
163 163
 
164 164
     // If current position is not set, set it to zero
165
-    if (!isset($_REQUEST['int_cur_position']) || $_REQUEST['int_cur_position'] == 0) {
165
+    if (!isset($_REQUEST['int_cur_position']) || $_REQUEST['int_cur_position'] == 0) {
166 166
         $int_cur_position = 0;
167
-    } else {
167
+    } else {
168 168
         $int_cur_position = $_REQUEST['int_cur_position'];
169 169
     }
170 170
 
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
 
179 179
     $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('manager_log'), (!empty($sqladd) ? implode(' AND ', $sqladd) : ''), 'timestamp DESC, id DESC', "{$int_cur_position}, {$int_num_result}");
180 180
 
181
-if ($limit < 1) {
181
+if ($limit < 1) {
182 182
     echo '<p>' . $_lang["mgrlog_emptysrch"] . '</p>';
183
-} else {
183
+} else {
184 184
     echo '<p>' . $_lang["mgrlog_sortinst"] . '</p>';
185 185
 
186 186
     // New instance of the Paging class, you can modify the color and the width of the html table
@@ -198,14 +198,14 @@  discard block
 block discarded – undo
198 198
     $paging = $array_paging['first_link'] . $_lang["paging_first"] . (isset($array_paging['first_link']) ? "</a> " : " ");
199 199
     $paging .= $array_paging['previous_link'] . $_lang["paging_prev"] . (isset($array_paging['previous_link']) ? "</a> " : " ");
200 200
     $pagesfound = sizeof($array_row_paging);
201
-    if ($pagesfound > 6) {
201
+    if ($pagesfound > 6) {
202 202
         $paging .= $array_row_paging[$current_row - 2]; // ."&nbsp;";
203 203
         $paging .= $array_row_paging[$current_row - 1]; // ."&nbsp;";
204 204
         $paging .= $array_row_paging[$current_row]; // ."&nbsp;";
205 205
         $paging .= $array_row_paging[$current_row + 1]; // ."&nbsp;";
206 206
         $paging .= $array_row_paging[$current_row + 2]; // ."&nbsp;";
207
-    } else {
208
-        for ($i = 0; $i < $pagesfound; $i++) {
207
+    } else {
208
+        for ($i = 0; $i < $pagesfound; $i++) {
209 209
             $paging .= $array_row_paging[$i] . "&nbsp;";
210 210
         }
211 211
     }
@@ -242,12 +242,12 @@  discard block
 block discarded – undo
242 242
                 // grab the entire log file...
243 243
                 $logentries = array();
244 244
                 $i = 0;
245
-                while ($logentry = $modx->getDatabase()->getRow($rs)) {
246
-                    if (!preg_match("/^[0-9]+$/", $logentry['itemid'])) {
245
+                while ($logentry = $modx->getDatabase()->getRow($rs)) {
246
+                    if (!preg_match("/^[0-9]+$/", $logentry['itemid'])) {
247 247
                         $item = '<div style="text-align:center;">-</div>';
248
-                    } elseif ($logentry['action'] == 3 || $logentry['action'] == 27 || $logentry['action'] == 5) {
248
+                    } elseif ($logentry['action'] == 3 || $logentry['action'] == 27 || $logentry['action'] == 5) {
249 249
                         $item = '<a href="index.php?a=3&amp;id=' . $logentry['itemid'] . '">' . $logentry['itemname'] . '</a>';
250
-                    } else {
250
+                    } else {
251 251
                         $item = $logentry['itemname'];
252 252
                     }
253 253
                     //index.php?a=13&searchuser=' . $logentry['internalKey'] . '&action=' . $logentry['action'] . '&itemname=' . $logentry['itemname'] . '&log_submit=true'
@@ -284,6 +284,6 @@  discard block
 block discarded – undo
284 284
     // @see index.php @ 915
285 285
     global $action;
286 286
     $action = 1;
287
-} else {
287
+} else {
288 288
     echo $_lang["mgrlog_noquery"];
289 289
 }
Please login to merge, or discard this patch.
manager/actions/mutate_plugin_priority.dynamic.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 if (!$modx->hasPermission('save_plugin')) {
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 $updateMsg = '';
12 12
 
13 13
 if (isset($_POST['listSubmitted'])) {
14
-    $updateMsg .= '<span class="text-success" id="updated">' . $_lang['sort_updated'] . '</span>';
14
+    $updateMsg .= '<span class="text-success" id="updated">'.$_lang['sort_updated'].'</span>';
15 15
     $tbl = $modx->getDatabase()->getFullTableName('site_plugin_events');
16 16
 
17 17
     foreach ($_POST as $listName => $listValue) {
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
     $modx->clearCache('full');
35 35
 }
36 36
 
37
-$rs = $modx->getDatabase()->select("sysevt.name as evtname, sysevt.id as evtid, pe.pluginid, plugs.name, pe.priority, plugs.disabled", $modx->getDatabase()->getFullTableName('system_eventnames') . " sysevt
38
-		INNER JOIN " . $modx->getDatabase()->getFullTableName('site_plugin_events') . " pe ON pe.evtid = sysevt.id
39
-		INNER JOIN " . $modx->getDatabase()->getFullTableName('site_plugins') . " plugs ON plugs.id = pe.pluginid", '', 'sysevt.name,pe.priority');
37
+$rs = $modx->getDatabase()->select("sysevt.name as evtname, sysevt.id as evtid, pe.pluginid, plugs.name, pe.priority, plugs.disabled", $modx->getDatabase()->getFullTableName('system_eventnames')." sysevt
38
+		INNER JOIN " . $modx->getDatabase()->getFullTableName('site_plugin_events')." pe ON pe.evtid = sysevt.id
39
+		INNER JOIN " . $modx->getDatabase()->getFullTableName('site_plugins')." plugs ON plugs.id = pe.pluginid", '', 'sysevt.name,pe.priority');
40 40
 
41 41
 $insideUl = 0;
42 42
 $preEvt = '';
@@ -47,17 +47,17 @@  discard block
 block discarded – undo
47 47
     if ($preEvt !== $plugins['evtid']) {
48 48
         $sortables[] = $plugins['evtid'];
49 49
         $sortableList .= $insideUl ? '</ul></div>' : '';
50
-        $sortableList .= '<div class="form-group clearfix"><strong>' . $plugins['evtname'] . '</strong><ul id="' . $plugins['evtid'] . '" class="sortableList">';
50
+        $sortableList .= '<div class="form-group clearfix"><strong>'.$plugins['evtname'].'</strong><ul id="'.$plugins['evtid'].'" class="sortableList">';
51 51
         $insideUl = 1;
52 52
     }
53
-    $sortableList .= '<li id="item_' . $plugins['pluginid'] . '"' . ($plugins['disabled'] ? ' class="disabledPlugin"' : '') . '><i class="fa fa-plug"></i> ' . $plugins['name'] . ($plugins['disabled'] ? ' (hide)' : '') . '</li>';
53
+    $sortableList .= '<li id="item_'.$plugins['pluginid'].'"'.($plugins['disabled'] ? ' class="disabledPlugin"' : '').'><i class="fa fa-plug"></i> '.$plugins['name'].($plugins['disabled'] ? ' (hide)' : '').'</li>';
54 54
     $preEvt = $plugins['evtid'];
55 55
 }
56 56
 if ($insideUl) {
57 57
     $sortableList .= '</ul></div>';
58 58
 }
59 59
 
60
-require_once(MODX_MANAGER_PATH . 'includes/header.inc.php');
60
+require_once(MODX_MANAGER_PATH.'includes/header.inc.php');
61 61
 ?>
62 62
 
63 63
 <script type="text/javascript">
Please login to merge, or discard this patch.
manager/media/browser/mcpuk/core/uploader.php 2 patches
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 /** This file is part of KCFinder project
4
-  *
5
-  *      @desc Uploader class
6
-  *   @package KCFinder
7
-  *   @version 2.54
8
-  *    @author Pavel Tzonkov <[email protected]>
9
-  * @copyright 2010-2014 KCFinder Project
10
-  *   @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
11
-  *   @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
12
-  *      @link http://kcfinder.sunhater.com
13
-  */
4
+ *
5
+ *      @desc Uploader class
6
+ *   @package KCFinder
7
+ *   @version 2.54
8
+ *    @author Pavel Tzonkov <[email protected]>
9
+ * @copyright 2010-2014 KCFinder Project
10
+ *   @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
11
+ *   @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
12
+ *      @link http://kcfinder.sunhater.com
13
+ */
14 14
 
15 15
 class uploader {
16 16
 
@@ -18,92 +18,92 @@  discard block
 block discarded – undo
18 18
     const VERSION = "2.54";
19 19
 
20 20
 /** Config session-overrided settings
21
-  * @var array */
21
+ * @var array */
22 22
     protected $config = array();
23 23
 
24 24
 /** Default image driver
25
-  * @var string */
25
+ * @var string */
26 26
     protected $imageDriver = "gd";
27 27
 
28 28
 /** Opener applocation properties
29
-  *   $opener['name']                 Got from $_GET['opener'];
30
-  *   $opener['CKEditor']['funcNum']  CKEditor function number (got from $_GET)
31
-  *   $opener['TinyMCE']              Boolean
32
-  * @var array */
29
+ *   $opener['name']                 Got from $_GET['opener'];
30
+ *   $opener['CKEditor']['funcNum']  CKEditor function number (got from $_GET)
31
+ *   $opener['TinyMCE']              Boolean
32
+ * @var array */
33 33
     protected $opener = array();
34 34
 
35 35
 /** Got from $_GET['type'] or first one $config['types'] array key, if inexistant
36
-  * @var string */
36
+ * @var string */
37 37
     protected $type;
38 38
 
39 39
 /** Helper property. Local filesystem path to the Type Directory
40
-  * Equivalent: $config['uploadDir'] . "/" . $type
41
-  * @var string */
40
+ * Equivalent: $config['uploadDir'] . "/" . $type
41
+ * @var string */
42 42
     protected $typeDir;
43 43
 
44 44
 /** Helper property. Web URL to the Type Directory
45
-  * Equivalent: $config['uploadURL'] . "/" . $type
46
-  * @var string */
45
+ * Equivalent: $config['uploadURL'] . "/" . $type
46
+ * @var string */
47 47
     protected $typeURL;
48 48
 
49 49
 /** Linked to $config['types']
50
-  * @var array */
50
+ * @var array */
51 51
     protected $types = array();
52 52
 
53 53
 /** Settings which can override default settings if exists as keys in $config['types'][$type] array
54
-  * @var array */
54
+ * @var array */
55 55
     protected $typeSettings = array('disabled', 'theme', 'dirPerms', 'filePerms', 'denyZipDownload', 'maxImageWidth', 'maxImageHeight', 'thumbWidth', 'thumbHeight', 'jpegQuality', 'access', 'filenameChangeChars', 'dirnameChangeChars', 'denyExtensionRename', 'deniedExts', 'watermark');
56 56
 
57 57
 /** Got from language file
58
-  * @var string */
58
+ * @var string */
59 59
     protected $charset;
60 60
 
61 61
 /** The language got from $_GET['lng'] or $_GET['lang'] or... Please see next property
62
-  * @var string */
62
+ * @var string */
63 63
     protected $lang = 'en';
64 64
 
65 65
 /** Possible language $_GET keys
66
-  * @var array */
66
+ * @var array */
67 67
     protected $langInputNames = array('lang', 'langCode', 'lng', 'language', 'lang_code');
68 68
 
69 69
 /** Uploaded file(s) info. Linked to first $_FILES element
70
-  * @var array */
70
+ * @var array */
71 71
     protected $file;
72 72
 
73 73
 /** Next three properties are got from the current language file
74
-  * @var string */
74
+ * @var string */
75 75
     protected $dateTimeFull;   // Currently not used
76 76
     protected $dateTimeMid;    // Currently not used
77 77
     protected $dateTimeSmall;
78 78
 
79 79
 /** Contain Specified language labels
80
-  * @var array */
80
+ * @var array */
81 81
     protected $labels = array();
82 82
 
83 83
 /** Contain unprocessed $_GET array. Please use this instead of $_GET
84
-  * @var array */
84
+ * @var array */
85 85
     protected $get;
86 86
 
87 87
 /** Contain unprocessed $_POST array. Please use this instead of $_POST
88
-  * @var array */
88
+ * @var array */
89 89
     protected $post;
90 90
 
91 91
 /** Contain unprocessed $_COOKIE array. Please use this instead of $_COOKIE
92
-  * @var array */
92
+ * @var array */
93 93
     protected $cookie;
94 94
 
95 95
 /** Session array. Please use this property instead of $_SESSION
96
-  * @var array */
96
+ * @var array */
97 97
     protected $session;
98 98
 
99 99
 /** CMS integration attribute (got from $_GET['cms'])
100
-  * @var string */
100
+ * @var string */
101 101
     protected $cms = "";
102 102
 
103 103
     protected $modx = null;
104 104
 /** Magic method which allows read-only access to protected or private class properties
105
-  * @param string $property
106
-  * @return mixed */
105
+     * @param string $property
106
+     * @return mixed */
107 107
     public function __get($property) {
108 108
         return property_exists($this, $property) ? $this->$property : null;
109 109
     }
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
         )
133 133
             $this->cms = $this->get['cms'];
134 134
 
135
-		// LINKING UPLOADED FILE
135
+        // LINKING UPLOADED FILE
136 136
         if (count($_FILES))
137 137
             $this->file = &$_FILES[key($_FILES)];
138 138
 
@@ -228,8 +228,8 @@  discard block
 block discarded – undo
228 228
             $this->config['uploadDir'] = strlen($this->config['uploadDir'])
229 229
                 ? path::normalize($this->config['uploadDir'])
230 230
                 : path::url2fullPath("/$path");
231
-         $this->typeDir = "{$this->config['uploadDir']}/{$this->type}";
232
-         $this->typeURL = "{$this->config['siteURL']}/{$this->config['uploadURL']}/{$this->type}";
231
+            $this->typeDir = "{$this->config['uploadDir']}/{$this->type}";
232
+            $this->typeURL = "{$this->config['siteURL']}/{$this->config['uploadURL']}/{$this->type}";
233 233
 
234 234
         // SITE ROOT
235 235
         } elseif ($this->config['uploadURL'] == "/") {
@@ -365,36 +365,36 @@  discard block
 block discarded – undo
365 365
     }
366 366
 
367 367
 
368
-	protected function getTransaliasSettings() {
369
-		$modx = evolutionCMS();
370
-
371
-		// Cleaning uploaded filename?
372
-		$setting = $modx->getDatabase()->select('count(*)', $modx->getDatabase()->getFullTableName('system_settings'), 'setting_name="clean_uploaded_filename" AND setting_value=1');
373
-		if ($modx->getDatabase()->getValue($setting)>0) {
374
-			// Transalias plugin active?
375
-			$res = $modx->getDatabase()->select('properties', $modx->getDatabase()->getFullTableName('site_plugins'), 'name="TransAlias" AND disabled=0');
376
-			if ($properties = $modx->getDatabase()->getValue($res)) {
377
-				$properties = $modx->parseProperties($properties, 'TransAlias', 'plugin');
378
-			} else {
379
-				$properties = NULL;
380
-			}
381
-		} else {
382
-			$properties = NULL;
383
-		}
384
-		return $properties;
385
-	}
386
-
387
-
388
-	protected function normalizeFilename($filename) {
389
-		if ($this->getTransaliasSettings()) {
390
-        		$format = strrchr($filename, ".");
391
-        		$filename = str_replace($format, "", $filename);
392
-            		$filename = $this->modx->stripAlias($filename).$format;
393
-        	}
394
-        	return $filename;
395
-	}
396
-
397
-	protected function normalizeDirname($dirname) {
368
+    protected function getTransaliasSettings() {
369
+        $modx = evolutionCMS();
370
+
371
+        // Cleaning uploaded filename?
372
+        $setting = $modx->getDatabase()->select('count(*)', $modx->getDatabase()->getFullTableName('system_settings'), 'setting_name="clean_uploaded_filename" AND setting_value=1');
373
+        if ($modx->getDatabase()->getValue($setting)>0) {
374
+            // Transalias plugin active?
375
+            $res = $modx->getDatabase()->select('properties', $modx->getDatabase()->getFullTableName('site_plugins'), 'name="TransAlias" AND disabled=0');
376
+            if ($properties = $modx->getDatabase()->getValue($res)) {
377
+                $properties = $modx->parseProperties($properties, 'TransAlias', 'plugin');
378
+            } else {
379
+                $properties = NULL;
380
+            }
381
+        } else {
382
+            $properties = NULL;
383
+        }
384
+        return $properties;
385
+    }
386
+
387
+
388
+    protected function normalizeFilename($filename) {
389
+        if ($this->getTransaliasSettings()) {
390
+                $format = strrchr($filename, ".");
391
+                $filename = str_replace($format, "", $filename);
392
+                    $filename = $this->modx->stripAlias($filename).$format;
393
+            }
394
+            return $filename;
395
+    }
396
+
397
+    protected function normalizeDirname($dirname) {
398 398
         return $this->modx->stripAlias($dirname);
399 399
     }
400 400
 
@@ -472,10 +472,10 @@  discard block
 block discarded – undo
472 472
             return $this->label("The image is too big and/or cannot be resized.");
473 473
 
474 474
 
475
-	// CHECK FOR MODX MAX FILE SIZE
476
-	$actualfilesize=filesize($file['tmp_name']);
477
-	if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize'])
478
-	    return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)");
475
+    // CHECK FOR MODX MAX FILE SIZE
476
+    $actualfilesize=filesize($file['tmp_name']);
477
+    if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize'])
478
+        return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)");
479 479
 
480 480
         return true;
481 481
     }
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
             $top = isset($this->config['watermark']['top'])
628 628
                 ? $this->config['watermark']['top'] : false;
629 629
             $img->watermark($this->config['watermark']['file'], $left, $top);
630
-		}
630
+        }
631 631
 
632 632
         $options = array( 'file' => $file );
633 633
 
Please login to merge, or discard this patch.
Spacing   +46 added lines, -47 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
   *      @link http://kcfinder.sunhater.com
13 13
   */
14 14
 
15
-class uploader {
15
+class uploader{
16 16
 
17 17
 /** Release version */
18 18
     const VERSION = "2.54";
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 
73 73
 /** Next three properties are got from the current language file
74 74
   * @var string */
75
-    protected $dateTimeFull;   // Currently not used
76
-    protected $dateTimeMid;    // Currently not used
75
+    protected $dateTimeFull; // Currently not used
76
+    protected $dateTimeMid; // Currently not used
77 77
     protected $dateTimeSmall;
78 78
 
79 79
 /** Contain Specified language labels
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
 /** Magic method which allows read-only access to protected or private class properties
105 105
   * @param string $property
106 106
   * @return mixed */
107
-    public function __get($property) {
107
+    public function __get($property){
108 108
         return property_exists($this, $property) ? $this->$property : null;
109 109
     }
110 110
 
111
-    public function __construct($modx) {
111
+    public function __construct($modx){
112 112
 
113 113
         //MODX
114 114
         try {
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 
207 207
         // COOKIES INIT
208 208
         $ip = '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)';
209
-        $ip = '/^' . implode('\.', array($ip, $ip, $ip, $ip)) . '$/';
209
+        $ip = '/^'.implode('\.', array($ip, $ip, $ip, $ip)).'$/';
210 210
         if (preg_match($ip, $_SERVER['HTTP_HOST']) ||
211 211
             preg_match('/^[^\.]+$/', $_SERVER['HTTP_HOST'])
212 212
         )
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
         ) {
225 225
             list($unused, $protocol, $domain, $unused, $port, $path) = $patt;
226 226
             $path = path::normalize($path);
227
-            $this->config['uploadURL'] = "$protocol://$domain" . (strlen($port) ? ":$port" : "") . "/$path";
227
+            $this->config['uploadURL'] = "$protocol://$domain".(strlen($port) ? ":$port" : "")."/$path";
228 228
             $this->config['uploadDir'] = strlen($this->config['uploadDir'])
229 229
                 ? path::normalize($this->config['uploadDir'])
230 230
                 : path::url2fullPath("/$path");
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
         foreach ($this->langInputNames as $key)
268 268
             if (isset($this->get[$key]) &&
269 269
                 preg_match('/^[a-z][a-z\._\-]*$/i', $this->get[$key]) &&
270
-                file_exists("lang/" . strtolower($this->get[$key]) . ".php")
270
+                file_exists("lang/".strtolower($this->get[$key]).".php")
271 271
             ) {
272 272
                 $this->lang = $this->get[$key];
273 273
                 break;
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
             $this->backMsg("Cannot read upload folder.");
299 299
     }
300 300
 
301
-    public function upload() {
301
+    public function upload(){
302 302
         $config = &$this->config;
303 303
         $file = &$this->file;
304 304
         $url = $message = "";
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
                     @mkdir(path::normalize($dir), $this->config['dirPerms'], true);
330 330
 
331 331
                 $filename = $this->normalizeFilename($file['name']);
332
-                $target = file::getInexistantFilename($dir . $filename);
332
+                $target = file::getInexistantFilename($dir.$filename);
333 333
 
334 334
                 if (!@move_uploaded_file($file['tmp_name'], $target) &&
335 335
                     !@rename($file['tmp_name'], $target) &&
@@ -342,11 +342,11 @@  discard block
 block discarded – undo
342 342
                     $this->makeThumb($target);
343 343
                     $url = $this->typeURL;
344 344
                     if (isset($udir)) $url .= "/$udir";
345
-                    $url .= "/" . basename($target);
345
+                    $url .= "/".basename($target);
346 346
                     if (preg_match('/^([a-z]+)\:\/\/([^\/^\:]+)(\:(\d+))?\/(.+)$/', $url, $patt)) {
347 347
                         list($unused, $protocol, $domain, $unused, $port, $path) = $patt;
348
-                        $base = "$protocol://$domain" . (strlen($port) ? ":$port" : "") . "/";
349
-                        $url = $base . path::urlPathEncode($path);
348
+                        $base = "$protocol://$domain".(strlen($port) ? ":$port" : "")."/";
349
+                        $url = $base.path::urlPathEncode($path);
350 350
                     } else
351 351
                         $url = path::urlPathEncode($url);
352 352
                 }
@@ -365,12 +365,12 @@  discard block
 block discarded – undo
365 365
     }
366 366
 
367 367
 
368
-	protected function getTransaliasSettings() {
368
+	protected function getTransaliasSettings(){
369 369
 		$modx = evolutionCMS();
370 370
 
371 371
 		// Cleaning uploaded filename?
372 372
 		$setting = $modx->getDatabase()->select('count(*)', $modx->getDatabase()->getFullTableName('system_settings'), 'setting_name="clean_uploaded_filename" AND setting_value=1');
373
-		if ($modx->getDatabase()->getValue($setting)>0) {
373
+		if ($modx->getDatabase()->getValue($setting) > 0) {
374 374
 			// Transalias plugin active?
375 375
 			$res = $modx->getDatabase()->select('properties', $modx->getDatabase()->getFullTableName('site_plugins'), 'name="TransAlias" AND disabled=0');
376 376
 			if ($properties = $modx->getDatabase()->getValue($res)) {
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 	}
386 386
 
387 387
 
388
-	protected function normalizeFilename($filename) {
388
+	protected function normalizeFilename($filename){
389 389
 		if ($this->getTransaliasSettings()) {
390 390
         		$format = strrchr($filename, ".");
391 391
         		$filename = str_replace($format, "", $filename);
@@ -394,11 +394,11 @@  discard block
 block discarded – undo
394 394
         	return $filename;
395 395
 	}
396 396
 
397
-	protected function normalizeDirname($dirname) {
397
+	protected function normalizeDirname($dirname){
398 398
         return $this->modx->stripAlias($dirname);
399 399
     }
400 400
 
401
-    protected function checkUploadedFile(array $aFile=null) {
401
+    protected function checkUploadedFile(array $aFile = null){
402 402
         $config = &$this->config;
403 403
         $file = ($aFile === null) ? $this->file : $aFile;
404 404
 
@@ -437,8 +437,7 @@  discard block
 block discarded – undo
437 437
                 ($file['error'] == UPLOAD_ERR_NO_TMP_DIR) ?
438 438
                     $this->label("Missing a temporary folder.") : (
439 439
                 ($file['error'] == UPLOAD_ERR_CANT_WRITE) ?
440
-                    $this->label("Failed to write file.") :
441
-                    $this->label("Unknown error.")
440
+                    $this->label("Failed to write file.") : $this->label("Unknown error.")
442 441
             )))));
443 442
 
444 443
         // HIDDEN FILENAMES CHECK
@@ -473,14 +472,14 @@  discard block
 block discarded – undo
473 472
 
474 473
 
475 474
 	// CHECK FOR MODX MAX FILE SIZE
476
-	$actualfilesize=filesize($file['tmp_name']);
475
+	$actualfilesize = filesize($file['tmp_name']);
477 476
 	if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize'])
478 477
 	    return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)");
479 478
 
480 479
         return true;
481 480
     }
482 481
 
483
-    protected function checkInputDir($dir, $inclType=true, $existing=true) {
482
+    protected function checkInputDir($dir, $inclType = true, $existing = true){
484 483
         $dir = path::normalize($dir);
485 484
         if (substr($dir, 0, 1) == "/")
486 485
             $dir = substr($dir, 1);
@@ -506,7 +505,7 @@  discard block
 block discarded – undo
506 505
         return (is_dir($path) && is_readable($path)) ? $return : false;
507 506
     }
508 507
 
509
-    protected function validateExtension($ext, $type) {
508
+    protected function validateExtension($ext, $type){
510 509
         $ext = trim(strtolower($ext));
511 510
         if (!isset($this->types[$type]))
512 511
             return false;
@@ -531,17 +530,17 @@  discard block
 block discarded – undo
531 530
         return in_array($ext, $exts);
532 531
     }
533 532
 
534
-    protected function getTypeFromPath($path) {
533
+    protected function getTypeFromPath($path){
535 534
         return preg_match('/^([^\/]*)\/.*$/', $path, $patt)
536 535
             ? $patt[1] : $path;
537 536
     }
538 537
 
539
-    protected function removeTypeFromPath($path) {
538
+    protected function removeTypeFromPath($path){
540 539
         return preg_match('/^[^\/]*\/(.*)$/', $path, $patt)
541 540
             ? $patt[1] : "";
542 541
     }
543 542
 
544
-    protected function imageResize($image, $file=null) {
543
+    protected function imageResize($image, $file = null){
545 544
 
546 545
         if (!($image instanceof image)) {
547 546
             $img = image::factory($this->imageDriver, $image);
@@ -629,24 +628,24 @@  discard block
 block discarded – undo
629 628
             $img->watermark($this->config['watermark']['file'], $left, $top);
630 629
 		}
631 630
 
632
-        $options = array( 'file' => $file );
631
+        $options = array('file' => $file);
633 632
 
634
-        $type = exif_imagetype( $file );
633
+        $type = exif_imagetype($file);
635 634
 
636
-        switch ( $type ) {
635
+        switch ($type) {
637 636
             case IMAGETYPE_GIF:
638
-                return $img->output( 'gif', $options );
637
+                return $img->output('gif', $options);
639 638
 
640 639
             case IMAGETYPE_PNG:
641
-                return $img->output( 'png', $options );
640
+                return $img->output('png', $options);
642 641
 
643 642
             default:
644
-                return $img->output( 'jpeg', array_merge( $options, array( 'quality' => $this->config['jpegQuality'] ) ) );
643
+                return $img->output('jpeg', array_merge($options, array('quality' => $this->config['jpegQuality'])));
645 644
         }
646 645
 
647 646
     }
648 647
 
649
-    protected function makeThumb($file, $overwrite=true) {
648
+    protected function makeThumb($file, $overwrite = true){
650 649
         $img = image::factory($this->imageDriver, $file);
651 650
 
652 651
         // Drop files which are not images
@@ -654,7 +653,7 @@  discard block
 block discarded – undo
654 653
             return true;
655 654
 
656 655
         $thumb = substr($file, strlen($this->config['uploadDir']));
657
-        $thumb = $this->config['uploadDir'] . "/" . $this->config['thumbsDir'] . "/" . $thumb;
656
+        $thumb = $this->config['uploadDir']."/".$this->config['thumbsDir']."/".$thumb;
658 657
         $thumb = path::normalize($thumb);
659 658
         $thumbDir = dirname($thumb);
660 659
         if (!is_dir($thumbDir) && !@mkdir($thumbDir, $this->config['dirPerms'], true))
@@ -677,15 +676,15 @@  discard block
 block discarded – undo
677 676
         if (!$img->resizeFit($this->config['thumbWidth'], $this->config['thumbHeight']))
678 677
             return false;
679 678
 
680
-        if ( $this->imageDriver == 'gd' ) {
681
-            $width  = imagesx( $img->image );
682
-            $height = imagesy( $img->image );
683
-            $back   = image::factory( $this->imageDriver, array( $width, $height ) );
684
-            $tile   = image::factory( $this->imageDriver, __DIR__ . '/../themes/' . $this->config['theme'] . '/img/bg_transparent.png' );
679
+        if ($this->imageDriver == 'gd') {
680
+            $width  = imagesx($img->image);
681
+            $height = imagesy($img->image);
682
+            $back   = image::factory($this->imageDriver, array($width, $height));
683
+            $tile   = image::factory($this->imageDriver, __DIR__.'/../themes/'.$this->config['theme'].'/img/bg_transparent.png');
685 684
 
686
-            imagesettile( $back->image, $tile->image );
687
-            imagefilledrectangle( $back->image, 0, 0, $width, $height, IMG_COLOR_TILED );
688
-            imagecopy( $back->image, $img->image, 0, 0, 0, 0, $width, $height );
685
+            imagesettile($back->image, $tile->image);
686
+            imagefilledrectangle($back->image, 0, 0, $width, $height, IMG_COLOR_TILED);
687
+            imagecopy($back->image, $img->image, 0, 0, 0, 0, $width, $height);
689 688
 
690 689
             $img = $back;
691 690
         }
@@ -697,7 +696,7 @@  discard block
 block discarded – undo
697 696
         ));
698 697
     }
699 698
 
700
-    protected function localize($langCode) {
699
+    protected function localize($langCode){
701 700
         require "lang/{$langCode}.php";
702 701
         setlocale(LC_ALL, $lang['_locale']);
703 702
         $this->charset = $lang['_charset'];
@@ -712,7 +711,7 @@  discard block
 block discarded – undo
712 711
         $this->labels = $lang;
713 712
     }
714 713
 
715
-    protected function label($string, array $data=null) {
714
+    protected function label($string, array $data = null){
716 715
         $return = isset($this->labels[$string]) ? $this->labels[$string] : $string;
717 716
         if (is_array($data))
718 717
             foreach ($data as $key => $val)
@@ -720,7 +719,7 @@  discard block
 block discarded – undo
720 719
         return $return;
721 720
     }
722 721
 
723
-    protected function backMsg($message, array $data=null) {
722
+    protected function backMsg($message, array $data = null){
724 723
         $message = $this->label($message, $data);
725 724
         if (isset($this->file['tmp_name']) && file_exists($this->file['tmp_name']))
726 725
             @unlink($this->file['tmp_name']);
@@ -728,7 +727,7 @@  discard block
 block discarded – undo
728 727
         die;
729 728
     }
730 729
 
731
-    protected function callBack($url, $message="") {
730
+    protected function callBack($url, $message = ""){
732 731
         $message = text::jsValue($message);
733 732
         $CKfuncNum = isset($this->opener['CKEditor']['funcNum'])
734 733
             ? $this->opener['CKEditor']['funcNum'] : 0;
@@ -769,7 +768,7 @@  discard block
 block discarded – undo
769 768
 
770 769
     }
771 770
 
772
-    protected function get_htaccess() {
771
+    protected function get_htaccess(){
773 772
         return "<IfModule mod_php4.c>
774 773
   php_value engine off
775 774
 </IfModule>
Please login to merge, or discard this patch.
manager/media/style/default/ajax.php 2 patches
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->getDatabase()->getFullTableName('site_templates') . ' AS t1
69
-                        ' . $sqlLike . '
68
+                        FROM ' . $modx->getDatabase()->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->getDatabase()->getFullTableName('site_tmplvars') . ' AS t1
83
-                        LEFT JOIN ' . $modx->getDatabase()->getFullTableName('site_tmplvar_templates') . ' AS t2 ON t1.id=t2.tmplvarid
84
-                        ' . $sqlLike . '
82
+                        FROM ' . $modx->getDatabase()->getFullTableName('site_tmplvars').' AS t1
83
+                        LEFT JOIN ' . $modx->getDatabase()->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->getDatabase()->getFullTableName('site_htmlsnippets') . ' AS t1
99
-                        ' . $sqlLike . '
98
+                        FROM ' . $modx->getDatabase()->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->getDatabase()->getFullTableName('site_snippets') . ' AS t1
113
-                        ' . $sqlLike . '
112
+                        FROM ' . $modx->getDatabase()->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->getDatabase()->getFullTableName('site_plugins') . ' AS t1
127
-                        ' . $sqlLike . '
126
+                        FROM ' . $modx->getDatabase()->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->getDatabase()->getFullTableName('manager_users') . ' AS t1
178
-				LEFT JOIN ' . $modx->getDatabase()->getFullTableName('user_attributes') . ' AS t2 ON t1.id=t2.internalKey
179
-				' . $sqlLike . '
177
+				FROM ' . $modx->getDatabase()->getFullTableName('manager_users').' AS t1
178
+				LEFT JOIN ' . $modx->getDatabase()->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->getDatabase()->getFullTableName('web_users') . ' AS t1
217
-				LEFT JOIN ' . $modx->getDatabase()->getFullTableName('web_user_attributes') . ' AS t2 ON t1.id=t2.internalKey
218
-				' . $sqlLike . '
216
+				FROM ' . $modx->getDatabase()->getFullTableName('web_users').' AS t1
217
+				LEFT JOIN ' . $modx->getDatabase()->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->getDatabase()->getFullTableName('site_snippets') . '
258
-						WHERE name="' . $name . '"
257
+						FROM ' . $modx->getDatabase()->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->getDatabase()->getFullTableName('site_htmlsnippets') . '
296
-						WHERE name="' . $name . '"
295
+						FROM ' . $modx->getDatabase()->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->getDatabase()->getFullTableName('site_htmlsnippets') . '
333
-						WHERE name="' . $name . '"
332
+						FROM ' . $modx->getDatabase()->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->getDatabase()->getFullTableName('site_snippets') . '
357
-							WHERE name="' . $name . '"
356
+							FROM ' . $modx->getDatabase()->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->getDatabase()->getFullTableName('site_tmplvars') . '
445
-						WHERE name="' . $name . '"
444
+						FROM ' . $modx->getDatabase()->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->getDatabase()->getFullTableName('site_content'), 'id=' . $id));
499
+                    $parentOld = $modx->getDatabase()->getValue($modx->getDatabase()->select('parent', $modx->getDatabase()->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->getDatabase()->getFullTableName('document_groups'), 'document IN(' . $id . ',' . $parent . ',' . $parentOld . ')');
520
+                            $sql = $modx->getDatabase()->select('*', $modx->getDatabase()->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->getDatabase()->getFullTableName('site_content'), 'id=' . $id);
545
+                            ), $modx->getDatabase()->getFullTableName('site_content'), 'id='.$id);
546 546
                             // set parent isfolder = 1
547 547
                             $modx->getDatabase()->update(array(
548 548
                                 'isfolder' => 1
549
-                            ), $modx->getDatabase()->getFullTableName('site_content'), 'id=' . $parent);
549
+                            ), $modx->getDatabase()->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->getDatabase()->getFullTableName('site_content'), 'parent=' . $parentOld))) {
553
+                                if ($modx->getDatabase()->getRecordCount($modx->getDatabase()->select('id', $modx->getDatabase()->getFullTableName('site_content'), 'parent='.$parentOld))) {
554 554
                                     $modx->getDatabase()->update(array(
555 555
                                         'isfolder' => 1
556
-                                    ), $modx->getDatabase()->getFullTableName('site_content'), 'id=' . $parentOld);
556
+                                    ), $modx->getDatabase()->getFullTableName('site_content'), 'id='.$parentOld);
557 557
                                 } else {
558 558
                                     $modx->getDatabase()->update(array(
559 559
                                         'isfolder' => 0
560
-                                    ), $modx->getDatabase()->getFullTableName('site_content'), 'id=' . $parentOld);
560
+                                    ), $modx->getDatabase()->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->getDatabase()->getFullTableName('site_content') . ' SET menuindex=' . $key . ' WHERE id=' . $value);
568
+                                    $modx->getDatabase()->query('UPDATE '.$modx->getDatabase()->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->getDatabase()->getFullTableName('site_content') . ' AS sc 
608
-                    LEFT JOIN ' . $modx->getDatabase()->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->getDatabase()->getFullTableName('site_content').' AS sc 
608
+                    LEFT JOIN ' . $modx->getDatabase()->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.
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
 
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 
20 20
 $_lang = array();
21 21
 include_once MODX_MANAGER_PATH . '/includes/lang/english.inc.php';
22
-if ($modx->config['manager_language'] != 'english') {
22
+if ($modx->config['manager_language'] != 'english') {
23 23
     include_once MODX_MANAGER_PATH . '/includes/lang/' . $modx->config['manager_language'] . '.inc.php';
24 24
 }
25 25
 include_once MODX_MANAGER_PATH . '/media/style/' . $modx->config['manager_theme'] . '/style.php';
@@ -32,12 +32,12 @@  discard block
 block discarded – undo
32 32
 // set limit sql query
33 33
 $limit = !empty($modx->config['number_of_results']) ? (int) $modx->config['number_of_results'] : 100;
34 34
 
35
-if (isset($action)) {
36
-    switch ($action) {
35
+if (isset($action)) {
36
+    switch ($action) {
37 37
 
38 38
         case '1': {
39 39
 
40
-            switch ($frame) {
40
+            switch ($frame) {
41 41
                 case 'nodes':
42 42
                     include_once MODX_MANAGER_PATH . '/frames/nodes.php';
43 43
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
             $elements = isset($_REQUEST['elements']) && is_scalar($_REQUEST['elements']) ? htmlentities($_REQUEST['elements']) : '';
53 53
 
54
-            if ($elements) {
54
+            if ($elements) {
55 55
                 $output = '';
56 56
                 $items = '';
57 57
                 $sql = '';
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
                 $sqlLike = $filter ? 'WHERE t1.name LIKE "' . $modx->getDatabase()->escape($filter) . '%"' : '';
61 61
                 $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit;
62 62
 
63
-                switch ($elements) {
63
+                switch ($elements) {
64 64
                     case 'element_templates':
65 65
                         $a = 16;
66 66
                         $sqlLike = $filter ? 'WHERE t1.templatename LIKE "' . $modx->getDatabase()->escape($filter) . '%"' : '';
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
                         ORDER BY t1.templatename ASC
71 71
                         ' . $sqlLimit);
72 72
 
73
-                        if ($modx->hasPermission('new_template')) {
73
+                        if ($modx->hasPermission('new_template')) {
74 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
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
                         ORDER BY t1.name ASC
87 87
                         ' . $sqlLimit);
88 88
 
89
-                        if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) {
89
+                        if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) {
90 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
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
                         ORDER BY t1.name ASC
101 101
                         ' . $sqlLimit);
102 102
 
103
-                        if ($modx->hasPermission('new_chunk')) {
103
+                        if ($modx->hasPermission('new_chunk')) {
104 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
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
                         ORDER BY t1.name ASC
115 115
                         ' . $sqlLimit);
116 116
 
117
-                        if ($modx->hasPermission('new_snippet')) {
117
+                        if ($modx->hasPermission('new_snippet')) {
118 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
 
@@ -128,19 +128,19 @@  discard block
 block discarded – undo
128 128
                         ORDER BY t1.name ASC
129 129
                         ' . $sqlLimit);
130 130
 
131
-                        if ($modx->hasPermission('new_plugin')) {
131
+                        if ($modx->hasPermission('new_plugin')) {
132 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;
136 136
                 }
137 137
 
138
-                if ($count = $modx->getDatabase()->getRecordCount($sql)) {
139
-                    if ($count == $limit) {
138
+                if ($count = $modx->getDatabase()->getRecordCount($sql)) {
139
+                    if ($count == $limit) {
140 140
                         $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>';
141 141
                     }
142
-                    while ($row = $modx->getDatabase()->getRow($sql)) {
143
-                        if (($row['disabled'] || $row['locked']) && $role != 1) {
142
+                    while ($row = $modx->getDatabase()->getRow($sql)) {
143
+                        if (($row['disabled'] || $row['locked']) && $role != 1) {
144 144
                             continue;
145 145
                         }
146 146
 
@@ -148,9 +148,9 @@  discard block
 block discarded – undo
148 148
                     }
149 149
                 }
150 150
 
151
-                if (isset($_REQUEST['filter'])) {
151
+                if (isset($_REQUEST['filter'])) {
152 152
                     $output = $items;
153
-                } else {
153
+                } else {
154 154
                     $output .= $items;
155 155
                 }
156 156
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
             $sqlLike = $filter ? 'WHERE t1.username LIKE "' . $modx->getDatabase()->escape($filter) . '%"' : '';
169 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
             }
@@ -180,22 +180,22 @@  discard block
 block discarded – undo
180 180
 				ORDER BY t1.username ASC
181 181
 				' . $sqlLimit);
182 182
 
183
-            if ($modx->hasPermission('new_user')) {
183
+            if ($modx->hasPermission('new_user')) {
184 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
-            if ($count = $modx->getDatabase()->getRecordCount($sql)) {
188
-                if ($count == $limit) {
187
+            if ($count = $modx->getDatabase()->getRecordCount($sql)) {
188
+                if ($count == $limit) {
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
-                while ($row = $modx->getDatabase()->getRow($sql)) {
191
+                while ($row = $modx->getDatabase()->getRow($sql)) {
192 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
 
196
-            if (isset($_REQUEST['filter'])) {
196
+            if (isset($_REQUEST['filter'])) {
197 197
                 $output = $items;
198
-            } else {
198
+            } else {
199 199
                 $output .= $items;
200 200
             }
201 201
 
@@ -219,22 +219,22 @@  discard block
 block discarded – undo
219 219
 				ORDER BY t1.username ASC
220 220
 				' . $sqlLimit);
221 221
 
222
-            if ($modx->hasPermission('new_web_user')) {
222
+            if ($modx->hasPermission('new_web_user')) {
223 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
-            if ($count = $modx->getDatabase()->getRecordCount($sql)) {
227
-                if ($count == $limit) {
226
+            if ($count = $modx->getDatabase()->getRecordCount($sql)) {
227
+                if ($count == $limit) {
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
-                while ($row = $modx->getDatabase()->getRow($sql)) {
230
+                while ($row = $modx->getDatabase()->getRow($sql)) {
231 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
 
235
-            if (isset($_REQUEST['filter'])) {
235
+            if (isset($_REQUEST['filter'])) {
236 236
                 $output = $items;
237
-            } else {
237
+            } else {
238 238
                 $output .= $items;
239 239
             }
240 240
 
@@ -248,8 +248,8 @@  discard block
 block discarded – undo
248 248
             $type = isset($_REQUEST['type']) && is_scalar($_REQUEST['type']) ? $modx->getDatabase()->escape($_REQUEST['type']) : false;
249 249
             $contextmenu = '';
250 250
 
251
-            if ($role && $name && $type) {
252
-                switch ($type) {
251
+            if ($role && $name && $type) {
252
+                switch ($type) {
253 253
                     case 'Snippet':
254 254
                     case 'SnippetNoCache': {
255 255
 
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 						WHERE name="' . $name . '"
259 259
 						LIMIT 1');
260 260
 
261
-                        if ($modx->getDatabase()->getRecordCount($sql)) {
261
+                        if ($modx->getDatabase()->getRecordCount($sql)) {
262 262
                             $row = $modx->getDatabase()->getRow($sql);
263 263
                             $contextmenu = array(
264 264
                                 'header' => array(
@@ -269,13 +269,13 @@  discard block
 block discarded – undo
269 269
                                     'url' => "index.php?a=22&id=" . $row['id']
270 270
                                 )
271 271
                             );
272
-                            if (!empty($row['description'])) {
272
+                            if (!empty($row['description'])) {
273 273
                                 $contextmenu['seperator'] = '';
274 274
                                 $contextmenu['description'] = array(
275 275
                                     'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
276 276
                                 );
277 277
                             }
278
-                        } else {
278
+                        } else {
279 279
                             $contextmenu = array(
280 280
                                 'header' => array(
281 281
                                     'innerHTML' => '<i class="fa fa-code"></i> ' . $name
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 						WHERE name="' . $name . '"
297 297
 						LIMIT 1');
298 298
 
299
-                        if ($modx->getDatabase()->getRecordCount($sql)) {
299
+                        if ($modx->getDatabase()->getRecordCount($sql)) {
300 300
                             $row = $modx->getDatabase()->getRow($sql);
301 301
                             $contextmenu = array(
302 302
                                 'header' => array(
@@ -307,13 +307,13 @@  discard block
 block discarded – undo
307 307
                                     'url' => "index.php?a=78&id=" . $row['id']
308 308
                                 )
309 309
                             );
310
-                            if (!empty($row['description'])) {
310
+                            if (!empty($row['description'])) {
311 311
                                 $contextmenu['seperator'] = '';
312 312
                                 $contextmenu['description'] = array(
313 313
                                     'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
314 314
                                 );
315 315
                             }
316
-                        } else {
316
+                        } else {
317 317
                             $contextmenu = array(
318 318
                                 'header' => array(
319 319
                                     'innerHTML' => '<i class="fa fa-th-large"></i> ' . $name
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 						WHERE name="' . $name . '"
334 334
 						LIMIT 1');
335 335
 
336
-                        if ($modx->getDatabase()->getRecordCount($sql)) {
336
+                        if ($modx->getDatabase()->getRecordCount($sql)) {
337 337
                             $row = $modx->getDatabase()->getRow($sql);
338 338
                             $contextmenu = array(
339 339
                                 'header' => array(
@@ -344,20 +344,20 @@  discard block
 block discarded – undo
344 344
                                     'url' => "index.php?a=78&id=" . $row['id']
345 345
                                 )
346 346
                             );
347
-                            if (!empty($row['description'])) {
347
+                            if (!empty($row['description'])) {
348 348
                                 $contextmenu['seperator'] = '';
349 349
                                 $contextmenu['description'] = array(
350 350
                                     'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
351 351
                                 );
352 352
                             }
353
-                        } else {
353
+                        } else {
354 354
 
355 355
                             $sql = $modx->getDatabase()->query('SELECT *
356 356
 							FROM ' . $modx->getDatabase()->getFullTableName('site_snippets') . '
357 357
 							WHERE name="' . $name . '"
358 358
 							LIMIT 1');
359 359
 
360
-                            if ($modx->getDatabase()->getRecordCount($sql)) {
360
+                            if ($modx->getDatabase()->getRecordCount($sql)) {
361 361
                                 $row = $modx->getDatabase()->getRow($sql);
362 362
                                 $contextmenu = array(
363 363
                                     'header' => array(
@@ -368,13 +368,13 @@  discard block
 block discarded – undo
368 368
                                         'url' => "index.php?a=22&id=" . $row['id']
369 369
                                     )
370 370
                                 );
371
-                                if (!empty($row['description'])) {
371
+                                if (!empty($row['description'])) {
372 372
                                     $contextmenu['seperator'] = '';
373 373
                                     $contextmenu['description'] = array(
374 374
                                         'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
375 375
                                     );
376 376
                                 }
377
-                            } else {
377
+                            } else {
378 378
                                 $contextmenu = array(
379 379
                                     'header' => array(
380 380
                                         'innerHTML' => '<i class="fa fa-code"></i> ' . $name
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
                             'alias_visible'
437 437
                         );
438 438
 
439
-                        if (in_array($name, $default_field)) {
439
+                        if (in_array($name, $default_field)) {
440 440
                             return;
441 441
                         }
442 442
 
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 						WHERE name="' . $name . '"
446 446
 						LIMIT 1');
447 447
 
448
-                        if ($modx->getDatabase()->getRecordCount($sql)) {
448
+                        if ($modx->getDatabase()->getRecordCount($sql)) {
449 449
                             $row = $modx->getDatabase()->getRow($sql);
450 450
                             $contextmenu = array(
451 451
                                 'header' => array(
@@ -456,13 +456,13 @@  discard block
 block discarded – undo
456 456
                                     'url' => "index.php?a=301&id=" . $row['id']
457 457
                                 )
458 458
                             );
459
-                            if (!empty($row['description'])) {
459
+                            if (!empty($row['description'])) {
460 460
                                 $contextmenu['seperator'] = '';
461 461
                                 $contextmenu['description'] = array(
462 462
                                     'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
463 463
                                 );
464 464
                             }
465
-                        } else {
465
+                        } else {
466 466
                             $contextmenu = array(
467 467
                                 'header' => array(
468 468
                                     'innerHTML' => '<i class="fa fa-list-alt"></i> ' . $name
@@ -487,13 +487,13 @@  discard block
 block discarded – undo
487 487
         case 'movedocument' : {
488 488
             $json = array();
489 489
 
490
-            if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) {
490
+            if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) {
491 491
                 $id = !empty($_REQUEST['id']) ? (int)$_REQUEST['id'] : '';
492 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
-                if ($id && $parent >= 0) {
496
+                if ($id && $parent >= 0) {
497 497
 
498 498
                     // find older parent
499 499
                     $parentOld = $modx->getDatabase()->getValue($modx->getDatabase()->select('parent', $modx->getDatabase()->getFullTableName('site_content'), 'id=' . $id));
@@ -504,31 +504,31 @@  discard block
 block discarded – undo
504 504
                         'new_parent'  => $parent,
505 505
                     ]);
506 506
 
507
-                    if (is_array($eventOut) && count($eventOut) > 0) {
507
+                    if (is_array($eventOut) && count($eventOut) > 0) {
508 508
                         $eventParent = array_pop($eventOut);
509 509
 
510
-                        if ($eventParent == $parentOld) {
510
+                        if ($eventParent == $parentOld) {
511 511
                             $json['errors'] = $_lang['error_movedocument2'];
512
-                        } else {
512
+                        } else {
513 513
                             $parent = $eventParent;
514 514
                         }
515 515
                     }
516 516
 
517
-                    if (empty($json['errors'])) {
517
+                    if (empty($json['errors'])) {
518 518
                         // check privileges user for move docs
519
-                        if (!empty($modx->config['tree_show_protected']) && $role != 1) {
519
+                        if (!empty($modx->config['tree_show_protected']) && $role != 1) {
520 520
                             $sql = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('document_groups'), 'document IN(' . $id . ',' . $parent . ',' . $parentOld . ')');
521
-                            if ($modx->getDatabase()->getRecordCount($sql)) {
521
+                            if ($modx->getDatabase()->getRecordCount($sql)) {
522 522
                                 $document_groups = array();
523
-                                while ($row = $modx->getDatabase()->getRow($sql)) {
523
+                                while ($row = $modx->getDatabase()->getRow($sql)) {
524 524
                                     $document_groups[$row['document']]['groups'][] = $row['document_group'];
525 525
                                 }
526
-                                foreach ($document_groups as $key => $value) {
527
-                                    if (($key == $parent || $key == $parentOld || $key == $id) && !in_array($role, $value['groups'])) {
526
+                                foreach ($document_groups as $key => $value) {
527
+                                    if (($key == $parent || $key == $parentOld || $key == $id) && !in_array($role, $value['groups'])) {
528 528
                                         $json['errors'] = $_lang["error_no_privileges"];
529 529
                                     }
530 530
                                 }
531
-                                if ($json['errors']) {
531
+                                if ($json['errors']) {
532 532
                                     header('content-type: application/json');
533 533
                                     echo json_encode($json, JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE);
534 534
                                     break;
@@ -536,9 +536,9 @@  discard block
 block discarded – undo
536 536
                             }
537 537
                         }
538 538
 
539
-                        if ($parent == 0 && $parent != $parentOld && !$modx->config['udperms_allowroot'] && $role != 1) {
539
+                        if ($parent == 0 && $parent != $parentOld && !$modx->config['udperms_allowroot'] && $role != 1) {
540 540
                             $json['errors'] = $_lang["error_no_privileges"];
541
-                        } else {
541
+                        } else {
542 542
                             // set new parent
543 543
                             $modx->getDatabase()->update(array(
544 544
                                 'parent' => $parent
@@ -548,13 +548,13 @@  discard block
 block discarded – undo
548 548
                                 'isfolder' => 1
549 549
                             ), $modx->getDatabase()->getFullTableName('site_content'), 'id=' . $parent);
550 550
 
551
-                            if ($parent != $parentOld) {
551
+                            if ($parent != $parentOld) {
552 552
                                 // check children docs and set parent isfolder
553
-                                if ($modx->getDatabase()->getRecordCount($modx->getDatabase()->select('id', $modx->getDatabase()->getFullTableName('site_content'), 'parent=' . $parentOld))) {
553
+                                if ($modx->getDatabase()->getRecordCount($modx->getDatabase()->select('id', $modx->getDatabase()->getFullTableName('site_content'), 'parent=' . $parentOld))) {
554 554
                                     $modx->getDatabase()->update(array(
555 555
                                         'isfolder' => 1
556 556
                                     ), $modx->getDatabase()->getFullTableName('site_content'), 'id=' . $parentOld);
557
-                                } else {
557
+                                } else {
558 558
                                     $modx->getDatabase()->update(array(
559 559
                                         'isfolder' => 0
560 560
                                     ), $modx->getDatabase()->getFullTableName('site_content'), 'id=' . $parentOld);
@@ -562,16 +562,16 @@  discard block
 block discarded – undo
562 562
                             }
563 563
 
564 564
                             // set menuindex
565
-                            if (!empty($menuindex)) {
565
+                            if (!empty($menuindex)) {
566 566
                                 $menuindex = explode(',', $menuindex);
567
-                                foreach ($menuindex as $key => $value) {
567
+                                foreach ($menuindex as $key => $value) {
568 568
                                     $modx->getDatabase()->query('UPDATE ' . $modx->getDatabase()->getFullTableName('site_content') . ' SET menuindex=' . $key . ' WHERE id=' . $value);
569 569
                                 }
570
-                            } else {
570
+                            } else {
571 571
                                 // TODO: max(*) menuindex
572 572
                             }
573 573
 
574
-                            if (!$json['errors']) {
574
+                            if (!$json['errors']) {
575 575
                                 $json['success'] = $_lang["actioncomplete"];
576 576
 
577 577
                                 $modx->invokeEvent('onAfterMoveDocument', [
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
                         }
584 584
                     }
585 585
                 }
586
-            } else {
586
+            } else {
587 587
                 $json['errors'] = $_lang["error_no_privileges"];
588 588
             }
589 589
 
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
 
600 600
             $output = !!$modx->elementIsLocked($type, $id, true);
601 601
 
602
-            if (!$output) {
602
+            if (!$output) {
603 603
                 $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : '';
604 604
                 $docgrp_cond = $docgrp ? ' OR dg.document_group IN (' . $docgrp . ')' : '';
605 605
                 $sql = '
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
                     LEFT JOIN ' . $modx->getDatabase()->getFullTableName('document_groups') . ' dg ON dg.document=sc.id
609 609
                     WHERE sc.id=' . $id . ' GROUP BY sc.id';
610 610
                 $sql = $modx->getDatabase()->query($sql);
611
-                if ($modx->getDatabase()->getRecordCount($sql)) {
611
+                if ($modx->getDatabase()->getRecordCount($sql)) {
612 612
                     $row = $modx->getDatabase()->getRow($sql);
613 613
                     $output = !!$row['locked'];
614 614
                 }
Please login to merge, or discard this patch.