| @@ -5,7 +5,8 @@ | ||
| 5 | 5 | * @deprecated EvolutionCMS\Legacy\ErrorHandler | 
| 6 | 6 | * @todo could be unnecessary | 
| 7 | 7 | */ | 
| 8 | -class errorHandler extends EvolutionCMS\Legacy\ErrorHandler { | |
| 8 | +class errorHandler extends EvolutionCMS\Legacy\ErrorHandler | |
| 9 | +{ | |
| 9 | 10 | public function include_lang($context = 'common') | 
| 10 | 11 |      { | 
| 11 | 12 | parent::includeLang($context); | 
| @@ -3,4 +3,6 @@ | ||
| 3 | 3 | /** | 
| 4 | 4 | * @deprecated use EvolutionCMS\Legacy\LogHandler | 
| 5 | 5 | */ | 
| 6 | -class logHandler extends EvolutionCMS\Legacy\LogHandler{} | |
| 6 | +class logHandler extends EvolutionCMS\Legacy\LogHandler | |
| 7 | +{ | |
| 8 | +} | |
| @@ -1,6 +1,7 @@ discard block | ||
| 1 | 1 | <?php namespace EvolutionCMS\Legacy; | 
| 2 | 2 | |
| 3 | -class mgrResources { | |
| 3 | +class mgrResources | |
| 4 | +{ | |
| 4 | 5 | /** | 
| 5 | 6 | * @var array | 
| 6 | 7 | */ | 
| @@ -21,7 +22,8 @@ discard block | ||
| 21 | 22 | /** | 
| 22 | 23 | * mgrResources constructor. | 
| 23 | 24 | */ | 
| 24 | -    public function __construct() { | |
| 25 | + public function __construct() | |
| 26 | +    { | |
| 25 | 27 | $this->setTypes(); | 
| 26 | 28 | $this->queryItemsFromDB(); | 
| 27 | 29 | $this->prepareCategoryArrays(); | 
| @@ -30,7 +32,8 @@ discard block | ||
| 30 | 32 | /** | 
| 31 | 33 | * @return void | 
| 32 | 34 | */ | 
| 33 | -    public function setTypes() { | |
| 35 | + public function setTypes() | |
| 36 | +    { | |
| 34 | 37 | global $_lang; | 
| 35 | 38 | $this->types['site_templates'] = array( | 
| 36 | 39 | 'title'=>$_lang["manage_templates"], | 
| @@ -68,7 +71,8 @@ discard block | ||
| 68 | 71 | /** | 
| 69 | 72 | * @return void | 
| 70 | 73 | */ | 
| 71 | -    public function queryItemsFromDB() { | |
| 74 | + public function queryItemsFromDB() | |
| 75 | +    { | |
| 72 | 76 |          foreach($this->types as $resourceTable=>$type) { | 
| 73 | 77 |              if($this->hasAnyPermissions($type['permissions'])) { | 
| 74 | 78 | $nameField = isset($type['name']) ? $type['name'] : 'name'; | 
| @@ -81,11 +85,13 @@ discard block | ||
| 81 | 85 | * @param array $permissions | 
| 82 | 86 | * @return bool | 
| 83 | 87 | */ | 
| 84 | -    public function hasAnyPermissions($permissions) { | |
| 88 | + public function hasAnyPermissions($permissions) | |
| 89 | +    { | |
| 85 | 90 | $modx = evolutionCMS(); | 
| 86 | 91 | |
| 87 | - foreach($permissions as $p) | |
| 88 | - if($modx->hasPermission($p)) return true; | |
| 92 | +        foreach($permissions as $p) { | |
| 93 | + if($modx->hasPermission($p)) return true; | |
| 94 | + } | |
| 89 | 95 | |
| 90 | 96 | return false; | 
| 91 | 97 | } | 
| @@ -95,7 +101,8 @@ discard block | ||
| 95 | 101 | * @param string $nameField | 
| 96 | 102 | * @return array|bool | 
| 97 | 103 | */ | 
| 98 | -    public function queryResources($resourceTable, $nameField = 'name') { | |
| 104 | + public function queryResources($resourceTable, $nameField = 'name') | |
| 105 | +    { | |
| 99 | 106 | $modx = evolutionCMS(); global $_lang; | 
| 100 | 107 | |
| 101 | 108 | $allowed = array( | 
| @@ -112,8 +119,9 @@ discard block | ||
| 112 | 119 | $tvsql = 'site_tmplvars.caption, '; | 
| 113 | 120 |              $tvjoin   = sprintf('LEFT JOIN %s AS stt ON site_tmplvars.id=stt.tmplvarid GROUP BY site_tmplvars.id,reltpl', $modx->getFullTableName('site_tmplvar_templates')); | 
| 114 | 121 | $sttfield = 'IF(stt.templateid,1,0) AS reltpl,'; | 
| 122 | +        } else { | |
| 123 | + $sttfield = ''; | |
| 115 | 124 | } | 
| 116 | - else $sttfield = ''; | |
| 117 | 125 | |
| 118 | 126 |          $selectableTemplates = $resourceTable === 'site_templates' ? "{$resourceTable}.selectable, " : ""; | 
| 119 | 127 | |
| @@ -126,7 +134,9 @@ discard block | ||
| 126 | 134 | ); | 
| 127 | 135 | $limit = $modx->db->getRecordCount($rs); | 
| 128 | 136 | |
| 129 | - if($limit < 1) return false; | |
| 137 | +        if($limit < 1) { | |
| 138 | + return false; | |
| 139 | + } | |
| 130 | 140 | |
| 131 | 141 | $result = array(); | 
| 132 | 142 |          while ($row = $modx->db->getRow($rs)) { | 
| @@ -138,7 +148,8 @@ discard block | ||
| 138 | 148 | /** | 
| 139 | 149 | * @return void | 
| 140 | 150 | */ | 
| 141 | -    public function prepareCategoryArrays() { | |
| 151 | + public function prepareCategoryArrays() | |
| 152 | +    { | |
| 142 | 153 |          foreach($this->items as $type=>$items) { | 
| 143 | 154 |              foreach((array)$items as $item) { | 
| 144 | 155 | $catid = $item['catid'] ? $item['catid'] : 0; | 
| @@ -154,7 +165,7 @@ discard block | ||
| 154 | 165 | |
| 155 | 166 | // Now sort by name | 
| 156 | 167 |          foreach($this->itemsPerCategory as $catid=>$items) { | 
| 157 | -            usort($this->itemsPerCategory[$catid], function ($a, $b) { | |
| 168 | +            usort($this->itemsPerCategory[$catid], function ($a, $b){ | |
| 158 | 169 | return strcasecmp($a['name'], $b['name']); | 
| 159 | 170 | }); | 
| 160 | 171 | } | 
| @@ -8,7 +8,8 @@ discard block | ||
| 8 | 8 | * @param array $data | 
| 9 | 9 | * @return string | 
| 10 | 10 | */ | 
| 11 | -    public function output($config = array(), $data = array()) { | |
| 11 | + public function output($config = array(), $data = array()) | |
| 12 | +    { | |
| 12 | 13 | $modx = evolutionCMS(); | 
| 13 | 14 | |
| 14 | 15 | $output = ''; | 
| @@ -64,7 +65,8 @@ discard block | ||
| 64 | 65 | * @param array $data | 
| 65 | 66 | * @return string | 
| 66 | 67 | */ | 
| 67 | -    private function render($data) { | |
| 68 | + private function render($data) | |
| 69 | +    { | |
| 68 | 70 | $modx = evolutionCMS(); global $_lang, $_country_lang; | 
| 69 | 71 | |
| 70 | 72 | $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']); | 
| @@ -43,7 +43,8 @@ discard block | ||
| 43 | 43 | public $im_height = 0; | 
| 44 | 44 | public $im; | 
| 45 | 45 | |
| 46 | -    public function __construct($w=200, $h=80) { | |
| 46 | + public function __construct($w=200, $h=80) | |
| 47 | +    { | |
| 47 | 48 | /* create session to set word for verification */ | 
| 48 | 49 | $this->setVeriword(); | 
| 49 | 50 | $this->dir_font = MODX_BASE_PATH . 'assets/' . $this->dir_font; | 
| @@ -51,21 +52,24 @@ discard block | ||
| 51 | 52 | $this->im_height = $h; | 
| 52 | 53 | } | 
| 53 | 54 | |
| 54 | -    public function setVeriword() { | |
| 55 | + public function setVeriword() | |
| 56 | +    { | |
| 55 | 57 | /* create session variable for verification, | 
| 56 | 58 | you may change the session variable name */ | 
| 57 | 59 | $this->word = $this->makeText(); | 
| 58 | 60 | $_SESSION['veriword'] = $this->word; | 
| 59 | 61 | } | 
| 60 | 62 | |
| 61 | -    public function output() { | |
| 63 | + public function output() | |
| 64 | +    { | |
| 62 | 65 | /* output the image as jpeg */ | 
| 63 | 66 | $this->drawImage(); | 
| 64 | 67 |          header("Content-type: image/jpeg"); | 
| 65 | 68 | imagejpeg($this->im); | 
| 66 | 69 | } | 
| 67 | 70 | |
| 68 | -    public function makeText() { | |
| 71 | + public function makeText() | |
| 72 | +    { | |
| 69 | 73 | $modx = evolutionCMS(); | 
| 70 | 74 | // set default words | 
| 71 | 75 | $words="MODX,Access,Better,BitCode,Chunk,Cache,Desc,Design,Excell,Enjoy,URLs,TechView,Gerald,Griff,Humphrey,Holiday,Intel,Integration,Joystick,Join(),Oscope,Genetic,Light,Likeness,Marit,Maaike,Niche,Netherlands,Ordinance,Oscillo,Parser,Phusion,Query,Question,Regalia,Righteous,Snippet,Sentinel,Template,Thespian,Unity,Enterprise,Verily,Veri,Website,WideWeb,Yap,Yellow,Zebra,Zygote"; | 
| @@ -76,7 +80,8 @@ discard block | ||
| 76 | 80 | return (string) $arr_words[array_rand($arr_words)].rand(10,999); | 
| 77 | 81 | } | 
| 78 | 82 | |
| 79 | -    public function drawText() { | |
| 83 | + public function drawText() | |
| 84 | +    { | |
| 80 | 85 | $dir = dir($this->dir_font); | 
| 81 | 86 | $fontstmp = array(); | 
| 82 | 87 |          while (false !== ($file = $dir->read())) { | 
| @@ -131,7 +136,8 @@ discard block | ||
| 131 | 136 | } | 
| 132 | 137 | |
| 133 | 138 | |
| 134 | -    public function drawImage() { | |
| 139 | + public function drawImage() | |
| 140 | +    { | |
| 135 | 141 | |
| 136 | 142 | /* pick one background image randomly from image directory */ | 
| 137 | 143 | $img_file = MODX_BASE_PATH . 'assets/' . $this->dir_noise."noise".rand(1,4).".jpg"; | 
| @@ -162,7 +168,8 @@ discard block | ||
| 162 | 168 | return $this->im; | 
| 163 | 169 | } | 
| 164 | 170 | |
| 165 | -    public function destroy() { | |
| 171 | + public function destroy() | |
| 172 | +    { | |
| 166 | 173 | imagedestroy($this->im); | 
| 167 | 174 | } | 
| 168 | 175 | } | 
| @@ -8,8 +8,8 @@ | ||
| 8 | 8 | * @todo could be unnecessary | 
| 9 | 9 | * | 
| 10 | 10 | */ | 
| 11 | -Class TemplateParser extends EvolutionCMS\Legacy\TemplateParser | |
| 12 | -{
 | |
| 11 | +Class TemplateParser extends EvolutionCMS\Legacy\TemplateParser | |
| 12 | +{ | |
| 13 | 13 | } | 
| 14 | 14 | |
| 15 | 15 | ?> | 
| @@ -573,7 +573,8 @@ | ||
| 573 | 573 | * @return array|string | 
| 574 | 574 | */ | 
| 575 | 575 | function parseInput($src, $delim = "||", $type = "string", $columns = true) | 
| 576 | -    { // type can be: string, array | |
| 576 | +    { | |
| 577 | +// type can be: string, array | |
| 577 | 578 | $modx = evolutionCMS(); | 
| 578 | 579 |          if ($modx->db->isResult($src)) { | 
| 579 | 580 | // must be a recordset | 
| @@ -3,7 +3,7 @@ | ||
| 3 | 3 | * @see https://github.com/theseer/Autoload | 
| 4 | 4 | */ | 
| 5 | 5 | spl_autoload_register( | 
| 6 | -    function ($class) { | |
| 6 | +    function ($class){ | |
| 7 | 7 | static $classes = null; | 
| 8 | 8 |          if ($classes === null) { | 
| 9 | 9 | $classes = array( | 
| @@ -1,5 +1,5 @@ discard block | ||
| 1 | 1 | <?php | 
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
 | |
| 2 | +if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { | |
| 3 | 3 |      die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
 | 
| 4 | 4 | } | 
| 5 | 5 |  header("X-XSS-Protection: 0");
 | 
| @@ -11,22 +11,22 @@ discard block | ||
| 11 | 11 | |
| 12 | 12 | $mxla = $modx_lang_attribute ? $modx_lang_attribute : 'en'; | 
| 13 | 13 | |
| 14 | -if (!isset($modx->config['manager_menu_height'])) {
 | |
| 14 | +if (!isset($modx->config['manager_menu_height'])) { | |
| 15 | 15 | $modx->config['manager_menu_height'] = 2.2; // rem | 
| 16 | 16 | } | 
| 17 | 17 | |
| 18 | -if (!isset($modx->config['manager_tree_width'])) {
 | |
| 18 | +if (!isset($modx->config['manager_tree_width'])) { | |
| 19 | 19 | $modx->config['manager_tree_width'] = 20; // rem | 
| 20 | 20 | } | 
| 21 | 21 | |
| 22 | -if (isset($_SESSION['onLoginForwardToAction']) && is_int($_SESSION['onLoginForwardToAction'])) {
 | |
| 22 | +if (isset($_SESSION['onLoginForwardToAction']) && is_int($_SESSION['onLoginForwardToAction'])) { | |
| 23 | 23 | $initMainframeAction = $_SESSION['onLoginForwardToAction']; | 
| 24 | 24 | unset($_SESSION['onLoginForwardToAction']); | 
| 25 | -} else {
 | |
| 25 | +} else { | |
| 26 | 26 | $initMainframeAction = 2; // welcome.static | 
| 27 | 27 | } | 
| 28 | 28 | |
| 29 | -if (!isset($_SESSION['tree_show_only_folders'])) {
 | |
| 29 | +if (!isset($_SESSION['tree_show_only_folders'])) { | |
| 30 | 30 | $_SESSION['tree_show_only_folders'] = 0; | 
| 31 | 31 | } | 
| 32 | 32 | |
| @@ -35,29 +35,29 @@ discard block | ||
| 35 | 35 | $tree_width = $modx->config['manager_tree_width']; | 
| 36 | 36 | $tree_min_width = 0; | 
| 37 | 37 | |
| 38 | -if (isset($_COOKIE['MODX_widthSideBar'])) {
 | |
| 38 | +if (isset($_COOKIE['MODX_widthSideBar'])) { | |
| 39 | 39 | $MODX_widthSideBar = $_COOKIE['MODX_widthSideBar']; | 
| 40 | -} else {
 | |
| 40 | +} else { | |
| 41 | 41 | $MODX_widthSideBar = $tree_width; | 
| 42 | 42 | } | 
| 43 | 43 | |
| 44 | -if (!$MODX_widthSideBar) {
 | |
| 44 | +if (!$MODX_widthSideBar) { | |
| 45 | 45 | $body_class .= 'sidebar-closed'; | 
| 46 | 46 | } | 
| 47 | 47 | |
| 48 | 48 |  $theme_modes = array('', 'lightness', 'light', 'dark', 'darkness');
 | 
| 49 | -if (!empty($theme_modes[$_COOKIE['MODX_themeMode']])) {
 | |
| 49 | +if (!empty($theme_modes[$_COOKIE['MODX_themeMode']])) { | |
| 50 | 50 | $body_class .= ' ' . $theme_modes[$_COOKIE['MODX_themeMode']]; | 
| 51 | -} elseif (!empty($theme_modes[$modx->config['manager_theme_mode']])) {
 | |
| 51 | +} elseif (!empty($theme_modes[$modx->config['manager_theme_mode']])) { | |
| 52 | 52 | $body_class .= ' ' . $theme_modes[$modx->config['manager_theme_mode']]; | 
| 53 | 53 | } | 
| 54 | 54 | |
| 55 | 55 | $navbar_position = $modx->config['manager_menu_position']; | 
| 56 | -if ($navbar_position == 'left') {
 | |
| 56 | +if ($navbar_position == 'left') { | |
| 57 | 57 | $body_class .= ' navbar-left navbar-left-icon-and-text'; | 
| 58 | 58 | } | 
| 59 | 59 | |
| 60 | -if (isset($modx->pluginCache['ElementsInTree'])) {
 | |
| 60 | +if (isset($modx->pluginCache['ElementsInTree'])) { | |
| 61 | 61 | $body_class .= ' ElementsInTree'; | 
| 62 | 62 | } | 
| 63 | 63 | |
| @@ -73,19 +73,19 @@ discard block | ||
| 73 | 73 | 'type8' => $_lang["lock_element_type_8"] | 
| 74 | 74 | ); | 
| 75 | 75 | |
| 76 | -foreach ($unlockTranslations as $key => $value) {
 | |
| 76 | +foreach ($unlockTranslations as $key => $value) { | |
| 77 | 77 | $unlockTranslations[$key] = iconv($modx->config["modx_charset"], "utf-8", $value); | 
| 78 | 78 | } | 
| 79 | 79 | |
| 80 | 80 | $user = $modx->getUserInfo($modx->getLoginUserID()); | 
| 81 | -if ($user['which_browser'] == 'default') {
 | |
| 81 | +if ($user['which_browser'] == 'default') { | |
| 82 | 82 | $user['which_browser'] = $modx->config['which_browser']; | 
| 83 | 83 | } | 
| 84 | 84 | |
| 85 | 85 | $css = 'media/style/' . $modx->config['manager_theme'] . '/css/page.css?v=' . $lastInstallTime; | 
| 86 | 86 | |
| 87 | -if ($modx->config['manager_theme'] == 'default') {
 | |
| 88 | -    if (!file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css') && is_writable(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css')) {
 | |
| 87 | +if ($modx->config['manager_theme'] == 'default') { | |
| 88 | +    if (!file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css') && is_writable(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css')) { | |
| 89 | 89 | require_once MODX_BASE_PATH . 'assets/lib/Formatter/CSSMinify.php'; | 
| 90 | 90 | $minifier = new Formatter\CSSMinify(); | 
| 91 | 91 | $minifier->addFile(MODX_MANAGER_PATH . 'media/style/common/bootstrap/css/bootstrap.min.css'); | 
| @@ -102,7 +102,7 @@ discard block | ||
| 102 | 102 | $css = $minifier->minify(); | 
| 103 | 103 | file_put_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css', $css); | 
| 104 | 104 | } | 
| 105 | -    if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) {
 | |
| 105 | +    if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) { | |
| 106 | 106 | $css = 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css?v=' . $lastInstallTime; | 
| 107 | 107 | } | 
| 108 | 108 | } | 
| @@ -257,7 +257,7 @@ discard block | ||
| 257 | 257 | <?php | 
| 258 | 258 | // invoke OnManagerTopPrerender event | 
| 259 | 259 |      $evtOut = $modx->invokeEvent('OnManagerTopPrerender', $_REQUEST);
 | 
| 260 | -    if (is_array($evtOut)) {
 | |
| 260 | +    if (is_array($evtOut)) { | |
| 261 | 261 |          echo implode("\n", $evtOut);
 | 
| 262 | 262 | } | 
| 263 | 263 | ?> | 
| @@ -428,11 +428,14 @@ discard block | ||
| 428 | 428 | <div id="evo-tab-page-home" class="evo-tab-page show iframe-scroller"> | 
| 429 | 429 | <iframe id="mainframe" src="index.php?a=<?= $initMainframeAction ?>" scrolling="auto" frameborder="0" onload="modx.main.onload(event);"></iframe> | 
| 430 | 430 | </div> | 
| 431 | - <?php else: ?> | |
| 431 | +        <?php else { | |
| 432 | + : ?> | |
| 432 | 433 | <div class="iframe-scroller"> | 
| 433 | 434 | <iframe id="mainframe" name="main" src="index.php?a=<?= $initMainframeAction ?>" scrolling="auto" frameborder="0" onload="modx.main.onload(event);"></iframe> | 
| 434 | 435 | </div> | 
| 435 | - <?php endif; ?> | |
| 436 | + <?php endif; | |
| 437 | +} | |
| 438 | +?> | |
| 436 | 439 | <script> | 
| 437 | 440 |              if (/iPhone|iPad|iPod/i.test(navigator.userAgent)) {
 | 
| 438 | 441 |                  document.getElementById('mainframe').setAttribute('scrolling', 'no');
 | 
| @@ -451,11 +454,11 @@ discard block | ||
| 451 | 454 | 'tree_sortdir', | 
| 452 | 455 | 'tree_nodename' | 
| 453 | 456 | ); | 
| 454 | -        foreach ($sortParams as $param) {
 | |
| 455 | -            if (isset($_REQUEST[$param])) {
 | |
| 457 | +        foreach ($sortParams as $param) { | |
| 458 | +            if (isset($_REQUEST[$param])) { | |
| 456 | 459 | $modx->manager->saveLastUserSetting($param, $_REQUEST[$param]); | 
| 457 | 460 | $_SESSION[$param] = $_REQUEST[$param]; | 
| 458 | -            } else if (!isset($_SESSION[$param])) {
 | |
| 461 | +            } else if (!isset($_SESSION[$param])) { | |
| 459 | 462 | $_SESSION[$param] = $modx->manager->getLastUserSetting($param); | 
| 460 | 463 | } | 
| 461 | 464 | } | 
| @@ -535,16 +538,16 @@ discard block | ||
| 535 | 538 | </div> | 
| 536 | 539 | |
| 537 | 540 | <?php | 
| 538 | -    if(!function_exists('constructLink')) {
 | |
| 541 | +    if(!function_exists('constructLink')) { | |
| 539 | 542 | /** | 
| 540 | 543 | * @param string $action | 
| 541 | 544 | * @param string $img | 
| 542 | 545 | * @param string $text | 
| 543 | 546 | * @param bool $allowed | 
| 544 | 547 | */ | 
| 545 | - function constructLink($action, $img, $text, $allowed) | |
| 546 | -        {
 | |
| 547 | -            if ((bool)$allowed) {
 | |
| 548 | + function constructLink($action, $img, $text, $allowed) | |
| 549 | +        { | |
| 550 | +            if ((bool)$allowed) { | |
| 548 | 551 |                  echo sprintf('<div class="menuLink" id="item%s" onclick="modx.tree.menuHandler(%s);">', $action,
 | 
| 549 | 552 | $action); | 
| 550 | 553 |                  echo sprintf('<i class="%s"></i> %s</div>', $img, $text);
 | 
| @@ -651,7 +654,7 @@ discard block | ||
| 651 | 654 | ?> | 
| 652 | 655 | |
| 653 | 656 | </div> | 
| 654 | -<?php if ($modx->config['show_picker'] != "0") {
 | |
| 657 | +<?php if ($modx->config['show_picker'] != "0") { | |
| 655 | 658 |      include('media/style/' . $modx->config['manager_theme'] . '/color.switcher.php');
 | 
| 656 | 659 | } ?> | 
| 657 | 660 | </body> |