@@ -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");
|
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | if (isset($_COOKIE['MODX_themeColor'])) {
|
| 49 | - $body_class .= ' ' . $_COOKIE['MODX_themeColor']; |
|
| 49 | + $body_class .= ' '.$_COOKIE['MODX_themeColor']; |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | if (isset($modx->pluginCache['ElementsInTree'])) {
|
@@ -74,36 +74,36 @@ discard block |
||
| 74 | 74 | $user['which_browser'] = $modx->config['which_browser']; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | -$css = 'media/style/' . $modx->config['manager_theme'] . '/css/page.css?v=' . $lastInstallTime; |
|
| 77 | +$css = 'media/style/'.$modx->config['manager_theme'].'/css/page.css?v='.$lastInstallTime; |
|
| 78 | 78 | |
| 79 | 79 | if ($modx->config['manager_theme'] == 'default') {
|
| 80 | - 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')) {
|
|
| 81 | - require_once MODX_BASE_PATH . 'assets/lib/Formatter/CSSMinify.php'; |
|
| 80 | + 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')) {
|
|
| 81 | + require_once MODX_BASE_PATH.'assets/lib/Formatter/CSSMinify.php'; |
|
| 82 | 82 | $minifier = new Formatter\CSSMinify(); |
| 83 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/common/bootstrap/css/bootstrap.min.css'); |
|
| 84 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/common/font-awesome/css/font-awesome.min.css'); |
|
| 85 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/fonts.css'); |
|
| 86 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/forms.css'); |
|
| 87 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/mainmenu.css'); |
|
| 88 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/tree.css'); |
|
| 89 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/custom.css'); |
|
| 90 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/tabpane.css'); |
|
| 91 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/contextmenu.css'); |
|
| 92 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/index.css'); |
|
| 93 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/main.css'); |
|
| 83 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/common/bootstrap/css/bootstrap.min.css'); |
|
| 84 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/common/font-awesome/css/font-awesome.min.css'); |
|
| 85 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/fonts.css'); |
|
| 86 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/forms.css'); |
|
| 87 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/mainmenu.css'); |
|
| 88 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/tree.css'); |
|
| 89 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/custom.css'); |
|
| 90 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/tabpane.css'); |
|
| 91 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/contextmenu.css'); |
|
| 92 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/index.css'); |
|
| 93 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/main.css'); |
|
| 94 | 94 | $css = $minifier->minify(); |
| 95 | - file_put_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css', $css); |
|
| 95 | + file_put_contents(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css', $css); |
|
| 96 | 96 | } |
| 97 | - if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) {
|
|
| 98 | - $css = 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css?v=' . $lastInstallTime; |
|
| 97 | + if (file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css')) {
|
|
| 98 | + $css = 'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css?v='.$lastInstallTime; |
|
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | -$modx->config['global_tabs'] = (int)($modx->config['global_tabs'] && ($user['role'] == 1 || $modx->hasPermission('edit_template') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_plugin')));
|
|
| 102 | +$modx->config['global_tabs'] = (int) ($modx->config['global_tabs'] && ($user['role'] == 1 || $modx->hasPermission('edit_template') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_plugin')));
|
|
| 103 | 103 | |
| 104 | 104 | ?> |
| 105 | 105 | <!DOCTYPE html> |
| 106 | -<html <?= (isset($modx_textdir) && $modx_textdir ? 'dir="rtl" lang="' : 'lang="') . $mxla . '" xml:lang="' . $mxla . '"' ?>> |
|
| 106 | +<html <?= (isset($modx_textdir) && $modx_textdir ? 'dir="rtl" lang="' : 'lang="').$mxla.'" xml:lang="'.$mxla.'"' ?>> |
|
| 107 | 107 | <head> |
| 108 | 108 | <title><?= $site_name ?>- (EVO CMS Manager)</title> |
| 109 | 109 | <meta http-equiv="Content-Type" content="text/html; charset=<?= $modx_manager_charset ?>" /> |
@@ -134,20 +134,20 @@ discard block |
||
| 134 | 134 | MODX_SITE_URL: '<?= MODX_SITE_URL ?>', |
| 135 | 135 | MODX_MANAGER_URL: '<?= MODX_MANAGER_URL ?>', |
| 136 | 136 | user: {
|
| 137 | - role: <?= (int)$user['role'] ?>, |
|
| 137 | + role: <?= (int) $user['role'] ?>, |
|
| 138 | 138 | username: '<?= $user['username'] ?>' |
| 139 | 139 | }, |
| 140 | 140 | config: {
|
| 141 | 141 | mail_check_timeperiod: <?= $modx->config['mail_check_timeperiod'] ?>, |
| 142 | - menu_height: <?= (int)$menu_height ?>, |
|
| 143 | - tree_width: <?= (int)$tree_width ?>, |
|
| 144 | - tree_min_width: <?= (int)$tree_min_width ?>, |
|
| 145 | - session_timeout: <?= (int)$modx->config['session_timeout'] ?>, |
|
| 146 | - site_start: <?= (int)$modx->config['site_start'] ?>, |
|
| 147 | - tree_page_click: <?=(!empty($modx->config['tree_page_click']) ? (int)$modx->config['tree_page_click'] : 27) ?>, |
|
| 142 | + menu_height: <?= (int) $menu_height ?>, |
|
| 143 | + tree_width: <?= (int) $tree_width ?>, |
|
| 144 | + tree_min_width: <?= (int) $tree_min_width ?>, |
|
| 145 | + session_timeout: <?= (int) $modx->config['session_timeout'] ?>, |
|
| 146 | + site_start: <?= (int) $modx->config['site_start'] ?>, |
|
| 147 | + tree_page_click: <?=(!empty($modx->config['tree_page_click']) ? (int) $modx->config['tree_page_click'] : 27) ?>, |
|
| 148 | 148 | theme: '<?= $modx->config['manager_theme'] ?>', |
| 149 | 149 | which_browser: '<?= $user['which_browser'] ?>', |
| 150 | - layout: <?= (int)$manager_layout ?>, |
|
| 150 | + layout: <?= (int) $manager_layout ?>, |
|
| 151 | 151 | textdir: '<?= $modx_textdir ?>', |
| 152 | 152 | global_tabs: <?= $modx->config['global_tabs'] ?> |
| 153 | 153 | |
@@ -232,12 +232,12 @@ discard block |
||
| 232 | 232 | delete a[b]; |
| 233 | 233 | }, |
| 234 | 234 | openedArray: [], |
| 235 | - lockedElementsTranslation: <?= json_encode($unlockTranslations, JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE) . "\n" ?> |
|
| 235 | + lockedElementsTranslation: <?= json_encode($unlockTranslations, JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE)."\n" ?> |
|
| 236 | 236 | }; |
| 237 | 237 | <?php |
| 238 | 238 | $opened = array_filter(array_map('intval', explode('|', $_SESSION['openedArray'])));
|
| 239 | - echo (empty($opened) ? '' : 'modx.openedArray[' . implode("] = 1;\n modx.openedArray[", $opened) . '] = 1;') . "\n";
|
|
| 240 | - if(filemtime(MODX_MANAGER_PATH.'media/style/'.$modx->config["manager_theme"].'/js/modx.js') > filemtime(MODX_MANAGER_PATH.'media/style/'.$modx->config["manager_theme"].'/js/modx.min.js')) $modxJs = 'modx.js'; |
|
| 239 | + echo (empty($opened) ? '' : 'modx.openedArray['.implode("] = 1;\n modx.openedArray[", $opened).'] = 1;')."\n";
|
|
| 240 | + if (filemtime(MODX_MANAGER_PATH.'media/style/'.$modx->config["manager_theme"].'/js/modx.js') > filemtime(MODX_MANAGER_PATH.'media/style/'.$modx->config["manager_theme"].'/js/modx.min.js')) $modxJs = 'modx.js'; |
|
| 241 | 241 | else $modxJs = 'modx.min.js'; // For easier development |
| 242 | 242 | ?> |
| 243 | 243 | </script> |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | <a href="javascript:;" class="dropdown-toggle" onclick="return false;"> |
| 368 | 368 | <span class="username"><?= $user['username'] ?></span> |
| 369 | 369 | <?php if ($user['photo']) { ?>
|
| 370 | - <span class="icon photo" style="background-image: url(<?= MODX_SITE_URL . $user['photo'] ?>);"></span> |
|
| 370 | + <span class="icon photo" style="background-image: url(<?= MODX_SITE_URL.$user['photo'] ?>);"></span> |
|
| 371 | 371 | <?php } else { ?>
|
| 372 | 372 | <span class="icon"><?= $_style['menu_user'] ?></span> |
| 373 | 373 | <?php } ?> |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | $version = 'Evolution'; |
| 395 | 395 | ?> |
| 396 | 396 | <?php |
| 397 | - echo sprintf('<li><span class="dropdown-item" title="%s – %s" %s>' . $version . ' %s</span></li>', $site_name, $modx->getVersionData('full_appname'), $style, $modx->config['settings_version']);
|
|
| 397 | + echo sprintf('<li><span class="dropdown-item" title="%s – %s" %s>'.$version.' %s</span></li>', $site_name, $modx->getVersionData('full_appname'), $style, $modx->config['settings_version']);
|
|
| 398 | 398 | ?> |
| 399 | 399 | </ul> |
| 400 | 400 | </li> |
@@ -533,7 +533,7 @@ discard block |
||
| 533 | 533 | <script type="text/javascript"> |
| 534 | 534 | |
| 535 | 535 | if (document.getElementById('treeMenu')) {
|
| 536 | - <?php if($modx->hasPermission('edit_template') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_plugin')) { ?>
|
|
| 536 | + <?php if ($modx->hasPermission('edit_template') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_plugin')) { ?>
|
|
| 537 | 537 | |
| 538 | 538 | document.getElementById('treeMenu_openelements').onclick = function(e) {
|
| 539 | 539 | e.preventDefault(); |
@@ -551,12 +551,12 @@ discard block |
||
| 551 | 551 | } |
| 552 | 552 | }; |
| 553 | 553 | <?php } ?> |
| 554 | - <?php if($use_browser && $modx->hasPermission('assets_images')) { ?>
|
|
| 554 | + <?php if ($use_browser && $modx->hasPermission('assets_images')) { ?>
|
|
| 555 | 555 | |
| 556 | 556 | document.getElementById('treeMenu_openimages').onclick = function(e) {
|
| 557 | 557 | e.preventDefault(); |
| 558 | 558 | if (modx.config.global_tabs && !e.shiftKey) {
|
| 559 | - modx.tabs({url: '<?= MODX_MANAGER_URL . 'media/browser/' . $which_browser . '/browse.php?filemanager=media/browser/' . $which_browser . '/browse.php&type=images' ?>', title: '<?= $_lang["images_management"] ?>'});
|
|
| 559 | + modx.tabs({url: '<?= MODX_MANAGER_URL.'media/browser/'.$which_browser.'/browse.php?filemanager=media/browser/'.$which_browser.'/browse.php&type=images' ?>', title: '<?= $_lang["images_management"] ?>'});
|
|
| 560 | 560 | } else {
|
| 561 | 561 | var randomNum = '<?= $_lang["files_files"] ?>'; |
| 562 | 562 | if (e.shiftKey) {
|
@@ -569,12 +569,12 @@ discard block |
||
| 569 | 569 | } |
| 570 | 570 | }; |
| 571 | 571 | <?php } ?> |
| 572 | - <?php if($use_browser && $modx->hasPermission('assets_files')) { ?>
|
|
| 572 | + <?php if ($use_browser && $modx->hasPermission('assets_files')) { ?>
|
|
| 573 | 573 | |
| 574 | 574 | document.getElementById('treeMenu_openfiles').onclick = function(e) {
|
| 575 | 575 | e.preventDefault(); |
| 576 | 576 | if (modx.config.global_tabs && !e.shiftKey) {
|
| 577 | - modx.tabs({url: '<?= MODX_MANAGER_URL . 'media/browser/' . $which_browser . '/browse.php?filemanager=media/browser/' . $which_browser . '/browse.php&type=files' ?>', title: '<?= $_lang["files_files"] ?>'});
|
|
| 577 | + modx.tabs({url: '<?= MODX_MANAGER_URL.'media/browser/'.$which_browser.'/browse.php?filemanager=media/browser/'.$which_browser.'/browse.php&type=files' ?>', title: '<?= $_lang["files_files"] ?>'});
|
|
| 578 | 578 | } else {
|
| 579 | 579 | var randomNum = '<?= $_lang["files_files"] ?>'; |
| 580 | 580 | if (e.shiftKey) {
|
@@ -628,7 +628,7 @@ discard block |
||
| 628 | 628 | |
| 629 | 629 | </div> |
| 630 | 630 | <?php if ($modx->config['show_picker'] != "0") {
|
| 631 | - include('media/style/' . $modx->config['manager_theme'] . '/color.switcher.php');
|
|
| 631 | + include('media/style/'.$modx->config['manager_theme'].'/color.switcher.php');
|
|
| 632 | 632 | } ?> |
| 633 | 633 | </body> |
| 634 | 634 | </html> |
@@ -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,21 +35,21 @@ 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 | -if (isset($_COOKIE['MODX_themeColor'])) {
|
|
| 48 | +if (isset($_COOKIE['MODX_themeColor'])) { |
|
| 49 | 49 | $body_class .= ' ' . $_COOKIE['MODX_themeColor']; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | -if (isset($modx->pluginCache['ElementsInTree'])) {
|
|
| 52 | +if (isset($modx->pluginCache['ElementsInTree'])) { |
|
| 53 | 53 | $body_class .= ' ElementsInTree'; |
| 54 | 54 | } |
| 55 | 55 | |
@@ -65,19 +65,19 @@ discard block |
||
| 65 | 65 | 'type8' => $_lang["lock_element_type_8"] |
| 66 | 66 | ); |
| 67 | 67 | |
| 68 | -foreach ($unlockTranslations as $key => $value) {
|
|
| 68 | +foreach ($unlockTranslations as $key => $value) { |
|
| 69 | 69 | $unlockTranslations[$key] = iconv($modx->config["modx_charset"], "utf-8", $value); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | $user = $modx->getUserInfo($modx->getLoginUserID()); |
| 73 | -if ($user['which_browser'] == 'default') {
|
|
| 73 | +if ($user['which_browser'] == 'default') { |
|
| 74 | 74 | $user['which_browser'] = $modx->config['which_browser']; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | $css = 'media/style/' . $modx->config['manager_theme'] . '/css/page.css?v=' . $lastInstallTime; |
| 78 | 78 | |
| 79 | -if ($modx->config['manager_theme'] == 'default') {
|
|
| 80 | - 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')) {
|
|
| 79 | +if ($modx->config['manager_theme'] == 'default') { |
|
| 80 | + 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')) { |
|
| 81 | 81 | require_once MODX_BASE_PATH . 'assets/lib/Formatter/CSSMinify.php'; |
| 82 | 82 | $minifier = new Formatter\CSSMinify(); |
| 83 | 83 | $minifier->addFile(MODX_MANAGER_PATH . 'media/style/common/bootstrap/css/bootstrap.min.css'); |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | $css = $minifier->minify(); |
| 95 | 95 | file_put_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css', $css); |
| 96 | 96 | } |
| 97 | - if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) {
|
|
| 97 | + if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) { |
|
| 98 | 98 | $css = 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css?v=' . $lastInstallTime; |
| 99 | 99 | } |
| 100 | 100 | } |
@@ -237,8 +237,12 @@ discard block |
||
| 237 | 237 | <?php |
| 238 | 238 | $opened = array_filter(array_map('intval', explode('|', $_SESSION['openedArray'])));
|
| 239 | 239 | echo (empty($opened) ? '' : 'modx.openedArray[' . implode("] = 1;\n modx.openedArray[", $opened) . '] = 1;') . "\n";
|
| 240 | - if(filemtime(MODX_MANAGER_PATH.'media/style/'.$modx->config["manager_theme"].'/js/modx.js') > filemtime(MODX_MANAGER_PATH.'media/style/'.$modx->config["manager_theme"].'/js/modx.min.js')) $modxJs = 'modx.js'; |
|
| 241 | - else $modxJs = 'modx.min.js'; // For easier development |
|
| 240 | + if(filemtime(MODX_MANAGER_PATH.'media/style/'.$modx->config["manager_theme"].'/js/modx.js') > filemtime(MODX_MANAGER_PATH.'media/style/'.$modx->config["manager_theme"].'/js/modx.min.js')) { |
|
| 241 | + $modxJs = 'modx.js'; |
|
| 242 | + } else { |
|
| 243 | + $modxJs = 'modx.min.js'; |
|
| 244 | + } |
|
| 245 | + // For easier development |
|
| 242 | 246 | ?> |
| 243 | 247 | </script> |
| 244 | 248 | <script src="media/style/<?= $modx->config['manager_theme'] ?>/js/<?= $modxJs ?>?v=<?= $lastInstallTime ?>"></script> |
@@ -250,7 +254,7 @@ discard block |
||
| 250 | 254 | <?php |
| 251 | 255 | // invoke OnManagerTopPrerender event |
| 252 | 256 | $evtOut = $modx->invokeEvent('OnManagerTopPrerender', $_REQUEST);
|
| 253 | - if (is_array($evtOut)) {
|
|
| 257 | + if (is_array($evtOut)) { |
|
| 254 | 258 | echo implode("\n", $evtOut);
|
| 255 | 259 | } |
| 256 | 260 | ?> |
@@ -421,9 +425,12 @@ discard block |
||
| 421 | 425 | <div id="evo-tab-page-home" class="evo-tab-page show"> |
| 422 | 426 | <iframe id="mainframe" src="index.php?a=<?= $initMainframeAction ?>" scrolling="auto" frameborder="0" onload="modx.main.onload(event);"></iframe> |
| 423 | 427 | </div> |
| 424 | - <?php else: ?> |
|
| 428 | + <?php else { |
|
| 429 | + : ?> |
|
| 425 | 430 | <iframe id="mainframe" name="main" src="index.php?a=<?= $initMainframeAction ?>" scrolling="auto" frameborder="0" onload="modx.main.onload(event);"></iframe> |
| 426 | - <?php endif; ?> |
|
| 431 | + <?php endif; |
|
| 432 | +} |
|
| 433 | +?> |
|
| 427 | 434 | <div id="mainloader"></div> |
| 428 | 435 | </div> |
| 429 | 436 | <div id="resizer"></div> |
@@ -436,11 +443,11 @@ discard block |
||
| 436 | 443 | 'tree_sortdir', |
| 437 | 444 | 'tree_nodename' |
| 438 | 445 | ); |
| 439 | - foreach ($sortParams as $param) {
|
|
| 440 | - if (isset($_REQUEST[$param])) {
|
|
| 446 | + foreach ($sortParams as $param) { |
|
| 447 | + if (isset($_REQUEST[$param])) { |
|
| 441 | 448 | $modx->manager->saveLastUserSetting($param, $_REQUEST[$param]); |
| 442 | 449 | $_SESSION[$param] = $_REQUEST[$param]; |
| 443 | - } else if (!isset($_SESSION[$param])) {
|
|
| 450 | + } else if (!isset($_SESSION[$param])) { |
|
| 444 | 451 | $_SESSION[$param] = $modx->manager->getLastUserSetting($param); |
| 445 | 452 | } |
| 446 | 453 | } |
@@ -520,9 +527,9 @@ discard block |
||
| 520 | 527 | </div> |
| 521 | 528 | |
| 522 | 529 | <?php |
| 523 | - function constructLink($action, $img, $text, $allowed) |
|
| 524 | - {
|
|
| 525 | - if ($allowed == 1) {
|
|
| 530 | + function constructLink($action, $img, $text, $allowed) |
|
| 531 | + { |
|
| 532 | + if ($allowed == 1) { |
|
| 526 | 533 | echo sprintf('<div class="menuLink" id="item%s" onclick="modx.tree.menuHandler(%s);">', $action, $action);
|
| 527 | 534 | echo sprintf('<i class="%s"></i> %s</div>', $img, $text);
|
| 528 | 535 | } |
@@ -627,7 +634,7 @@ discard block |
||
| 627 | 634 | ?> |
| 628 | 635 | |
| 629 | 636 | </div> |
| 630 | -<?php if ($modx->config['show_picker'] != "0") {
|
|
| 637 | +<?php if ($modx->config['show_picker'] != "0") { |
|
| 631 | 638 | include('media/style/' . $modx->config['manager_theme'] . '/color.switcher.php');
|
| 632 | 639 | } ?> |
| 633 | 640 | </body> |
@@ -1,11 +1,11 @@ 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 | |
| 6 | 6 | unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes |
| 7 | 7 | |
| 8 | -if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
|
|
| 8 | +if ($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
|
|
| 9 | 9 | // seems to be a new install - send the user to the configuration page |
| 10 | 10 | exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
|
| 11 | 11 | } |
@@ -16,50 +16,50 @@ discard block |
||
| 16 | 16 | $_SESSION['nrnewmessages'] = 0; |
| 17 | 17 | |
| 18 | 18 | // setup message info |
| 19 | -if($modx->hasPermission('messages')) {
|
|
| 20 | - include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php'); |
|
| 19 | +if ($modx->hasPermission('messages')) {
|
|
| 20 | + include_once(MODX_MANAGER_PATH.'includes/messageCount.inc.php'); |
|
| 21 | 21 | $_SESSION['nrtotalmessages'] = $nrtotalmessages; |
| 22 | 22 | $_SESSION['nrnewmessages'] = $nrnewmessages; |
| 23 | 23 | |
| 24 | 24 | $msg = array(); |
| 25 | 25 | $msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']);
|
| 26 | - $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : ''; |
|
| 26 | + $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">'.$_SESSION['nrnewmessages'].'</span>)' : ''; |
|
| 27 | 27 | $msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold"> <a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages);
|
| 28 | - $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0'; |
|
| 28 | + $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">'.$_SESSION['nrnewmessages'].'</span>' : '0'; |
|
| 29 | 29 | $welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages); |
| 30 | 30 | $msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages);
|
| 31 | 31 | $ph['MessageInfo'] = join("\n", $msg);
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | // setup icons |
| 35 | -if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
|
|
| 35 | +if ($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
|
|
| 36 | 36 | $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]'; |
| 37 | 37 | $ph['SecurityIcon'] = wrapIcon($icon, 75); |
| 38 | 38 | } |
| 39 | -if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
|
|
| 39 | +if ($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
|
|
| 40 | 40 | $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]'; |
| 41 | 41 | $ph['WebUserIcon'] = wrapIcon($icon, 99); |
| 42 | 42 | } |
| 43 | -if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
|
|
| 43 | +if ($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
|
|
| 44 | 44 | $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]'; |
| 45 | 45 | $ph['ModulesIcon'] = wrapIcon($icon, 106); |
| 46 | 46 | } |
| 47 | -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')) {
|
|
| 47 | +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')) {
|
|
| 48 | 48 | $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]'; |
| 49 | 49 | $ph['ResourcesIcon'] = wrapIcon($icon, 76); |
| 50 | 50 | } |
| 51 | -if($modx->hasPermission('bk_manager')) {
|
|
| 51 | +if ($modx->hasPermission('bk_manager')) {
|
|
| 52 | 52 | $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]'; |
| 53 | 53 | $ph['BackupIcon'] = wrapIcon($icon, 93); |
| 54 | 54 | } |
| 55 | -if($modx->hasPermission('help')) {
|
|
| 55 | +if ($modx->hasPermission('help')) {
|
|
| 56 | 56 | $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]'; |
| 57 | 57 | $ph['HelpIcon'] = wrapIcon($icon, 9); |
| 58 | 58 | } |
| 59 | 59 | // do some config checks |
| 60 | -if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
|
|
| 61 | - include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php'); |
|
| 62 | - if($config_check_results != $_lang['configcheck_ok']) {
|
|
| 60 | +if (($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
|
|
| 61 | + include_once(MODX_MANAGER_PATH.'includes/config_check.inc.php'); |
|
| 62 | + if ($config_check_results != $_lang['configcheck_ok']) {
|
|
| 63 | 63 | $ph['config_check_results'] = $config_check_results; |
| 64 | 64 | $ph['config_display'] = 'block'; |
| 65 | 65 | } else {
|
@@ -70,8 +70,8 @@ discard block |
||
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | // Check logout-reminder |
| 73 | -if(isset($_SESSION['show_logout_reminder'])) {
|
|
| 74 | - switch($_SESSION['show_logout_reminder']['type']) {
|
|
| 73 | +if (isset($_SESSION['show_logout_reminder'])) {
|
|
| 74 | + switch ($_SESSION['show_logout_reminder']['type']) {
|
|
| 75 | 75 | case 'logout_reminder': |
| 76 | 76 | $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly'); |
| 77 | 77 | $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
|
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | </tr> |
| 126 | 126 | </table>'; |
| 127 | 127 | |
| 128 | -$nrnewmessages = '<span class="text-danger">' . $_SESSION['nrnewmessages'] . '</span>'; |
|
| 128 | +$nrnewmessages = '<span class="text-danger">'.$_SESSION['nrnewmessages'].'</span>'; |
|
| 129 | 129 | |
| 130 | 130 | $ph['UserInfo'] = $modx->parseText($tpl, array( |
| 131 | 131 | 'username' => $modx->getLoginUserName(), |
@@ -140,10 +140,10 @@ discard block |
||
| 140 | 140 | $from[] = " us LEFT JOIN [+prefix+]active_users au ON au.sid=us.sid WHERE au.action <> '8'"; |
| 141 | 141 | $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC');
|
| 142 | 142 | |
| 143 | -if($modx->db->getRecordCount($rs) < 1) {
|
|
| 143 | +if ($modx->db->getRecordCount($rs) < 1) {
|
|
| 144 | 144 | $html = '<p>[%no_active_users_found%]</p>'; |
| 145 | 145 | } else {
|
| 146 | - include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
| 146 | + include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php'); |
|
| 147 | 147 | $now = $_SERVER['REQUEST_TIME'] + $server_offset_time; |
| 148 | 148 | $ph['now'] = strftime('%H:%M:%S', $now);
|
| 149 | 149 | $timetocheck = ($now - (60 * 20)); //+$server_offset_time; |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $userList = array(); |
| 169 | 169 | $userCount = array(); |
| 170 | 170 | // Create userlist with session-count first before output |
| 171 | - while($activeusers = $modx->db->getRow($rs)) {
|
|
| 171 | + while ($activeusers = $modx->db->getRow($rs)) {
|
|
| 172 | 172 | $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1; |
| 173 | 173 | |
| 174 | 174 | $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : ''; |
@@ -186,9 +186,9 @@ discard block |
||
| 186 | 186 | $currentaction |
| 187 | 187 | ); |
| 188 | 188 | } |
| 189 | - foreach($userList as $params) {
|
|
| 189 | + foreach ($userList as $params) {
|
|
| 190 | 190 | $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : ''; |
| 191 | - $html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
|
|
| 191 | + $html .= "\n\t\t".vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
|
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | $html .= ' |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | $ph['OnlineInfo'] = $html; |
| 201 | 201 | |
| 202 | 202 | // include rss feeds for important forum topics |
| 203 | -include_once(MODX_MANAGER_PATH . 'includes/rss.inc.php'); |
|
| 203 | +include_once(MODX_MANAGER_PATH.'includes/rss.inc.php'); |
|
| 204 | 204 | $ph['modx_security_notices_content'] = $feedData['modx_security_notices_content']; |
| 205 | 205 | $ph['modx_news_content'] = $feedData['modx_news_content']; |
| 206 | 206 | |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | |
| 232 | 232 | // invoke event OnManagerWelcomePrerender |
| 233 | 233 | $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender');
|
| 234 | -if(is_array($evtOut)) {
|
|
| 234 | +if (is_array($evtOut)) {
|
|
| 235 | 235 | $output = implode('', $evtOut);
|
| 236 | 236 | $ph['OnManagerWelcomePrerender'] = $output; |
| 237 | 237 | } |
@@ -365,57 +365,57 @@ discard block |
||
| 365 | 365 | |
| 366 | 366 | // invoke OnManagerWelcomeHome event |
| 367 | 367 | $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
|
| 368 | -if(is_array($sitewidgets)) {
|
|
| 368 | +if (is_array($sitewidgets)) {
|
|
| 369 | 369 | $newwidgets = array(); |
| 370 | - foreach($sitewidgets as $widget){
|
|
| 370 | + foreach ($sitewidgets as $widget) {
|
|
| 371 | 371 | $newwidgets = array_merge($newwidgets, unserialize($widget)); |
| 372 | 372 | } |
| 373 | 373 | $widgets = (count($newwidgets) > 0) ? $newwidgets : $widgets; |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | -usort($widgets, function ($a, $b) {
|
|
| 376 | +usort($widgets, function($a, $b){
|
|
| 377 | 377 | return $a['menuindex'] - $b['menuindex']; |
| 378 | 378 | }); |
| 379 | 379 | |
| 380 | 380 | $tpl = getTplWidget(); |
| 381 | 381 | $output = ''; |
| 382 | -foreach($widgets as $widget) {
|
|
| 383 | - if ($widget['hide'] != '1'){
|
|
| 382 | +foreach ($widgets as $widget) {
|
|
| 383 | + if ($widget['hide'] != '1') {
|
|
| 384 | 384 | $output .= $modx->parseText($tpl, $widget); |
| 385 | 385 | } |
| 386 | 386 | } |
| 387 | 387 | $ph['widgets'] = $output; |
| 388 | 388 | |
| 389 | 389 | // load template |
| 390 | -if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
|
|
| 391 | - $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'; |
|
| 390 | +if (!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
|
|
| 391 | + $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH.'media/style/common/welcome.tpl'; |
|
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | $target = $modx->config['manager_welcome_tpl']; |
| 395 | 395 | $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target);
|
| 396 | 396 | $target = $modx->mergeSettingsContent($target); |
| 397 | 397 | |
| 398 | -if(substr($target, 0, 1) === '@') {
|
|
| 399 | - if(substr($target, 0, 6) === '@CHUNK') {
|
|
| 398 | +if (substr($target, 0, 1) === '@') {
|
|
| 399 | + if (substr($target, 0, 6) === '@CHUNK') {
|
|
| 400 | 400 | $content = $modx->getChunk(trim(substr($target, 7))); |
| 401 | - } elseif(substr($target, 0, 5) === '@FILE') {
|
|
| 401 | + } elseif (substr($target, 0, 5) === '@FILE') {
|
|
| 402 | 402 | $content = file_get_contents(trim(substr($target, 6))); |
| 403 | 403 | } else {
|
| 404 | 404 | $content = ''; |
| 405 | 405 | } |
| 406 | 406 | } else {
|
| 407 | 407 | $chunk = $modx->getChunk($target); |
| 408 | - if($chunk !== false && !empty($chunk)) {
|
|
| 408 | + if ($chunk !== false && !empty($chunk)) {
|
|
| 409 | 409 | $content = $chunk; |
| 410 | - } elseif(is_file(MODX_BASE_PATH . $target)) {
|
|
| 411 | - $content = file_get_contents(MODX_BASE_PATH . $target); |
|
| 412 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
|
|
| 413 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl'); |
|
| 414 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible |
|
| 410 | + } elseif (is_file(MODX_BASE_PATH.$target)) {
|
|
| 411 | + $content = file_get_contents(MODX_BASE_PATH.$target); |
|
| 412 | + } elseif (is_file(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/welcome.tpl')) {
|
|
| 413 | + $content = file_get_contents(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/welcome.tpl'); |
|
| 414 | + } elseif (is_file(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/html/welcome.html')) // ClipperCMS compatible |
|
| 415 | 415 | {
|
| 416 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
| 416 | + $content = file_get_contents(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/html/welcome.html'); |
|
| 417 | 417 | } else {
|
| 418 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'); |
|
| 418 | + $content = file_get_contents(MODX_MANAGER_PATH.'media/style/common/welcome.tpl'); |
|
| 419 | 419 | } |
| 420 | 420 | } |
| 421 | 421 | |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | $content = $modx->mergeConditionalTagsContent($content); |
| 424 | 424 | $content = $modx->mergeSettingsContent($content); |
| 425 | 425 | $content = $modx->parseText($content, $ph); |
| 426 | -if(strpos($content, '[+') !== false) {
|
|
| 426 | +if (strpos($content, '[+') !== false) {
|
|
| 427 | 427 | $modx->toPlaceholders($ph); |
| 428 | 428 | $content = $modx->mergePlaceholderContent($content); |
| 429 | 429 | } |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | $content = $modx->parseText($content, $_style, '[&', '&]'); |
| 433 | 433 | $content = $modx->cleanUpMODXTags($content); //cleanup |
| 434 | 434 | |
| 435 | -if($js = $modx->getRegisteredClientScripts()) {
|
|
| 435 | +if ($js = $modx->getRegisteredClientScripts()) {
|
|
| 436 | 436 | $content .= $js; |
| 437 | 437 | } |
| 438 | 438 | |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | // <a href="javascript:;" class="setting"><i class="fa fa-cog"></i></a> |
| 443 | 443 | // <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a> |
| 444 | 444 | //</span> |
| 445 | -function getTplWidget() { // recent document info
|
|
| 445 | +function getTplWidget(){ // recent document info
|
|
| 446 | 446 | return ' |
| 447 | 447 | <div class="[+cols+]" id="[+id+]"> |
| 448 | 448 | <div class="card"[+cardAttr+]> |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | '; |
| 454 | 454 | } |
| 455 | 455 | |
| 456 | -function getRecentInfo() { // recent document info
|
|
| 456 | +function getRecentInfo(){ // recent document info
|
|
| 457 | 457 | global $modx; |
| 458 | 458 | |
| 459 | 459 | $modx->addSnippet('recentInfoList', 'getRecentInfoList');
|
@@ -479,12 +479,12 @@ discard block |
||
| 479 | 479 | return $html; |
| 480 | 480 | } |
| 481 | 481 | |
| 482 | -function getRecentInfoList() {
|
|
| 482 | +function getRecentInfoList(){
|
|
| 483 | 483 | global $modx; |
| 484 | 484 | |
| 485 | 485 | $rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
|
| 486 | 486 | |
| 487 | - if($modx->db->getRecordCount($rs) < 1) {
|
|
| 487 | + if ($modx->db->getRecordCount($rs) < 1) {
|
|
| 488 | 488 | return '<tr><td>[%no_activity_message%]</td></tr>'; |
| 489 | 489 | } |
| 490 | 490 | |
@@ -494,20 +494,20 @@ discard block |
||
| 494 | 494 | $btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> '; |
| 495 | 495 | |
| 496 | 496 | $output = array(); |
| 497 | - while($ph = $modx->db->getRow($rs)) {
|
|
| 497 | + while ($ph = $modx->db->getRow($rs)) {
|
|
| 498 | 498 | $docid = $ph['id']; |
| 499 | 499 | $_ = $modx->getUserInfo($ph['editedby']); |
| 500 | 500 | $ph['username'] = $_['username']; |
| 501 | 501 | |
| 502 | - if($ph['deleted'] == 1) {
|
|
| 502 | + if ($ph['deleted'] == 1) {
|
|
| 503 | 503 | $ph['status'] = 'deleted text-danger'; |
| 504 | - } elseif($ph['published'] == 0) {
|
|
| 504 | + } elseif ($ph['published'] == 0) {
|
|
| 505 | 505 | $ph['status'] = 'unpublished font-italic text-muted'; |
| 506 | 506 | } else {
|
| 507 | 507 | $ph['status'] = 'published'; |
| 508 | 508 | } |
| 509 | 509 | |
| 510 | - if($modx->hasPermission('edit_document')) {
|
|
| 510 | + if ($modx->hasPermission('edit_document')) {
|
|
| 511 | 511 | $ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
|
| 512 | 512 | } else {
|
| 513 | 513 | $ph['edit_btn'] = ''; |
@@ -522,8 +522,8 @@ discard block |
||
| 522 | 522 | $preview_disabled |
| 523 | 523 | ), $btntpl['preview_btn']); |
| 524 | 524 | |
| 525 | - if($modx->hasPermission('delete_document')) {
|
|
| 526 | - if($ph['deleted'] == 0) {
|
|
| 525 | + if ($modx->hasPermission('delete_document')) {
|
|
| 526 | + if ($ph['deleted'] == 0) {
|
|
| 527 | 527 | $delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&id=[+id+]" target="main" data-ajaxaction="delete.res" data-id="[+id+]" data-element="row[+id+]"><i class="fa fa-trash fa-fw"></i></a> '; |
| 528 | 528 | } else {
|
| 529 | 529 | $delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&id=[+id+]" target="main" data-ajaxaction="delete.res" data-id="[+id+]" data-element="row[+id+]"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> '; |
@@ -533,11 +533,11 @@ discard block |
||
| 533 | 533 | $ph['delete_btn'] = ''; |
| 534 | 534 | } |
| 535 | 535 | |
| 536 | - if($ph['deleted'] == 1 && $ph['published'] == 0) {
|
|
| 536 | + if ($ph['deleted'] == 1 && $ph['published'] == 0) {
|
|
| 537 | 537 | $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main" data-ajaxaction="publish.res" data-id="[+id+]" data-element="row[+id+]"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
| 538 | - } elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
|
|
| 538 | + } elseif ($ph['deleted'] == 1 && $ph['published'] == 1) {
|
|
| 539 | 539 | $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main" data-ajaxaction="publish.res" data-id="[+id+]" data-element="row[+id+]"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
| 540 | - } elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
|
|
| 540 | + } elseif ($ph['deleted'] == 0 && $ph['published'] == 0) {
|
|
| 541 | 541 | $publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main" data-ajaxaction="publish.res" data-id="[+id+]" data-element="row[+id+]"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
| 542 | 542 | } else {
|
| 543 | 543 | $publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&id=[+id+]" target="main" data-ajaxaction="publish.res" data-id="[+id+]" data-element="row[+id+]"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
@@ -546,16 +546,16 @@ discard block |
||
| 546 | 546 | |
| 547 | 547 | $ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>');
|
| 548 | 548 | |
| 549 | - if($ph['longtitle'] == '') {
|
|
| 549 | + if ($ph['longtitle'] == '') {
|
|
| 550 | 550 | $ph['longtitle'] = '(<i>[%not_set%]</i>)'; |
| 551 | 551 | } |
| 552 | - if($ph['description'] == '') {
|
|
| 552 | + if ($ph['description'] == '') {
|
|
| 553 | 553 | $ph['description'] = '(<i>[%not_set%]</i>)'; |
| 554 | 554 | } |
| 555 | - if($ph['introtext'] == '') {
|
|
| 555 | + if ($ph['introtext'] == '') {
|
|
| 556 | 556 | $ph['introtext'] = '(<i>[%not_set%]</i>)'; |
| 557 | 557 | } |
| 558 | - if($ph['alias'] == '') {
|
|
| 558 | + if ($ph['alias'] == '') {
|
|
| 559 | 559 | $ph['alias'] = '(<i>[%not_set%]</i>)'; |
| 560 | 560 | } |
| 561 | 561 | |
@@ -564,7 +564,7 @@ discard block |
||
| 564 | 564 | return join("\n", $output);
|
| 565 | 565 | } |
| 566 | 566 | |
| 567 | -function getRecentInfoRowTpl() {
|
|
| 567 | +function getRecentInfoRowTpl(){
|
|
| 568 | 568 | $tpl = ' |
| 569 | 569 | <tr id="row[+id+]"> |
| 570 | 570 | <td data-toggle="collapse" data-target=".collapse[+id+]" class="text-right"><span class="label label-info">[+id+]</span></td> |
@@ -593,11 +593,11 @@ discard block |
||
| 593 | 593 | } |
| 594 | 594 | |
| 595 | 595 | // setup icons |
| 596 | -function wrapIcon($i, $action) {
|
|
| 596 | +function wrapIcon($i, $action){
|
|
| 597 | 597 | return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i);
|
| 598 | 598 | } |
| 599 | 599 | |
| 600 | -function getStartUpScript() {
|
|
| 600 | +function getStartUpScript(){
|
|
| 601 | 601 | $script = ' |
| 602 | 602 | <script type="text/javascript"> |
| 603 | 603 | function hideConfigCheckWarning(key) {
|
@@ -1,11 +1,11 @@ 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 | |
| 6 | 6 | unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes |
| 7 | 7 | |
| 8 | -if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
|
|
| 8 | +if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) { |
|
| 9 | 9 | // seems to be a new install - send the user to the configuration page |
| 10 | 10 | exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
|
| 11 | 11 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | $_SESSION['nrnewmessages'] = 0; |
| 17 | 17 | |
| 18 | 18 | // setup message info |
| 19 | -if($modx->hasPermission('messages')) {
|
|
| 19 | +if($modx->hasPermission('messages')) { |
|
| 20 | 20 | include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php'); |
| 21 | 21 | $_SESSION['nrtotalmessages'] = $nrtotalmessages; |
| 22 | 22 | $_SESSION['nrnewmessages'] = $nrnewmessages; |
@@ -32,46 +32,46 @@ discard block |
||
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | // setup icons |
| 35 | -if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
|
|
| 35 | +if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) { |
|
| 36 | 36 | $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]'; |
| 37 | 37 | $ph['SecurityIcon'] = wrapIcon($icon, 75); |
| 38 | 38 | } |
| 39 | -if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
|
|
| 39 | +if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) { |
|
| 40 | 40 | $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]'; |
| 41 | 41 | $ph['WebUserIcon'] = wrapIcon($icon, 99); |
| 42 | 42 | } |
| 43 | -if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
|
|
| 43 | +if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) { |
|
| 44 | 44 | $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]'; |
| 45 | 45 | $ph['ModulesIcon'] = wrapIcon($icon, 106); |
| 46 | 46 | } |
| 47 | -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')) {
|
|
| 47 | +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')) { |
|
| 48 | 48 | $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]'; |
| 49 | 49 | $ph['ResourcesIcon'] = wrapIcon($icon, 76); |
| 50 | 50 | } |
| 51 | -if($modx->hasPermission('bk_manager')) {
|
|
| 51 | +if($modx->hasPermission('bk_manager')) { |
|
| 52 | 52 | $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]'; |
| 53 | 53 | $ph['BackupIcon'] = wrapIcon($icon, 93); |
| 54 | 54 | } |
| 55 | -if($modx->hasPermission('help')) {
|
|
| 55 | +if($modx->hasPermission('help')) { |
|
| 56 | 56 | $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]'; |
| 57 | 57 | $ph['HelpIcon'] = wrapIcon($icon, 9); |
| 58 | 58 | } |
| 59 | 59 | // do some config checks |
| 60 | -if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
|
|
| 60 | +if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) { |
|
| 61 | 61 | include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php'); |
| 62 | - if($config_check_results != $_lang['configcheck_ok']) {
|
|
| 62 | + if($config_check_results != $_lang['configcheck_ok']) { |
|
| 63 | 63 | $ph['config_check_results'] = $config_check_results; |
| 64 | 64 | $ph['config_display'] = 'block'; |
| 65 | - } else {
|
|
| 65 | + } else { |
|
| 66 | 66 | $ph['config_display'] = 'none'; |
| 67 | 67 | } |
| 68 | -} else {
|
|
| 68 | +} else { |
|
| 69 | 69 | $ph['config_display'] = 'none'; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | // Check logout-reminder |
| 73 | -if(isset($_SESSION['show_logout_reminder'])) {
|
|
| 74 | - switch($_SESSION['show_logout_reminder']['type']) {
|
|
| 73 | +if(isset($_SESSION['show_logout_reminder'])) { |
|
| 74 | + switch($_SESSION['show_logout_reminder']['type']) { |
|
| 75 | 75 | case 'logout_reminder': |
| 76 | 76 | $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly'); |
| 77 | 77 | $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
|
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | $ph['show_logout_reminder'] = 'block'; |
| 81 | 81 | unset($_SESSION['show_logout_reminder']); |
| 82 | -} else {
|
|
| 82 | +} else { |
|
| 83 | 83 | $ph['show_logout_reminder'] = 'none'; |
| 84 | 84 | } |
| 85 | 85 | |
@@ -140,9 +140,9 @@ discard block |
||
| 140 | 140 | $from[] = " us LEFT JOIN [+prefix+]active_users au ON au.sid=us.sid WHERE au.action <> '8'"; |
| 141 | 141 | $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC');
|
| 142 | 142 | |
| 143 | -if($modx->db->getRecordCount($rs) < 1) {
|
|
| 143 | +if($modx->db->getRecordCount($rs) < 1) { |
|
| 144 | 144 | $html = '<p>[%no_active_users_found%]</p>'; |
| 145 | -} else {
|
|
| 145 | +} else { |
|
| 146 | 146 | include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
| 147 | 147 | $now = $_SERVER['REQUEST_TIME'] + $server_offset_time; |
| 148 | 148 | $ph['now'] = strftime('%H:%M:%S', $now);
|
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $userList = array(); |
| 169 | 169 | $userCount = array(); |
| 170 | 170 | // Create userlist with session-count first before output |
| 171 | - while($activeusers = $modx->db->getRow($rs)) {
|
|
| 171 | + while($activeusers = $modx->db->getRow($rs)) { |
|
| 172 | 172 | $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1; |
| 173 | 173 | |
| 174 | 174 | $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : ''; |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | $currentaction |
| 187 | 187 | ); |
| 188 | 188 | } |
| 189 | - foreach($userList as $params) {
|
|
| 189 | + foreach($userList as $params) { |
|
| 190 | 190 | $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : ''; |
| 191 | 191 | $html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
|
| 192 | 192 | } |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | |
| 232 | 232 | // invoke event OnManagerWelcomePrerender |
| 233 | 233 | $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender');
|
| 234 | -if(is_array($evtOut)) {
|
|
| 234 | +if(is_array($evtOut)) { |
|
| 235 | 235 | $output = implode('', $evtOut);
|
| 236 | 236 | $ph['OnManagerWelcomePrerender'] = $output; |
| 237 | 237 | } |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | 'body' => '<div class="widget-stage">[+RecentInfo+]</div>', |
| 341 | 341 | 'hide'=>'0' |
| 342 | 342 | ); |
| 343 | -if ($modx->config['rss_url_news']) {
|
|
| 343 | +if ($modx->config['rss_url_news']) { |
|
| 344 | 344 | $widgets['news'] = array( |
| 345 | 345 | 'menuindex' => '40', |
| 346 | 346 | 'id' => 'news', |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | 'hide'=>'0' |
| 352 | 352 | ); |
| 353 | 353 | } |
| 354 | -if ($modx->config['rss_url_security']) {
|
|
| 354 | +if ($modx->config['rss_url_security']) { |
|
| 355 | 355 | $widgets['security'] = array( |
| 356 | 356 | 'menuindex' => '50', |
| 357 | 357 | 'id' => 'security', |
@@ -365,29 +365,29 @@ discard block |
||
| 365 | 365 | |
| 366 | 366 | // invoke OnManagerWelcomeHome event |
| 367 | 367 | $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
|
| 368 | -if(is_array($sitewidgets)) {
|
|
| 368 | +if(is_array($sitewidgets)) { |
|
| 369 | 369 | $newwidgets = array(); |
| 370 | - foreach($sitewidgets as $widget){
|
|
| 370 | + foreach($sitewidgets as $widget) { |
|
| 371 | 371 | $newwidgets = array_merge($newwidgets, unserialize($widget)); |
| 372 | 372 | } |
| 373 | 373 | $widgets = (count($newwidgets) > 0) ? $newwidgets : $widgets; |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | -usort($widgets, function ($a, $b) {
|
|
| 376 | +usort($widgets, function ($a, $b){ |
|
| 377 | 377 | return $a['menuindex'] - $b['menuindex']; |
| 378 | 378 | }); |
| 379 | 379 | |
| 380 | 380 | $tpl = getTplWidget(); |
| 381 | 381 | $output = ''; |
| 382 | -foreach($widgets as $widget) {
|
|
| 383 | - if ($widget['hide'] != '1'){
|
|
| 382 | +foreach($widgets as $widget) { |
|
| 383 | + if ($widget['hide'] != '1') { |
|
| 384 | 384 | $output .= $modx->parseText($tpl, $widget); |
| 385 | 385 | } |
| 386 | 386 | } |
| 387 | 387 | $ph['widgets'] = $output; |
| 388 | 388 | |
| 389 | 389 | // load template |
| 390 | -if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
|
|
| 390 | +if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) { |
|
| 391 | 391 | $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'; |
| 392 | 392 | } |
| 393 | 393 | |
@@ -395,26 +395,28 @@ discard block |
||
| 395 | 395 | $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target);
|
| 396 | 396 | $target = $modx->mergeSettingsContent($target); |
| 397 | 397 | |
| 398 | -if(substr($target, 0, 1) === '@') {
|
|
| 399 | - if(substr($target, 0, 6) === '@CHUNK') {
|
|
| 398 | +if(substr($target, 0, 1) === '@') { |
|
| 399 | + if(substr($target, 0, 6) === '@CHUNK') { |
|
| 400 | 400 | $content = $modx->getChunk(trim(substr($target, 7))); |
| 401 | - } elseif(substr($target, 0, 5) === '@FILE') {
|
|
| 401 | + } elseif(substr($target, 0, 5) === '@FILE') { |
|
| 402 | 402 | $content = file_get_contents(trim(substr($target, 6))); |
| 403 | - } else {
|
|
| 403 | + } else { |
|
| 404 | 404 | $content = ''; |
| 405 | 405 | } |
| 406 | -} else {
|
|
| 406 | +} else { |
|
| 407 | 407 | $chunk = $modx->getChunk($target); |
| 408 | - if($chunk !== false && !empty($chunk)) {
|
|
| 408 | + if($chunk !== false && !empty($chunk)) { |
|
| 409 | 409 | $content = $chunk; |
| 410 | - } elseif(is_file(MODX_BASE_PATH . $target)) {
|
|
| 410 | + } elseif(is_file(MODX_BASE_PATH . $target)) { |
|
| 411 | 411 | $content = file_get_contents(MODX_BASE_PATH . $target); |
| 412 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
|
|
| 412 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) { |
|
| 413 | 413 | $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl'); |
| 414 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible |
|
| 414 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) { |
|
| 415 | + // ClipperCMS compatible |
|
| 415 | 416 | {
|
| 416 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
| 417 | - } else {
|
|
| 417 | + $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
| 418 | + } |
|
| 419 | + } else { |
|
| 418 | 420 | $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'); |
| 419 | 421 | } |
| 420 | 422 | } |
@@ -423,7 +425,7 @@ discard block |
||
| 423 | 425 | $content = $modx->mergeConditionalTagsContent($content); |
| 424 | 426 | $content = $modx->mergeSettingsContent($content); |
| 425 | 427 | $content = $modx->parseText($content, $ph); |
| 426 | -if(strpos($content, '[+') !== false) {
|
|
| 428 | +if(strpos($content, '[+') !== false) { |
|
| 427 | 429 | $modx->toPlaceholders($ph); |
| 428 | 430 | $content = $modx->mergePlaceholderContent($content); |
| 429 | 431 | } |
@@ -432,7 +434,7 @@ discard block |
||
| 432 | 434 | $content = $modx->parseText($content, $_style, '[&', '&]'); |
| 433 | 435 | $content = $modx->cleanUpMODXTags($content); //cleanup |
| 434 | 436 | |
| 435 | -if($js = $modx->getRegisteredClientScripts()) {
|
|
| 437 | +if($js = $modx->getRegisteredClientScripts()) { |
|
| 436 | 438 | $content .= $js; |
| 437 | 439 | } |
| 438 | 440 | |
@@ -442,7 +444,9 @@ discard block |
||
| 442 | 444 | // <a href="javascript:;" class="setting"><i class="fa fa-cog"></i></a> |
| 443 | 445 | // <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a> |
| 444 | 446 | //</span> |
| 445 | -function getTplWidget() { // recent document info
|
|
| 447 | +function getTplWidget() |
|
| 448 | +{ |
|
| 449 | +// recent document info |
|
| 446 | 450 | return ' |
| 447 | 451 | <div class="[+cols+]" id="[+id+]"> |
| 448 | 452 | <div class="card"[+cardAttr+]> |
@@ -453,7 +457,9 @@ discard block |
||
| 453 | 457 | '; |
| 454 | 458 | } |
| 455 | 459 | |
| 456 | -function getRecentInfo() { // recent document info
|
|
| 460 | +function getRecentInfo() |
|
| 461 | +{ |
|
| 462 | +// recent document info |
|
| 457 | 463 | global $modx; |
| 458 | 464 | |
| 459 | 465 | $modx->addSnippet('recentInfoList', 'getRecentInfoList');
|
@@ -479,12 +485,13 @@ discard block |
||
| 479 | 485 | return $html; |
| 480 | 486 | } |
| 481 | 487 | |
| 482 | -function getRecentInfoList() {
|
|
| 488 | +function getRecentInfoList() |
|
| 489 | +{ |
|
| 483 | 490 | global $modx; |
| 484 | 491 | |
| 485 | 492 | $rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
|
| 486 | 493 | |
| 487 | - if($modx->db->getRecordCount($rs) < 1) {
|
|
| 494 | + if($modx->db->getRecordCount($rs) < 1) { |
|
| 488 | 495 | return '<tr><td>[%no_activity_message%]</td></tr>'; |
| 489 | 496 | } |
| 490 | 497 | |
@@ -494,22 +501,22 @@ discard block |
||
| 494 | 501 | $btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> '; |
| 495 | 502 | |
| 496 | 503 | $output = array(); |
| 497 | - while($ph = $modx->db->getRow($rs)) {
|
|
| 504 | + while($ph = $modx->db->getRow($rs)) { |
|
| 498 | 505 | $docid = $ph['id']; |
| 499 | 506 | $_ = $modx->getUserInfo($ph['editedby']); |
| 500 | 507 | $ph['username'] = $_['username']; |
| 501 | 508 | |
| 502 | - if($ph['deleted'] == 1) {
|
|
| 509 | + if($ph['deleted'] == 1) { |
|
| 503 | 510 | $ph['status'] = 'deleted text-danger'; |
| 504 | - } elseif($ph['published'] == 0) {
|
|
| 511 | + } elseif($ph['published'] == 0) { |
|
| 505 | 512 | $ph['status'] = 'unpublished font-italic text-muted'; |
| 506 | - } else {
|
|
| 513 | + } else { |
|
| 507 | 514 | $ph['status'] = 'published'; |
| 508 | 515 | } |
| 509 | 516 | |
| 510 | - if($modx->hasPermission('edit_document')) {
|
|
| 517 | + if($modx->hasPermission('edit_document')) { |
|
| 511 | 518 | $ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
|
| 512 | - } else {
|
|
| 519 | + } else { |
|
| 513 | 520 | $ph['edit_btn'] = ''; |
| 514 | 521 | } |
| 515 | 522 | |
@@ -522,40 +529,40 @@ discard block |
||
| 522 | 529 | $preview_disabled |
| 523 | 530 | ), $btntpl['preview_btn']); |
| 524 | 531 | |
| 525 | - if($modx->hasPermission('delete_document')) {
|
|
| 526 | - if($ph['deleted'] == 0) {
|
|
| 532 | + if($modx->hasPermission('delete_document')) { |
|
| 533 | + if($ph['deleted'] == 0) { |
|
| 527 | 534 | $delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&id=[+id+]" target="main" data-ajaxaction="delete.res" data-id="[+id+]" data-element="row[+id+]"><i class="fa fa-trash fa-fw"></i></a> '; |
| 528 | - } else {
|
|
| 535 | + } else { |
|
| 529 | 536 | $delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&id=[+id+]" target="main" data-ajaxaction="delete.res" data-id="[+id+]" data-element="row[+id+]"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> '; |
| 530 | 537 | } |
| 531 | 538 | $ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn);
|
| 532 | - } else {
|
|
| 539 | + } else { |
|
| 533 | 540 | $ph['delete_btn'] = ''; |
| 534 | 541 | } |
| 535 | 542 | |
| 536 | - if($ph['deleted'] == 1 && $ph['published'] == 0) {
|
|
| 543 | + if($ph['deleted'] == 1 && $ph['published'] == 0) { |
|
| 537 | 544 | $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main" data-ajaxaction="publish.res" data-id="[+id+]" data-element="row[+id+]"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
| 538 | - } elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
|
|
| 545 | + } elseif($ph['deleted'] == 1 && $ph['published'] == 1) { |
|
| 539 | 546 | $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main" data-ajaxaction="publish.res" data-id="[+id+]" data-element="row[+id+]"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
| 540 | - } elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
|
|
| 547 | + } elseif($ph['deleted'] == 0 && $ph['published'] == 0) { |
|
| 541 | 548 | $publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main" data-ajaxaction="publish.res" data-id="[+id+]" data-element="row[+id+]"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
| 542 | - } else {
|
|
| 549 | + } else { |
|
| 543 | 550 | $publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&id=[+id+]" target="main" data-ajaxaction="publish.res" data-id="[+id+]" data-element="row[+id+]"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
| 544 | 551 | } |
| 545 | 552 | $ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn);
|
| 546 | 553 | |
| 547 | 554 | $ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>');
|
| 548 | 555 | |
| 549 | - if($ph['longtitle'] == '') {
|
|
| 556 | + if($ph['longtitle'] == '') { |
|
| 550 | 557 | $ph['longtitle'] = '(<i>[%not_set%]</i>)'; |
| 551 | 558 | } |
| 552 | - if($ph['description'] == '') {
|
|
| 559 | + if($ph['description'] == '') { |
|
| 553 | 560 | $ph['description'] = '(<i>[%not_set%]</i>)'; |
| 554 | 561 | } |
| 555 | - if($ph['introtext'] == '') {
|
|
| 562 | + if($ph['introtext'] == '') { |
|
| 556 | 563 | $ph['introtext'] = '(<i>[%not_set%]</i>)'; |
| 557 | 564 | } |
| 558 | - if($ph['alias'] == '') {
|
|
| 565 | + if($ph['alias'] == '') { |
|
| 559 | 566 | $ph['alias'] = '(<i>[%not_set%]</i>)'; |
| 560 | 567 | } |
| 561 | 568 | |
@@ -564,7 +571,8 @@ discard block |
||
| 564 | 571 | return join("\n", $output);
|
| 565 | 572 | } |
| 566 | 573 | |
| 567 | -function getRecentInfoRowTpl() {
|
|
| 574 | +function getRecentInfoRowTpl() |
|
| 575 | +{ |
|
| 568 | 576 | $tpl = ' |
| 569 | 577 | <tr id="row[+id+]"> |
| 570 | 578 | <td data-toggle="collapse" data-target=".collapse[+id+]" class="text-right"><span class="label label-info">[+id+]</span></td> |
@@ -593,11 +601,13 @@ discard block |
||
| 593 | 601 | } |
| 594 | 602 | |
| 595 | 603 | // setup icons |
| 596 | -function wrapIcon($i, $action) {
|
|
| 604 | +function wrapIcon($i, $action) |
|
| 605 | +{ |
|
| 597 | 606 | return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i);
|
| 598 | 607 | } |
| 599 | 608 | |
| 600 | -function getStartUpScript() {
|
|
| 609 | +function getStartUpScript() |
|
| 610 | +{ |
|
| 601 | 611 | $script = ' |
| 602 | 612 | <script type="text/javascript"> |
| 603 | 613 | function hideConfigCheckWarning(key) {
|
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | */ |
| 203 | 203 | function __call($method_name, $arguments) |
| 204 | 204 | { |
| 205 | - include_once(MODX_MANAGER_PATH . 'includes/extenders/deprecated.functions.inc.php'); |
|
| 205 | + include_once(MODX_MANAGER_PATH.'includes/extenders/deprecated.functions.inc.php'); |
|
| 206 | 206 | if (method_exists($this->old, $method_name)) { |
| 207 | 207 | $error_type = 1; |
| 208 | 208 | } else { |
@@ -220,12 +220,12 @@ discard block |
||
| 220 | 220 | $info = debug_backtrace(); |
| 221 | 221 | $m[] = $msg; |
| 222 | 222 | if (!empty($this->currentSnippet)) { |
| 223 | - $m[] = 'Snippet - ' . $this->currentSnippet; |
|
| 223 | + $m[] = 'Snippet - '.$this->currentSnippet; |
|
| 224 | 224 | } elseif (!empty($this->event->activePlugin)) { |
| 225 | - $m[] = 'Plugin - ' . $this->event->activePlugin; |
|
| 225 | + $m[] = 'Plugin - '.$this->event->activePlugin; |
|
| 226 | 226 | } |
| 227 | 227 | $m[] = $this->decoded_request_uri; |
| 228 | - $m[] = str_replace('\\', '/', $info[0]['file']) . '(line:' . $info[0]['line'] . ')'; |
|
| 228 | + $m[] = str_replace('\\', '/', $info[0]['file']).'(line:'.$info[0]['line'].')'; |
|
| 229 | 229 | $msg = implode('<br />', $m); |
| 230 | 230 | $this->logEvent(0, $error_type, $msg, $title); |
| 231 | 231 | } |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | { |
| 243 | 243 | $flag = false; |
| 244 | 244 | if (is_scalar($connector) && !empty($connector) && isset($this->{$connector}) && $this->{$connector} instanceof DBAPI) { |
| 245 | - $flag = (bool)$this->{$connector}->conn; |
|
| 245 | + $flag = (bool) $this->{$connector}->conn; |
|
| 246 | 246 | } |
| 247 | 247 | return $flag; |
| 248 | 248 | } |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | } |
| 270 | 270 | if (!$out && $flag) { |
| 271 | 271 | $extname = trim(str_replace(array('..', '/', '\\'), '', strtolower($extname))); |
| 272 | - $filename = MODX_MANAGER_PATH . "includes/extenders/ex_{$extname}.inc.php"; |
|
| 272 | + $filename = MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php"; |
|
| 273 | 273 | $out = is_file($filename) ? include $filename : false; |
| 274 | 274 | } |
| 275 | 275 | if ($out && !in_array($extname, $this->extensions)) { |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | public function getMicroTime() |
| 287 | 287 | { |
| 288 | 288 | list ($usec, $sec) = explode(' ', microtime()); |
| 289 | - return ((float)$usec + (float)$sec); |
|
| 289 | + return ((float) $usec + (float) $sec); |
|
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | /** |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | // append the redirect count string to the url |
| 311 | 311 | $currentNumberOfRedirects = isset ($_REQUEST['err']) ? $_REQUEST['err'] : 0; |
| 312 | 312 | if ($currentNumberOfRedirects > 3) { |
| 313 | - $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>' . $url . '</i></p>'); |
|
| 313 | + $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>'.$url.'</i></p>'); |
|
| 314 | 314 | } else { |
| 315 | 315 | $currentNumberOfRedirects += 1; |
| 316 | 316 | if (strpos($url, "?") > 0) { |
@@ -321,9 +321,9 @@ discard block |
||
| 321 | 321 | } |
| 322 | 322 | } |
| 323 | 323 | if ($type == 'REDIRECT_REFRESH') { |
| 324 | - $header = 'Refresh: 0;URL=' . $url; |
|
| 324 | + $header = 'Refresh: 0;URL='.$url; |
|
| 325 | 325 | } elseif ($type == 'REDIRECT_META') { |
| 326 | - $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=' . $url . '" />'; |
|
| 326 | + $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL='.$url.'" />'; |
|
| 327 | 327 | echo $header; |
| 328 | 328 | exit; |
| 329 | 329 | } elseif ($type == 'REDIRECT_HEADER' || empty ($type)) { |
@@ -331,10 +331,10 @@ discard block |
||
| 331 | 331 | global $base_url, $site_url; |
| 332 | 332 | if (substr($url, 0, strlen($base_url)) == $base_url) { |
| 333 | 333 | // append $site_url to make it work with Location: |
| 334 | - $url = $site_url . substr($url, strlen($base_url)); |
|
| 334 | + $url = $site_url.substr($url, strlen($base_url)); |
|
| 335 | 335 | } |
| 336 | 336 | if (strpos($url, "\n") === false) { |
| 337 | - $header = 'Location: ' . $url; |
|
| 337 | + $header = 'Location: '.$url; |
|
| 338 | 338 | } else { |
| 339 | 339 | $this->messageQuit('No newline allowed in redirect url.'); |
| 340 | 340 | } |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | header($responseCode); |
| 344 | 344 | } |
| 345 | 345 | |
| 346 | - if(!empty($header)) { |
|
| 346 | + if (!empty($header)) { |
|
| 347 | 347 | header($header); |
| 348 | 348 | } |
| 349 | 349 | |
@@ -447,8 +447,8 @@ discard block |
||
| 447 | 447 | |
| 448 | 448 | private function recoverySiteCache() |
| 449 | 449 | { |
| 450 | - $site_cache_dir = MODX_BASE_PATH . $this->getCacheFolder(); |
|
| 451 | - $site_cache_path = $site_cache_dir . 'siteCache.idx.php'; |
|
| 450 | + $site_cache_dir = MODX_BASE_PATH.$this->getCacheFolder(); |
|
| 451 | + $site_cache_path = $site_cache_dir.'siteCache.idx.php'; |
|
| 452 | 452 | |
| 453 | 453 | if (is_file($site_cache_path)) { |
| 454 | 454 | include($site_cache_path); |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | return; |
| 458 | 458 | } |
| 459 | 459 | |
| 460 | - include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php'); |
|
| 460 | + include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php'); |
|
| 461 | 461 | $cache = new synccache(); |
| 462 | 462 | $cache->setCachepath($site_cache_dir); |
| 463 | 463 | $cache->setReport(false); |
@@ -508,8 +508,8 @@ discard block |
||
| 508 | 508 | $this->invokeEvent("OnBeforeManagerPageInit"); |
| 509 | 509 | } |
| 510 | 510 | |
| 511 | - if (isset ($_SESSION[$usrType . 'UsrConfigSet'])) { |
|
| 512 | - $usrSettings = &$_SESSION[$usrType . 'UsrConfigSet']; |
|
| 511 | + if (isset ($_SESSION[$usrType.'UsrConfigSet'])) { |
|
| 512 | + $usrSettings = &$_SESSION[$usrType.'UsrConfigSet']; |
|
| 513 | 513 | } else { |
| 514 | 514 | if ($usrType == 'web') { |
| 515 | 515 | $from = $tbl_web_user_settings; |
@@ -529,7 +529,7 @@ discard block |
||
| 529 | 529 | $usrSettings[$row['setting_name']] = $row['setting_value']; |
| 530 | 530 | } |
| 531 | 531 | if (isset ($usrType)) { |
| 532 | - $_SESSION[$usrType . 'UsrConfigSet'] = $usrSettings; |
|
| 532 | + $_SESSION[$usrType.'UsrConfigSet'] = $usrSettings; |
|
| 533 | 533 | } // store user settings in session |
| 534 | 534 | } |
| 535 | 535 | } |
@@ -674,10 +674,10 @@ discard block |
||
| 674 | 674 | $suf = $this->config['friendly_url_suffix']; |
| 675 | 675 | $pre = preg_quote($pre, '/'); |
| 676 | 676 | $suf = preg_quote($suf, '/'); |
| 677 | - if ($pre && preg_match('@^' . $pre . '(.*)$@', $q, $_)) { |
|
| 677 | + if ($pre && preg_match('@^'.$pre.'(.*)$@', $q, $_)) { |
|
| 678 | 678 | $q = $_[1]; |
| 679 | 679 | } |
| 680 | - if ($suf && preg_match('@(.*)' . $suf . '$@', $q, $_)) { |
|
| 680 | + if ($suf && preg_match('@(.*)'.$suf.'$@', $q, $_)) { |
|
| 681 | 681 | $q = $_[1]; |
| 682 | 682 | } |
| 683 | 683 | |
@@ -699,7 +699,7 @@ discard block |
||
| 699 | 699 | if (preg_match('@^[1-9][0-9]*$@', $q) && !isset($this->documentListing[$q])) { /* we got an ID returned, check to make sure it's not an alias */ |
| 700 | 700 | /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */ |
| 701 | 701 | if ($this->config['use_alias_path'] == 1) { |
| 702 | - if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir . '/' . $q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q, $this->getChildIds($this->documentListing[$this->virtualDir], 1))) || ($this->virtualDir == '' && in_array($q, $this->getChildIds(0, 1))))) { |
|
| 702 | + if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir.'/'.$q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q, $this->getChildIds($this->documentListing[$this->virtualDir], 1))) || ($this->virtualDir == '' && in_array($q, $this->getChildIds(0, 1))))) { |
|
| 703 | 703 | $this->documentMethod = 'id'; |
| 704 | 704 | return $q; |
| 705 | 705 | } else { /* not a valid id in terms of virtualDir, treat as alias */ |
@@ -733,7 +733,7 @@ discard block |
||
| 733 | 733 | */ |
| 734 | 734 | public function getHashFile($key) |
| 735 | 735 | { |
| 736 | - return $this->getCacheFolder() . "docid_" . $key . ".pageCache.php"; |
|
| 736 | + return $this->getCacheFolder()."docid_".$key.".pageCache.php"; |
|
| 737 | 737 | } |
| 738 | 738 | |
| 739 | 739 | /** |
@@ -744,9 +744,9 @@ discard block |
||
| 744 | 744 | $hash = $id; |
| 745 | 745 | $tmp = null; |
| 746 | 746 | $params = array(); |
| 747 | - if(!empty($this->systemCacheKey)){ |
|
| 747 | + if (!empty($this->systemCacheKey)) { |
|
| 748 | 748 | $hash = $this->systemCacheKey; |
| 749 | - }else { |
|
| 749 | + } else { |
|
| 750 | 750 | if (!empty($_GET)) { |
| 751 | 751 | // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID. |
| 752 | 752 | $params = $_GET; |
@@ -754,8 +754,8 @@ discard block |
||
| 754 | 754 | $hash .= '_'.md5(http_build_query($params)); |
| 755 | 755 | } |
| 756 | 756 | } |
| 757 | - $evtOut = $this->invokeEvent("OnMakePageCacheKey", array ("hash" => $hash, "id" => $id, 'params' => $params)); |
|
| 758 | - if (is_array($evtOut) && count($evtOut) > 0){ |
|
| 757 | + $evtOut = $this->invokeEvent("OnMakePageCacheKey", array("hash" => $hash, "id" => $id, 'params' => $params)); |
|
| 758 | + if (is_array($evtOut) && count($evtOut) > 0) { |
|
| 759 | 759 | $tmp = array_pop($evtOut); |
| 760 | 760 | } |
| 761 | 761 | return empty($tmp) ? $hash : $tmp; |
@@ -897,12 +897,12 @@ discard block |
||
| 897 | 897 | if ($js = $this->getRegisteredClientStartupScripts()) { |
| 898 | 898 | // change to just before closing </head> |
| 899 | 899 | // $this->documentContent = preg_replace("/(<head[^>]*>)/i", "\\1\n".$js, $this->documentContent); |
| 900 | - $this->documentOutput = preg_replace("/(<\/head>)/i", $js . "\n\\1", $this->documentOutput); |
|
| 900 | + $this->documentOutput = preg_replace("/(<\/head>)/i", $js."\n\\1", $this->documentOutput); |
|
| 901 | 901 | } |
| 902 | 902 | |
| 903 | 903 | // Insert jscripts & html block into template - template must have a </body> tag |
| 904 | 904 | if ($js = $this->getRegisteredClientScripts()) { |
| 905 | - $this->documentOutput = preg_replace("/(<\/body>)/i", $js . "\n\\1", $this->documentOutput); |
|
| 905 | + $this->documentOutput = preg_replace("/(<\/body>)/i", $js."\n\\1", $this->documentOutput); |
|
| 906 | 906 | } |
| 907 | 907 | // End fix by sirlancelot |
| 908 | 908 | |
@@ -913,7 +913,7 @@ discard block |
||
| 913 | 913 | // send out content-type and content-disposition headers |
| 914 | 914 | if (IN_PARSER_MODE == "true") { |
| 915 | 915 | $type = !empty ($this->contentTypes[$this->documentIdentifier]) ? $this->contentTypes[$this->documentIdentifier] : "text/html"; |
| 916 | - header('Content-Type: ' . $type . '; charset=' . $this->config['modx_charset']); |
|
| 916 | + header('Content-Type: '.$type.'; charset='.$this->config['modx_charset']); |
|
| 917 | 917 | // if (($this->documentIdentifier == $this->config['error_page']) || $redirect_error) |
| 918 | 918 | // header('HTTP/1.0 404 Not Found'); |
| 919 | 919 | if (!$this->checkPreview() && $this->documentObject['content_dispo'] == 1) { |
@@ -931,7 +931,7 @@ discard block |
||
| 931 | 931 | $name = preg_replace('|-+|', '-', $name); |
| 932 | 932 | $name = trim($name, '-'); |
| 933 | 933 | } |
| 934 | - $header = 'Content-Disposition: attachment; filename=' . $name; |
|
| 934 | + $header = 'Content-Disposition: attachment; filename='.$name; |
|
| 935 | 935 | header($header); |
| 936 | 936 | } |
| 937 | 937 | } |
@@ -939,7 +939,7 @@ discard block |
||
| 939 | 939 | |
| 940 | 940 | $stats = $this->getTimerStats($this->tstart); |
| 941 | 941 | |
| 942 | - $out =& $this->documentOutput; |
|
| 942 | + $out = & $this->documentOutput; |
|
| 943 | 943 | $out = str_replace("[^q^]", $stats['queries'], $out); |
| 944 | 944 | $out = str_replace("[^qt^]", $stats['queryTime'], $out); |
| 945 | 945 | $out = str_replace("[^p^]", $stats['phpTime'], $out); |
@@ -978,17 +978,17 @@ discard block |
||
| 978 | 978 | $sc .= sprintf("%s. %s (%s)<br>", $s, $sname, sprintf("%2.2f ms", $t)); // currentSnippet |
| 979 | 979 | $tt += $t; |
| 980 | 980 | } |
| 981 | - echo "<fieldset><legend><b>Snippets</b> (" . count($this->snippetsTime) . " / " . sprintf("%2.2f ms", $tt) . ")</legend>{$sc}</fieldset><br />"; |
|
| 981 | + echo "<fieldset><legend><b>Snippets</b> (".count($this->snippetsTime)." / ".sprintf("%2.2f ms", $tt).")</legend>{$sc}</fieldset><br />"; |
|
| 982 | 982 | echo $this->snippetsCode; |
| 983 | 983 | } |
| 984 | 984 | if ($this->dumpPlugins) { |
| 985 | 985 | $ps = ""; |
| 986 | 986 | $tt = 0; |
| 987 | 987 | foreach ($this->pluginsTime as $s => $t) { |
| 988 | - $ps .= "$s (" . sprintf("%2.2f ms", $t * 1000) . ")<br>"; |
|
| 988 | + $ps .= "$s (".sprintf("%2.2f ms", $t * 1000).")<br>"; |
|
| 989 | 989 | $tt += $t; |
| 990 | 990 | } |
| 991 | - echo "<fieldset><legend><b>Plugins</b> (" . count($this->pluginsTime) . " / " . sprintf("%2.2f ms", $tt * 1000) . ")</legend>{$ps}</fieldset><br />"; |
|
| 991 | + echo "<fieldset><legend><b>Plugins</b> (".count($this->pluginsTime)." / ".sprintf("%2.2f ms", $tt * 1000).")</legend>{$ps}</fieldset><br />"; |
|
| 992 | 992 | echo $this->pluginsCode; |
| 993 | 993 | } |
| 994 | 994 | |
@@ -1014,7 +1014,7 @@ discard block |
||
| 1014 | 1014 | $srcTags = explode(',', $tags); |
| 1015 | 1015 | $repTags = array(); |
| 1016 | 1016 | foreach ($srcTags as $tag) { |
| 1017 | - $repTags[] = '\\' . $tag[0] . '\\' . $tag[1]; |
|
| 1017 | + $repTags[] = '\\'.$tag[0].'\\'.$tag[1]; |
|
| 1018 | 1018 | } |
| 1019 | 1019 | return array($srcTags, $repTags); |
| 1020 | 1020 | } |
@@ -1036,7 +1036,7 @@ discard block |
||
| 1036 | 1036 | $stats['phpTime'] = sprintf("%2.4f s", $stats['phpTime']); |
| 1037 | 1037 | $stats['source'] = $this->documentGenerated == 1 ? "database" : "cache"; |
| 1038 | 1038 | $stats['queries'] = isset ($this->executedQueries) ? $this->executedQueries : 0; |
| 1039 | - $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024) . " mb"; |
|
| 1039 | + $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024)." mb"; |
|
| 1040 | 1040 | |
| 1041 | 1041 | return $stats; |
| 1042 | 1042 | } |
@@ -1069,7 +1069,7 @@ discard block |
||
| 1069 | 1069 | { |
| 1070 | 1070 | $cacheRefreshTime = 0; |
| 1071 | 1071 | $recent_update = 0; |
| 1072 | - @include(MODX_BASE_PATH . $this->getCacheFolder() . 'sitePublishing.idx.php'); |
|
| 1072 | + @include(MODX_BASE_PATH.$this->getCacheFolder().'sitePublishing.idx.php'); |
|
| 1073 | 1073 | $this->recentUpdate = $recent_update; |
| 1074 | 1074 | |
| 1075 | 1075 | $timeNow = $_SERVER['REQUEST_TIME'] + $this->config['server_offset_time']; |
@@ -1123,8 +1123,8 @@ discard block |
||
| 1123 | 1123 | } |
| 1124 | 1124 | |
| 1125 | 1125 | $docObjSerial = serialize($this->documentObject); |
| 1126 | - $cacheContent = $docObjSerial . "<!--__MODxCacheSpliter__-->" . $this->documentContent; |
|
| 1127 | - $page_cache_path = MODX_BASE_PATH . $this->getHashFile($this->cacheKey); |
|
| 1126 | + $cacheContent = $docObjSerial."<!--__MODxCacheSpliter__-->".$this->documentContent; |
|
| 1127 | + $page_cache_path = MODX_BASE_PATH.$this->getHashFile($this->cacheKey); |
|
| 1128 | 1128 | file_put_contents($page_cache_path, "<?php die('Unauthorized access.'); ?>$cacheContent"); |
| 1129 | 1129 | } |
| 1130 | 1130 | } |
@@ -1166,16 +1166,16 @@ discard block |
||
| 1166 | 1166 | return array(); |
| 1167 | 1167 | } |
| 1168 | 1168 | $spacer = md5('<<<EVO>>>'); |
| 1169 | - if($left==='{{' && strpos($content,';}}')!==false) $content = str_replace(';}}', sprintf(';}%s}', $spacer),$content); |
|
| 1170 | - if($left==='{{' && strpos($content,'{{}}')!==false) $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content); |
|
| 1171 | - if($left==='[[' && strpos($content,']]]]')!==false) $content = str_replace(']]]]',sprintf(']]%s]]', $spacer),$content); |
|
| 1172 | - if($left==='[[' && strpos($content,']]]')!==false) $content = str_replace(']]]', sprintf(']%s]]', $spacer),$content); |
|
| 1169 | + if ($left === '{{' && strpos($content, ';}}') !== false) $content = str_replace(';}}', sprintf(';}%s}', $spacer), $content); |
|
| 1170 | + if ($left === '{{' && strpos($content, '{{}}') !== false) $content = str_replace('{{}}', sprintf('{%$1s{}%$1s}', $spacer), $content); |
|
| 1171 | + if ($left === '[[' && strpos($content, ']]]]') !== false) $content = str_replace(']]]]', sprintf(']]%s]]', $spacer), $content); |
|
| 1172 | + if ($left === '[[' && strpos($content, ']]]') !== false) $content = str_replace(']]]', sprintf(']%s]]', $spacer), $content); |
|
| 1173 | 1173 | |
| 1174 | 1174 | $pos['<![CDATA['] = strpos($content, '<![CDATA['); |
| 1175 | 1175 | $pos[']]>'] = strpos($content, ']]>'); |
| 1176 | 1176 | |
| 1177 | 1177 | if ($pos['<![CDATA['] !== false && $pos[']]>'] !== false) { |
| 1178 | - $content = substr($content, 0, $pos['<![CDATA[']) . substr($content, $pos[']]>'] + 3); |
|
| 1178 | + $content = substr($content, 0, $pos['<![CDATA[']).substr($content, $pos[']]>'] + 3); |
|
| 1179 | 1179 | } |
| 1180 | 1180 | |
| 1181 | 1181 | $lp = explode($left, $content); |
@@ -1239,8 +1239,8 @@ discard block |
||
| 1239 | 1239 | } |
| 1240 | 1240 | } |
| 1241 | 1241 | } |
| 1242 | - foreach($tags as $i=>$tag) { |
|
| 1243 | - if(strpos($tag,$spacer)!==false) $tags[$i] = str_replace($spacer, '', $tag); |
|
| 1242 | + foreach ($tags as $i=>$tag) { |
|
| 1243 | + if (strpos($tag, $spacer) !== false) $tags[$i] = str_replace($spacer, '', $tag); |
|
| 1244 | 1244 | } |
| 1245 | 1245 | return $tags; |
| 1246 | 1246 | } |
@@ -1280,7 +1280,7 @@ discard block |
||
| 1280 | 1280 | } |
| 1281 | 1281 | |
| 1282 | 1282 | foreach ($matches[1] as $i => $key) { |
| 1283 | - if(strpos($key,'[+')!==false) continue; // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
| 1283 | + if (strpos($key, '[+') !== false) continue; // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
| 1284 | 1284 | if (substr($key, 0, 1) == '#') { |
| 1285 | 1285 | $key = substr($key, 1); |
| 1286 | 1286 | } // remove # for QuickEdit format |
@@ -1300,8 +1300,8 @@ discard block |
||
| 1300 | 1300 | } |
| 1301 | 1301 | |
| 1302 | 1302 | if (is_array($value)) { |
| 1303 | - include_once(MODX_MANAGER_PATH . 'includes/tmplvars.format.inc.php'); |
|
| 1304 | - include_once(MODX_MANAGER_PATH . 'includes/tmplvars.commands.inc.php'); |
|
| 1303 | + include_once(MODX_MANAGER_PATH.'includes/tmplvars.format.inc.php'); |
|
| 1304 | + include_once(MODX_MANAGER_PATH.'includes/tmplvars.commands.inc.php'); |
|
| 1305 | 1305 | $value = getTVDisplayFormat($value[0], $value[1], $value[2], $value[3], $value[4]); |
| 1306 | 1306 | } |
| 1307 | 1307 | |
@@ -1312,8 +1312,8 @@ discard block |
||
| 1312 | 1312 | |
| 1313 | 1313 | if (strpos($content, $s) !== false) { |
| 1314 | 1314 | $content = str_replace($s, $value, $content); |
| 1315 | - } elseif($this->debug) { |
|
| 1316 | - $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
| 1315 | + } elseif ($this->debug) { |
|
| 1316 | + $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
| 1317 | 1317 | } |
| 1318 | 1318 | } |
| 1319 | 1319 | |
@@ -1480,8 +1480,8 @@ discard block |
||
| 1480 | 1480 | $s = &$matches[0][$i]; |
| 1481 | 1481 | if (strpos($content, $s) !== false) { |
| 1482 | 1482 | $content = str_replace($s, $value, $content); |
| 1483 | - } elseif($this->debug) { |
|
| 1484 | - $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
| 1483 | + } elseif ($this->debug) { |
|
| 1484 | + $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
| 1485 | 1485 | } |
| 1486 | 1486 | } |
| 1487 | 1487 | return $content; |
@@ -1534,7 +1534,7 @@ discard block |
||
| 1534 | 1534 | } |
| 1535 | 1535 | |
| 1536 | 1536 | $value = $this->parseText($value, $params); // parse local scope placeholers for ConditionalTags |
| 1537 | - $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers |
|
| 1537 | + $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers |
|
| 1538 | 1538 | if ($this->config['enable_at_syntax']) { |
| 1539 | 1539 | $value = $this->mergeConditionalTagsContent($value); |
| 1540 | 1540 | } |
@@ -1549,8 +1549,8 @@ discard block |
||
| 1549 | 1549 | $s = &$matches[0][$i]; |
| 1550 | 1550 | if (strpos($content, $s) !== false) { |
| 1551 | 1551 | $content = str_replace($s, $value, $content); |
| 1552 | - } elseif($this->debug) { |
|
| 1553 | - $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
| 1552 | + } elseif ($this->debug) { |
|
| 1553 | + $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
| 1554 | 1554 | } |
| 1555 | 1555 | } |
| 1556 | 1556 | return $content; |
@@ -1608,8 +1608,8 @@ discard block |
||
| 1608 | 1608 | $s = &$matches[0][$i]; |
| 1609 | 1609 | if (strpos($content, $s) !== false) { |
| 1610 | 1610 | $content = str_replace($s, $value, $content); |
| 1611 | - } elseif($this->debug) { |
|
| 1612 | - $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
| 1611 | + } elseif ($this->debug) { |
|
| 1612 | + $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
| 1613 | 1613 | } |
| 1614 | 1614 | } |
| 1615 | 1615 | return $content; |
@@ -1633,7 +1633,7 @@ discard block |
||
| 1633 | 1633 | return $content; |
| 1634 | 1634 | } |
| 1635 | 1635 | |
| 1636 | - $sp = '#' . md5('ConditionalTags' . $_SERVER['REQUEST_TIME']) . '#'; |
|
| 1636 | + $sp = '#'.md5('ConditionalTags'.$_SERVER['REQUEST_TIME']).'#'; |
|
| 1637 | 1637 | $content = str_replace(array('<?php', '<?=', '<?', '?>'), array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), $content); |
| 1638 | 1638 | |
| 1639 | 1639 | $pieces = explode('<@IF:', $content); |
@@ -1644,7 +1644,7 @@ discard block |
||
| 1644 | 1644 | } |
| 1645 | 1645 | list($cmd, $text) = explode('>', $split, 2); |
| 1646 | 1646 | $cmd = str_replace("'", "\'", $cmd); |
| 1647 | - $content .= "<?php if(\$this->_parseCTagCMD('" . $cmd . "')): ?>"; |
|
| 1647 | + $content .= "<?php if(\$this->_parseCTagCMD('".$cmd."')): ?>"; |
|
| 1648 | 1648 | $content .= $text; |
| 1649 | 1649 | } |
| 1650 | 1650 | $pieces = explode('<@ELSEIF:', $content); |
@@ -1655,13 +1655,13 @@ discard block |
||
| 1655 | 1655 | } |
| 1656 | 1656 | list($cmd, $text) = explode('>', $split, 2); |
| 1657 | 1657 | $cmd = str_replace("'", "\'", $cmd); |
| 1658 | - $content .= "<?php elseif(\$this->_parseCTagCMD('" . $cmd . "')): ?>"; |
|
| 1658 | + $content .= "<?php elseif(\$this->_parseCTagCMD('".$cmd."')): ?>"; |
|
| 1659 | 1659 | $content .= $text; |
| 1660 | 1660 | } |
| 1661 | 1661 | |
| 1662 | 1662 | $content = str_replace(array('<@ELSE>', '<@ENDIF>'), array('<?php else:?>', '<?php endif;?>'), $content); |
| 1663 | 1663 | ob_start(); |
| 1664 | - $content = eval('?>' . $content); |
|
| 1664 | + $content = eval('?>'.$content); |
|
| 1665 | 1665 | $content = ob_get_clean(); |
| 1666 | 1666 | $content = str_replace(array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), array('<?php', '<?=', '<?', '?>'), $content); |
| 1667 | 1667 | |
@@ -1786,7 +1786,7 @@ discard block |
||
| 1786 | 1786 | $matches = $this->getTagsFromContent($content, $left, $right); |
| 1787 | 1787 | if (!empty($matches)) { |
| 1788 | 1788 | foreach ($matches[0] as $i => $v) { |
| 1789 | - $addBreakMatches[$i] = $v . "\n"; |
|
| 1789 | + $addBreakMatches[$i] = $v."\n"; |
|
| 1790 | 1790 | } |
| 1791 | 1791 | $content = str_replace($addBreakMatches, '', $content); |
| 1792 | 1792 | if (strpos($content, $left) !== false) { |
@@ -1819,8 +1819,8 @@ discard block |
||
| 1819 | 1819 | $s = &$matches[0][$i]; |
| 1820 | 1820 | if (strpos($content, $s) !== false) { |
| 1821 | 1821 | $content = str_replace($s, $v, $content); |
| 1822 | - } elseif($this->debug) { |
|
| 1823 | - $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
| 1822 | + } elseif ($this->debug) { |
|
| 1823 | + $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
| 1824 | 1824 | } |
| 1825 | 1825 | } |
| 1826 | 1826 | return $content; |
@@ -1884,7 +1884,7 @@ discard block |
||
| 1884 | 1884 | $msg = ($msg === false) ? 'ob_get_contents() error' : $msg; |
| 1885 | 1885 | $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Plugin', $error_info['message'], $error_info['line'], $msg); |
| 1886 | 1886 | if ($this->isBackend()) { |
| 1887 | - $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>' . $msg . '</p>'); |
|
| 1887 | + $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>'.$msg.'</p>'); |
|
| 1888 | 1888 | } |
| 1889 | 1889 | } |
| 1890 | 1890 | } else { |
@@ -1930,7 +1930,7 @@ discard block |
||
| 1930 | 1930 | $echo = ($echo === false) ? 'ob_get_contents() error' : $echo; |
| 1931 | 1931 | $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Snippet', $error_info['message'], $error_info['line'], $echo); |
| 1932 | 1932 | if ($this->isBackend()) { |
| 1933 | - $this->event->alert('An error occurred while loading. Please see the event log for more information<p>' . $echo . $return . '</p>'); |
|
| 1933 | + $this->event->alert('An error occurred while loading. Please see the event log for more information<p>'.$echo.$return.'</p>'); |
|
| 1934 | 1934 | } |
| 1935 | 1935 | } |
| 1936 | 1936 | } |
@@ -1938,7 +1938,7 @@ discard block |
||
| 1938 | 1938 | if (is_array($return) || is_object($return)) { |
| 1939 | 1939 | return $return; |
| 1940 | 1940 | } else { |
| 1941 | - return $echo . $return; |
|
| 1941 | + return $echo.$return; |
|
| 1942 | 1942 | } |
| 1943 | 1943 | } |
| 1944 | 1944 | |
@@ -1976,8 +1976,8 @@ discard block |
||
| 1976 | 1976 | } |
| 1977 | 1977 | if (strpos($content, $s) !== false) { |
| 1978 | 1978 | $content = str_replace($s, $value, $content); |
| 1979 | - } elseif($this->debug) { |
|
| 1980 | - $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
| 1979 | + } elseif ($this->debug) { |
|
| 1980 | + $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
| 1981 | 1981 | } |
| 1982 | 1982 | continue; |
| 1983 | 1983 | } |
@@ -1988,8 +1988,8 @@ discard block |
||
| 1988 | 1988 | |
| 1989 | 1989 | if (strpos($content, $s) !== false) { |
| 1990 | 1990 | $content = str_replace($s, $value, $content); |
| 1991 | - } elseif($this->debug) { |
|
| 1992 | - $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
| 1991 | + } elseif ($this->debug) { |
|
| 1992 | + $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
| 1993 | 1993 | } |
| 1994 | 1994 | } |
| 1995 | 1995 | |
@@ -2081,7 +2081,7 @@ discard block |
||
| 2081 | 2081 | $eventtime = sprintf('%2.2f ms', $eventtime * 1000); |
| 2082 | 2082 | $code = str_replace("\t", ' ', $this->htmlspecialchars($value)); |
| 2083 | 2083 | $piece = str_replace("\t", ' ', $this->htmlspecialchars($piece)); |
| 2084 | - $print_r_params = str_replace("\t", ' ', $this->htmlspecialchars('$modx->event->params = ' . print_r($params, true))); |
|
| 2084 | + $print_r_params = str_replace("\t", ' ', $this->htmlspecialchars('$modx->event->params = '.print_r($params, true))); |
|
| 2085 | 2085 | $this->snippetsCode .= sprintf('<fieldset style="margin:1em;"><legend><b>%s</b>(%s)</legend><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">[[%s]]</pre><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">%s</pre><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">%s</pre></fieldset>', $snippetObject['name'], $eventtime, $piece, $print_r_params, $code); |
| 2086 | 2086 | $this->snippetsTime[] = array('sname' => $key, 'time' => $eventtime); |
| 2087 | 2087 | } |
@@ -2325,7 +2325,7 @@ discard block |
||
| 2325 | 2325 | $rs = $this->db->select('name,snippet,properties', '[+prefix+]site_snippets', $where); |
| 2326 | 2326 | $count = $this->db->getRecordCount($rs); |
| 2327 | 2327 | if (1 < $count) { |
| 2328 | - exit('Error $modx->_getSnippetObject()' . $snip_name); |
|
| 2328 | + exit('Error $modx->_getSnippetObject()'.$snip_name); |
|
| 2329 | 2329 | } |
| 2330 | 2330 | if ($count) { |
| 2331 | 2331 | $row = $this->db->getRow($rs); |
@@ -2351,7 +2351,7 @@ discard block |
||
| 2351 | 2351 | public function toAlias($text) |
| 2352 | 2352 | { |
| 2353 | 2353 | $suff = $this->config['friendly_url_suffix']; |
| 2354 | - return str_replace(array('.xml' . $suff, '.rss' . $suff, '.js' . $suff, '.css' . $suff, '.txt' . $suff, '.json' . $suff, '.pdf' . $suff), array('.xml', '.rss', '.js', '.css', '.txt', '.json', '.pdf'), $text); |
|
| 2354 | + return str_replace(array('.xml'.$suff, '.rss'.$suff, '.js'.$suff, '.css'.$suff, '.txt'.$suff, '.json'.$suff, '.pdf'.$suff), array('.xml', '.rss', '.js', '.css', '.txt', '.json', '.pdf'), $text); |
|
| 2355 | 2355 | } |
| 2356 | 2356 | |
| 2357 | 2357 | /** |
@@ -2383,7 +2383,7 @@ discard block |
||
| 2383 | 2383 | $suff = '/'; |
| 2384 | 2384 | } |
| 2385 | 2385 | |
| 2386 | - $url = ($dir != '' ? $dir . '/' : '') . $pre . $alias . $suff; |
|
| 2386 | + $url = ($dir != '' ? $dir.'/' : '').$pre.$alias.$suff; |
|
| 2387 | 2387 | } |
| 2388 | 2388 | |
| 2389 | 2389 | $evtOut = $this->invokeEvent('OnMakeDocUrl', array( |
@@ -2420,7 +2420,7 @@ discard block |
||
| 2420 | 2420 | preg_match_all('!\[\~([0-9]+)\~\]!ise', $documentSource, $match); |
| 2421 | 2421 | $ids = implode(',', array_unique($match['1'])); |
| 2422 | 2422 | if ($ids) { |
| 2423 | - $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (" . $ids . ") AND isfolder = '0'"); |
|
| 2423 | + $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (".$ids.") AND isfolder = '0'"); |
|
| 2424 | 2424 | while ($row = $this->db->getRow($res)) { |
| 2425 | 2425 | if ($this->config['use_alias_path'] == '1' && $row['parent'] != 0) { |
| 2426 | 2426 | $parent = $row['parent']; |
@@ -2431,7 +2431,7 @@ discard block |
||
| 2431 | 2431 | $parent = $this->aliasListing[$parent]['parent']; |
| 2432 | 2432 | } |
| 2433 | 2433 | |
| 2434 | - $aliases[$row['id']] = $path . '/' . $row['alias']; |
|
| 2434 | + $aliases[$row['id']] = $path.'/'.$row['alias']; |
|
| 2435 | 2435 | } else { |
| 2436 | 2436 | $aliases[$row['id']] = $row['alias']; |
| 2437 | 2437 | } |
@@ -2443,7 +2443,7 @@ discard block |
||
| 2443 | 2443 | $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0); |
| 2444 | 2444 | $pref = $this->config['friendly_url_prefix']; |
| 2445 | 2445 | $suff = $this->config['friendly_url_suffix']; |
| 2446 | - $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
| 2446 | + $documentSource = preg_replace_callback($in, function($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
| 2447 | 2447 | global $modx; |
| 2448 | 2448 | $thealias = $aliases[$m[1]]; |
| 2449 | 2449 | $thefolder = $isfolder[$m[1]]; |
@@ -2459,7 +2459,7 @@ discard block |
||
| 2459 | 2459 | |
| 2460 | 2460 | } else { |
| 2461 | 2461 | $in = '!\[\~([0-9]+)\~\]!is'; |
| 2462 | - $out = "index.php?id=" . '\1'; |
|
| 2462 | + $out = "index.php?id=".'\1'; |
|
| 2463 | 2463 | $documentSource = preg_replace($in, $out, $documentSource); |
| 2464 | 2464 | } |
| 2465 | 2465 | |
@@ -2480,7 +2480,7 @@ discard block |
||
| 2480 | 2480 | $scheme = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http'; |
| 2481 | 2481 | $len_base_url = strlen($this->config['base_url']); |
| 2482 | 2482 | |
| 2483 | - $url_path = $q;//LANG |
|
| 2483 | + $url_path = $q; //LANG |
|
| 2484 | 2484 | |
| 2485 | 2485 | if (substr($url_path, 0, $len_base_url) === $this->config['base_url']) { |
| 2486 | 2486 | $url_path = substr($url_path, $len_base_url); |
@@ -2492,7 +2492,7 @@ discard block |
||
| 2492 | 2492 | $strictURL = substr($strictURL, $len_base_url); |
| 2493 | 2493 | } |
| 2494 | 2494 | $http_host = $_SERVER['HTTP_HOST']; |
| 2495 | - $requestedURL = "{$scheme}://{$http_host}" . '/' . $q; //LANG |
|
| 2495 | + $requestedURL = "{$scheme}://{$http_host}".'/'.$q; //LANG |
|
| 2496 | 2496 | |
| 2497 | 2497 | $site_url = $this->config['site_url']; |
| 2498 | 2498 | |
@@ -2508,7 +2508,7 @@ discard block |
||
| 2508 | 2508 | } |
| 2509 | 2509 | if ($this->config['base_url'] != $_SERVER['REQUEST_URI']) { |
| 2510 | 2510 | if (empty($_POST)) { |
| 2511 | - if (($this->config['base_url'] . '?' . $qstring) != $_SERVER['REQUEST_URI']) { |
|
| 2511 | + if (($this->config['base_url'].'?'.$qstring) != $_SERVER['REQUEST_URI']) { |
|
| 2512 | 2512 | $this->sendRedirect($url, 0, 'REDIRECT_HEADER', 'HTTP/1.0 301 Moved Permanently'); |
| 2513 | 2513 | exit(0); |
| 2514 | 2514 | } |
@@ -2571,7 +2571,7 @@ discard block |
||
| 2571 | 2571 | $docgrp = implode(",", $docgrp); |
| 2572 | 2572 | } |
| 2573 | 2573 | // get document |
| 2574 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
| 2574 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
| 2575 | 2575 | $rs = $this->db->select('sc.*', "{$tblsc} sc |
| 2576 | 2576 | LEFT JOIN {$tbldg} dg ON dg.document = sc.id", "sc.{$method} = '{$identifier}' AND ({$access})", "", 1); |
| 2577 | 2577 | if ($this->db->getRecordCount($rs) < 1) { |
@@ -2607,9 +2607,9 @@ discard block |
||
| 2607 | 2607 | } |
| 2608 | 2608 | if ($documentObject['template']) { |
| 2609 | 2609 | // load TVs and merge with document - Orig by Apodigm - Docvars |
| 2610 | - $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars") . " tv |
|
| 2611 | - INNER JOIN " . $this->getFullTableName("site_tmplvar_templates") . " tvtpl ON tvtpl.tmplvarid = tv.id |
|
| 2612 | - LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues") . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'"); |
|
| 2610 | + $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars")." tv |
|
| 2611 | + INNER JOIN " . $this->getFullTableName("site_tmplvar_templates")." tvtpl ON tvtpl.tmplvarid = tv.id |
|
| 2612 | + LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues")." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'"); |
|
| 2613 | 2613 | $tmplvars = array(); |
| 2614 | 2614 | while ($row = $this->db->getRow($rs)) { |
| 2615 | 2615 | $tmplvars[$row['name']] = array( |
@@ -2655,7 +2655,7 @@ discard block |
||
| 2655 | 2655 | $st = md5($source); |
| 2656 | 2656 | } |
| 2657 | 2657 | if ($this->dumpSnippets == 1) { |
| 2658 | - $this->snippetsCode .= "<fieldset><legend><b style='color: #821517;'>PARSE PASS " . ($i + 1) . "</b></legend><p>The following snippets (if any) were parsed during this pass.</p>"; |
|
| 2658 | + $this->snippetsCode .= "<fieldset><legend><b style='color: #821517;'>PARSE PASS ".($i + 1)."</b></legend><p>The following snippets (if any) were parsed during this pass.</p>"; |
|
| 2659 | 2659 | } |
| 2660 | 2660 | |
| 2661 | 2661 | // invoke OnParseDocument event |
@@ -2741,7 +2741,7 @@ discard block |
||
| 2741 | 2741 | |
| 2742 | 2742 | // Check use_alias_path and check if $this->virtualDir is set to anything, then parse the path |
| 2743 | 2743 | if ($this->config['use_alias_path'] == 1) { |
| 2744 | - $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir . '/' : '') . $this->documentIdentifier; |
|
| 2744 | + $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir.'/' : '').$this->documentIdentifier; |
|
| 2745 | 2745 | if (isset($this->documentListing[$alias])) { |
| 2746 | 2746 | $this->documentIdentifier = $this->documentListing[$alias]; |
| 2747 | 2747 | } else { |
@@ -2802,7 +2802,7 @@ discard block |
||
| 2802 | 2802 | } else { |
| 2803 | 2803 | $docAlias = $this->db->escape($this->documentIdentifier); |
| 2804 | 2804 | $rs = $this->db->select('id', $this->getFullTableName('site_content'), "deleted=0 and alias='{$docAlias}'"); |
| 2805 | - $this->documentIdentifier = (int)$this->db->getValue($rs); |
|
| 2805 | + $this->documentIdentifier = (int) $this->db->getValue($rs); |
|
| 2806 | 2806 | } |
| 2807 | 2807 | } |
| 2808 | 2808 | $this->documentMethod = 'id'; |
@@ -2855,7 +2855,7 @@ discard block |
||
| 2855 | 2855 | $_REQUEST[$n] = $_GET[$n] = $v; |
| 2856 | 2856 | } |
| 2857 | 2857 | } |
| 2858 | - $_SERVER['PHP_SELF'] = $this->config['base_url'] . $qp['path']; |
|
| 2858 | + $_SERVER['PHP_SELF'] = $this->config['base_url'].$qp['path']; |
|
| 2859 | 2859 | $this->q = $qp['path']; |
| 2860 | 2860 | return $qp['path']; |
| 2861 | 2861 | } |
@@ -2949,7 +2949,7 @@ discard block |
||
| 2949 | 2949 | $this->sendErrorPage(); |
| 2950 | 2950 | } else { |
| 2951 | 2951 | // Inculde the necessary files to check document permissions |
| 2952 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
| 2952 | + include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php'); |
|
| 2953 | 2953 | $udperms = new udperms(); |
| 2954 | 2954 | $udperms->user = $this->getLoginUserID(); |
| 2955 | 2955 | $udperms->document = $this->documentIdentifier; |
@@ -3003,7 +3003,7 @@ discard block |
||
| 3003 | 3003 | while ($id && $height--) { |
| 3004 | 3004 | $thisid = $id; |
| 3005 | 3005 | if ($this->config['aliaslistingfolder'] == 1) { |
| 3006 | - $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->db->getValue("SELECT `parent` FROM " . $this->getFullTableName("site_content") . " WHERE `id` = '{$id}' LIMIT 0,1"); |
|
| 3006 | + $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->db->getValue("SELECT `parent` FROM ".$this->getFullTableName("site_content")." WHERE `id` = '{$id}' LIMIT 0,1"); |
|
| 3007 | 3007 | if (!$id || $id == '0') { |
| 3008 | 3008 | break; |
| 3009 | 3009 | } |
@@ -3054,15 +3054,15 @@ discard block |
||
| 3054 | 3054 | |
| 3055 | 3055 | if ($this->config['aliaslistingfolder'] == 1) { |
| 3056 | 3056 | |
| 3057 | - $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (" . $id . ") AND deleted = '0'"); |
|
| 3057 | + $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (".$id.") AND deleted = '0'"); |
|
| 3058 | 3058 | $idx = array(); |
| 3059 | 3059 | while ($row = $this->db->getRow($res)) { |
| 3060 | 3060 | $pAlias = ''; |
| 3061 | 3061 | if (isset($this->aliasListing[$row['parent']])) { |
| 3062 | - $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'] . '/' : ''; |
|
| 3063 | - $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'] . '/' : ''; |
|
| 3062 | + $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'].'/' : ''; |
|
| 3063 | + $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'].'/' : ''; |
|
| 3064 | 3064 | }; |
| 3065 | - $children[$pAlias . $row['alias']] = $row['id']; |
|
| 3065 | + $children[$pAlias.$row['alias']] = $row['id']; |
|
| 3066 | 3066 | if ($row['isfolder'] == 1) { |
| 3067 | 3067 | $idx[] = $row['id']; |
| 3068 | 3068 | } |
@@ -3094,7 +3094,7 @@ discard block |
||
| 3094 | 3094 | $depth--; |
| 3095 | 3095 | |
| 3096 | 3096 | foreach ($documentMap_cache[$id] as $childId) { |
| 3097 | - $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '') . $this->aliasListing[$childId]['alias']; |
|
| 3097 | + $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '').$this->aliasListing[$childId]['alias']; |
|
| 3098 | 3098 | if (!strlen($pkey)) { |
| 3099 | 3099 | $pkey = "{$childId}"; |
| 3100 | 3100 | } |
@@ -3120,11 +3120,11 @@ discard block |
||
| 3120 | 3120 | public function webAlertAndQuit($msg, $url = "") |
| 3121 | 3121 | { |
| 3122 | 3122 | global $modx_manager_charset; |
| 3123 | - if($this->ajaxMode === true) $this->jsonResponse(array('error'=>$msg)); |
|
| 3123 | + if ($this->ajaxMode === true) $this->jsonResponse(array('error'=>$msg)); |
|
| 3124 | 3124 | if (substr(strtolower($url), 0, 11) == "javascript:") { |
| 3125 | 3125 | $fnc = substr($url, 11); |
| 3126 | 3126 | } elseif ($url) { |
| 3127 | - $fnc = "window.location.href='" . addslashes($url) . "';"; |
|
| 3127 | + $fnc = "window.location.href='".addslashes($url)."';"; |
|
| 3128 | 3128 | } else { |
| 3129 | 3129 | $fnc = "history.back(-1);"; |
| 3130 | 3130 | } |
@@ -3133,7 +3133,7 @@ discard block |
||
| 3133 | 3133 | <meta http-equiv=\"Content-Type\" content=\"text/html; charset={$modx_manager_charset};\"> |
| 3134 | 3134 | <script> |
| 3135 | 3135 | function __alertQuit() { |
| 3136 | - alert('" . addslashes($msg) . "'); |
|
| 3136 | + alert('".addslashes($msg)."'); |
|
| 3137 | 3137 | {$fnc} |
| 3138 | 3138 | } |
| 3139 | 3139 | window.setTimeout('__alertQuit();',100); |
@@ -3157,7 +3157,7 @@ discard block |
||
| 3157 | 3157 | if ($pms) { |
| 3158 | 3158 | $state = ($pms[$pm] == 1); |
| 3159 | 3159 | } |
| 3160 | - return (int)$state; |
|
| 3160 | + return (int) $state; |
|
| 3161 | 3161 | } |
| 3162 | 3162 | |
| 3163 | 3163 | /** |
@@ -3238,7 +3238,7 @@ discard block |
||
| 3238 | 3238 | $this->lockedElements = array(); |
| 3239 | 3239 | $this->cleanupExpiredLocks(); |
| 3240 | 3240 | |
| 3241 | - $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks') . " ul |
|
| 3241 | + $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks')." ul |
|
| 3242 | 3242 | LEFT JOIN {$this->getFullTableName('manager_users')} mu on ul.internalKey = mu.id"); |
| 3243 | 3243 | while ($row = $this->db->getRow($rs)) { |
| 3244 | 3244 | $this->lockedElements[$row['elementType']][$row['elementId']] = array( |
@@ -3274,7 +3274,7 @@ discard block |
||
| 3274 | 3274 | foreach ($rs as $row) { |
| 3275 | 3275 | $userSids[] = $row['sid']; |
| 3276 | 3276 | } |
| 3277 | - $userSids = "'" . implode("','", $userSids) . "'"; |
|
| 3277 | + $userSids = "'".implode("','", $userSids)."'"; |
|
| 3278 | 3278 | $this->db->delete($this->getFullTableName('active_user_locks'), "sid NOT IN({$userSids})"); |
| 3279 | 3279 | } else { |
| 3280 | 3280 | $this->db->delete($this->getFullTableName('active_user_locks')); |
@@ -3471,8 +3471,8 @@ discard block |
||
| 3471 | 3471 | if (isset($this->config['send_errormail']) && $this->config['send_errormail'] !== '0') { |
| 3472 | 3472 | if ($this->config['send_errormail'] <= $type) { |
| 3473 | 3473 | $this->sendmail(array( |
| 3474 | - 'subject' => 'MODX System Error on ' . $this->config['site_name'], |
|
| 3475 | - 'body' => 'Source: ' . $source . ' - The details of the error could be seen in the MODX system events log.', |
|
| 3474 | + 'subject' => 'MODX System Error on '.$this->config['site_name'], |
|
| 3475 | + 'body' => 'Source: '.$source.' - The details of the error could be seen in the MODX system events log.', |
|
| 3476 | 3476 | 'type' => 'text' |
| 3477 | 3477 | )); |
| 3478 | 3478 | } |
@@ -3520,7 +3520,7 @@ discard block |
||
| 3520 | 3520 | $p['fromname'] = $userinfo['username']; |
| 3521 | 3521 | } |
| 3522 | 3522 | if ($msg === '' && !isset($p['body'])) { |
| 3523 | - $p['body'] = $_SERVER['REQUEST_URI'] . "\n" . $_SERVER['HTTP_USER_AGENT'] . "\n" . $_SERVER['HTTP_REFERER']; |
|
| 3523 | + $p['body'] = $_SERVER['REQUEST_URI']."\n".$_SERVER['HTTP_USER_AGENT']."\n".$_SERVER['HTTP_REFERER']; |
|
| 3524 | 3524 | } elseif (is_string($msg) && 0 < strlen($msg)) { |
| 3525 | 3525 | $p['body'] = $msg; |
| 3526 | 3526 | } |
@@ -3560,8 +3560,8 @@ discard block |
||
| 3560 | 3560 | $files = array(); |
| 3561 | 3561 | } |
| 3562 | 3562 | foreach ($files as $f) { |
| 3563 | - if (file_exists(MODX_BASE_PATH . $f) && is_file(MODX_BASE_PATH . $f) && is_readable(MODX_BASE_PATH . $f)) { |
|
| 3564 | - $this->mail->AddAttachment(MODX_BASE_PATH . $f); |
|
| 3563 | + if (file_exists(MODX_BASE_PATH.$f) && is_file(MODX_BASE_PATH.$f) && is_readable(MODX_BASE_PATH.$f)) { |
|
| 3564 | + $this->mail->AddAttachment(MODX_BASE_PATH.$f); |
|
| 3565 | 3565 | } |
| 3566 | 3566 | } |
| 3567 | 3567 | $rs = $this->mail->send(); |
@@ -3606,7 +3606,7 @@ discard block |
||
| 3606 | 3606 | */ |
| 3607 | 3607 | public function isFrontend() |
| 3608 | 3608 | { |
| 3609 | - return ! $this->isBackend(); |
|
| 3609 | + return !$this->isBackend(); |
|
| 3610 | 3610 | } |
| 3611 | 3611 | |
| 3612 | 3612 | /** |
@@ -3631,14 +3631,14 @@ discard block |
||
| 3631 | 3631 | $tblsc = $this->getFullTableName("site_content"); |
| 3632 | 3632 | $tbldg = $this->getFullTableName("document_groups"); |
| 3633 | 3633 | // modify field names to use sc. table reference |
| 3634 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
| 3635 | - $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
| 3634 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
| 3635 | + $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
| 3636 | 3636 | // get document groups for current user |
| 3637 | 3637 | if ($docgrp = $this->getUserDocGroups()) { |
| 3638 | 3638 | $docgrp = implode(",", $docgrp); |
| 3639 | 3639 | } |
| 3640 | 3640 | // build query |
| 3641 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
| 3641 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
| 3642 | 3642 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
| 3643 | 3643 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}"); |
| 3644 | 3644 | $resourceArray = $this->db->makeArray($result); |
@@ -3668,14 +3668,14 @@ discard block |
||
| 3668 | 3668 | $tbldg = $this->getFullTableName("document_groups"); |
| 3669 | 3669 | |
| 3670 | 3670 | // modify field names to use sc. table reference |
| 3671 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
| 3672 | - $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
| 3671 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
| 3672 | + $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
| 3673 | 3673 | // get document groups for current user |
| 3674 | 3674 | if ($docgrp = $this->getUserDocGroups()) { |
| 3675 | 3675 | $docgrp = implode(",", $docgrp); |
| 3676 | 3676 | } |
| 3677 | 3677 | // build query |
| 3678 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
| 3678 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
| 3679 | 3679 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
| 3680 | 3680 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND sc.published=1 AND sc.deleted=0 AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}"); |
| 3681 | 3681 | $resourceArray = $this->db->makeArray($result); |
@@ -3710,16 +3710,16 @@ discard block |
||
| 3710 | 3710 | return $this->tmpCache[__FUNCTION__][$cacheKey]; |
| 3711 | 3711 | } |
| 3712 | 3712 | |
| 3713 | - $published = ($published !== 'all') ? 'AND sc.published = ' . $published : ''; |
|
| 3714 | - $deleted = ($deleted !== 'all') ? 'AND sc.deleted = ' . $deleted : ''; |
|
| 3713 | + $published = ($published !== 'all') ? 'AND sc.published = '.$published : ''; |
|
| 3714 | + $deleted = ($deleted !== 'all') ? 'AND sc.deleted = '.$deleted : ''; |
|
| 3715 | 3715 | |
| 3716 | 3716 | if ($where != '') { |
| 3717 | - $where = 'AND ' . $where; |
|
| 3717 | + $where = 'AND '.$where; |
|
| 3718 | 3718 | } |
| 3719 | 3719 | |
| 3720 | 3720 | // modify field names to use sc. table reference |
| 3721 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
| 3722 | - $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
| 3721 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
| 3722 | + $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
| 3723 | 3723 | |
| 3724 | 3724 | // get document groups for current user |
| 3725 | 3725 | if ($docgrp = $this->getUserDocGroups()) { |
@@ -3727,7 +3727,7 @@ discard block |
||
| 3727 | 3727 | } |
| 3728 | 3728 | |
| 3729 | 3729 | // build query |
| 3730 | - $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')'); |
|
| 3730 | + $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')'); |
|
| 3731 | 3731 | |
| 3732 | 3732 | $tblsc = $this->getFullTableName('site_content'); |
| 3733 | 3733 | $tbldg = $this->getFullTableName('document_groups'); |
@@ -3779,10 +3779,10 @@ discard block |
||
| 3779 | 3779 | return false; |
| 3780 | 3780 | } else { |
| 3781 | 3781 | // modify field names to use sc. table reference |
| 3782 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
| 3783 | - $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
| 3782 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
| 3783 | + $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
| 3784 | 3784 | if ($where != '') { |
| 3785 | - $where = 'AND ' . $where; |
|
| 3785 | + $where = 'AND '.$where; |
|
| 3786 | 3786 | } |
| 3787 | 3787 | |
| 3788 | 3788 | $published = ($published !== 'all') ? "AND sc.published = '{$published}'" : ''; |
@@ -3793,13 +3793,13 @@ discard block |
||
| 3793 | 3793 | $docgrp = implode(',', $docgrp); |
| 3794 | 3794 | } |
| 3795 | 3795 | |
| 3796 | - $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')'); |
|
| 3796 | + $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')'); |
|
| 3797 | 3797 | |
| 3798 | 3798 | $tblsc = $this->getFullTableName('site_content'); |
| 3799 | 3799 | $tbldg = $this->getFullTableName('document_groups'); |
| 3800 | 3800 | |
| 3801 | 3801 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
| 3802 | - LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (" . implode(',', $ids) . ") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id", ($sort ? "{$sort} {$dir}" : ""), $limit); |
|
| 3802 | + LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (".implode(',', $ids).") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id", ($sort ? "{$sort} {$dir}" : ""), $limit); |
|
| 3803 | 3803 | |
| 3804 | 3804 | $resourceArray = $this->db->makeArray($result); |
| 3805 | 3805 | |
@@ -3904,12 +3904,12 @@ discard block |
||
| 3904 | 3904 | $tbldg = $this->getFullTableName("document_groups"); |
| 3905 | 3905 | $activeSql = $active == 1 ? "AND sc.published=1 AND sc.deleted=0" : ""; |
| 3906 | 3906 | // modify field names to use sc. table reference |
| 3907 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
| 3907 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
| 3908 | 3908 | // get document groups for current user |
| 3909 | 3909 | if ($docgrp = $this->getUserDocGroups()) { |
| 3910 | 3910 | $docgrp = implode(",", $docgrp); |
| 3911 | 3911 | } |
| 3912 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
| 3912 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
| 3913 | 3913 | $result = $this->db->select($fields, "{$tblsc} sc LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id='{$pageid}' {$activeSql}) AND ({$access})", "", 1); |
| 3914 | 3914 | $pageInfo = $this->db->getRow($result); |
| 3915 | 3915 | |
@@ -3956,7 +3956,7 @@ discard block |
||
| 3956 | 3956 | { |
| 3957 | 3957 | if ($this->currentSnippet) { |
| 3958 | 3958 | $tbl = $this->getFullTableName("site_snippets"); |
| 3959 | - $rs = $this->db->select('id', $tbl, "name='" . $this->db->escape($this->currentSnippet) . "'", '', 1); |
|
| 3959 | + $rs = $this->db->select('id', $tbl, "name='".$this->db->escape($this->currentSnippet)."'", '', 1); |
|
| 3960 | 3960 | if ($snippetId = $this->db->getValue($rs)) { |
| 3961 | 3961 | return $snippetId; |
| 3962 | 3962 | } |
@@ -3983,23 +3983,23 @@ discard block |
||
| 3983 | 3983 | */ |
| 3984 | 3984 | public function clearCache($type = '', $report = false) |
| 3985 | 3985 | { |
| 3986 | - $cache_dir = MODX_BASE_PATH . $this->getCacheFolder(); |
|
| 3986 | + $cache_dir = MODX_BASE_PATH.$this->getCacheFolder(); |
|
| 3987 | 3987 | if (is_array($type)) { |
| 3988 | 3988 | foreach ($type as $_) { |
| 3989 | 3989 | $this->clearCache($_, $report); |
| 3990 | 3990 | } |
| 3991 | 3991 | } elseif ($type == 'full') { |
| 3992 | - include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php'); |
|
| 3992 | + include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php'); |
|
| 3993 | 3993 | $sync = new synccache(); |
| 3994 | 3994 | $sync->setCachepath($cache_dir); |
| 3995 | 3995 | $sync->setReport($report); |
| 3996 | 3996 | $sync->emptyCache(); |
| 3997 | 3997 | } elseif (preg_match('@^[1-9][0-9]*$@', $type)) { |
| 3998 | 3998 | $key = ($this->config['cache_type'] == 2) ? $this->makePageCacheKey($type) : $type; |
| 3999 | - $file_name = "docid_" . $key . "_*.pageCache.php"; |
|
| 4000 | - $cache_path = $cache_dir . $file_name; |
|
| 3999 | + $file_name = "docid_".$key."_*.pageCache.php"; |
|
| 4000 | + $cache_path = $cache_dir.$file_name; |
|
| 4001 | 4001 | $files = glob($cache_path); |
| 4002 | - $files[] = $cache_dir . "docid_" . $key . ".pageCache.php"; |
|
| 4002 | + $files[] = $cache_dir."docid_".$key.".pageCache.php"; |
|
| 4003 | 4003 | foreach ($files as $file) { |
| 4004 | 4004 | if (!is_file($file)) { |
| 4005 | 4005 | continue; |
@@ -4007,7 +4007,7 @@ discard block |
||
| 4007 | 4007 | unlink($file); |
| 4008 | 4008 | } |
| 4009 | 4009 | } else { |
| 4010 | - $files = glob($cache_dir . '*'); |
|
| 4010 | + $files = glob($cache_dir.'*'); |
|
| 4011 | 4011 | foreach ($files as $file) { |
| 4012 | 4012 | $name = basename($file); |
| 4013 | 4013 | if (strpos($name, '.pageCache.php') === false) { |
@@ -4076,7 +4076,7 @@ discard block |
||
| 4076 | 4076 | $f_url_suffix = '/'; |
| 4077 | 4077 | } |
| 4078 | 4078 | |
| 4079 | - $alPath = !empty ($al['path']) ? $al['path'] . '/' : ''; |
|
| 4079 | + $alPath = !empty ($al['path']) ? $al['path'].'/' : ''; |
|
| 4080 | 4080 | |
| 4081 | 4081 | if ($al && $al['alias']) { |
| 4082 | 4082 | $alias = $al['alias']; |
@@ -4084,7 +4084,7 @@ discard block |
||
| 4084 | 4084 | |
| 4085 | 4085 | } |
| 4086 | 4086 | |
| 4087 | - $alias = $alPath . $f_url_prefix . $alias . $f_url_suffix; |
|
| 4087 | + $alias = $alPath.$f_url_prefix.$alias.$f_url_suffix; |
|
| 4088 | 4088 | $url = "{$alias}{$args}"; |
| 4089 | 4089 | } else { |
| 4090 | 4090 | $url = "index.php?id={$id}{$args}"; |
@@ -4103,7 +4103,7 @@ discard block |
||
| 4103 | 4103 | } |
| 4104 | 4104 | |
| 4105 | 4105 | //TODO: check to make sure that $site_url incudes the url :port (e.g. :8080) |
| 4106 | - $host = $scheme == 'full' ? $this->config['site_url'] : $scheme . '://' . $_SERVER['HTTP_HOST'] . $host; |
|
| 4106 | + $host = $scheme == 'full' ? $this->config['site_url'] : $scheme.'://'.$_SERVER['HTTP_HOST'].$host; |
|
| 4107 | 4107 | } |
| 4108 | 4108 | |
| 4109 | 4109 | //fix strictUrl by Bumkaka |
@@ -4112,9 +4112,9 @@ discard block |
||
| 4112 | 4112 | } |
| 4113 | 4113 | |
| 4114 | 4114 | if ($this->config['xhtml_urls']) { |
| 4115 | - $url = preg_replace("/&(?!amp;)/", "&", $host . $virtualDir . $url); |
|
| 4115 | + $url = preg_replace("/&(?!amp;)/", "&", $host.$virtualDir.$url); |
|
| 4116 | 4116 | } else { |
| 4117 | - $url = $host . $virtualDir . $url; |
|
| 4117 | + $url = $host.$virtualDir.$url; |
|
| 4118 | 4118 | } |
| 4119 | 4119 | |
| 4120 | 4120 | $evtOut = $this->invokeEvent('OnMakeDocUrl', array( |
@@ -4138,21 +4138,21 @@ discard block |
||
| 4138 | 4138 | if (isset($this->aliasListing[$id])) { |
| 4139 | 4139 | $out = $this->aliasListing[$id]; |
| 4140 | 4140 | } else { |
| 4141 | - $q = $this->db->query("SELECT id,alias,isfolder,parent FROM " . $this->getFullTableName("site_content") . " WHERE id=" . (int)$id); |
|
| 4141 | + $q = $this->db->query("SELECT id,alias,isfolder,parent FROM ".$this->getFullTableName("site_content")." WHERE id=".(int) $id); |
|
| 4142 | 4142 | if ($this->db->getRecordCount($q) == '1') { |
| 4143 | 4143 | $q = $this->db->getRow($q); |
| 4144 | 4144 | $this->aliasListing[$id] = array( |
| 4145 | - 'id' => (int)$q['id'], |
|
| 4145 | + 'id' => (int) $q['id'], |
|
| 4146 | 4146 | 'alias' => $q['alias'] == '' ? $q['id'] : $q['alias'], |
| 4147 | - 'parent' => (int)$q['parent'], |
|
| 4148 | - 'isfolder' => (int)$q['isfolder'], |
|
| 4147 | + 'parent' => (int) $q['parent'], |
|
| 4148 | + 'isfolder' => (int) $q['isfolder'], |
|
| 4149 | 4149 | ); |
| 4150 | 4150 | if ($this->aliasListing[$id]['parent'] > 0) { |
| 4151 | 4151 | //fix alias_path_usage |
| 4152 | 4152 | if ($this->config['use_alias_path'] == '1') { |
| 4153 | 4153 | //&& $tmp['path'] != '' - fix error slash with epty path |
| 4154 | 4154 | $tmp = $this->getAliasListing($this->aliasListing[$id]['parent']); |
| 4155 | - $this->aliasListing[$id]['path'] = $tmp['path'] . ($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '') . $tmp['alias'] : ''); |
|
| 4155 | + $this->aliasListing[$id]['path'] = $tmp['path'].($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '').$tmp['alias'] : ''); |
|
| 4156 | 4156 | } else { |
| 4157 | 4157 | $this->aliasListing[$id]['path'] = ''; |
| 4158 | 4158 | } |
@@ -4193,7 +4193,7 @@ discard block |
||
| 4193 | 4193 | $out = array(); |
| 4194 | 4194 | if (empty($this->version) || !is_array($this->version)) { |
| 4195 | 4195 | //include for compatibility modx version < 1.0.10 |
| 4196 | - include MODX_MANAGER_PATH . "includes/version.inc.php"; |
|
| 4196 | + include MODX_MANAGER_PATH."includes/version.inc.php"; |
|
| 4197 | 4197 | $this->version = array(); |
| 4198 | 4198 | $this->version['version'] = isset($modx_version) ? $modx_version : ''; |
| 4199 | 4199 | $this->version['branch'] = isset($modx_branch) ? $modx_branch : ''; |
@@ -4215,18 +4215,18 @@ discard block |
||
| 4215 | 4215 | { |
| 4216 | 4216 | if (isset ($this->snippetCache[$snippetName])) { |
| 4217 | 4217 | $snippet = $this->snippetCache[$snippetName]; |
| 4218 | - $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : ''; |
|
| 4218 | + $properties = !empty($this->snippetCache[$snippetName."Props"]) ? $this->snippetCache[$snippetName."Props"] : ''; |
|
| 4219 | 4219 | } else { // not in cache so let's check the db |
| 4220 | - $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM " . $this->getFullTableName("site_snippets") . " as ss LEFT JOIN " . $this->getFullTableName('site_modules') . " as sm on sm.guid=ss.moduleguid WHERE ss.`name`='" . $this->db->escape($snippetName) . "' AND ss.disabled=0;"; |
|
| 4220 | + $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM ".$this->getFullTableName("site_snippets")." as ss LEFT JOIN ".$this->getFullTableName('site_modules')." as sm on sm.guid=ss.moduleguid WHERE ss.`name`='".$this->db->escape($snippetName)."' AND ss.disabled=0;"; |
|
| 4221 | 4221 | $result = $this->db->query($sql); |
| 4222 | 4222 | if ($this->db->getRecordCount($result) == 1) { |
| 4223 | 4223 | $row = $this->db->getRow($result); |
| 4224 | 4224 | $snippet = $this->snippetCache[$snippetName] = $row['snippet']; |
| 4225 | 4225 | $mergedProperties = array_merge($this->parseProperties($row['properties']), $this->parseProperties($row['sharedproperties'])); |
| 4226 | - $properties = $this->snippetCache[$snippetName . "Props"] = json_encode($mergedProperties); |
|
| 4226 | + $properties = $this->snippetCache[$snippetName."Props"] = json_encode($mergedProperties); |
|
| 4227 | 4227 | } else { |
| 4228 | 4228 | $snippet = $this->snippetCache[$snippetName] = "return false;"; |
| 4229 | - $properties = $this->snippetCache[$snippetName . "Props"] = ''; |
|
| 4229 | + $properties = $this->snippetCache[$snippetName."Props"] = ''; |
|
| 4230 | 4230 | } |
| 4231 | 4231 | } |
| 4232 | 4232 | // load default params/properties |
@@ -4329,8 +4329,8 @@ discard block |
||
| 4329 | 4329 | } |
| 4330 | 4330 | if (strpos($tpl, $s) !== false) { |
| 4331 | 4331 | $tpl = str_replace($s, $value, $tpl); |
| 4332 | - } elseif($this->debug) { |
|
| 4333 | - $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
| 4332 | + } elseif ($this->debug) { |
|
| 4333 | + $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
| 4334 | 4334 | } |
| 4335 | 4335 | } |
| 4336 | 4336 | |
@@ -4379,7 +4379,7 @@ discard block |
||
| 4379 | 4379 | case 'CODE': |
| 4380 | 4380 | break; |
| 4381 | 4381 | case 'FILE': |
| 4382 | - $template = file_get_contents(MODX_BASE_PATH . $template); |
|
| 4382 | + $template = file_get_contents(MODX_BASE_PATH.$template); |
|
| 4383 | 4383 | break; |
| 4384 | 4384 | case 'CHUNK': |
| 4385 | 4385 | $template = $this->getChunk($template); |
@@ -4432,7 +4432,7 @@ discard block |
||
| 4432 | 4432 | } |
| 4433 | 4433 | |
| 4434 | 4434 | if (empty($mode)) { |
| 4435 | - $strTime = strftime($dateFormat . " %H:%M:%S", $timestamp); |
|
| 4435 | + $strTime = strftime($dateFormat." %H:%M:%S", $timestamp); |
|
| 4436 | 4436 | } elseif ($mode == 'dateOnly') { |
| 4437 | 4437 | $strTime = strftime($dateFormat, $timestamp); |
| 4438 | 4438 | } elseif ($mode == 'formatOnly') { |
@@ -4528,7 +4528,7 @@ discard block |
||
| 4528 | 4528 | if ($v === 'value') { |
| 4529 | 4529 | unset($_[$i]); |
| 4530 | 4530 | } else { |
| 4531 | - $_[$i] = 'tv.' . $v; |
|
| 4531 | + $_[$i] = 'tv.'.$v; |
|
| 4532 | 4532 | } |
| 4533 | 4533 | } |
| 4534 | 4534 | $fields = join(',', $_); |
@@ -4537,12 +4537,12 @@ discard block |
||
| 4537 | 4537 | } |
| 4538 | 4538 | |
| 4539 | 4539 | if ($tvsort != '') { |
| 4540 | - $tvsort = 'tv.' . join(',tv.', array_filter(array_map('trim', explode(',', $tvsort)))); |
|
| 4540 | + $tvsort = 'tv.'.join(',tv.', array_filter(array_map('trim', explode(',', $tvsort)))); |
|
| 4541 | 4541 | } |
| 4542 | 4542 | if ($tvidnames == "*") { |
| 4543 | 4543 | $query = "tv.id<>0"; |
| 4544 | 4544 | } else { |
| 4545 | - $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name") . " IN ('" . join("','", $tvidnames) . "')"; |
|
| 4545 | + $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name")." IN ('".join("','", $tvidnames)."')"; |
|
| 4546 | 4546 | } |
| 4547 | 4547 | |
| 4548 | 4548 | $this->getUserDocGroups(); |
@@ -4686,7 +4686,7 @@ discard block |
||
| 4686 | 4686 | return $this->tmpCache[__FUNCTION__][$cacheKey]; |
| 4687 | 4687 | } |
| 4688 | 4688 | |
| 4689 | - if (($idnames != '*' && !is_array($idnames)) || empty($idnames) ) { |
|
| 4689 | + if (($idnames != '*' && !is_array($idnames)) || empty($idnames)) { |
|
| 4690 | 4690 | return false; |
| 4691 | 4691 | } else { |
| 4692 | 4692 | |
@@ -4704,23 +4704,23 @@ discard block |
||
| 4704 | 4704 | } |
| 4705 | 4705 | |
| 4706 | 4706 | // get user defined template variables |
| 4707 | - $fields = ($fields == '') ? 'tv.*' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $fields)))); |
|
| 4708 | - $sort = ($sort == '') ? '' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $sort)))); |
|
| 4707 | + $fields = ($fields == '') ? 'tv.*' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $fields)))); |
|
| 4708 | + $sort = ($sort == '') ? '' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $sort)))); |
|
| 4709 | 4709 | |
| 4710 | 4710 | if ($idnames == '*') { |
| 4711 | 4711 | $query = 'tv.id<>0'; |
| 4712 | 4712 | } else { |
| 4713 | - $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name') . " IN ('" . implode("','", $idnames) . "')"; |
|
| 4713 | + $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name')." IN ('".implode("','", $idnames)."')"; |
|
| 4714 | 4714 | } |
| 4715 | 4715 | |
| 4716 | - $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars') . " tv |
|
| 4717 | - INNER JOIN " . $this->getFullTableName('site_tmplvar_templates') . " tvtpl ON tvtpl.tmplvarid = tv.id |
|
| 4718 | - LEFT JOIN " . $this->getFullTableName('site_tmplvar_contentvalues') . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'", "{$query} AND tvtpl.templateid = '{$docRow['template']}'", ($sort ? "{$sort} {$dir}" : "")); |
|
| 4716 | + $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars')." tv |
|
| 4717 | + INNER JOIN " . $this->getFullTableName('site_tmplvar_templates')." tvtpl ON tvtpl.tmplvarid = tv.id |
|
| 4718 | + LEFT JOIN " . $this->getFullTableName('site_tmplvar_contentvalues')." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'", "{$query} AND tvtpl.templateid = '{$docRow['template']}'", ($sort ? "{$sort} {$dir}" : "")); |
|
| 4719 | 4719 | |
| 4720 | 4720 | $result = $this->db->makeArray($rs); |
| 4721 | 4721 | |
| 4722 | 4722 | // get default/built-in template variables |
| 4723 | - if(is_array($docRow)){ |
|
| 4723 | + if (is_array($docRow)) { |
|
| 4724 | 4724 | ksort($docRow); |
| 4725 | 4725 | |
| 4726 | 4726 | foreach ($docRow as $key => $value) { |
@@ -4758,7 +4758,7 @@ discard block |
||
| 4758 | 4758 | */ |
| 4759 | 4759 | public function getTemplateVarOutput($idnames = array(), $docid = '', $published = 1, $sep = '') |
| 4760 | 4760 | { |
| 4761 | - if (is_array($idnames) && empty($idnames) ) { |
|
| 4761 | + if (is_array($idnames) && empty($idnames)) { |
|
| 4762 | 4762 | return false; |
| 4763 | 4763 | } else { |
| 4764 | 4764 | $output = array(); |
@@ -4771,9 +4771,9 @@ discard block |
||
| 4771 | 4771 | if ($result == false) { |
| 4772 | 4772 | return false; |
| 4773 | 4773 | } else { |
| 4774 | - $baspath = MODX_MANAGER_PATH . 'includes'; |
|
| 4775 | - include_once $baspath . '/tmplvars.format.inc.php'; |
|
| 4776 | - include_once $baspath . '/tmplvars.commands.inc.php'; |
|
| 4774 | + $baspath = MODX_MANAGER_PATH.'includes'; |
|
| 4775 | + include_once $baspath.'/tmplvars.format.inc.php'; |
|
| 4776 | + include_once $baspath.'/tmplvars.commands.inc.php'; |
|
| 4777 | 4777 | |
| 4778 | 4778 | for ($i = 0; $i < count($result); $i++) { |
| 4779 | 4779 | $row = $result[$i]; |
@@ -4798,7 +4798,7 @@ discard block |
||
| 4798 | 4798 | */ |
| 4799 | 4799 | public function getFullTableName($tbl) |
| 4800 | 4800 | { |
| 4801 | - return $this->db->config['dbase'] . ".`" . $this->db->config['table_prefix'] . $tbl . "`"; |
|
| 4801 | + return $this->db->config['dbase'].".`".$this->db->config['table_prefix'].$tbl."`"; |
|
| 4802 | 4802 | } |
| 4803 | 4803 | |
| 4804 | 4804 | /** |
@@ -4877,7 +4877,7 @@ discard block |
||
| 4877 | 4877 | public function getCachePath() |
| 4878 | 4878 | { |
| 4879 | 4879 | global $base_url; |
| 4880 | - $pth = $base_url . $this->getCacheFolder(); |
|
| 4880 | + $pth = $base_url.$this->getCacheFolder(); |
|
| 4881 | 4881 | return $pth; |
| 4882 | 4882 | } |
| 4883 | 4883 | |
@@ -4929,8 +4929,8 @@ discard block |
||
| 4929 | 4929 | $out = false; |
| 4930 | 4930 | |
| 4931 | 4931 | if (!empty($context)) { |
| 4932 | - if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) { |
|
| 4933 | - $out = $_SESSION[$context . 'InternalKey']; |
|
| 4932 | + if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) { |
|
| 4933 | + $out = $_SESSION[$context.'InternalKey']; |
|
| 4934 | 4934 | } |
| 4935 | 4935 | } else { |
| 4936 | 4936 | switch (true) { |
@@ -4958,8 +4958,8 @@ discard block |
||
| 4958 | 4958 | $out = false; |
| 4959 | 4959 | |
| 4960 | 4960 | if (!empty($context)) { |
| 4961 | - if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) { |
|
| 4962 | - $out = $_SESSION[$context . 'Shortname']; |
|
| 4961 | + if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) { |
|
| 4962 | + $out = $_SESSION[$context.'Shortname']; |
|
| 4963 | 4963 | } |
| 4964 | 4964 | } else { |
| 4965 | 4965 | switch (true) { |
@@ -5030,8 +5030,8 @@ discard block |
||
| 5030 | 5030 | */ |
| 5031 | 5031 | public function getWebUserInfo($uid) |
| 5032 | 5032 | { |
| 5033 | - $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users") . " wu |
|
| 5034 | - INNER JOIN " . $this->getFullTableName("web_user_attributes") . " wua ON wua.internalkey=wu.id", "wu.id='{$uid}'"); |
|
| 5033 | + $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users")." wu |
|
| 5034 | + INNER JOIN " . $this->getFullTableName("web_user_attributes")." wua ON wua.internalkey=wu.id", "wu.id='{$uid}'"); |
|
| 5035 | 5035 | if ($row = $this->db->getRow($rs)) { |
| 5036 | 5036 | if (!isset($row['usertype']) or !$row["usertype"]) { |
| 5037 | 5037 | $row["usertype"] = "web"; |
@@ -5067,7 +5067,7 @@ discard block |
||
| 5067 | 5067 | } else if (is_array($dg)) { |
| 5068 | 5068 | // resolve ids to names |
| 5069 | 5069 | $dgn = array(); |
| 5070 | - $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (" . implode(",", $dg) . ")"); |
|
| 5070 | + $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (".implode(",", $dg).")"); |
|
| 5071 | 5071 | while ($row = $this->db->getRow($ds)) { |
| 5072 | 5072 | $dgn[] = $row['name']; |
| 5073 | 5073 | } |
@@ -5095,7 +5095,7 @@ discard block |
||
| 5095 | 5095 | $rt = false; |
| 5096 | 5096 | if ($_SESSION["webValidated"] == 1) { |
| 5097 | 5097 | $tbl = $this->getFullTableName("web_users"); |
| 5098 | - $ds = $this->db->select('id, username, password', $tbl, "id='" . $this->getLoginUserID() . "'"); |
|
| 5098 | + $ds = $this->db->select('id, username, password', $tbl, "id='".$this->getLoginUserID()."'"); |
|
| 5099 | 5099 | if ($row = $this->db->getRow($ds)) { |
| 5100 | 5100 | if ($row["password"] == md5($oldPwd)) { |
| 5101 | 5101 | if (strlen($newPwd) < 6) { |
@@ -5105,7 +5105,7 @@ discard block |
||
| 5105 | 5105 | } else { |
| 5106 | 5106 | $this->db->update(array( |
| 5107 | 5107 | 'password' => $this->db->escape($newPwd), |
| 5108 | - ), $tbl, "id='" . $this->getLoginUserID() . "'"); |
|
| 5108 | + ), $tbl, "id='".$this->getLoginUserID()."'"); |
|
| 5109 | 5109 | // invoke OnWebChangePassword event |
| 5110 | 5110 | $this->invokeEvent("OnWebChangePassword", array( |
| 5111 | 5111 | "userid" => $row["id"], |
@@ -5136,8 +5136,8 @@ discard block |
||
| 5136 | 5136 | // check cache |
| 5137 | 5137 | $grpNames = isset ($_SESSION['webUserGroupNames']) ? $_SESSION['webUserGroupNames'] : false; |
| 5138 | 5138 | if (!is_array($grpNames)) { |
| 5139 | - $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names") . " wgn |
|
| 5140 | - INNER JOIN " . $this->getFullTableName("web_groups") . " wg ON wg.webgroup=wgn.id AND wg.webuser='" . $this->getLoginUserID() . "'"); |
|
| 5139 | + $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names")." wgn |
|
| 5140 | + INNER JOIN " . $this->getFullTableName("web_groups")." wg ON wg.webgroup=wgn.id AND wg.webuser='".$this->getLoginUserID()."'"); |
|
| 5141 | 5141 | $grpNames = $this->db->getColumn("name", $rs); |
| 5142 | 5142 | // save to cache |
| 5143 | 5143 | $_SESSION['webUserGroupNames'] = $grpNames; |
@@ -5170,7 +5170,7 @@ discard block |
||
| 5170 | 5170 | if (strpos(strtolower($src), "<style") !== false || strpos(strtolower($src), "<link") !== false) { |
| 5171 | 5171 | $this->sjscripts[$nextpos] = $src; |
| 5172 | 5172 | } else { |
| 5173 | - $this->sjscripts[$nextpos] = "\t" . '<link rel="stylesheet" type="text/css" href="' . $src . '" ' . ($media ? 'media="' . $media . '" ' : '') . '/>'; |
|
| 5173 | + $this->sjscripts[$nextpos] = "\t".'<link rel="stylesheet" type="text/css" href="'.$src.'" '.($media ? 'media="'.$media.'" ' : '').'/>'; |
|
| 5174 | 5174 | } |
| 5175 | 5175 | } |
| 5176 | 5176 | |
@@ -5249,7 +5249,7 @@ discard block |
||
| 5249 | 5249 | } |
| 5250 | 5250 | |
| 5251 | 5251 | if ($useThisVer && $plaintext != true && (strpos(strtolower($src), "<script") === false)) { |
| 5252 | - $src = "\t" . '<script type="text/javascript" src="' . $src . '"></script>'; |
|
| 5252 | + $src = "\t".'<script type="text/javascript" src="'.$src.'"></script>'; |
|
| 5253 | 5253 | } |
| 5254 | 5254 | if ($startup) { |
| 5255 | 5255 | $pos = isset($overwritepos) ? $overwritepos : max(array_merge(array(0), array_keys($this->sjscripts))) + 1; |
@@ -5395,7 +5395,7 @@ discard block |
||
| 5395 | 5395 | $eventtime = $this->getMicroTime() - $eventtime; |
| 5396 | 5396 | $this->pluginsCode .= sprintf('<fieldset><legend><b>%s / %s</b> (%2.2f ms)</legend>', $evtName, $pluginName, $eventtime * 1000); |
| 5397 | 5397 | foreach ($parameter as $k => $v) { |
| 5398 | - $this->pluginsCode .= "{$k} => " . print_r($v, true) . '<br>'; |
|
| 5398 | + $this->pluginsCode .= "{$k} => ".print_r($v, true).'<br>'; |
|
| 5399 | 5399 | } |
| 5400 | 5400 | $this->pluginsCode .= '</fieldset><br />'; |
| 5401 | 5401 | $this->pluginsTime["{$evtName} / {$pluginName}"] += $eventtime; |
@@ -5423,13 +5423,13 @@ discard block |
||
| 5423 | 5423 | $plugin = array(); |
| 5424 | 5424 | if (isset ($this->pluginCache[$pluginName])) { |
| 5425 | 5425 | $pluginCode = $this->pluginCache[$pluginName]; |
| 5426 | - $pluginProperties = isset($this->pluginCache[$pluginName . "Props"]) ? $this->pluginCache[$pluginName . "Props"] : ''; |
|
| 5426 | + $pluginProperties = isset($this->pluginCache[$pluginName."Props"]) ? $this->pluginCache[$pluginName."Props"] : ''; |
|
| 5427 | 5427 | } else { |
| 5428 | 5428 | $pluginName = $this->db->escape($pluginName); |
| 5429 | 5429 | $result = $this->db->select('name, plugincode, properties', $this->getFullTableName("site_plugins"), "name='{$pluginName}' AND disabled=0"); |
| 5430 | 5430 | if ($row = $this->db->getRow($result)) { |
| 5431 | 5431 | $pluginCode = $this->pluginCache[$row['name']] = $row['plugincode']; |
| 5432 | - $pluginProperties = $this->pluginCache[$row['name'] . "Props"] = $row['properties']; |
|
| 5432 | + $pluginProperties = $this->pluginCache[$row['name']."Props"] = $row['properties']; |
|
| 5433 | 5433 | } else { |
| 5434 | 5434 | $pluginCode = $this->pluginCache[$pluginName] = "return false;"; |
| 5435 | 5435 | $pluginProperties = ''; |
@@ -5536,7 +5536,7 @@ discard block |
||
| 5536 | 5536 | public function parseDocBlockFromFile($element_dir, $filename, $escapeValues = false) |
| 5537 | 5537 | { |
| 5538 | 5538 | $params = array(); |
| 5539 | - $fullpath = $element_dir . '/' . $filename; |
|
| 5539 | + $fullpath = $element_dir.'/'.$filename; |
|
| 5540 | 5540 | if (is_readable($fullpath)) { |
| 5541 | 5541 | $tpl = @fopen($fullpath, "r"); |
| 5542 | 5542 | if ($tpl) { |
@@ -5703,8 +5703,8 @@ discard block |
||
| 5703 | 5703 | $ph = array('site_url' => MODX_SITE_URL); |
| 5704 | 5704 | $regexUrl = "/((http|https|ftp|ftps)\:\/\/[^\/]+(\/[^\s]+[^,.?!:;\s])?)/"; |
| 5705 | 5705 | $regexEmail = '#([0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-wyz][a-z](fo|g|l|m|mes|o|op|pa|ro|seum|t|u|v|z)?)#i'; |
| 5706 | - $emailSubject = isset($parsed['name']) ? '?subject=' . $parsed['name'] : ''; |
|
| 5707 | - $emailSubject .= isset($parsed['version']) ? ' v' . $parsed['version'] : ''; |
|
| 5706 | + $emailSubject = isset($parsed['name']) ? '?subject='.$parsed['name'] : ''; |
|
| 5707 | + $emailSubject .= isset($parsed['version']) ? ' v'.$parsed['version'] : ''; |
|
| 5708 | 5708 | foreach ($parsed as $key => $val) { |
| 5709 | 5709 | if (is_array($val)) { |
| 5710 | 5710 | foreach ($val as $key2 => $val2) { |
@@ -5713,7 +5713,7 @@ discard block |
||
| 5713 | 5713 | $val2 = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val2); |
| 5714 | 5714 | } |
| 5715 | 5715 | if (preg_match($regexEmail, $val2, $url)) { |
| 5716 | - $val2 = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val2); |
|
| 5716 | + $val2 = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val2); |
|
| 5717 | 5717 | } |
| 5718 | 5718 | $parsed[$key][$key2] = $val2; |
| 5719 | 5719 | } |
@@ -5723,7 +5723,7 @@ discard block |
||
| 5723 | 5723 | $val = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val); |
| 5724 | 5724 | } |
| 5725 | 5725 | if (preg_match($regexEmail, $val, $url)) { |
| 5726 | - $val = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val); |
|
| 5726 | + $val = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val); |
|
| 5727 | 5727 | } |
| 5728 | 5728 | $parsed[$key] = $val; |
| 5729 | 5729 | } |
@@ -5737,32 +5737,32 @@ discard block |
||
| 5737 | 5737 | ); |
| 5738 | 5738 | |
| 5739 | 5739 | $nl = "\n"; |
| 5740 | - $list = isset($parsed['logo']) ? '<img src="' . $this->config['base_url'] . ltrim($parsed['logo'], "/") . '" style="float:right;max-width:100px;height:auto;" />' . $nl : ''; |
|
| 5741 | - $list .= '<p>' . $nl; |
|
| 5742 | - $list .= isset($parsed['name']) ? '<strong>' . $parsed['name'] . '</strong><br/>' . $nl : ''; |
|
| 5743 | - $list .= isset($parsed['description']) ? $parsed['description'] . $nl : ''; |
|
| 5744 | - $list .= '</p><br/>' . $nl; |
|
| 5745 | - $list .= isset($parsed['version']) ? '<p><strong>' . $_lang['version'] . ':</strong> ' . $parsed['version'] . '</p>' . $nl : ''; |
|
| 5746 | - $list .= isset($parsed['license']) ? '<p><strong>' . $_lang['license'] . ':</strong> ' . $parsed['license'] . '</p>' . $nl : ''; |
|
| 5747 | - $list .= isset($parsed['lastupdate']) ? '<p><strong>' . $_lang['last_update'] . ':</strong> ' . $parsed['lastupdate'] . '</p>' . $nl : ''; |
|
| 5748 | - $list .= '<br/>' . $nl; |
|
| 5740 | + $list = isset($parsed['logo']) ? '<img src="'.$this->config['base_url'].ltrim($parsed['logo'], "/").'" style="float:right;max-width:100px;height:auto;" />'.$nl : ''; |
|
| 5741 | + $list .= '<p>'.$nl; |
|
| 5742 | + $list .= isset($parsed['name']) ? '<strong>'.$parsed['name'].'</strong><br/>'.$nl : ''; |
|
| 5743 | + $list .= isset($parsed['description']) ? $parsed['description'].$nl : ''; |
|
| 5744 | + $list .= '</p><br/>'.$nl; |
|
| 5745 | + $list .= isset($parsed['version']) ? '<p><strong>'.$_lang['version'].':</strong> '.$parsed['version'].'</p>'.$nl : ''; |
|
| 5746 | + $list .= isset($parsed['license']) ? '<p><strong>'.$_lang['license'].':</strong> '.$parsed['license'].'</p>'.$nl : ''; |
|
| 5747 | + $list .= isset($parsed['lastupdate']) ? '<p><strong>'.$_lang['last_update'].':</strong> '.$parsed['lastupdate'].'</p>'.$nl : ''; |
|
| 5748 | + $list .= '<br/>'.$nl; |
|
| 5749 | 5749 | $first = true; |
| 5750 | 5750 | foreach ($arrayParams as $param => $label) { |
| 5751 | 5751 | if (isset($parsed[$param])) { |
| 5752 | 5752 | if ($first) { |
| 5753 | - $list .= '<p><strong>' . $_lang['references'] . '</strong></p>' . $nl; |
|
| 5754 | - $list .= '<ul class="docBlockList">' . $nl; |
|
| 5753 | + $list .= '<p><strong>'.$_lang['references'].'</strong></p>'.$nl; |
|
| 5754 | + $list .= '<ul class="docBlockList">'.$nl; |
|
| 5755 | 5755 | $first = false; |
| 5756 | 5756 | } |
| 5757 | - $list .= ' <li><strong>' . $label . '</strong>' . $nl; |
|
| 5758 | - $list .= ' <ul>' . $nl; |
|
| 5757 | + $list .= ' <li><strong>'.$label.'</strong>'.$nl; |
|
| 5758 | + $list .= ' <ul>'.$nl; |
|
| 5759 | 5759 | foreach ($parsed[$param] as $val) { |
| 5760 | - $list .= ' <li>' . $val . '</li>' . $nl; |
|
| 5760 | + $list .= ' <li>'.$val.'</li>'.$nl; |
|
| 5761 | 5761 | } |
| 5762 | - $list .= ' </ul></li>' . $nl; |
|
| 5762 | + $list .= ' </ul></li>'.$nl; |
|
| 5763 | 5763 | } |
| 5764 | 5764 | } |
| 5765 | - $list .= !$first ? '</ul>' . $nl : ''; |
|
| 5765 | + $list .= !$first ? '</ul>'.$nl : ''; |
|
| 5766 | 5766 | |
| 5767 | 5767 | return $list; |
| 5768 | 5768 | } |
@@ -5838,7 +5838,7 @@ discard block |
||
| 5838 | 5838 | */ |
| 5839 | 5839 | public function addSnippet($name, $phpCode) |
| 5840 | 5840 | { |
| 5841 | - $this->snippetCache['#' . $name] = $phpCode; |
|
| 5841 | + $this->snippetCache['#'.$name] = $phpCode; |
|
| 5842 | 5842 | } |
| 5843 | 5843 | |
| 5844 | 5844 | /** |
@@ -5847,7 +5847,7 @@ discard block |
||
| 5847 | 5847 | */ |
| 5848 | 5848 | public function addChunk($name, $text) |
| 5849 | 5849 | { |
| 5850 | - $this->chunkCache['#' . $name] = $text; |
|
| 5850 | + $this->chunkCache['#'.$name] = $text; |
|
| 5851 | 5851 | } |
| 5852 | 5852 | |
| 5853 | 5853 | /** |
@@ -5883,7 +5883,7 @@ discard block |
||
| 5883 | 5883 | } |
| 5884 | 5884 | |
| 5885 | 5885 | if (!$isSafe) { |
| 5886 | - $msg = $phpcode . "\n" . $this->currentSnippet . "\n" . print_r($_SERVER, true); |
|
| 5886 | + $msg = $phpcode."\n".$this->currentSnippet."\n".print_r($_SERVER, true); |
|
| 5887 | 5887 | $title = sprintf('Unknown eval was executed (%s)', $this->htmlspecialchars(substr(trim($phpcode), 0, 50))); |
| 5888 | 5888 | $this->messageQuit($title, '', true, '', '', 'Parser', $msg); |
| 5889 | 5889 | return; |
@@ -5897,7 +5897,7 @@ discard block |
||
| 5897 | 5897 | return 'array()'; |
| 5898 | 5898 | } |
| 5899 | 5899 | |
| 5900 | - $output = $echo . $return; |
|
| 5900 | + $output = $echo.$return; |
|
| 5901 | 5901 | modx_sanitize_gpc($output); |
| 5902 | 5902 | return $this->htmlspecialchars($output); // Maybe, all html tags are dangerous |
| 5903 | 5903 | } |
@@ -5915,8 +5915,8 @@ discard block |
||
| 5915 | 5915 | |
| 5916 | 5916 | $safe = explode(',', $safe_functions); |
| 5917 | 5917 | |
| 5918 | - $phpcode = rtrim($phpcode, ';') . ';'; |
|
| 5919 | - $tokens = token_get_all('<?php ' . $phpcode); |
|
| 5918 | + $phpcode = rtrim($phpcode, ';').';'; |
|
| 5919 | + $tokens = token_get_all('<?php '.$phpcode); |
|
| 5920 | 5920 | foreach ($tokens as $i => $token) { |
| 5921 | 5921 | if (!is_array($token)) { |
| 5922 | 5922 | continue; |
@@ -5952,7 +5952,7 @@ discard block |
||
| 5952 | 5952 | public function atBindFileContent($str = '') |
| 5953 | 5953 | { |
| 5954 | 5954 | |
| 5955 | - $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'] . 'files/', ''); |
|
| 5955 | + $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'].'files/', ''); |
|
| 5956 | 5956 | |
| 5957 | 5957 | if (stripos($str, '@FILE') !== 0) { |
| 5958 | 5958 | return $str; |
@@ -5975,7 +5975,7 @@ discard block |
||
| 5975 | 5975 | $errorMsg = sprintf("Could not retrieve string '%s'.", $str); |
| 5976 | 5976 | |
| 5977 | 5977 | foreach ($search_path as $path) { |
| 5978 | - $file_path = MODX_BASE_PATH . $path . $str; |
|
| 5978 | + $file_path = MODX_BASE_PATH.$path.$str; |
|
| 5979 | 5979 | if (strpos($file_path, MODX_MANAGER_PATH) === 0) { |
| 5980 | 5980 | return $errorMsg; |
| 5981 | 5981 | } elseif (is_file($file_path)) { |
@@ -5989,7 +5989,7 @@ discard block |
||
| 5989 | 5989 | return $errorMsg; |
| 5990 | 5990 | } |
| 5991 | 5991 | |
| 5992 | - $content = (string)file_get_contents($file_path); |
|
| 5992 | + $content = (string) file_get_contents($file_path); |
|
| 5993 | 5993 | if ($content === false) { |
| 5994 | 5994 | return $errorMsg; |
| 5995 | 5995 | } |
@@ -6102,22 +6102,22 @@ discard block |
||
| 6102 | 6102 | |
| 6103 | 6103 | $version = isset ($GLOBALS['modx_version']) ? $GLOBALS['modx_version'] : ''; |
| 6104 | 6104 | $release_date = isset ($GLOBALS['release_date']) ? $GLOBALS['release_date'] : ''; |
| 6105 | - $request_uri = "http://" . $_SERVER['HTTP_HOST'] . ($_SERVER["SERVER_PORT"] == 80 ? "" : (":" . $_SERVER["SERVER_PORT"])) . $_SERVER['REQUEST_URI']; |
|
| 6105 | + $request_uri = "http://".$_SERVER['HTTP_HOST'].($_SERVER["SERVER_PORT"] == 80 ? "" : (":".$_SERVER["SERVER_PORT"])).$_SERVER['REQUEST_URI']; |
|
| 6106 | 6106 | $request_uri = $this->htmlspecialchars($request_uri, ENT_QUOTES, $this->config['modx_charset']); |
| 6107 | 6107 | $ua = $this->htmlspecialchars($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, $this->config['modx_charset']); |
| 6108 | 6108 | $referer = $this->htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_QUOTES, $this->config['modx_charset']); |
| 6109 | 6109 | if ($is_error) { |
| 6110 | 6110 | $str = '<h2 style="color:red">« Evo Parse Error »</h2>'; |
| 6111 | 6111 | if ($msg != 'PHP Parse Error') { |
| 6112 | - $str .= '<h3 style="color:red">' . $msg . '</h3>'; |
|
| 6112 | + $str .= '<h3 style="color:red">'.$msg.'</h3>'; |
|
| 6113 | 6113 | } |
| 6114 | 6114 | } else { |
| 6115 | 6115 | $str = '<h2 style="color:#003399">« Evo Debug/ stop message »</h2>'; |
| 6116 | - $str .= '<h3 style="color:#003399">' . $msg . '</h3>'; |
|
| 6116 | + $str .= '<h3 style="color:#003399">'.$msg.'</h3>'; |
|
| 6117 | 6117 | } |
| 6118 | 6118 | |
| 6119 | 6119 | if (!empty ($query)) { |
| 6120 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">SQL > <span id="sqlHolder">' . $query . '</span></div>'; |
|
| 6120 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">SQL > <span id="sqlHolder">'.$query.'</span></div>'; |
|
| 6121 | 6121 | } |
| 6122 | 6122 | |
| 6123 | 6123 | $errortype = array( |
@@ -6140,13 +6140,13 @@ discard block |
||
| 6140 | 6140 | |
| 6141 | 6141 | if (!empty($nr) || !empty($file)) { |
| 6142 | 6142 | if ($text != '') { |
| 6143 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : ' . $text . '</div>'; |
|
| 6143 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : '.$text.'</div>'; |
|
| 6144 | 6144 | } |
| 6145 | 6145 | if ($output != '') { |
| 6146 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">' . $output . '</div>'; |
|
| 6146 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">'.$output.'</div>'; |
|
| 6147 | 6147 | } |
| 6148 | 6148 | if ($nr !== '') { |
| 6149 | - $table[] = array('ErrorType[num]', $errortype [$nr] . "[" . $nr . "]"); |
|
| 6149 | + $table[] = array('ErrorType[num]', $errortype [$nr]."[".$nr."]"); |
|
| 6150 | 6150 | } |
| 6151 | 6151 | if ($file) { |
| 6152 | 6152 | $table[] = array('File', $file); |
@@ -6166,7 +6166,7 @@ discard block |
||
| 6166 | 6166 | } |
| 6167 | 6167 | |
| 6168 | 6168 | if (!empty($this->event->activePlugin)) { |
| 6169 | - $table[] = array('Current Plugin', $this->event->activePlugin . '(' . $this->event->name . ')'); |
|
| 6169 | + $table[] = array('Current Plugin', $this->event->activePlugin.'('.$this->event->name.')'); |
|
| 6170 | 6170 | } |
| 6171 | 6171 | |
| 6172 | 6172 | $str .= $MakeTable->create($table, array('Error information', '')); |
@@ -6176,17 +6176,17 @@ discard block |
||
| 6176 | 6176 | $table[] = array('REQUEST_URI', $request_uri); |
| 6177 | 6177 | |
| 6178 | 6178 | if ($this->manager->action) { |
| 6179 | - include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
| 6179 | + include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php'); |
|
| 6180 | 6180 | global $action_list; |
| 6181 | 6181 | $actionName = (isset($action_list[$this->manager->action])) ? " - {$action_list[$this->manager->action]}" : ''; |
| 6182 | 6182 | |
| 6183 | - $table[] = array('Manager action', $this->manager->action . $actionName); |
|
| 6183 | + $table[] = array('Manager action', $this->manager->action.$actionName); |
|
| 6184 | 6184 | } |
| 6185 | 6185 | |
| 6186 | 6186 | if (preg_match('@^[0-9]+@', $this->documentIdentifier)) { |
| 6187 | 6187 | $resource = $this->getDocumentObject('id', $this->documentIdentifier); |
| 6188 | 6188 | $url = $this->makeUrl($this->documentIdentifier, '', '', 'full'); |
| 6189 | - $table[] = array('Resource', '[' . $this->documentIdentifier . '] <a href="' . $url . '" target="_blank">' . $resource['pagetitle'] . '</a>'); |
|
| 6189 | + $table[] = array('Resource', '['.$this->documentIdentifier.'] <a href="'.$url.'" target="_blank">'.$resource['pagetitle'].'</a>'); |
|
| 6190 | 6190 | } |
| 6191 | 6191 | $table[] = array('Referer', $referer); |
| 6192 | 6192 | $table[] = array('User Agent', $ua); |
@@ -6207,7 +6207,7 @@ discard block |
||
| 6207 | 6207 | |
| 6208 | 6208 | $mem = memory_get_peak_usage(true); |
| 6209 | 6209 | $total_mem = $mem - $this->mstart; |
| 6210 | - $total_mem = ($total_mem / 1024 / 1024) . ' mb'; |
|
| 6210 | + $total_mem = ($total_mem / 1024 / 1024).' mb'; |
|
| 6211 | 6211 | |
| 6212 | 6212 | $queryTime = $this->queryTime; |
| 6213 | 6213 | $phpTime = $totalTime - $queryTime; |
@@ -6228,18 +6228,18 @@ discard block |
||
| 6228 | 6228 | $str .= $this->get_backtrace(debug_backtrace()); |
| 6229 | 6229 | // Log error |
| 6230 | 6230 | if (!empty($this->currentSnippet)) { |
| 6231 | - $source = 'Snippet - ' . $this->currentSnippet; |
|
| 6231 | + $source = 'Snippet - '.$this->currentSnippet; |
|
| 6232 | 6232 | } elseif (!empty($this->event->activePlugin)) { |
| 6233 | - $source = 'Plugin - ' . $this->event->activePlugin; |
|
| 6233 | + $source = 'Plugin - '.$this->event->activePlugin; |
|
| 6234 | 6234 | } elseif ($source !== '') { |
| 6235 | - $source = 'Parser - ' . $source; |
|
| 6235 | + $source = 'Parser - '.$source; |
|
| 6236 | 6236 | } elseif ($query !== '') { |
| 6237 | 6237 | $source = 'SQL Query'; |
| 6238 | 6238 | } else { |
| 6239 | 6239 | $source = 'Parser'; |
| 6240 | 6240 | } |
| 6241 | 6241 | if ($msg) { |
| 6242 | - $source .= ' / ' . $msg; |
|
| 6242 | + $source .= ' / '.$msg; |
|
| 6243 | 6243 | } |
| 6244 | 6244 | if (isset($actionName) && !empty($actionName)) { |
| 6245 | 6245 | $source .= $actionName; |
@@ -6271,12 +6271,12 @@ discard block |
||
| 6271 | 6271 | |
| 6272 | 6272 | // Display error |
| 6273 | 6273 | if (isset($_SESSION['mgrValidated'])) { |
| 6274 | - echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html><head><title>EVO Content Manager ' . $version . ' » ' . $release_date . '</title> |
|
| 6274 | + echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html><head><title>EVO Content Manager '.$version.' » '.$release_date.'</title> |
|
| 6275 | 6275 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 6276 | - <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'] . 'media/style/' . $this->config['manager_theme'] . '/style.css" /> |
|
| 6276 | + <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'].'media/style/'.$this->config['manager_theme'].'/style.css" /> |
|
| 6277 | 6277 | <style type="text/css">body { padding:10px; } td {font:inherit;}</style> |
| 6278 | 6278 | </head><body> |
| 6279 | - ' . $str . '</body></html>'; |
|
| 6279 | + ' . $str.'</body></html>'; |
|
| 6280 | 6280 | |
| 6281 | 6281 | } else { |
| 6282 | 6282 | echo 'Error'; |
@@ -6314,7 +6314,7 @@ discard block |
||
| 6314 | 6314 | switch ($val['type']) { |
| 6315 | 6315 | case '->': |
| 6316 | 6316 | case '::': |
| 6317 | - $functionName = $val['function'] = $val['class'] . $val['type'] . $val['function']; |
|
| 6317 | + $functionName = $val['function'] = $val['class'].$val['type'].$val['function']; |
|
| 6318 | 6318 | break; |
| 6319 | 6319 | default: |
| 6320 | 6320 | $functionName = $val['function']; |
@@ -6324,7 +6324,7 @@ discard block |
||
| 6324 | 6324 | $args = array_pad(array(), $_, '$var'); |
| 6325 | 6325 | $args = implode(", ", $args); |
| 6326 | 6326 | $modx = &$this; |
| 6327 | - $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) { |
|
| 6327 | + $args = preg_replace_callback('/\$var/', function() use ($modx, &$tmp, $val) { |
|
| 6328 | 6328 | $arg = $val['args'][$tmp - 1]; |
| 6329 | 6329 | switch (true) { |
| 6330 | 6330 | case is_null($arg): { |
@@ -6336,7 +6336,7 @@ discard block |
||
| 6336 | 6336 | break; |
| 6337 | 6337 | } |
| 6338 | 6338 | case is_scalar($arg): { |
| 6339 | - $out = strlen($arg) > 20 ? 'string $var' . $tmp : ("'" . $this->htmlspecialchars(str_replace("'", "\\'", $arg)) . "'"); |
|
| 6339 | + $out = strlen($arg) > 20 ? 'string $var'.$tmp : ("'".$this->htmlspecialchars(str_replace("'", "\\'", $arg))."'"); |
|
| 6340 | 6340 | break; |
| 6341 | 6341 | } |
| 6342 | 6342 | case is_bool($arg): { |
@@ -6344,23 +6344,23 @@ discard block |
||
| 6344 | 6344 | break; |
| 6345 | 6345 | } |
| 6346 | 6346 | case is_array($arg): { |
| 6347 | - $out = 'array $var' . $tmp; |
|
| 6347 | + $out = 'array $var'.$tmp; |
|
| 6348 | 6348 | break; |
| 6349 | 6349 | } |
| 6350 | 6350 | case is_object($arg): { |
| 6351 | - $out = get_class($arg) . ' $var' . $tmp; |
|
| 6351 | + $out = get_class($arg).' $var'.$tmp; |
|
| 6352 | 6352 | break; |
| 6353 | 6353 | } |
| 6354 | 6354 | default: { |
| 6355 | - $out = '$var' . $tmp; |
|
| 6355 | + $out = '$var'.$tmp; |
|
| 6356 | 6356 | } |
| 6357 | 6357 | } |
| 6358 | 6358 | $tmp++; |
| 6359 | 6359 | return $out; |
| 6360 | 6360 | }, $args); |
| 6361 | 6361 | $line = array( |
| 6362 | - "<strong>" . $functionName . "</strong>(" . $args . ")", |
|
| 6363 | - $path . " on line " . $val['line'] |
|
| 6362 | + "<strong>".$functionName."</strong>(".$args.")", |
|
| 6363 | + $path." on line ".$val['line'] |
|
| 6364 | 6364 | ); |
| 6365 | 6365 | $table[] = array(implode("<br />", $line)); |
| 6366 | 6366 | } |
@@ -6401,7 +6401,7 @@ discard block |
||
| 6401 | 6401 | $alias = strip_tags($alias); // strip HTML |
| 6402 | 6402 | $alias = preg_replace('/[^\.A-Za-z0-9 _-]/', '', $alias); // strip non-alphanumeric characters |
| 6403 | 6403 | $alias = preg_replace('/\s+/', '-', $alias); // convert white-space to dash |
| 6404 | - $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one |
|
| 6404 | + $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one |
|
| 6405 | 6405 | $alias = trim($alias, '-'); // trim excess |
| 6406 | 6406 | return $alias; |
| 6407 | 6407 | } |
@@ -6417,7 +6417,7 @@ discard block |
||
| 6417 | 6417 | $precisions = count($sizes) - 1; |
| 6418 | 6418 | foreach ($sizes as $unit => $bytes) { |
| 6419 | 6419 | if ($size >= $bytes) { |
| 6420 | - return number_format($size / $bytes, $precisions) . ' ' . $unit; |
|
| 6420 | + return number_format($size / $bytes, $precisions).' '.$unit; |
|
| 6421 | 6421 | } |
| 6422 | 6422 | $precisions--; |
| 6423 | 6423 | } |
@@ -6521,10 +6521,10 @@ discard block |
||
| 6521 | 6521 | |
| 6522 | 6522 | if (strpos($str, MODX_MANAGER_PATH) === 0) { |
| 6523 | 6523 | return false; |
| 6524 | - } elseif (is_file(MODX_BASE_PATH . $str)) { |
|
| 6525 | - $file_path = MODX_BASE_PATH . $str; |
|
| 6526 | - } elseif (is_file(MODX_BASE_PATH . "{$tpl_dir}{$str}")) { |
|
| 6527 | - $file_path = MODX_BASE_PATH . $tpl_dir . $str; |
|
| 6524 | + } elseif (is_file(MODX_BASE_PATH.$str)) { |
|
| 6525 | + $file_path = MODX_BASE_PATH.$str; |
|
| 6526 | + } elseif (is_file(MODX_BASE_PATH."{$tpl_dir}{$str}")) { |
|
| 6527 | + $file_path = MODX_BASE_PATH.$tpl_dir.$str; |
|
| 6528 | 6528 | } else { |
| 6529 | 6529 | return false; |
| 6530 | 6530 | } |
@@ -6565,7 +6565,7 @@ discard block |
||
| 6565 | 6565 | * |
| 6566 | 6566 | * @param boolean $state State of ajaxMode |
| 6567 | 6567 | */ |
| 6568 | - function setAjaxMode($state) { |
|
| 6568 | + function setAjaxMode($state){ |
|
| 6569 | 6569 | $this->ajaxMode = $state === true ? true : false; |
| 6570 | 6570 | } |
| 6571 | 6571 | |
@@ -6574,7 +6574,7 @@ discard block |
||
| 6574 | 6574 | * |
| 6575 | 6575 | * @param array $array Array to convert |
| 6576 | 6576 | */ |
| 6577 | - function jsonResponse($array) { |
|
| 6577 | + function jsonResponse($array){ |
|
| 6578 | 6578 | header('content-type: application/json'); |
| 6579 | 6579 | exit(json_encode($array, JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE)); |
| 6580 | 6580 | } |
@@ -6669,7 +6669,7 @@ discard block |
||
| 6669 | 6669 | $title = 'no title'; |
| 6670 | 6670 | } |
| 6671 | 6671 | if (is_array($msg)) { |
| 6672 | - $msg = '<pre>' . print_r($msg, true) . '</pre>'; |
|
| 6672 | + $msg = '<pre>'.print_r($msg, true).'</pre>'; |
|
| 6673 | 6673 | } elseif ($msg === '') { |
| 6674 | 6674 | $msg = $_SERVER['REQUEST_URI']; |
| 6675 | 6675 | } |
@@ -6714,7 +6714,7 @@ discard block |
||
| 6714 | 6714 | if (is_array($SystemAlertMsgQueque)) { |
| 6715 | 6715 | $title = ''; |
| 6716 | 6716 | if ($this->name && $this->activePlugin) { |
| 6717 | - $title = "<div><b>" . $this->activePlugin . "</b> - <span style='color:maroon;'>" . $this->name . "</span></div>"; |
|
| 6717 | + $title = "<div><b>".$this->activePlugin."</b> - <span style='color:maroon;'>".$this->name."</span></div>"; |
|
| 6718 | 6718 | } |
| 6719 | 6719 | $SystemAlertMsgQueque[] = "$title<div style='margin-left:10px;margin-top:3px;'>$msg</div>"; |
| 6720 | 6720 | } |
@@ -696,13 +696,15 @@ discard block |
||
| 696 | 696 | $this->virtualDir = ''; |
| 697 | 697 | } |
| 698 | 698 | |
| 699 | - if (preg_match('@^[1-9][0-9]*$@', $q) && !isset($this->documentListing[$q])) { /* we got an ID returned, check to make sure it's not an alias */ |
|
| 699 | + if (preg_match('@^[1-9][0-9]*$@', $q) && !isset($this->documentListing[$q])) { |
|
| 700 | +/* we got an ID returned, check to make sure it's not an alias */ |
|
| 700 | 701 | /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */ |
| 701 | 702 | if ($this->config['use_alias_path'] == 1) { |
| 702 | 703 | if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir . '/' . $q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q, $this->getChildIds($this->documentListing[$this->virtualDir], 1))) || ($this->virtualDir == '' && in_array($q, $this->getChildIds(0, 1))))) { |
| 703 | 704 | $this->documentMethod = 'id'; |
| 704 | 705 | return $q; |
| 705 | - } else { /* not a valid id in terms of virtualDir, treat as alias */ |
|
| 706 | + } else { |
|
| 707 | +/* not a valid id in terms of virtualDir, treat as alias */ |
|
| 706 | 708 | $this->documentMethod = 'alias'; |
| 707 | 709 | return $q; |
| 708 | 710 | } |
@@ -710,7 +712,8 @@ discard block |
||
| 710 | 712 | $this->documentMethod = 'id'; |
| 711 | 713 | return $q; |
| 712 | 714 | } |
| 713 | - } else { /* we didn't get an ID back, so instead we assume it's an alias */ |
|
| 715 | + } else { |
|
| 716 | +/* we didn't get an ID back, so instead we assume it's an alias */ |
|
| 714 | 717 | if ($this->config['friendly_alias_urls'] != 1) { |
| 715 | 718 | $q = $qOrig; |
| 716 | 719 | } |
@@ -740,13 +743,14 @@ discard block |
||
| 740 | 743 | * @param $id |
| 741 | 744 | * @return array|mixed|null|string |
| 742 | 745 | */ |
| 743 | - public function makePageCacheKey($id){ |
|
| 746 | + public function makePageCacheKey($id) |
|
| 747 | + { |
|
| 744 | 748 | $hash = $id; |
| 745 | 749 | $tmp = null; |
| 746 | 750 | $params = array(); |
| 747 | - if(!empty($this->systemCacheKey)){ |
|
| 751 | + if(!empty($this->systemCacheKey)) { |
|
| 748 | 752 | $hash = $this->systemCacheKey; |
| 749 | - }else { |
|
| 753 | + } else { |
|
| 750 | 754 | if (!empty($_GET)) { |
| 751 | 755 | // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID. |
| 752 | 756 | $params = $_GET; |
@@ -755,7 +759,7 @@ discard block |
||
| 755 | 759 | } |
| 756 | 760 | } |
| 757 | 761 | $evtOut = $this->invokeEvent("OnMakePageCacheKey", array ("hash" => $hash, "id" => $id, 'params' => $params)); |
| 758 | - if (is_array($evtOut) && count($evtOut) > 0){ |
|
| 762 | + if (is_array($evtOut) && count($evtOut) > 0) { |
|
| 759 | 763 | $tmp = array_pop($evtOut); |
| 760 | 764 | } |
| 761 | 765 | return empty($tmp) ? $hash : $tmp; |
@@ -1166,10 +1170,18 @@ discard block |
||
| 1166 | 1170 | return array(); |
| 1167 | 1171 | } |
| 1168 | 1172 | $spacer = md5('<<<EVO>>>'); |
| 1169 | - if($left==='{{' && strpos($content,';}}')!==false) $content = str_replace(';}}', sprintf(';}%s}', $spacer),$content); |
|
| 1170 | - if($left==='{{' && strpos($content,'{{}}')!==false) $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content); |
|
| 1171 | - if($left==='[[' && strpos($content,']]]]')!==false) $content = str_replace(']]]]',sprintf(']]%s]]', $spacer),$content); |
|
| 1172 | - if($left==='[[' && strpos($content,']]]')!==false) $content = str_replace(']]]', sprintf(']%s]]', $spacer),$content); |
|
| 1173 | + if($left==='{{' && strpos($content,';}}')!==false) { |
|
| 1174 | + $content = str_replace(';}}', sprintf(';}%s}', $spacer),$content); |
|
| 1175 | + } |
|
| 1176 | + if($left==='{{' && strpos($content,'{{}}')!==false) { |
|
| 1177 | + $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content); |
|
| 1178 | + } |
|
| 1179 | + if($left==='[[' && strpos($content,']]]]')!==false) { |
|
| 1180 | + $content = str_replace(']]]]',sprintf(']]%s]]', $spacer),$content); |
|
| 1181 | + } |
|
| 1182 | + if($left==='[[' && strpos($content,']]]')!==false) { |
|
| 1183 | + $content = str_replace(']]]', sprintf(']%s]]', $spacer),$content); |
|
| 1184 | + } |
|
| 1173 | 1185 | |
| 1174 | 1186 | $pos['<![CDATA['] = strpos($content, '<![CDATA['); |
| 1175 | 1187 | $pos[']]>'] = strpos($content, ']]>'); |
@@ -1222,7 +1234,8 @@ discard block |
||
| 1222 | 1234 | } |
| 1223 | 1235 | } |
| 1224 | 1236 | |
| 1225 | - if (!in_array($fetch, $tags)) { // Avoid double Matches |
|
| 1237 | + if (!in_array($fetch, $tags)) { |
|
| 1238 | +// Avoid double Matches |
|
| 1226 | 1239 | $tags[] = $fetch; // Fetch |
| 1227 | 1240 | }; |
| 1228 | 1241 | $fetch = ''; // and reset |
@@ -1240,7 +1253,9 @@ discard block |
||
| 1240 | 1253 | } |
| 1241 | 1254 | } |
| 1242 | 1255 | foreach($tags as $i=>$tag) { |
| 1243 | - if(strpos($tag,$spacer)!==false) $tags[$i] = str_replace($spacer, '', $tag); |
|
| 1256 | + if(strpos($tag,$spacer)!==false) { |
|
| 1257 | + $tags[$i] = str_replace($spacer, '', $tag); |
|
| 1258 | + } |
|
| 1244 | 1259 | } |
| 1245 | 1260 | return $tags; |
| 1246 | 1261 | } |
@@ -1280,7 +1295,10 @@ discard block |
||
| 1280 | 1295 | } |
| 1281 | 1296 | |
| 1282 | 1297 | foreach ($matches[1] as $i => $key) { |
| 1283 | - if(strpos($key,'[+')!==false) continue; // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
| 1298 | + if(strpos($key,'[+')!==false) { |
|
| 1299 | + continue; |
|
| 1300 | + } |
|
| 1301 | + // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
| 1284 | 1302 | if (substr($key, 0, 1) == '#') { |
| 1285 | 1303 | $key = substr($key, 1); |
| 1286 | 1304 | } // remove # for QuickEdit format |
@@ -2005,7 +2023,8 @@ discard block |
||
| 2005 | 2023 | * @return mixed|string |
| 2006 | 2024 | */ |
| 2007 | 2025 | public function _getSGVar($value) |
| 2008 | - { // Get super globals |
|
| 2026 | + { |
|
| 2027 | +// Get super globals |
|
| 2009 | 2028 | $key = $value; |
| 2010 | 2029 | $_ = $this->config['enable_filter']; |
| 2011 | 2030 | $this->config['enable_filter'] = 1; |
@@ -2410,7 +2429,8 @@ discard block |
||
| 2410 | 2429 | if ($this->config['friendly_urls'] == 1) { |
| 2411 | 2430 | $aliases = array(); |
| 2412 | 2431 | if (is_array($this->documentListing)) { |
| 2413 | - foreach ($this->documentListing as $path => $docid) { // This is big Loop on large site! |
|
| 2432 | + foreach ($this->documentListing as $path => $docid) { |
|
| 2433 | +// This is big Loop on large site! |
|
| 2414 | 2434 | $aliases[$docid] = $path; |
| 2415 | 2435 | $isfolder[$docid] = $this->aliasListing[$docid]['isfolder']; |
| 2416 | 2436 | } |
@@ -2443,7 +2463,7 @@ discard block |
||
| 2443 | 2463 | $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0); |
| 2444 | 2464 | $pref = $this->config['friendly_url_prefix']; |
| 2445 | 2465 | $suff = $this->config['friendly_url_suffix']; |
| 2446 | - $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
| 2466 | + $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff){ |
|
| 2447 | 2467 | global $modx; |
| 2448 | 2468 | $thealias = $aliases[$m[1]]; |
| 2449 | 2469 | $thefolder = $isfolder[$m[1]]; |
@@ -3120,7 +3140,9 @@ discard block |
||
| 3120 | 3140 | public function webAlertAndQuit($msg, $url = "") |
| 3121 | 3141 | { |
| 3122 | 3142 | global $modx_manager_charset; |
| 3123 | - if($this->ajaxMode === true) $this->jsonResponse(array('error'=>$msg)); |
|
| 3143 | + if($this->ajaxMode === true) { |
|
| 3144 | + $this->jsonResponse(array('error'=>$msg)); |
|
| 3145 | + } |
|
| 3124 | 3146 | if (substr(strtolower($url), 0, 11) == "javascript:") { |
| 3125 | 3147 | $fnc = substr($url, 11); |
| 3126 | 3148 | } elseif ($url) { |
@@ -4216,7 +4238,8 @@ discard block |
||
| 4216 | 4238 | if (isset ($this->snippetCache[$snippetName])) { |
| 4217 | 4239 | $snippet = $this->snippetCache[$snippetName]; |
| 4218 | 4240 | $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : ''; |
| 4219 | - } else { // not in cache so let's check the db |
|
| 4241 | + } else { |
|
| 4242 | +// not in cache so let's check the db |
|
| 4220 | 4243 | $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM " . $this->getFullTableName("site_snippets") . " as ss LEFT JOIN " . $this->getFullTableName('site_modules') . " as sm on sm.guid=ss.moduleguid WHERE ss.`name`='" . $this->db->escape($snippetName) . "' AND ss.disabled=0;"; |
| 4221 | 4244 | $result = $this->db->query($sql); |
| 4222 | 4245 | if ($this->db->getRecordCount($result) == 1) { |
@@ -4720,7 +4743,7 @@ discard block |
||
| 4720 | 4743 | $result = $this->db->makeArray($rs); |
| 4721 | 4744 | |
| 4722 | 4745 | // get default/built-in template variables |
| 4723 | - if(is_array($docRow)){ |
|
| 4746 | + if(is_array($docRow)) { |
|
| 4724 | 4747 | ksort($docRow); |
| 4725 | 4748 | |
| 4726 | 4749 | foreach ($docRow as $key => $value) { |
@@ -5199,12 +5222,16 @@ discard block |
||
| 5199 | 5222 | return ''; |
| 5200 | 5223 | } // nothing to register |
| 5201 | 5224 | if (!is_array($options)) { |
| 5202 | - if (is_bool($options)) // backward compatibility with old plaintext parameter |
|
| 5225 | + if (is_bool($options)) { |
|
| 5226 | + // backward compatibility with old plaintext parameter |
|
| 5203 | 5227 | { |
| 5204 | 5228 | $options = array('plaintext' => $options); |
| 5205 | - } elseif (is_string($options)) // Also allow script name as 2nd param |
|
| 5229 | + } |
|
| 5230 | + } elseif (is_string($options)) { |
|
| 5231 | + // Also allow script name as 2nd param |
|
| 5206 | 5232 | { |
| 5207 | 5233 | $options = array('name' => $options); |
| 5234 | + } |
|
| 5208 | 5235 | } else { |
| 5209 | 5236 | $options = array(); |
| 5210 | 5237 | } |
@@ -5216,7 +5243,8 @@ discard block |
||
| 5216 | 5243 | unset($overwritepos); // probably unnecessary--just making sure |
| 5217 | 5244 | |
| 5218 | 5245 | $useThisVer = true; |
| 5219 | - if (isset($this->loadedjscripts[$key])) { // a matching script was found |
|
| 5246 | + if (isset($this->loadedjscripts[$key])) { |
|
| 5247 | +// a matching script was found |
|
| 5220 | 5248 | // if existing script is a startup script, make sure the candidate is also a startup script |
| 5221 | 5249 | if ($this->loadedjscripts[$key]['startup']) { |
| 5222 | 5250 | $startup = true; |
@@ -5236,7 +5264,8 @@ discard block |
||
| 5236 | 5264 | // overwrite the old script (the position may be important for dependent scripts) |
| 5237 | 5265 | $overwritepos = $this->loadedjscripts[$key]['pos']; |
| 5238 | 5266 | } |
| 5239 | - } else { // Use the original version |
|
| 5267 | + } else { |
|
| 5268 | +// Use the original version |
|
| 5240 | 5269 | if ($startup == true && $this->loadedjscripts[$key]['startup'] == false) { |
| 5241 | 5270 | // need to move the exisiting script to the head |
| 5242 | 5271 | $version = $this->loadedjscripts[$key][$version]; |
@@ -5360,7 +5389,8 @@ discard block |
||
| 5360 | 5389 | } |
| 5361 | 5390 | |
| 5362 | 5391 | $results = null; |
| 5363 | - foreach ($this->pluginEvent[$evtName] as $pluginName) { // start for loop |
|
| 5392 | + foreach ($this->pluginEvent[$evtName] as $pluginName) { |
|
| 5393 | +// start for loop |
|
| 5364 | 5394 | if ($this->dumpPlugins) { |
| 5365 | 5395 | $eventtime = $this->getMicroTime(); |
| 5366 | 5396 | } |
@@ -5908,7 +5938,8 @@ discard block |
||
| 5908 | 5938 | * @return bool |
| 5909 | 5939 | */ |
| 5910 | 5940 | public function isSafeCode($phpcode = '', $safe_functions = '') |
| 5911 | - { // return true or false |
|
| 5941 | + { |
|
| 5942 | +// return true or false |
|
| 5912 | 5943 | if ($safe_functions == '') { |
| 5913 | 5944 | return false; |
| 5914 | 5945 | } |
@@ -6324,7 +6355,7 @@ discard block |
||
| 6324 | 6355 | $args = array_pad(array(), $_, '$var'); |
| 6325 | 6356 | $args = implode(", ", $args); |
| 6326 | 6357 | $modx = &$this; |
| 6327 | - $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) { |
|
| 6358 | + $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val){ |
|
| 6328 | 6359 | $arg = $val['args'][$tmp - 1]; |
| 6329 | 6360 | switch (true) { |
| 6330 | 6361 | case is_null($arg): { |
@@ -6565,7 +6596,8 @@ discard block |
||
| 6565 | 6596 | * |
| 6566 | 6597 | * @param boolean $state State of ajaxMode |
| 6567 | 6598 | */ |
| 6568 | - function setAjaxMode($state) { |
|
| 6599 | + function setAjaxMode($state) |
|
| 6600 | + { |
|
| 6569 | 6601 | $this->ajaxMode = $state === true ? true : false; |
| 6570 | 6602 | } |
| 6571 | 6603 | |
@@ -6574,7 +6606,8 @@ discard block |
||
| 6574 | 6606 | * |
| 6575 | 6607 | * @param array $array Array to convert |
| 6576 | 6608 | */ |
| 6577 | - function jsonResponse($array) { |
|
| 6609 | + function jsonResponse($array) |
|
| 6610 | + { |
|
| 6578 | 6611 | header('content-type: application/json'); |
| 6579 | 6612 | exit(json_encode($array, JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE)); |
| 6580 | 6613 | } |
@@ -1,25 +1,25 @@ 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 | if (!$modx->hasPermission('delete_document')) { |
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -$id = isset($_REQUEST['id'])? intval($_REQUEST['id']) : 0; |
|
| 10 | -if ($id==0) { |
|
| 9 | +$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
|
| 10 | +if ($id == 0) { |
|
| 11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | /*******ищем родителя чтобы к нему вернуться********/ |
| 15 | -$content=$modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'")); |
|
| 16 | -$pid=($content['parent']==0?$id:$content['parent']); |
|
| 15 | +$content = $modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'")); |
|
| 16 | +$pid = ($content['parent'] == 0 ? $id : $content['parent']); |
|
| 17 | 17 | |
| 18 | 18 | /************ а заодно и путь возврата (сам путь внизу файла) **********/ |
| 19 | -$sd=isset($_REQUEST['dir'])?'&dir='.$_REQUEST['dir']:'&dir=DESC'; |
|
| 20 | -$sb=isset($_REQUEST['sort'])?'&sort='.$_REQUEST['sort']:'&sort=createdon'; |
|
| 21 | -$pg=isset($_REQUEST['page'])?'&page='.(int)$_REQUEST['page']:''; |
|
| 22 | -$add_path=$sd.$sb.$pg; |
|
| 19 | +$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC'; |
|
| 20 | +$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon'; |
|
| 21 | +$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : ''; |
|
| 22 | +$add_path = $sd.$sb.$pg; |
|
| 23 | 23 | |
| 24 | 24 | /*****************************/ |
| 25 | 25 | |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | $children = array(); |
| 28 | 28 | |
| 29 | 29 | // check permissions on the document |
| 30 | -include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php"; |
|
| 30 | +include_once MODX_MANAGER_PATH."processors/user_documents_permissions.class.php"; |
|
| 31 | 31 | $udperms = new udperms(); |
| 32 | 32 | $udperms->user = $modx->getLoginUserID(); |
| 33 | 33 | $udperms->document = $id; |
@@ -48,17 +48,17 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent={$parent} AND deleted=0"); |
| 50 | 50 | // the document has children documents, we'll need to delete those too |
| 51 | - while ($childid=$modx->db->getValue($rs)) { |
|
| 52 | - if ($childid==$site_start) { |
|
| 51 | + while ($childid = $modx->db->getValue($rs)) { |
|
| 52 | + if ($childid == $site_start) { |
|
| 53 | 53 | $modx->webAlertAndQuit("The document you are trying to delete is a folder containing document {$childid}. This document is registered as the 'Site start' document, and cannot be deleted. Please assign another document as your 'Site start' document and try again."); |
| 54 | 54 | } |
| 55 | - if ($childid==$site_unavailable_page) { |
|
| 55 | + if ($childid == $site_unavailable_page) { |
|
| 56 | 56 | $modx->webAlertAndQuit("The document you are trying to delete is a folder containing document {$childid}. This document is registered as the 'Site unavailable page' document, and cannot be deleted. Please assign another document as your 'Site unavailable page' document and try again."); |
| 57 | 57 | } |
| 58 | - if ($childid==$error_page) { |
|
| 58 | + if ($childid == $error_page) { |
|
| 59 | 59 | $modx->webAlertAndQuit("The document you are trying to delete is a folder containing document {$childid}. This document is registered as the 'Site error page' document, and cannot be deleted. Please assign another document as your 'Site error page' document and try again."); |
| 60 | 60 | } |
| 61 | - if ($childid==$unauthorized_page) { |
|
| 61 | + if ($childid == $unauthorized_page) { |
|
| 62 | 62 | $modx->webAlertAndQuit("The document you are trying to delete is a folder containing document {$childid}. This document is registered as the 'Site unauthorized page' document, and cannot be deleted. Please assign another document as your 'Site unauthorized page' document and try again."); |
| 63 | 63 | } |
| 64 | 64 | $children[] = $childid; |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | "children"=>$children |
| 77 | 77 | )); |
| 78 | 78 | |
| 79 | -if (count($children)>0) { |
|
| 79 | +if (count($children) > 0) { |
|
| 80 | 80 | $modx->db->update( |
| 81 | 81 | array( |
| 82 | 82 | 'deleted' => 1, |
@@ -85,19 +85,19 @@ discard block |
||
| 85 | 85 | ), $modx->getFullTableName('site_content'), "id IN (".implode(", ", $children).")"); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | -if ($site_start==$id) { |
|
| 88 | +if ($site_start == $id) { |
|
| 89 | 89 | $modx->webAlertAndQuit("Document is 'Site start' and cannot be deleted!"); |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | -if ($site_unavailable_page==$id) { |
|
| 92 | +if ($site_unavailable_page == $id) { |
|
| 93 | 93 | $modx->webAlertAndQuit("Document is used as the 'Site unavailable page' and cannot be deleted!"); |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | -if ($error_page==$id) { |
|
| 96 | +if ($error_page == $id) { |
|
| 97 | 97 | $modx->webAlertAndQuit("Document is used as the 'Site error page' and cannot be deleted!"); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | -if ($unauthorized_page==$id) { |
|
| 100 | +if ($unauthorized_page == $id) { |
|
| 101 | 101 | $modx->webAlertAndQuit("Document is used as the 'Site unauthorized page' and cannot be deleted!"); |
| 102 | 102 | } |
| 103 | 103 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | $modx->clearCache('full'); |
| 124 | 124 | |
| 125 | 125 | // finished emptying cache - redirect |
| 126 | -if($modx->ajaxMode !== true) { |
|
| 127 | - $header="Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
| 126 | +if ($modx->ajaxMode !== true) { |
|
| 127 | + $header = "Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
| 128 | 128 | header($header); |
| 129 | 129 | } |
| 130 | 130 | \ No newline at end of file |
@@ -1,50 +1,50 @@ 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 | -if(!$modx->hasPermission('delete_document')) { |
|
| 5 | +if (!$modx->hasPermission('delete_document')) { |
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -$id = isset($_REQUEST['id'])? intval($_REQUEST['id']) : 0; |
|
| 10 | -if($id==0) { |
|
| 9 | +$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
|
| 10 | +if ($id == 0) { |
|
| 11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | /************ webber ********/ |
| 15 | -$content=$modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'")); |
|
| 16 | -$pid=($content['parent']==0?$id:$content['parent']); |
|
| 15 | +$content = $modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'")); |
|
| 16 | +$pid = ($content['parent'] == 0 ? $id : $content['parent']); |
|
| 17 | 17 | |
| 18 | 18 | /************** webber *************/ |
| 19 | -$sd=isset($_REQUEST['dir'])?'&dir='.$_REQUEST['dir']:'&dir=DESC'; |
|
| 20 | -$sb=isset($_REQUEST['sort'])?'&sort='.$_REQUEST['sort']:'&sort=createdon'; |
|
| 21 | -$pg=isset($_REQUEST['page'])?'&page='.(int)$_REQUEST['page']:''; |
|
| 22 | -$add_path=$sd.$sb.$pg; |
|
| 19 | +$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC'; |
|
| 20 | +$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon'; |
|
| 21 | +$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : ''; |
|
| 22 | +$add_path = $sd.$sb.$pg; |
|
| 23 | 23 | |
| 24 | 24 | /***********************************/ |
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | // check permissions on the document |
| 28 | -include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php"; |
|
| 28 | +include_once MODX_MANAGER_PATH."processors/user_documents_permissions.class.php"; |
|
| 29 | 29 | $udperms = new udperms(); |
| 30 | 30 | $udperms->user = $modx->getLoginUserID(); |
| 31 | 31 | $udperms->document = $id; |
| 32 | 32 | $udperms->role = $_SESSION['mgrRole']; |
| 33 | 33 | |
| 34 | -if(!$udperms->checkPermissions()) { |
|
| 34 | +if (!$udperms->checkPermissions()) { |
|
| 35 | 35 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | // get the timestamp on which the document was deleted. |
| 39 | 39 | $rs = $modx->db->select('deletedon', $modx->getFullTableName('site_content'), "id='{$id}' AND deleted=1"); |
| 40 | 40 | $deltime = $modx->db->getValue($rs); |
| 41 | -if(!$deltime) { |
|
| 41 | +if (!$deltime) { |
|
| 42 | 42 | $modx->webAlertAndQuit("Couldn't find document to determine it's date of deletion!"); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | $children = array(); |
| 46 | 46 | |
| 47 | -function getChildren($parent) { |
|
| 47 | +function getChildren($parent){ |
|
| 48 | 48 | |
| 49 | 49 | global $modx; |
| 50 | 50 | global $children; |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent='{$parent}' AND deleted=1 AND deletedon='{$deltime}'"); |
| 54 | 54 | // the document has children documents, we'll need to delete those too |
| 55 | - while ($row=$modx->db->getRow($rs)) { |
|
| 55 | + while ($row = $modx->db->getRow($rs)) { |
|
| 56 | 56 | $children[] = $row['id']; |
| 57 | 57 | getChildren($row['id']); |
| 58 | 58 | //echo "Found childNode of parentNode $parent: ".$row['id']."<br />"; |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | getChildren($id); |
| 63 | 63 | |
| 64 | -if(count($children)>0) { |
|
| 64 | +if (count($children) > 0) { |
|
| 65 | 65 | $modx->db->update( |
| 66 | 66 | array( |
| 67 | 67 | 'deleted' => 0, |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | $modx->clearCache('full'); |
| 91 | 91 | |
| 92 | 92 | // finished emptying cache - redirect |
| 93 | -if($modx->ajaxMode !== true) { |
|
| 94 | - $header="Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
| 93 | +if ($modx->ajaxMode !== true) { |
|
| 94 | + $header = "Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
| 95 | 95 | header($header); |
| 96 | 96 | } |
| 97 | 97 | \ No newline at end of file |
@@ -1,38 +1,38 @@ 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 | -if(!$modx->hasPermission('save_document')||!$modx->hasPermission('publish_document')) { |
|
| 5 | +if (!$modx->hasPermission('save_document') || !$modx->hasPermission('publish_document')) { |
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -$id = isset($_REQUEST['id'])? intval($_REQUEST['id']) : 0; |
|
| 10 | -if($id==0) { |
|
| 9 | +$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
|
| 10 | +if ($id == 0) { |
|
| 11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | /************webber ********/ |
| 15 | -$content=$modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'")); |
|
| 16 | -$pid=($content['parent']==0?$id:$content['parent']); |
|
| 15 | +$content = $modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'")); |
|
| 16 | +$pid = ($content['parent'] == 0 ? $id : $content['parent']); |
|
| 17 | 17 | |
| 18 | 18 | /************** webber *************/ |
| 19 | -$sd=isset($_REQUEST['dir'])?'&dir='.$_REQUEST['dir']:'&dir=DESC'; |
|
| 20 | -$sb=isset($_REQUEST['sort'])?'&sort='.$_REQUEST['sort']:'&sort=createdon'; |
|
| 21 | -$pg=isset($_REQUEST['page'])?'&page='.(int)$_REQUEST['page']:''; |
|
| 22 | -$add_path=$sd.$sb.$pg; |
|
| 19 | +$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC'; |
|
| 20 | +$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon'; |
|
| 21 | +$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : ''; |
|
| 22 | +$add_path = $sd.$sb.$pg; |
|
| 23 | 23 | |
| 24 | 24 | /***********************************/ |
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | |
| 28 | 28 | // check permissions on the document |
| 29 | -include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php"; |
|
| 29 | +include_once MODX_MANAGER_PATH."processors/user_documents_permissions.class.php"; |
|
| 30 | 30 | $udperms = new udperms(); |
| 31 | 31 | $udperms->user = $modx->getLoginUserID(); |
| 32 | 32 | $udperms->document = $id; |
| 33 | 33 | $udperms->role = $_SESSION['mgrRole']; |
| 34 | 34 | |
| 35 | -if(!$udperms->checkPermissions()) { |
|
| 35 | +if (!$udperms->checkPermissions()) { |
|
| 36 | 36 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
| 37 | 37 | } |
| 38 | 38 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | ), $modx->getFullTableName('site_content'), "id='{$id}'"); |
| 50 | 50 | |
| 51 | 51 | // invoke OnDocPublished event |
| 52 | -$modx->invokeEvent("OnDocPublished",array("docid"=>$id)); |
|
| 52 | +$modx->invokeEvent("OnDocPublished", array("docid"=>$id)); |
|
| 53 | 53 | |
| 54 | 54 | // Set the item name for logger |
| 55 | 55 | $_SESSION['itemname'] = $content['pagetitle']; |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | // empty cache |
| 58 | 58 | $modx->clearCache('full'); |
| 59 | 59 | |
| 60 | -if($modx->ajaxMode !== true) { |
|
| 61 | - $header="Location: index.php?a=3&id=$pid&r=1" . $add_path; |
|
| 60 | +if ($modx->ajaxMode !== true) { |
|
| 61 | + $header = "Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
| 62 | 62 | header($header); |
| 63 | 63 | } |
| 64 | 64 | \ No newline at end of file |
@@ -1,38 +1,38 @@ 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 | -if(!$modx->hasPermission('save_document')||!$modx->hasPermission('publish_document')) { |
|
| 5 | +if (!$modx->hasPermission('save_document') || !$modx->hasPermission('publish_document')) { |
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -$id = isset($_REQUEST['id'])? intval($_REQUEST['id']) : 0; |
|
| 10 | -if($id==0) { |
|
| 9 | +$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
|
| 10 | +if ($id == 0) { |
|
| 11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | /************webber ********/ |
| 15 | -$content=$modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'")); |
|
| 16 | -$pid=($content['parent']==0?$id:$content['parent']); |
|
| 15 | +$content = $modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'")); |
|
| 16 | +$pid = ($content['parent'] == 0 ? $id : $content['parent']); |
|
| 17 | 17 | |
| 18 | 18 | /************** webber *************/ |
| 19 | -$sd=isset($_REQUEST['dir'])?'&dir='.$_REQUEST['dir']:'&dir=DESC'; |
|
| 20 | -$sb=isset($_REQUEST['sort'])?'&sort='.$_REQUEST['sort']:'&sort=createdon'; |
|
| 21 | -$pg=isset($_REQUEST['page'])?'&page='.(int)$_REQUEST['page']:''; |
|
| 22 | -$add_path=$sd.$sb.$pg; |
|
| 19 | +$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC'; |
|
| 20 | +$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon'; |
|
| 21 | +$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : ''; |
|
| 22 | +$add_path = $sd.$sb.$pg; |
|
| 23 | 23 | |
| 24 | 24 | /***********************************/ |
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | |
| 28 | 28 | // check permissions on the document |
| 29 | -include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php"; |
|
| 29 | +include_once MODX_MANAGER_PATH."processors/user_documents_permissions.class.php"; |
|
| 30 | 30 | $udperms = new udperms(); |
| 31 | 31 | $udperms->user = $modx->getLoginUserID(); |
| 32 | 32 | $udperms->document = $id; |
| 33 | 33 | $udperms->role = $_SESSION['mgrRole']; |
| 34 | 34 | |
| 35 | -if(!$udperms->checkPermissions()) { |
|
| 35 | +if (!$udperms->checkPermissions()) { |
|
| 36 | 36 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
| 37 | 37 | } |
| 38 | 38 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | ), $modx->getFullTableName('site_content'), "id='{$id}'"); |
| 50 | 50 | |
| 51 | 51 | // invoke OnDocUnPublished event |
| 52 | -$modx->invokeEvent("OnDocUnPublished",array("docid"=>$id)); |
|
| 52 | +$modx->invokeEvent("OnDocUnPublished", array("docid"=>$id)); |
|
| 53 | 53 | |
| 54 | 54 | // Set the item name for logger |
| 55 | 55 | $_SESSION['itemname'] = $content['pagetitle']; |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | // empty cache |
| 58 | 58 | $modx->clearCache('full'); |
| 59 | 59 | |
| 60 | -if($modx->ajaxMode !== true) { |
|
| 61 | - $header="Location: index.php?a=3&id=$pid&r=1" . $add_path; |
|
| 60 | +if ($modx->ajaxMode !== true) { |
|
| 61 | + $header = "Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
| 62 | 62 | header($header); |
| 63 | 63 | } |
| 64 | 64 | \ No newline at end of file |
@@ -20,11 +20,11 @@ discard block |
||
| 20 | 20 | extract($modx->config, EXTR_OVERWRITE); // For correct function of native processors |
| 21 | 21 | |
| 22 | 22 | $_lang = array(); |
| 23 | -include_once MODX_MANAGER_PATH . '/includes/lang/english.inc.php'; |
|
| 23 | +include_once MODX_MANAGER_PATH.'/includes/lang/english.inc.php'; |
|
| 24 | 24 | if ($modx->config['manager_language'] != 'english') {
|
| 25 | - include_once MODX_MANAGER_PATH . '/includes/lang/' . $modx->config['manager_language'] . '.inc.php'; |
|
| 25 | + include_once MODX_MANAGER_PATH.'/includes/lang/'.$modx->config['manager_language'].'.inc.php'; |
|
| 26 | 26 | } |
| 27 | -include_once MODX_MANAGER_PATH . '/media/style/' . $modx->config['manager_theme'] . '/style.php'; |
|
| 27 | +include_once MODX_MANAGER_PATH.'/media/style/'.$modx->config['manager_theme'].'/style.php'; |
|
| 28 | 28 | |
| 29 | 29 | $action = isset($_REQUEST['a']) ? $_REQUEST['a'] : ''; |
| 30 | 30 | $frame = isset($_REQUEST['f']) ? $_REQUEST['f'] : ''; |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | switch ($frame) {
|
| 45 | 45 | case 'nodes': |
| 46 | - include_once MODX_MANAGER_PATH . '/frames/nodes.php'; |
|
| 46 | + include_once MODX_MANAGER_PATH.'/frames/nodes.php'; |
|
| 47 | 47 | |
| 48 | 48 | break; |
| 49 | 49 | } |
@@ -61,21 +61,21 @@ discard block |
||
| 61 | 61 | $sql = ''; |
| 62 | 62 | $a = ''; |
| 63 | 63 | $filter = !empty($_REQUEST['filter']) && is_scalar($_REQUEST['filter']) ? addcslashes(trim($_REQUEST['filter']), '%*_') : ''; |
| 64 | - $sqlLike = $filter ? 'WHERE t1.name LIKE "' . $modx->db->escape($filter) . '%"' : ''; |
|
| 65 | - $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit; |
|
| 64 | + $sqlLike = $filter ? 'WHERE t1.name LIKE "'.$modx->db->escape($filter).'%"' : ''; |
|
| 65 | + $sqlLimit = $sqlLike ? '' : 'LIMIT '.$limit; |
|
| 66 | 66 | |
| 67 | 67 | switch ($elements) {
|
| 68 | 68 | case 'element_templates': |
| 69 | 69 | $a = 16; |
| 70 | - $sqlLike = $filter ? 'WHERE t1.templatename LIKE "' . $modx->db->escape($filter) . '%"' : ''; |
|
| 70 | + $sqlLike = $filter ? 'WHERE t1.templatename LIKE "'.$modx->db->escape($filter).'%"' : ''; |
|
| 71 | 71 | $sql = $modx->db->query('SELECT t1.*, t1.templatename AS name
|
| 72 | - FROM ' . $modx->getFullTableName('site_templates') . ' AS t1
|
|
| 73 | - ' . $sqlLike . ' |
|
| 72 | + FROM ' . $modx->getFullTableName('site_templates').' AS t1
|
|
| 73 | + ' . $sqlLike.' |
|
| 74 | 74 | ORDER BY t1.templatename ASC |
| 75 | 75 | ' . $sqlLimit); |
| 76 | 76 | |
| 77 | 77 | if ($modx->hasPermission('new_template')) {
|
| 78 | - $output .= '<li><a id="a_19" href="index.php?a=19" target="main"><i class="fa fa-plus"></i>' . $_lang['new_template'] . '</a></li>'; |
|
| 78 | + $output .= '<li><a id="a_19" href="index.php?a=19" target="main"><i class="fa fa-plus"></i>'.$_lang['new_template'].'</a></li>'; |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | break; |
@@ -83,15 +83,15 @@ discard block |
||
| 83 | 83 | case 'element_tplvars': |
| 84 | 84 | $a = 301; |
| 85 | 85 | $sql = $modx->db->query('SELECT t1.*, IF(t2.templateid,0,1) AS disabled
|
| 86 | - FROM ' . $modx->getFullTableName('site_tmplvars') . ' AS t1
|
|
| 87 | - LEFT JOIN ' . $modx->getFullTableName('site_tmplvar_templates') . ' AS t2 ON t1.id=t2.tmplvarid
|
|
| 88 | - ' . $sqlLike . ' |
|
| 86 | + FROM ' . $modx->getFullTableName('site_tmplvars').' AS t1
|
|
| 87 | + LEFT JOIN ' . $modx->getFullTableName('site_tmplvar_templates').' AS t2 ON t1.id=t2.tmplvarid
|
|
| 88 | + ' . $sqlLike.' |
|
| 89 | 89 | GROUP BY t1.id |
| 90 | 90 | ORDER BY t1.name ASC |
| 91 | 91 | ' . $sqlLimit); |
| 92 | 92 | |
| 93 | 93 | if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) {
|
| 94 | - $output .= '<li><a id="a_300" href="index.php?a=300" target="main"><i class="fa fa-plus"></i>' . $_lang['new_tmplvars'] . '</a></li>'; |
|
| 94 | + $output .= '<li><a id="a_300" href="index.php?a=300" target="main"><i class="fa fa-plus"></i>'.$_lang['new_tmplvars'].'</a></li>'; |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | break; |
@@ -99,13 +99,13 @@ discard block |
||
| 99 | 99 | case 'element_htmlsnippets': |
| 100 | 100 | $a = 78; |
| 101 | 101 | $sql = $modx->db->query('SELECT t1.*
|
| 102 | - FROM ' . $modx->getFullTableName('site_htmlsnippets') . ' AS t1
|
|
| 103 | - ' . $sqlLike . ' |
|
| 102 | + FROM ' . $modx->getFullTableName('site_htmlsnippets').' AS t1
|
|
| 103 | + ' . $sqlLike.' |
|
| 104 | 104 | ORDER BY t1.name ASC |
| 105 | 105 | ' . $sqlLimit); |
| 106 | 106 | |
| 107 | 107 | if ($modx->hasPermission('new_chunk')) {
|
| 108 | - $output .= '<li><a id="a_77" href="index.php?a=77" target="main"><i class="fa fa-plus"></i>' . $_lang['new_htmlsnippet'] . '</a></li>'; |
|
| 108 | + $output .= '<li><a id="a_77" href="index.php?a=77" target="main"><i class="fa fa-plus"></i>'.$_lang['new_htmlsnippet'].'</a></li>'; |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | break; |
@@ -113,13 +113,13 @@ discard block |
||
| 113 | 113 | case 'element_snippets': |
| 114 | 114 | $a = 22; |
| 115 | 115 | $sql = $modx->db->query('SELECT t1.*
|
| 116 | - FROM ' . $modx->getFullTableName('site_snippets') . ' AS t1
|
|
| 117 | - ' . $sqlLike . ' |
|
| 116 | + FROM ' . $modx->getFullTableName('site_snippets').' AS t1
|
|
| 117 | + ' . $sqlLike.' |
|
| 118 | 118 | ORDER BY t1.name ASC |
| 119 | 119 | ' . $sqlLimit); |
| 120 | 120 | |
| 121 | 121 | if ($modx->hasPermission('new_snippet')) {
|
| 122 | - $output .= '<li><a id="a_23" href="index.php?a=23" target="main"><i class="fa fa-plus"></i>' . $_lang['new_snippet'] . '</a></li>'; |
|
| 122 | + $output .= '<li><a id="a_23" href="index.php?a=23" target="main"><i class="fa fa-plus"></i>'.$_lang['new_snippet'].'</a></li>'; |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | break; |
@@ -127,13 +127,13 @@ discard block |
||
| 127 | 127 | case 'element_plugins': |
| 128 | 128 | $a = 102; |
| 129 | 129 | $sql = $modx->db->query('SELECT t1.*
|
| 130 | - FROM ' . $modx->getFullTableName('site_plugins') . ' AS t1
|
|
| 131 | - ' . $sqlLike . ' |
|
| 130 | + FROM ' . $modx->getFullTableName('site_plugins').' AS t1
|
|
| 131 | + ' . $sqlLike.' |
|
| 132 | 132 | ORDER BY t1.name ASC |
| 133 | 133 | ' . $sqlLimit); |
| 134 | 134 | |
| 135 | 135 | if ($modx->hasPermission('new_plugin')) {
|
| 136 | - $output .= '<li><a id="a_101" href="index.php?a=101" target="main"><i class="fa fa-plus"></i>' . $_lang['new_plugin'] . '</a></li>'; |
|
| 136 | + $output .= '<li><a id="a_101" href="index.php?a=101" target="main"><i class="fa fa-plus"></i>'.$_lang['new_plugin'].'</a></li>'; |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | break; |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | continue; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | - $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";
|
|
| 151 | + $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";
|
|
| 152 | 152 | } |
| 153 | 153 | } |
| 154 | 154 | |
@@ -169,18 +169,18 @@ discard block |
||
| 169 | 169 | $output = ''; |
| 170 | 170 | $items = ''; |
| 171 | 171 | $filter = !empty($_REQUEST['filter']) && is_scalar($_REQUEST['filter']) ? addcslashes(trim($_REQUEST['filter']), '\%*_') : ''; |
| 172 | - $sqlLike = $filter ? 'WHERE t1.username LIKE "' . $modx->db->escape($filter) . '%"' : ''; |
|
| 173 | - $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit; |
|
| 172 | + $sqlLike = $filter ? 'WHERE t1.username LIKE "'.$modx->db->escape($filter).'%"' : ''; |
|
| 173 | + $sqlLimit = $sqlLike ? '' : 'LIMIT '.$limit; |
|
| 174 | 174 | |
| 175 | 175 | $sql = $modx->db->query('SELECT t1.*, t1.username AS name, t2.blocked
|
| 176 | - FROM ' . $modx->getFullTableName('manager_users') . ' AS t1
|
|
| 177 | - LEFT JOIN ' . $modx->getFullTableName('user_attributes') . ' AS t2 ON t1.id=t2.internalKey
|
|
| 178 | - ' . $sqlLike . ' |
|
| 176 | + FROM ' . $modx->getFullTableName('manager_users').' AS t1
|
|
| 177 | + LEFT JOIN ' . $modx->getFullTableName('user_attributes').' AS t2 ON t1.id=t2.internalKey
|
|
| 178 | + ' . $sqlLike.' |
|
| 179 | 179 | ORDER BY t1.username ASC |
| 180 | 180 | ' . $sqlLimit); |
| 181 | 181 | |
| 182 | 182 | if ($modx->hasPermission('new_user')) {
|
| 183 | - $output .= '<li><a id="a_11" href="index.php?a=11" target="main"><i class="fa fa-plus"></i>' . $_lang['new_user'] . '</a></li>'; |
|
| 183 | + $output .= '<li><a id="a_11" href="index.php?a=11" target="main"><i class="fa fa-plus"></i>'.$_lang['new_user'].'</a></li>'; |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | if ($count = $modx->db->getRecordCount($sql)) {
|
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>'; |
| 189 | 189 | } |
| 190 | 190 | while ($row = $modx->db->getRow($sql)) {
|
| 191 | - $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>';
|
|
| 191 | + $items .= '<li class="item '.($row['blocked'] ? 'disabled' : '').'"><a id="a_'.$a.'__id_'.$row['id'].'" href="index.php?a='.$a.'&id='.$row['id'].'" target="main">'.$row['name'].' <small>('.$row['id'].')</small></a></li>';
|
|
| 192 | 192 | } |
| 193 | 193 | } |
| 194 | 194 | |
@@ -208,18 +208,18 @@ discard block |
||
| 208 | 208 | $output = ''; |
| 209 | 209 | $items = ''; |
| 210 | 210 | $filter = !empty($_REQUEST['filter']) && is_scalar($_REQUEST['filter']) ? addcslashes(trim($_REQUEST['filter']), '\%*_') : ''; |
| 211 | - $sqlLike = $filter ? 'WHERE t1.username LIKE "' . $modx->db->escape($filter) . '%"' : ''; |
|
| 212 | - $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit; |
|
| 211 | + $sqlLike = $filter ? 'WHERE t1.username LIKE "'.$modx->db->escape($filter).'%"' : ''; |
|
| 212 | + $sqlLimit = $sqlLike ? '' : 'LIMIT '.$limit; |
|
| 213 | 213 | |
| 214 | 214 | $sql = $modx->db->query('SELECT t1.*, t1.username AS name, t2.blocked
|
| 215 | - FROM ' . $modx->getFullTableName('web_users') . ' AS t1
|
|
| 216 | - LEFT JOIN ' . $modx->getFullTableName('web_user_attributes') . ' AS t2 ON t1.id=t2.internalKey
|
|
| 217 | - ' . $sqlLike . ' |
|
| 215 | + FROM ' . $modx->getFullTableName('web_users').' AS t1
|
|
| 216 | + LEFT JOIN ' . $modx->getFullTableName('web_user_attributes').' AS t2 ON t1.id=t2.internalKey
|
|
| 217 | + ' . $sqlLike.' |
|
| 218 | 218 | ORDER BY t1.username ASC |
| 219 | 219 | ' . $sqlLimit); |
| 220 | 220 | |
| 221 | 221 | if ($modx->hasPermission('new_web_user')) {
|
| 222 | - $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>'; |
|
| 222 | + $output .= '<li><a id="a_87" href="index.php?a=87" target="main"><i class="fa fa-plus"></i>'.$_lang['new_web_user'].'</a></li>'; |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | if ($count = $modx->db->getRecordCount($sql)) {
|
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>'; |
| 228 | 228 | } |
| 229 | 229 | while ($row = $modx->db->getRow($sql)) {
|
| 230 | - $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>';
|
|
| 230 | + $items .= '<li class="item '.($row['blocked'] ? 'disabled' : '').'"><a id="a_'.$a.'__id_'.$row['id'].'" href="index.php?a='.$a.'&id='.$row['id'].'" target="main">'.$row['name'].' <small>('.$row['id'].')</small></a></li>';
|
|
| 231 | 231 | } |
| 232 | 232 | } |
| 233 | 233 | |
@@ -253,35 +253,35 @@ discard block |
||
| 253 | 253 | case 'SnippetNoCache': {
|
| 254 | 254 | |
| 255 | 255 | $sql = $modx->db->query('SELECT *
|
| 256 | - FROM ' . $modx->getFullTableName('site_snippets') . '
|
|
| 257 | - WHERE name="' . $name . '" |
|
| 256 | + FROM ' . $modx->getFullTableName('site_snippets').'
|
|
| 257 | + WHERE name="' . $name.'" |
|
| 258 | 258 | LIMIT 1'); |
| 259 | 259 | |
| 260 | 260 | if ($modx->db->getRecordCount($sql)) {
|
| 261 | 261 | $row = $modx->db->getRow($sql); |
| 262 | 262 | $contextmenu = array( |
| 263 | 263 | 'header' => array( |
| 264 | - 'innerHTML' => '<i class="fa fa-code"></i> ' . $row['name'] |
|
| 264 | + 'innerHTML' => '<i class="fa fa-code"></i> '.$row['name'] |
|
| 265 | 265 | ), |
| 266 | 266 | 'item' => array( |
| 267 | - 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'], |
|
| 268 | - 'url' => "index.php?a=22&id=" . $row['id'] |
|
| 267 | + 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'], |
|
| 268 | + 'url' => "index.php?a=22&id=".$row['id'] |
|
| 269 | 269 | ) |
| 270 | 270 | ); |
| 271 | 271 | if (!empty($row['description'])) {
|
| 272 | 272 | $contextmenu['seperator'] = ''; |
| 273 | 273 | $contextmenu['description'] = array( |
| 274 | - 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
|
| 274 | + 'innerHTML' => '<i class="fa fa-info"></i> '.$row['description'] |
|
| 275 | 275 | ); |
| 276 | 276 | } |
| 277 | 277 | } else {
|
| 278 | 278 | $contextmenu = array( |
| 279 | 279 | 'header' => array( |
| 280 | - 'innerHTML' => '<i class="fa fa-code"></i> ' . $name |
|
| 280 | + 'innerHTML' => '<i class="fa fa-code"></i> '.$name |
|
| 281 | 281 | ), |
| 282 | 282 | 'item' => array( |
| 283 | - 'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_snippet'], |
|
| 284 | - 'url' => "index.php?a=23&itemname=" . $name |
|
| 283 | + 'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_snippet'], |
|
| 284 | + 'url' => "index.php?a=23&itemname=".$name |
|
| 285 | 285 | ) |
| 286 | 286 | ); |
| 287 | 287 | } |
@@ -291,35 +291,35 @@ discard block |
||
| 291 | 291 | case 'Chunk' : {
|
| 292 | 292 | |
| 293 | 293 | $sql = $modx->db->query('SELECT *
|
| 294 | - FROM ' . $modx->getFullTableName('site_htmlsnippets') . '
|
|
| 295 | - WHERE name="' . $name . '" |
|
| 294 | + FROM ' . $modx->getFullTableName('site_htmlsnippets').'
|
|
| 295 | + WHERE name="' . $name.'" |
|
| 296 | 296 | LIMIT 1'); |
| 297 | 297 | |
| 298 | 298 | if ($modx->db->getRecordCount($sql)) {
|
| 299 | 299 | $row = $modx->db->getRow($sql); |
| 300 | 300 | $contextmenu = array( |
| 301 | 301 | 'header' => array( |
| 302 | - 'innerHTML' => '<i class="fa fa-th-large"></i> ' . $row['name'] |
|
| 302 | + 'innerHTML' => '<i class="fa fa-th-large"></i> '.$row['name'] |
|
| 303 | 303 | ), |
| 304 | 304 | 'item' => array( |
| 305 | - 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'], |
|
| 306 | - 'url' => "index.php?a=78&id=" . $row['id'] |
|
| 305 | + 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'], |
|
| 306 | + 'url' => "index.php?a=78&id=".$row['id'] |
|
| 307 | 307 | ) |
| 308 | 308 | ); |
| 309 | 309 | if (!empty($row['description'])) {
|
| 310 | 310 | $contextmenu['seperator'] = ''; |
| 311 | 311 | $contextmenu['description'] = array( |
| 312 | - 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
|
| 312 | + 'innerHTML' => '<i class="fa fa-info"></i> '.$row['description'] |
|
| 313 | 313 | ); |
| 314 | 314 | } |
| 315 | 315 | } else {
|
| 316 | 316 | $contextmenu = array( |
| 317 | 317 | 'header' => array( |
| 318 | - 'innerHTML' => '<i class="fa fa-th-large"></i> ' . $name |
|
| 318 | + 'innerHTML' => '<i class="fa fa-th-large"></i> '.$name |
|
| 319 | 319 | ), |
| 320 | 320 | 'item' => array( |
| 321 | - 'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_htmlsnippet'], |
|
| 322 | - 'url' => "index.php?a=77&itemname=" . $name |
|
| 321 | + 'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_htmlsnippet'], |
|
| 322 | + 'url' => "index.php?a=77&itemname=".$name |
|
| 323 | 323 | ) |
| 324 | 324 | ); |
| 325 | 325 | } |
@@ -328,8 +328,8 @@ discard block |
||
| 328 | 328 | } |
| 329 | 329 | case 'AttributeValue': {
|
| 330 | 330 | $sql = $modx->db->query('SELECT *
|
| 331 | - FROM ' . $modx->getFullTableName('site_htmlsnippets') . '
|
|
| 332 | - WHERE name="' . $name . '" |
|
| 331 | + FROM ' . $modx->getFullTableName('site_htmlsnippets').'
|
|
| 332 | + WHERE name="' . $name.'" |
|
| 333 | 333 | LIMIT 1'); |
| 334 | 334 | |
| 335 | 335 | if ($modx->db->getRecordCount($sql)) {
|
@@ -339,52 +339,52 @@ discard block |
||
| 339 | 339 | 'innerText' => $row['name'] |
| 340 | 340 | ), |
| 341 | 341 | 'item' => array( |
| 342 | - 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'], |
|
| 343 | - 'url' => "index.php?a=78&id=" . $row['id'] |
|
| 342 | + 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'], |
|
| 343 | + 'url' => "index.php?a=78&id=".$row['id'] |
|
| 344 | 344 | ) |
| 345 | 345 | ); |
| 346 | 346 | if (!empty($row['description'])) {
|
| 347 | 347 | $contextmenu['seperator'] = ''; |
| 348 | 348 | $contextmenu['description'] = array( |
| 349 | - 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
|
| 349 | + 'innerHTML' => '<i class="fa fa-info"></i> '.$row['description'] |
|
| 350 | 350 | ); |
| 351 | 351 | } |
| 352 | 352 | } else {
|
| 353 | 353 | |
| 354 | 354 | $sql = $modx->db->query('SELECT *
|
| 355 | - FROM ' . $modx->getFullTableName('site_snippets') . '
|
|
| 356 | - WHERE name="' . $name . '" |
|
| 355 | + FROM ' . $modx->getFullTableName('site_snippets').'
|
|
| 356 | + WHERE name="' . $name.'" |
|
| 357 | 357 | LIMIT 1'); |
| 358 | 358 | |
| 359 | 359 | if ($modx->db->getRecordCount($sql)) {
|
| 360 | 360 | $row = $modx->db->getRow($sql); |
| 361 | 361 | $contextmenu = array( |
| 362 | 362 | 'header' => array( |
| 363 | - 'innerHTML' => '<i class="fa fa-code"></i> ' . $row['name'] |
|
| 363 | + 'innerHTML' => '<i class="fa fa-code"></i> '.$row['name'] |
|
| 364 | 364 | ), |
| 365 | 365 | 'item' => array( |
| 366 | - 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'], |
|
| 367 | - 'url' => "index.php?a=22&id=" . $row['id'] |
|
| 366 | + 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'], |
|
| 367 | + 'url' => "index.php?a=22&id=".$row['id'] |
|
| 368 | 368 | ) |
| 369 | 369 | ); |
| 370 | 370 | if (!empty($row['description'])) {
|
| 371 | 371 | $contextmenu['seperator'] = ''; |
| 372 | 372 | $contextmenu['description'] = array( |
| 373 | - 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
|
| 373 | + 'innerHTML' => '<i class="fa fa-info"></i> '.$row['description'] |
|
| 374 | 374 | ); |
| 375 | 375 | } |
| 376 | 376 | } else {
|
| 377 | 377 | $contextmenu = array( |
| 378 | 378 | 'header' => array( |
| 379 | - 'innerHTML' => '<i class="fa fa-code"></i> ' . $name |
|
| 379 | + 'innerHTML' => '<i class="fa fa-code"></i> '.$name |
|
| 380 | 380 | ), |
| 381 | 381 | 'item' => array( |
| 382 | - 'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_htmlsnippet'], |
|
| 383 | - 'url' => "index.php?a=77&itemname=" . $name |
|
| 382 | + 'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_htmlsnippet'], |
|
| 383 | + 'url' => "index.php?a=77&itemname=".$name |
|
| 384 | 384 | ), |
| 385 | 385 | 'item2' => array( |
| 386 | - 'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_snippet'], |
|
| 387 | - 'url' => "index.php?a=23&itemname=" . $name |
|
| 386 | + 'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_snippet'], |
|
| 387 | + 'url' => "index.php?a=23&itemname=".$name |
|
| 388 | 388 | ) |
| 389 | 389 | ); |
| 390 | 390 | } |
@@ -440,35 +440,35 @@ discard block |
||
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | $sql = $modx->db->query('SELECT *
|
| 443 | - FROM ' . $modx->getFullTableName('site_tmplvars') . '
|
|
| 444 | - WHERE name="' . $name . '" |
|
| 443 | + FROM ' . $modx->getFullTableName('site_tmplvars').'
|
|
| 444 | + WHERE name="' . $name.'" |
|
| 445 | 445 | LIMIT 1'); |
| 446 | 446 | |
| 447 | 447 | if ($modx->db->getRecordCount($sql)) {
|
| 448 | 448 | $row = $modx->db->getRow($sql); |
| 449 | 449 | $contextmenu = array( |
| 450 | 450 | 'header' => array( |
| 451 | - 'innerHTML' => '<i class="fa fa-list-alt"></i> ' . $row['name'] |
|
| 451 | + 'innerHTML' => '<i class="fa fa-list-alt"></i> '.$row['name'] |
|
| 452 | 452 | ), |
| 453 | 453 | 'item' => array( |
| 454 | - 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'], |
|
| 455 | - 'url' => "index.php?a=301&id=" . $row['id'] |
|
| 454 | + 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'], |
|
| 455 | + 'url' => "index.php?a=301&id=".$row['id'] |
|
| 456 | 456 | ) |
| 457 | 457 | ); |
| 458 | 458 | if (!empty($row['description'])) {
|
| 459 | 459 | $contextmenu['seperator'] = ''; |
| 460 | 460 | $contextmenu['description'] = array( |
| 461 | - 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
|
| 461 | + 'innerHTML' => '<i class="fa fa-info"></i> '.$row['description'] |
|
| 462 | 462 | ); |
| 463 | 463 | } |
| 464 | 464 | } else {
|
| 465 | 465 | $contextmenu = array( |
| 466 | 466 | 'header' => array( |
| 467 | - 'innerHTML' => '<i class="fa fa-list-alt"></i> ' . $name |
|
| 467 | + 'innerHTML' => '<i class="fa fa-list-alt"></i> '.$name |
|
| 468 | 468 | ), |
| 469 | 469 | 'item' => array( |
| 470 | - 'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_tmplvars'], |
|
| 471 | - 'url' => "index.php?a=300&itemname=" . $name |
|
| 470 | + 'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_tmplvars'], |
|
| 471 | + 'url' => "index.php?a=300&itemname=".$name |
|
| 472 | 472 | ) |
| 473 | 473 | ); |
| 474 | 474 | } |
@@ -485,15 +485,15 @@ discard block |
||
| 485 | 485 | |
| 486 | 486 | case 'movedocument' : {
|
| 487 | 487 | if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) {
|
| 488 | - $id = !empty($_REQUEST['id']) ? (int)$_REQUEST['id'] : ''; |
|
| 489 | - $parent = isset($_REQUEST['parent']) ? (int)$_REQUEST['parent'] : 0; |
|
| 488 | + $id = !empty($_REQUEST['id']) ? (int) $_REQUEST['id'] : ''; |
|
| 489 | + $parent = isset($_REQUEST['parent']) ? (int) $_REQUEST['parent'] : 0; |
|
| 490 | 490 | $menuindex = isset($_REQUEST['menuindex']) && is_scalar($_REQUEST['menuindex']) ? $_REQUEST['menuindex'] : 0; |
| 491 | 491 | |
| 492 | 492 | // set parent |
| 493 | 493 | if ($id && $parent >= 0) {
|
| 494 | 494 | |
| 495 | 495 | // find older parent |
| 496 | - $parentOld = $modx->db->getValue($modx->db->select('parent', $modx->getFullTableName('site_content'), 'id=' . $id));
|
|
| 496 | + $parentOld = $modx->db->getValue($modx->db->select('parent', $modx->getFullTableName('site_content'), 'id='.$id));
|
|
| 497 | 497 | |
| 498 | 498 | $eventOut = $modx->invokeEvent('onBeforeMoveDocument', [
|
| 499 | 499 | 'id_document' => $id, |
@@ -514,7 +514,7 @@ discard block |
||
| 514 | 514 | if (empty($json['errors'])) {
|
| 515 | 515 | // check privileges user for move docs |
| 516 | 516 | if (!empty($modx->config['tree_show_protected']) && $role != 1) {
|
| 517 | - $sql = $modx->db->select('*', $modx->getFullTableName('document_groups'), 'document IN(' . $id . ',' . $parent . ',' . $parentOld . ')');
|
|
| 517 | + $sql = $modx->db->select('*', $modx->getFullTableName('document_groups'), 'document IN('.$id.','.$parent.','.$parentOld.')');
|
|
| 518 | 518 | if ($modx->db->getRecordCount($sql)) {
|
| 519 | 519 | $document_groups = array(); |
| 520 | 520 | while ($row = $modx->db->getRow($sql)) {
|
@@ -539,22 +539,22 @@ discard block |
||
| 539 | 539 | // set new parent |
| 540 | 540 | $modx->db->update(array( |
| 541 | 541 | 'parent' => $parent |
| 542 | - ), $modx->getFullTableName('site_content'), 'id=' . $id);
|
|
| 542 | + ), $modx->getFullTableName('site_content'), 'id='.$id);
|
|
| 543 | 543 | // set parent isfolder = 1 |
| 544 | 544 | $modx->db->update(array( |
| 545 | 545 | 'isfolder' => 1 |
| 546 | - ), $modx->getFullTableName('site_content'), 'id=' . $parent);
|
|
| 546 | + ), $modx->getFullTableName('site_content'), 'id='.$parent);
|
|
| 547 | 547 | |
| 548 | 548 | if ($parent != $parentOld) {
|
| 549 | 549 | // check children docs and set parent isfolder |
| 550 | - if ($modx->db->getRecordCount($modx->db->select('id', $modx->getFullTableName('site_content'), 'parent=' . $parentOld))) {
|
|
| 550 | + if ($modx->db->getRecordCount($modx->db->select('id', $modx->getFullTableName('site_content'), 'parent='.$parentOld))) {
|
|
| 551 | 551 | $modx->db->update(array( |
| 552 | 552 | 'isfolder' => 1 |
| 553 | - ), $modx->getFullTableName('site_content'), 'id=' . $parentOld);
|
|
| 553 | + ), $modx->getFullTableName('site_content'), 'id='.$parentOld);
|
|
| 554 | 554 | } else {
|
| 555 | 555 | $modx->db->update(array( |
| 556 | 556 | 'isfolder' => 0 |
| 557 | - ), $modx->getFullTableName('site_content'), 'id=' . $parentOld);
|
|
| 557 | + ), $modx->getFullTableName('site_content'), 'id='.$parentOld);
|
|
| 558 | 558 | } |
| 559 | 559 | } |
| 560 | 560 | |
@@ -562,7 +562,7 @@ discard block |
||
| 562 | 562 | if (!empty($menuindex)) {
|
| 563 | 563 | $menuindex = explode(',', $menuindex);
|
| 564 | 564 | foreach ($menuindex as $key => $value) {
|
| 565 | - $modx->db->query('UPDATE ' . $modx->getFullTableName('site_content') . ' SET menuindex=' . $key . ' WHERE id=' . $value);
|
|
| 565 | + $modx->db->query('UPDATE '.$modx->getFullTableName('site_content').' SET menuindex='.$key.' WHERE id='.$value);
|
|
| 566 | 566 | } |
| 567 | 567 | } else {
|
| 568 | 568 | // TODO: max(*) menuindex |
@@ -590,19 +590,19 @@ discard block |
||
| 590 | 590 | } |
| 591 | 591 | |
| 592 | 592 | case 'getLockedElements': {
|
| 593 | - $type = isset($_REQUEST['type']) ? (int)$_REQUEST['type'] : 0; |
|
| 594 | - $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
| 593 | + $type = isset($_REQUEST['type']) ? (int) $_REQUEST['type'] : 0; |
|
| 594 | + $id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
| 595 | 595 | |
| 596 | 596 | $output = !!$modx->elementIsLocked($type, $id, true); |
| 597 | 597 | |
| 598 | 598 | if (!$output) {
|
| 599 | 599 | $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : '';
|
| 600 | - $docgrp_cond = $docgrp ? ' OR dg.document_group IN (' . $docgrp . ')' : '';
|
|
| 600 | + $docgrp_cond = $docgrp ? ' OR dg.document_group IN ('.$docgrp.')' : '';
|
|
| 601 | 601 | $sql = ' |
| 602 | - SELECT MAX(IF(1=' . $role . ' OR sc.privatemgr=0' . $docgrp_cond . ', 0, 1)) AS locked |
|
| 603 | - FROM ' . $modx->getFullTableName('site_content') . ' AS sc
|
|
| 604 | - LEFT JOIN ' . $modx->getFullTableName('document_groups') . ' dg ON dg.document=sc.id
|
|
| 605 | - WHERE sc.id=' . $id . ' GROUP BY sc.id'; |
|
| 602 | + SELECT MAX(IF(1=' . $role.' OR sc.privatemgr=0'.$docgrp_cond.', 0, 1)) AS locked |
|
| 603 | + FROM ' . $modx->getFullTableName('site_content').' AS sc
|
|
| 604 | + LEFT JOIN ' . $modx->getFullTableName('document_groups').' dg ON dg.document=sc.id
|
|
| 605 | + WHERE sc.id=' . $id.' GROUP BY sc.id'; |
|
| 606 | 606 | $sql = $modx->db->query($sql); |
| 607 | 607 | if ($modx->db->getRecordCount($sql)) {
|
| 608 | 608 | $row = $modx->db->getRow($sql); |
@@ -619,7 +619,7 @@ discard block |
||
| 619 | 619 | case 'publish.res': {
|
| 620 | 620 | $published = getDocumentTv('published');
|
| 621 | 621 | $state = $published == 0 ? 1 : 0; |
| 622 | - if($state) {
|
|
| 622 | + if ($state) {
|
|
| 623 | 623 | require_once('../../../processors/publish_content.processor.php');
|
| 624 | 624 | } else {
|
| 625 | 625 | require_once('../../../processors/unpublish_content.processor.php');
|
@@ -630,7 +630,7 @@ discard block |
||
| 630 | 630 | case 'delete.res': {
|
| 631 | 631 | $deleted = getDocumentTv('deleted');
|
| 632 | 632 | $state = $deleted == 0 ? 1 : 0; |
| 633 | - if($state) {
|
|
| 633 | + if ($state) {
|
|
| 634 | 634 | require_once('../../../processors/delete_content.processor.php');
|
| 635 | 635 | } else {
|
| 636 | 636 | require_once('../../../processors/undelete_content.processor.php');
|
@@ -639,13 +639,13 @@ discard block |
||
| 639 | 639 | break; |
| 640 | 640 | } |
| 641 | 641 | } |
| 642 | - if(!empty($json)) $modx->jsonResponse($json); |
|
| 642 | + if (!empty($json)) $modx->jsonResponse($json); |
|
| 643 | 643 | } |
| 644 | 644 | |
| 645 | -function getDocumentTv($tv) {
|
|
| 645 | +function getDocumentTv($tv){
|
|
| 646 | 646 | global $modx, $_lang; |
| 647 | 647 | $modx->setAjaxMode(true); |
| 648 | - $id = isset($_REQUEST['id'])? intval($_REQUEST['id']) : 0; |
|
| 649 | - if($id==0) $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
| 650 | - return $modx->db->getValue($modx->db->select($tv, $modx->getFullTableName('site_content'), 'id=' . $id));
|
|
| 648 | + $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
|
| 649 | + if ($id == 0) $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
| 650 | + return $modx->db->getValue($modx->db->select($tv, $modx->getFullTableName('site_content'), 'id='.$id));
|
|
| 651 | 651 | } |
| 652 | 652 | \ No newline at end of file |
@@ -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 | |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | $_lang = array(); |
| 23 | 23 | include_once MODX_MANAGER_PATH . '/includes/lang/english.inc.php'; |
| 24 | -if ($modx->config['manager_language'] != 'english') {
|
|
| 24 | +if ($modx->config['manager_language'] != 'english') { |
|
| 25 | 25 | include_once MODX_MANAGER_PATH . '/includes/lang/' . $modx->config['manager_language'] . '.inc.php'; |
| 26 | 26 | } |
| 27 | 27 | include_once MODX_MANAGER_PATH . '/media/style/' . $modx->config['manager_theme'] . '/style.php'; |
@@ -36,12 +36,12 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | $json = array(); |
| 38 | 38 | |
| 39 | -if (isset($action)) {
|
|
| 40 | - switch ($action) {
|
|
| 39 | +if (isset($action)) { |
|
| 40 | + switch ($action) { |
|
| 41 | 41 | |
| 42 | 42 | case '1': {
|
| 43 | 43 | |
| 44 | - switch ($frame) {
|
|
| 44 | + switch ($frame) { |
|
| 45 | 45 | case 'nodes': |
| 46 | 46 | include_once MODX_MANAGER_PATH . '/frames/nodes.php'; |
| 47 | 47 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | $elements = isset($_REQUEST['elements']) && is_scalar($_REQUEST['elements']) ? htmlentities($_REQUEST['elements']) : ''; |
| 57 | 57 | |
| 58 | - if ($elements) {
|
|
| 58 | + if ($elements) { |
|
| 59 | 59 | $output = ''; |
| 60 | 60 | $items = ''; |
| 61 | 61 | $sql = ''; |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $sqlLike = $filter ? 'WHERE t1.name LIKE "' . $modx->db->escape($filter) . '%"' : ''; |
| 65 | 65 | $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit; |
| 66 | 66 | |
| 67 | - switch ($elements) {
|
|
| 67 | + switch ($elements) { |
|
| 68 | 68 | case 'element_templates': |
| 69 | 69 | $a = 16; |
| 70 | 70 | $sqlLike = $filter ? 'WHERE t1.templatename LIKE "' . $modx->db->escape($filter) . '%"' : ''; |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | ORDER BY t1.templatename ASC |
| 75 | 75 | ' . $sqlLimit); |
| 76 | 76 | |
| 77 | - if ($modx->hasPermission('new_template')) {
|
|
| 77 | + if ($modx->hasPermission('new_template')) { |
|
| 78 | 78 | $output .= '<li><a id="a_19" href="index.php?a=19" target="main"><i class="fa fa-plus"></i>' . $_lang['new_template'] . '</a></li>'; |
| 79 | 79 | } |
| 80 | 80 | |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | ORDER BY t1.name ASC |
| 91 | 91 | ' . $sqlLimit); |
| 92 | 92 | |
| 93 | - if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) {
|
|
| 93 | + if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) { |
|
| 94 | 94 | $output .= '<li><a id="a_300" href="index.php?a=300" target="main"><i class="fa fa-plus"></i>' . $_lang['new_tmplvars'] . '</a></li>'; |
| 95 | 95 | } |
| 96 | 96 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | ORDER BY t1.name ASC |
| 105 | 105 | ' . $sqlLimit); |
| 106 | 106 | |
| 107 | - if ($modx->hasPermission('new_chunk')) {
|
|
| 107 | + if ($modx->hasPermission('new_chunk')) { |
|
| 108 | 108 | $output .= '<li><a id="a_77" href="index.php?a=77" target="main"><i class="fa fa-plus"></i>' . $_lang['new_htmlsnippet'] . '</a></li>'; |
| 109 | 109 | } |
| 110 | 110 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | ORDER BY t1.name ASC |
| 119 | 119 | ' . $sqlLimit); |
| 120 | 120 | |
| 121 | - if ($modx->hasPermission('new_snippet')) {
|
|
| 121 | + if ($modx->hasPermission('new_snippet')) { |
|
| 122 | 122 | $output .= '<li><a id="a_23" href="index.php?a=23" target="main"><i class="fa fa-plus"></i>' . $_lang['new_snippet'] . '</a></li>'; |
| 123 | 123 | } |
| 124 | 124 | |
@@ -132,19 +132,19 @@ discard block |
||
| 132 | 132 | ORDER BY t1.name ASC |
| 133 | 133 | ' . $sqlLimit); |
| 134 | 134 | |
| 135 | - if ($modx->hasPermission('new_plugin')) {
|
|
| 135 | + if ($modx->hasPermission('new_plugin')) { |
|
| 136 | 136 | $output .= '<li><a id="a_101" href="index.php?a=101" target="main"><i class="fa fa-plus"></i>' . $_lang['new_plugin'] . '</a></li>'; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | break; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - if ($count = $modx->db->getRecordCount($sql)) {
|
|
| 143 | - if ($count == $limit) {
|
|
| 142 | + if ($count = $modx->db->getRecordCount($sql)) { |
|
| 143 | + if ($count == $limit) { |
|
| 144 | 144 | $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>'; |
| 145 | 145 | } |
| 146 | - while ($row = $modx->db->getRow($sql)) {
|
|
| 147 | - if (($row['disabled'] || $row['locked']) && $role != 1) {
|
|
| 146 | + while ($row = $modx->db->getRow($sql)) { |
|
| 147 | + if (($row['disabled'] || $row['locked']) && $role != 1) { |
|
| 148 | 148 | continue; |
| 149 | 149 | } |
| 150 | 150 | |
@@ -152,9 +152,9 @@ discard block |
||
| 152 | 152 | } |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - if (isset($_REQUEST['filter'])) {
|
|
| 155 | + if (isset($_REQUEST['filter'])) { |
|
| 156 | 156 | $output = $items; |
| 157 | - } else {
|
|
| 157 | + } else { |
|
| 158 | 158 | $output .= $items; |
| 159 | 159 | } |
| 160 | 160 | |
@@ -179,22 +179,22 @@ discard block |
||
| 179 | 179 | ORDER BY t1.username ASC |
| 180 | 180 | ' . $sqlLimit); |
| 181 | 181 | |
| 182 | - if ($modx->hasPermission('new_user')) {
|
|
| 182 | + if ($modx->hasPermission('new_user')) { |
|
| 183 | 183 | $output .= '<li><a id="a_11" href="index.php?a=11" target="main"><i class="fa fa-plus"></i>' . $_lang['new_user'] . '</a></li>'; |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - if ($count = $modx->db->getRecordCount($sql)) {
|
|
| 187 | - if ($count == $limit) {
|
|
| 186 | + if ($count = $modx->db->getRecordCount($sql)) { |
|
| 187 | + if ($count == $limit) { |
|
| 188 | 188 | $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>'; |
| 189 | 189 | } |
| 190 | - while ($row = $modx->db->getRow($sql)) {
|
|
| 190 | + while ($row = $modx->db->getRow($sql)) { |
|
| 191 | 191 | $items .= '<li class="item ' . ($row['blocked'] ? 'disabled' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>';
|
| 192 | 192 | } |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - if (isset($_REQUEST['filter'])) {
|
|
| 195 | + if (isset($_REQUEST['filter'])) { |
|
| 196 | 196 | $output = $items; |
| 197 | - } else {
|
|
| 197 | + } else { |
|
| 198 | 198 | $output .= $items; |
| 199 | 199 | } |
| 200 | 200 | |
@@ -218,22 +218,22 @@ discard block |
||
| 218 | 218 | ORDER BY t1.username ASC |
| 219 | 219 | ' . $sqlLimit); |
| 220 | 220 | |
| 221 | - if ($modx->hasPermission('new_web_user')) {
|
|
| 221 | + if ($modx->hasPermission('new_web_user')) { |
|
| 222 | 222 | $output .= '<li><a id="a_87" href="index.php?a=87" target="main"><i class="fa fa-plus"></i>' . $_lang['new_web_user'] . '</a></li>'; |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | - if ($count = $modx->db->getRecordCount($sql)) {
|
|
| 226 | - if ($count == $limit) {
|
|
| 225 | + if ($count = $modx->db->getRecordCount($sql)) { |
|
| 226 | + if ($count == $limit) { |
|
| 227 | 227 | $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>'; |
| 228 | 228 | } |
| 229 | - while ($row = $modx->db->getRow($sql)) {
|
|
| 229 | + while ($row = $modx->db->getRow($sql)) { |
|
| 230 | 230 | $items .= '<li class="item ' . ($row['blocked'] ? 'disabled' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>';
|
| 231 | 231 | } |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | - if (isset($_REQUEST['filter'])) {
|
|
| 234 | + if (isset($_REQUEST['filter'])) { |
|
| 235 | 235 | $output = $items; |
| 236 | - } else {
|
|
| 236 | + } else { |
|
| 237 | 237 | $output .= $items; |
| 238 | 238 | } |
| 239 | 239 | |
@@ -247,8 +247,8 @@ discard block |
||
| 247 | 247 | $type = isset($_REQUEST['type']) && is_scalar($_REQUEST['type']) ? $modx->db->escape($_REQUEST['type']) : false; |
| 248 | 248 | $contextmenu = ''; |
| 249 | 249 | |
| 250 | - if ($role && $name && $type) {
|
|
| 251 | - switch ($type) {
|
|
| 250 | + if ($role && $name && $type) { |
|
| 251 | + switch ($type) { |
|
| 252 | 252 | case 'Snippet': |
| 253 | 253 | case 'SnippetNoCache': {
|
| 254 | 254 | |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | WHERE name="' . $name . '" |
| 258 | 258 | LIMIT 1'); |
| 259 | 259 | |
| 260 | - if ($modx->db->getRecordCount($sql)) {
|
|
| 260 | + if ($modx->db->getRecordCount($sql)) { |
|
| 261 | 261 | $row = $modx->db->getRow($sql); |
| 262 | 262 | $contextmenu = array( |
| 263 | 263 | 'header' => array( |
@@ -268,13 +268,13 @@ discard block |
||
| 268 | 268 | 'url' => "index.php?a=22&id=" . $row['id'] |
| 269 | 269 | ) |
| 270 | 270 | ); |
| 271 | - if (!empty($row['description'])) {
|
|
| 271 | + if (!empty($row['description'])) { |
|
| 272 | 272 | $contextmenu['seperator'] = ''; |
| 273 | 273 | $contextmenu['description'] = array( |
| 274 | 274 | 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
| 275 | 275 | ); |
| 276 | 276 | } |
| 277 | - } else {
|
|
| 277 | + } else { |
|
| 278 | 278 | $contextmenu = array( |
| 279 | 279 | 'header' => array( |
| 280 | 280 | 'innerHTML' => '<i class="fa fa-code"></i> ' . $name |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | WHERE name="' . $name . '" |
| 296 | 296 | LIMIT 1'); |
| 297 | 297 | |
| 298 | - if ($modx->db->getRecordCount($sql)) {
|
|
| 298 | + if ($modx->db->getRecordCount($sql)) { |
|
| 299 | 299 | $row = $modx->db->getRow($sql); |
| 300 | 300 | $contextmenu = array( |
| 301 | 301 | 'header' => array( |
@@ -306,13 +306,13 @@ discard block |
||
| 306 | 306 | 'url' => "index.php?a=78&id=" . $row['id'] |
| 307 | 307 | ) |
| 308 | 308 | ); |
| 309 | - if (!empty($row['description'])) {
|
|
| 309 | + if (!empty($row['description'])) { |
|
| 310 | 310 | $contextmenu['seperator'] = ''; |
| 311 | 311 | $contextmenu['description'] = array( |
| 312 | 312 | 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
| 313 | 313 | ); |
| 314 | 314 | } |
| 315 | - } else {
|
|
| 315 | + } else { |
|
| 316 | 316 | $contextmenu = array( |
| 317 | 317 | 'header' => array( |
| 318 | 318 | 'innerHTML' => '<i class="fa fa-th-large"></i> ' . $name |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | WHERE name="' . $name . '" |
| 333 | 333 | LIMIT 1'); |
| 334 | 334 | |
| 335 | - if ($modx->db->getRecordCount($sql)) {
|
|
| 335 | + if ($modx->db->getRecordCount($sql)) { |
|
| 336 | 336 | $row = $modx->db->getRow($sql); |
| 337 | 337 | $contextmenu = array( |
| 338 | 338 | 'header' => array( |
@@ -343,20 +343,20 @@ discard block |
||
| 343 | 343 | 'url' => "index.php?a=78&id=" . $row['id'] |
| 344 | 344 | ) |
| 345 | 345 | ); |
| 346 | - if (!empty($row['description'])) {
|
|
| 346 | + if (!empty($row['description'])) { |
|
| 347 | 347 | $contextmenu['seperator'] = ''; |
| 348 | 348 | $contextmenu['description'] = array( |
| 349 | 349 | 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
| 350 | 350 | ); |
| 351 | 351 | } |
| 352 | - } else {
|
|
| 352 | + } else { |
|
| 353 | 353 | |
| 354 | 354 | $sql = $modx->db->query('SELECT *
|
| 355 | 355 | FROM ' . $modx->getFullTableName('site_snippets') . '
|
| 356 | 356 | WHERE name="' . $name . '" |
| 357 | 357 | LIMIT 1'); |
| 358 | 358 | |
| 359 | - if ($modx->db->getRecordCount($sql)) {
|
|
| 359 | + if ($modx->db->getRecordCount($sql)) { |
|
| 360 | 360 | $row = $modx->db->getRow($sql); |
| 361 | 361 | $contextmenu = array( |
| 362 | 362 | 'header' => array( |
@@ -367,13 +367,13 @@ discard block |
||
| 367 | 367 | 'url' => "index.php?a=22&id=" . $row['id'] |
| 368 | 368 | ) |
| 369 | 369 | ); |
| 370 | - if (!empty($row['description'])) {
|
|
| 370 | + if (!empty($row['description'])) { |
|
| 371 | 371 | $contextmenu['seperator'] = ''; |
| 372 | 372 | $contextmenu['description'] = array( |
| 373 | 373 | 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
| 374 | 374 | ); |
| 375 | 375 | } |
| 376 | - } else {
|
|
| 376 | + } else { |
|
| 377 | 377 | $contextmenu = array( |
| 378 | 378 | 'header' => array( |
| 379 | 379 | 'innerHTML' => '<i class="fa fa-code"></i> ' . $name |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | 'alias_visible' |
| 436 | 436 | ); |
| 437 | 437 | |
| 438 | - if (in_array($name, $default_field)) {
|
|
| 438 | + if (in_array($name, $default_field)) { |
|
| 439 | 439 | return; |
| 440 | 440 | } |
| 441 | 441 | |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | WHERE name="' . $name . '" |
| 445 | 445 | LIMIT 1'); |
| 446 | 446 | |
| 447 | - if ($modx->db->getRecordCount($sql)) {
|
|
| 447 | + if ($modx->db->getRecordCount($sql)) { |
|
| 448 | 448 | $row = $modx->db->getRow($sql); |
| 449 | 449 | $contextmenu = array( |
| 450 | 450 | 'header' => array( |
@@ -455,13 +455,13 @@ discard block |
||
| 455 | 455 | 'url' => "index.php?a=301&id=" . $row['id'] |
| 456 | 456 | ) |
| 457 | 457 | ); |
| 458 | - if (!empty($row['description'])) {
|
|
| 458 | + if (!empty($row['description'])) { |
|
| 459 | 459 | $contextmenu['seperator'] = ''; |
| 460 | 460 | $contextmenu['description'] = array( |
| 461 | 461 | 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
| 462 | 462 | ); |
| 463 | 463 | } |
| 464 | - } else {
|
|
| 464 | + } else { |
|
| 465 | 465 | $contextmenu = array( |
| 466 | 466 | 'header' => array( |
| 467 | 467 | 'innerHTML' => '<i class="fa fa-list-alt"></i> ' . $name |
@@ -484,13 +484,13 @@ discard block |
||
| 484 | 484 | } |
| 485 | 485 | |
| 486 | 486 | case 'movedocument' : {
|
| 487 | - if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) {
|
|
| 487 | + if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) { |
|
| 488 | 488 | $id = !empty($_REQUEST['id']) ? (int)$_REQUEST['id'] : ''; |
| 489 | 489 | $parent = isset($_REQUEST['parent']) ? (int)$_REQUEST['parent'] : 0; |
| 490 | 490 | $menuindex = isset($_REQUEST['menuindex']) && is_scalar($_REQUEST['menuindex']) ? $_REQUEST['menuindex'] : 0; |
| 491 | 491 | |
| 492 | 492 | // set parent |
| 493 | - if ($id && $parent >= 0) {
|
|
| 493 | + if ($id && $parent >= 0) { |
|
| 494 | 494 | |
| 495 | 495 | // find older parent |
| 496 | 496 | $parentOld = $modx->db->getValue($modx->db->select('parent', $modx->getFullTableName('site_content'), 'id=' . $id));
|
@@ -501,31 +501,31 @@ discard block |
||
| 501 | 501 | 'new_parent' => $parent, |
| 502 | 502 | ]); |
| 503 | 503 | |
| 504 | - if (is_array($eventOut) && count($eventOut) > 0) {
|
|
| 504 | + if (is_array($eventOut) && count($eventOut) > 0) { |
|
| 505 | 505 | $eventParent = array_pop($eventOut); |
| 506 | 506 | |
| 507 | - if ($eventParent == $parentOld) {
|
|
| 507 | + if ($eventParent == $parentOld) { |
|
| 508 | 508 | $json['errors'] = $_lang['error_movedocument2']; |
| 509 | - } else {
|
|
| 509 | + } else { |
|
| 510 | 510 | $parent = $eventParent; |
| 511 | 511 | } |
| 512 | 512 | } |
| 513 | 513 | |
| 514 | - if (empty($json['errors'])) {
|
|
| 514 | + if (empty($json['errors'])) { |
|
| 515 | 515 | // check privileges user for move docs |
| 516 | - if (!empty($modx->config['tree_show_protected']) && $role != 1) {
|
|
| 516 | + if (!empty($modx->config['tree_show_protected']) && $role != 1) { |
|
| 517 | 517 | $sql = $modx->db->select('*', $modx->getFullTableName('document_groups'), 'document IN(' . $id . ',' . $parent . ',' . $parentOld . ')');
|
| 518 | - if ($modx->db->getRecordCount($sql)) {
|
|
| 518 | + if ($modx->db->getRecordCount($sql)) { |
|
| 519 | 519 | $document_groups = array(); |
| 520 | - while ($row = $modx->db->getRow($sql)) {
|
|
| 520 | + while ($row = $modx->db->getRow($sql)) { |
|
| 521 | 521 | $document_groups[$row['document']]['groups'][] = $row['document_group']; |
| 522 | 522 | } |
| 523 | - foreach ($document_groups as $key => $value) {
|
|
| 524 | - if (($key == $parent || $key == $parentOld || $key == $id) && !in_array($role, $value['groups'])) {
|
|
| 523 | + foreach ($document_groups as $key => $value) { |
|
| 524 | + if (($key == $parent || $key == $parentOld || $key == $id) && !in_array($role, $value['groups'])) { |
|
| 525 | 525 | $json['errors'] = $_lang["error_no_privileges"]; |
| 526 | 526 | } |
| 527 | 527 | } |
| 528 | - if ($json['errors']) {
|
|
| 528 | + if ($json['errors']) { |
|
| 529 | 529 | header('content-type: application/json');
|
| 530 | 530 | echo json_encode($json, JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE); |
| 531 | 531 | break; |
@@ -533,9 +533,9 @@ discard block |
||
| 533 | 533 | } |
| 534 | 534 | } |
| 535 | 535 | |
| 536 | - if ($parent == 0 && $parent != $parentOld && !$modx->config['udperms_allowroot'] && $role != 1) {
|
|
| 536 | + if ($parent == 0 && $parent != $parentOld && !$modx->config['udperms_allowroot'] && $role != 1) { |
|
| 537 | 537 | $json['errors'] = $_lang["error_no_privileges"]; |
| 538 | - } else {
|
|
| 538 | + } else { |
|
| 539 | 539 | // set new parent |
| 540 | 540 | $modx->db->update(array( |
| 541 | 541 | 'parent' => $parent |
@@ -545,13 +545,13 @@ discard block |
||
| 545 | 545 | 'isfolder' => 1 |
| 546 | 546 | ), $modx->getFullTableName('site_content'), 'id=' . $parent);
|
| 547 | 547 | |
| 548 | - if ($parent != $parentOld) {
|
|
| 548 | + if ($parent != $parentOld) { |
|
| 549 | 549 | // check children docs and set parent isfolder |
| 550 | - if ($modx->db->getRecordCount($modx->db->select('id', $modx->getFullTableName('site_content'), 'parent=' . $parentOld))) {
|
|
| 550 | + if ($modx->db->getRecordCount($modx->db->select('id', $modx->getFullTableName('site_content'), 'parent=' . $parentOld))) { |
|
| 551 | 551 | $modx->db->update(array( |
| 552 | 552 | 'isfolder' => 1 |
| 553 | 553 | ), $modx->getFullTableName('site_content'), 'id=' . $parentOld);
|
| 554 | - } else {
|
|
| 554 | + } else { |
|
| 555 | 555 | $modx->db->update(array( |
| 556 | 556 | 'isfolder' => 0 |
| 557 | 557 | ), $modx->getFullTableName('site_content'), 'id=' . $parentOld);
|
@@ -559,16 +559,16 @@ discard block |
||
| 559 | 559 | } |
| 560 | 560 | |
| 561 | 561 | // set menuindex |
| 562 | - if (!empty($menuindex)) {
|
|
| 562 | + if (!empty($menuindex)) { |
|
| 563 | 563 | $menuindex = explode(',', $menuindex);
|
| 564 | - foreach ($menuindex as $key => $value) {
|
|
| 564 | + foreach ($menuindex as $key => $value) { |
|
| 565 | 565 | $modx->db->query('UPDATE ' . $modx->getFullTableName('site_content') . ' SET menuindex=' . $key . ' WHERE id=' . $value);
|
| 566 | 566 | } |
| 567 | - } else {
|
|
| 567 | + } else { |
|
| 568 | 568 | // TODO: max(*) menuindex |
| 569 | 569 | } |
| 570 | 570 | |
| 571 | - if (!$json['errors']) {
|
|
| 571 | + if (!$json['errors']) { |
|
| 572 | 572 | $json['success'] = $_lang["actioncomplete"]; |
| 573 | 573 | |
| 574 | 574 | $modx->invokeEvent('onAfterMoveDocument', [
|
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | } |
| 581 | 581 | } |
| 582 | 582 | } |
| 583 | - } else {
|
|
| 583 | + } else { |
|
| 584 | 584 | $json['errors'] = $_lang["error_no_privileges"]; |
| 585 | 585 | } |
| 586 | 586 | |
@@ -595,7 +595,7 @@ discard block |
||
| 595 | 595 | |
| 596 | 596 | $output = !!$modx->elementIsLocked($type, $id, true); |
| 597 | 597 | |
| 598 | - if (!$output) {
|
|
| 598 | + if (!$output) { |
|
| 599 | 599 | $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : '';
|
| 600 | 600 | $docgrp_cond = $docgrp ? ' OR dg.document_group IN (' . $docgrp . ')' : '';
|
| 601 | 601 | $sql = ' |
@@ -604,7 +604,7 @@ discard block |
||
| 604 | 604 | LEFT JOIN ' . $modx->getFullTableName('document_groups') . ' dg ON dg.document=sc.id
|
| 605 | 605 | WHERE sc.id=' . $id . ' GROUP BY sc.id'; |
| 606 | 606 | $sql = $modx->db->query($sql); |
| 607 | - if ($modx->db->getRecordCount($sql)) {
|
|
| 607 | + if ($modx->db->getRecordCount($sql)) { |
|
| 608 | 608 | $row = $modx->db->getRow($sql); |
| 609 | 609 | $output = !!$row['locked']; |
| 610 | 610 | } |
@@ -619,9 +619,9 @@ discard block |
||
| 619 | 619 | case 'publish.res': {
|
| 620 | 620 | $published = getDocumentTv('published');
|
| 621 | 621 | $state = $published == 0 ? 1 : 0; |
| 622 | - if($state) {
|
|
| 622 | + if($state) { |
|
| 623 | 623 | require_once('../../../processors/publish_content.processor.php');
|
| 624 | - } else {
|
|
| 624 | + } else { |
|
| 625 | 625 | require_once('../../../processors/unpublish_content.processor.php');
|
| 626 | 626 | } |
| 627 | 627 | $json['result'] = $state == 1 ? 'publish' : 'unpublish'; |
@@ -630,22 +630,27 @@ discard block |
||
| 630 | 630 | case 'delete.res': {
|
| 631 | 631 | $deleted = getDocumentTv('deleted');
|
| 632 | 632 | $state = $deleted == 0 ? 1 : 0; |
| 633 | - if($state) {
|
|
| 633 | + if($state) { |
|
| 634 | 634 | require_once('../../../processors/delete_content.processor.php');
|
| 635 | - } else {
|
|
| 635 | + } else { |
|
| 636 | 636 | require_once('../../../processors/undelete_content.processor.php');
|
| 637 | 637 | } |
| 638 | 638 | $json['result'] = $state == 1 ? 'delete' : 'undelete'; |
| 639 | 639 | break; |
| 640 | 640 | } |
| 641 | 641 | } |
| 642 | - if(!empty($json)) $modx->jsonResponse($json); |
|
| 643 | -} |
|
| 642 | + if(!empty($json)) { |
|
| 643 | + $modx->jsonResponse($json); |
|
| 644 | + } |
|
| 645 | + } |
|
| 644 | 646 | |
| 645 | -function getDocumentTv($tv) {
|
|
| 647 | +function getDocumentTv($tv) |
|
| 648 | +{ |
|
| 646 | 649 | global $modx, $_lang; |
| 647 | 650 | $modx->setAjaxMode(true); |
| 648 | 651 | $id = isset($_REQUEST['id'])? intval($_REQUEST['id']) : 0; |
| 649 | - if($id==0) $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
| 652 | + if($id==0) { |
|
| 653 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
| 654 | + } |
|
| 650 | 655 | return $modx->db->getValue($modx->db->select($tv, $modx->getFullTableName('site_content'), 'id=' . $id));
|
| 651 | 656 | } |
| 652 | 657 | \ No newline at end of file |