@@ -19,11 +19,11 @@ discard block |
||
| 19 | 19 | $modx->loadExtension("ManagerAPI");
|
| 20 | 20 | |
| 21 | 21 | $_lang = array(); |
| 22 | -include_once MODX_MANAGER_PATH . '/includes/lang/english.inc.php'; |
|
| 22 | +include_once MODX_MANAGER_PATH.'/includes/lang/english.inc.php'; |
|
| 23 | 23 | if ($modx->config['manager_language'] != 'english') {
|
| 24 | - include_once MODX_MANAGER_PATH . '/includes/lang/' . $modx->config['manager_language'] . '.inc.php'; |
|
| 24 | + include_once MODX_MANAGER_PATH.'/includes/lang/'.$modx->config['manager_language'].'.inc.php'; |
|
| 25 | 25 | } |
| 26 | -include_once MODX_MANAGER_PATH . '/media/style/' . $modx->config['manager_theme'] . '/style.php'; |
|
| 26 | +include_once MODX_MANAGER_PATH.'/media/style/'.$modx->config['manager_theme'].'/style.php'; |
|
| 27 | 27 | |
| 28 | 28 | $action = isset($_REQUEST['a']) ? $_REQUEST['a'] : ''; |
| 29 | 29 | $frame = isset($_REQUEST['f']) ? $_REQUEST['f'] : ''; |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | switch ($frame) {
|
| 42 | 42 | case 'nodes': |
| 43 | - include_once MODX_MANAGER_PATH . '/frames/nodes.php'; |
|
| 43 | + include_once MODX_MANAGER_PATH.'/frames/nodes.php'; |
|
| 44 | 44 | |
| 45 | 45 | break; |
| 46 | 46 | } |
@@ -58,21 +58,21 @@ discard block |
||
| 58 | 58 | $sql = ''; |
| 59 | 59 | $a = ''; |
| 60 | 60 | $filter = !empty($_REQUEST['filter']) && is_scalar($_REQUEST['filter']) ? addcslashes(trim($_REQUEST['filter']), '%*_') : ''; |
| 61 | - $sqlLike = $filter ? 'WHERE t1.name LIKE "' . $modx->db->escape($filter) . '%"' : ''; |
|
| 62 | - $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit; |
|
| 61 | + $sqlLike = $filter ? 'WHERE t1.name LIKE "'.$modx->db->escape($filter).'%"' : ''; |
|
| 62 | + $sqlLimit = $sqlLike ? '' : 'LIMIT '.$limit; |
|
| 63 | 63 | |
| 64 | 64 | switch ($elements) {
|
| 65 | 65 | case 'element_templates': |
| 66 | 66 | $a = 16; |
| 67 | - $sqlLike = $filter ? 'WHERE t1.templatename LIKE "' . $modx->db->escape($filter) . '%"' : ''; |
|
| 67 | + $sqlLike = $filter ? 'WHERE t1.templatename LIKE "'.$modx->db->escape($filter).'%"' : ''; |
|
| 68 | 68 | $sql = $modx->db->query('SELECT t1.id, t1.templatename AS name, t1.locked, 0 AS disabled
|
| 69 | - FROM ' . $modx->getFullTableName('site_templates') . ' AS t1
|
|
| 70 | - ' . $sqlLike . ' |
|
| 69 | + FROM ' . $modx->getFullTableName('site_templates').' AS t1
|
|
| 70 | + ' . $sqlLike.' |
|
| 71 | 71 | ORDER BY t1.templatename ASC |
| 72 | 72 | ' . $sqlLimit); |
| 73 | 73 | |
| 74 | 74 | if ($modx->hasPermission('new_template')) {
|
| 75 | - $output .= '<li><a id="a_19" href="index.php?a=19" target="main"><i class="fa fa-plus"></i>' . $_lang['new_template'] . '</a></li>'; |
|
| 75 | + $output .= '<li><a id="a_19" href="index.php?a=19" target="main"><i class="fa fa-plus"></i>'.$_lang['new_template'].'</a></li>'; |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | break; |
@@ -80,15 +80,15 @@ discard block |
||
| 80 | 80 | case 'element_tplvars': |
| 81 | 81 | $a = 301; |
| 82 | 82 | $sql = $modx->db->query('SELECT t1.id, t1.name, t1.locked, IF(MIN(t2.tmplvarid),0,1) AS disabled
|
| 83 | - FROM ' . $modx->getFullTableName('site_tmplvars') . ' AS t1
|
|
| 84 | - LEFT JOIN ' . $modx->getFullTableName('site_tmplvar_templates') . ' AS t2 ON t1.id=t2.tmplvarid
|
|
| 85 | - ' . $sqlLike . ' |
|
| 83 | + FROM ' . $modx->getFullTableName('site_tmplvars').' AS t1
|
|
| 84 | + LEFT JOIN ' . $modx->getFullTableName('site_tmplvar_templates').' AS t2 ON t1.id=t2.tmplvarid
|
|
| 85 | + ' . $sqlLike.' |
|
| 86 | 86 | GROUP BY t1.id |
| 87 | 87 | ORDER BY t1.name ASC |
| 88 | 88 | ' . $sqlLimit); |
| 89 | 89 | |
| 90 | 90 | if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) {
|
| 91 | - $output .= '<li><a id="a_300" href="index.php?a=300" target="main"><i class="fa fa-plus"></i>' . $_lang['new_tmplvars'] . '</a></li>'; |
|
| 91 | + $output .= '<li><a id="a_300" href="index.php?a=300" target="main"><i class="fa fa-plus"></i>'.$_lang['new_tmplvars'].'</a></li>'; |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | break; |
@@ -96,13 +96,13 @@ discard block |
||
| 96 | 96 | case 'element_htmlsnippets': |
| 97 | 97 | $a = 78; |
| 98 | 98 | $sql = $modx->db->query('SELECT t1.id, t1.name, t1.locked, t1.disabled
|
| 99 | - FROM ' . $modx->getFullTableName('site_htmlsnippets') . ' AS t1
|
|
| 100 | - ' . $sqlLike . ' |
|
| 99 | + FROM ' . $modx->getFullTableName('site_htmlsnippets').' AS t1
|
|
| 100 | + ' . $sqlLike.' |
|
| 101 | 101 | ORDER BY t1.name ASC |
| 102 | 102 | ' . $sqlLimit); |
| 103 | 103 | |
| 104 | 104 | if ($modx->hasPermission('new_chunk')) {
|
| 105 | - $output .= '<li><a id="a_77" href="index.php?a=77" target="main"><i class="fa fa-plus"></i>' . $_lang['new_htmlsnippet'] . '</a></li>'; |
|
| 105 | + $output .= '<li><a id="a_77" href="index.php?a=77" target="main"><i class="fa fa-plus"></i>'.$_lang['new_htmlsnippet'].'</a></li>'; |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | break; |
@@ -110,13 +110,13 @@ discard block |
||
| 110 | 110 | case 'element_snippets': |
| 111 | 111 | $a = 22; |
| 112 | 112 | $sql = $modx->db->query('SELECT t1.id, t1.name, t1.locked, t1.disabled
|
| 113 | - FROM ' . $modx->getFullTableName('site_snippets') . ' AS t1
|
|
| 114 | - ' . $sqlLike . ' |
|
| 113 | + FROM ' . $modx->getFullTableName('site_snippets').' AS t1
|
|
| 114 | + ' . $sqlLike.' |
|
| 115 | 115 | ORDER BY t1.name ASC |
| 116 | 116 | ' . $sqlLimit); |
| 117 | 117 | |
| 118 | 118 | if ($modx->hasPermission('new_snippet')) {
|
| 119 | - $output .= '<li><a id="a_23" href="index.php?a=23" target="main"><i class="fa fa-plus"></i>' . $_lang['new_snippet'] . '</a></li>'; |
|
| 119 | + $output .= '<li><a id="a_23" href="index.php?a=23" target="main"><i class="fa fa-plus"></i>'.$_lang['new_snippet'].'</a></li>'; |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | break; |
@@ -124,13 +124,13 @@ discard block |
||
| 124 | 124 | case 'element_plugins': |
| 125 | 125 | $a = 102; |
| 126 | 126 | $sql = $modx->db->query('SELECT t1.id, t1.name, t1.locked, t1.disabled
|
| 127 | - FROM ' . $modx->getFullTableName('site_plugins') . ' AS t1
|
|
| 128 | - ' . $sqlLike . ' |
|
| 127 | + FROM ' . $modx->getFullTableName('site_plugins').' AS t1
|
|
| 128 | + ' . $sqlLike.' |
|
| 129 | 129 | ORDER BY t1.name ASC |
| 130 | 130 | ' . $sqlLimit); |
| 131 | 131 | |
| 132 | 132 | if ($modx->hasPermission('new_plugin')) {
|
| 133 | - $output .= '<li><a id="a_101" href="index.php?a=101" target="main"><i class="fa fa-plus"></i>' . $_lang['new_plugin'] . '</a></li>'; |
|
| 133 | + $output .= '<li><a id="a_101" href="index.php?a=101" target="main"><i class="fa fa-plus"></i>'.$_lang['new_plugin'].'</a></li>'; |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | break; |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | continue; |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - $items .= '<li class="item ' . ($row['disabled'] ? 'disabled' : '') . ($row['locked'] ? ' locked' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main" data-parent-id="a_76__elements_' . $elements . '">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>' . "\n";
|
|
| 148 | + $items .= '<li class="item '.($row['disabled'] ? 'disabled' : '').($row['locked'] ? ' locked' : '').'"><a id="a_'.$a.'__id_'.$row['id'].'" href="index.php?a='.$a.'&id='.$row['id'].'" target="main" data-parent-id="a_76__elements_'.$elements.'">'.$row['name'].' <small>('.$row['id'].')</small></a></li>'."\n";
|
|
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | |
@@ -166,23 +166,23 @@ discard block |
||
| 166 | 166 | $output = ''; |
| 167 | 167 | $items = ''; |
| 168 | 168 | $filter = !empty($_REQUEST['filter']) && is_scalar($_REQUEST['filter']) ? addcslashes(trim($_REQUEST['filter']), '\%*_') : ''; |
| 169 | - $sqlLike = $filter ? 'WHERE t1.username LIKE "' . $modx->db->escape($filter) . '%"' : ''; |
|
| 170 | - $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit; |
|
| 169 | + $sqlLike = $filter ? 'WHERE t1.username LIKE "'.$modx->db->escape($filter).'%"' : ''; |
|
| 170 | + $sqlLimit = $sqlLike ? '' : 'LIMIT '.$limit; |
|
| 171 | 171 | |
| 172 | - if(!$modx->hasPermission('save_role')) {
|
|
| 172 | + if (!$modx->hasPermission('save_role')) {
|
|
| 173 | 173 | $sqlLike .= $sqlLike ? ' AND ' : 'WHERE '; |
| 174 | 174 | $sqlLike .= 't2.role != 1'; |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | $sql = $modx->db->query('SELECT t1.*, t1.username AS name, t2.blocked
|
| 178 | - FROM ' . $modx->getFullTableName('manager_users') . ' AS t1
|
|
| 179 | - LEFT JOIN ' . $modx->getFullTableName('user_attributes') . ' AS t2 ON t1.id=t2.internalKey
|
|
| 180 | - ' . $sqlLike . ' |
|
| 178 | + FROM ' . $modx->getFullTableName('manager_users').' AS t1
|
|
| 179 | + LEFT JOIN ' . $modx->getFullTableName('user_attributes').' AS t2 ON t1.id=t2.internalKey
|
|
| 180 | + ' . $sqlLike.' |
|
| 181 | 181 | ORDER BY t1.username ASC |
| 182 | 182 | ' . $sqlLimit); |
| 183 | 183 | |
| 184 | 184 | if ($modx->hasPermission('new_user')) {
|
| 185 | - $output .= '<li><a id="a_11" href="index.php?a=11" target="main"><i class="fa fa-plus"></i>' . $_lang['new_user'] . '</a></li>'; |
|
| 185 | + $output .= '<li><a id="a_11" href="index.php?a=11" target="main"><i class="fa fa-plus"></i>'.$_lang['new_user'].'</a></li>'; |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | if ($count = $modx->db->getRecordCount($sql)) {
|
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>'; |
| 191 | 191 | } |
| 192 | 192 | while ($row = $modx->db->getRow($sql)) {
|
| 193 | - $items .= '<li class="item ' . ($row['blocked'] ? 'disabled' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>';
|
|
| 193 | + $items .= '<li class="item '.($row['blocked'] ? 'disabled' : '').'"><a id="a_'.$a.'__id_'.$row['id'].'" href="index.php?a='.$a.'&id='.$row['id'].'" target="main">'.$row['name'].' <small>('.$row['id'].')</small></a></li>';
|
|
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | 196 | |
@@ -210,18 +210,18 @@ discard block |
||
| 210 | 210 | $output = ''; |
| 211 | 211 | $items = ''; |
| 212 | 212 | $filter = !empty($_REQUEST['filter']) && is_scalar($_REQUEST['filter']) ? addcslashes(trim($_REQUEST['filter']), '\%*_') : ''; |
| 213 | - $sqlLike = $filter ? 'WHERE t1.username LIKE "' . $modx->db->escape($filter) . '%"' : ''; |
|
| 214 | - $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit; |
|
| 213 | + $sqlLike = $filter ? 'WHERE t1.username LIKE "'.$modx->db->escape($filter).'%"' : ''; |
|
| 214 | + $sqlLimit = $sqlLike ? '' : 'LIMIT '.$limit; |
|
| 215 | 215 | |
| 216 | 216 | $sql = $modx->db->query('SELECT t1.*, t1.username AS name, t2.blocked
|
| 217 | - FROM ' . $modx->getFullTableName('web_users') . ' AS t1
|
|
| 218 | - LEFT JOIN ' . $modx->getFullTableName('web_user_attributes') . ' AS t2 ON t1.id=t2.internalKey
|
|
| 219 | - ' . $sqlLike . ' |
|
| 217 | + FROM ' . $modx->getFullTableName('web_users').' AS t1
|
|
| 218 | + LEFT JOIN ' . $modx->getFullTableName('web_user_attributes').' AS t2 ON t1.id=t2.internalKey
|
|
| 219 | + ' . $sqlLike.' |
|
| 220 | 220 | ORDER BY t1.username ASC |
| 221 | 221 | ' . $sqlLimit); |
| 222 | 222 | |
| 223 | 223 | if ($modx->hasPermission('new_web_user')) {
|
| 224 | - $output .= '<li><a id="a_87" href="index.php?a=87" target="main"><i class="fa fa-plus"></i>' . $_lang['new_web_user'] . '</a></li>'; |
|
| 224 | + $output .= '<li><a id="a_87" href="index.php?a=87" target="main"><i class="fa fa-plus"></i>'.$_lang['new_web_user'].'</a></li>'; |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | if ($count = $modx->db->getRecordCount($sql)) {
|
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>'; |
| 230 | 230 | } |
| 231 | 231 | while ($row = $modx->db->getRow($sql)) {
|
| 232 | - $items .= '<li class="item ' . ($row['blocked'] ? 'disabled' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>';
|
|
| 232 | + $items .= '<li class="item '.($row['blocked'] ? 'disabled' : '').'"><a id="a_'.$a.'__id_'.$row['id'].'" href="index.php?a='.$a.'&id='.$row['id'].'" target="main">'.$row['name'].' <small>('.$row['id'].')</small></a></li>';
|
|
| 233 | 233 | } |
| 234 | 234 | } |
| 235 | 235 | |
@@ -255,35 +255,35 @@ discard block |
||
| 255 | 255 | case 'SnippetNoCache': {
|
| 256 | 256 | |
| 257 | 257 | $sql = $modx->db->query('SELECT *
|
| 258 | - FROM ' . $modx->getFullTableName('site_snippets') . '
|
|
| 259 | - WHERE name="' . $name . '" |
|
| 258 | + FROM ' . $modx->getFullTableName('site_snippets').'
|
|
| 259 | + WHERE name="' . $name.'" |
|
| 260 | 260 | LIMIT 1'); |
| 261 | 261 | |
| 262 | 262 | if ($modx->db->getRecordCount($sql)) {
|
| 263 | 263 | $row = $modx->db->getRow($sql); |
| 264 | 264 | $contextmenu = array( |
| 265 | 265 | 'header' => array( |
| 266 | - 'innerHTML' => '<i class="fa fa-code"></i> ' . $row['name'] |
|
| 266 | + 'innerHTML' => '<i class="fa fa-code"></i> '.$row['name'] |
|
| 267 | 267 | ), |
| 268 | 268 | 'item' => array( |
| 269 | - 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'], |
|
| 270 | - 'url' => "index.php?a=22&id=" . $row['id'] |
|
| 269 | + 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'], |
|
| 270 | + 'url' => "index.php?a=22&id=".$row['id'] |
|
| 271 | 271 | ) |
| 272 | 272 | ); |
| 273 | 273 | if (!empty($row['description'])) {
|
| 274 | 274 | $contextmenu['seperator'] = ''; |
| 275 | 275 | $contextmenu['description'] = array( |
| 276 | - 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
|
| 276 | + 'innerHTML' => '<i class="fa fa-info"></i> '.$row['description'] |
|
| 277 | 277 | ); |
| 278 | 278 | } |
| 279 | 279 | } else {
|
| 280 | 280 | $contextmenu = array( |
| 281 | 281 | 'header' => array( |
| 282 | - 'innerHTML' => '<i class="fa fa-code"></i> ' . $name |
|
| 282 | + 'innerHTML' => '<i class="fa fa-code"></i> '.$name |
|
| 283 | 283 | ), |
| 284 | 284 | 'item' => array( |
| 285 | - 'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_snippet'], |
|
| 286 | - 'url' => "index.php?a=23&itemname=" . $name |
|
| 285 | + 'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_snippet'], |
|
| 286 | + 'url' => "index.php?a=23&itemname=".$name |
|
| 287 | 287 | ) |
| 288 | 288 | ); |
| 289 | 289 | } |
@@ -293,35 +293,35 @@ discard block |
||
| 293 | 293 | case 'Chunk' : {
|
| 294 | 294 | |
| 295 | 295 | $sql = $modx->db->query('SELECT *
|
| 296 | - FROM ' . $modx->getFullTableName('site_htmlsnippets') . '
|
|
| 297 | - WHERE name="' . $name . '" |
|
| 296 | + FROM ' . $modx->getFullTableName('site_htmlsnippets').'
|
|
| 297 | + WHERE name="' . $name.'" |
|
| 298 | 298 | LIMIT 1'); |
| 299 | 299 | |
| 300 | 300 | if ($modx->db->getRecordCount($sql)) {
|
| 301 | 301 | $row = $modx->db->getRow($sql); |
| 302 | 302 | $contextmenu = array( |
| 303 | 303 | 'header' => array( |
| 304 | - 'innerHTML' => '<i class="fa fa-th-large"></i> ' . $row['name'] |
|
| 304 | + 'innerHTML' => '<i class="fa fa-th-large"></i> '.$row['name'] |
|
| 305 | 305 | ), |
| 306 | 306 | 'item' => array( |
| 307 | - 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'], |
|
| 308 | - 'url' => "index.php?a=78&id=" . $row['id'] |
|
| 307 | + 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'], |
|
| 308 | + 'url' => "index.php?a=78&id=".$row['id'] |
|
| 309 | 309 | ) |
| 310 | 310 | ); |
| 311 | 311 | if (!empty($row['description'])) {
|
| 312 | 312 | $contextmenu['seperator'] = ''; |
| 313 | 313 | $contextmenu['description'] = array( |
| 314 | - 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
|
| 314 | + 'innerHTML' => '<i class="fa fa-info"></i> '.$row['description'] |
|
| 315 | 315 | ); |
| 316 | 316 | } |
| 317 | 317 | } else {
|
| 318 | 318 | $contextmenu = array( |
| 319 | 319 | 'header' => array( |
| 320 | - 'innerHTML' => '<i class="fa fa-th-large"></i> ' . $name |
|
| 320 | + 'innerHTML' => '<i class="fa fa-th-large"></i> '.$name |
|
| 321 | 321 | ), |
| 322 | 322 | 'item' => array( |
| 323 | - 'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_htmlsnippet'], |
|
| 324 | - 'url' => "index.php?a=77&itemname=" . $name |
|
| 323 | + 'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_htmlsnippet'], |
|
| 324 | + 'url' => "index.php?a=77&itemname=".$name |
|
| 325 | 325 | ) |
| 326 | 326 | ); |
| 327 | 327 | } |
@@ -330,8 +330,8 @@ discard block |
||
| 330 | 330 | } |
| 331 | 331 | case 'AttributeValue': {
|
| 332 | 332 | $sql = $modx->db->query('SELECT *
|
| 333 | - FROM ' . $modx->getFullTableName('site_htmlsnippets') . '
|
|
| 334 | - WHERE name="' . $name . '" |
|
| 333 | + FROM ' . $modx->getFullTableName('site_htmlsnippets').'
|
|
| 334 | + WHERE name="' . $name.'" |
|
| 335 | 335 | LIMIT 1'); |
| 336 | 336 | |
| 337 | 337 | if ($modx->db->getRecordCount($sql)) {
|
@@ -341,52 +341,52 @@ discard block |
||
| 341 | 341 | 'innerText' => $row['name'] |
| 342 | 342 | ), |
| 343 | 343 | 'item' => array( |
| 344 | - 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'], |
|
| 345 | - 'url' => "index.php?a=78&id=" . $row['id'] |
|
| 344 | + 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'], |
|
| 345 | + 'url' => "index.php?a=78&id=".$row['id'] |
|
| 346 | 346 | ) |
| 347 | 347 | ); |
| 348 | 348 | if (!empty($row['description'])) {
|
| 349 | 349 | $contextmenu['seperator'] = ''; |
| 350 | 350 | $contextmenu['description'] = array( |
| 351 | - 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
|
| 351 | + 'innerHTML' => '<i class="fa fa-info"></i> '.$row['description'] |
|
| 352 | 352 | ); |
| 353 | 353 | } |
| 354 | 354 | } else {
|
| 355 | 355 | |
| 356 | 356 | $sql = $modx->db->query('SELECT *
|
| 357 | - FROM ' . $modx->getFullTableName('site_snippets') . '
|
|
| 358 | - WHERE name="' . $name . '" |
|
| 357 | + FROM ' . $modx->getFullTableName('site_snippets').'
|
|
| 358 | + WHERE name="' . $name.'" |
|
| 359 | 359 | LIMIT 1'); |
| 360 | 360 | |
| 361 | 361 | if ($modx->db->getRecordCount($sql)) {
|
| 362 | 362 | $row = $modx->db->getRow($sql); |
| 363 | 363 | $contextmenu = array( |
| 364 | 364 | 'header' => array( |
| 365 | - 'innerHTML' => '<i class="fa fa-code"></i> ' . $row['name'] |
|
| 365 | + 'innerHTML' => '<i class="fa fa-code"></i> '.$row['name'] |
|
| 366 | 366 | ), |
| 367 | 367 | 'item' => array( |
| 368 | - 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'], |
|
| 369 | - 'url' => "index.php?a=22&id=" . $row['id'] |
|
| 368 | + 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'], |
|
| 369 | + 'url' => "index.php?a=22&id=".$row['id'] |
|
| 370 | 370 | ) |
| 371 | 371 | ); |
| 372 | 372 | if (!empty($row['description'])) {
|
| 373 | 373 | $contextmenu['seperator'] = ''; |
| 374 | 374 | $contextmenu['description'] = array( |
| 375 | - 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
|
| 375 | + 'innerHTML' => '<i class="fa fa-info"></i> '.$row['description'] |
|
| 376 | 376 | ); |
| 377 | 377 | } |
| 378 | 378 | } else {
|
| 379 | 379 | $contextmenu = array( |
| 380 | 380 | 'header' => array( |
| 381 | - 'innerHTML' => '<i class="fa fa-code"></i> ' . $name |
|
| 381 | + 'innerHTML' => '<i class="fa fa-code"></i> '.$name |
|
| 382 | 382 | ), |
| 383 | 383 | 'item' => array( |
| 384 | - 'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_htmlsnippet'], |
|
| 385 | - 'url' => "index.php?a=77&itemname=" . $name |
|
| 384 | + 'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_htmlsnippet'], |
|
| 385 | + 'url' => "index.php?a=77&itemname=".$name |
|
| 386 | 386 | ), |
| 387 | 387 | 'item2' => array( |
| 388 | - 'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_snippet'], |
|
| 389 | - 'url' => "index.php?a=23&itemname=" . $name |
|
| 388 | + 'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_snippet'], |
|
| 389 | + 'url' => "index.php?a=23&itemname=".$name |
|
| 390 | 390 | ) |
| 391 | 391 | ); |
| 392 | 392 | } |
@@ -442,35 +442,35 @@ discard block |
||
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | $sql = $modx->db->query('SELECT *
|
| 445 | - FROM ' . $modx->getFullTableName('site_tmplvars') . '
|
|
| 446 | - WHERE name="' . $name . '" |
|
| 445 | + FROM ' . $modx->getFullTableName('site_tmplvars').'
|
|
| 446 | + WHERE name="' . $name.'" |
|
| 447 | 447 | LIMIT 1'); |
| 448 | 448 | |
| 449 | 449 | if ($modx->db->getRecordCount($sql)) {
|
| 450 | 450 | $row = $modx->db->getRow($sql); |
| 451 | 451 | $contextmenu = array( |
| 452 | 452 | 'header' => array( |
| 453 | - 'innerHTML' => '<i class="fa fa-list-alt"></i> ' . $row['name'] |
|
| 453 | + 'innerHTML' => '<i class="fa fa-list-alt"></i> '.$row['name'] |
|
| 454 | 454 | ), |
| 455 | 455 | 'item' => array( |
| 456 | - 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'], |
|
| 457 | - 'url' => "index.php?a=301&id=" . $row['id'] |
|
| 456 | + 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'], |
|
| 457 | + 'url' => "index.php?a=301&id=".$row['id'] |
|
| 458 | 458 | ) |
| 459 | 459 | ); |
| 460 | 460 | if (!empty($row['description'])) {
|
| 461 | 461 | $contextmenu['seperator'] = ''; |
| 462 | 462 | $contextmenu['description'] = array( |
| 463 | - 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
|
| 463 | + 'innerHTML' => '<i class="fa fa-info"></i> '.$row['description'] |
|
| 464 | 464 | ); |
| 465 | 465 | } |
| 466 | 466 | } else {
|
| 467 | 467 | $contextmenu = array( |
| 468 | 468 | 'header' => array( |
| 469 | - 'innerHTML' => '<i class="fa fa-list-alt"></i> ' . $name |
|
| 469 | + 'innerHTML' => '<i class="fa fa-list-alt"></i> '.$name |
|
| 470 | 470 | ), |
| 471 | 471 | 'item' => array( |
| 472 | - 'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_tmplvars'], |
|
| 473 | - 'url' => "index.php?a=300&itemname=" . $name |
|
| 472 | + 'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_tmplvars'], |
|
| 473 | + 'url' => "index.php?a=300&itemname=".$name |
|
| 474 | 474 | ) |
| 475 | 475 | ); |
| 476 | 476 | } |
@@ -489,15 +489,15 @@ discard block |
||
| 489 | 489 | $json = array(); |
| 490 | 490 | |
| 491 | 491 | if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) {
|
| 492 | - $id = !empty($_REQUEST['id']) ? (int)$_REQUEST['id'] : ''; |
|
| 493 | - $parent = isset($_REQUEST['parent']) ? (int)$_REQUEST['parent'] : 0; |
|
| 492 | + $id = !empty($_REQUEST['id']) ? (int) $_REQUEST['id'] : ''; |
|
| 493 | + $parent = isset($_REQUEST['parent']) ? (int) $_REQUEST['parent'] : 0; |
|
| 494 | 494 | $menuindex = isset($_REQUEST['menuindex']) && is_scalar($_REQUEST['menuindex']) ? $_REQUEST['menuindex'] : 0; |
| 495 | 495 | |
| 496 | 496 | // set parent |
| 497 | 497 | if ($id && $parent >= 0) {
|
| 498 | 498 | |
| 499 | 499 | // find older parent |
| 500 | - $parentOld = $modx->db->getValue($modx->db->select('parent', $modx->getFullTableName('site_content'), 'id=' . $id));
|
|
| 500 | + $parentOld = $modx->db->getValue($modx->db->select('parent', $modx->getFullTableName('site_content'), 'id='.$id));
|
|
| 501 | 501 | |
| 502 | 502 | $eventOut = $modx->invokeEvent('onBeforeMoveDocument', [
|
| 503 | 503 | 'id_document' => $id, |
@@ -518,7 +518,7 @@ discard block |
||
| 518 | 518 | if (empty($json['errors'])) {
|
| 519 | 519 | // check privileges user for move docs |
| 520 | 520 | if (!empty($modx->config['tree_show_protected']) && $role != 1) {
|
| 521 | - $sql = $modx->db->select('*', $modx->getFullTableName('document_groups'), 'document IN(' . $id . ',' . $parent . ',' . $parentOld . ')');
|
|
| 521 | + $sql = $modx->db->select('*', $modx->getFullTableName('document_groups'), 'document IN('.$id.','.$parent.','.$parentOld.')');
|
|
| 522 | 522 | if ($modx->db->getRecordCount($sql)) {
|
| 523 | 523 | $document_groups = array(); |
| 524 | 524 | while ($row = $modx->db->getRow($sql)) {
|
@@ -543,22 +543,22 @@ discard block |
||
| 543 | 543 | // set new parent |
| 544 | 544 | $modx->db->update(array( |
| 545 | 545 | 'parent' => $parent |
| 546 | - ), $modx->getFullTableName('site_content'), 'id=' . $id);
|
|
| 546 | + ), $modx->getFullTableName('site_content'), 'id='.$id);
|
|
| 547 | 547 | // set parent isfolder = 1 |
| 548 | 548 | $modx->db->update(array( |
| 549 | 549 | 'isfolder' => 1 |
| 550 | - ), $modx->getFullTableName('site_content'), 'id=' . $parent);
|
|
| 550 | + ), $modx->getFullTableName('site_content'), 'id='.$parent);
|
|
| 551 | 551 | |
| 552 | 552 | if ($parent != $parentOld) {
|
| 553 | 553 | // check children docs and set parent isfolder |
| 554 | - if ($modx->db->getRecordCount($modx->db->select('id', $modx->getFullTableName('site_content'), 'parent=' . $parentOld))) {
|
|
| 554 | + if ($modx->db->getRecordCount($modx->db->select('id', $modx->getFullTableName('site_content'), 'parent='.$parentOld))) {
|
|
| 555 | 555 | $modx->db->update(array( |
| 556 | 556 | 'isfolder' => 1 |
| 557 | - ), $modx->getFullTableName('site_content'), 'id=' . $parentOld);
|
|
| 557 | + ), $modx->getFullTableName('site_content'), 'id='.$parentOld);
|
|
| 558 | 558 | } else {
|
| 559 | 559 | $modx->db->update(array( |
| 560 | 560 | 'isfolder' => 0 |
| 561 | - ), $modx->getFullTableName('site_content'), 'id=' . $parentOld);
|
|
| 561 | + ), $modx->getFullTableName('site_content'), 'id='.$parentOld);
|
|
| 562 | 562 | } |
| 563 | 563 | } |
| 564 | 564 | |
@@ -566,7 +566,7 @@ discard block |
||
| 566 | 566 | if (!empty($menuindex)) {
|
| 567 | 567 | $menuindex = explode(',', $menuindex);
|
| 568 | 568 | foreach ($menuindex as $key => $value) {
|
| 569 | - $modx->db->query('UPDATE ' . $modx->getFullTableName('site_content') . ' SET menuindex=' . $key . ' WHERE id=' . $value);
|
|
| 569 | + $modx->db->query('UPDATE '.$modx->getFullTableName('site_content').' SET menuindex='.$key.' WHERE id='.$value);
|
|
| 570 | 570 | } |
| 571 | 571 | } else {
|
| 572 | 572 | // TODO: max(*) menuindex |
@@ -595,19 +595,19 @@ discard block |
||
| 595 | 595 | } |
| 596 | 596 | |
| 597 | 597 | case 'getLockedElements': {
|
| 598 | - $type = isset($_REQUEST['type']) ? (int)$_REQUEST['type'] : 0; |
|
| 599 | - $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
| 598 | + $type = isset($_REQUEST['type']) ? (int) $_REQUEST['type'] : 0; |
|
| 599 | + $id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
| 600 | 600 | |
| 601 | 601 | $output = !!$modx->elementIsLocked($type, $id, true); |
| 602 | 602 | |
| 603 | 603 | if (!$output) {
|
| 604 | 604 | $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : '';
|
| 605 | - $docgrp_cond = $docgrp ? ' OR dg.document_group IN (' . $docgrp . ')' : '';
|
|
| 605 | + $docgrp_cond = $docgrp ? ' OR dg.document_group IN ('.$docgrp.')' : '';
|
|
| 606 | 606 | $sql = ' |
| 607 | - SELECT MAX(IF(1=' . $role . ' OR sc.privatemgr=0' . $docgrp_cond . ', 0, 1)) AS locked |
|
| 608 | - FROM ' . $modx->getFullTableName('site_content') . ' AS sc
|
|
| 609 | - LEFT JOIN ' . $modx->getFullTableName('document_groups') . ' dg ON dg.document=sc.id
|
|
| 610 | - WHERE sc.id=' . $id . ' GROUP BY sc.id'; |
|
| 607 | + SELECT MAX(IF(1=' . $role.' OR sc.privatemgr=0'.$docgrp_cond.', 0, 1)) AS locked |
|
| 608 | + FROM ' . $modx->getFullTableName('site_content').' AS sc
|
|
| 609 | + LEFT JOIN ' . $modx->getFullTableName('document_groups').' dg ON dg.document=sc.id
|
|
| 610 | + WHERE sc.id=' . $id.' GROUP BY sc.id'; |
|
| 611 | 611 | $sql = $modx->db->query($sql); |
| 612 | 612 | if ($modx->db->getRecordCount($sql)) {
|
| 613 | 613 | $row = $modx->db->getRow($sql); |
@@ -7,11 +7,11 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | $modx->db->connect(); |
| 9 | 9 | |
| 10 | -if (empty ($modx->config)) {
|
|
| 10 | +if (empty ($modx->config)) { |
|
| 11 | 11 | $modx->getSettings(); |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | -if (!isset($_SESSION['mgrValidated']) || !isset($_SERVER['HTTP_X_REQUESTED_WITH']) || (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest') || ($_SERVER['REQUEST_METHOD'] != 'POST')) {
|
|
| 14 | +if (!isset($_SESSION['mgrValidated']) || !isset($_SERVER['HTTP_X_REQUESTED_WITH']) || (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest') || ($_SERVER['REQUEST_METHOD'] != 'POST')) { |
|
| 15 | 15 | $modx->sendErrorPage(); |
| 16 | 16 | } |
| 17 | 17 | |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | $_lang = array(); |
| 22 | 22 | include_once MODX_MANAGER_PATH . '/includes/lang/english.inc.php'; |
| 23 | -if ($modx->config['manager_language'] != 'english') {
|
|
| 23 | +if ($modx->config['manager_language'] != 'english') { |
|
| 24 | 24 | include_once MODX_MANAGER_PATH . '/includes/lang/' . $modx->config['manager_language'] . '.inc.php'; |
| 25 | 25 | } |
| 26 | 26 | include_once MODX_MANAGER_PATH . '/media/style/' . $modx->config['manager_theme'] . '/style.php'; |
@@ -33,12 +33,12 @@ discard block |
||
| 33 | 33 | // set limit sql query |
| 34 | 34 | $limit = !empty($modx->config['number_of_results']) ? (int) $modx->config['number_of_results'] : 100; |
| 35 | 35 | |
| 36 | -if (isset($action)) {
|
|
| 37 | - switch ($action) {
|
|
| 36 | +if (isset($action)) { |
|
| 37 | + switch ($action) { |
|
| 38 | 38 | |
| 39 | 39 | case '1': {
|
| 40 | 40 | |
| 41 | - switch ($frame) {
|
|
| 41 | + switch ($frame) { |
|
| 42 | 42 | case 'nodes': |
| 43 | 43 | include_once MODX_MANAGER_PATH . '/frames/nodes.php'; |
| 44 | 44 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | $elements = isset($_REQUEST['elements']) && is_scalar($_REQUEST['elements']) ? htmlentities($_REQUEST['elements']) : ''; |
| 54 | 54 | |
| 55 | - if ($elements) {
|
|
| 55 | + if ($elements) { |
|
| 56 | 56 | $output = ''; |
| 57 | 57 | $items = ''; |
| 58 | 58 | $sql = ''; |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | $sqlLike = $filter ? 'WHERE t1.name LIKE "' . $modx->db->escape($filter) . '%"' : ''; |
| 62 | 62 | $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit; |
| 63 | 63 | |
| 64 | - switch ($elements) {
|
|
| 64 | + switch ($elements) { |
|
| 65 | 65 | case 'element_templates': |
| 66 | 66 | $a = 16; |
| 67 | 67 | $sqlLike = $filter ? 'WHERE t1.templatename LIKE "' . $modx->db->escape($filter) . '%"' : ''; |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | ORDER BY t1.templatename ASC |
| 72 | 72 | ' . $sqlLimit); |
| 73 | 73 | |
| 74 | - if ($modx->hasPermission('new_template')) {
|
|
| 74 | + if ($modx->hasPermission('new_template')) { |
|
| 75 | 75 | $output .= '<li><a id="a_19" href="index.php?a=19" target="main"><i class="fa fa-plus"></i>' . $_lang['new_template'] . '</a></li>'; |
| 76 | 76 | } |
| 77 | 77 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | ORDER BY t1.name ASC |
| 88 | 88 | ' . $sqlLimit); |
| 89 | 89 | |
| 90 | - if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) {
|
|
| 90 | + if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) { |
|
| 91 | 91 | $output .= '<li><a id="a_300" href="index.php?a=300" target="main"><i class="fa fa-plus"></i>' . $_lang['new_tmplvars'] . '</a></li>'; |
| 92 | 92 | } |
| 93 | 93 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | ORDER BY t1.name ASC |
| 102 | 102 | ' . $sqlLimit); |
| 103 | 103 | |
| 104 | - if ($modx->hasPermission('new_chunk')) {
|
|
| 104 | + if ($modx->hasPermission('new_chunk')) { |
|
| 105 | 105 | $output .= '<li><a id="a_77" href="index.php?a=77" target="main"><i class="fa fa-plus"></i>' . $_lang['new_htmlsnippet'] . '</a></li>'; |
| 106 | 106 | } |
| 107 | 107 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | ORDER BY t1.name ASC |
| 116 | 116 | ' . $sqlLimit); |
| 117 | 117 | |
| 118 | - if ($modx->hasPermission('new_snippet')) {
|
|
| 118 | + if ($modx->hasPermission('new_snippet')) { |
|
| 119 | 119 | $output .= '<li><a id="a_23" href="index.php?a=23" target="main"><i class="fa fa-plus"></i>' . $_lang['new_snippet'] . '</a></li>'; |
| 120 | 120 | } |
| 121 | 121 | |
@@ -129,19 +129,19 @@ discard block |
||
| 129 | 129 | ORDER BY t1.name ASC |
| 130 | 130 | ' . $sqlLimit); |
| 131 | 131 | |
| 132 | - if ($modx->hasPermission('new_plugin')) {
|
|
| 132 | + if ($modx->hasPermission('new_plugin')) { |
|
| 133 | 133 | $output .= '<li><a id="a_101" href="index.php?a=101" target="main"><i class="fa fa-plus"></i>' . $_lang['new_plugin'] . '</a></li>'; |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | break; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - if ($count = $modx->db->getRecordCount($sql)) {
|
|
| 140 | - if ($count == $limit) {
|
|
| 139 | + if ($count = $modx->db->getRecordCount($sql)) { |
|
| 140 | + if ($count == $limit) { |
|
| 141 | 141 | $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>'; |
| 142 | 142 | } |
| 143 | - while ($row = $modx->db->getRow($sql)) {
|
|
| 144 | - if (($row['disabled'] || $row['locked']) && $role != 1) {
|
|
| 143 | + while ($row = $modx->db->getRow($sql)) { |
|
| 144 | + if (($row['disabled'] || $row['locked']) && $role != 1) { |
|
| 145 | 145 | continue; |
| 146 | 146 | } |
| 147 | 147 | |
@@ -149,9 +149,9 @@ discard block |
||
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - if (isset($_REQUEST['filter'])) {
|
|
| 152 | + if (isset($_REQUEST['filter'])) { |
|
| 153 | 153 | $output = $items; |
| 154 | - } else {
|
|
| 154 | + } else { |
|
| 155 | 155 | $output .= $items; |
| 156 | 156 | } |
| 157 | 157 | |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | $sqlLike = $filter ? 'WHERE t1.username LIKE "' . $modx->db->escape($filter) . '%"' : ''; |
| 170 | 170 | $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit; |
| 171 | 171 | |
| 172 | - if(!$modx->hasPermission('save_role')) {
|
|
| 172 | + if(!$modx->hasPermission('save_role')) { |
|
| 173 | 173 | $sqlLike .= $sqlLike ? ' AND ' : 'WHERE '; |
| 174 | 174 | $sqlLike .= 't2.role != 1'; |
| 175 | 175 | } |
@@ -181,22 +181,22 @@ discard block |
||
| 181 | 181 | ORDER BY t1.username ASC |
| 182 | 182 | ' . $sqlLimit); |
| 183 | 183 | |
| 184 | - if ($modx->hasPermission('new_user')) {
|
|
| 184 | + if ($modx->hasPermission('new_user')) { |
|
| 185 | 185 | $output .= '<li><a id="a_11" href="index.php?a=11" target="main"><i class="fa fa-plus"></i>' . $_lang['new_user'] . '</a></li>'; |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | - if ($count = $modx->db->getRecordCount($sql)) {
|
|
| 189 | - if ($count == $limit) {
|
|
| 188 | + if ($count = $modx->db->getRecordCount($sql)) { |
|
| 189 | + if ($count == $limit) { |
|
| 190 | 190 | $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>'; |
| 191 | 191 | } |
| 192 | - while ($row = $modx->db->getRow($sql)) {
|
|
| 192 | + while ($row = $modx->db->getRow($sql)) { |
|
| 193 | 193 | $items .= '<li class="item ' . ($row['blocked'] ? 'disabled' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>';
|
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | - if (isset($_REQUEST['filter'])) {
|
|
| 197 | + if (isset($_REQUEST['filter'])) { |
|
| 198 | 198 | $output = $items; |
| 199 | - } else {
|
|
| 199 | + } else { |
|
| 200 | 200 | $output .= $items; |
| 201 | 201 | } |
| 202 | 202 | |
@@ -220,22 +220,22 @@ discard block |
||
| 220 | 220 | ORDER BY t1.username ASC |
| 221 | 221 | ' . $sqlLimit); |
| 222 | 222 | |
| 223 | - if ($modx->hasPermission('new_web_user')) {
|
|
| 223 | + if ($modx->hasPermission('new_web_user')) { |
|
| 224 | 224 | $output .= '<li><a id="a_87" href="index.php?a=87" target="main"><i class="fa fa-plus"></i>' . $_lang['new_web_user'] . '</a></li>'; |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | - if ($count = $modx->db->getRecordCount($sql)) {
|
|
| 228 | - if ($count == $limit) {
|
|
| 227 | + if ($count = $modx->db->getRecordCount($sql)) { |
|
| 228 | + if ($count == $limit) { |
|
| 229 | 229 | $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>'; |
| 230 | 230 | } |
| 231 | - while ($row = $modx->db->getRow($sql)) {
|
|
| 231 | + while ($row = $modx->db->getRow($sql)) { |
|
| 232 | 232 | $items .= '<li class="item ' . ($row['blocked'] ? 'disabled' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>';
|
| 233 | 233 | } |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | - if (isset($_REQUEST['filter'])) {
|
|
| 236 | + if (isset($_REQUEST['filter'])) { |
|
| 237 | 237 | $output = $items; |
| 238 | - } else {
|
|
| 238 | + } else { |
|
| 239 | 239 | $output .= $items; |
| 240 | 240 | } |
| 241 | 241 | |
@@ -249,8 +249,8 @@ discard block |
||
| 249 | 249 | $type = isset($_REQUEST['type']) && is_scalar($_REQUEST['type']) ? $modx->db->escape($_REQUEST['type']) : false; |
| 250 | 250 | $contextmenu = ''; |
| 251 | 251 | |
| 252 | - if ($role && $name && $type) {
|
|
| 253 | - switch ($type) {
|
|
| 252 | + if ($role && $name && $type) { |
|
| 253 | + switch ($type) { |
|
| 254 | 254 | case 'Snippet': |
| 255 | 255 | case 'SnippetNoCache': {
|
| 256 | 256 | |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | WHERE name="' . $name . '" |
| 260 | 260 | LIMIT 1'); |
| 261 | 261 | |
| 262 | - if ($modx->db->getRecordCount($sql)) {
|
|
| 262 | + if ($modx->db->getRecordCount($sql)) { |
|
| 263 | 263 | $row = $modx->db->getRow($sql); |
| 264 | 264 | $contextmenu = array( |
| 265 | 265 | 'header' => array( |
@@ -270,13 +270,13 @@ discard block |
||
| 270 | 270 | 'url' => "index.php?a=22&id=" . $row['id'] |
| 271 | 271 | ) |
| 272 | 272 | ); |
| 273 | - if (!empty($row['description'])) {
|
|
| 273 | + if (!empty($row['description'])) { |
|
| 274 | 274 | $contextmenu['seperator'] = ''; |
| 275 | 275 | $contextmenu['description'] = array( |
| 276 | 276 | 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
| 277 | 277 | ); |
| 278 | 278 | } |
| 279 | - } else {
|
|
| 279 | + } else { |
|
| 280 | 280 | $contextmenu = array( |
| 281 | 281 | 'header' => array( |
| 282 | 282 | 'innerHTML' => '<i class="fa fa-code"></i> ' . $name |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | WHERE name="' . $name . '" |
| 298 | 298 | LIMIT 1'); |
| 299 | 299 | |
| 300 | - if ($modx->db->getRecordCount($sql)) {
|
|
| 300 | + if ($modx->db->getRecordCount($sql)) { |
|
| 301 | 301 | $row = $modx->db->getRow($sql); |
| 302 | 302 | $contextmenu = array( |
| 303 | 303 | 'header' => array( |
@@ -308,13 +308,13 @@ discard block |
||
| 308 | 308 | 'url' => "index.php?a=78&id=" . $row['id'] |
| 309 | 309 | ) |
| 310 | 310 | ); |
| 311 | - if (!empty($row['description'])) {
|
|
| 311 | + if (!empty($row['description'])) { |
|
| 312 | 312 | $contextmenu['seperator'] = ''; |
| 313 | 313 | $contextmenu['description'] = array( |
| 314 | 314 | 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
| 315 | 315 | ); |
| 316 | 316 | } |
| 317 | - } else {
|
|
| 317 | + } else { |
|
| 318 | 318 | $contextmenu = array( |
| 319 | 319 | 'header' => array( |
| 320 | 320 | 'innerHTML' => '<i class="fa fa-th-large"></i> ' . $name |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | WHERE name="' . $name . '" |
| 335 | 335 | LIMIT 1'); |
| 336 | 336 | |
| 337 | - if ($modx->db->getRecordCount($sql)) {
|
|
| 337 | + if ($modx->db->getRecordCount($sql)) { |
|
| 338 | 338 | $row = $modx->db->getRow($sql); |
| 339 | 339 | $contextmenu = array( |
| 340 | 340 | 'header' => array( |
@@ -345,20 +345,20 @@ discard block |
||
| 345 | 345 | 'url' => "index.php?a=78&id=" . $row['id'] |
| 346 | 346 | ) |
| 347 | 347 | ); |
| 348 | - if (!empty($row['description'])) {
|
|
| 348 | + if (!empty($row['description'])) { |
|
| 349 | 349 | $contextmenu['seperator'] = ''; |
| 350 | 350 | $contextmenu['description'] = array( |
| 351 | 351 | 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
| 352 | 352 | ); |
| 353 | 353 | } |
| 354 | - } else {
|
|
| 354 | + } else { |
|
| 355 | 355 | |
| 356 | 356 | $sql = $modx->db->query('SELECT *
|
| 357 | 357 | FROM ' . $modx->getFullTableName('site_snippets') . '
|
| 358 | 358 | WHERE name="' . $name . '" |
| 359 | 359 | LIMIT 1'); |
| 360 | 360 | |
| 361 | - if ($modx->db->getRecordCount($sql)) {
|
|
| 361 | + if ($modx->db->getRecordCount($sql)) { |
|
| 362 | 362 | $row = $modx->db->getRow($sql); |
| 363 | 363 | $contextmenu = array( |
| 364 | 364 | 'header' => array( |
@@ -369,13 +369,13 @@ discard block |
||
| 369 | 369 | 'url' => "index.php?a=22&id=" . $row['id'] |
| 370 | 370 | ) |
| 371 | 371 | ); |
| 372 | - if (!empty($row['description'])) {
|
|
| 372 | + if (!empty($row['description'])) { |
|
| 373 | 373 | $contextmenu['seperator'] = ''; |
| 374 | 374 | $contextmenu['description'] = array( |
| 375 | 375 | 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
| 376 | 376 | ); |
| 377 | 377 | } |
| 378 | - } else {
|
|
| 378 | + } else { |
|
| 379 | 379 | $contextmenu = array( |
| 380 | 380 | 'header' => array( |
| 381 | 381 | 'innerHTML' => '<i class="fa fa-code"></i> ' . $name |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | 'alias_visible' |
| 438 | 438 | ); |
| 439 | 439 | |
| 440 | - if (in_array($name, $default_field)) {
|
|
| 440 | + if (in_array($name, $default_field)) { |
|
| 441 | 441 | return; |
| 442 | 442 | } |
| 443 | 443 | |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | WHERE name="' . $name . '" |
| 447 | 447 | LIMIT 1'); |
| 448 | 448 | |
| 449 | - if ($modx->db->getRecordCount($sql)) {
|
|
| 449 | + if ($modx->db->getRecordCount($sql)) { |
|
| 450 | 450 | $row = $modx->db->getRow($sql); |
| 451 | 451 | $contextmenu = array( |
| 452 | 452 | 'header' => array( |
@@ -457,13 +457,13 @@ discard block |
||
| 457 | 457 | 'url' => "index.php?a=301&id=" . $row['id'] |
| 458 | 458 | ) |
| 459 | 459 | ); |
| 460 | - if (!empty($row['description'])) {
|
|
| 460 | + if (!empty($row['description'])) { |
|
| 461 | 461 | $contextmenu['seperator'] = ''; |
| 462 | 462 | $contextmenu['description'] = array( |
| 463 | 463 | 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
| 464 | 464 | ); |
| 465 | 465 | } |
| 466 | - } else {
|
|
| 466 | + } else { |
|
| 467 | 467 | $contextmenu = array( |
| 468 | 468 | 'header' => array( |
| 469 | 469 | 'innerHTML' => '<i class="fa fa-list-alt"></i> ' . $name |
@@ -488,13 +488,13 @@ discard block |
||
| 488 | 488 | case 'movedocument' : {
|
| 489 | 489 | $json = array(); |
| 490 | 490 | |
| 491 | - if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) {
|
|
| 491 | + if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) { |
|
| 492 | 492 | $id = !empty($_REQUEST['id']) ? (int)$_REQUEST['id'] : ''; |
| 493 | 493 | $parent = isset($_REQUEST['parent']) ? (int)$_REQUEST['parent'] : 0; |
| 494 | 494 | $menuindex = isset($_REQUEST['menuindex']) && is_scalar($_REQUEST['menuindex']) ? $_REQUEST['menuindex'] : 0; |
| 495 | 495 | |
| 496 | 496 | // set parent |
| 497 | - if ($id && $parent >= 0) {
|
|
| 497 | + if ($id && $parent >= 0) { |
|
| 498 | 498 | |
| 499 | 499 | // find older parent |
| 500 | 500 | $parentOld = $modx->db->getValue($modx->db->select('parent', $modx->getFullTableName('site_content'), 'id=' . $id));
|
@@ -505,31 +505,31 @@ discard block |
||
| 505 | 505 | 'new_parent' => $parent, |
| 506 | 506 | ]); |
| 507 | 507 | |
| 508 | - if (is_array($eventOut) && count($eventOut) > 0) {
|
|
| 508 | + if (is_array($eventOut) && count($eventOut) > 0) { |
|
| 509 | 509 | $eventParent = array_pop($eventOut); |
| 510 | 510 | |
| 511 | - if ($eventParent == $parentOld) {
|
|
| 511 | + if ($eventParent == $parentOld) { |
|
| 512 | 512 | $json['errors'] = $_lang['error_movedocument2']; |
| 513 | - } else {
|
|
| 513 | + } else { |
|
| 514 | 514 | $parent = $eventParent; |
| 515 | 515 | } |
| 516 | 516 | } |
| 517 | 517 | |
| 518 | - if (empty($json['errors'])) {
|
|
| 518 | + if (empty($json['errors'])) { |
|
| 519 | 519 | // check privileges user for move docs |
| 520 | - if (!empty($modx->config['tree_show_protected']) && $role != 1) {
|
|
| 520 | + if (!empty($modx->config['tree_show_protected']) && $role != 1) { |
|
| 521 | 521 | $sql = $modx->db->select('*', $modx->getFullTableName('document_groups'), 'document IN(' . $id . ',' . $parent . ',' . $parentOld . ')');
|
| 522 | - if ($modx->db->getRecordCount($sql)) {
|
|
| 522 | + if ($modx->db->getRecordCount($sql)) { |
|
| 523 | 523 | $document_groups = array(); |
| 524 | - while ($row = $modx->db->getRow($sql)) {
|
|
| 524 | + while ($row = $modx->db->getRow($sql)) { |
|
| 525 | 525 | $document_groups[$row['document']]['groups'][] = $row['document_group']; |
| 526 | 526 | } |
| 527 | - foreach ($document_groups as $key => $value) {
|
|
| 528 | - if (($key == $parent || $key == $parentOld || $key == $id) && !in_array($role, $value['groups'])) {
|
|
| 527 | + foreach ($document_groups as $key => $value) { |
|
| 528 | + if (($key == $parent || $key == $parentOld || $key == $id) && !in_array($role, $value['groups'])) { |
|
| 529 | 529 | $json['errors'] = $_lang["error_no_privileges"]; |
| 530 | 530 | } |
| 531 | 531 | } |
| 532 | - if ($json['errors']) {
|
|
| 532 | + if ($json['errors']) { |
|
| 533 | 533 | header('content-type: application/json');
|
| 534 | 534 | echo json_encode($json, JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE); |
| 535 | 535 | break; |
@@ -537,9 +537,9 @@ discard block |
||
| 537 | 537 | } |
| 538 | 538 | } |
| 539 | 539 | |
| 540 | - if ($parent == 0 && $parent != $parentOld && !$modx->config['udperms_allowroot'] && $role != 1) {
|
|
| 540 | + if ($parent == 0 && $parent != $parentOld && !$modx->config['udperms_allowroot'] && $role != 1) { |
|
| 541 | 541 | $json['errors'] = $_lang["error_no_privileges"]; |
| 542 | - } else {
|
|
| 542 | + } else { |
|
| 543 | 543 | // set new parent |
| 544 | 544 | $modx->db->update(array( |
| 545 | 545 | 'parent' => $parent |
@@ -549,13 +549,13 @@ discard block |
||
| 549 | 549 | 'isfolder' => 1 |
| 550 | 550 | ), $modx->getFullTableName('site_content'), 'id=' . $parent);
|
| 551 | 551 | |
| 552 | - if ($parent != $parentOld) {
|
|
| 552 | + if ($parent != $parentOld) { |
|
| 553 | 553 | // check children docs and set parent isfolder |
| 554 | - if ($modx->db->getRecordCount($modx->db->select('id', $modx->getFullTableName('site_content'), 'parent=' . $parentOld))) {
|
|
| 554 | + if ($modx->db->getRecordCount($modx->db->select('id', $modx->getFullTableName('site_content'), 'parent=' . $parentOld))) { |
|
| 555 | 555 | $modx->db->update(array( |
| 556 | 556 | 'isfolder' => 1 |
| 557 | 557 | ), $modx->getFullTableName('site_content'), 'id=' . $parentOld);
|
| 558 | - } else {
|
|
| 558 | + } else { |
|
| 559 | 559 | $modx->db->update(array( |
| 560 | 560 | 'isfolder' => 0 |
| 561 | 561 | ), $modx->getFullTableName('site_content'), 'id=' . $parentOld);
|
@@ -563,16 +563,16 @@ discard block |
||
| 563 | 563 | } |
| 564 | 564 | |
| 565 | 565 | // set menuindex |
| 566 | - if (!empty($menuindex)) {
|
|
| 566 | + if (!empty($menuindex)) { |
|
| 567 | 567 | $menuindex = explode(',', $menuindex);
|
| 568 | - foreach ($menuindex as $key => $value) {
|
|
| 568 | + foreach ($menuindex as $key => $value) { |
|
| 569 | 569 | $modx->db->query('UPDATE ' . $modx->getFullTableName('site_content') . ' SET menuindex=' . $key . ' WHERE id=' . $value);
|
| 570 | 570 | } |
| 571 | - } else {
|
|
| 571 | + } else { |
|
| 572 | 572 | // TODO: max(*) menuindex |
| 573 | 573 | } |
| 574 | 574 | |
| 575 | - if (!$json['errors']) {
|
|
| 575 | + if (!$json['errors']) { |
|
| 576 | 576 | $json['success'] = $_lang["actioncomplete"]; |
| 577 | 577 | |
| 578 | 578 | $modx->invokeEvent('onAfterMoveDocument', [
|
@@ -584,7 +584,7 @@ discard block |
||
| 584 | 584 | } |
| 585 | 585 | } |
| 586 | 586 | } |
| 587 | - } else {
|
|
| 587 | + } else { |
|
| 588 | 588 | $json['errors'] = $_lang["error_no_privileges"]; |
| 589 | 589 | } |
| 590 | 590 | |
@@ -600,7 +600,7 @@ discard block |
||
| 600 | 600 | |
| 601 | 601 | $output = !!$modx->elementIsLocked($type, $id, true); |
| 602 | 602 | |
| 603 | - if (!$output) {
|
|
| 603 | + if (!$output) { |
|
| 604 | 604 | $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : '';
|
| 605 | 605 | $docgrp_cond = $docgrp ? ' OR dg.document_group IN (' . $docgrp . ')' : '';
|
| 606 | 606 | $sql = ' |
@@ -609,7 +609,7 @@ discard block |
||
| 609 | 609 | LEFT JOIN ' . $modx->getFullTableName('document_groups') . ' dg ON dg.document=sc.id
|
| 610 | 610 | WHERE sc.id=' . $id . ' GROUP BY sc.id'; |
| 611 | 611 | $sql = $modx->db->query($sql); |
| 612 | - if ($modx->db->getRecordCount($sql)) {
|
|
| 612 | + if ($modx->db->getRecordCount($sql)) { |
|
| 613 | 613 | $row = $modx->db->getRow($sql); |
| 614 | 614 | $output = !!$row['locked']; |
| 615 | 615 | } |