@@ -3,7 +3,7 @@ discard block |
||
| 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 | -if($modx->getManagerApi()->action!='8' && isset($_SESSION['mgrValidated'])){ |
|
| 6 | +if($modx->getManagerApi()->action!='8' && isset($_SESSION['mgrValidated'])) { |
|
| 7 | 7 | |
| 8 | 8 | $homeurl = $modx->makeUrl($manager_login_startup>0 ? $manager_login_startup:$site_start); |
| 9 | 9 | $logouturl = MODX_MANAGER_URL.'index.php?a=8'; |
@@ -35,8 +35,7 @@ discard block |
||
| 35 | 35 | if(substr($target,0,6)==='@CHUNK') { |
| 36 | 36 | $target = trim(substr($target,7)); |
| 37 | 37 | $lockout_tpl = $modx->getChunk($target); |
| 38 | - } |
|
| 39 | - elseif(substr($target,0,5)==='@FILE') { |
|
| 38 | + } elseif(substr($target,0,5)==='@FILE') { |
|
| 40 | 39 | $target = trim(substr($target,6)); |
| 41 | 40 | $lockout_tpl = file_get_contents($target); |
| 42 | 41 | } |
@@ -44,24 +43,20 @@ discard block |
||
| 44 | 43 | $chunk = $modx->getChunk($target); |
| 45 | 44 | if($chunk!==false && !empty($chunk)) { |
| 46 | 45 | $lockout_tpl = $chunk; |
| 47 | - } |
|
| 48 | - elseif(is_file(MODX_BASE_PATH . $target)) { |
|
| 46 | + } elseif(is_file(MODX_BASE_PATH . $target)) { |
|
| 49 | 47 | $target = MODX_BASE_PATH . $target; |
| 50 | 48 | $lockout_tpl = file_get_contents($target); |
| 51 | - } |
|
| 52 | - elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/manager.lockout.tpl')) { |
|
| 49 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/manager.lockout.tpl')) { |
|
| 53 | 50 | $target = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/manager.lockout.tpl'; |
| 54 | 51 | $lockout_tpl = file_get_contents($target); |
| 55 | - } |
|
| 56 | - elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/templates/actions/manager.lockout.tpl')) { |
|
| 52 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/templates/actions/manager.lockout.tpl')) { |
|
| 57 | 53 | $target = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/templates/actions/manager.lockout.tpl'; |
| 58 | 54 | $login_tpl = file_get_contents($target); |
| 59 | - } |
|
| 60 | - elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/manager.lockout.html')) { // ClipperCMS compatible |
|
| 55 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/manager.lockout.html')) { |
|
| 56 | +// ClipperCMS compatible |
|
| 61 | 57 | $target = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/manager.lockout.html'; |
| 62 | 58 | $lockout_tpl = file_get_contents($target); |
| 63 | - } |
|
| 64 | - else { |
|
| 59 | + } else { |
|
| 65 | 60 | $target = MODX_MANAGER_PATH . 'media/style/common/manager.lockout.tpl'; |
| 66 | 61 | $lockout_tpl = file_get_contents($target); |
| 67 | 62 | } |
@@ -5,14 +5,14 @@ discard block |
||
| 5 | 5 | |
| 6 | 6 | // PROCESSOR FIRST |
| 7 | 7 | if($_SESSION['mgrRole'] == 1) { |
| 8 | - if($_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) { |
|
| 9 | - $current = $modx->getManagerApi()->getSystemChecksum($modx->config['check_files_onlogin']); |
|
| 10 | - if(!empty($current)) { |
|
| 11 | - $modx->getManagerApi()->setSystemChecksum($current); |
|
| 12 | - $modx->clearCache('full'); |
|
| 13 | - $modx->config['sys_files_checksum'] = $current; |
|
| 14 | - }; |
|
| 15 | - } |
|
| 8 | + if($_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) { |
|
| 9 | + $current = $modx->getManagerApi()->getSystemChecksum($modx->config['check_files_onlogin']); |
|
| 10 | + if(!empty($current)) { |
|
| 11 | + $modx->getManagerApi()->setSystemChecksum($current); |
|
| 12 | + $modx->clearCache('full'); |
|
| 13 | + $modx->config['sys_files_checksum'] = $current; |
|
| 14 | + }; |
|
| 15 | + } |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | // NOW CHECK CONFIG |
@@ -20,15 +20,15 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | $sysfiles_check = $modx->getManagerApi()->checkSystemChecksum(); |
| 22 | 22 | if ($sysfiles_check!=='0'){ |
| 23 | - $warningspresent = 1; |
|
| 24 | - $warnings[] = array($_lang['configcheck_sysfiles_mod']); |
|
| 23 | + $warningspresent = 1; |
|
| 24 | + $warnings[] = array($_lang['configcheck_sysfiles_mod']); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | if (is_writable("includes/config.inc.php")){ |
| 28 | 28 | // Warn if world writable |
| 29 | 29 | if(@fileperms('includes/config.inc.php') & 0x0002) { |
| 30 | - $warningspresent = 1; |
|
| 31 | - $warnings[] = array($_lang['configcheck_configinc']); |
|
| 30 | + $warningspresent = 1; |
|
| 31 | + $warnings[] = array($_lang['configcheck_configinc']); |
|
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | 34 | |
@@ -182,10 +182,10 @@ discard block |
||
| 182 | 182 | break; |
| 183 | 183 | case $_lang['configcheck_sysfiles_mod']: |
| 184 | 184 | $warnings[$i][1] = $_lang["configcheck_sysfiles_mod_msg"]; |
| 185 | - $warnings[$i][2] = '<ul><li>'. implode('</li><li>', $sysfiles_check) .'</li></ul>'; |
|
| 186 | - if($modx->hasPermission('settings')) { |
|
| 187 | - $warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\'' . $_lang["reset_sysfiles_checksum_alert"] . '\')">' . $_lang["reset_sysfiles_checksum_button"] . '</a></li></ul>'; |
|
| 188 | - } |
|
| 185 | + $warnings[$i][2] = '<ul><li>'. implode('</li><li>', $sysfiles_check) .'</li></ul>'; |
|
| 186 | + if($modx->hasPermission('settings')) { |
|
| 187 | + $warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\'' . $_lang["reset_sysfiles_checksum_alert"] . '\')">' . $_lang["reset_sysfiles_checksum_button"] . '</a></li></ul>'; |
|
| 188 | + } |
|
| 189 | 189 | if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1]." ".implode(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']); |
| 190 | 190 | break; |
| 191 | 191 | case $_lang['configcheck_lang_difference'] : |
@@ -19,12 +19,12 @@ discard block |
||
| 19 | 19 | $warningspresent = 0; |
| 20 | 20 | |
| 21 | 21 | $sysfiles_check = $modx->getManagerApi()->checkSystemChecksum(); |
| 22 | -if ($sysfiles_check!=='0'){ |
|
| 22 | +if ($sysfiles_check!=='0') { |
|
| 23 | 23 | $warningspresent = 1; |
| 24 | 24 | $warnings[] = array($_lang['configcheck_sysfiles_mod']); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | -if (is_writable("includes/config.inc.php")){ |
|
| 27 | +if (is_writable("includes/config.inc.php")) { |
|
| 28 | 28 | // Warn if world writable |
| 29 | 29 | if(@fileperms('includes/config.inc.php') & 0x0002) { |
| 30 | 30 | $warningspresent = 1; |
@@ -120,7 +120,8 @@ discard block |
||
| 120 | 120 | /** |
| 121 | 121 | * @return bool |
| 122 | 122 | */ |
| 123 | - function checkSiteCache() { |
|
| 123 | + function checkSiteCache() |
|
| 124 | + { |
|
| 124 | 125 | $modx = evolutionCMS(); |
| 125 | 126 | $checked= true; |
| 126 | 127 | if (file_exists($modx->config['base_path'] . 'assets/cache/siteCache.idx.php')) { |
@@ -159,26 +160,36 @@ discard block |
||
| 159 | 160 | |
| 160 | 161 | if ($warningspresent==1) { |
| 161 | 162 | |
| 162 | -if(!isset($modx->config['send_errormail'])) $modx->config['send_errormail']='3'; |
|
| 163 | +if(!isset($modx->config['send_errormail'])) { |
|
| 164 | + $modx->config['send_errormail']='3'; |
|
| 165 | +} |
|
| 163 | 166 | $config_check_results = "<h3>".$_lang['configcheck_notok']."</h3>"; |
| 164 | 167 | |
| 165 | 168 | for ($i=0;$i<count($warnings);$i++) { |
| 166 | 169 | switch ($warnings[$i][0]) { |
| 167 | 170 | case $_lang['configcheck_configinc']; |
| 168 | 171 | $warnings[$i][1] = $_lang['configcheck_configinc_msg']; |
| 169 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_configinc']); |
|
| 172 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
| 173 | + $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_configinc']); |
|
| 174 | + } |
|
| 170 | 175 | break; |
| 171 | 176 | case $_lang['configcheck_installer'] : |
| 172 | 177 | $warnings[$i][1] = $_lang['configcheck_installer_msg']; |
| 173 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_installer']); |
|
| 178 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
| 179 | + $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_installer']); |
|
| 180 | + } |
|
| 174 | 181 | break; |
| 175 | 182 | case $_lang['configcheck_cache'] : |
| 176 | 183 | $warnings[$i][1] = $_lang['configcheck_cache_msg']; |
| 177 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_cache']); |
|
| 184 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
| 185 | + $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_cache']); |
|
| 186 | + } |
|
| 178 | 187 | break; |
| 179 | 188 | case $_lang['configcheck_images'] : |
| 180 | 189 | $warnings[$i][1] = $_lang['configcheck_images_msg']; |
| 181 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_images']); |
|
| 190 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
| 191 | + $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_images']); |
|
| 192 | + } |
|
| 182 | 193 | break; |
| 183 | 194 | case $_lang['configcheck_sysfiles_mod']: |
| 184 | 195 | $warnings[$i][1] = $_lang["configcheck_sysfiles_mod_msg"]; |
@@ -186,7 +197,9 @@ discard block |
||
| 186 | 197 | if($modx->hasPermission('settings')) { |
| 187 | 198 | $warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\'' . $_lang["reset_sysfiles_checksum_alert"] . '\')">' . $_lang["reset_sysfiles_checksum_button"] . '</a></li></ul>'; |
| 188 | 199 | } |
| 189 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1]." ".implode(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']); |
|
| 200 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
| 201 | + $modx->logEvent(0,3,$warnings[$i][1]." ".implode(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']); |
|
| 202 | + } |
|
| 190 | 203 | break; |
| 191 | 204 | case $_lang['configcheck_lang_difference'] : |
| 192 | 205 | $warnings[$i][1] = $_lang['configcheck_lang_difference_msg']; |
@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
| 3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 4 | 4 | } |
| 5 | 5 | global $SystemAlertMsgQueque; |
| 6 | 6 | // display system alert window if messages are available |
| 7 | 7 | if(count($SystemAlertMsgQueque) > 0) { |
| 8 | - include "sysalert.display.inc.php"; |
|
| 8 | + include "sysalert.display.inc.php"; |
|
| 9 | 9 | } |
| 10 | 10 | ?> |
| 11 | 11 | <script type='text/javascript'> |
@@ -19,17 +19,17 @@ discard block |
||
| 19 | 19 | </script> |
| 20 | 20 | <?php |
| 21 | 21 | if(in_array($modx->getManagerApi()->action, array( |
| 22 | - 85, |
|
| 23 | - 27, |
|
| 24 | - 4, |
|
| 25 | - 72, |
|
| 26 | - 13, |
|
| 27 | - 11, |
|
| 28 | - 12, |
|
| 29 | - 87, |
|
| 30 | - 88 |
|
| 22 | + 85, |
|
| 23 | + 27, |
|
| 24 | + 4, |
|
| 25 | + 72, |
|
| 26 | + 13, |
|
| 27 | + 11, |
|
| 28 | + 12, |
|
| 29 | + 87, |
|
| 30 | + 88 |
|
| 31 | 31 | ))) { |
| 32 | - echo $modx->getManagerApi()->loadDatePicker($modx->config['mgr_date_picker_path']); |
|
| 32 | + echo $modx->getManagerApi()->loadDatePicker($modx->config['mgr_date_picker_path']); |
|
| 33 | 33 | } |
| 34 | 34 | ?> |
| 35 | 35 | </body> |
@@ -1,30 +1,30 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | - /** |
|
| 4 | - * System Alert Message Queue Display file |
|
| 5 | - * Written By Raymond Irving, April, 2005 |
|
| 6 | - * |
|
| 7 | - * Used to display system alert messages inside the browser |
|
| 8 | - * |
|
| 9 | - */ |
|
| 3 | + /** |
|
| 4 | + * System Alert Message Queue Display file |
|
| 5 | + * Written By Raymond Irving, April, 2005 |
|
| 6 | + * |
|
| 7 | + * Used to display system alert messages inside the browser |
|
| 8 | + * |
|
| 9 | + */ |
|
| 10 | 10 | |
| 11 | - require_once(dirname(__FILE__).'/protect.inc.php'); |
|
| 11 | + require_once(dirname(__FILE__).'/protect.inc.php'); |
|
| 12 | 12 | |
| 13 | - $sysMsgs = ""; |
|
| 14 | - $limit = count($SystemAlertMsgQueque); |
|
| 15 | - for($i=0;$i<$limit;$i++) { |
|
| 16 | - $sysMsgs .= $SystemAlertMsgQueque[$i]."<hr sys/>"; |
|
| 17 | - } |
|
| 18 | - // reset message queque |
|
| 19 | - unset($_SESSION['SystemAlertMsgQueque']); |
|
| 20 | - $_SESSION['SystemAlertMsgQueque'] = array(); |
|
| 21 | - $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque']; |
|
| 13 | + $sysMsgs = ""; |
|
| 14 | + $limit = count($SystemAlertMsgQueque); |
|
| 15 | + for($i=0;$i<$limit;$i++) { |
|
| 16 | + $sysMsgs .= $SystemAlertMsgQueque[$i]."<hr sys/>"; |
|
| 17 | + } |
|
| 18 | + // reset message queque |
|
| 19 | + unset($_SESSION['SystemAlertMsgQueque']); |
|
| 20 | + $_SESSION['SystemAlertMsgQueque'] = array(); |
|
| 21 | + $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque']; |
|
| 22 | 22 | |
| 23 | - if($sysMsgs!="") { |
|
| 23 | + if($sysMsgs!="") { |
|
| 24 | 24 | ?> |
| 25 | 25 | |
| 26 | 26 | <?php // fetch the styles |
| 27 | - echo '<link rel="stylesheet" type="text/css" href="'.MODX_MANAGER_URL.'media/style/'.$manager_theme.'/style.css'.'" />'; |
|
| 27 | + echo '<link rel="stylesheet" type="text/css" href="'.MODX_MANAGER_URL.'media/style/'.$manager_theme.'/style.css'.'" />'; |
|
| 28 | 28 | ?> |
| 29 | 29 | <script type="text/javascript"> |
| 30 | 30 | // <![CDATA[ |
@@ -42,5 +42,5 @@ discard block |
||
| 42 | 42 | // ]]> |
| 43 | 43 | </script> |
| 44 | 44 | <?php |
| 45 | - } |
|
| 45 | + } |
|
| 46 | 46 | ?> |
@@ -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->getDatabase()->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->getDatabase()->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 | } |
@@ -5,10 +5,10 @@ |
||
| 5 | 5 | class DeprecatedCore implements DeprecatedCoreInterface |
| 6 | 6 | { |
| 7 | 7 | /** |
| 8 | - * @deprecated |
|
| 9 | - * |
|
| 10 | - * return @void |
|
| 11 | - */ |
|
| 8 | + * @deprecated |
|
| 9 | + * |
|
| 10 | + * return @void |
|
| 11 | + */ |
|
| 12 | 12 | public function dbConnect() |
| 13 | 13 | { |
| 14 | 14 | $modx = evolutionCMS(); |
@@ -2,4 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | use Exception; |
| 4 | 4 | |
| 5 | -class ServiceNotFoundException extends Exception{} |
|
| 5 | +class ServiceNotFoundException extends Exception |
|
| 6 | +{ |
|
| 7 | +} |
|
@@ -2,4 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | use Exception; |
| 4 | 4 | |
| 5 | -class ContainerException extends Exception{} |
|
| 5 | +class ContainerException extends Exception |
|
| 6 | +{ |
|
| 7 | +} |
|
@@ -282,7 +282,8 @@ discard block |
||
| 282 | 282 | return $service; |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | - private function checkServiceAlias($name){ |
|
| 285 | + private function checkServiceAlias($name) |
|
| 286 | + { |
|
| 286 | 287 | foreach ($this->providerAliases as $alias => $interface) { |
| 287 | 288 | if($name === $interface) { |
| 288 | 289 | return $alias; |
@@ -962,13 +963,15 @@ discard block |
||
| 962 | 963 | $this->virtualDir = ''; |
| 963 | 964 | } |
| 964 | 965 | |
| 965 | - 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 */ |
|
| 966 | + if (preg_match('@^[1-9][0-9]*$@', $q) && !isset($this->documentListing[$q])) { |
|
| 967 | +/* we got an ID returned, check to make sure it's not an alias */ |
|
| 966 | 968 | /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */ |
| 967 | 969 | if ($this->config['use_alias_path'] == 1) { |
| 968 | 970 | 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))))) { |
| 969 | 971 | $this->documentMethod = 'id'; |
| 970 | 972 | return $q; |
| 971 | - } else { /* not a valid id in terms of virtualDir, treat as alias */ |
|
| 973 | + } else { |
|
| 974 | +/* not a valid id in terms of virtualDir, treat as alias */ |
|
| 972 | 975 | $this->documentMethod = 'alias'; |
| 973 | 976 | return $q; |
| 974 | 977 | } |
@@ -976,7 +979,8 @@ discard block |
||
| 976 | 979 | $this->documentMethod = 'id'; |
| 977 | 980 | return $q; |
| 978 | 981 | } |
| 979 | - } else { /* we didn't get an ID back, so instead we assume it's an alias */ |
|
| 982 | + } else { |
|
| 983 | +/* we didn't get an ID back, so instead we assume it's an alias */ |
|
| 980 | 984 | if ($this->config['friendly_alias_urls'] != 1) { |
| 981 | 985 | $q = $qOrig; |
| 982 | 986 | } |
@@ -1006,13 +1010,14 @@ discard block |
||
| 1006 | 1010 | * @param $id |
| 1007 | 1011 | * @return array|mixed|null|string |
| 1008 | 1012 | */ |
| 1009 | - public function makePageCacheKey($id){ |
|
| 1013 | + public function makePageCacheKey($id) |
|
| 1014 | + { |
|
| 1010 | 1015 | $hash = $id; |
| 1011 | 1016 | $tmp = null; |
| 1012 | 1017 | $params = array(); |
| 1013 | - if(!empty($this->systemCacheKey)){ |
|
| 1018 | + if(!empty($this->systemCacheKey)) { |
|
| 1014 | 1019 | $hash = $this->systemCacheKey; |
| 1015 | - }else { |
|
| 1020 | + } else { |
|
| 1016 | 1021 | if (!empty($_GET)) { |
| 1017 | 1022 | // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID. |
| 1018 | 1023 | $params = $_GET; |
@@ -1021,7 +1026,7 @@ discard block |
||
| 1021 | 1026 | } |
| 1022 | 1027 | } |
| 1023 | 1028 | $evtOut = $this->invokeEvent("OnMakePageCacheKey", array ("hash" => $hash, "id" => $id, 'params' => $params)); |
| 1024 | - if (is_array($evtOut) && count($evtOut) > 0){ |
|
| 1029 | + if (is_array($evtOut) && count($evtOut) > 0) { |
|
| 1025 | 1030 | $tmp = array_pop($evtOut); |
| 1026 | 1031 | } |
| 1027 | 1032 | return empty($tmp) ? $hash : $tmp; |
@@ -1348,7 +1353,8 @@ discard block |
||
| 1348 | 1353 | $where = "pub_date <= {$timeNow} AND pub_date!=0 AND published=0"; |
| 1349 | 1354 | $result_pub = $this->getDatabase()->select( 'id', '[+prefix+]site_content', $where); |
| 1350 | 1355 | $this->getDatabase()->update($field, '[+prefix+]site_content', $where); |
| 1351 | - if ($this->getDatabase()->getRecordCount($result_pub) >= 1) { //Event unPublished doc |
|
| 1356 | + if ($this->getDatabase()->getRecordCount($result_pub) >= 1) { |
|
| 1357 | +//Event unPublished doc |
|
| 1352 | 1358 | while ($row_pub = $this->getDatabase()->getRow($result_pub)) { |
| 1353 | 1359 | $this->invokeEvent("OnDocUnPublished", array( |
| 1354 | 1360 | "docid" => $row_pub['id'] |
@@ -1361,7 +1367,8 @@ discard block |
||
| 1361 | 1367 | $where = "unpub_date <= {$timeNow} AND unpub_date!=0 AND published=1"; |
| 1362 | 1368 | $result_unpub = $this->getDatabase()->select( 'id', '[+prefix+]site_content', $where); |
| 1363 | 1369 | $this->getDatabase()->update($field, '[+prefix+]site_content', $where); |
| 1364 | - if ($this->getDatabase()->getRecordCount($result_unpub) >= 1) { //Event unPublished doc |
|
| 1370 | + if ($this->getDatabase()->getRecordCount($result_unpub) >= 1) { |
|
| 1371 | +//Event unPublished doc |
|
| 1365 | 1372 | while ($row_unpub = $this->getDatabase()->getRow($result_unpub)) { |
| 1366 | 1373 | $this->invokeEvent("OnDocUnPublished", array( |
| 1367 | 1374 | "docid" => $row_unpub['id'] |
@@ -1448,10 +1455,18 @@ discard block |
||
| 1448 | 1455 | return array(); |
| 1449 | 1456 | } |
| 1450 | 1457 | $spacer = md5('<<<EVO>>>'); |
| 1451 | - if($left==='{{' && strpos($content,';}}')!==false) $content = str_replace(';}}', sprintf(';}%s}', $spacer),$content); |
|
| 1452 | - if($left==='{{' && strpos($content,'{{}}')!==false) $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content); |
|
| 1453 | - if($left==='[[' && strpos($content,']]]]')!==false) $content = str_replace(']]]]',sprintf(']]%s]]', $spacer),$content); |
|
| 1454 | - if($left==='[[' && strpos($content,']]]')!==false) $content = str_replace(']]]', sprintf(']%s]]', $spacer),$content); |
|
| 1458 | + if($left==='{{' && strpos($content,';}}')!==false) { |
|
| 1459 | + $content = str_replace(';}}', sprintf(';}%s}', $spacer),$content); |
|
| 1460 | + } |
|
| 1461 | + if($left==='{{' && strpos($content,'{{}}')!==false) { |
|
| 1462 | + $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content); |
|
| 1463 | + } |
|
| 1464 | + if($left==='[[' && strpos($content,']]]]')!==false) { |
|
| 1465 | + $content = str_replace(']]]]',sprintf(']]%s]]', $spacer),$content); |
|
| 1466 | + } |
|
| 1467 | + if($left==='[[' && strpos($content,']]]')!==false) { |
|
| 1468 | + $content = str_replace(']]]', sprintf(']%s]]', $spacer),$content); |
|
| 1469 | + } |
|
| 1455 | 1470 | |
| 1456 | 1471 | $pos['<![CDATA['] = strpos($content, '<![CDATA['); |
| 1457 | 1472 | $pos[']]>'] = strpos($content, ']]>'); |
@@ -1504,7 +1519,8 @@ discard block |
||
| 1504 | 1519 | } |
| 1505 | 1520 | } |
| 1506 | 1521 | |
| 1507 | - if (!in_array($fetch, $tags)) { // Avoid double Matches |
|
| 1522 | + if (!in_array($fetch, $tags)) { |
|
| 1523 | +// Avoid double Matches |
|
| 1508 | 1524 | $tags[] = $fetch; // Fetch |
| 1509 | 1525 | }; |
| 1510 | 1526 | $fetch = ''; // and reset |
@@ -1522,7 +1538,9 @@ discard block |
||
| 1522 | 1538 | } |
| 1523 | 1539 | } |
| 1524 | 1540 | foreach($tags as $i=>$tag) { |
| 1525 | - if(strpos($tag,$spacer)!==false) $tags[$i] = str_replace($spacer, '', $tag); |
|
| 1541 | + if(strpos($tag,$spacer)!==false) { |
|
| 1542 | + $tags[$i] = str_replace($spacer, '', $tag); |
|
| 1543 | + } |
|
| 1526 | 1544 | } |
| 1527 | 1545 | return $tags; |
| 1528 | 1546 | } |
@@ -1562,7 +1580,10 @@ discard block |
||
| 1562 | 1580 | } |
| 1563 | 1581 | |
| 1564 | 1582 | foreach ($matches[1] as $i => $key) { |
| 1565 | - if(strpos($key,'[+')!==false) continue; // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
| 1583 | + if(strpos($key,'[+')!==false) { |
|
| 1584 | + continue; |
|
| 1585 | + } |
|
| 1586 | + // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
| 1566 | 1587 | if (substr($key, 0, 1) == '#') { |
| 1567 | 1588 | $key = substr($key, 1); |
| 1568 | 1589 | } // remove # for QuickEdit format |
@@ -2288,7 +2309,8 @@ discard block |
||
| 2288 | 2309 | * @return mixed|string |
| 2289 | 2310 | */ |
| 2290 | 2311 | public function _getSGVar($value) |
| 2291 | - { // Get super globals |
|
| 2312 | + { |
|
| 2313 | +// Get super globals |
|
| 2292 | 2314 | $key = $value; |
| 2293 | 2315 | $_ = $this->config['enable_filter']; |
| 2294 | 2316 | $this->config['enable_filter'] = 1; |
@@ -2693,7 +2715,8 @@ discard block |
||
| 2693 | 2715 | if ($this->config['friendly_urls'] == 1) { |
| 2694 | 2716 | $aliases = array(); |
| 2695 | 2717 | if (is_array($this->documentListing)) { |
| 2696 | - foreach ($this->documentListing as $path => $docid) { // This is big Loop on large site! |
|
| 2718 | + foreach ($this->documentListing as $path => $docid) { |
|
| 2719 | +// This is big Loop on large site! |
|
| 2697 | 2720 | $aliases[$docid] = $path; |
| 2698 | 2721 | $isfolder[$docid] = $this->aliasListing[$docid]['isfolder']; |
| 2699 | 2722 | } |
@@ -2726,7 +2749,7 @@ discard block |
||
| 2726 | 2749 | $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0); |
| 2727 | 2750 | $pref = $this->config['friendly_url_prefix']; |
| 2728 | 2751 | $suff = $this->config['friendly_url_suffix']; |
| 2729 | - $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
| 2752 | + $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff){ |
|
| 2730 | 2753 | global $modx; |
| 2731 | 2754 | $thealias = $aliases[$m[1]]; |
| 2732 | 2755 | $thefolder = $isfolder[$m[1]]; |
@@ -4509,7 +4532,8 @@ discard block |
||
| 4509 | 4532 | if (isset ($this->snippetCache[$snippetName])) { |
| 4510 | 4533 | $snippet = $this->snippetCache[$snippetName]; |
| 4511 | 4534 | $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : ''; |
| 4512 | - } else { // not in cache so let's check the db |
|
| 4535 | + } else { |
|
| 4536 | +// not in cache so let's check the db |
|
| 4513 | 4537 | $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->getDatabase()->escape($snippetName) . "' AND ss.disabled=0;"; |
| 4514 | 4538 | $result = $this->getDatabase()->query($sql); |
| 4515 | 4539 | if ($this->getDatabase()->getRecordCount($result) == 1) { |
@@ -5010,7 +5034,7 @@ discard block |
||
| 5010 | 5034 | $result = $this->getDatabase()->makeArray($rs); |
| 5011 | 5035 | |
| 5012 | 5036 | // get default/built-in template variables |
| 5013 | - if(is_array($docRow)){ |
|
| 5037 | + if(is_array($docRow)) { |
|
| 5014 | 5038 | ksort($docRow); |
| 5015 | 5039 | |
| 5016 | 5040 | foreach ($docRow as $key => $value) { |
@@ -5485,12 +5509,16 @@ discard block |
||
| 5485 | 5509 | return ''; |
| 5486 | 5510 | } // nothing to register |
| 5487 | 5511 | if (!is_array($options)) { |
| 5488 | - if (is_bool($options)) // backward compatibility with old plaintext parameter |
|
| 5512 | + if (is_bool($options)) { |
|
| 5513 | + // backward compatibility with old plaintext parameter |
|
| 5489 | 5514 | { |
| 5490 | 5515 | $options = array('plaintext' => $options); |
| 5491 | - } elseif (is_string($options)) // Also allow script name as 2nd param |
|
| 5516 | + } |
|
| 5517 | + } elseif (is_string($options)) { |
|
| 5518 | + // Also allow script name as 2nd param |
|
| 5492 | 5519 | { |
| 5493 | 5520 | $options = array('name' => $options); |
| 5521 | + } |
|
| 5494 | 5522 | } else { |
| 5495 | 5523 | $options = array(); |
| 5496 | 5524 | } |
@@ -5502,7 +5530,8 @@ discard block |
||
| 5502 | 5530 | unset($overwritepos); // probably unnecessary--just making sure |
| 5503 | 5531 | |
| 5504 | 5532 | $useThisVer = true; |
| 5505 | - if (isset($this->loadedjscripts[$key])) { // a matching script was found |
|
| 5533 | + if (isset($this->loadedjscripts[$key])) { |
|
| 5534 | +// a matching script was found |
|
| 5506 | 5535 | // if existing script is a startup script, make sure the candidate is also a startup script |
| 5507 | 5536 | if ($this->loadedjscripts[$key]['startup']) { |
| 5508 | 5537 | $startup = true; |
@@ -5522,7 +5551,8 @@ discard block |
||
| 5522 | 5551 | // overwrite the old script (the position may be important for dependent scripts) |
| 5523 | 5552 | $overwritepos = $this->loadedjscripts[$key]['pos']; |
| 5524 | 5553 | } |
| 5525 | - } else { // Use the original version |
|
| 5554 | + } else { |
|
| 5555 | +// Use the original version |
|
| 5526 | 5556 | if ($startup == true && $this->loadedjscripts[$key]['startup'] == false) { |
| 5527 | 5557 | // need to move the exisiting script to the head |
| 5528 | 5558 | $version = $this->loadedjscripts[$key][$version]; |
@@ -5647,7 +5677,8 @@ discard block |
||
| 5647 | 5677 | } |
| 5648 | 5678 | |
| 5649 | 5679 | $results = null; |
| 5650 | - foreach ($this->pluginEvent[$evtName] as $pluginName) { // start for loop |
|
| 5680 | + foreach ($this->pluginEvent[$evtName] as $pluginName) { |
|
| 5681 | +// start for loop |
|
| 5651 | 5682 | if ($this->dumpPlugins) { |
| 5652 | 5683 | $eventtime = $this->getMicroTime(); |
| 5653 | 5684 | } |
@@ -5793,8 +5824,7 @@ discard block |
||
| 5793 | 5824 | } |
| 5794 | 5825 | } |
| 5795 | 5826 | } |
| 5796 | - } |
|
| 5797 | - elseif(\is_array($propertyString)) { |
|
| 5827 | + } elseif(\is_array($propertyString)) { |
|
| 5798 | 5828 | $property = $propertyString; |
| 5799 | 5829 | } |
| 5800 | 5830 | if (!empty($elementName) && !empty($elementType)) { |
@@ -6241,7 +6271,8 @@ discard block |
||
| 6241 | 6271 | * @return bool |
| 6242 | 6272 | */ |
| 6243 | 6273 | public function isSafeCode($phpcode = '', $safe_functions = '') |
| 6244 | - { // return true or false |
|
| 6274 | + { |
|
| 6275 | +// return true or false |
|
| 6245 | 6276 | if ($safe_functions == '') { |
| 6246 | 6277 | return false; |
| 6247 | 6278 | } |
@@ -6650,7 +6681,7 @@ discard block |
||
| 6650 | 6681 | $args = array_pad(array(), $_, '$var'); |
| 6651 | 6682 | $args = implode(", ", $args); |
| 6652 | 6683 | $modx = &$this; |
| 6653 | - $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) { |
|
| 6684 | + $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val){ |
|
| 6654 | 6685 | $arg = $val['args'][$tmp - 1]; |
| 6655 | 6686 | switch (true) { |
| 6656 | 6687 | case is_null($arg): { |