@@ -1,5 +1,5 @@ discard block |
||
| 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 | header("X-XSS-Protection: 0");
|
@@ -11,22 +11,22 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | $mxla = $modx_lang_attribute ? $modx_lang_attribute : 'en'; |
| 13 | 13 | |
| 14 | -if (!isset($modx->config['manager_menu_height'])) {
|
|
| 14 | +if (!isset($modx->config['manager_menu_height'])) { |
|
| 15 | 15 | $modx->config['manager_menu_height'] = 2.2; // rem |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -if (!isset($modx->config['manager_tree_width'])) {
|
|
| 18 | +if (!isset($modx->config['manager_tree_width'])) { |
|
| 19 | 19 | $modx->config['manager_tree_width'] = 20; // rem |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | -if (isset($_SESSION['onLoginForwardToAction']) && is_int($_SESSION['onLoginForwardToAction'])) {
|
|
| 22 | +if (isset($_SESSION['onLoginForwardToAction']) && is_int($_SESSION['onLoginForwardToAction'])) { |
|
| 23 | 23 | $initMainframeAction = $_SESSION['onLoginForwardToAction']; |
| 24 | 24 | unset($_SESSION['onLoginForwardToAction']); |
| 25 | -} else {
|
|
| 25 | +} else { |
|
| 26 | 26 | $initMainframeAction = 2; // welcome.static |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | -if (!isset($_SESSION['tree_show_only_folders'])) {
|
|
| 29 | +if (!isset($_SESSION['tree_show_only_folders'])) { |
|
| 30 | 30 | $_SESSION['tree_show_only_folders'] = 0; |
| 31 | 31 | } |
| 32 | 32 | |
@@ -35,29 +35,29 @@ discard block |
||
| 35 | 35 | $tree_width = $modx->config['manager_tree_width']; |
| 36 | 36 | $tree_min_width = 0; |
| 37 | 37 | |
| 38 | -if (isset($_COOKIE['MODX_widthSideBar'])) {
|
|
| 38 | +if (isset($_COOKIE['MODX_widthSideBar'])) { |
|
| 39 | 39 | $MODX_widthSideBar = $_COOKIE['MODX_widthSideBar']; |
| 40 | -} else {
|
|
| 40 | +} else { |
|
| 41 | 41 | $MODX_widthSideBar = $tree_width; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | -if (!$MODX_widthSideBar) {
|
|
| 44 | +if (!$MODX_widthSideBar) { |
|
| 45 | 45 | $body_class .= 'sidebar-closed'; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | $theme_modes = array('', 'lightness', 'light', 'dark', 'darkness');
|
| 49 | -if (!empty($theme_modes[$_COOKIE['MODX_themeMode']])) {
|
|
| 49 | +if (!empty($theme_modes[$_COOKIE['MODX_themeMode']])) { |
|
| 50 | 50 | $body_class .= ' ' . $theme_modes[$_COOKIE['MODX_themeMode']]; |
| 51 | -} elseif (!empty($theme_modes[$modx->config['manager_theme_mode']])) {
|
|
| 51 | +} elseif (!empty($theme_modes[$modx->config['manager_theme_mode']])) { |
|
| 52 | 52 | $body_class .= ' ' . $theme_modes[$modx->config['manager_theme_mode']]; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | $navbar_position = $modx->config['manager_menu_position']; |
| 56 | -if ($navbar_position == 'left') {
|
|
| 56 | +if ($navbar_position == 'left') { |
|
| 57 | 57 | $body_class .= ' navbar-left navbar-left-icon-and-text'; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | -if (isset($modx->pluginCache['ElementsInTree'])) {
|
|
| 60 | +if (isset($modx->pluginCache['ElementsInTree'])) { |
|
| 61 | 61 | $body_class .= ' ElementsInTree'; |
| 62 | 62 | } |
| 63 | 63 | |
@@ -73,19 +73,19 @@ discard block |
||
| 73 | 73 | 'type8' => $_lang["lock_element_type_8"] |
| 74 | 74 | ); |
| 75 | 75 | |
| 76 | -foreach ($unlockTranslations as $key => $value) {
|
|
| 76 | +foreach ($unlockTranslations as $key => $value) { |
|
| 77 | 77 | $unlockTranslations[$key] = iconv($modx->config["modx_charset"], "utf-8", $value); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | $user = $modx->getUserInfo($modx->getLoginUserID()); |
| 81 | -if ($user['which_browser'] == 'default') {
|
|
| 81 | +if ($user['which_browser'] == 'default') { |
|
| 82 | 82 | $user['which_browser'] = $modx->config['which_browser']; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | $css = 'media/style/' . $modx->config['manager_theme'] . '/css/page.css?v=' . $lastInstallTime; |
| 86 | 86 | |
| 87 | -if ($modx->config['manager_theme'] == 'default') {
|
|
| 88 | - if (!file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css') && is_writable(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css')) {
|
|
| 87 | +if ($modx->config['manager_theme'] == 'default') { |
|
| 88 | + if (!file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css') && is_writable(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css')) { |
|
| 89 | 89 | require_once MODX_BASE_PATH . 'assets/lib/Formatter/CSSMinify.php'; |
| 90 | 90 | $minifier = new Formatter\CSSMinify(); |
| 91 | 91 | $minifier->addFile(MODX_MANAGER_PATH . 'media/style/common/bootstrap/css/bootstrap.min.css'); |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | $css = $minifier->minify(); |
| 103 | 103 | file_put_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css', $css); |
| 104 | 104 | } |
| 105 | - if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) {
|
|
| 105 | + if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) { |
|
| 106 | 106 | $css = 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css?v=' . $lastInstallTime; |
| 107 | 107 | } |
| 108 | 108 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | <meta name="theme-color" content="#1d2023" /> |
| 120 | 120 | <meta http-equiv="X-UA-Compatible" content="IE=edge" /> |
| 121 | 121 | <link rel="stylesheet" type="text/css" href="<?= $css ?>" /> |
| 122 | - <?php if ($modx->config['show_picker'] != "0") {
|
|
| 122 | + <?php if ($modx->config['show_picker'] != "0") { |
|
| 123 | 123 | ?> |
| 124 | 124 | <link rel="stylesheet" href="media/style/common/spectrum/spectrum.css" /> |
| 125 | 125 | <link rel="stylesheet" type="text/css" href="media/style/<?= $modx->config['manager_theme'] ?>/css/color.switcher.css" /> |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | ?> |
| 252 | 252 | </script> |
| 253 | 253 | <script src="media/style/<?= $modx->config['manager_theme'] ?>/js/modx.min.js?v=<?= $lastInstallTime ?>"></script> |
| 254 | - <?php if ($modx->config['show_picker'] != "0") {
|
|
| 254 | + <?php if ($modx->config['show_picker'] != "0") { |
|
| 255 | 255 | ?> |
| 256 | 256 | <script src="media/script/bootstrap/js/bootstrap.min.js" type="text/javascript"></script> |
| 257 | 257 | <script src="media/script/spectrum/spectrum.evo.min.js" type="text/javascript"></script> |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | <?php |
| 262 | 262 | // invoke OnManagerTopPrerender event |
| 263 | 263 | $evtOut = $modx->invokeEvent('OnManagerTopPrerender', $_REQUEST);
|
| 264 | - if (is_array($evtOut)) {
|
|
| 264 | + if (is_array($evtOut)) { |
|
| 265 | 265 | echo implode("\n", $evtOut);
|
| 266 | 266 | } |
| 267 | 267 | ?> |
@@ -287,14 +287,14 @@ discard block |
||
| 287 | 287 | <div class="mask"></div> |
| 288 | 288 | </form> |
| 289 | 289 | </li> |
| 290 | - <?php if ($modx->config['show_newresource_btn'] != "0") {
|
|
| 290 | + <?php if ($modx->config['show_newresource_btn'] != "0") { |
|
| 291 | 291 | ?> |
| 292 | - <?php if ($modx->hasPermission('new_document')) {
|
|
| 292 | + <?php if ($modx->hasPermission('new_document')) { |
|
| 293 | 293 | ?> |
| 294 | 294 | <li id="newresource" class="dropdown newresource"> |
| 295 | 295 | <a href="javascript:;" class="dropdown-toggle" onclick="return false;" title="<?= $_lang['add_resource'] ?>"><?= $_style['menu_new_resource'] ?></a> |
| 296 | 296 | <ul class="dropdown-menu"> |
| 297 | - <?php if ($modx->hasPermission('new_document')) {
|
|
| 297 | + <?php if ($modx->hasPermission('new_document')) { |
|
| 298 | 298 | ?> |
| 299 | 299 | <li> |
| 300 | 300 | <a onclick="" href="index.php?a=4" target="main"> |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | </li> |
| 309 | 309 | <?php |
| 310 | 310 | } ?> |
| 311 | - <?php if ($use_browser && $modx->hasPermission('assets_images')) {
|
|
| 311 | + <?php if ($use_browser && $modx->hasPermission('assets_images')) { |
|
| 312 | 312 | ?> |
| 313 | 313 | <li> |
| 314 | 314 | <a onclick="" href="media/browser/<?= $which_browser ?>/browse.php?&type=images" target="main"> |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | </li> |
| 318 | 318 | <?php |
| 319 | 319 | } ?> |
| 320 | - <?php if ($use_browser && $modx->hasPermission('assets_files')) {
|
|
| 320 | + <?php if ($use_browser && $modx->hasPermission('assets_files')) { |
|
| 321 | 321 | ?> |
| 322 | 322 | <li> |
| 323 | 323 | <a onclick="" href="media/browser/<?= $which_browser ?>/browse.php?&type=files" target="main"> |
@@ -340,11 +340,11 @@ discard block |
||
| 340 | 340 | <li id="account" class="dropdown account"> |
| 341 | 341 | <a href="javascript:;" class="dropdown-toggle" onclick="return false;"> |
| 342 | 342 | <span class="username"><?= $user['username'] ?></span> |
| 343 | - <?php if ($user['photo']) {
|
|
| 343 | + <?php if ($user['photo']) { |
|
| 344 | 344 | ?> |
| 345 | 345 | <span class="icon photo" style="background-image: url(<?= MODX_SITE_URL . $user['photo'] ?>);"></span> |
| 346 | 346 | <?php |
| 347 | - } else {
|
|
| 347 | + } else { |
|
| 348 | 348 | ?> |
| 349 | 349 | <span class="icon"><?= $_style['menu_user'] ?></span> |
| 350 | 350 | <?php |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | <?php if ($modx->hasPermission('messages')): ?>
|
| 356 | 356 | <li id="newMail"></li> |
| 357 | 357 | <?php endif; ?> |
| 358 | - <?php if ($modx->hasPermission('change_password')) {
|
|
| 358 | + <?php if ($modx->hasPermission('change_password')) { |
|
| 359 | 359 | ?> |
| 360 | 360 | <li> |
| 361 | 361 | <a onclick="" href="index.php?a=28" target="main"> |
@@ -378,12 +378,12 @@ discard block |
||
| 378 | 378 | ?> |
| 379 | 379 | </ul> |
| 380 | 380 | </li> |
| 381 | - <?php if ($modx->hasPermission('settings') || $modx->hasPermission('view_eventlog') || $modx->hasPermission('logs') || $modx->hasPermission('help')) {
|
|
| 381 | + <?php if ($modx->hasPermission('settings') || $modx->hasPermission('view_eventlog') || $modx->hasPermission('logs') || $modx->hasPermission('help')) { |
|
| 382 | 382 | ?> |
| 383 | 383 | <li id="system" class="dropdown"> |
| 384 | 384 | <a href="javascript:;" class="dropdown-toggle" title="<?= $_lang['system'] ?>" onclick="return false;"><?= $_style['menu_system'] ?></a> |
| 385 | 385 | <ul class="dropdown-menu"> |
| 386 | - <?php if ($modx->hasPermission('settings')) {
|
|
| 386 | + <?php if ($modx->hasPermission('settings')) { |
|
| 387 | 387 | ?> |
| 388 | 388 | <li> |
| 389 | 389 | <a href="index.php?a=17" target="main"> |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | </li> |
| 393 | 393 | <?php |
| 394 | 394 | } ?> |
| 395 | - <?php if ($modx->hasPermission('view_eventlog')) {
|
|
| 395 | + <?php if ($modx->hasPermission('view_eventlog')) { |
|
| 396 | 396 | ?> |
| 397 | 397 | <li> |
| 398 | 398 | <a href="index.php?a=70" target="main"> |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | </li> |
| 402 | 402 | <?php |
| 403 | 403 | } ?> |
| 404 | - <?php if ($modx->hasPermission('view_eventlog')) {
|
|
| 404 | + <?php if ($modx->hasPermission('view_eventlog')) { |
|
| 405 | 405 | ?> |
| 406 | 406 | <li> |
| 407 | 407 | <a href="index.php?a=114" target="main"> |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | </li> |
| 411 | 411 | <?php |
| 412 | 412 | } ?> |
| 413 | - <?php if ($modx->hasPermission('logs')) {
|
|
| 413 | + <?php if ($modx->hasPermission('logs')) { |
|
| 414 | 414 | ?> |
| 415 | 415 | <li> |
| 416 | 416 | <a href="index.php?a=13" target="main"> |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | </li> |
| 425 | 425 | <?php |
| 426 | 426 | } ?> |
| 427 | - <?php if ($modx->hasPermission('help')) {
|
|
| 427 | + <?php if ($modx->hasPermission('help')) { |
|
| 428 | 428 | ?> |
| 429 | 429 | <li> |
| 430 | 430 | <a href="index.php?a=9" target="main"> |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | </li> |
| 438 | 438 | <?php |
| 439 | 439 | } ?> |
| 440 | - <?php if ($modx->config['show_fullscreen_btn'] != "0") {
|
|
| 440 | + <?php if ($modx->config['show_fullscreen_btn'] != "0") { |
|
| 441 | 441 | ?> |
| 442 | 442 | <li id="fullscreen"> |
| 443 | 443 | <a href="javascript:;" onclick="toggleFullScreen();" id="toggleFullScreen" title="<?= $_lang["toggle_fullscreen"] ?>"> |
@@ -462,11 +462,14 @@ discard block |
||
| 462 | 462 | <div id="evo-tab-page-home" class="evo-tab-page show iframe-scroller"> |
| 463 | 463 | <iframe id="mainframe" src="index.php?a=<?= $initMainframeAction ?>" scrolling="auto" frameborder="0" onload="modx.main.onload(event);"></iframe> |
| 464 | 464 | </div> |
| 465 | - <?php else: ?> |
|
| 465 | + <?php else { |
|
| 466 | + : ?> |
|
| 466 | 467 | <div class="iframe-scroller"> |
| 467 | 468 | <iframe id="mainframe" name="main" src="index.php?a=<?= $initMainframeAction ?>" scrolling="auto" frameborder="0" onload="modx.main.onload(event);"></iframe> |
| 468 | 469 | </div> |
| 469 | - <?php endif; ?> |
|
| 470 | + <?php endif; |
|
| 471 | +} |
|
| 472 | +?> |
|
| 470 | 473 | <script> |
| 471 | 474 | if (/iPhone|iPad|iPod/i.test(navigator.userAgent)) {
|
| 472 | 475 | document.getElementById('mainframe').setAttribute('scrolling', 'no');
|
@@ -485,11 +488,11 @@ discard block |
||
| 485 | 488 | 'tree_sortdir', |
| 486 | 489 | 'tree_nodename' |
| 487 | 490 | ); |
| 488 | - foreach ($sortParams as $param) {
|
|
| 489 | - if (isset($_REQUEST[$param])) {
|
|
| 491 | + foreach ($sortParams as $param) { |
|
| 492 | + if (isset($_REQUEST[$param])) { |
|
| 490 | 493 | $modx->manager->saveLastUserSetting($param, $_REQUEST[$param]); |
| 491 | 494 | $_SESSION[$param] = $_REQUEST[$param]; |
| 492 | - } elseif (!isset($_SESSION[$param])) {
|
|
| 495 | + } elseif (!isset($_SESSION[$param])) { |
|
| 493 | 496 | $_SESSION[$param] = $modx->manager->getLastUserSetting($param); |
| 494 | 497 | } |
| 495 | 498 | } |
@@ -575,9 +578,9 @@ discard block |
||
| 575 | 578 | * @param string $text |
| 576 | 579 | * @param bool $allowed |
| 577 | 580 | */ |
| 578 | - function constructLink($action, $img, $text, $allowed) |
|
| 579 | - {
|
|
| 580 | - if ((bool)$allowed) {
|
|
| 581 | + function constructLink($action, $img, $text, $allowed) |
|
| 582 | + { |
|
| 583 | + if ((bool)$allowed) { |
|
| 581 | 584 | echo sprintf('<div class="menuLink" id="item%s" onclick="modx.tree.menuHandler(%s);">', $action, $action);
|
| 582 | 585 | echo sprintf('<i class="%s"></i> %s</div>', $img, $text);
|
| 583 | 586 | } |
@@ -588,7 +591,7 @@ discard block |
||
| 588 | 591 | <script type="text/javascript"> |
| 589 | 592 | |
| 590 | 593 | if (document.getElementById('treeMenu')) {
|
| 591 | - <?php if ($modx->hasPermission('edit_template') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_plugin')) {
|
|
| 594 | + <?php if ($modx->hasPermission('edit_template') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_plugin')) { |
|
| 592 | 595 | ?> |
| 593 | 596 | |
| 594 | 597 | document.getElementById('treeMenu_openelements').onclick = function(e) {
|
@@ -608,7 +611,7 @@ discard block |
||
| 608 | 611 | }; |
| 609 | 612 | <?php |
| 610 | 613 | } ?> |
| 611 | - <?php if ($use_browser && $modx->hasPermission('assets_images')) {
|
|
| 614 | + <?php if ($use_browser && $modx->hasPermission('assets_images')) { |
|
| 612 | 615 | ?> |
| 613 | 616 | |
| 614 | 617 | document.getElementById('treeMenu_openimages').onclick = function(e) {
|
@@ -628,7 +631,7 @@ discard block |
||
| 628 | 631 | }; |
| 629 | 632 | <?php |
| 630 | 633 | } ?> |
| 631 | - <?php if ($use_browser && $modx->hasPermission('assets_files')) {
|
|
| 634 | + <?php if ($use_browser && $modx->hasPermission('assets_files')) { |
|
| 632 | 635 | ?> |
| 633 | 636 | |
| 634 | 637 | document.getElementById('treeMenu_openfiles').onclick = function(e) {
|
@@ -652,7 +655,7 @@ discard block |
||
| 652 | 655 | } |
| 653 | 656 | |
| 654 | 657 | </script> |
| 655 | - <?php if ($modx->config['show_fullscreen_btn'] != "0") {
|
|
| 658 | + <?php if ($modx->config['show_fullscreen_btn'] != "0") { |
|
| 656 | 659 | ?> |
| 657 | 660 | <script> |
| 658 | 661 | function toggleFullScreen() |
@@ -690,7 +693,7 @@ discard block |
||
| 690 | 693 | ?> |
| 691 | 694 | |
| 692 | 695 | </div> |
| 693 | -<?php if ($modx->config['show_picker'] != "0") {
|
|
| 696 | +<?php if ($modx->config['show_picker'] != "0") { |
|
| 694 | 697 | include('media/style/' . $modx->config['manager_theme'] . '/color.switcher.php');
|
| 695 | 698 | } ?> |
| 696 | 699 | </body> |
@@ -22,7 +22,8 @@ discard block |
||
| 22 | 22 | // ABSTRACT PUBLIC METHODS |
| 23 | 23 | |
| 24 | 24 | public function resize($width, $height) |
| 25 | - {// |
|
| 25 | + { |
|
| 26 | +// |
|
| 26 | 27 | if (!$width) { |
| 27 | 28 | $width = 1; |
| 28 | 29 | } |
@@ -40,7 +41,8 @@ discard block |
||
| 40 | 41 | } |
| 41 | 42 | |
| 42 | 43 | public function resizeFit($width, $height, $background=false) |
| 43 | - {// |
|
| 44 | + { |
|
| 45 | +// |
|
| 44 | 46 | if (!$width) { |
| 45 | 47 | $width = 1; |
| 46 | 48 | } |
@@ -12,8 +12,8 @@ discard block |
||
| 12 | 12 | * @link http://kcfinder.sunhater.com |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | -class gd |
|
| 16 | -{
|
|
| 15 | +class gd |
|
| 16 | +{ |
|
| 17 | 17 | |
| 18 | 18 | /** GD resource |
| 19 | 19 | * @var resource */ |
@@ -41,20 +41,20 @@ discard block |
||
| 41 | 41 | * @param mixed $image |
| 42 | 42 | * @return array */ |
| 43 | 43 | |
| 44 | - protected function build_image($image) |
|
| 45 | - {
|
|
| 46 | - if ($image instanceof gd) {
|
|
| 44 | + protected function build_image($image) |
|
| 45 | + { |
|
| 46 | + if ($image instanceof gd) { |
|
| 47 | 47 | $width = $image->get_width(); |
| 48 | 48 | $height = $image->get_height(); |
| 49 | 49 | $image = $image->get_image(); |
| 50 | - } elseif (is_resource($image) && (get_resource_type($image) == "gd")) {
|
|
| 50 | + } elseif (is_resource($image) && (get_resource_type($image) == "gd")) { |
|
| 51 | 51 | $width = @imagesx($image); |
| 52 | 52 | $height = @imagesy($image); |
| 53 | - } elseif (is_array($image)) {
|
|
| 53 | + } elseif (is_array($image)) { |
|
| 54 | 54 | list($key, $width) = each($image); |
| 55 | 55 | list($key, $height) = each($image); |
| 56 | 56 | $image = imagecreatetruecolor($width, $height); |
| 57 | - } elseif (false !== (list($width, $height, $type) = @getimagesize($image))) {
|
|
| 57 | + } elseif (false !== (list($width, $height, $type) = @getimagesize($image))) { |
|
| 58 | 58 | $image = |
| 59 | 59 | ($type == IMAGETYPE_GIF) ? @imagecreatefromgif($image) : ( |
| 60 | 60 | ($type == IMAGETYPE_WBMP) ? @imagecreatefromwbmp($image) : ( |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | ($type == IMAGETYPE_XBM) ? @imagecreatefromxbm($image) : false |
| 65 | 65 | ))))); |
| 66 | 66 | |
| 67 | - if ($type == IMAGETYPE_PNG) {
|
|
| 67 | + if ($type == IMAGETYPE_PNG) { |
|
| 68 | 68 | imagealphablending($image, false); |
| 69 | 69 | } |
| 70 | 70 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | ? array($image, $width, $height) |
| 81 | 81 | : false; |
| 82 | 82 | |
| 83 | - if (($return !== false) && isset($type)) {
|
|
| 83 | + if (($return !== false) && isset($type)) { |
|
| 84 | 84 | $this->type = $type; |
| 85 | 85 | } |
| 86 | 86 | |
@@ -98,22 +98,22 @@ discard block |
||
| 98 | 98 | * @param integer $bigger_size |
| 99 | 99 | * @return gd */ |
| 100 | 100 | |
| 101 | - public function __construct($image, $bigger_size=null) |
|
| 102 | - {
|
|
| 101 | + public function __construct($image, $bigger_size=null) |
|
| 102 | + { |
|
| 103 | 103 | $this->image = $this->width = $this->height = null; |
| 104 | 104 | |
| 105 | 105 | $image_details = $this->build_image($image); |
| 106 | 106 | |
| 107 | - if ($image_details !== false) {
|
|
| 107 | + if ($image_details !== false) { |
|
| 108 | 108 | list($this->image, $this->width, $this->height) = $image_details; |
| 109 | - } else {
|
|
| 109 | + } else { |
|
| 110 | 110 | $this->init_error = true; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | if (!is_null($this->image) && |
| 114 | 114 | !is_null($bigger_size) && |
| 115 | 115 | (preg_match('/^[1-9][0-9]*$/', $bigger_size) !== false)
|
| 116 | - ) {
|
|
| 116 | + ) { |
|
| 117 | 117 | $image = $this->image; |
| 118 | 118 | list($width, $height) = $this->get_prop_size($bigger_size); |
| 119 | 119 | $this->image = imagecreatetruecolor($width, $height); |
@@ -128,24 +128,24 @@ discard block |
||
| 128 | 128 | /** Returns the GD resource |
| 129 | 129 | * @return resource */ |
| 130 | 130 | |
| 131 | - public function get_image() |
|
| 132 | - {
|
|
| 131 | + public function get_image() |
|
| 132 | + { |
|
| 133 | 133 | return $this->image; |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /** Returns the image width |
| 137 | 137 | * @return integer */ |
| 138 | 138 | |
| 139 | - public function get_width() |
|
| 140 | - {
|
|
| 139 | + public function get_width() |
|
| 140 | + { |
|
| 141 | 141 | return $this->width; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | /** Returns the image height |
| 145 | 145 | * @return integer */ |
| 146 | 146 | |
| 147 | - public function get_height() |
|
| 148 | - {
|
|
| 147 | + public function get_height() |
|
| 148 | + { |
|
| 149 | 149 | return $this->height; |
| 150 | 150 | } |
| 151 | 151 | |
@@ -153,10 +153,10 @@ discard block |
||
| 153 | 153 | * @param integer $resized_height |
| 154 | 154 | * @return integer */ |
| 155 | 155 | |
| 156 | - public function get_prop_width($resized_height) |
|
| 157 | - {
|
|
| 156 | + public function get_prop_width($resized_height) |
|
| 157 | + { |
|
| 158 | 158 | $width = intval(($this->width * $resized_height) / $this->height); |
| 159 | - if (!$width) {
|
|
| 159 | + if (!$width) { |
|
| 160 | 160 | $width = 1; |
| 161 | 161 | } |
| 162 | 162 | return $width; |
@@ -166,10 +166,10 @@ discard block |
||
| 166 | 166 | * @param integer $resized_width |
| 167 | 167 | * @return integer */ |
| 168 | 168 | |
| 169 | - public function get_prop_height($resized_width) |
|
| 170 | - {
|
|
| 169 | + public function get_prop_height($resized_width) |
|
| 170 | + { |
|
| 171 | 171 | $height = intval(($this->height * $resized_width) / $this->width); |
| 172 | - if (!$height) {
|
|
| 172 | + if (!$height) { |
|
| 173 | 173 | $height = 1; |
| 174 | 174 | } |
| 175 | 175 | return $height; |
@@ -181,15 +181,15 @@ discard block |
||
| 181 | 181 | * @param integer $bigger_size |
| 182 | 182 | * @return array */ |
| 183 | 183 | |
| 184 | - public function get_prop_size($bigger_size) |
|
| 185 | - {
|
|
| 186 | - if ($this->width > $this->height) {
|
|
| 184 | + public function get_prop_size($bigger_size) |
|
| 185 | + { |
|
| 186 | + if ($this->width > $this->height) { |
|
| 187 | 187 | $width = $bigger_size; |
| 188 | 188 | $height = $this->get_prop_height($width); |
| 189 | - } elseif ($this->height > $this->width) {
|
|
| 189 | + } elseif ($this->height > $this->width) { |
|
| 190 | 190 | $height = $bigger_size; |
| 191 | 191 | $width = $this->get_prop_width($height); |
| 192 | - } else {
|
|
| 192 | + } else { |
|
| 193 | 193 | $width = $height = $bigger_size; |
| 194 | 194 | } |
| 195 | 195 | |
@@ -201,12 +201,12 @@ discard block |
||
| 201 | 201 | * @param integer $height |
| 202 | 202 | * @return bool */ |
| 203 | 203 | |
| 204 | - public function resize($width, $height) |
|
| 205 | - {
|
|
| 206 | - if (!$width) {
|
|
| 204 | + public function resize($width, $height) |
|
| 205 | + { |
|
| 206 | + if (!$width) { |
|
| 207 | 207 | $width = 1; |
| 208 | 208 | } |
| 209 | - if (!$height) {
|
|
| 209 | + if (!$height) { |
|
| 210 | 210 | $height = 1; |
| 211 | 211 | } |
| 212 | 212 | return ( |
@@ -223,19 +223,19 @@ discard block |
||
| 223 | 223 | * @param mixed $src |
| 224 | 224 | * @return bool */ |
| 225 | 225 | |
| 226 | - public function resize_crop($src) |
|
| 227 | - {
|
|
| 226 | + public function resize_crop($src) |
|
| 227 | + { |
|
| 228 | 228 | $image_details = $this->build_image($src); |
| 229 | 229 | |
| 230 | - if ($image_details !== false) {
|
|
| 230 | + if ($image_details !== false) { |
|
| 231 | 231 | list($src, $src_width, $src_height) = $image_details; |
| 232 | 232 | |
| 233 | - if (($src_width / $src_height) > ($this->width / $this->height)) {
|
|
| 233 | + if (($src_width / $src_height) > ($this->width / $this->height)) { |
|
| 234 | 234 | $src_w = $this->get_prop_width($src_height); |
| 235 | 235 | $src_h = $src_height; |
| 236 | 236 | $src_x = intval(($src_width - $src_w) / 2); |
| 237 | 237 | $src_y = 0; |
| 238 | - } else {
|
|
| 238 | + } else { |
|
| 239 | 239 | $src_w = $src_width; |
| 240 | 240 | $src_h = $this->get_prop_height($src_width); |
| 241 | 241 | $src_x = 0; |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | return imagecopyresampled($this->image, $src, 0, 0, $src_x, $src_y, $this->width, $this->height, $src_w, $src_h); |
| 246 | - } else {
|
|
| 246 | + } else { |
|
| 247 | 247 | return false; |
| 248 | 248 | } |
| 249 | 249 | } |
@@ -253,20 +253,20 @@ discard block |
||
| 253 | 253 | * @param integer $height |
| 254 | 254 | * @return bool */ |
| 255 | 255 | |
| 256 | - public function resize_fit($width, $height) |
|
| 257 | - {
|
|
| 258 | - if ((!$width && !$height) || (($width == $this->width) && ($height == $this->height))) {
|
|
| 256 | + public function resize_fit($width, $height) |
|
| 257 | + { |
|
| 258 | + if ((!$width && !$height) || (($width == $this->width) && ($height == $this->height))) { |
|
| 259 | 259 | return true; |
| 260 | 260 | } |
| 261 | - if (!$width || (($height / $width) < ($this->height / $this->width))) {
|
|
| 261 | + if (!$width || (($height / $width) < ($this->height / $this->width))) { |
|
| 262 | 262 | $width = intval(($this->width * $height) / $this->height); |
| 263 | - } elseif (!$height || (($width / $height) < ($this->width / $this->height))) {
|
|
| 263 | + } elseif (!$height || (($width / $height) < ($this->width / $this->height))) { |
|
| 264 | 264 | $height = intval(($this->height * $width) / $this->width); |
| 265 | 265 | } |
| 266 | - if (!$width) {
|
|
| 266 | + if (!$width) { |
|
| 267 | 267 | $width = 1; |
| 268 | 268 | } |
| 269 | - if (!$height) {
|
|
| 269 | + if (!$height) { |
|
| 270 | 270 | $height = 1; |
| 271 | 271 | } |
| 272 | 272 | return $this->resize($width, $height); |
@@ -279,8 +279,8 @@ discard block |
||
| 279 | 279 | * @param integer $height |
| 280 | 280 | * @return bool */ |
| 281 | 281 | |
| 282 | - public function resize_overflow($width, $height) |
|
| 283 | - {
|
|
| 282 | + public function resize_overflow($width, $height) |
|
| 283 | + { |
|
| 284 | 284 | $big = (($this->width / $this->height) > ($width / $height)) |
| 285 | 285 | ? ($this->width * $height) / $this->height |
| 286 | 286 | : ($this->height * $width) / $this->width; |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | |
| 289 | 289 | $return = ($img = new gd($this->image, $big)); |
| 290 | 290 | |
| 291 | - if ($return) {
|
|
| 291 | + if ($return) { |
|
| 292 | 292 | $this->image = $img->get_image(); |
| 293 | 293 | $this->width = $img->get_width(); |
| 294 | 294 | $this->height = $img->get_height(); |
@@ -297,8 +297,8 @@ discard block |
||
| 297 | 297 | return $return; |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | - public function gd_color() |
|
| 301 | - {
|
|
| 300 | + public function gd_color() |
|
| 301 | + { |
|
| 302 | 302 | $args = func_get_args(); |
| 303 | 303 | |
| 304 | 304 | $expr_rgb = '/^rgb\(\s*(\d{1,3})\s*\,\s*(\d{1,3})\s*\,\s*(\d{1,3})\s*\)$/i';
|
@@ -306,20 +306,20 @@ discard block |
||
| 306 | 306 | $expr_hex2 = '/^\#?([0-9a-f])([0-9a-f])([0-9a-f])$/i'; |
| 307 | 307 | $expr_byte = '/^([01]?\d?\d|2[0-4]\d|25[0-5])$/'; |
| 308 | 308 | |
| 309 | - if (!isset($args[0])) {
|
|
| 309 | + if (!isset($args[0])) { |
|
| 310 | 310 | return false; |
| 311 | 311 | } |
| 312 | 312 | |
| 313 | - if (count($args[0]) == 3) {
|
|
| 313 | + if (count($args[0]) == 3) { |
|
| 314 | 314 | list($r, $g, $b) = $args[0]; |
| 315 | - } elseif (preg_match($expr_rgb, $args[0])) {
|
|
| 315 | + } elseif (preg_match($expr_rgb, $args[0])) { |
|
| 316 | 316 | list($r, $g, $b) = explode(" ", preg_replace($expr_rgb, "$1 $2 $3", $args[0]));
|
| 317 | - } elseif (preg_match($expr_hex1, $args[0])) {
|
|
| 317 | + } elseif (preg_match($expr_hex1, $args[0])) { |
|
| 318 | 318 | list($r, $g, $b) = explode(" ", preg_replace($expr_hex1, "$1 $2 $3", $args[0]));
|
| 319 | 319 | $r = hexdec($r); |
| 320 | 320 | $g = hexdec($g); |
| 321 | 321 | $b = hexdec($b); |
| 322 | - } elseif (preg_match($expr_hex2, $args[0])) {
|
|
| 322 | + } elseif (preg_match($expr_hex2, $args[0])) { |
|
| 323 | 323 | list($r, $g, $b) = explode(" ", preg_replace($expr_hex2, "$1$1 $2$2 $3$3", $args[0]));
|
| 324 | 324 | $r = hexdec($r); |
| 325 | 325 | $g = hexdec($g); |
@@ -328,17 +328,17 @@ discard block |
||
| 328 | 328 | preg_match($expr_byte, $args[0]) && |
| 329 | 329 | preg_match($expr_byte, $args[1]) && |
| 330 | 330 | preg_match($expr_byte, $args[2]) |
| 331 | - ) {
|
|
| 331 | + ) { |
|
| 332 | 332 | list($r, $g, $b) = $args; |
| 333 | - } else {
|
|
| 333 | + } else { |
|
| 334 | 334 | return false; |
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | return imagecolorallocate($this->image, $r, $g, $b); |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | - public function fill_color($color) |
|
| 341 | - {
|
|
| 340 | + public function fill_color($color) |
|
| 341 | + { |
|
| 342 | 342 | return $this->imagefilledrectangle(0, 0, $this->width - 1, $this->height - 1, $color); |
| 343 | 343 | } |
| 344 | 344 | |
@@ -351,26 +351,26 @@ discard block |
||
| 351 | 351 | $src_x=0, $src_y=0, |
| 352 | 352 | $dst_w=null, $dst_h=null, |
| 353 | 353 | $src_w=null, $src_h=null |
| 354 | - ) {
|
|
| 354 | + ) { |
|
| 355 | 355 | $image_details = $this->build_image($src); |
| 356 | 356 | |
| 357 | - if ($image_details !== false) {
|
|
| 357 | + if ($image_details !== false) { |
|
| 358 | 358 | list($src, $src_width, $src_height) = $image_details; |
| 359 | 359 | |
| 360 | - if (is_null($dst_w)) {
|
|
| 360 | + if (is_null($dst_w)) { |
|
| 361 | 361 | $dst_w = $this->width - $dst_x; |
| 362 | 362 | } |
| 363 | - if (is_null($dst_h)) {
|
|
| 363 | + if (is_null($dst_h)) { |
|
| 364 | 364 | $dst_h = $this->height - $dst_y; |
| 365 | 365 | } |
| 366 | - if (is_null($src_w)) {
|
|
| 366 | + if (is_null($src_w)) { |
|
| 367 | 367 | $src_w = $src_width - $src_x; |
| 368 | 368 | } |
| 369 | - if (is_null($src_h)) {
|
|
| 369 | + if (is_null($src_h)) { |
|
| 370 | 370 | $src_h = $src_height - $src_y; |
| 371 | 371 | } |
| 372 | 372 | return imagecopy($this->image, $src, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h); |
| 373 | - } else {
|
|
| 373 | + } else { |
|
| 374 | 374 | return false; |
| 375 | 375 | } |
| 376 | 376 | } |
@@ -381,22 +381,22 @@ discard block |
||
| 381 | 381 | $src_x=0, $src_y=0, |
| 382 | 382 | $dst_w=null, $dst_h=null, |
| 383 | 383 | $src_w=null, $src_h=null |
| 384 | - ) {
|
|
| 384 | + ) { |
|
| 385 | 385 | $image_details = $this->build_image($src); |
| 386 | 386 | |
| 387 | - if ($image_details !== false) {
|
|
| 387 | + if ($image_details !== false) { |
|
| 388 | 388 | list($src, $src_width, $src_height) = $image_details; |
| 389 | 389 | |
| 390 | - if (is_null($dst_w)) {
|
|
| 390 | + if (is_null($dst_w)) { |
|
| 391 | 391 | $dst_w = $this->width - $dst_x; |
| 392 | 392 | } |
| 393 | - if (is_null($dst_h)) {
|
|
| 393 | + if (is_null($dst_h)) { |
|
| 394 | 394 | $dst_h = $this->height - $dst_y; |
| 395 | 395 | } |
| 396 | - if (is_null($src_w)) {
|
|
| 396 | + if (is_null($src_w)) { |
|
| 397 | 397 | $src_w = $src_width - $src_x; |
| 398 | 398 | } |
| 399 | - if (is_null($src_h)) {
|
|
| 399 | + if (is_null($src_h)) { |
|
| 400 | 400 | $src_h = $src_height - $src_y; |
| 401 | 401 | } |
| 402 | 402 | imagealphablending($this->image, false); |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | |
| 410 | 410 | $transindex = imagecolortransparent($src); |
| 411 | 411 | $palletsize = imagecolorstotal($src); |
| 412 | - if ($transindex >= 0 && $transindex < $palletsize) {
|
|
| 412 | + if ($transindex >= 0 && $transindex < $palletsize) { |
|
| 413 | 413 | $transcol = imagecolorsforindex($src, $transindex); |
| 414 | 414 | |
| 415 | 415 | /*** end gif transparent fix ***/ |
@@ -418,54 +418,54 @@ discard block |
||
| 418 | 418 | imagefilledrectangle($this->image, 0, 0, $dst_w, $dst_h, $transindex); |
| 419 | 419 | imagecopyresampled($this->image, $src, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h); |
| 420 | 420 | imagecolortransparent($this->image, $transindex); |
| 421 | - for ($y=0; $y<$dst_h; ++$y) {
|
|
| 422 | - for ($x=0; $x<$dst_w; ++$x) {
|
|
| 423 | - if (((imagecolorat($this->image, $x, $y)>>24) & 0x7F) >= 100) {
|
|
| 421 | + for ($y=0; $y<$dst_h; ++$y) { |
|
| 422 | + for ($x=0; $x<$dst_w; ++$x) { |
|
| 423 | + if (((imagecolorat($this->image, $x, $y)>>24) & 0x7F) >= 100) { |
|
| 424 | 424 | imagesetpixel($this->image, $x, $y, $transindex); |
| 425 | 425 | } |
| 426 | 426 | } |
| 427 | 427 | } |
| 428 | 428 | imagetruecolortopalette($this->image, true, 255); |
| 429 | - } else {
|
|
| 429 | + } else { |
|
| 430 | 430 | $transparent = imagecolorallocatealpha($this->image, 255, 255, 255, 127); |
| 431 | 431 | imagefilledrectangle($this->image, 0, 0, $dst_w, $dst_h, $transparent); |
| 432 | 432 | imagecopyresampled($this->image, $src, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h); |
| 433 | 433 | } |
| 434 | 434 | return $this->image; |
| 435 | - } else {
|
|
| 435 | + } else { |
|
| 436 | 436 | return false; |
| 437 | 437 | } |
| 438 | 438 | } |
| 439 | 439 | |
| 440 | - public function imagefilledrectangle($x1, $y1, $x2, $y2, $color) |
|
| 441 | - {
|
|
| 440 | + public function imagefilledrectangle($x1, $y1, $x2, $y2, $color) |
|
| 441 | + { |
|
| 442 | 442 | $color = $this->gd_color($color); |
| 443 | - if ($color === false) {
|
|
| 443 | + if ($color === false) { |
|
| 444 | 444 | return false; |
| 445 | 445 | } |
| 446 | 446 | return imagefilledrectangle($this->image, $x1, $y1, $x2, $y2, $color); |
| 447 | 447 | } |
| 448 | 448 | |
| 449 | - public function imagepng($filename=null, $quality=null, $filters=null) |
|
| 450 | - {
|
|
| 451 | - if (is_null($filename) && !headers_sent()) {
|
|
| 449 | + public function imagepng($filename=null, $quality=null, $filters=null) |
|
| 450 | + { |
|
| 451 | + if (is_null($filename) && !headers_sent()) { |
|
| 452 | 452 | header("Content-Type: image/png");
|
| 453 | 453 | } |
| 454 | 454 | @imagesavealpha($this->image, true); |
| 455 | 455 | return imagepng($this->image, $filename, $quality, $filters); |
| 456 | 456 | } |
| 457 | 457 | |
| 458 | - public function imagejpeg($filename=null, $quality=75) |
|
| 459 | - {
|
|
| 460 | - if (is_null($filename) && !headers_sent()) {
|
|
| 458 | + public function imagejpeg($filename=null, $quality=75) |
|
| 459 | + { |
|
| 460 | + if (is_null($filename) && !headers_sent()) { |
|
| 461 | 461 | header("Content-Type: image/jpeg");
|
| 462 | 462 | } |
| 463 | 463 | return imagejpeg($this->image, $filename, $quality); |
| 464 | 464 | } |
| 465 | 465 | |
| 466 | - public function imagegif($filename=null) |
|
| 467 | - {
|
|
| 468 | - if (is_null($filename) && !headers_sent()) {
|
|
| 466 | + public function imagegif($filename=null) |
|
| 467 | + { |
|
| 468 | + if (is_null($filename) && !headers_sent()) { |
|
| 469 | 469 | header("Content-Type: image/gif");
|
| 470 | 470 | } |
| 471 | 471 | @imagesavealpha($this->image, true); |
@@ -10,15 +10,15 @@ |
||
| 10 | 10 | } |
| 11 | 11 | }; |
| 12 | 12 | <?php |
| 13 | - if (isset($_GET['type'])) {
|
|
| 13 | + if (isset($_GET['type'])) { |
|
| 14 | 14 | $type = htmlspecialchars(trim($_GET['type']), ENT_QUOTES); |
| 15 | - } elseif (isset($_GET['Type'])) {
|
|
| 15 | + } elseif (isset($_GET['Type'])) { |
|
| 16 | 16 | $type = htmlspecialchars(trim($_GET['Type']), ENT_QUOTES); |
| 17 | - } else {
|
|
| 17 | + } else { |
|
| 18 | 18 | $type = 'images'; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - if ($type==='image') {
|
|
| 21 | + if ($type==='image') { |
|
| 22 | 22 | $type = 'images'; |
| 23 | 23 | } |
| 24 | 24 | |
@@ -10,12 +10,12 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | $style_path = 'media/style/' . $modx->config['manager_theme'] . '/images/'; |
| 12 | 12 | $modx->config['mgr_date_picker_path'] = 'media/calendar/datepicker.inc.php'; |
| 13 | -if (!$modx->config['lang_code']) {
|
|
| 13 | +if (!$modx->config['lang_code']) { |
|
| 14 | 14 | global $modx_lang_attribute; |
| 15 | 15 | $modx->config['lang_code'] = !$modx_lang_attribute ? 'en' : $modx_lang_attribute; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -if ($_GET['a'] == 2) {
|
|
| 18 | +if ($_GET['a'] == 2) { |
|
| 19 | 19 | include_once('welcome.php');
|
| 20 | 20 | } |
| 21 | 21 | |
@@ -262,68 +262,68 @@ discard block |
||
| 262 | 262 | |
| 263 | 263 | // actions buttons templates |
| 264 | 264 | $action = isset($_REQUEST['a']) ? $_REQUEST['a'] : ''; |
| 265 | -if (!empty($modx->config['global_tabs']) && !isset($_SESSION['stay'])) {
|
|
| 265 | +if (!empty($modx->config['global_tabs']) && !isset($_SESSION['stay'])) { |
|
| 266 | 266 | $_REQUEST['stay'] = 2; |
| 267 | 267 | } |
| 268 | -if (isset($_REQUEST['stay'])) {
|
|
| 268 | +if (isset($_REQUEST['stay'])) { |
|
| 269 | 269 | $_SESSION['stay'] = $_REQUEST['stay']; |
| 270 | -} elseif (isset($_SESSION['stay'])) {
|
|
| 270 | +} elseif (isset($_SESSION['stay'])) { |
|
| 271 | 271 | $_REQUEST['stay'] = $_SESSION['stay']; |
| 272 | 272 | } |
| 273 | 273 | $stay = isset($_REQUEST['stay']) ? $_REQUEST['stay'] : ''; |
| 274 | 274 | $addnew = 0; |
| 275 | 275 | $run = 0; |
| 276 | -switch ($action) {
|
|
| 276 | +switch ($action) { |
|
| 277 | 277 | case '3': |
| 278 | 278 | case '4': |
| 279 | 279 | case '27': |
| 280 | 280 | case '72': |
| 281 | - if ($modx->hasPermission('new_document')) {
|
|
| 281 | + if ($modx->hasPermission('new_document')) { |
|
| 282 | 282 | $addnew = 1; |
| 283 | 283 | } |
| 284 | 284 | break; |
| 285 | 285 | case '16': |
| 286 | 286 | case '19': |
| 287 | - if ($modx->hasPermission('new_template')) {
|
|
| 287 | + if ($modx->hasPermission('new_template')) { |
|
| 288 | 288 | $addnew = 1; |
| 289 | 289 | } |
| 290 | 290 | break; |
| 291 | 291 | case '300': |
| 292 | 292 | case '301': |
| 293 | - if ($modx->hasPermission('new_snippet') && $modx->hasPermission('new_chunk') && $modx->hasPermission('new_plugin')) {
|
|
| 293 | + if ($modx->hasPermission('new_snippet') && $modx->hasPermission('new_chunk') && $modx->hasPermission('new_plugin')) { |
|
| 294 | 294 | $addnew = 1; |
| 295 | 295 | } |
| 296 | 296 | break; |
| 297 | 297 | case '77': |
| 298 | 298 | case '78': |
| 299 | - if ($modx->hasPermission('new_chunk')) {
|
|
| 299 | + if ($modx->hasPermission('new_chunk')) { |
|
| 300 | 300 | $addnew = 1; |
| 301 | 301 | } |
| 302 | 302 | break; |
| 303 | 303 | case '22': |
| 304 | 304 | case '23': |
| 305 | - if ($modx->hasPermission('new_snippet')) {
|
|
| 305 | + if ($modx->hasPermission('new_snippet')) { |
|
| 306 | 306 | $addnew = 1; |
| 307 | 307 | } |
| 308 | 308 | break; |
| 309 | 309 | case '101': |
| 310 | 310 | case '102': |
| 311 | - if ($modx->hasPermission('new_plugin')) {
|
|
| 311 | + if ($modx->hasPermission('new_plugin')) { |
|
| 312 | 312 | $addnew = 1; |
| 313 | 313 | } |
| 314 | 314 | break; |
| 315 | 315 | case '106': |
| 316 | 316 | case '107': |
| 317 | 317 | case '108': |
| 318 | - if ($modx->hasPermission('new_module')) {
|
|
| 318 | + if ($modx->hasPermission('new_module')) { |
|
| 319 | 319 | $addnew = 1; |
| 320 | 320 | } |
| 321 | - if ($modx->hasPermission('exec_module')) {
|
|
| 321 | + if ($modx->hasPermission('exec_module')) { |
|
| 322 | 322 | $run = 1; |
| 323 | 323 | } |
| 324 | 324 | break; |
| 325 | 325 | case '88': |
| 326 | - if ($modx->hasPermission('new_web_user')) {
|
|
| 326 | + if ($modx->hasPermission('new_web_user')) { |
|
| 327 | 327 | $addnew = 1; |
| 328 | 328 | } |
| 329 | 329 | break; |
@@ -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 | |
@@ -176,22 +176,22 @@ discard block |
||
| 176 | 176 | ORDER BY t1.username ASC |
| 177 | 177 | ' . $sqlLimit); |
| 178 | 178 | |
| 179 | - if ($modx->hasPermission('new_user')) {
|
|
| 179 | + if ($modx->hasPermission('new_user')) { |
|
| 180 | 180 | $output .= '<li><a id="a_11" href="index.php?a=11" target="main"><i class="fa fa-plus"></i>' . $_lang['new_user'] . '</a></li>'; |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - if ($count = $modx->db->getRecordCount($sql)) {
|
|
| 184 | - if ($count == $limit) {
|
|
| 183 | + if ($count = $modx->db->getRecordCount($sql)) { |
|
| 184 | + if ($count == $limit) { |
|
| 185 | 185 | $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>'; |
| 186 | 186 | } |
| 187 | - while ($row = $modx->db->getRow($sql)) {
|
|
| 187 | + while ($row = $modx->db->getRow($sql)) { |
|
| 188 | 188 | $items .= '<li class="item ' . ($row['blocked'] ? 'disabled' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>';
|
| 189 | 189 | } |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - if (isset($_REQUEST['filter'])) {
|
|
| 192 | + if (isset($_REQUEST['filter'])) { |
|
| 193 | 193 | $output = $items; |
| 194 | - } else {
|
|
| 194 | + } else { |
|
| 195 | 195 | $output .= $items; |
| 196 | 196 | } |
| 197 | 197 | |
@@ -215,22 +215,22 @@ discard block |
||
| 215 | 215 | ORDER BY t1.username ASC |
| 216 | 216 | ' . $sqlLimit); |
| 217 | 217 | |
| 218 | - if ($modx->hasPermission('new_web_user')) {
|
|
| 218 | + if ($modx->hasPermission('new_web_user')) { |
|
| 219 | 219 | $output .= '<li><a id="a_87" href="index.php?a=87" target="main"><i class="fa fa-plus"></i>' . $_lang['new_web_user'] . '</a></li>'; |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | - if ($count = $modx->db->getRecordCount($sql)) {
|
|
| 223 | - if ($count == $limit) {
|
|
| 222 | + if ($count = $modx->db->getRecordCount($sql)) { |
|
| 223 | + if ($count == $limit) { |
|
| 224 | 224 | $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>'; |
| 225 | 225 | } |
| 226 | - while ($row = $modx->db->getRow($sql)) {
|
|
| 226 | + while ($row = $modx->db->getRow($sql)) { |
|
| 227 | 227 | $items .= '<li class="item ' . ($row['blocked'] ? 'disabled' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>';
|
| 228 | 228 | } |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | - if (isset($_REQUEST['filter'])) {
|
|
| 231 | + if (isset($_REQUEST['filter'])) { |
|
| 232 | 232 | $output = $items; |
| 233 | - } else {
|
|
| 233 | + } else { |
|
| 234 | 234 | $output .= $items; |
| 235 | 235 | } |
| 236 | 236 | |
@@ -244,8 +244,8 @@ discard block |
||
| 244 | 244 | $type = isset($_REQUEST['type']) && is_scalar($_REQUEST['type']) ? $modx->db->escape($_REQUEST['type']) : false; |
| 245 | 245 | $contextmenu = ''; |
| 246 | 246 | |
| 247 | - if ($role && $name && $type) {
|
|
| 248 | - switch ($type) {
|
|
| 247 | + if ($role && $name && $type) { |
|
| 248 | + switch ($type) { |
|
| 249 | 249 | case 'Snippet': |
| 250 | 250 | case 'SnippetNoCache': {
|
| 251 | 251 | |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | WHERE name="' . $name . '" |
| 255 | 255 | LIMIT 1'); |
| 256 | 256 | |
| 257 | - if ($modx->db->getRecordCount($sql)) {
|
|
| 257 | + if ($modx->db->getRecordCount($sql)) { |
|
| 258 | 258 | $row = $modx->db->getRow($sql); |
| 259 | 259 | $contextmenu = array( |
| 260 | 260 | 'header' => array( |
@@ -265,13 +265,13 @@ discard block |
||
| 265 | 265 | 'url' => "index.php?a=22&id=" . $row['id'] |
| 266 | 266 | ) |
| 267 | 267 | ); |
| 268 | - if (!empty($row['description'])) {
|
|
| 268 | + if (!empty($row['description'])) { |
|
| 269 | 269 | $contextmenu['seperator'] = ''; |
| 270 | 270 | $contextmenu['description'] = array( |
| 271 | 271 | 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
| 272 | 272 | ); |
| 273 | 273 | } |
| 274 | - } else {
|
|
| 274 | + } else { |
|
| 275 | 275 | $contextmenu = array( |
| 276 | 276 | 'header' => array( |
| 277 | 277 | 'innerHTML' => '<i class="fa fa-code"></i> ' . $name |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | WHERE name="' . $name . '" |
| 293 | 293 | LIMIT 1'); |
| 294 | 294 | |
| 295 | - if ($modx->db->getRecordCount($sql)) {
|
|
| 295 | + if ($modx->db->getRecordCount($sql)) { |
|
| 296 | 296 | $row = $modx->db->getRow($sql); |
| 297 | 297 | $contextmenu = array( |
| 298 | 298 | 'header' => array( |
@@ -303,13 +303,13 @@ discard block |
||
| 303 | 303 | 'url' => "index.php?a=78&id=" . $row['id'] |
| 304 | 304 | ) |
| 305 | 305 | ); |
| 306 | - if (!empty($row['description'])) {
|
|
| 306 | + if (!empty($row['description'])) { |
|
| 307 | 307 | $contextmenu['seperator'] = ''; |
| 308 | 308 | $contextmenu['description'] = array( |
| 309 | 309 | 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
| 310 | 310 | ); |
| 311 | 311 | } |
| 312 | - } else {
|
|
| 312 | + } else { |
|
| 313 | 313 | $contextmenu = array( |
| 314 | 314 | 'header' => array( |
| 315 | 315 | 'innerHTML' => '<i class="fa fa-th-large"></i> ' . $name |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | WHERE name="' . $name . '" |
| 330 | 330 | LIMIT 1'); |
| 331 | 331 | |
| 332 | - if ($modx->db->getRecordCount($sql)) {
|
|
| 332 | + if ($modx->db->getRecordCount($sql)) { |
|
| 333 | 333 | $row = $modx->db->getRow($sql); |
| 334 | 334 | $contextmenu = array( |
| 335 | 335 | 'header' => array( |
@@ -340,19 +340,19 @@ discard block |
||
| 340 | 340 | 'url' => "index.php?a=78&id=" . $row['id'] |
| 341 | 341 | ) |
| 342 | 342 | ); |
| 343 | - if (!empty($row['description'])) {
|
|
| 343 | + if (!empty($row['description'])) { |
|
| 344 | 344 | $contextmenu['seperator'] = ''; |
| 345 | 345 | $contextmenu['description'] = array( |
| 346 | 346 | 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
| 347 | 347 | ); |
| 348 | 348 | } |
| 349 | - } else {
|
|
| 349 | + } else { |
|
| 350 | 350 | $sql = $modx->db->query('SELECT *
|
| 351 | 351 | FROM ' . $modx->getFullTableName('site_snippets') . '
|
| 352 | 352 | WHERE name="' . $name . '" |
| 353 | 353 | LIMIT 1'); |
| 354 | 354 | |
| 355 | - if ($modx->db->getRecordCount($sql)) {
|
|
| 355 | + if ($modx->db->getRecordCount($sql)) { |
|
| 356 | 356 | $row = $modx->db->getRow($sql); |
| 357 | 357 | $contextmenu = array( |
| 358 | 358 | 'header' => array( |
@@ -363,13 +363,13 @@ discard block |
||
| 363 | 363 | 'url' => "index.php?a=22&id=" . $row['id'] |
| 364 | 364 | ) |
| 365 | 365 | ); |
| 366 | - if (!empty($row['description'])) {
|
|
| 366 | + if (!empty($row['description'])) { |
|
| 367 | 367 | $contextmenu['seperator'] = ''; |
| 368 | 368 | $contextmenu['description'] = array( |
| 369 | 369 | 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
| 370 | 370 | ); |
| 371 | 371 | } |
| 372 | - } else {
|
|
| 372 | + } else { |
|
| 373 | 373 | $contextmenu = array( |
| 374 | 374 | 'header' => array( |
| 375 | 375 | 'innerHTML' => '<i class="fa fa-code"></i> ' . $name |
@@ -431,7 +431,7 @@ discard block |
||
| 431 | 431 | 'alias_visible' |
| 432 | 432 | ); |
| 433 | 433 | |
| 434 | - if (in_array($name, $default_field)) {
|
|
| 434 | + if (in_array($name, $default_field)) { |
|
| 435 | 435 | return; |
| 436 | 436 | } |
| 437 | 437 | |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | WHERE name="' . $name . '" |
| 441 | 441 | LIMIT 1'); |
| 442 | 442 | |
| 443 | - if ($modx->db->getRecordCount($sql)) {
|
|
| 443 | + if ($modx->db->getRecordCount($sql)) { |
|
| 444 | 444 | $row = $modx->db->getRow($sql); |
| 445 | 445 | $contextmenu = array( |
| 446 | 446 | 'header' => array( |
@@ -451,13 +451,13 @@ discard block |
||
| 451 | 451 | 'url' => "index.php?a=301&id=" . $row['id'] |
| 452 | 452 | ) |
| 453 | 453 | ); |
| 454 | - if (!empty($row['description'])) {
|
|
| 454 | + if (!empty($row['description'])) { |
|
| 455 | 455 | $contextmenu['seperator'] = ''; |
| 456 | 456 | $contextmenu['description'] = array( |
| 457 | 457 | 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
| 458 | 458 | ); |
| 459 | 459 | } |
| 460 | - } else {
|
|
| 460 | + } else { |
|
| 461 | 461 | $contextmenu = array( |
| 462 | 462 | 'header' => array( |
| 463 | 463 | 'innerHTML' => '<i class="fa fa-list-alt"></i> ' . $name |
@@ -482,13 +482,13 @@ discard block |
||
| 482 | 482 | case 'movedocument': {
|
| 483 | 483 | $json = array(); |
| 484 | 484 | |
| 485 | - if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) {
|
|
| 485 | + if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) { |
|
| 486 | 486 | $id = !empty($_REQUEST['id']) ? (int)$_REQUEST['id'] : ''; |
| 487 | 487 | $parent = isset($_REQUEST['parent']) ? (int)$_REQUEST['parent'] : 0; |
| 488 | 488 | $menuindex = isset($_REQUEST['menuindex']) && is_scalar($_REQUEST['menuindex']) ? $_REQUEST['menuindex'] : 0; |
| 489 | 489 | |
| 490 | 490 | // set parent |
| 491 | - if ($id && $parent >= 0) {
|
|
| 491 | + if ($id && $parent >= 0) { |
|
| 492 | 492 | |
| 493 | 493 | // find older parent |
| 494 | 494 | $parentOld = $modx->db->getValue($modx->db->select('parent', $modx->getFullTableName('site_content'), 'id=' . $id));
|
@@ -499,31 +499,31 @@ discard block |
||
| 499 | 499 | 'new_parent' => $parent, |
| 500 | 500 | )); |
| 501 | 501 | |
| 502 | - if (is_array($eventOut) && count($eventOut) > 0) {
|
|
| 502 | + if (is_array($eventOut) && count($eventOut) > 0) { |
|
| 503 | 503 | $eventParent = array_pop($eventOut); |
| 504 | 504 | |
| 505 | - if ($eventParent == $parentOld) {
|
|
| 505 | + if ($eventParent == $parentOld) { |
|
| 506 | 506 | $json['errors'] = $_lang['error_movedocument2']; |
| 507 | - } else {
|
|
| 507 | + } else { |
|
| 508 | 508 | $parent = $eventParent; |
| 509 | 509 | } |
| 510 | 510 | } |
| 511 | 511 | |
| 512 | - if (empty($json['errors'])) {
|
|
| 512 | + if (empty($json['errors'])) { |
|
| 513 | 513 | // check privileges user for move docs |
| 514 | - if (!empty($modx->config['tree_show_protected']) && $role != 1) {
|
|
| 514 | + if (!empty($modx->config['tree_show_protected']) && $role != 1) { |
|
| 515 | 515 | $sql = $modx->db->select('*', $modx->getFullTableName('document_groups'), 'document IN(' . $id . ',' . $parent . ',' . $parentOld . ')');
|
| 516 | - if ($modx->db->getRecordCount($sql)) {
|
|
| 516 | + if ($modx->db->getRecordCount($sql)) { |
|
| 517 | 517 | $document_groups = array(); |
| 518 | - while ($row = $modx->db->getRow($sql)) {
|
|
| 518 | + while ($row = $modx->db->getRow($sql)) { |
|
| 519 | 519 | $document_groups[$row['document']]['groups'][] = $row['document_group']; |
| 520 | 520 | } |
| 521 | - foreach ($document_groups as $key => $value) {
|
|
| 522 | - if (($key == $parent || $key == $parentOld || $key == $id) && !in_array($role, $value['groups'])) {
|
|
| 521 | + foreach ($document_groups as $key => $value) { |
|
| 522 | + if (($key == $parent || $key == $parentOld || $key == $id) && !in_array($role, $value['groups'])) { |
|
| 523 | 523 | $json['errors'] = $_lang["error_no_privileges"]; |
| 524 | 524 | } |
| 525 | 525 | } |
| 526 | - if ($json['errors']) {
|
|
| 526 | + if ($json['errors']) { |
|
| 527 | 527 | header('content-type: application/json');
|
| 528 | 528 | echo json_encode($json, JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE); |
| 529 | 529 | break; |
@@ -531,9 +531,9 @@ discard block |
||
| 531 | 531 | } |
| 532 | 532 | } |
| 533 | 533 | |
| 534 | - if ($parent == 0 && $parent != $parentOld && !$modx->config['udperms_allowroot'] && $role != 1) {
|
|
| 534 | + if ($parent == 0 && $parent != $parentOld && !$modx->config['udperms_allowroot'] && $role != 1) { |
|
| 535 | 535 | $json['errors'] = $_lang["error_no_privileges"]; |
| 536 | - } else {
|
|
| 536 | + } else { |
|
| 537 | 537 | // set new parent |
| 538 | 538 | $modx->db->update(array( |
| 539 | 539 | 'parent' => $parent |
@@ -543,13 +543,13 @@ discard block |
||
| 543 | 543 | 'isfolder' => 1 |
| 544 | 544 | ), $modx->getFullTableName('site_content'), 'id=' . $parent);
|
| 545 | 545 | |
| 546 | - if ($parent != $parentOld) {
|
|
| 546 | + if ($parent != $parentOld) { |
|
| 547 | 547 | // check children docs and set parent isfolder |
| 548 | - if ($modx->db->getRecordCount($modx->db->select('id', $modx->getFullTableName('site_content'), 'parent=' . $parentOld))) {
|
|
| 548 | + if ($modx->db->getRecordCount($modx->db->select('id', $modx->getFullTableName('site_content'), 'parent=' . $parentOld))) { |
|
| 549 | 549 | $modx->db->update(array( |
| 550 | 550 | 'isfolder' => 1 |
| 551 | 551 | ), $modx->getFullTableName('site_content'), 'id=' . $parentOld);
|
| 552 | - } else {
|
|
| 552 | + } else { |
|
| 553 | 553 | $modx->db->update(array( |
| 554 | 554 | 'isfolder' => 0 |
| 555 | 555 | ), $modx->getFullTableName('site_content'), 'id=' . $parentOld);
|
@@ -557,16 +557,16 @@ discard block |
||
| 557 | 557 | } |
| 558 | 558 | |
| 559 | 559 | // set menuindex |
| 560 | - if (!empty($menuindex)) {
|
|
| 560 | + if (!empty($menuindex)) { |
|
| 561 | 561 | $menuindex = explode(',', $menuindex);
|
| 562 | - foreach ($menuindex as $key => $value) {
|
|
| 562 | + foreach ($menuindex as $key => $value) { |
|
| 563 | 563 | $modx->db->query('UPDATE ' . $modx->getFullTableName('site_content') . ' SET menuindex=' . $key . ' WHERE id=' . $value);
|
| 564 | 564 | } |
| 565 | - } else {
|
|
| 565 | + } else { |
|
| 566 | 566 | // TODO: max(*) menuindex |
| 567 | 567 | } |
| 568 | 568 | |
| 569 | - if (!$json['errors']) {
|
|
| 569 | + if (!$json['errors']) { |
|
| 570 | 570 | $json['success'] = $_lang["actioncomplete"]; |
| 571 | 571 | |
| 572 | 572 | $modx->invokeEvent('onAfterMoveDocument', array(
|
@@ -578,7 +578,7 @@ discard block |
||
| 578 | 578 | } |
| 579 | 579 | } |
| 580 | 580 | } |
| 581 | - } else {
|
|
| 581 | + } else { |
|
| 582 | 582 | $json['errors'] = $_lang["error_no_privileges"]; |
| 583 | 583 | } |
| 584 | 584 | |
@@ -594,7 +594,7 @@ discard block |
||
| 594 | 594 | |
| 595 | 595 | $output = !!$modx->elementIsLocked($type, $id, true); |
| 596 | 596 | |
| 597 | - if (!$output) {
|
|
| 597 | + if (!$output) { |
|
| 598 | 598 | $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : '';
|
| 599 | 599 | $docgrp_cond = $docgrp ? ' OR dg.document_group IN (' . $docgrp . ')' : '';
|
| 600 | 600 | $sql = ' |
@@ -603,7 +603,7 @@ discard block |
||
| 603 | 603 | LEFT JOIN ' . $modx->getFullTableName('document_groups') . ' dg ON dg.document=sc.id
|
| 604 | 604 | WHERE sc.id=' . $id . ' GROUP BY sc.id'; |
| 605 | 605 | $sql = $modx->db->query($sql); |
| 606 | - if ($modx->db->getRecordCount($sql)) {
|
|
| 606 | + if ($modx->db->getRecordCount($sql)) { |
|
| 607 | 607 | $row = $modx->db->getRow($sql); |
| 608 | 608 | $output = !!$row['locked']; |
| 609 | 609 | } |
@@ -3,9 +3,9 @@ |
||
| 3 | 3 | |
| 4 | 4 | $modx->addSnippet('hasPermission', 'return $modx->hasPermission($key);');
|
| 5 | 5 | |
| 6 | -if ($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
|
|
| 6 | +if ($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) { |
|
| 7 | 7 | $hasAnyPermission = 1; |
| 8 | -} else {
|
|
| 8 | +} else { |
|
| 9 | 9 | $hasAnyPermission = 0; |
| 10 | 10 | } |
| 11 | 11 | $modx->addSnippet('hasAnyPermission', 'global $hasAnyPermission; return $hasAnyPermission;');
|
@@ -1,13 +1,13 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -class DATEPICKER |
|
| 4 | -{
|
|
| 5 | - public function __construct() |
|
| 6 | - {
|
|
| 3 | +class DATEPICKER |
|
| 4 | +{ |
|
| 5 | + public function __construct() |
|
| 6 | + { |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | - public function getDP() |
|
| 10 | - {
|
|
| 9 | + public function getDP() |
|
| 10 | + { |
|
| 11 | 11 | $modx = evolutionCMS(); |
| 12 | 12 | global $_lang; |
| 13 | 13 | |
@@ -1,5 +1,5 @@ discard block |
||
| 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 | $helpBasePath = "actions/help/"; |
@@ -16,9 +16,9 @@ discard block |
||
| 16 | 16 | </script> |
| 17 | 17 | |
| 18 | 18 | <?php |
| 19 | - if ($handle = opendir('actions/help')) {
|
|
| 20 | - while (false !== ($file = readdir($handle))) {
|
|
| 21 | - if ($file != "." && $file != ".." && $file != ".svn" && $file != 'index.html' && !is_dir($helpBasePath . $file)) {
|
|
| 19 | + if ($handle = opendir('actions/help')) { |
|
| 20 | + while (false !== ($file = readdir($handle))) { |
|
| 21 | + if ($file != "." && $file != ".." && $file != ".svn" && $file != 'index.html' && !is_dir($helpBasePath . $file)) { |
|
| 22 | 22 | $help[] = $file; |
| 23 | 23 | } |
| 24 | 24 | } |
@@ -27,11 +27,11 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | natcasesort($help); |
| 29 | 29 | |
| 30 | - foreach ($help as $k => $v) {
|
|
| 30 | + foreach ($help as $k => $v) { |
|
| 31 | 31 | $helpname = substr($v, 0, strrpos($v, '.')); |
| 32 | 32 | |
| 33 | 33 | $prefix = substr($helpname, 0, 2); |
| 34 | - if (is_numeric($prefix)) {
|
|
| 34 | + if (is_numeric($prefix)) { |
|
| 35 | 35 | $helpname = substr($helpname, 2, strlen($helpname) - 1); |
| 36 | 36 | } |
| 37 | 37 | |