@@ -3,10 +3,10 @@ discard block |
||
| 3 | 3 | global $site_sessionname; |
| 4 | 4 | $site_sessionname = genEvoSessionName(); // For legacy extras not using startCMSSession |
| 5 | 5 | |
| 6 | -function genEvoSessionName() {
|
|
| 6 | +function genEvoSessionName(){
|
|
| 7 | 7 | $_ = crc32(__FILE__); |
| 8 | 8 | $_ = sprintf('%u', $_);
|
| 9 | - return 'evo' . base_convert($_,10,36); |
|
| 9 | + return 'evo'.base_convert($_, 10, 36); |
|
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | function startCMSSession(){
|
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | session_name($site_sessionname); |
| 17 | 17 | removeInvalidCmsSessionIds($site_sessionname); |
| 18 | - $cookieExpiration= 0; |
|
| 18 | + $cookieExpiration = 0; |
|
| 19 | 19 | $secure = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port); |
| 20 | 20 | $cookiePath = !empty($session_cookie_path) ? $session_cookie_path : MODX_BASE_URL; |
| 21 | 21 | $cookieDomain = !empty($session_cookie_domain) ? $session_cookie_domain : ''; |
@@ -24,8 +24,8 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | $key = "modx.{$context}.session.cookie.lifetime";
|
| 26 | 26 | if (isset($_SESSION[$key]) && is_numeric($_SESSION[$key])) {
|
| 27 | - $cookieLifetime= intval($_SESSION[$key]); |
|
| 28 | - if($cookieLifetime) $cookieExpiration = $_SERVER['REQUEST_TIME']+$cookieLifetime; |
|
| 27 | + $cookieLifetime = intval($_SESSION[$key]); |
|
| 28 | + if ($cookieLifetime) $cookieExpiration = $_SERVER['REQUEST_TIME'] + $cookieLifetime; |
|
| 29 | 29 | setcookie(session_name(), session_id(), $cookieExpiration, $cookiePath, $cookieDomain, $secure, true); |
| 30 | 30 | } |
| 31 | 31 | if (!isset($_SESSION['modx.session.created.time'])) {
|
@@ -33,14 +33,14 @@ discard block |
||
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | -function removeInvalidCmsSessionFromStorage(&$storage, $session_name) {
|
|
| 36 | +function removeInvalidCmsSessionFromStorage(&$storage, $session_name){
|
|
| 37 | 37 | if (isset($storage[$session_name]) && ($storage[$session_name] === '' || $storage[$session_name] === 'deleted')) |
| 38 | 38 | {
|
| 39 | 39 | unset($storage[$session_name]); |
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | -function removeInvalidCmsSessionIds($session_name) {
|
|
| 43 | +function removeInvalidCmsSessionIds($session_name){
|
|
| 44 | 44 | // session ids is invalid iff it is empty string |
| 45 | 45 | // storage priorioty can see in PHP source ext/session/session.c |
| 46 | 46 | removeInvalidCmsSessionFromStorage($_COOKIE, $session_name); |
@@ -3,13 +3,15 @@ discard block |
||
| 3 | 3 | global $site_sessionname; |
| 4 | 4 | $site_sessionname = genEvoSessionName(); // For legacy extras not using startCMSSession |
| 5 | 5 | |
| 6 | -function genEvoSessionName() {
|
|
| 6 | +function genEvoSessionName() |
|
| 7 | +{ |
|
| 7 | 8 | $_ = crc32(__FILE__); |
| 8 | 9 | $_ = sprintf('%u', $_);
|
| 9 | 10 | return 'evo' . base_convert($_,10,36); |
| 10 | 11 | } |
| 11 | 12 | |
| 12 | -function startCMSSession(){
|
|
| 13 | +function startCMSSession() |
|
| 14 | +{ |
|
| 13 | 15 | |
| 14 | 16 | global $site_sessionname, $https_port, $session_cookie_path, $session_cookie_domain; |
| 15 | 17 | |
@@ -23,24 +25,27 @@ discard block |
||
| 23 | 25 | session_start(); |
| 24 | 26 | |
| 25 | 27 | $key = "modx.{$context}.session.cookie.lifetime";
|
| 26 | - if (isset($_SESSION[$key]) && is_numeric($_SESSION[$key])) {
|
|
| 28 | + if (isset($_SESSION[$key]) && is_numeric($_SESSION[$key])) { |
|
| 27 | 29 | $cookieLifetime= intval($_SESSION[$key]); |
| 28 | - if($cookieLifetime) $cookieExpiration = $_SERVER['REQUEST_TIME']+$cookieLifetime; |
|
| 30 | + if($cookieLifetime) { |
|
| 31 | + $cookieExpiration = $_SERVER['REQUEST_TIME']+$cookieLifetime; |
|
| 32 | + } |
|
| 29 | 33 | setcookie(session_name(), session_id(), $cookieExpiration, $cookiePath, $cookieDomain, $secure, true); |
| 30 | 34 | } |
| 31 | - if (!isset($_SESSION['modx.session.created.time'])) {
|
|
| 35 | + if (!isset($_SESSION['modx.session.created.time'])) { |
|
| 32 | 36 | $_SESSION['modx.session.created.time'] = $_SERVER['REQUEST_TIME']; |
| 33 | 37 | } |
| 34 | 38 | } |
| 35 | 39 | |
| 36 | -function removeInvalidCmsSessionFromStorage(&$storage, $session_name) {
|
|
| 37 | - if (isset($storage[$session_name]) && ($storage[$session_name] === '' || $storage[$session_name] === 'deleted')) |
|
| 38 | - {
|
|
| 40 | +function removeInvalidCmsSessionFromStorage(&$storage, $session_name) |
|
| 41 | +{ |
|
| 42 | + if (isset($storage[$session_name]) && ($storage[$session_name] === '' || $storage[$session_name] === 'deleted')) { |
|
| 39 | 43 | unset($storage[$session_name]); |
| 40 | 44 | } |
| 41 | 45 | } |
| 42 | 46 | |
| 43 | -function removeInvalidCmsSessionIds($session_name) {
|
|
| 47 | +function removeInvalidCmsSessionIds($session_name) |
|
| 48 | +{ |
|
| 44 | 49 | // session ids is invalid iff it is empty string |
| 45 | 50 | // storage priorioty can see in PHP source ext/session/session.c |
| 46 | 51 | removeInvalidCmsSessionFromStorage($_COOKIE, $session_name); |
@@ -5,72 +5,72 @@ discard block |
||
| 5 | 5 | var $errorcode; |
| 6 | 6 | var $errors = array(); |
| 7 | 7 | |
| 8 | - function __construct() { |
|
| 8 | + function __construct() { |
|
| 9 | 9 | |
| 10 | - $_lang = $this->include_lang('errormsg'); |
|
| 10 | + $_lang = $this->include_lang('errormsg'); |
|
| 11 | 11 | |
| 12 | - $this->errors = array( |
|
| 13 | - 0 => $_lang["No errors occured."], |
|
| 14 | - 1 => $_lang["An error occured!"], |
|
| 15 | - 2 => $_lang["Document's ID not passed in request!"], |
|
| 16 | - 3 => $_lang["You don't have enough privileges for this action!"], |
|
| 17 | - 4 => $_lang["ID passed in request is NaN!"], |
|
| 18 | - 5 => $_lang["The document is locked!"], |
|
| 19 | - 6 => $_lang["Too many results returned from database!"], |
|
| 20 | - 7 => $_lang["Not enough/ no results returned from database!"], |
|
| 21 | - 8 => $_lang["Couldn't find parent document's name!"], |
|
| 22 | - 9 => $_lang["Logging error!"], |
|
| 23 | - 10 => $_lang["Table to optimise not found in request!"], |
|
| 24 | - 11 => $_lang["No settings found in request!"], |
|
| 25 | - 12 => $_lang["The document must have a title!"], |
|
| 26 | - 13 => $_lang["No user selected as recipient of this message!"], |
|
| 27 | - 14 => $_lang["No group selected as recipient of this message!"], |
|
| 28 | - 15 => $_lang["The document was not found!"], |
|
| 12 | + $this->errors = array( |
|
| 13 | + 0 => $_lang["No errors occured."], |
|
| 14 | + 1 => $_lang["An error occured!"], |
|
| 15 | + 2 => $_lang["Document's ID not passed in request!"], |
|
| 16 | + 3 => $_lang["You don't have enough privileges for this action!"], |
|
| 17 | + 4 => $_lang["ID passed in request is NaN!"], |
|
| 18 | + 5 => $_lang["The document is locked!"], |
|
| 19 | + 6 => $_lang["Too many results returned from database!"], |
|
| 20 | + 7 => $_lang["Not enough/ no results returned from database!"], |
|
| 21 | + 8 => $_lang["Couldn't find parent document's name!"], |
|
| 22 | + 9 => $_lang["Logging error!"], |
|
| 23 | + 10 => $_lang["Table to optimise not found in request!"], |
|
| 24 | + 11 => $_lang["No settings found in request!"], |
|
| 25 | + 12 => $_lang["The document must have a title!"], |
|
| 26 | + 13 => $_lang["No user selected as recipient of this message!"], |
|
| 27 | + 14 => $_lang["No group selected as recipient of this message!"], |
|
| 28 | + 15 => $_lang["The document was not found!"], |
|
| 29 | 29 | |
| 30 | - 100 => $_lang["Double action (GET & POST) posted!"], |
|
| 31 | - 600 => $_lang["Document cannot be it's own parent!"], |
|
| 32 | - 601 => $_lang["Document's ID not passed in request!"], |
|
| 33 | - 602 => $_lang["New parent not set in request!"], |
|
| 34 | - 900 => $_lang["don't know the user!"], // don't know the user! |
|
| 35 | - 901 => $_lang["wrong password!"], // wrong password! |
|
| 36 | - 902 => $_lang["Due to too many failed logins, you have been blocked!"], |
|
| 37 | - 903 => $_lang["You are blocked and cannot log in!"], |
|
| 38 | - 904 => $_lang["You are blocked and cannot log in! Please try again later."], |
|
| 39 | - 905 => $_lang["The security code you entered didn't validate! Please try to login again!"] |
|
| 40 | - ); |
|
| 41 | - } |
|
| 30 | + 100 => $_lang["Double action (GET & POST) posted!"], |
|
| 31 | + 600 => $_lang["Document cannot be it's own parent!"], |
|
| 32 | + 601 => $_lang["Document's ID not passed in request!"], |
|
| 33 | + 602 => $_lang["New parent not set in request!"], |
|
| 34 | + 900 => $_lang["don't know the user!"], // don't know the user! |
|
| 35 | + 901 => $_lang["wrong password!"], // wrong password! |
|
| 36 | + 902 => $_lang["Due to too many failed logins, you have been blocked!"], |
|
| 37 | + 903 => $_lang["You are blocked and cannot log in!"], |
|
| 38 | + 904 => $_lang["You are blocked and cannot log in! Please try again later."], |
|
| 39 | + 905 => $_lang["The security code you entered didn't validate! Please try to login again!"] |
|
| 40 | + ); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - function include_lang($context='common') { |
|
| 44 | - global $modx; |
|
| 45 | - $_lang = array(); |
|
| 43 | + function include_lang($context='common') { |
|
| 44 | + global $modx; |
|
| 45 | + $_lang = array(); |
|
| 46 | 46 | |
| 47 | - $context = trim($context,'/'); |
|
| 48 | - if(strpos($context,'..')!==false) return; |
|
| 47 | + $context = trim($context,'/'); |
|
| 48 | + if(strpos($context,'..')!==false) return; |
|
| 49 | 49 | |
| 50 | - if($context === 'common') |
|
| 51 | - $lang_path = MODX_MANAGER_PATH . 'includes/lang/'; |
|
| 52 | - else |
|
| 53 | - $lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/"; |
|
| 54 | - include_once($lang_path . 'english.inc.php'); |
|
| 55 | - $manager_language = $modx->config['manager_language']; |
|
| 56 | - if(is_file("{$lang_path}{$manager_language}.inc.php")) |
|
| 57 | - include_once("{$lang_path}{$manager_language}.inc.php"); |
|
| 58 | - return $_lang; |
|
| 59 | - } |
|
| 50 | + if($context === 'common') |
|
| 51 | + $lang_path = MODX_MANAGER_PATH . 'includes/lang/'; |
|
| 52 | + else |
|
| 53 | + $lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/"; |
|
| 54 | + include_once($lang_path . 'english.inc.php'); |
|
| 55 | + $manager_language = $modx->config['manager_language']; |
|
| 56 | + if(is_file("{$lang_path}{$manager_language}.inc.php")) |
|
| 57 | + include_once("{$lang_path}{$manager_language}.inc.php"); |
|
| 58 | + return $_lang; |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - function setError($errorcode, $custommessage=""){ |
|
| 62 | - $this->errorcode=$errorcode; |
|
| 63 | - $this->errormessage=$this->errors[$errorcode]; |
|
| 64 | - if($custommessage!="") { |
|
| 65 | - $this->errormessage=$custommessage; |
|
| 66 | - } |
|
| 67 | - } |
|
| 61 | + function setError($errorcode, $custommessage=""){ |
|
| 62 | + $this->errorcode=$errorcode; |
|
| 63 | + $this->errormessage=$this->errors[$errorcode]; |
|
| 64 | + if($custommessage!="") { |
|
| 65 | + $this->errormessage=$custommessage; |
|
| 66 | + } |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - function getError() { |
|
| 70 | - return $this->errorcode; |
|
| 71 | - } |
|
| 69 | + function getError() { |
|
| 70 | + return $this->errorcode; |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - function dumpError(){ |
|
| 73 | + function dumpError(){ |
|
| 74 | 74 | ?> |
| 75 | 75 | <html> |
| 76 | 76 | <head> |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | </body> |
| 89 | 89 | </html> |
| 90 | 90 | <?php |
| 91 | - exit; |
|
| 92 | - } |
|
| 91 | + exit; |
|
| 92 | + } |
|
| 93 | 93 | } |
| 94 | 94 | ?> |
| 95 | 95 | \ No newline at end of file |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | var $errorcode; |
| 6 | 6 | var $errors = array(); |
| 7 | 7 | |
| 8 | - function __construct() { |
|
| 8 | + function __construct(){ |
|
| 9 | 9 | |
| 10 | 10 | $_lang = $this->include_lang('errormsg'); |
| 11 | 11 | |
@@ -40,33 +40,33 @@ discard block |
||
| 40 | 40 | ); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - function include_lang($context='common') { |
|
| 43 | + function include_lang($context = 'common'){ |
|
| 44 | 44 | global $modx; |
| 45 | 45 | $_lang = array(); |
| 46 | 46 | |
| 47 | - $context = trim($context,'/'); |
|
| 48 | - if(strpos($context,'..')!==false) return; |
|
| 47 | + $context = trim($context, '/'); |
|
| 48 | + if (strpos($context, '..') !== false) return; |
|
| 49 | 49 | |
| 50 | - if($context === 'common') |
|
| 51 | - $lang_path = MODX_MANAGER_PATH . 'includes/lang/'; |
|
| 50 | + if ($context === 'common') |
|
| 51 | + $lang_path = MODX_MANAGER_PATH.'includes/lang/'; |
|
| 52 | 52 | else |
| 53 | - $lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/"; |
|
| 54 | - include_once($lang_path . 'english.inc.php'); |
|
| 53 | + $lang_path = MODX_MANAGER_PATH."includes/lang/{$context}/"; |
|
| 54 | + include_once($lang_path.'english.inc.php'); |
|
| 55 | 55 | $manager_language = $modx->config['manager_language']; |
| 56 | - if(is_file("{$lang_path}{$manager_language}.inc.php")) |
|
| 56 | + if (is_file("{$lang_path}{$manager_language}.inc.php")) |
|
| 57 | 57 | include_once("{$lang_path}{$manager_language}.inc.php"); |
| 58 | 58 | return $_lang; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - function setError($errorcode, $custommessage=""){ |
|
| 62 | - $this->errorcode=$errorcode; |
|
| 63 | - $this->errormessage=$this->errors[$errorcode]; |
|
| 64 | - if($custommessage!="") { |
|
| 65 | - $this->errormessage=$custommessage; |
|
| 61 | + function setError($errorcode, $custommessage = ""){ |
|
| 62 | + $this->errorcode = $errorcode; |
|
| 63 | + $this->errormessage = $this->errors[$errorcode]; |
|
| 64 | + if ($custommessage != "") { |
|
| 65 | + $this->errormessage = $custommessage; |
|
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - function getError() { |
|
| 69 | + function getError(){ |
|
| 70 | 70 | return $this->errorcode; |
| 71 | 71 | } |
| 72 | 72 | |
@@ -1,11 +1,13 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | // this is the old error handler. Here for legacy, until i replace all the old errors. |
| 3 | -class errorHandler{ |
|
| 3 | +class errorHandler |
|
| 4 | +{ |
|
| 4 | 5 | |
| 5 | 6 | var $errorcode; |
| 6 | 7 | var $errors = array(); |
| 7 | 8 | |
| 8 | - function __construct() { |
|
| 9 | + function __construct() |
|
| 10 | + { |
|
| 9 | 11 | |
| 10 | 12 | $_lang = $this->include_lang('errormsg'); |
| 11 | 13 | |
@@ -40,25 +42,31 @@ discard block |
||
| 40 | 42 | ); |
| 41 | 43 | } |
| 42 | 44 | |
| 43 | - function include_lang($context='common') { |
|
| 45 | + function include_lang($context='common') |
|
| 46 | + { |
|
| 44 | 47 | global $modx; |
| 45 | 48 | $_lang = array(); |
| 46 | 49 | |
| 47 | 50 | $context = trim($context,'/'); |
| 48 | - if(strpos($context,'..')!==false) return; |
|
| 51 | + if(strpos($context,'..')!==false) { |
|
| 52 | + return; |
|
| 53 | + } |
|
| 49 | 54 | |
| 50 | - if($context === 'common') |
|
| 51 | - $lang_path = MODX_MANAGER_PATH . 'includes/lang/'; |
|
| 52 | - else |
|
| 53 | - $lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/"; |
|
| 55 | + if($context === 'common') { |
|
| 56 | + $lang_path = MODX_MANAGER_PATH . 'includes/lang/'; |
|
| 57 | + } else { |
|
| 58 | + $lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/"; |
|
| 59 | + } |
|
| 54 | 60 | include_once($lang_path . 'english.inc.php'); |
| 55 | 61 | $manager_language = $modx->config['manager_language']; |
| 56 | - if(is_file("{$lang_path}{$manager_language}.inc.php")) |
|
| 57 | - include_once("{$lang_path}{$manager_language}.inc.php"); |
|
| 62 | + if(is_file("{$lang_path}{$manager_language}.inc.php")) { |
|
| 63 | + include_once("{$lang_path}{$manager_language}.inc.php"); |
|
| 64 | + } |
|
| 58 | 65 | return $_lang; |
| 59 | 66 | } |
| 60 | 67 | |
| 61 | - function setError($errorcode, $custommessage=""){ |
|
| 68 | + function setError($errorcode, $custommessage="") |
|
| 69 | + { |
|
| 62 | 70 | $this->errorcode=$errorcode; |
| 63 | 71 | $this->errormessage=$this->errors[$errorcode]; |
| 64 | 72 | if($custommessage!="") { |
@@ -66,11 +74,13 @@ discard block |
||
| 66 | 74 | } |
| 67 | 75 | } |
| 68 | 76 | |
| 69 | - function getError() { |
|
| 77 | + function getError() |
|
| 78 | + { |
|
| 70 | 79 | return $this->errorcode; |
| 71 | 80 | } |
| 72 | 81 | |
| 73 | - function dumpError(){ |
|
| 82 | + function dumpError() |
|
| 83 | + { |
|
| 74 | 84 | ?> |
| 75 | 85 | <html> |
| 76 | 86 | <head> |
@@ -2224,11 +2224,11 @@ discard block |
||
| 2224 | 2224 | if (isset($this->snippetCache[$snip_name])) { |
| 2225 | 2225 | $snippetObject['name'] = $snip_name; |
| 2226 | 2226 | $snippetObject['content'] = $this->snippetCache[$snip_name]; |
| 2227 | - if (isset($this->snippetCache["{$snip_name}Props"])) { |
|
| 2228 | - if (!isset($this->snippetCache["{$snip_name}Props"])) { |
|
| 2229 | - $this->snippetCache["{$snip_name}Props"] = ''; |
|
| 2227 | + if (isset($this->snippetCache["{$snip_name}props"])) { |
|
| 2228 | + if (!isset($this->snippetCache["{$snip_name}props"])) { |
|
| 2229 | + $this->snippetCache["{$snip_name}props"] = ''; |
|
| 2230 | 2230 | } |
| 2231 | - $snippetObject['properties'] = $this->snippetCache["{$snip_name}Props"]; |
|
| 2231 | + $snippetObject['properties'] = $this->snippetCache["{$snip_name}props"]; |
|
| 2232 | 2232 | } |
| 2233 | 2233 | } elseif (substr($snip_name, 0, 1) === '@' && isset($this->pluginEvent[trim($snip_name, '@')])) { |
| 2234 | 2234 | $snippetObject['name'] = trim($snip_name, '@'); |
@@ -2253,7 +2253,7 @@ discard block |
||
| 2253 | 2253 | $snippetObject['content'] = $snip_content; |
| 2254 | 2254 | $snippetObject['properties'] = $snip_prop; |
| 2255 | 2255 | $this->snippetCache[$snip_name] = $snip_content; |
| 2256 | - $this->snippetCache["{$snip_name}Props"] = $snip_prop; |
|
| 2256 | + $this->snippetCache["{$snip_name}props"] = $snip_prop; |
|
| 2257 | 2257 | } |
| 2258 | 2258 | return $snippetObject; |
| 2259 | 2259 | } |
@@ -3569,7 +3569,7 @@ discard block |
||
| 3569 | 3569 | } |
| 3570 | 3570 | // build query |
| 3571 | 3571 | $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
| 3572 | - $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
|
| 3572 | + $result = $this->db->select("distinct {$fields}", "{$tblsc} sc |
|
| 3573 | 3573 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}"); |
| 3574 | 3574 | $resourceArray = $this->db->makeArray($result); |
| 3575 | 3575 | $this->tmpCache[__FUNCTION__][$cacheKey] = $resourceArray; |
@@ -3606,7 +3606,7 @@ discard block |
||
| 3606 | 3606 | } |
| 3607 | 3607 | // build query |
| 3608 | 3608 | $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
| 3609 | - $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
|
| 3609 | + $result = $this->db->select("distinct {$fields}", "{$tblsc} sc |
|
| 3610 | 3610 | 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}"); |
| 3611 | 3611 | $resourceArray = $this->db->makeArray($result); |
| 3612 | 3612 | |
@@ -3662,7 +3662,7 @@ discard block |
||
| 3662 | 3662 | $tblsc = $this->getFullTableName('site_content'); |
| 3663 | 3663 | $tbldg = $this->getFullTableName('document_groups'); |
| 3664 | 3664 | |
| 3665 | - $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
|
| 3665 | + $result = $this->db->select("distinct {$fields}", "{$tblsc} sc |
|
| 3666 | 3666 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$parentid}' {$published} {$deleted} {$where} AND ({$access}) GROUP BY sc.id", ($sort ? "{$sort} {$dir}" : ""), $limit); |
| 3667 | 3667 | |
| 3668 | 3668 | $resourceArray = $this->db->makeArray($result); |
@@ -3728,7 +3728,7 @@ discard block |
||
| 3728 | 3728 | $tblsc = $this->getFullTableName('site_content'); |
| 3729 | 3729 | $tbldg = $this->getFullTableName('document_groups'); |
| 3730 | 3730 | |
| 3731 | - $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
|
| 3731 | + $result = $this->db->select("distinct {$fields}", "{$tblsc} sc |
|
| 3732 | 3732 | 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); |
| 3733 | 3733 | |
| 3734 | 3734 | $resourceArray = $this->db->makeArray($result); |
@@ -4320,7 +4320,7 @@ discard block |
||
| 4320 | 4320 | $template = $doc['content']; |
| 4321 | 4321 | break; |
| 4322 | 4322 | case 'SELECT': |
| 4323 | - $this->db->getValue($this->db->query("SELECT {$template}")); |
|
| 4323 | + $this->db->getValue($this->db->query("select {$template}")); |
|
| 4324 | 4324 | break; |
| 4325 | 4325 | default: |
| 4326 | 4326 | if (!($template = $this->getChunk($tpl))) { |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | * MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php" |
| 253 | 253 | * $extname - extension name in lowercase |
| 254 | 254 | * |
| 255 | - * @param $extname |
|
| 255 | + * @param string $extname |
|
| 256 | 256 | * @param bool $reload |
| 257 | 257 | * @return bool |
| 258 | 258 | */ |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | * @param int $count_attempts |
| 296 | 296 | * @param string $type $type |
| 297 | 297 | * @param string $responseCode |
| 298 | - * @return bool |
|
| 298 | + * @return false|null |
|
| 299 | 299 | * @global string $base_url |
| 300 | 300 | * @global string $site_url |
| 301 | 301 | */ |
@@ -995,7 +995,7 @@ discard block |
||
| 995 | 995 | } |
| 996 | 996 | |
| 997 | 997 | /** |
| 998 | - * @param $contents |
|
| 998 | + * @param string $contents |
|
| 999 | 999 | * @return mixed |
| 1000 | 1000 | */ |
| 1001 | 1001 | public function RecoveryEscapedTags($contents) |
@@ -1019,7 +1019,7 @@ discard block |
||
| 1019 | 1019 | } |
| 1020 | 1020 | |
| 1021 | 1021 | /** |
| 1022 | - * @param $tstart |
|
| 1022 | + * @param double $tstart |
|
| 1023 | 1023 | * @return array |
| 1024 | 1024 | */ |
| 1025 | 1025 | public function getTimerStats($tstart) |
@@ -1771,7 +1771,7 @@ discard block |
||
| 1771 | 1771 | |
| 1772 | 1772 | /** |
| 1773 | 1773 | * Remove Comment-Tags from output like <!--@- Comment -@--> |
| 1774 | - * @param $content |
|
| 1774 | + * @param string $content |
|
| 1775 | 1775 | * @param string $left |
| 1776 | 1776 | * @param string $right |
| 1777 | 1777 | * @return mixed |
@@ -1944,7 +1944,7 @@ discard block |
||
| 1944 | 1944 | /** |
| 1945 | 1945 | * Run snippets as per the tags in $documentSource and replace the tags with the returned values. |
| 1946 | 1946 | * |
| 1947 | - * @param $content |
|
| 1947 | + * @param string $content |
|
| 1948 | 1948 | * @return string |
| 1949 | 1949 | * @internal param string $documentSource |
| 1950 | 1950 | */ |
@@ -2977,7 +2977,7 @@ discard block |
||
| 2977 | 2977 | |
| 2978 | 2978 | /** |
| 2979 | 2979 | * @param $templateID |
| 2980 | - * @return mixed |
|
| 2980 | + * @return string |
|
| 2981 | 2981 | */ |
| 2982 | 2982 | public function _getTemplateCodeFromDB($templateID) |
| 2983 | 2983 | { |
@@ -3018,9 +3018,9 @@ discard block |
||
| 3018 | 3018 | } |
| 3019 | 3019 | |
| 3020 | 3020 | /** |
| 3021 | - * @param $id |
|
| 3021 | + * @param integer $id |
|
| 3022 | 3022 | * @param int $top |
| 3023 | - * @return mixed |
|
| 3023 | + * @return string |
|
| 3024 | 3024 | */ |
| 3025 | 3025 | public function getUltimateParentId($id, $top = 0) |
| 3026 | 3026 | { |
@@ -3351,7 +3351,7 @@ discard block |
||
| 3351 | 3351 | * |
| 3352 | 3352 | * @param int $type Types: 1=template, 2=tv, 3=chunk, 4=snippet, 5=plugin, 6=module, 7=resource, 8=role |
| 3353 | 3353 | * @param int $id Element- / Resource-id |
| 3354 | - * @return bool |
|
| 3354 | + * @return false|null |
|
| 3355 | 3355 | */ |
| 3356 | 3356 | public function lockElement($type, $id) |
| 3357 | 3357 | { |
@@ -3373,7 +3373,7 @@ discard block |
||
| 3373 | 3373 | * @param int $type Types: 1=template, 2=tv, 3=chunk, 4=snippet, 5=plugin, 6=module, 7=resource, 8=role |
| 3374 | 3374 | * @param int $id Element- / Resource-id |
| 3375 | 3375 | * @param bool $includeAllUsers true = Deletes not only own user-locks |
| 3376 | - * @return bool |
|
| 3376 | + * @return false|null |
|
| 3377 | 3377 | */ |
| 3378 | 3378 | public function unlockElement($type, $id, $includeAllUsers = false) |
| 3379 | 3379 | { |
@@ -3481,7 +3481,7 @@ discard block |
||
| 3481 | 3481 | * @param array $params |
| 3482 | 3482 | * @param string $msg |
| 3483 | 3483 | * @param array $files |
| 3484 | - * @return mixed |
|
| 3484 | + * @return boolean |
|
| 3485 | 3485 | */ |
| 3486 | 3486 | public function sendmail($params = array(), $msg = '', $files = array()) |
| 3487 | 3487 | { |
@@ -3977,7 +3977,7 @@ discard block |
||
| 3977 | 3977 | * |
| 3978 | 3978 | * @param string $type |
| 3979 | 3979 | * @param bool $report |
| 3980 | - * @return bool |
|
| 3980 | + * @return boolean|null |
|
| 3981 | 3981 | */ |
| 3982 | 3982 | public function clearCache($type = '', $report = false) |
| 3983 | 3983 | { |
@@ -5322,7 +5322,7 @@ discard block |
||
| 5322 | 5322 | * Remove event listener - only for use within the current execution cycle |
| 5323 | 5323 | * |
| 5324 | 5324 | * @param string $evtName |
| 5325 | - * @return boolean |
|
| 5325 | + * @return false|null |
|
| 5326 | 5326 | */ |
| 5327 | 5327 | public function removeEventListener($evtName) |
| 5328 | 5328 | { |
@@ -5346,7 +5346,7 @@ discard block |
||
| 5346 | 5346 | * |
| 5347 | 5347 | * @param string $evtName |
| 5348 | 5348 | * @param array $extParams Parameters available to plugins. Each array key will be the PHP variable name, and the array value will be the variable value. |
| 5349 | - * @return boolean|array |
|
| 5349 | + * @return false|null |
|
| 5350 | 5350 | */ |
| 5351 | 5351 | public function invokeEvent($evtName, $extParams = array()) |
| 5352 | 5352 | { |
@@ -5767,7 +5767,7 @@ discard block |
||
| 5767 | 5767 | |
| 5768 | 5768 | /** |
| 5769 | 5769 | * @param string $string |
| 5770 | - * @return mixed|string |
|
| 5770 | + * @return string |
|
| 5771 | 5771 | */ |
| 5772 | 5772 | public function removeSanitizeSeed($string = '') |
| 5773 | 5773 | { |
@@ -5782,7 +5782,7 @@ discard block |
||
| 5782 | 5782 | |
| 5783 | 5783 | /** |
| 5784 | 5784 | * @param string $content |
| 5785 | - * @return mixed|string |
|
| 5785 | + * @return string |
|
| 5786 | 5786 | */ |
| 5787 | 5787 | public function cleanUpMODXTags($content = '') |
| 5788 | 5788 | { |
@@ -5945,7 +5945,7 @@ discard block |
||
| 5945 | 5945 | |
| 5946 | 5946 | /** |
| 5947 | 5947 | * @param string $str |
| 5948 | - * @return bool|mixed|string |
|
| 5948 | + * @return string |
|
| 5949 | 5949 | */ |
| 5950 | 5950 | public function atBindFileContent($str = '') |
| 5951 | 5951 | { |
@@ -5996,8 +5996,8 @@ discard block |
||
| 5996 | 5996 | } |
| 5997 | 5997 | |
| 5998 | 5998 | /** |
| 5999 | - * @param $str |
|
| 6000 | - * @return bool|string |
|
| 5999 | + * @param string $str |
|
| 6000 | + * @return false|string |
|
| 6001 | 6001 | */ |
| 6002 | 6002 | public function getExtFromFilename($str) |
| 6003 | 6003 | { |
@@ -6025,7 +6025,7 @@ discard block |
||
| 6025 | 6025 | * @param string $text Error message |
| 6026 | 6026 | * @param string $file File where the error was detected |
| 6027 | 6027 | * @param string $line Line number within $file |
| 6028 | - * @return boolean |
|
| 6028 | + * @return boolean|null |
|
| 6029 | 6029 | */ |
| 6030 | 6030 | public function phpError($nr, $text, $file, $line) |
| 6031 | 6031 | { |
@@ -6077,7 +6077,7 @@ discard block |
||
| 6077 | 6077 | * @param string $text |
| 6078 | 6078 | * @param string $line |
| 6079 | 6079 | * @param string $output |
| 6080 | - * @return bool |
|
| 6080 | + * @return null|boolean |
|
| 6081 | 6081 | */ |
| 6082 | 6082 | public function messageQuit($msg = 'unspecified error', $query = '', $is_error = true, $nr = '', $file = '', $source = '', $text = '', $line = '', $output = '') |
| 6083 | 6083 | { |
@@ -6499,7 +6499,7 @@ discard block |
||
| 6499 | 6499 | |
| 6500 | 6500 | /** |
| 6501 | 6501 | * @param string $str |
| 6502 | - * @return bool|mixed|string |
|
| 6502 | + * @return string |
|
| 6503 | 6503 | */ |
| 6504 | 6504 | public function atBindInclude($str = '') |
| 6505 | 6505 | { |
@@ -6550,7 +6550,7 @@ discard block |
||
| 6550 | 6550 | * @param $str |
| 6551 | 6551 | * @param int $flags |
| 6552 | 6552 | * @param string $encode |
| 6553 | - * @return mixed |
|
| 6553 | + * @return string |
|
| 6554 | 6554 | */ |
| 6555 | 6555 | public function htmlspecialchars($str, $flags = ENT_COMPAT, $encode = '') |
| 6556 | 6556 | { |
@@ -6559,7 +6559,7 @@ discard block |
||
| 6559 | 6559 | } |
| 6560 | 6560 | |
| 6561 | 6561 | /** |
| 6562 | - * @param $string |
|
| 6562 | + * @param string $string |
|
| 6563 | 6563 | * @param bool $returnData |
| 6564 | 6564 | * @return bool|mixed |
| 6565 | 6565 | */ |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | */ |
| 202 | 202 | function __call($method_name, $arguments) |
| 203 | 203 | { |
| 204 | - include_once(MODX_MANAGER_PATH . 'includes/extenders/deprecated.functions.inc.php'); |
|
| 204 | + include_once(MODX_MANAGER_PATH.'includes/extenders/deprecated.functions.inc.php'); |
|
| 205 | 205 | if (method_exists($this->old, $method_name)) { |
| 206 | 206 | $error_type = 1; |
| 207 | 207 | } else { |
@@ -219,12 +219,12 @@ discard block |
||
| 219 | 219 | $info = debug_backtrace(); |
| 220 | 220 | $m[] = $msg; |
| 221 | 221 | if (!empty($this->currentSnippet)) { |
| 222 | - $m[] = 'Snippet - ' . $this->currentSnippet; |
|
| 222 | + $m[] = 'Snippet - '.$this->currentSnippet; |
|
| 223 | 223 | } elseif (!empty($this->event->activePlugin)) { |
| 224 | - $m[] = 'Plugin - ' . $this->event->activePlugin; |
|
| 224 | + $m[] = 'Plugin - '.$this->event->activePlugin; |
|
| 225 | 225 | } |
| 226 | 226 | $m[] = $this->decoded_request_uri; |
| 227 | - $m[] = str_replace('\\', '/', $info[0]['file']) . '(line:' . $info[0]['line'] . ')'; |
|
| 227 | + $m[] = str_replace('\\', '/', $info[0]['file']).'(line:'.$info[0]['line'].')'; |
|
| 228 | 228 | $msg = implode('<br />', $m); |
| 229 | 229 | $this->logEvent(0, $error_type, $msg, $title); |
| 230 | 230 | } |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | { |
| 242 | 242 | $flag = false; |
| 243 | 243 | if (is_scalar($connector) && !empty($connector) && isset($this->{$connector}) && $this->{$connector} instanceof DBAPI) { |
| 244 | - $flag = (bool)$this->{$connector}->conn; |
|
| 244 | + $flag = (bool) $this->{$connector}->conn; |
|
| 245 | 245 | } |
| 246 | 246 | return $flag; |
| 247 | 247 | } |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | } |
| 269 | 269 | if (!$out && $flag) { |
| 270 | 270 | $extname = trim(str_replace(array('..', '/', '\\'), '', strtolower($extname))); |
| 271 | - $filename = MODX_MANAGER_PATH . "includes/extenders/ex_{$extname}.inc.php"; |
|
| 271 | + $filename = MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php"; |
|
| 272 | 272 | $out = is_file($filename) ? include $filename : false; |
| 273 | 273 | } |
| 274 | 274 | if ($out && !in_array($extname, $this->extensions)) { |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | public function getMicroTime() |
| 286 | 286 | { |
| 287 | 287 | list ($usec, $sec) = explode(' ', microtime()); |
| 288 | - return ((float)$usec + (float)$sec); |
|
| 288 | + return ((float) $usec + (float) $sec); |
|
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | /** |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | // append the redirect count string to the url |
| 310 | 310 | $currentNumberOfRedirects = isset ($_REQUEST['err']) ? $_REQUEST['err'] : 0; |
| 311 | 311 | if ($currentNumberOfRedirects > 3) { |
| 312 | - $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>' . $url . '</i></p>'); |
|
| 312 | + $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>'.$url.'</i></p>'); |
|
| 313 | 313 | } else { |
| 314 | 314 | $currentNumberOfRedirects += 1; |
| 315 | 315 | if (strpos($url, "?") > 0) { |
@@ -320,9 +320,9 @@ discard block |
||
| 320 | 320 | } |
| 321 | 321 | } |
| 322 | 322 | if ($type == 'REDIRECT_REFRESH') { |
| 323 | - $header = 'Refresh: 0;URL=' . $url; |
|
| 323 | + $header = 'Refresh: 0;URL='.$url; |
|
| 324 | 324 | } elseif ($type == 'REDIRECT_META') { |
| 325 | - $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=' . $url . '" />'; |
|
| 325 | + $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL='.$url.'" />'; |
|
| 326 | 326 | echo $header; |
| 327 | 327 | exit; |
| 328 | 328 | } elseif ($type == 'REDIRECT_HEADER' || empty ($type)) { |
@@ -330,10 +330,10 @@ discard block |
||
| 330 | 330 | global $base_url, $site_url; |
| 331 | 331 | if (substr($url, 0, strlen($base_url)) == $base_url) { |
| 332 | 332 | // append $site_url to make it work with Location: |
| 333 | - $url = $site_url . substr($url, strlen($base_url)); |
|
| 333 | + $url = $site_url.substr($url, strlen($base_url)); |
|
| 334 | 334 | } |
| 335 | 335 | if (strpos($url, "\n") === false) { |
| 336 | - $header = 'Location: ' . $url; |
|
| 336 | + $header = 'Location: '.$url; |
|
| 337 | 337 | } else { |
| 338 | 338 | $this->messageQuit('No newline allowed in redirect url.'); |
| 339 | 339 | } |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | header($responseCode); |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | - if(!empty($header)) { |
|
| 345 | + if (!empty($header)) { |
|
| 346 | 346 | header($header); |
| 347 | 347 | } |
| 348 | 348 | |
@@ -446,8 +446,8 @@ discard block |
||
| 446 | 446 | |
| 447 | 447 | private function recoverySiteCache() |
| 448 | 448 | { |
| 449 | - $site_cache_dir = MODX_BASE_PATH . $this->getCacheFolder(); |
|
| 450 | - $site_cache_path = $site_cache_dir . 'siteCache.idx.php'; |
|
| 449 | + $site_cache_dir = MODX_BASE_PATH.$this->getCacheFolder(); |
|
| 450 | + $site_cache_path = $site_cache_dir.'siteCache.idx.php'; |
|
| 451 | 451 | |
| 452 | 452 | if (is_file($site_cache_path)) { |
| 453 | 453 | include($site_cache_path); |
@@ -456,7 +456,7 @@ discard block |
||
| 456 | 456 | return; |
| 457 | 457 | } |
| 458 | 458 | |
| 459 | - include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php'); |
|
| 459 | + include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php'); |
|
| 460 | 460 | $cache = new synccache(); |
| 461 | 461 | $cache->setCachepath($site_cache_dir); |
| 462 | 462 | $cache->setReport(false); |
@@ -507,8 +507,8 @@ discard block |
||
| 507 | 507 | $this->invokeEvent("OnBeforeManagerPageInit"); |
| 508 | 508 | } |
| 509 | 509 | |
| 510 | - if (isset ($_SESSION[$usrType . 'UsrConfigSet'])) { |
|
| 511 | - $usrSettings = &$_SESSION[$usrType . 'UsrConfigSet']; |
|
| 510 | + if (isset ($_SESSION[$usrType.'UsrConfigSet'])) { |
|
| 511 | + $usrSettings = &$_SESSION[$usrType.'UsrConfigSet']; |
|
| 512 | 512 | } else { |
| 513 | 513 | if ($usrType == 'web') { |
| 514 | 514 | $from = $tbl_web_user_settings; |
@@ -528,7 +528,7 @@ discard block |
||
| 528 | 528 | $usrSettings[$row['setting_name']] = $row['setting_value']; |
| 529 | 529 | } |
| 530 | 530 | if (isset ($usrType)) { |
| 531 | - $_SESSION[$usrType . 'UsrConfigSet'] = $usrSettings; |
|
| 531 | + $_SESSION[$usrType.'UsrConfigSet'] = $usrSettings; |
|
| 532 | 532 | } // store user settings in session |
| 533 | 533 | } |
| 534 | 534 | } |
@@ -673,10 +673,10 @@ discard block |
||
| 673 | 673 | $suf = $this->config['friendly_url_suffix']; |
| 674 | 674 | $pre = preg_quote($pre, '/'); |
| 675 | 675 | $suf = preg_quote($suf, '/'); |
| 676 | - if ($pre && preg_match('@^' . $pre . '(.*)$@', $q, $_)) { |
|
| 676 | + if ($pre && preg_match('@^'.$pre.'(.*)$@', $q, $_)) { |
|
| 677 | 677 | $q = $_[1]; |
| 678 | 678 | } |
| 679 | - if ($suf && preg_match('@(.*)' . $suf . '$@', $q, $_)) { |
|
| 679 | + if ($suf && preg_match('@(.*)'.$suf.'$@', $q, $_)) { |
|
| 680 | 680 | $q = $_[1]; |
| 681 | 681 | } |
| 682 | 682 | |
@@ -698,7 +698,7 @@ discard block |
||
| 698 | 698 | 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 | 699 | /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */ |
| 700 | 700 | if ($this->config['use_alias_path'] == 1) { |
| 701 | - 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))))) { |
|
| 701 | + 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 | 702 | $this->documentMethod = 'id'; |
| 703 | 703 | return $q; |
| 704 | 704 | } else { /* not a valid id in terms of virtualDir, treat as alias */ |
@@ -732,7 +732,7 @@ discard block |
||
| 732 | 732 | */ |
| 733 | 733 | public function getHashFile($key) |
| 734 | 734 | { |
| 735 | - return $this->getCacheFolder() . "docid_" . $key . ".pageCache.php"; |
|
| 735 | + return $this->getCacheFolder()."docid_".$key.".pageCache.php"; |
|
| 736 | 736 | } |
| 737 | 737 | |
| 738 | 738 | /** |
@@ -743,9 +743,9 @@ discard block |
||
| 743 | 743 | $hash = $id; |
| 744 | 744 | $tmp = null; |
| 745 | 745 | $params = array(); |
| 746 | - if(!empty($this->systemCacheKey)){ |
|
| 746 | + if (!empty($this->systemCacheKey)) { |
|
| 747 | 747 | $hash = $this->systemCacheKey; |
| 748 | - }else { |
|
| 748 | + } else { |
|
| 749 | 749 | if (!empty($_GET)) { |
| 750 | 750 | // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID. |
| 751 | 751 | $params = $_GET; |
@@ -753,8 +753,8 @@ discard block |
||
| 753 | 753 | $hash .= '_'.md5(http_build_query($params)); |
| 754 | 754 | } |
| 755 | 755 | } |
| 756 | - $evtOut = $this->invokeEvent("OnMakePageCacheKey", array ("hash" => $hash, "id" => $id, 'params' => $params)); |
|
| 757 | - if (is_array($evtOut) && count($evtOut) > 0){ |
|
| 756 | + $evtOut = $this->invokeEvent("OnMakePageCacheKey", array("hash" => $hash, "id" => $id, 'params' => $params)); |
|
| 757 | + if (is_array($evtOut) && count($evtOut) > 0) { |
|
| 758 | 758 | $tmp = array_pop($evtOut); |
| 759 | 759 | } |
| 760 | 760 | return empty($tmp) ? $hash : $tmp; |
@@ -896,12 +896,12 @@ discard block |
||
| 896 | 896 | if ($js = $this->getRegisteredClientStartupScripts()) { |
| 897 | 897 | // change to just before closing </head> |
| 898 | 898 | // $this->documentContent = preg_replace("/(<head[^>]*>)/i", "\\1\n".$js, $this->documentContent); |
| 899 | - $this->documentOutput = preg_replace("/(<\/head>)/i", $js . "\n\\1", $this->documentOutput); |
|
| 899 | + $this->documentOutput = preg_replace("/(<\/head>)/i", $js."\n\\1", $this->documentOutput); |
|
| 900 | 900 | } |
| 901 | 901 | |
| 902 | 902 | // Insert jscripts & html block into template - template must have a </body> tag |
| 903 | 903 | if ($js = $this->getRegisteredClientScripts()) { |
| 904 | - $this->documentOutput = preg_replace("/(<\/body>)/i", $js . "\n\\1", $this->documentOutput); |
|
| 904 | + $this->documentOutput = preg_replace("/(<\/body>)/i", $js."\n\\1", $this->documentOutput); |
|
| 905 | 905 | } |
| 906 | 906 | // End fix by sirlancelot |
| 907 | 907 | |
@@ -912,7 +912,7 @@ discard block |
||
| 912 | 912 | // send out content-type and content-disposition headers |
| 913 | 913 | if (IN_PARSER_MODE == "true") { |
| 914 | 914 | $type = !empty ($this->contentTypes[$this->documentIdentifier]) ? $this->contentTypes[$this->documentIdentifier] : "text/html"; |
| 915 | - header('Content-Type: ' . $type . '; charset=' . $this->config['modx_charset']); |
|
| 915 | + header('Content-Type: '.$type.'; charset='.$this->config['modx_charset']); |
|
| 916 | 916 | // if (($this->documentIdentifier == $this->config['error_page']) || $redirect_error) |
| 917 | 917 | // header('HTTP/1.0 404 Not Found'); |
| 918 | 918 | if (!$this->checkPreview() && $this->documentObject['content_dispo'] == 1) { |
@@ -930,7 +930,7 @@ discard block |
||
| 930 | 930 | $name = preg_replace('|-+|', '-', $name); |
| 931 | 931 | $name = trim($name, '-'); |
| 932 | 932 | } |
| 933 | - $header = 'Content-Disposition: attachment; filename=' . $name; |
|
| 933 | + $header = 'Content-Disposition: attachment; filename='.$name; |
|
| 934 | 934 | header($header); |
| 935 | 935 | } |
| 936 | 936 | } |
@@ -938,7 +938,7 @@ discard block |
||
| 938 | 938 | |
| 939 | 939 | $stats = $this->getTimerStats($this->tstart); |
| 940 | 940 | |
| 941 | - $out =& $this->documentOutput; |
|
| 941 | + $out = & $this->documentOutput; |
|
| 942 | 942 | $out = str_replace("[^q^]", $stats['queries'], $out); |
| 943 | 943 | $out = str_replace("[^qt^]", $stats['queryTime'], $out); |
| 944 | 944 | $out = str_replace("[^p^]", $stats['phpTime'], $out); |
@@ -977,17 +977,17 @@ discard block |
||
| 977 | 977 | $sc .= sprintf("%s. %s (%s)<br>", $s, $sname, sprintf("%2.2f ms", $t)); // currentSnippet |
| 978 | 978 | $tt += $t; |
| 979 | 979 | } |
| 980 | - echo "<fieldset><legend><b>Snippets</b> (" . count($this->snippetsTime) . " / " . sprintf("%2.2f ms", $tt) . ")</legend>{$sc}</fieldset><br />"; |
|
| 980 | + echo "<fieldset><legend><b>Snippets</b> (".count($this->snippetsTime)." / ".sprintf("%2.2f ms", $tt).")</legend>{$sc}</fieldset><br />"; |
|
| 981 | 981 | echo $this->snippetsCode; |
| 982 | 982 | } |
| 983 | 983 | if ($this->dumpPlugins) { |
| 984 | 984 | $ps = ""; |
| 985 | 985 | $tt = 0; |
| 986 | 986 | foreach ($this->pluginsTime as $s => $t) { |
| 987 | - $ps .= "$s (" . sprintf("%2.2f ms", $t * 1000) . ")<br>"; |
|
| 987 | + $ps .= "$s (".sprintf("%2.2f ms", $t * 1000).")<br>"; |
|
| 988 | 988 | $tt += $t; |
| 989 | 989 | } |
| 990 | - echo "<fieldset><legend><b>Plugins</b> (" . count($this->pluginsTime) . " / " . sprintf("%2.2f ms", $tt * 1000) . ")</legend>{$ps}</fieldset><br />"; |
|
| 990 | + echo "<fieldset><legend><b>Plugins</b> (".count($this->pluginsTime)." / ".sprintf("%2.2f ms", $tt * 1000).")</legend>{$ps}</fieldset><br />"; |
|
| 991 | 991 | echo $this->pluginsCode; |
| 992 | 992 | } |
| 993 | 993 | |
@@ -1013,7 +1013,7 @@ discard block |
||
| 1013 | 1013 | $srcTags = explode(',', $tags); |
| 1014 | 1014 | $repTags = array(); |
| 1015 | 1015 | foreach ($srcTags as $tag) { |
| 1016 | - $repTags[] = '\\' . $tag[0] . '\\' . $tag[1]; |
|
| 1016 | + $repTags[] = '\\'.$tag[0].'\\'.$tag[1]; |
|
| 1017 | 1017 | } |
| 1018 | 1018 | return array($srcTags, $repTags); |
| 1019 | 1019 | } |
@@ -1035,7 +1035,7 @@ discard block |
||
| 1035 | 1035 | $stats['phpTime'] = sprintf("%2.4f s", $stats['phpTime']); |
| 1036 | 1036 | $stats['source'] = $this->documentGenerated == 1 ? "database" : "cache"; |
| 1037 | 1037 | $stats['queries'] = isset ($this->executedQueries) ? $this->executedQueries : 0; |
| 1038 | - $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024) . " mb"; |
|
| 1038 | + $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024)." mb"; |
|
| 1039 | 1039 | |
| 1040 | 1040 | return $stats; |
| 1041 | 1041 | } |
@@ -1068,7 +1068,7 @@ discard block |
||
| 1068 | 1068 | { |
| 1069 | 1069 | $cacheRefreshTime = 0; |
| 1070 | 1070 | $recent_update = 0; |
| 1071 | - @include(MODX_BASE_PATH . $this->getCacheFolder() . 'sitePublishing.idx.php'); |
|
| 1071 | + @include(MODX_BASE_PATH.$this->getCacheFolder().'sitePublishing.idx.php'); |
|
| 1072 | 1072 | $this->recentUpdate = $recent_update; |
| 1073 | 1073 | |
| 1074 | 1074 | $timeNow = $_SERVER['REQUEST_TIME'] + $this->config['server_offset_time']; |
@@ -1122,8 +1122,8 @@ discard block |
||
| 1122 | 1122 | } |
| 1123 | 1123 | |
| 1124 | 1124 | $docObjSerial = serialize($this->documentObject); |
| 1125 | - $cacheContent = $docObjSerial . "<!--__MODxCacheSpliter__-->" . $this->documentContent; |
|
| 1126 | - $page_cache_path = MODX_BASE_PATH . $this->getHashFile($this->cacheKey); |
|
| 1125 | + $cacheContent = $docObjSerial."<!--__MODxCacheSpliter__-->".$this->documentContent; |
|
| 1126 | + $page_cache_path = MODX_BASE_PATH.$this->getHashFile($this->cacheKey); |
|
| 1127 | 1127 | file_put_contents($page_cache_path, "<?php die('Unauthorized access.'); ?>$cacheContent"); |
| 1128 | 1128 | } |
| 1129 | 1129 | } |
@@ -1165,16 +1165,16 @@ discard block |
||
| 1165 | 1165 | return array(); |
| 1166 | 1166 | } |
| 1167 | 1167 | $spacer = md5('<<<EVO>>>'); |
| 1168 | - if($left==='{{' && strpos($content,';}}')!==false) $content = str_replace(';}}', sprintf(';}%s}', $spacer),$content); |
|
| 1169 | - if($left==='{{' && strpos($content,'{{}}')!==false) $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content); |
|
| 1170 | - if($left==='[[' && strpos($content,']]]]')!==false) $content = str_replace(']]]]',sprintf(']]%s]]', $spacer),$content); |
|
| 1171 | - if($left==='[[' && strpos($content,']]]')!==false) $content = str_replace(']]]', sprintf(']%s]]', $spacer),$content); |
|
| 1168 | + if ($left === '{{' && strpos($content, ';}}') !== false) $content = str_replace(';}}', sprintf(';}%s}', $spacer), $content); |
|
| 1169 | + if ($left === '{{' && strpos($content, '{{}}') !== false) $content = str_replace('{{}}', sprintf('{%$1s{}%$1s}', $spacer), $content); |
|
| 1170 | + if ($left === '[[' && strpos($content, ']]]]') !== false) $content = str_replace(']]]]', sprintf(']]%s]]', $spacer), $content); |
|
| 1171 | + if ($left === '[[' && strpos($content, ']]]') !== false) $content = str_replace(']]]', sprintf(']%s]]', $spacer), $content); |
|
| 1172 | 1172 | |
| 1173 | 1173 | $pos['<![CDATA['] = strpos($content, '<![CDATA['); |
| 1174 | 1174 | $pos[']]>'] = strpos($content, ']]>'); |
| 1175 | 1175 | |
| 1176 | 1176 | if ($pos['<![CDATA['] !== false && $pos[']]>'] !== false) { |
| 1177 | - $content = substr($content, 0, $pos['<![CDATA[']) . substr($content, $pos[']]>'] + 3); |
|
| 1177 | + $content = substr($content, 0, $pos['<![CDATA[']).substr($content, $pos[']]>'] + 3); |
|
| 1178 | 1178 | } |
| 1179 | 1179 | |
| 1180 | 1180 | $lp = explode($left, $content); |
@@ -1238,8 +1238,8 @@ discard block |
||
| 1238 | 1238 | } |
| 1239 | 1239 | } |
| 1240 | 1240 | } |
| 1241 | - foreach($tags as $i=>$tag) { |
|
| 1242 | - if(strpos($tag,$spacer)!==false) $tags[$i] = str_replace($spacer, '', $tag); |
|
| 1241 | + foreach ($tags as $i=>$tag) { |
|
| 1242 | + if (strpos($tag, $spacer) !== false) $tags[$i] = str_replace($spacer, '', $tag); |
|
| 1243 | 1243 | } |
| 1244 | 1244 | return $tags; |
| 1245 | 1245 | } |
@@ -1279,7 +1279,7 @@ discard block |
||
| 1279 | 1279 | } |
| 1280 | 1280 | |
| 1281 | 1281 | foreach ($matches[1] as $i => $key) { |
| 1282 | - if(strpos($key,'[+')!==false) continue; // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
| 1282 | + if (strpos($key, '[+') !== false) continue; // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
| 1283 | 1283 | if (substr($key, 0, 1) == '#') { |
| 1284 | 1284 | $key = substr($key, 1); |
| 1285 | 1285 | } // remove # for QuickEdit format |
@@ -1299,8 +1299,8 @@ discard block |
||
| 1299 | 1299 | } |
| 1300 | 1300 | |
| 1301 | 1301 | if (is_array($value)) { |
| 1302 | - include_once(MODX_MANAGER_PATH . 'includes/tmplvars.format.inc.php'); |
|
| 1303 | - include_once(MODX_MANAGER_PATH . 'includes/tmplvars.commands.inc.php'); |
|
| 1302 | + include_once(MODX_MANAGER_PATH.'includes/tmplvars.format.inc.php'); |
|
| 1303 | + include_once(MODX_MANAGER_PATH.'includes/tmplvars.commands.inc.php'); |
|
| 1304 | 1304 | $value = getTVDisplayFormat($value[0], $value[1], $value[2], $value[3], $value[4]); |
| 1305 | 1305 | } |
| 1306 | 1306 | |
@@ -1311,8 +1311,8 @@ discard block |
||
| 1311 | 1311 | |
| 1312 | 1312 | if (strpos($content, $s) !== false) { |
| 1313 | 1313 | $content = str_replace($s, $value, $content); |
| 1314 | - } elseif($this->debug) { |
|
| 1315 | - $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
| 1314 | + } elseif ($this->debug) { |
|
| 1315 | + $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
| 1316 | 1316 | } |
| 1317 | 1317 | } |
| 1318 | 1318 | |
@@ -1479,8 +1479,8 @@ discard block |
||
| 1479 | 1479 | $s = &$matches[0][$i]; |
| 1480 | 1480 | if (strpos($content, $s) !== false) { |
| 1481 | 1481 | $content = str_replace($s, $value, $content); |
| 1482 | - } elseif($this->debug) { |
|
| 1483 | - $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
| 1482 | + } elseif ($this->debug) { |
|
| 1483 | + $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
| 1484 | 1484 | } |
| 1485 | 1485 | } |
| 1486 | 1486 | return $content; |
@@ -1533,7 +1533,7 @@ discard block |
||
| 1533 | 1533 | } |
| 1534 | 1534 | |
| 1535 | 1535 | $value = $this->parseText($value, $params); // parse local scope placeholers for ConditionalTags |
| 1536 | - $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers |
|
| 1536 | + $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers |
|
| 1537 | 1537 | if ($this->config['enable_at_syntax']) { |
| 1538 | 1538 | $value = $this->mergeConditionalTagsContent($value); |
| 1539 | 1539 | } |
@@ -1548,8 +1548,8 @@ discard block |
||
| 1548 | 1548 | $s = &$matches[0][$i]; |
| 1549 | 1549 | if (strpos($content, $s) !== false) { |
| 1550 | 1550 | $content = str_replace($s, $value, $content); |
| 1551 | - } elseif($this->debug) { |
|
| 1552 | - $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
| 1551 | + } elseif ($this->debug) { |
|
| 1552 | + $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
| 1553 | 1553 | } |
| 1554 | 1554 | } |
| 1555 | 1555 | return $content; |
@@ -1607,8 +1607,8 @@ discard block |
||
| 1607 | 1607 | $s = &$matches[0][$i]; |
| 1608 | 1608 | if (strpos($content, $s) !== false) { |
| 1609 | 1609 | $content = str_replace($s, $value, $content); |
| 1610 | - } elseif($this->debug) { |
|
| 1611 | - $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
| 1610 | + } elseif ($this->debug) { |
|
| 1611 | + $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
| 1612 | 1612 | } |
| 1613 | 1613 | } |
| 1614 | 1614 | return $content; |
@@ -1632,7 +1632,7 @@ discard block |
||
| 1632 | 1632 | return $content; |
| 1633 | 1633 | } |
| 1634 | 1634 | |
| 1635 | - $sp = '#' . md5('ConditionalTags' . $_SERVER['REQUEST_TIME']) . '#'; |
|
| 1635 | + $sp = '#'.md5('ConditionalTags'.$_SERVER['REQUEST_TIME']).'#'; |
|
| 1636 | 1636 | $content = str_replace(array('<?php', '<?=', '<?', '?>'), array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), $content); |
| 1637 | 1637 | |
| 1638 | 1638 | $pieces = explode('<@IF:', $content); |
@@ -1643,7 +1643,7 @@ discard block |
||
| 1643 | 1643 | } |
| 1644 | 1644 | list($cmd, $text) = explode('>', $split, 2); |
| 1645 | 1645 | $cmd = str_replace("'", "\'", $cmd); |
| 1646 | - $content .= "<?php if(\$this->_parseCTagCMD('" . $cmd . "')): ?>"; |
|
| 1646 | + $content .= "<?php if(\$this->_parseCTagCMD('".$cmd."')): ?>"; |
|
| 1647 | 1647 | $content .= $text; |
| 1648 | 1648 | } |
| 1649 | 1649 | $pieces = explode('<@ELSEIF:', $content); |
@@ -1654,13 +1654,13 @@ discard block |
||
| 1654 | 1654 | } |
| 1655 | 1655 | list($cmd, $text) = explode('>', $split, 2); |
| 1656 | 1656 | $cmd = str_replace("'", "\'", $cmd); |
| 1657 | - $content .= "<?php elseif(\$this->_parseCTagCMD('" . $cmd . "')): ?>"; |
|
| 1657 | + $content .= "<?php elseif(\$this->_parseCTagCMD('".$cmd."')): ?>"; |
|
| 1658 | 1658 | $content .= $text; |
| 1659 | 1659 | } |
| 1660 | 1660 | |
| 1661 | 1661 | $content = str_replace(array('<@ELSE>', '<@ENDIF>'), array('<?php else:?>', '<?php endif;?>'), $content); |
| 1662 | 1662 | ob_start(); |
| 1663 | - $content = eval('?>' . $content); |
|
| 1663 | + $content = eval('?>'.$content); |
|
| 1664 | 1664 | $content = ob_get_clean(); |
| 1665 | 1665 | $content = str_replace(array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), array('<?php', '<?=', '<?', '?>'), $content); |
| 1666 | 1666 | |
@@ -1785,7 +1785,7 @@ discard block |
||
| 1785 | 1785 | $matches = $this->getTagsFromContent($content, $left, $right); |
| 1786 | 1786 | if (!empty($matches)) { |
| 1787 | 1787 | foreach ($matches[0] as $i => $v) { |
| 1788 | - $addBreakMatches[$i] = $v . "\n"; |
|
| 1788 | + $addBreakMatches[$i] = $v."\n"; |
|
| 1789 | 1789 | } |
| 1790 | 1790 | $content = str_replace($addBreakMatches, '', $content); |
| 1791 | 1791 | if (strpos($content, $left) !== false) { |
@@ -1818,8 +1818,8 @@ discard block |
||
| 1818 | 1818 | $s = &$matches[0][$i]; |
| 1819 | 1819 | if (strpos($content, $s) !== false) { |
| 1820 | 1820 | $content = str_replace($s, $v, $content); |
| 1821 | - } elseif($this->debug) { |
|
| 1822 | - $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
| 1821 | + } elseif ($this->debug) { |
|
| 1822 | + $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
| 1823 | 1823 | } |
| 1824 | 1824 | } |
| 1825 | 1825 | return $content; |
@@ -1883,7 +1883,7 @@ discard block |
||
| 1883 | 1883 | $msg = ($msg === false) ? 'ob_get_contents() error' : $msg; |
| 1884 | 1884 | $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Plugin', $error_info['message'], $error_info['line'], $msg); |
| 1885 | 1885 | if ($this->isBackend()) { |
| 1886 | - $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>' . $msg . '</p>'); |
|
| 1886 | + $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>'.$msg.'</p>'); |
|
| 1887 | 1887 | } |
| 1888 | 1888 | } |
| 1889 | 1889 | } else { |
@@ -1929,7 +1929,7 @@ discard block |
||
| 1929 | 1929 | $echo = ($echo === false) ? 'ob_get_contents() error' : $echo; |
| 1930 | 1930 | $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Snippet', $error_info['message'], $error_info['line'], $echo); |
| 1931 | 1931 | if ($this->isBackend()) { |
| 1932 | - $this->event->alert('An error occurred while loading. Please see the event log for more information<p>' . $echo . $return . '</p>'); |
|
| 1932 | + $this->event->alert('An error occurred while loading. Please see the event log for more information<p>'.$echo.$return.'</p>'); |
|
| 1933 | 1933 | } |
| 1934 | 1934 | } |
| 1935 | 1935 | } |
@@ -1937,7 +1937,7 @@ discard block |
||
| 1937 | 1937 | if (is_array($return) || is_object($return)) { |
| 1938 | 1938 | return $return; |
| 1939 | 1939 | } else { |
| 1940 | - return $echo . $return; |
|
| 1940 | + return $echo.$return; |
|
| 1941 | 1941 | } |
| 1942 | 1942 | } |
| 1943 | 1943 | |
@@ -1975,8 +1975,8 @@ discard block |
||
| 1975 | 1975 | } |
| 1976 | 1976 | if (strpos($content, $s) !== false) { |
| 1977 | 1977 | $content = str_replace($s, $value, $content); |
| 1978 | - } elseif($this->debug) { |
|
| 1979 | - $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
| 1978 | + } elseif ($this->debug) { |
|
| 1979 | + $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
| 1980 | 1980 | } |
| 1981 | 1981 | continue; |
| 1982 | 1982 | } |
@@ -1987,8 +1987,8 @@ discard block |
||
| 1987 | 1987 | |
| 1988 | 1988 | if (strpos($content, $s) !== false) { |
| 1989 | 1989 | $content = str_replace($s, $value, $content); |
| 1990 | - } elseif($this->debug) { |
|
| 1991 | - $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
| 1990 | + } elseif ($this->debug) { |
|
| 1991 | + $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
| 1992 | 1992 | } |
| 1993 | 1993 | } |
| 1994 | 1994 | |
@@ -2080,7 +2080,7 @@ discard block |
||
| 2080 | 2080 | $eventtime = sprintf('%2.2f ms', $eventtime * 1000); |
| 2081 | 2081 | $code = str_replace("\t", ' ', $this->htmlspecialchars($value)); |
| 2082 | 2082 | $piece = str_replace("\t", ' ', $this->htmlspecialchars($piece)); |
| 2083 | - $print_r_params = str_replace("\t", ' ', $this->htmlspecialchars('$modx->event->params = ' . print_r($params, true))); |
|
| 2083 | + $print_r_params = str_replace("\t", ' ', $this->htmlspecialchars('$modx->event->params = '.print_r($params, true))); |
|
| 2084 | 2084 | $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); |
| 2085 | 2085 | $this->snippetsTime[] = array('sname' => $key, 'time' => $eventtime); |
| 2086 | 2086 | } |
@@ -2324,7 +2324,7 @@ discard block |
||
| 2324 | 2324 | $rs = $this->db->select('name,snippet,properties', '[+prefix+]site_snippets', $where); |
| 2325 | 2325 | $count = $this->db->getRecordCount($rs); |
| 2326 | 2326 | if (1 < $count) { |
| 2327 | - exit('Error $modx->_getSnippetObject()' . $snip_name); |
|
| 2327 | + exit('Error $modx->_getSnippetObject()'.$snip_name); |
|
| 2328 | 2328 | } |
| 2329 | 2329 | if ($count) { |
| 2330 | 2330 | $row = $this->db->getRow($rs); |
@@ -2350,7 +2350,7 @@ discard block |
||
| 2350 | 2350 | public function toAlias($text) |
| 2351 | 2351 | { |
| 2352 | 2352 | $suff = $this->config['friendly_url_suffix']; |
| 2353 | - 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); |
|
| 2353 | + 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 | 2354 | } |
| 2355 | 2355 | |
| 2356 | 2356 | /** |
@@ -2382,7 +2382,7 @@ discard block |
||
| 2382 | 2382 | $suff = '/'; |
| 2383 | 2383 | } |
| 2384 | 2384 | |
| 2385 | - $url = ($dir != '' ? $dir . '/' : '') . $pre . $alias . $suff; |
|
| 2385 | + $url = ($dir != '' ? $dir.'/' : '').$pre.$alias.$suff; |
|
| 2386 | 2386 | } |
| 2387 | 2387 | |
| 2388 | 2388 | $evtOut = $this->invokeEvent('OnMakeDocUrl', array( |
@@ -2419,7 +2419,7 @@ discard block |
||
| 2419 | 2419 | preg_match_all('!\[\~([0-9]+)\~\]!ise', $documentSource, $match); |
| 2420 | 2420 | $ids = implode(',', array_unique($match['1'])); |
| 2421 | 2421 | if ($ids) { |
| 2422 | - $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (" . $ids . ") AND isfolder = '0'"); |
|
| 2422 | + $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (".$ids.") AND isfolder = '0'"); |
|
| 2423 | 2423 | while ($row = $this->db->getRow($res)) { |
| 2424 | 2424 | if ($this->config['use_alias_path'] == '1' && $row['parent'] != 0) { |
| 2425 | 2425 | $parent = $row['parent']; |
@@ -2430,7 +2430,7 @@ discard block |
||
| 2430 | 2430 | $parent = $this->aliasListing[$parent]['parent']; |
| 2431 | 2431 | } |
| 2432 | 2432 | |
| 2433 | - $aliases[$row['id']] = $path . '/' . $row['alias']; |
|
| 2433 | + $aliases[$row['id']] = $path.'/'.$row['alias']; |
|
| 2434 | 2434 | } else { |
| 2435 | 2435 | $aliases[$row['id']] = $row['alias']; |
| 2436 | 2436 | } |
@@ -2442,7 +2442,7 @@ discard block |
||
| 2442 | 2442 | $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0); |
| 2443 | 2443 | $pref = $this->config['friendly_url_prefix']; |
| 2444 | 2444 | $suff = $this->config['friendly_url_suffix']; |
| 2445 | - $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
| 2445 | + $documentSource = preg_replace_callback($in, function($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
| 2446 | 2446 | global $modx; |
| 2447 | 2447 | $thealias = $aliases[$m[1]]; |
| 2448 | 2448 | $thefolder = $isfolder[$m[1]]; |
@@ -2458,7 +2458,7 @@ discard block |
||
| 2458 | 2458 | |
| 2459 | 2459 | } else { |
| 2460 | 2460 | $in = '!\[\~([0-9]+)\~\]!is'; |
| 2461 | - $out = "index.php?id=" . '\1'; |
|
| 2461 | + $out = "index.php?id=".'\1'; |
|
| 2462 | 2462 | $documentSource = preg_replace($in, $out, $documentSource); |
| 2463 | 2463 | } |
| 2464 | 2464 | |
@@ -2479,7 +2479,7 @@ discard block |
||
| 2479 | 2479 | $scheme = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http'; |
| 2480 | 2480 | $len_base_url = strlen($this->config['base_url']); |
| 2481 | 2481 | |
| 2482 | - $url_path = $q;//LANG |
|
| 2482 | + $url_path = $q; //LANG |
|
| 2483 | 2483 | |
| 2484 | 2484 | if (substr($url_path, 0, $len_base_url) === $this->config['base_url']) { |
| 2485 | 2485 | $url_path = substr($url_path, $len_base_url); |
@@ -2491,7 +2491,7 @@ discard block |
||
| 2491 | 2491 | $strictURL = substr($strictURL, $len_base_url); |
| 2492 | 2492 | } |
| 2493 | 2493 | $http_host = $_SERVER['HTTP_HOST']; |
| 2494 | - $requestedURL = "{$scheme}://{$http_host}" . '/' . $q; //LANG |
|
| 2494 | + $requestedURL = "{$scheme}://{$http_host}".'/'.$q; //LANG |
|
| 2495 | 2495 | |
| 2496 | 2496 | $site_url = $this->config['site_url']; |
| 2497 | 2497 | |
@@ -2507,7 +2507,7 @@ discard block |
||
| 2507 | 2507 | } |
| 2508 | 2508 | if ($this->config['base_url'] != $_SERVER['REQUEST_URI']) { |
| 2509 | 2509 | if (empty($_POST)) { |
| 2510 | - if (($this->config['base_url'] . '?' . $qstring) != $_SERVER['REQUEST_URI']) { |
|
| 2510 | + if (($this->config['base_url'].'?'.$qstring) != $_SERVER['REQUEST_URI']) { |
|
| 2511 | 2511 | $this->sendRedirect($url, 0, 'REDIRECT_HEADER', 'HTTP/1.0 301 Moved Permanently'); |
| 2512 | 2512 | exit(0); |
| 2513 | 2513 | } |
@@ -2570,7 +2570,7 @@ discard block |
||
| 2570 | 2570 | $docgrp = implode(",", $docgrp); |
| 2571 | 2571 | } |
| 2572 | 2572 | // get document |
| 2573 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
| 2573 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
| 2574 | 2574 | $rs = $this->db->select('sc.*', "{$tblsc} sc |
| 2575 | 2575 | LEFT JOIN {$tbldg} dg ON dg.document = sc.id", "sc.{$method} = '{$identifier}' AND ({$access})", "", 1); |
| 2576 | 2576 | if ($this->db->getRecordCount($rs) < 1) { |
@@ -2606,9 +2606,9 @@ discard block |
||
| 2606 | 2606 | } |
| 2607 | 2607 | if ($documentObject['template']) { |
| 2608 | 2608 | // load TVs and merge with document - Orig by Apodigm - Docvars |
| 2609 | - $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars") . " tv |
|
| 2610 | - INNER JOIN " . $this->getFullTableName("site_tmplvar_templates") . " tvtpl ON tvtpl.tmplvarid = tv.id |
|
| 2611 | - LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues") . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'"); |
|
| 2609 | + $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars")." tv |
|
| 2610 | + INNER JOIN " . $this->getFullTableName("site_tmplvar_templates")." tvtpl ON tvtpl.tmplvarid = tv.id |
|
| 2611 | + LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues")." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'"); |
|
| 2612 | 2612 | $tmplvars = array(); |
| 2613 | 2613 | while ($row = $this->db->getRow($rs)) { |
| 2614 | 2614 | $tmplvars[$row['name']] = array( |
@@ -2654,7 +2654,7 @@ discard block |
||
| 2654 | 2654 | $st = md5($source); |
| 2655 | 2655 | } |
| 2656 | 2656 | if ($this->dumpSnippets == 1) { |
| 2657 | - $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>"; |
|
| 2657 | + $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 | 2658 | } |
| 2659 | 2659 | |
| 2660 | 2660 | // invoke OnParseDocument event |
@@ -2740,7 +2740,7 @@ discard block |
||
| 2740 | 2740 | |
| 2741 | 2741 | // Check use_alias_path and check if $this->virtualDir is set to anything, then parse the path |
| 2742 | 2742 | if ($this->config['use_alias_path'] == 1) { |
| 2743 | - $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir . '/' : '') . $this->documentIdentifier; |
|
| 2743 | + $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir.'/' : '').$this->documentIdentifier; |
|
| 2744 | 2744 | if (isset($this->documentListing[$alias])) { |
| 2745 | 2745 | $this->documentIdentifier = $this->documentListing[$alias]; |
| 2746 | 2746 | } else { |
@@ -2801,7 +2801,7 @@ discard block |
||
| 2801 | 2801 | } else { |
| 2802 | 2802 | $docAlias = $this->db->escape($this->documentIdentifier); |
| 2803 | 2803 | $rs = $this->db->select('id', $this->getFullTableName('site_content'), "deleted=0 and alias='{$docAlias}'"); |
| 2804 | - $this->documentIdentifier = (int)$this->db->getValue($rs); |
|
| 2804 | + $this->documentIdentifier = (int) $this->db->getValue($rs); |
|
| 2805 | 2805 | } |
| 2806 | 2806 | } |
| 2807 | 2807 | $this->documentMethod = 'id'; |
@@ -2854,7 +2854,7 @@ discard block |
||
| 2854 | 2854 | $_REQUEST[$n] = $_GET[$n] = $v; |
| 2855 | 2855 | } |
| 2856 | 2856 | } |
| 2857 | - $_SERVER['PHP_SELF'] = $this->config['base_url'] . $qp['path']; |
|
| 2857 | + $_SERVER['PHP_SELF'] = $this->config['base_url'].$qp['path']; |
|
| 2858 | 2858 | $this->q = $qp['path']; |
| 2859 | 2859 | return $qp['path']; |
| 2860 | 2860 | } |
@@ -2948,7 +2948,7 @@ discard block |
||
| 2948 | 2948 | $this->sendErrorPage(); |
| 2949 | 2949 | } else { |
| 2950 | 2950 | // Inculde the necessary files to check document permissions |
| 2951 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
| 2951 | + include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php'); |
|
| 2952 | 2952 | $udperms = new udperms(); |
| 2953 | 2953 | $udperms->user = $this->getLoginUserID(); |
| 2954 | 2954 | $udperms->document = $this->documentIdentifier; |
@@ -3002,7 +3002,7 @@ discard block |
||
| 3002 | 3002 | while ($id && $height--) { |
| 3003 | 3003 | $thisid = $id; |
| 3004 | 3004 | if ($this->config['aliaslistingfolder'] == 1) { |
| 3005 | - $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"); |
|
| 3005 | + $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 | 3006 | if (!$id || $id == '0') { |
| 3007 | 3007 | break; |
| 3008 | 3008 | } |
@@ -3053,15 +3053,15 @@ discard block |
||
| 3053 | 3053 | |
| 3054 | 3054 | if ($this->config['aliaslistingfolder'] == 1) { |
| 3055 | 3055 | |
| 3056 | - $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (" . $id . ") AND deleted = '0'"); |
|
| 3056 | + $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (".$id.") AND deleted = '0'"); |
|
| 3057 | 3057 | $idx = array(); |
| 3058 | 3058 | while ($row = $this->db->getRow($res)) { |
| 3059 | 3059 | $pAlias = ''; |
| 3060 | 3060 | if (isset($this->aliasListing[$row['parent']])) { |
| 3061 | - $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'] . '/' : ''; |
|
| 3062 | - $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'] . '/' : ''; |
|
| 3061 | + $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'].'/' : ''; |
|
| 3062 | + $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'].'/' : ''; |
|
| 3063 | 3063 | }; |
| 3064 | - $children[$pAlias . $row['alias']] = $row['id']; |
|
| 3064 | + $children[$pAlias.$row['alias']] = $row['id']; |
|
| 3065 | 3065 | if ($row['isfolder'] == 1) { |
| 3066 | 3066 | $idx[] = $row['id']; |
| 3067 | 3067 | } |
@@ -3093,7 +3093,7 @@ discard block |
||
| 3093 | 3093 | $depth--; |
| 3094 | 3094 | |
| 3095 | 3095 | foreach ($documentMap_cache[$id] as $childId) { |
| 3096 | - $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '') . $this->aliasListing[$childId]['alias']; |
|
| 3096 | + $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '').$this->aliasListing[$childId]['alias']; |
|
| 3097 | 3097 | if (!strlen($pkey)) { |
| 3098 | 3098 | $pkey = "{$childId}"; |
| 3099 | 3099 | } |
@@ -3122,7 +3122,7 @@ discard block |
||
| 3122 | 3122 | if (substr(strtolower($url), 0, 11) == "javascript:") { |
| 3123 | 3123 | $fnc = substr($url, 11); |
| 3124 | 3124 | } elseif ($url) { |
| 3125 | - $fnc = "window.location.href='" . addslashes($url) . "';"; |
|
| 3125 | + $fnc = "window.location.href='".addslashes($url)."';"; |
|
| 3126 | 3126 | } else { |
| 3127 | 3127 | $fnc = "history.back(-1);"; |
| 3128 | 3128 | } |
@@ -3131,7 +3131,7 @@ discard block |
||
| 3131 | 3131 | <meta http-equiv=\"Content-Type\" content=\"text/html; charset={$modx_manager_charset};\"> |
| 3132 | 3132 | <script> |
| 3133 | 3133 | function __alertQuit() { |
| 3134 | - alert('" . addslashes($msg) . "'); |
|
| 3134 | + alert('".addslashes($msg)."'); |
|
| 3135 | 3135 | {$fnc} |
| 3136 | 3136 | } |
| 3137 | 3137 | window.setTimeout('__alertQuit();',100); |
@@ -3155,7 +3155,7 @@ discard block |
||
| 3155 | 3155 | if ($pms) { |
| 3156 | 3156 | $state = ($pms[$pm] == 1); |
| 3157 | 3157 | } |
| 3158 | - return (int)$state; |
|
| 3158 | + return (int) $state; |
|
| 3159 | 3159 | } |
| 3160 | 3160 | |
| 3161 | 3161 | /** |
@@ -3236,7 +3236,7 @@ discard block |
||
| 3236 | 3236 | $this->lockedElements = array(); |
| 3237 | 3237 | $this->cleanupExpiredLocks(); |
| 3238 | 3238 | |
| 3239 | - $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks') . " ul |
|
| 3239 | + $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks')." ul |
|
| 3240 | 3240 | LEFT JOIN {$this->getFullTableName('manager_users')} mu on ul.internalKey = mu.id"); |
| 3241 | 3241 | while ($row = $this->db->getRow($rs)) { |
| 3242 | 3242 | $this->lockedElements[$row['elementType']][$row['elementId']] = array( |
@@ -3272,7 +3272,7 @@ discard block |
||
| 3272 | 3272 | foreach ($rs as $row) { |
| 3273 | 3273 | $userSids[] = $row['sid']; |
| 3274 | 3274 | } |
| 3275 | - $userSids = "'" . implode("','", $userSids) . "'"; |
|
| 3275 | + $userSids = "'".implode("','", $userSids)."'"; |
|
| 3276 | 3276 | $this->db->delete($this->getFullTableName('active_user_locks'), "sid NOT IN({$userSids})"); |
| 3277 | 3277 | } else { |
| 3278 | 3278 | $this->db->delete($this->getFullTableName('active_user_locks')); |
@@ -3469,8 +3469,8 @@ discard block |
||
| 3469 | 3469 | if (isset($this->config['send_errormail']) && $this->config['send_errormail'] !== '0') { |
| 3470 | 3470 | if ($this->config['send_errormail'] <= $type) { |
| 3471 | 3471 | $this->sendmail(array( |
| 3472 | - 'subject' => 'MODX System Error on ' . $this->config['site_name'], |
|
| 3473 | - 'body' => 'Source: ' . $source . ' - The details of the error could be seen in the MODX system events log.', |
|
| 3472 | + 'subject' => 'MODX System Error on '.$this->config['site_name'], |
|
| 3473 | + 'body' => 'Source: '.$source.' - The details of the error could be seen in the MODX system events log.', |
|
| 3474 | 3474 | 'type' => 'text' |
| 3475 | 3475 | )); |
| 3476 | 3476 | } |
@@ -3518,7 +3518,7 @@ discard block |
||
| 3518 | 3518 | $p['fromname'] = $userinfo['username']; |
| 3519 | 3519 | } |
| 3520 | 3520 | if ($msg === '' && !isset($p['body'])) { |
| 3521 | - $p['body'] = $_SERVER['REQUEST_URI'] . "\n" . $_SERVER['HTTP_USER_AGENT'] . "\n" . $_SERVER['HTTP_REFERER']; |
|
| 3521 | + $p['body'] = $_SERVER['REQUEST_URI']."\n".$_SERVER['HTTP_USER_AGENT']."\n".$_SERVER['HTTP_REFERER']; |
|
| 3522 | 3522 | } elseif (is_string($msg) && 0 < strlen($msg)) { |
| 3523 | 3523 | $p['body'] = $msg; |
| 3524 | 3524 | } |
@@ -3558,8 +3558,8 @@ discard block |
||
| 3558 | 3558 | $files = array(); |
| 3559 | 3559 | } |
| 3560 | 3560 | foreach ($files as $f) { |
| 3561 | - if (file_exists(MODX_BASE_PATH . $f) && is_file(MODX_BASE_PATH . $f) && is_readable(MODX_BASE_PATH . $f)) { |
|
| 3562 | - $this->mail->AddAttachment(MODX_BASE_PATH . $f); |
|
| 3561 | + if (file_exists(MODX_BASE_PATH.$f) && is_file(MODX_BASE_PATH.$f) && is_readable(MODX_BASE_PATH.$f)) { |
|
| 3562 | + $this->mail->AddAttachment(MODX_BASE_PATH.$f); |
|
| 3563 | 3563 | } |
| 3564 | 3564 | } |
| 3565 | 3565 | $rs = $this->mail->send(); |
@@ -3604,7 +3604,7 @@ discard block |
||
| 3604 | 3604 | */ |
| 3605 | 3605 | public function isFrontend() |
| 3606 | 3606 | { |
| 3607 | - return ! $this->isBackend(); |
|
| 3607 | + return !$this->isBackend(); |
|
| 3608 | 3608 | } |
| 3609 | 3609 | |
| 3610 | 3610 | /** |
@@ -3629,14 +3629,14 @@ discard block |
||
| 3629 | 3629 | $tblsc = $this->getFullTableName("site_content"); |
| 3630 | 3630 | $tbldg = $this->getFullTableName("document_groups"); |
| 3631 | 3631 | // modify field names to use sc. table reference |
| 3632 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
| 3633 | - $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
| 3632 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
| 3633 | + $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
| 3634 | 3634 | // get document groups for current user |
| 3635 | 3635 | if ($docgrp = $this->getUserDocGroups()) { |
| 3636 | 3636 | $docgrp = implode(",", $docgrp); |
| 3637 | 3637 | } |
| 3638 | 3638 | // build query |
| 3639 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
| 3639 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
| 3640 | 3640 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
| 3641 | 3641 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}"); |
| 3642 | 3642 | $resourceArray = $this->db->makeArray($result); |
@@ -3666,14 +3666,14 @@ discard block |
||
| 3666 | 3666 | $tbldg = $this->getFullTableName("document_groups"); |
| 3667 | 3667 | |
| 3668 | 3668 | // modify field names to use sc. table reference |
| 3669 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
| 3670 | - $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
| 3669 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
| 3670 | + $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
| 3671 | 3671 | // get document groups for current user |
| 3672 | 3672 | if ($docgrp = $this->getUserDocGroups()) { |
| 3673 | 3673 | $docgrp = implode(",", $docgrp); |
| 3674 | 3674 | } |
| 3675 | 3675 | // build query |
| 3676 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
| 3676 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
| 3677 | 3677 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
| 3678 | 3678 | 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}"); |
| 3679 | 3679 | $resourceArray = $this->db->makeArray($result); |
@@ -3708,16 +3708,16 @@ discard block |
||
| 3708 | 3708 | return $this->tmpCache[__FUNCTION__][$cacheKey]; |
| 3709 | 3709 | } |
| 3710 | 3710 | |
| 3711 | - $published = ($published !== 'all') ? 'AND sc.published = ' . $published : ''; |
|
| 3712 | - $deleted = ($deleted !== 'all') ? 'AND sc.deleted = ' . $deleted : ''; |
|
| 3711 | + $published = ($published !== 'all') ? 'AND sc.published = '.$published : ''; |
|
| 3712 | + $deleted = ($deleted !== 'all') ? 'AND sc.deleted = '.$deleted : ''; |
|
| 3713 | 3713 | |
| 3714 | 3714 | if ($where != '') { |
| 3715 | - $where = 'AND ' . $where; |
|
| 3715 | + $where = 'AND '.$where; |
|
| 3716 | 3716 | } |
| 3717 | 3717 | |
| 3718 | 3718 | // modify field names to use sc. table reference |
| 3719 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
| 3720 | - $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
| 3719 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
| 3720 | + $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
| 3721 | 3721 | |
| 3722 | 3722 | // get document groups for current user |
| 3723 | 3723 | if ($docgrp = $this->getUserDocGroups()) { |
@@ -3725,7 +3725,7 @@ discard block |
||
| 3725 | 3725 | } |
| 3726 | 3726 | |
| 3727 | 3727 | // build query |
| 3728 | - $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')'); |
|
| 3728 | + $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')'); |
|
| 3729 | 3729 | |
| 3730 | 3730 | $tblsc = $this->getFullTableName('site_content'); |
| 3731 | 3731 | $tbldg = $this->getFullTableName('document_groups'); |
@@ -3777,10 +3777,10 @@ discard block |
||
| 3777 | 3777 | return false; |
| 3778 | 3778 | } else { |
| 3779 | 3779 | // modify field names to use sc. table reference |
| 3780 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
| 3781 | - $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
| 3780 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
| 3781 | + $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
| 3782 | 3782 | if ($where != '') { |
| 3783 | - $where = 'AND ' . $where; |
|
| 3783 | + $where = 'AND '.$where; |
|
| 3784 | 3784 | } |
| 3785 | 3785 | |
| 3786 | 3786 | $published = ($published !== 'all') ? "AND sc.published = '{$published}'" : ''; |
@@ -3791,13 +3791,13 @@ discard block |
||
| 3791 | 3791 | $docgrp = implode(',', $docgrp); |
| 3792 | 3792 | } |
| 3793 | 3793 | |
| 3794 | - $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')'); |
|
| 3794 | + $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')'); |
|
| 3795 | 3795 | |
| 3796 | 3796 | $tblsc = $this->getFullTableName('site_content'); |
| 3797 | 3797 | $tbldg = $this->getFullTableName('document_groups'); |
| 3798 | 3798 | |
| 3799 | 3799 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
| 3800 | - 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); |
|
| 3800 | + 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); |
|
| 3801 | 3801 | |
| 3802 | 3802 | $resourceArray = $this->db->makeArray($result); |
| 3803 | 3803 | |
@@ -3902,12 +3902,12 @@ discard block |
||
| 3902 | 3902 | $tbldg = $this->getFullTableName("document_groups"); |
| 3903 | 3903 | $activeSql = $active == 1 ? "AND sc.published=1 AND sc.deleted=0" : ""; |
| 3904 | 3904 | // modify field names to use sc. table reference |
| 3905 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
| 3905 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
| 3906 | 3906 | // get document groups for current user |
| 3907 | 3907 | if ($docgrp = $this->getUserDocGroups()) { |
| 3908 | 3908 | $docgrp = implode(",", $docgrp); |
| 3909 | 3909 | } |
| 3910 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
| 3910 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
| 3911 | 3911 | $result = $this->db->select($fields, "{$tblsc} sc LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id='{$pageid}' {$activeSql}) AND ({$access})", "", 1); |
| 3912 | 3912 | $pageInfo = $this->db->getRow($result); |
| 3913 | 3913 | |
@@ -3954,7 +3954,7 @@ discard block |
||
| 3954 | 3954 | { |
| 3955 | 3955 | if ($this->currentSnippet) { |
| 3956 | 3956 | $tbl = $this->getFullTableName("site_snippets"); |
| 3957 | - $rs = $this->db->select('id', $tbl, "name='" . $this->db->escape($this->currentSnippet) . "'", '', 1); |
|
| 3957 | + $rs = $this->db->select('id', $tbl, "name='".$this->db->escape($this->currentSnippet)."'", '', 1); |
|
| 3958 | 3958 | if ($snippetId = $this->db->getValue($rs)) { |
| 3959 | 3959 | return $snippetId; |
| 3960 | 3960 | } |
@@ -3981,23 +3981,23 @@ discard block |
||
| 3981 | 3981 | */ |
| 3982 | 3982 | public function clearCache($type = '', $report = false) |
| 3983 | 3983 | { |
| 3984 | - $cache_dir = MODX_BASE_PATH . $this->getCacheFolder(); |
|
| 3984 | + $cache_dir = MODX_BASE_PATH.$this->getCacheFolder(); |
|
| 3985 | 3985 | if (is_array($type)) { |
| 3986 | 3986 | foreach ($type as $_) { |
| 3987 | 3987 | $this->clearCache($_, $report); |
| 3988 | 3988 | } |
| 3989 | 3989 | } elseif ($type == 'full') { |
| 3990 | - include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php'); |
|
| 3990 | + include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php'); |
|
| 3991 | 3991 | $sync = new synccache(); |
| 3992 | 3992 | $sync->setCachepath($cache_dir); |
| 3993 | 3993 | $sync->setReport($report); |
| 3994 | 3994 | $sync->emptyCache(); |
| 3995 | 3995 | } elseif (preg_match('@^[1-9][0-9]*$@', $type)) { |
| 3996 | 3996 | $key = ($this->config['cache_type'] == 2) ? $this->makePageCacheKey($type) : $type; |
| 3997 | - $file_name = "docid_" . $key . "_*.pageCache.php"; |
|
| 3998 | - $cache_path = $cache_dir . $file_name; |
|
| 3997 | + $file_name = "docid_".$key."_*.pageCache.php"; |
|
| 3998 | + $cache_path = $cache_dir.$file_name; |
|
| 3999 | 3999 | $files = glob($cache_path); |
| 4000 | - $files[] = $cache_dir . "docid_" . $key . ".pageCache.php"; |
|
| 4000 | + $files[] = $cache_dir."docid_".$key.".pageCache.php"; |
|
| 4001 | 4001 | foreach ($files as $file) { |
| 4002 | 4002 | if (!is_file($file)) { |
| 4003 | 4003 | continue; |
@@ -4005,7 +4005,7 @@ discard block |
||
| 4005 | 4005 | unlink($file); |
| 4006 | 4006 | } |
| 4007 | 4007 | } else { |
| 4008 | - $files = glob($cache_dir . '*'); |
|
| 4008 | + $files = glob($cache_dir.'*'); |
|
| 4009 | 4009 | foreach ($files as $file) { |
| 4010 | 4010 | $name = basename($file); |
| 4011 | 4011 | if (strpos($name, '.pageCache.php') === false) { |
@@ -4074,7 +4074,7 @@ discard block |
||
| 4074 | 4074 | $f_url_suffix = '/'; |
| 4075 | 4075 | } |
| 4076 | 4076 | |
| 4077 | - $alPath = !empty ($al['path']) ? $al['path'] . '/' : ''; |
|
| 4077 | + $alPath = !empty ($al['path']) ? $al['path'].'/' : ''; |
|
| 4078 | 4078 | |
| 4079 | 4079 | if ($al && $al['alias']) { |
| 4080 | 4080 | $alias = $al['alias']; |
@@ -4082,7 +4082,7 @@ discard block |
||
| 4082 | 4082 | |
| 4083 | 4083 | } |
| 4084 | 4084 | |
| 4085 | - $alias = $alPath . $f_url_prefix . $alias . $f_url_suffix; |
|
| 4085 | + $alias = $alPath.$f_url_prefix.$alias.$f_url_suffix; |
|
| 4086 | 4086 | $url = "{$alias}{$args}"; |
| 4087 | 4087 | } else { |
| 4088 | 4088 | $url = "index.php?id={$id}{$args}"; |
@@ -4101,7 +4101,7 @@ discard block |
||
| 4101 | 4101 | } |
| 4102 | 4102 | |
| 4103 | 4103 | //TODO: check to make sure that $site_url incudes the url :port (e.g. :8080) |
| 4104 | - $host = $scheme == 'full' ? $this->config['site_url'] : $scheme . '://' . $_SERVER['HTTP_HOST'] . $host; |
|
| 4104 | + $host = $scheme == 'full' ? $this->config['site_url'] : $scheme.'://'.$_SERVER['HTTP_HOST'].$host; |
|
| 4105 | 4105 | } |
| 4106 | 4106 | |
| 4107 | 4107 | //fix strictUrl by Bumkaka |
@@ -4110,9 +4110,9 @@ discard block |
||
| 4110 | 4110 | } |
| 4111 | 4111 | |
| 4112 | 4112 | if ($this->config['xhtml_urls']) { |
| 4113 | - $url = preg_replace("/&(?!amp;)/", "&", $host . $virtualDir . $url); |
|
| 4113 | + $url = preg_replace("/&(?!amp;)/", "&", $host.$virtualDir.$url); |
|
| 4114 | 4114 | } else { |
| 4115 | - $url = $host . $virtualDir . $url; |
|
| 4115 | + $url = $host.$virtualDir.$url; |
|
| 4116 | 4116 | } |
| 4117 | 4117 | |
| 4118 | 4118 | $evtOut = $this->invokeEvent('OnMakeDocUrl', array( |
@@ -4136,21 +4136,21 @@ discard block |
||
| 4136 | 4136 | if (isset($this->aliasListing[$id])) { |
| 4137 | 4137 | $out = $this->aliasListing[$id]; |
| 4138 | 4138 | } else { |
| 4139 | - $q = $this->db->query("SELECT id,alias,isfolder,parent FROM " . $this->getFullTableName("site_content") . " WHERE id=" . (int)$id); |
|
| 4139 | + $q = $this->db->query("SELECT id,alias,isfolder,parent FROM ".$this->getFullTableName("site_content")." WHERE id=".(int) $id); |
|
| 4140 | 4140 | if ($this->db->getRecordCount($q) == '1') { |
| 4141 | 4141 | $q = $this->db->getRow($q); |
| 4142 | 4142 | $this->aliasListing[$id] = array( |
| 4143 | - 'id' => (int)$q['id'], |
|
| 4143 | + 'id' => (int) $q['id'], |
|
| 4144 | 4144 | 'alias' => $q['alias'] == '' ? $q['id'] : $q['alias'], |
| 4145 | - 'parent' => (int)$q['parent'], |
|
| 4146 | - 'isfolder' => (int)$q['isfolder'], |
|
| 4145 | + 'parent' => (int) $q['parent'], |
|
| 4146 | + 'isfolder' => (int) $q['isfolder'], |
|
| 4147 | 4147 | ); |
| 4148 | 4148 | if ($this->aliasListing[$id]['parent'] > 0) { |
| 4149 | 4149 | //fix alias_path_usage |
| 4150 | 4150 | if ($this->config['use_alias_path'] == '1') { |
| 4151 | 4151 | //&& $tmp['path'] != '' - fix error slash with epty path |
| 4152 | 4152 | $tmp = $this->getAliasListing($this->aliasListing[$id]['parent']); |
| 4153 | - $this->aliasListing[$id]['path'] = $tmp['path'] . ($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '') . $tmp['alias'] : ''); |
|
| 4153 | + $this->aliasListing[$id]['path'] = $tmp['path'].($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '').$tmp['alias'] : ''); |
|
| 4154 | 4154 | } else { |
| 4155 | 4155 | $this->aliasListing[$id]['path'] = ''; |
| 4156 | 4156 | } |
@@ -4191,7 +4191,7 @@ discard block |
||
| 4191 | 4191 | $out = array(); |
| 4192 | 4192 | if (empty($this->version) || !is_array($this->version)) { |
| 4193 | 4193 | //include for compatibility modx version < 1.0.10 |
| 4194 | - include MODX_MANAGER_PATH . "includes/version.inc.php"; |
|
| 4194 | + include MODX_MANAGER_PATH."includes/version.inc.php"; |
|
| 4195 | 4195 | $this->version = array(); |
| 4196 | 4196 | $this->version['version'] = isset($modx_version) ? $modx_version : ''; |
| 4197 | 4197 | $this->version['branch'] = isset($modx_branch) ? $modx_branch : ''; |
@@ -4213,18 +4213,18 @@ discard block |
||
| 4213 | 4213 | { |
| 4214 | 4214 | if (isset ($this->snippetCache[$snippetName])) { |
| 4215 | 4215 | $snippet = $this->snippetCache[$snippetName]; |
| 4216 | - $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : ''; |
|
| 4216 | + $properties = !empty($this->snippetCache[$snippetName."Props"]) ? $this->snippetCache[$snippetName."Props"] : ''; |
|
| 4217 | 4217 | } else { // not in cache so let's check the db |
| 4218 | - $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;"; |
|
| 4218 | + $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;"; |
|
| 4219 | 4219 | $result = $this->db->query($sql); |
| 4220 | 4220 | if ($this->db->getRecordCount($result) == 1) { |
| 4221 | 4221 | $row = $this->db->getRow($result); |
| 4222 | 4222 | $snippet = $this->snippetCache[$snippetName] = $row['snippet']; |
| 4223 | 4223 | $mergedProperties = array_merge($this->parseProperties($row['properties']), $this->parseProperties($row['sharedproperties'])); |
| 4224 | - $properties = $this->snippetCache[$snippetName . "Props"] = json_encode($mergedProperties); |
|
| 4224 | + $properties = $this->snippetCache[$snippetName."Props"] = json_encode($mergedProperties); |
|
| 4225 | 4225 | } else { |
| 4226 | 4226 | $snippet = $this->snippetCache[$snippetName] = "return false;"; |
| 4227 | - $properties = $this->snippetCache[$snippetName . "Props"] = ''; |
|
| 4227 | + $properties = $this->snippetCache[$snippetName."Props"] = ''; |
|
| 4228 | 4228 | } |
| 4229 | 4229 | } |
| 4230 | 4230 | // load default params/properties |
@@ -4327,8 +4327,8 @@ discard block |
||
| 4327 | 4327 | } |
| 4328 | 4328 | if (strpos($tpl, $s) !== false) { |
| 4329 | 4329 | $tpl = str_replace($s, $value, $tpl); |
| 4330 | - } elseif($this->debug) { |
|
| 4331 | - $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
| 4330 | + } elseif ($this->debug) { |
|
| 4331 | + $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
| 4332 | 4332 | } |
| 4333 | 4333 | } |
| 4334 | 4334 | |
@@ -4377,7 +4377,7 @@ discard block |
||
| 4377 | 4377 | case 'CODE': |
| 4378 | 4378 | break; |
| 4379 | 4379 | case 'FILE': |
| 4380 | - $template = file_get_contents(MODX_BASE_PATH . $template); |
|
| 4380 | + $template = file_get_contents(MODX_BASE_PATH.$template); |
|
| 4381 | 4381 | break; |
| 4382 | 4382 | case 'CHUNK': |
| 4383 | 4383 | $template = $this->getChunk($template); |
@@ -4430,7 +4430,7 @@ discard block |
||
| 4430 | 4430 | } |
| 4431 | 4431 | |
| 4432 | 4432 | if (empty($mode)) { |
| 4433 | - $strTime = strftime($dateFormat . " %H:%M:%S", $timestamp); |
|
| 4433 | + $strTime = strftime($dateFormat." %H:%M:%S", $timestamp); |
|
| 4434 | 4434 | } elseif ($mode == 'dateOnly') { |
| 4435 | 4435 | $strTime = strftime($dateFormat, $timestamp); |
| 4436 | 4436 | } elseif ($mode == 'formatOnly') { |
@@ -4526,7 +4526,7 @@ discard block |
||
| 4526 | 4526 | if ($v === 'value') { |
| 4527 | 4527 | unset($_[$i]); |
| 4528 | 4528 | } else { |
| 4529 | - $_[$i] = 'tv.' . $v; |
|
| 4529 | + $_[$i] = 'tv.'.$v; |
|
| 4530 | 4530 | } |
| 4531 | 4531 | } |
| 4532 | 4532 | $fields = join(',', $_); |
@@ -4535,12 +4535,12 @@ discard block |
||
| 4535 | 4535 | } |
| 4536 | 4536 | |
| 4537 | 4537 | if ($tvsort != '') { |
| 4538 | - $tvsort = 'tv.' . join(',tv.', array_filter(array_map('trim', explode(',', $tvsort)))); |
|
| 4538 | + $tvsort = 'tv.'.join(',tv.', array_filter(array_map('trim', explode(',', $tvsort)))); |
|
| 4539 | 4539 | } |
| 4540 | 4540 | if ($tvidnames == "*") { |
| 4541 | 4541 | $query = "tv.id<>0"; |
| 4542 | 4542 | } else { |
| 4543 | - $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name") . " IN ('" . join("','", $tvidnames) . "')"; |
|
| 4543 | + $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name")." IN ('".join("','", $tvidnames)."')"; |
|
| 4544 | 4544 | } |
| 4545 | 4545 | |
| 4546 | 4546 | $this->getUserDocGroups(); |
@@ -4684,7 +4684,7 @@ discard block |
||
| 4684 | 4684 | return $this->tmpCache[__FUNCTION__][$cacheKey]; |
| 4685 | 4685 | } |
| 4686 | 4686 | |
| 4687 | - if (($idnames != '*' && !is_array($idnames)) || empty($idnames) ) { |
|
| 4687 | + if (($idnames != '*' && !is_array($idnames)) || empty($idnames)) { |
|
| 4688 | 4688 | return false; |
| 4689 | 4689 | } else { |
| 4690 | 4690 | |
@@ -4702,23 +4702,23 @@ discard block |
||
| 4702 | 4702 | } |
| 4703 | 4703 | |
| 4704 | 4704 | // get user defined template variables |
| 4705 | - $fields = ($fields == '') ? 'tv.*' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $fields)))); |
|
| 4706 | - $sort = ($sort == '') ? '' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $sort)))); |
|
| 4705 | + $fields = ($fields == '') ? 'tv.*' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $fields)))); |
|
| 4706 | + $sort = ($sort == '') ? '' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $sort)))); |
|
| 4707 | 4707 | |
| 4708 | 4708 | if ($idnames == '*') { |
| 4709 | 4709 | $query = 'tv.id<>0'; |
| 4710 | 4710 | } else { |
| 4711 | - $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name') . " IN ('" . implode("','", $idnames) . "')"; |
|
| 4711 | + $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name')." IN ('".implode("','", $idnames)."')"; |
|
| 4712 | 4712 | } |
| 4713 | 4713 | |
| 4714 | - $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars') . " tv |
|
| 4715 | - INNER JOIN " . $this->getFullTableName('site_tmplvar_templates') . " tvtpl ON tvtpl.tmplvarid = tv.id |
|
| 4716 | - 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}" : "")); |
|
| 4714 | + $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars')." tv |
|
| 4715 | + INNER JOIN " . $this->getFullTableName('site_tmplvar_templates')." tvtpl ON tvtpl.tmplvarid = tv.id |
|
| 4716 | + 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}" : "")); |
|
| 4717 | 4717 | |
| 4718 | 4718 | $result = $this->db->makeArray($rs); |
| 4719 | 4719 | |
| 4720 | 4720 | // get default/built-in template variables |
| 4721 | - if(is_array($docRow)){ |
|
| 4721 | + if (is_array($docRow)) { |
|
| 4722 | 4722 | ksort($docRow); |
| 4723 | 4723 | |
| 4724 | 4724 | foreach ($docRow as $key => $value) { |
@@ -4756,7 +4756,7 @@ discard block |
||
| 4756 | 4756 | */ |
| 4757 | 4757 | public function getTemplateVarOutput($idnames = array(), $docid = '', $published = 1, $sep = '') |
| 4758 | 4758 | { |
| 4759 | - if (is_array($idnames) && empty($idnames) ) { |
|
| 4759 | + if (is_array($idnames) && empty($idnames)) { |
|
| 4760 | 4760 | return false; |
| 4761 | 4761 | } else { |
| 4762 | 4762 | $output = array(); |
@@ -4769,9 +4769,9 @@ discard block |
||
| 4769 | 4769 | if ($result == false) { |
| 4770 | 4770 | return false; |
| 4771 | 4771 | } else { |
| 4772 | - $baspath = MODX_MANAGER_PATH . 'includes'; |
|
| 4773 | - include_once $baspath . '/tmplvars.format.inc.php'; |
|
| 4774 | - include_once $baspath . '/tmplvars.commands.inc.php'; |
|
| 4772 | + $baspath = MODX_MANAGER_PATH.'includes'; |
|
| 4773 | + include_once $baspath.'/tmplvars.format.inc.php'; |
|
| 4774 | + include_once $baspath.'/tmplvars.commands.inc.php'; |
|
| 4775 | 4775 | |
| 4776 | 4776 | for ($i = 0; $i < count($result); $i++) { |
| 4777 | 4777 | $row = $result[$i]; |
@@ -4796,7 +4796,7 @@ discard block |
||
| 4796 | 4796 | */ |
| 4797 | 4797 | public function getFullTableName($tbl) |
| 4798 | 4798 | { |
| 4799 | - return $this->db->config['dbase'] . ".`" . $this->db->config['table_prefix'] . $tbl . "`"; |
|
| 4799 | + return $this->db->config['dbase'].".`".$this->db->config['table_prefix'].$tbl."`"; |
|
| 4800 | 4800 | } |
| 4801 | 4801 | |
| 4802 | 4802 | /** |
@@ -4875,7 +4875,7 @@ discard block |
||
| 4875 | 4875 | public function getCachePath() |
| 4876 | 4876 | { |
| 4877 | 4877 | global $base_url; |
| 4878 | - $pth = $base_url . $this->getCacheFolder(); |
|
| 4878 | + $pth = $base_url.$this->getCacheFolder(); |
|
| 4879 | 4879 | return $pth; |
| 4880 | 4880 | } |
| 4881 | 4881 | |
@@ -4927,8 +4927,8 @@ discard block |
||
| 4927 | 4927 | $out = false; |
| 4928 | 4928 | |
| 4929 | 4929 | if (!empty($context)) { |
| 4930 | - if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) { |
|
| 4931 | - $out = $_SESSION[$context . 'InternalKey']; |
|
| 4930 | + if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) { |
|
| 4931 | + $out = $_SESSION[$context.'InternalKey']; |
|
| 4932 | 4932 | } |
| 4933 | 4933 | } else { |
| 4934 | 4934 | switch (true) { |
@@ -4956,8 +4956,8 @@ discard block |
||
| 4956 | 4956 | $out = false; |
| 4957 | 4957 | |
| 4958 | 4958 | if (!empty($context)) { |
| 4959 | - if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) { |
|
| 4960 | - $out = $_SESSION[$context . 'Shortname']; |
|
| 4959 | + if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) { |
|
| 4960 | + $out = $_SESSION[$context.'Shortname']; |
|
| 4961 | 4961 | } |
| 4962 | 4962 | } else { |
| 4963 | 4963 | switch (true) { |
@@ -5028,8 +5028,8 @@ discard block |
||
| 5028 | 5028 | */ |
| 5029 | 5029 | public function getWebUserInfo($uid) |
| 5030 | 5030 | { |
| 5031 | - $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users") . " wu |
|
| 5032 | - INNER JOIN " . $this->getFullTableName("web_user_attributes") . " wua ON wua.internalkey=wu.id", "wu.id='{$uid}'"); |
|
| 5031 | + $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users")." wu |
|
| 5032 | + INNER JOIN " . $this->getFullTableName("web_user_attributes")." wua ON wua.internalkey=wu.id", "wu.id='{$uid}'"); |
|
| 5033 | 5033 | if ($row = $this->db->getRow($rs)) { |
| 5034 | 5034 | if (!isset($row['usertype']) or !$row["usertype"]) { |
| 5035 | 5035 | $row["usertype"] = "web"; |
@@ -5065,7 +5065,7 @@ discard block |
||
| 5065 | 5065 | } else if (is_array($dg)) { |
| 5066 | 5066 | // resolve ids to names |
| 5067 | 5067 | $dgn = array(); |
| 5068 | - $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (" . implode(",", $dg) . ")"); |
|
| 5068 | + $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (".implode(",", $dg).")"); |
|
| 5069 | 5069 | while ($row = $this->db->getRow($ds)) { |
| 5070 | 5070 | $dgn[] = $row['name']; |
| 5071 | 5071 | } |
@@ -5093,7 +5093,7 @@ discard block |
||
| 5093 | 5093 | $rt = false; |
| 5094 | 5094 | if ($_SESSION["webValidated"] == 1) { |
| 5095 | 5095 | $tbl = $this->getFullTableName("web_users"); |
| 5096 | - $ds = $this->db->select('id, username, password', $tbl, "id='" . $this->getLoginUserID() . "'"); |
|
| 5096 | + $ds = $this->db->select('id, username, password', $tbl, "id='".$this->getLoginUserID()."'"); |
|
| 5097 | 5097 | if ($row = $this->db->getRow($ds)) { |
| 5098 | 5098 | if ($row["password"] == md5($oldPwd)) { |
| 5099 | 5099 | if (strlen($newPwd) < 6) { |
@@ -5103,7 +5103,7 @@ discard block |
||
| 5103 | 5103 | } else { |
| 5104 | 5104 | $this->db->update(array( |
| 5105 | 5105 | 'password' => $this->db->escape($newPwd), |
| 5106 | - ), $tbl, "id='" . $this->getLoginUserID() . "'"); |
|
| 5106 | + ), $tbl, "id='".$this->getLoginUserID()."'"); |
|
| 5107 | 5107 | // invoke OnWebChangePassword event |
| 5108 | 5108 | $this->invokeEvent("OnWebChangePassword", array( |
| 5109 | 5109 | "userid" => $row["id"], |
@@ -5134,8 +5134,8 @@ discard block |
||
| 5134 | 5134 | // check cache |
| 5135 | 5135 | $grpNames = isset ($_SESSION['webUserGroupNames']) ? $_SESSION['webUserGroupNames'] : false; |
| 5136 | 5136 | if (!is_array($grpNames)) { |
| 5137 | - $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names") . " wgn |
|
| 5138 | - INNER JOIN " . $this->getFullTableName("web_groups") . " wg ON wg.webgroup=wgn.id AND wg.webuser='" . $this->getLoginUserID() . "'"); |
|
| 5137 | + $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names")." wgn |
|
| 5138 | + INNER JOIN " . $this->getFullTableName("web_groups")." wg ON wg.webgroup=wgn.id AND wg.webuser='".$this->getLoginUserID()."'"); |
|
| 5139 | 5139 | $grpNames = $this->db->getColumn("name", $rs); |
| 5140 | 5140 | // save to cache |
| 5141 | 5141 | $_SESSION['webUserGroupNames'] = $grpNames; |
@@ -5168,7 +5168,7 @@ discard block |
||
| 5168 | 5168 | if (strpos(strtolower($src), "<style") !== false || strpos(strtolower($src), "<link") !== false) { |
| 5169 | 5169 | $this->sjscripts[$nextpos] = $src; |
| 5170 | 5170 | } else { |
| 5171 | - $this->sjscripts[$nextpos] = "\t" . '<link rel="stylesheet" type="text/css" href="' . $src . '" ' . ($media ? 'media="' . $media . '" ' : '') . '/>'; |
|
| 5171 | + $this->sjscripts[$nextpos] = "\t".'<link rel="stylesheet" type="text/css" href="'.$src.'" '.($media ? 'media="'.$media.'" ' : '').'/>'; |
|
| 5172 | 5172 | } |
| 5173 | 5173 | } |
| 5174 | 5174 | |
@@ -5247,7 +5247,7 @@ discard block |
||
| 5247 | 5247 | } |
| 5248 | 5248 | |
| 5249 | 5249 | if ($useThisVer && $plaintext != true && (strpos(strtolower($src), "<script") === false)) { |
| 5250 | - $src = "\t" . '<script type="text/javascript" src="' . $src . '"></script>'; |
|
| 5250 | + $src = "\t".'<script type="text/javascript" src="'.$src.'"></script>'; |
|
| 5251 | 5251 | } |
| 5252 | 5252 | if ($startup) { |
| 5253 | 5253 | $pos = isset($overwritepos) ? $overwritepos : max(array_merge(array(0), array_keys($this->sjscripts))) + 1; |
@@ -5393,7 +5393,7 @@ discard block |
||
| 5393 | 5393 | $eventtime = $this->getMicroTime() - $eventtime; |
| 5394 | 5394 | $this->pluginsCode .= sprintf('<fieldset><legend><b>%s / %s</b> (%2.2f ms)</legend>', $evtName, $pluginName, $eventtime * 1000); |
| 5395 | 5395 | foreach ($parameter as $k => $v) { |
| 5396 | - $this->pluginsCode .= "{$k} => " . print_r($v, true) . '<br>'; |
|
| 5396 | + $this->pluginsCode .= "{$k} => ".print_r($v, true).'<br>'; |
|
| 5397 | 5397 | } |
| 5398 | 5398 | $this->pluginsCode .= '</fieldset><br />'; |
| 5399 | 5399 | $this->pluginsTime["{$evtName} / {$pluginName}"] += $eventtime; |
@@ -5421,13 +5421,13 @@ discard block |
||
| 5421 | 5421 | $plugin = array(); |
| 5422 | 5422 | if (isset ($this->pluginCache[$pluginName])) { |
| 5423 | 5423 | $pluginCode = $this->pluginCache[$pluginName]; |
| 5424 | - $pluginProperties = isset($this->pluginCache[$pluginName . "Props"]) ? $this->pluginCache[$pluginName . "Props"] : ''; |
|
| 5424 | + $pluginProperties = isset($this->pluginCache[$pluginName."Props"]) ? $this->pluginCache[$pluginName."Props"] : ''; |
|
| 5425 | 5425 | } else { |
| 5426 | 5426 | $pluginName = $this->db->escape($pluginName); |
| 5427 | 5427 | $result = $this->db->select('name, plugincode, properties', $this->getFullTableName("site_plugins"), "name='{$pluginName}' AND disabled=0"); |
| 5428 | 5428 | if ($row = $this->db->getRow($result)) { |
| 5429 | 5429 | $pluginCode = $this->pluginCache[$row['name']] = $row['plugincode']; |
| 5430 | - $pluginProperties = $this->pluginCache[$row['name'] . "Props"] = $row['properties']; |
|
| 5430 | + $pluginProperties = $this->pluginCache[$row['name']."Props"] = $row['properties']; |
|
| 5431 | 5431 | } else { |
| 5432 | 5432 | $pluginCode = $this->pluginCache[$pluginName] = "return false;"; |
| 5433 | 5433 | $pluginProperties = ''; |
@@ -5534,7 +5534,7 @@ discard block |
||
| 5534 | 5534 | public function parseDocBlockFromFile($element_dir, $filename, $escapeValues = false) |
| 5535 | 5535 | { |
| 5536 | 5536 | $params = array(); |
| 5537 | - $fullpath = $element_dir . '/' . $filename; |
|
| 5537 | + $fullpath = $element_dir.'/'.$filename; |
|
| 5538 | 5538 | if (is_readable($fullpath)) { |
| 5539 | 5539 | $tpl = @fopen($fullpath, "r"); |
| 5540 | 5540 | if ($tpl) { |
@@ -5701,8 +5701,8 @@ discard block |
||
| 5701 | 5701 | $ph = array('site_url' => MODX_SITE_URL); |
| 5702 | 5702 | $regexUrl = "/((http|https|ftp|ftps)\:\/\/[^\/]+(\/[^\s]+[^,.?!:;\s])?)/"; |
| 5703 | 5703 | $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'; |
| 5704 | - $emailSubject = isset($parsed['name']) ? '?subject=' . $parsed['name'] : ''; |
|
| 5705 | - $emailSubject .= isset($parsed['version']) ? ' v' . $parsed['version'] : ''; |
|
| 5704 | + $emailSubject = isset($parsed['name']) ? '?subject='.$parsed['name'] : ''; |
|
| 5705 | + $emailSubject .= isset($parsed['version']) ? ' v'.$parsed['version'] : ''; |
|
| 5706 | 5706 | foreach ($parsed as $key => $val) { |
| 5707 | 5707 | if (is_array($val)) { |
| 5708 | 5708 | foreach ($val as $key2 => $val2) { |
@@ -5711,7 +5711,7 @@ discard block |
||
| 5711 | 5711 | $val2 = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val2); |
| 5712 | 5712 | } |
| 5713 | 5713 | if (preg_match($regexEmail, $val2, $url)) { |
| 5714 | - $val2 = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val2); |
|
| 5714 | + $val2 = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val2); |
|
| 5715 | 5715 | } |
| 5716 | 5716 | $parsed[$key][$key2] = $val2; |
| 5717 | 5717 | } |
@@ -5721,7 +5721,7 @@ discard block |
||
| 5721 | 5721 | $val = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val); |
| 5722 | 5722 | } |
| 5723 | 5723 | if (preg_match($regexEmail, $val, $url)) { |
| 5724 | - $val = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val); |
|
| 5724 | + $val = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val); |
|
| 5725 | 5725 | } |
| 5726 | 5726 | $parsed[$key] = $val; |
| 5727 | 5727 | } |
@@ -5735,32 +5735,32 @@ discard block |
||
| 5735 | 5735 | ); |
| 5736 | 5736 | |
| 5737 | 5737 | $nl = "\n"; |
| 5738 | - $list = isset($parsed['logo']) ? '<img src="' . $this->config['base_url'] . ltrim($parsed['logo'], "/") . '" style="float:right;max-width:100px;height:auto;" />' . $nl : ''; |
|
| 5739 | - $list .= '<p>' . $nl; |
|
| 5740 | - $list .= isset($parsed['name']) ? '<strong>' . $parsed['name'] . '</strong><br/>' . $nl : ''; |
|
| 5741 | - $list .= isset($parsed['description']) ? $parsed['description'] . $nl : ''; |
|
| 5742 | - $list .= '</p><br/>' . $nl; |
|
| 5743 | - $list .= isset($parsed['version']) ? '<p><strong>' . $_lang['version'] . ':</strong> ' . $parsed['version'] . '</p>' . $nl : ''; |
|
| 5744 | - $list .= isset($parsed['license']) ? '<p><strong>' . $_lang['license'] . ':</strong> ' . $parsed['license'] . '</p>' . $nl : ''; |
|
| 5745 | - $list .= isset($parsed['lastupdate']) ? '<p><strong>' . $_lang['last_update'] . ':</strong> ' . $parsed['lastupdate'] . '</p>' . $nl : ''; |
|
| 5746 | - $list .= '<br/>' . $nl; |
|
| 5738 | + $list = isset($parsed['logo']) ? '<img src="'.$this->config['base_url'].ltrim($parsed['logo'], "/").'" style="float:right;max-width:100px;height:auto;" />'.$nl : ''; |
|
| 5739 | + $list .= '<p>'.$nl; |
|
| 5740 | + $list .= isset($parsed['name']) ? '<strong>'.$parsed['name'].'</strong><br/>'.$nl : ''; |
|
| 5741 | + $list .= isset($parsed['description']) ? $parsed['description'].$nl : ''; |
|
| 5742 | + $list .= '</p><br/>'.$nl; |
|
| 5743 | + $list .= isset($parsed['version']) ? '<p><strong>'.$_lang['version'].':</strong> '.$parsed['version'].'</p>'.$nl : ''; |
|
| 5744 | + $list .= isset($parsed['license']) ? '<p><strong>'.$_lang['license'].':</strong> '.$parsed['license'].'</p>'.$nl : ''; |
|
| 5745 | + $list .= isset($parsed['lastupdate']) ? '<p><strong>'.$_lang['last_update'].':</strong> '.$parsed['lastupdate'].'</p>'.$nl : ''; |
|
| 5746 | + $list .= '<br/>'.$nl; |
|
| 5747 | 5747 | $first = true; |
| 5748 | 5748 | foreach ($arrayParams as $param => $label) { |
| 5749 | 5749 | if (isset($parsed[$param])) { |
| 5750 | 5750 | if ($first) { |
| 5751 | - $list .= '<p><strong>' . $_lang['references'] . '</strong></p>' . $nl; |
|
| 5752 | - $list .= '<ul class="docBlockList">' . $nl; |
|
| 5751 | + $list .= '<p><strong>'.$_lang['references'].'</strong></p>'.$nl; |
|
| 5752 | + $list .= '<ul class="docBlockList">'.$nl; |
|
| 5753 | 5753 | $first = false; |
| 5754 | 5754 | } |
| 5755 | - $list .= ' <li><strong>' . $label . '</strong>' . $nl; |
|
| 5756 | - $list .= ' <ul>' . $nl; |
|
| 5755 | + $list .= ' <li><strong>'.$label.'</strong>'.$nl; |
|
| 5756 | + $list .= ' <ul>'.$nl; |
|
| 5757 | 5757 | foreach ($parsed[$param] as $val) { |
| 5758 | - $list .= ' <li>' . $val . '</li>' . $nl; |
|
| 5758 | + $list .= ' <li>'.$val.'</li>'.$nl; |
|
| 5759 | 5759 | } |
| 5760 | - $list .= ' </ul></li>' . $nl; |
|
| 5760 | + $list .= ' </ul></li>'.$nl; |
|
| 5761 | 5761 | } |
| 5762 | 5762 | } |
| 5763 | - $list .= !$first ? '</ul>' . $nl : ''; |
|
| 5763 | + $list .= !$first ? '</ul>'.$nl : ''; |
|
| 5764 | 5764 | |
| 5765 | 5765 | return $list; |
| 5766 | 5766 | } |
@@ -5836,7 +5836,7 @@ discard block |
||
| 5836 | 5836 | */ |
| 5837 | 5837 | public function addSnippet($name, $phpCode) |
| 5838 | 5838 | { |
| 5839 | - $this->snippetCache['#' . $name] = $phpCode; |
|
| 5839 | + $this->snippetCache['#'.$name] = $phpCode; |
|
| 5840 | 5840 | } |
| 5841 | 5841 | |
| 5842 | 5842 | /** |
@@ -5845,7 +5845,7 @@ discard block |
||
| 5845 | 5845 | */ |
| 5846 | 5846 | public function addChunk($name, $text) |
| 5847 | 5847 | { |
| 5848 | - $this->chunkCache['#' . $name] = $text; |
|
| 5848 | + $this->chunkCache['#'.$name] = $text; |
|
| 5849 | 5849 | } |
| 5850 | 5850 | |
| 5851 | 5851 | /** |
@@ -5881,7 +5881,7 @@ discard block |
||
| 5881 | 5881 | } |
| 5882 | 5882 | |
| 5883 | 5883 | if (!$isSafe) { |
| 5884 | - $msg = $phpcode . "\n" . $this->currentSnippet . "\n" . print_r($_SERVER, true); |
|
| 5884 | + $msg = $phpcode."\n".$this->currentSnippet."\n".print_r($_SERVER, true); |
|
| 5885 | 5885 | $title = sprintf('Unknown eval was executed (%s)', $this->htmlspecialchars(substr(trim($phpcode), 0, 50))); |
| 5886 | 5886 | $this->messageQuit($title, '', true, '', '', 'Parser', $msg); |
| 5887 | 5887 | return; |
@@ -5895,7 +5895,7 @@ discard block |
||
| 5895 | 5895 | return 'array()'; |
| 5896 | 5896 | } |
| 5897 | 5897 | |
| 5898 | - $output = $echo . $return; |
|
| 5898 | + $output = $echo.$return; |
|
| 5899 | 5899 | modx_sanitize_gpc($output); |
| 5900 | 5900 | return $this->htmlspecialchars($output); // Maybe, all html tags are dangerous |
| 5901 | 5901 | } |
@@ -5913,8 +5913,8 @@ discard block |
||
| 5913 | 5913 | |
| 5914 | 5914 | $safe = explode(',', $safe_functions); |
| 5915 | 5915 | |
| 5916 | - $phpcode = rtrim($phpcode, ';') . ';'; |
|
| 5917 | - $tokens = token_get_all('<?php ' . $phpcode); |
|
| 5916 | + $phpcode = rtrim($phpcode, ';').';'; |
|
| 5917 | + $tokens = token_get_all('<?php '.$phpcode); |
|
| 5918 | 5918 | foreach ($tokens as $i => $token) { |
| 5919 | 5919 | if (!is_array($token)) { |
| 5920 | 5920 | continue; |
@@ -5950,7 +5950,7 @@ discard block |
||
| 5950 | 5950 | public function atBindFileContent($str = '') |
| 5951 | 5951 | { |
| 5952 | 5952 | |
| 5953 | - $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'] . 'files/', ''); |
|
| 5953 | + $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'].'files/', ''); |
|
| 5954 | 5954 | |
| 5955 | 5955 | if (stripos($str, '@FILE') !== 0) { |
| 5956 | 5956 | return $str; |
@@ -5973,7 +5973,7 @@ discard block |
||
| 5973 | 5973 | $errorMsg = sprintf("Could not retrieve string '%s'.", $str); |
| 5974 | 5974 | |
| 5975 | 5975 | foreach ($search_path as $path) { |
| 5976 | - $file_path = MODX_BASE_PATH . $path . $str; |
|
| 5976 | + $file_path = MODX_BASE_PATH.$path.$str; |
|
| 5977 | 5977 | if (strpos($file_path, MODX_MANAGER_PATH) === 0) { |
| 5978 | 5978 | return $errorMsg; |
| 5979 | 5979 | } elseif (is_file($file_path)) { |
@@ -5987,7 +5987,7 @@ discard block |
||
| 5987 | 5987 | return $errorMsg; |
| 5988 | 5988 | } |
| 5989 | 5989 | |
| 5990 | - $content = (string)file_get_contents($file_path); |
|
| 5990 | + $content = (string) file_get_contents($file_path); |
|
| 5991 | 5991 | if ($content === false) { |
| 5992 | 5992 | return $errorMsg; |
| 5993 | 5993 | } |
@@ -6100,22 +6100,22 @@ discard block |
||
| 6100 | 6100 | |
| 6101 | 6101 | $version = isset ($GLOBALS['modx_version']) ? $GLOBALS['modx_version'] : ''; |
| 6102 | 6102 | $release_date = isset ($GLOBALS['release_date']) ? $GLOBALS['release_date'] : ''; |
| 6103 | - $request_uri = "http://" . $_SERVER['HTTP_HOST'] . ($_SERVER["SERVER_PORT"] == 80 ? "" : (":" . $_SERVER["SERVER_PORT"])) . $_SERVER['REQUEST_URI']; |
|
| 6103 | + $request_uri = "http://".$_SERVER['HTTP_HOST'].($_SERVER["SERVER_PORT"] == 80 ? "" : (":".$_SERVER["SERVER_PORT"])).$_SERVER['REQUEST_URI']; |
|
| 6104 | 6104 | $request_uri = $this->htmlspecialchars($request_uri, ENT_QUOTES, $this->config['modx_charset']); |
| 6105 | 6105 | $ua = $this->htmlspecialchars($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, $this->config['modx_charset']); |
| 6106 | 6106 | $referer = $this->htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_QUOTES, $this->config['modx_charset']); |
| 6107 | 6107 | if ($is_error) { |
| 6108 | 6108 | $str = '<h2 style="color:red">« Evo Parse Error »</h2>'; |
| 6109 | 6109 | if ($msg != 'PHP Parse Error') { |
| 6110 | - $str .= '<h3 style="color:red">' . $msg . '</h3>'; |
|
| 6110 | + $str .= '<h3 style="color:red">'.$msg.'</h3>'; |
|
| 6111 | 6111 | } |
| 6112 | 6112 | } else { |
| 6113 | 6113 | $str = '<h2 style="color:#003399">« Evo Debug/ stop message »</h2>'; |
| 6114 | - $str .= '<h3 style="color:#003399">' . $msg . '</h3>'; |
|
| 6114 | + $str .= '<h3 style="color:#003399">'.$msg.'</h3>'; |
|
| 6115 | 6115 | } |
| 6116 | 6116 | |
| 6117 | 6117 | if (!empty ($query)) { |
| 6118 | - $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>'; |
|
| 6118 | + $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>'; |
|
| 6119 | 6119 | } |
| 6120 | 6120 | |
| 6121 | 6121 | $errortype = array( |
@@ -6138,13 +6138,13 @@ discard block |
||
| 6138 | 6138 | |
| 6139 | 6139 | if (!empty($nr) || !empty($file)) { |
| 6140 | 6140 | if ($text != '') { |
| 6141 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : ' . $text . '</div>'; |
|
| 6141 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : '.$text.'</div>'; |
|
| 6142 | 6142 | } |
| 6143 | 6143 | if ($output != '') { |
| 6144 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">' . $output . '</div>'; |
|
| 6144 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">'.$output.'</div>'; |
|
| 6145 | 6145 | } |
| 6146 | 6146 | if ($nr !== '') { |
| 6147 | - $table[] = array('ErrorType[num]', $errortype [$nr] . "[" . $nr . "]"); |
|
| 6147 | + $table[] = array('ErrorType[num]', $errortype [$nr]."[".$nr."]"); |
|
| 6148 | 6148 | } |
| 6149 | 6149 | if ($file) { |
| 6150 | 6150 | $table[] = array('File', $file); |
@@ -6164,7 +6164,7 @@ discard block |
||
| 6164 | 6164 | } |
| 6165 | 6165 | |
| 6166 | 6166 | if (!empty($this->event->activePlugin)) { |
| 6167 | - $table[] = array('Current Plugin', $this->event->activePlugin . '(' . $this->event->name . ')'); |
|
| 6167 | + $table[] = array('Current Plugin', $this->event->activePlugin.'('.$this->event->name.')'); |
|
| 6168 | 6168 | } |
| 6169 | 6169 | |
| 6170 | 6170 | $str .= $MakeTable->create($table, array('Error information', '')); |
@@ -6174,17 +6174,17 @@ discard block |
||
| 6174 | 6174 | $table[] = array('REQUEST_URI', $request_uri); |
| 6175 | 6175 | |
| 6176 | 6176 | if ($this->manager->action) { |
| 6177 | - include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
| 6177 | + include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php'); |
|
| 6178 | 6178 | global $action_list; |
| 6179 | 6179 | $actionName = (isset($action_list[$this->manager->action])) ? " - {$action_list[$this->manager->action]}" : ''; |
| 6180 | 6180 | |
| 6181 | - $table[] = array('Manager action', $this->manager->action . $actionName); |
|
| 6181 | + $table[] = array('Manager action', $this->manager->action.$actionName); |
|
| 6182 | 6182 | } |
| 6183 | 6183 | |
| 6184 | 6184 | if (preg_match('@^[0-9]+@', $this->documentIdentifier)) { |
| 6185 | 6185 | $resource = $this->getDocumentObject('id', $this->documentIdentifier); |
| 6186 | 6186 | $url = $this->makeUrl($this->documentIdentifier, '', '', 'full'); |
| 6187 | - $table[] = array('Resource', '[' . $this->documentIdentifier . '] <a href="' . $url . '" target="_blank">' . $resource['pagetitle'] . '</a>'); |
|
| 6187 | + $table[] = array('Resource', '['.$this->documentIdentifier.'] <a href="'.$url.'" target="_blank">'.$resource['pagetitle'].'</a>'); |
|
| 6188 | 6188 | } |
| 6189 | 6189 | $table[] = array('Referer', $referer); |
| 6190 | 6190 | $table[] = array('User Agent', $ua); |
@@ -6205,7 +6205,7 @@ discard block |
||
| 6205 | 6205 | |
| 6206 | 6206 | $mem = memory_get_peak_usage(true); |
| 6207 | 6207 | $total_mem = $mem - $this->mstart; |
| 6208 | - $total_mem = ($total_mem / 1024 / 1024) . ' mb'; |
|
| 6208 | + $total_mem = ($total_mem / 1024 / 1024).' mb'; |
|
| 6209 | 6209 | |
| 6210 | 6210 | $queryTime = $this->queryTime; |
| 6211 | 6211 | $phpTime = $totalTime - $queryTime; |
@@ -6226,18 +6226,18 @@ discard block |
||
| 6226 | 6226 | $str .= $this->get_backtrace(debug_backtrace()); |
| 6227 | 6227 | // Log error |
| 6228 | 6228 | if (!empty($this->currentSnippet)) { |
| 6229 | - $source = 'Snippet - ' . $this->currentSnippet; |
|
| 6229 | + $source = 'Snippet - '.$this->currentSnippet; |
|
| 6230 | 6230 | } elseif (!empty($this->event->activePlugin)) { |
| 6231 | - $source = 'Plugin - ' . $this->event->activePlugin; |
|
| 6231 | + $source = 'Plugin - '.$this->event->activePlugin; |
|
| 6232 | 6232 | } elseif ($source !== '') { |
| 6233 | - $source = 'Parser - ' . $source; |
|
| 6233 | + $source = 'Parser - '.$source; |
|
| 6234 | 6234 | } elseif ($query !== '') { |
| 6235 | 6235 | $source = 'SQL Query'; |
| 6236 | 6236 | } else { |
| 6237 | 6237 | $source = 'Parser'; |
| 6238 | 6238 | } |
| 6239 | 6239 | if ($msg) { |
| 6240 | - $source .= ' / ' . $msg; |
|
| 6240 | + $source .= ' / '.$msg; |
|
| 6241 | 6241 | } |
| 6242 | 6242 | if (isset($actionName) && !empty($actionName)) { |
| 6243 | 6243 | $source .= $actionName; |
@@ -6269,12 +6269,12 @@ discard block |
||
| 6269 | 6269 | |
| 6270 | 6270 | // Display error |
| 6271 | 6271 | if (isset($_SESSION['mgrValidated'])) { |
| 6272 | - 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> |
|
| 6272 | + 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> |
|
| 6273 | 6273 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 6274 | - <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'] . 'media/style/' . $this->config['manager_theme'] . '/style.css" /> |
|
| 6274 | + <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'].'media/style/'.$this->config['manager_theme'].'/style.css" /> |
|
| 6275 | 6275 | <style type="text/css">body { padding:10px; } td {font:inherit;}</style> |
| 6276 | 6276 | </head><body> |
| 6277 | - ' . $str . '</body></html>'; |
|
| 6277 | + ' . $str.'</body></html>'; |
|
| 6278 | 6278 | |
| 6279 | 6279 | } else { |
| 6280 | 6280 | echo 'Error'; |
@@ -6312,7 +6312,7 @@ discard block |
||
| 6312 | 6312 | switch ($val['type']) { |
| 6313 | 6313 | case '->': |
| 6314 | 6314 | case '::': |
| 6315 | - $functionName = $val['function'] = $val['class'] . $val['type'] . $val['function']; |
|
| 6315 | + $functionName = $val['function'] = $val['class'].$val['type'].$val['function']; |
|
| 6316 | 6316 | break; |
| 6317 | 6317 | default: |
| 6318 | 6318 | $functionName = $val['function']; |
@@ -6322,7 +6322,7 @@ discard block |
||
| 6322 | 6322 | $args = array_pad(array(), $_, '$var'); |
| 6323 | 6323 | $args = implode(", ", $args); |
| 6324 | 6324 | $modx = &$this; |
| 6325 | - $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) { |
|
| 6325 | + $args = preg_replace_callback('/\$var/', function() use ($modx, &$tmp, $val) { |
|
| 6326 | 6326 | $arg = $val['args'][$tmp - 1]; |
| 6327 | 6327 | switch (true) { |
| 6328 | 6328 | case is_null($arg): { |
@@ -6334,7 +6334,7 @@ discard block |
||
| 6334 | 6334 | break; |
| 6335 | 6335 | } |
| 6336 | 6336 | case is_scalar($arg): { |
| 6337 | - $out = strlen($arg) > 20 ? 'string $var' . $tmp : ("'" . $this->htmlspecialchars(str_replace("'", "\\'", $arg)) . "'"); |
|
| 6337 | + $out = strlen($arg) > 20 ? 'string $var'.$tmp : ("'".$this->htmlspecialchars(str_replace("'", "\\'", $arg))."'"); |
|
| 6338 | 6338 | break; |
| 6339 | 6339 | } |
| 6340 | 6340 | case is_bool($arg): { |
@@ -6342,23 +6342,23 @@ discard block |
||
| 6342 | 6342 | break; |
| 6343 | 6343 | } |
| 6344 | 6344 | case is_array($arg): { |
| 6345 | - $out = 'array $var' . $tmp; |
|
| 6345 | + $out = 'array $var'.$tmp; |
|
| 6346 | 6346 | break; |
| 6347 | 6347 | } |
| 6348 | 6348 | case is_object($arg): { |
| 6349 | - $out = get_class($arg) . ' $var' . $tmp; |
|
| 6349 | + $out = get_class($arg).' $var'.$tmp; |
|
| 6350 | 6350 | break; |
| 6351 | 6351 | } |
| 6352 | 6352 | default: { |
| 6353 | - $out = '$var' . $tmp; |
|
| 6353 | + $out = '$var'.$tmp; |
|
| 6354 | 6354 | } |
| 6355 | 6355 | } |
| 6356 | 6356 | $tmp++; |
| 6357 | 6357 | return $out; |
| 6358 | 6358 | }, $args); |
| 6359 | 6359 | $line = array( |
| 6360 | - "<strong>" . $functionName . "</strong>(" . $args . ")", |
|
| 6361 | - $path . " on line " . $val['line'] |
|
| 6360 | + "<strong>".$functionName."</strong>(".$args.")", |
|
| 6361 | + $path." on line ".$val['line'] |
|
| 6362 | 6362 | ); |
| 6363 | 6363 | $table[] = array(implode("<br />", $line)); |
| 6364 | 6364 | } |
@@ -6399,7 +6399,7 @@ discard block |
||
| 6399 | 6399 | $alias = strip_tags($alias); // strip HTML |
| 6400 | 6400 | $alias = preg_replace('/[^\.A-Za-z0-9 _-]/', '', $alias); // strip non-alphanumeric characters |
| 6401 | 6401 | $alias = preg_replace('/\s+/', '-', $alias); // convert white-space to dash |
| 6402 | - $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one |
|
| 6402 | + $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one |
|
| 6403 | 6403 | $alias = trim($alias, '-'); // trim excess |
| 6404 | 6404 | return $alias; |
| 6405 | 6405 | } |
@@ -6415,7 +6415,7 @@ discard block |
||
| 6415 | 6415 | $precisions = count($sizes) - 1; |
| 6416 | 6416 | foreach ($sizes as $unit => $bytes) { |
| 6417 | 6417 | if ($size >= $bytes) { |
| 6418 | - return number_format($size / $bytes, $precisions) . ' ' . $unit; |
|
| 6418 | + return number_format($size / $bytes, $precisions).' '.$unit; |
|
| 6419 | 6419 | } |
| 6420 | 6420 | $precisions--; |
| 6421 | 6421 | } |
@@ -6519,10 +6519,10 @@ discard block |
||
| 6519 | 6519 | |
| 6520 | 6520 | if (strpos($str, MODX_MANAGER_PATH) === 0) { |
| 6521 | 6521 | return false; |
| 6522 | - } elseif (is_file(MODX_BASE_PATH . $str)) { |
|
| 6523 | - $file_path = MODX_BASE_PATH . $str; |
|
| 6524 | - } elseif (is_file(MODX_BASE_PATH . "{$tpl_dir}{$str}")) { |
|
| 6525 | - $file_path = MODX_BASE_PATH . $tpl_dir . $str; |
|
| 6522 | + } elseif (is_file(MODX_BASE_PATH.$str)) { |
|
| 6523 | + $file_path = MODX_BASE_PATH.$str; |
|
| 6524 | + } elseif (is_file(MODX_BASE_PATH."{$tpl_dir}{$str}")) { |
|
| 6525 | + $file_path = MODX_BASE_PATH.$tpl_dir.$str; |
|
| 6526 | 6526 | } else { |
| 6527 | 6527 | return false; |
| 6528 | 6528 | } |
@@ -6648,7 +6648,7 @@ discard block |
||
| 6648 | 6648 | $title = 'no title'; |
| 6649 | 6649 | } |
| 6650 | 6650 | if (is_array($msg)) { |
| 6651 | - $msg = '<pre>' . print_r($msg, true) . '</pre>'; |
|
| 6651 | + $msg = '<pre>'.print_r($msg, true).'</pre>'; |
|
| 6652 | 6652 | } elseif ($msg === '') { |
| 6653 | 6653 | $msg = $_SERVER['REQUEST_URI']; |
| 6654 | 6654 | } |
@@ -6693,7 +6693,7 @@ discard block |
||
| 6693 | 6693 | if (is_array($SystemAlertMsgQueque)) { |
| 6694 | 6694 | $title = ''; |
| 6695 | 6695 | if ($this->name && $this->activePlugin) { |
| 6696 | - $title = "<div><b>" . $this->activePlugin . "</b> - <span style='color:maroon;'>" . $this->name . "</span></div>"; |
|
| 6696 | + $title = "<div><b>".$this->activePlugin."</b> - <span style='color:maroon;'>".$this->name."</span></div>"; |
|
| 6697 | 6697 | } |
| 6698 | 6698 | $SystemAlertMsgQueque[] = "$title<div style='margin-left:10px;margin-top:3px;'>$msg</div>"; |
| 6699 | 6699 | } |
@@ -695,13 +695,15 @@ discard block |
||
| 695 | 695 | $this->virtualDir = ''; |
| 696 | 696 | } |
| 697 | 697 | |
| 698 | - 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 */ |
|
| 698 | + if (preg_match('@^[1-9][0-9]*$@', $q) && !isset($this->documentListing[$q])) { |
|
| 699 | +/* we got an ID returned, check to make sure it's not an alias */ |
|
| 699 | 700 | /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */ |
| 700 | 701 | if ($this->config['use_alias_path'] == 1) { |
| 701 | 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 | 703 | $this->documentMethod = 'id'; |
| 703 | 704 | return $q; |
| 704 | - } else { /* not a valid id in terms of virtualDir, treat as alias */ |
|
| 705 | + } else { |
|
| 706 | +/* not a valid id in terms of virtualDir, treat as alias */ |
|
| 705 | 707 | $this->documentMethod = 'alias'; |
| 706 | 708 | return $q; |
| 707 | 709 | } |
@@ -709,7 +711,8 @@ discard block |
||
| 709 | 711 | $this->documentMethod = 'id'; |
| 710 | 712 | return $q; |
| 711 | 713 | } |
| 712 | - } else { /* we didn't get an ID back, so instead we assume it's an alias */ |
|
| 714 | + } else { |
|
| 715 | +/* we didn't get an ID back, so instead we assume it's an alias */ |
|
| 713 | 716 | if ($this->config['friendly_alias_urls'] != 1) { |
| 714 | 717 | $q = $qOrig; |
| 715 | 718 | } |
@@ -739,13 +742,14 @@ discard block |
||
| 739 | 742 | * @param $id |
| 740 | 743 | * @return array|mixed|null|string |
| 741 | 744 | */ |
| 742 | - public function makePageCacheKey($id){ |
|
| 745 | + public function makePageCacheKey($id) |
|
| 746 | + { |
|
| 743 | 747 | $hash = $id; |
| 744 | 748 | $tmp = null; |
| 745 | 749 | $params = array(); |
| 746 | - if(!empty($this->systemCacheKey)){ |
|
| 750 | + if(!empty($this->systemCacheKey)) { |
|
| 747 | 751 | $hash = $this->systemCacheKey; |
| 748 | - }else { |
|
| 752 | + } else { |
|
| 749 | 753 | if (!empty($_GET)) { |
| 750 | 754 | // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID. |
| 751 | 755 | $params = $_GET; |
@@ -754,7 +758,7 @@ discard block |
||
| 754 | 758 | } |
| 755 | 759 | } |
| 756 | 760 | $evtOut = $this->invokeEvent("OnMakePageCacheKey", array ("hash" => $hash, "id" => $id, 'params' => $params)); |
| 757 | - if (is_array($evtOut) && count($evtOut) > 0){ |
|
| 761 | + if (is_array($evtOut) && count($evtOut) > 0) { |
|
| 758 | 762 | $tmp = array_pop($evtOut); |
| 759 | 763 | } |
| 760 | 764 | return empty($tmp) ? $hash : $tmp; |
@@ -1165,10 +1169,18 @@ discard block |
||
| 1165 | 1169 | return array(); |
| 1166 | 1170 | } |
| 1167 | 1171 | $spacer = md5('<<<EVO>>>'); |
| 1168 | - if($left==='{{' && strpos($content,';}}')!==false) $content = str_replace(';}}', sprintf(';}%s}', $spacer),$content); |
|
| 1169 | - if($left==='{{' && strpos($content,'{{}}')!==false) $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content); |
|
| 1170 | - if($left==='[[' && strpos($content,']]]]')!==false) $content = str_replace(']]]]',sprintf(']]%s]]', $spacer),$content); |
|
| 1171 | - if($left==='[[' && strpos($content,']]]')!==false) $content = str_replace(']]]', sprintf(']%s]]', $spacer),$content); |
|
| 1172 | + if($left==='{{' && strpos($content,';}}')!==false) { |
|
| 1173 | + $content = str_replace(';}}', sprintf(';}%s}', $spacer),$content); |
|
| 1174 | + } |
|
| 1175 | + if($left==='{{' && strpos($content,'{{}}')!==false) { |
|
| 1176 | + $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content); |
|
| 1177 | + } |
|
| 1178 | + if($left==='[[' && strpos($content,']]]]')!==false) { |
|
| 1179 | + $content = str_replace(']]]]',sprintf(']]%s]]', $spacer),$content); |
|
| 1180 | + } |
|
| 1181 | + if($left==='[[' && strpos($content,']]]')!==false) { |
|
| 1182 | + $content = str_replace(']]]', sprintf(']%s]]', $spacer),$content); |
|
| 1183 | + } |
|
| 1172 | 1184 | |
| 1173 | 1185 | $pos['<![CDATA['] = strpos($content, '<![CDATA['); |
| 1174 | 1186 | $pos[']]>'] = strpos($content, ']]>'); |
@@ -1221,7 +1233,8 @@ discard block |
||
| 1221 | 1233 | } |
| 1222 | 1234 | } |
| 1223 | 1235 | |
| 1224 | - if (!in_array($fetch, $tags)) { // Avoid double Matches |
|
| 1236 | + if (!in_array($fetch, $tags)) { |
|
| 1237 | +// Avoid double Matches |
|
| 1225 | 1238 | $tags[] = $fetch; // Fetch |
| 1226 | 1239 | }; |
| 1227 | 1240 | $fetch = ''; // and reset |
@@ -1239,7 +1252,9 @@ discard block |
||
| 1239 | 1252 | } |
| 1240 | 1253 | } |
| 1241 | 1254 | foreach($tags as $i=>$tag) { |
| 1242 | - if(strpos($tag,$spacer)!==false) $tags[$i] = str_replace($spacer, '', $tag); |
|
| 1255 | + if(strpos($tag,$spacer)!==false) { |
|
| 1256 | + $tags[$i] = str_replace($spacer, '', $tag); |
|
| 1257 | + } |
|
| 1243 | 1258 | } |
| 1244 | 1259 | return $tags; |
| 1245 | 1260 | } |
@@ -1279,7 +1294,10 @@ discard block |
||
| 1279 | 1294 | } |
| 1280 | 1295 | |
| 1281 | 1296 | foreach ($matches[1] as $i => $key) { |
| 1282 | - if(strpos($key,'[+')!==false) continue; // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
| 1297 | + if(strpos($key,'[+')!==false) { |
|
| 1298 | + continue; |
|
| 1299 | + } |
|
| 1300 | + // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
| 1283 | 1301 | if (substr($key, 0, 1) == '#') { |
| 1284 | 1302 | $key = substr($key, 1); |
| 1285 | 1303 | } // remove # for QuickEdit format |
@@ -2004,7 +2022,8 @@ discard block |
||
| 2004 | 2022 | * @return mixed|string |
| 2005 | 2023 | */ |
| 2006 | 2024 | public function _getSGVar($value) |
| 2007 | - { // Get super globals |
|
| 2025 | + { |
|
| 2026 | +// Get super globals |
|
| 2008 | 2027 | $key = $value; |
| 2009 | 2028 | $_ = $this->config['enable_filter']; |
| 2010 | 2029 | $this->config['enable_filter'] = 1; |
@@ -2409,7 +2428,8 @@ discard block |
||
| 2409 | 2428 | if ($this->config['friendly_urls'] == 1) { |
| 2410 | 2429 | $aliases = array(); |
| 2411 | 2430 | if (is_array($this->documentListing)) { |
| 2412 | - foreach ($this->documentListing as $path => $docid) { // This is big Loop on large site! |
|
| 2431 | + foreach ($this->documentListing as $path => $docid) { |
|
| 2432 | +// This is big Loop on large site! |
|
| 2413 | 2433 | $aliases[$docid] = $path; |
| 2414 | 2434 | $isfolder[$docid] = $this->aliasListing[$docid]['isfolder']; |
| 2415 | 2435 | } |
@@ -2442,7 +2462,7 @@ discard block |
||
| 2442 | 2462 | $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0); |
| 2443 | 2463 | $pref = $this->config['friendly_url_prefix']; |
| 2444 | 2464 | $suff = $this->config['friendly_url_suffix']; |
| 2445 | - $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
| 2465 | + $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff){ |
|
| 2446 | 2466 | global $modx; |
| 2447 | 2467 | $thealias = $aliases[$m[1]]; |
| 2448 | 2468 | $thefolder = $isfolder[$m[1]]; |
@@ -4214,7 +4234,8 @@ discard block |
||
| 4214 | 4234 | if (isset ($this->snippetCache[$snippetName])) { |
| 4215 | 4235 | $snippet = $this->snippetCache[$snippetName]; |
| 4216 | 4236 | $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : ''; |
| 4217 | - } else { // not in cache so let's check the db |
|
| 4237 | + } else { |
|
| 4238 | +// not in cache so let's check the db |
|
| 4218 | 4239 | $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;"; |
| 4219 | 4240 | $result = $this->db->query($sql); |
| 4220 | 4241 | if ($this->db->getRecordCount($result) == 1) { |
@@ -4718,7 +4739,7 @@ discard block |
||
| 4718 | 4739 | $result = $this->db->makeArray($rs); |
| 4719 | 4740 | |
| 4720 | 4741 | // get default/built-in template variables |
| 4721 | - if(is_array($docRow)){ |
|
| 4742 | + if(is_array($docRow)) { |
|
| 4722 | 4743 | ksort($docRow); |
| 4723 | 4744 | |
| 4724 | 4745 | foreach ($docRow as $key => $value) { |
@@ -5197,12 +5218,16 @@ discard block |
||
| 5197 | 5218 | return ''; |
| 5198 | 5219 | } // nothing to register |
| 5199 | 5220 | if (!is_array($options)) { |
| 5200 | - if (is_bool($options)) // backward compatibility with old plaintext parameter |
|
| 5221 | + if (is_bool($options)) { |
|
| 5222 | + // backward compatibility with old plaintext parameter |
|
| 5201 | 5223 | { |
| 5202 | 5224 | $options = array('plaintext' => $options); |
| 5203 | - } elseif (is_string($options)) // Also allow script name as 2nd param |
|
| 5225 | + } |
|
| 5226 | + } elseif (is_string($options)) { |
|
| 5227 | + // Also allow script name as 2nd param |
|
| 5204 | 5228 | { |
| 5205 | 5229 | $options = array('name' => $options); |
| 5230 | + } |
|
| 5206 | 5231 | } else { |
| 5207 | 5232 | $options = array(); |
| 5208 | 5233 | } |
@@ -5214,7 +5239,8 @@ discard block |
||
| 5214 | 5239 | unset($overwritepos); // probably unnecessary--just making sure |
| 5215 | 5240 | |
| 5216 | 5241 | $useThisVer = true; |
| 5217 | - if (isset($this->loadedjscripts[$key])) { // a matching script was found |
|
| 5242 | + if (isset($this->loadedjscripts[$key])) { |
|
| 5243 | +// a matching script was found |
|
| 5218 | 5244 | // if existing script is a startup script, make sure the candidate is also a startup script |
| 5219 | 5245 | if ($this->loadedjscripts[$key]['startup']) { |
| 5220 | 5246 | $startup = true; |
@@ -5234,7 +5260,8 @@ discard block |
||
| 5234 | 5260 | // overwrite the old script (the position may be important for dependent scripts) |
| 5235 | 5261 | $overwritepos = $this->loadedjscripts[$key]['pos']; |
| 5236 | 5262 | } |
| 5237 | - } else { // Use the original version |
|
| 5263 | + } else { |
|
| 5264 | +// Use the original version |
|
| 5238 | 5265 | if ($startup == true && $this->loadedjscripts[$key]['startup'] == false) { |
| 5239 | 5266 | // need to move the exisiting script to the head |
| 5240 | 5267 | $version = $this->loadedjscripts[$key][$version]; |
@@ -5358,7 +5385,8 @@ discard block |
||
| 5358 | 5385 | } |
| 5359 | 5386 | |
| 5360 | 5387 | $results = null; |
| 5361 | - foreach ($this->pluginEvent[$evtName] as $pluginName) { // start for loop |
|
| 5388 | + foreach ($this->pluginEvent[$evtName] as $pluginName) { |
|
| 5389 | +// start for loop |
|
| 5362 | 5390 | if ($this->dumpPlugins) { |
| 5363 | 5391 | $eventtime = $this->getMicroTime(); |
| 5364 | 5392 | } |
@@ -5906,7 +5934,8 @@ discard block |
||
| 5906 | 5934 | * @return bool |
| 5907 | 5935 | */ |
| 5908 | 5936 | public function isSafeCode($phpcode = '', $safe_functions = '') |
| 5909 | - { // return true or false |
|
| 5937 | + { |
|
| 5938 | +// return true or false |
|
| 5910 | 5939 | if ($safe_functions == '') { |
| 5911 | 5940 | return false; |
| 5912 | 5941 | } |
@@ -6322,7 +6351,7 @@ discard block |
||
| 6322 | 6351 | $args = array_pad(array(), $_, '$var'); |
| 6323 | 6352 | $args = implode(", ", $args); |
| 6324 | 6353 | $modx = &$this; |
| 6325 | - $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) { |
|
| 6354 | + $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val){ |
|
| 6326 | 6355 | $arg = $val['args'][$tmp - 1]; |
| 6327 | 6356 | switch (true) { |
| 6328 | 6357 | case is_null($arg): { |
@@ -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 | ?> |
| 47 | 47 | \ No newline at end of file |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | $sysMsgs = ""; |
| 14 | 14 | $limit = count($SystemAlertMsgQueque); |
| 15 | - for($i=0;$i<$limit;$i++) { |
|
| 15 | + for ($i = 0; $i < $limit; $i++) { |
|
| 16 | 16 | $sysMsgs .= $SystemAlertMsgQueque[$i]."<hr sys/>"; |
| 17 | 17 | } |
| 18 | 18 | // reset message queque |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | $_SESSION['SystemAlertMsgQueque'] = array(); |
| 21 | 21 | $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque']; |
| 22 | 22 | |
| 23 | - if($sysMsgs!="") { |
|
| 23 | + if ($sysMsgs != "") { |
|
| 24 | 24 | ?> |
| 25 | 25 | |
| 26 | 26 | <?php // fetch the styles |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | var sysAlert = new Element('div').setProperties({ |
| 33 | 33 | 'class': 'sysAlert' |
| 34 | 34 | }); |
| 35 | - sysAlert.innerHTML = '<?php echo $modx->db->escape($sysMsgs);?>'; |
|
| 35 | + sysAlert.innerHTML = '<?php echo $modx->db->escape($sysMsgs); ?>'; |
|
| 36 | 36 | var boxHtml = new MooPrompt('<?php echo $_lang['sys_alert']; ?>', sysAlert, { |
| 37 | 37 | buttons: 1, |
| 38 | 38 | button1: 'Ok', |
@@ -31,10 +31,10 @@ discard block |
||
| 31 | 31 | class Paging |
| 32 | 32 | { |
| 33 | 33 | |
| 34 | - var $int_num_result; // Number of result to show per page (decided by user) |
|
| 35 | - var $int_nbr_row; // Total number of items (SQL count from db) |
|
| 36 | - var $int_cur_position;// Current position in recordset |
|
| 37 | - var $str_ext_argv; // Extra argv of query string |
|
| 34 | + var $int_num_result; // Number of result to show per page (decided by user) |
|
| 35 | + var $int_nbr_row; // Total number of items (SQL count from db) |
|
| 36 | + var $int_cur_position; // Current position in recordset |
|
| 37 | + var $str_ext_argv; // Extra argv of query string |
|
| 38 | 38 | |
| 39 | 39 | // ------------------------------------------------------------------------ Constructor |
| 40 | 40 | // |
@@ -64,14 +64,14 @@ discard block |
||
| 64 | 64 | $array_paging['total'] = $this->int_nbr_row; |
| 65 | 65 | |
| 66 | 66 | if ($this->int_cur_position != 0) { |
| 67 | - $array_paging['first_link'] = "<a href=\"$PHP_SELF?int_cur_position=0" . $this->str_ext_argv . "\">"; |
|
| 68 | - $array_paging['previous_link'] = "<a href=\"$PHP_SELF?int_cur_position=" . ($this->int_cur_position - $this->int_num_result) . $this->str_ext_argv . "\">"; |
|
| 67 | + $array_paging['first_link'] = "<a href=\"$PHP_SELF?int_cur_position=0".$this->str_ext_argv."\">"; |
|
| 68 | + $array_paging['previous_link'] = "<a href=\"$PHP_SELF?int_cur_position=".($this->int_cur_position - $this->int_num_result).$this->str_ext_argv."\">"; |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | if (($this->int_nbr_row - $this->int_cur_position) > $this->int_num_result) { |
| 72 | 72 | $int_new_position = $this->int_cur_position + $this->int_num_result; |
| 73 | - $array_paging['last_link'] = "<a href=\"$PHP_SELF?int_cur_position=" . $this->int_nbr_row . $this->str_ext_argv . "\">"; |
|
| 74 | - $array_paging['next_link'] = "<a href=\"$PHP_SELF?int_cur_position=$int_new_position" . $this->str_ext_argv . "\">"; |
|
| 73 | + $array_paging['last_link'] = "<a href=\"$PHP_SELF?int_cur_position=".$this->int_nbr_row.$this->str_ext_argv."\">"; |
|
| 74 | + $array_paging['next_link'] = "<a href=\"$PHP_SELF?int_cur_position=$int_new_position".$this->str_ext_argv."\">"; |
|
| 75 | 75 | } |
| 76 | 76 | return $array_paging; |
| 77 | 77 | } // end function |
@@ -86,10 +86,10 @@ discard block |
||
| 86 | 86 | for ($i = 0; $i < $this->getNumberOfPage(); $i++) { |
| 87 | 87 | // if current page, do not make a link |
| 88 | 88 | if ($i == $this->getCurrentPage()) { |
| 89 | - $array_all_page[$i] = "<b>" . ($i + 1) . "</b> "; |
|
| 89 | + $array_all_page[$i] = "<b>".($i + 1)."</b> "; |
|
| 90 | 90 | } else { |
| 91 | 91 | $int_new_position = ($i * $this->int_num_result); |
| 92 | - $array_all_page[$i] = "<a href=\"" . $PHP_SELF . "?int_cur_position=$int_new_position$this->str_ext_argv\">" . ($i + 1) . "</a> "; |
|
| 92 | + $array_all_page[$i] = "<a href=\"".$PHP_SELF."?int_cur_position=$int_new_position$this->str_ext_argv\">".($i + 1)."</a> "; |
|
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | return $array_all_page; |
@@ -21,5 +21,5 @@ |
||
| 21 | 21 | if($ok) { |
| 22 | 22 | echo '{status:"ok"}'; |
| 23 | 23 | } else { |
| 24 | - echo '{status:"null"}'; |
|
| 24 | + echo '{status:"null"}'; |
|
| 25 | 25 | } |
@@ -12,13 +12,13 @@ |
||
| 12 | 12 | $modx->invokeEvent('OnManagerPageInit'); |
| 13 | 13 | $ok = false; |
| 14 | 14 | |
| 15 | -if($modx->elementIsLocked($_GET['type'], $_GET['id'], true)) { |
|
| 15 | +if ($modx->elementIsLocked($_GET['type'], $_GET['id'], true)) { |
|
| 16 | 16 | $modx->lockElement($_GET['type'], $_GET['id'], true); |
| 17 | 17 | $ok = true; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | header('Content-type: application/json'); |
| 21 | -if($ok) { |
|
| 21 | +if ($ok) { |
|
| 22 | 22 | echo '{status:"ok"}'; |
| 23 | 23 | } else { |
| 24 | 24 | echo '{status:"null"}'; |
@@ -12,24 +12,24 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | -class logHandler { |
|
| 15 | +class logHandler{ |
|
| 16 | 16 | // Single variable for a log entry |
| 17 | 17 | var $entry = array(); |
| 18 | 18 | |
| 19 | - function initAndWriteLog($msg="", $internalKey="", $username="", $action="", $itemid="", $itemname="") { |
|
| 19 | + function initAndWriteLog($msg = "", $internalKey = "", $username = "", $action = "", $itemid = "", $itemname = ""){ |
|
| 20 | 20 | global $modx; |
| 21 | 21 | $this->entry['msg'] = $msg; // writes testmessage to the object |
| 22 | - $this->entry['action'] = empty($action)? $modx->manager->action : $action; // writes the action to the object |
|
| 22 | + $this->entry['action'] = empty($action) ? $modx->manager->action : $action; // writes the action to the object |
|
| 23 | 23 | |
| 24 | 24 | // User Credentials |
| 25 | 25 | $this->entry['internalKey'] = $internalKey == "" ? $modx->getLoginUserID() : $internalKey; |
| 26 | 26 | $this->entry['username'] = $username == "" ? $modx->getLoginUserName() : $username; |
| 27 | 27 | |
| 28 | - $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int)$_REQUEST['id'] : $itemid; // writes the id to the object |
|
| 29 | - if($this->entry['itemId'] == 0) $this->entry['itemId'] = "-"; // to stop items having id 0 |
|
| 28 | + $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int) $_REQUEST['id'] : $itemid; // writes the id to the object |
|
| 29 | + if ($this->entry['itemId'] == 0) $this->entry['itemId'] = "-"; // to stop items having id 0 |
|
| 30 | 30 | |
| 31 | - $this->entry['itemName'] = ($itemname == "" && isset($_SESSION['itemname']))? $_SESSION['itemname'] : $itemname; // writes the id to the object |
|
| 32 | - if($this->entry['itemName'] == "") $this->entry['itemName'] = "-"; // to stop item name being empty |
|
| 31 | + $this->entry['itemName'] = ($itemname == "" && isset($_SESSION['itemname'])) ? $_SESSION['itemname'] : $itemname; // writes the id to the object |
|
| 32 | + if ($this->entry['itemName'] == "") $this->entry['itemName'] = "-"; // to stop item name being empty |
|
| 33 | 33 | |
| 34 | 34 | $this->writeToLog(); |
| 35 | 35 | return; |
@@ -38,20 +38,20 @@ discard block |
||
| 38 | 38 | // function to write to the log |
| 39 | 39 | // collects all required info, and |
| 40 | 40 | // writes it to the logging table |
| 41 | - function writeToLog() { |
|
| 41 | + function writeToLog(){ |
|
| 42 | 42 | global $modx; |
| 43 | 43 | $tbl_manager_log = $modx->getFullTableName('manager_log'); |
| 44 | 44 | |
| 45 | - if($this->entry['internalKey'] == "") { |
|
| 45 | + if ($this->entry['internalKey'] == "") { |
|
| 46 | 46 | $modx->webAlertAndQuit("Logging error: internalKey not set."); |
| 47 | 47 | } |
| 48 | - if(empty($this->entry['action'])) { |
|
| 48 | + if (empty($this->entry['action'])) { |
|
| 49 | 49 | $modx->webAlertAndQuit("Logging error: action not set."); |
| 50 | 50 | } |
| 51 | - if($this->entry['msg'] == "") { |
|
| 51 | + if ($this->entry['msg'] == "") { |
|
| 52 | 52 | include_once "actionlist.inc.php"; |
| 53 | 53 | $this->entry['msg'] = getAction($this->entry['action'], $this->entry['itemId']); |
| 54 | - if($this->entry['msg'] == "") { |
|
| 54 | + if ($this->entry['msg'] == "") { |
|
| 55 | 55 | $modx->webAlertAndQuit("Logging error: couldn't find message to write to log."); |
| 56 | 56 | } |
| 57 | 57 | } |
@@ -63,14 +63,14 @@ discard block |
||
| 63 | 63 | $fields['itemid'] = $this->entry['itemId']; |
| 64 | 64 | $fields['itemname'] = $modx->db->escape($this->entry['itemName']); |
| 65 | 65 | $fields['message'] = $modx->db->escape($this->entry['msg']); |
| 66 | - $insert_id = $modx->db->insert($fields,$tbl_manager_log); |
|
| 67 | - if(!$insert_id) { |
|
| 66 | + $insert_id = $modx->db->insert($fields, $tbl_manager_log); |
|
| 67 | + if (!$insert_id) { |
|
| 68 | 68 | $modx->messageQuit("Logging error: couldn't save log to table! Error code: ".$modx->db->getLastError()); |
| 69 | 69 | } else { |
| 70 | 70 | $limit = (isset($modx->config['manager_log_limit'])) ? intval($modx->config['manager_log_limit']) : 3000; |
| 71 | - $trim = (isset($modx->config['manager_log_trim'])) ? intval($modx->config['manager_log_trim']) : 100; |
|
| 72 | - if(($insert_id % $trim) === 0) { |
|
| 73 | - $modx->rotate_log('manager_log',$limit,$trim); |
|
| 71 | + $trim = (isset($modx->config['manager_log_trim'])) ? intval($modx->config['manager_log_trim']) : 100; |
|
| 72 | + if (($insert_id % $trim) === 0) { |
|
| 73 | + $modx->rotate_log('manager_log', $limit, $trim); |
|
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | } |
@@ -12,11 +12,13 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | -class logHandler { |
|
| 15 | +class logHandler |
|
| 16 | +{ |
|
| 16 | 17 | // Single variable for a log entry |
| 17 | 18 | var $entry = array(); |
| 18 | 19 | |
| 19 | - function initAndWriteLog($msg="", $internalKey="", $username="", $action="", $itemid="", $itemname="") { |
|
| 20 | + function initAndWriteLog($msg="", $internalKey="", $username="", $action="", $itemid="", $itemname="") |
|
| 21 | + { |
|
| 20 | 22 | global $modx; |
| 21 | 23 | $this->entry['msg'] = $msg; // writes testmessage to the object |
| 22 | 24 | $this->entry['action'] = empty($action)? $modx->manager->action : $action; // writes the action to the object |
@@ -26,10 +28,16 @@ discard block |
||
| 26 | 28 | $this->entry['username'] = $username == "" ? $modx->getLoginUserName() : $username; |
| 27 | 29 | |
| 28 | 30 | $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int)$_REQUEST['id'] : $itemid; // writes the id to the object |
| 29 | - if($this->entry['itemId'] == 0) $this->entry['itemId'] = "-"; // to stop items having id 0 |
|
| 31 | + if($this->entry['itemId'] == 0) { |
|
| 32 | + $this->entry['itemId'] = "-"; |
|
| 33 | + } |
|
| 34 | + // to stop items having id 0 |
|
| 30 | 35 | |
| 31 | 36 | $this->entry['itemName'] = ($itemname == "" && isset($_SESSION['itemname']))? $_SESSION['itemname'] : $itemname; // writes the id to the object |
| 32 | - if($this->entry['itemName'] == "") $this->entry['itemName'] = "-"; // to stop item name being empty |
|
| 37 | + if($this->entry['itemName'] == "") { |
|
| 38 | + $this->entry['itemName'] = "-"; |
|
| 39 | + } |
|
| 40 | + // to stop item name being empty |
|
| 33 | 41 | |
| 34 | 42 | $this->writeToLog(); |
| 35 | 43 | return; |
@@ -38,7 +46,8 @@ discard block |
||
| 38 | 46 | // function to write to the log |
| 39 | 47 | // collects all required info, and |
| 40 | 48 | // writes it to the logging table |
| 41 | - function writeToLog() { |
|
| 49 | + function writeToLog() |
|
| 50 | + { |
|
| 42 | 51 | global $modx; |
| 43 | 52 | $tbl_manager_log = $modx->getFullTableName('manager_log'); |
| 44 | 53 | |
@@ -3,14 +3,14 @@ discard block |
||
| 3 | 3 | |
| 4 | 4 | // PROCESSOR FIRST |
| 5 | 5 | if($_SESSION['mgrRole'] == 1) { |
| 6 | - if($_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) { |
|
| 7 | - $current = $modx->manager->getSystemChecksum($modx->config['check_files_onlogin']); |
|
| 8 | - if(!empty($current)) { |
|
| 9 | - $modx->manager->setSystemChecksum($current); |
|
| 10 | - $modx->clearCache('full'); |
|
| 11 | - $modx->config['sys_files_checksum'] = $current; |
|
| 12 | - }; |
|
| 13 | - } |
|
| 6 | + if($_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) { |
|
| 7 | + $current = $modx->manager->getSystemChecksum($modx->config['check_files_onlogin']); |
|
| 8 | + if(!empty($current)) { |
|
| 9 | + $modx->manager->setSystemChecksum($current); |
|
| 10 | + $modx->clearCache('full'); |
|
| 11 | + $modx->config['sys_files_checksum'] = $current; |
|
| 12 | + }; |
|
| 13 | + } |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | // NOW CHECK CONFIG |
@@ -18,15 +18,15 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | $sysfiles_check = $modx->manager->checkSystemChecksum(); |
| 20 | 20 | if ($sysfiles_check!=='0'){ |
| 21 | - $warningspresent = 1; |
|
| 22 | - $warnings[] = array($_lang['configcheck_sysfiles_mod']); |
|
| 21 | + $warningspresent = 1; |
|
| 22 | + $warnings[] = array($_lang['configcheck_sysfiles_mod']); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | if (is_writable("includes/config.inc.php")){ |
| 26 | 26 | // Warn if world writable |
| 27 | 27 | if(@fileperms('includes/config.inc.php') & 0x0002) { |
| 28 | - $warningspresent = 1; |
|
| 29 | - $warnings[] = array($_lang['configcheck_configinc']); |
|
| 28 | + $warningspresent = 1; |
|
| 29 | + $warnings[] = array($_lang['configcheck_configinc']); |
|
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | |
@@ -177,10 +177,10 @@ discard block |
||
| 177 | 177 | break; |
| 178 | 178 | case $_lang['configcheck_sysfiles_mod']: |
| 179 | 179 | $warnings[$i][1] = $_lang["configcheck_sysfiles_mod_msg"]; |
| 180 | - $warnings[$i][2] = '<ul><li>'. join('</li><li>', $sysfiles_check) .'</li></ul>'; |
|
| 181 | - if($modx->hasPermission('settings')) { |
|
| 182 | - $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>'; |
|
| 183 | - } |
|
| 180 | + $warnings[$i][2] = '<ul><li>'. join('</li><li>', $sysfiles_check) .'</li></ul>'; |
|
| 181 | + if($modx->hasPermission('settings')) { |
|
| 182 | + $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>'; |
|
| 183 | + } |
|
| 184 | 184 | if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1]." ".join(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']); |
| 185 | 185 | break; |
| 186 | 186 | case $_lang['configcheck_lang_difference'] : |
@@ -88,7 +88,7 @@ |
||
| 88 | 88 | } |
| 89 | 89 | </script> |
| 90 | 90 | |
| 91 | -JS; |
|
| 91 | +js; |
|
| 92 | 92 | $modx->regClientScript($script); |
| 93 | 93 | } |
| 94 | 94 | } |
@@ -1,13 +1,13 @@ 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 | // PROCESSOR FIRST |
| 7 | -if($_SESSION['mgrRole'] == 1) { |
|
| 8 | - if($_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) { |
|
| 7 | +if ($_SESSION['mgrRole'] == 1) { |
|
| 8 | + if ($_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) { |
|
| 9 | 9 | $current = $modx->manager->getSystemChecksum($modx->config['check_files_onlogin']); |
| 10 | - if(!empty($current)) { |
|
| 10 | + if (!empty($current)) { |
|
| 11 | 11 | $modx->manager->setSystemChecksum($current); |
| 12 | 12 | $modx->clearCache('full'); |
| 13 | 13 | $modx->config['sys_files_checksum'] = $current; |
@@ -19,14 +19,14 @@ discard block |
||
| 19 | 19 | $warningspresent = 0; |
| 20 | 20 | |
| 21 | 21 | $sysfiles_check = $modx->manager->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 | - if(@fileperms('includes/config.inc.php') & 0x0002) { |
|
| 29 | + if (@fileperms('includes/config.inc.php') & 0x0002) { |
|
| 30 | 30 | $warningspresent = 1; |
| 31 | 31 | $warnings[] = array($_lang['configcheck_configinc']); |
| 32 | 32 | } |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | $warnings[] = array($_lang['configcheck_php_gdzip']); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | -if(!isset($modx->config['_hide_configcheck_validate_referer']) || $modx->config['_hide_configcheck_validate_referer'] !== '1') { |
|
| 46 | - if(isset($_SESSION['mgrPermissions']['settings']) && $_SESSION['mgrPermissions']['settings'] == '1') { |
|
| 45 | +if (!isset($modx->config['_hide_configcheck_validate_referer']) || $modx->config['_hide_configcheck_validate_referer'] !== '1') { |
|
| 46 | + if (isset($_SESSION['mgrPermissions']['settings']) && $_SESSION['mgrPermissions']['settings'] == '1') { |
|
| 47 | 47 | if ($modx->db->getValue($modx->db->select('COUNT(setting_value)', $modx->getFullTableName('system_settings'), "setting_name='validate_referer' AND setting_value='0'"))) { |
| 48 | 48 | $warningspresent = 1; |
| 49 | 49 | $warnings[] = array($_lang['configcheck_validate_referer']); |
@@ -52,11 +52,11 @@ discard block |
||
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | // check for Template Switcher plugin |
| 55 | -if(!isset($modx->config['_hide_configcheck_templateswitcher_present']) || $modx->config['_hide_configcheck_templateswitcher_present'] !== '1') { |
|
| 56 | - if(isset($_SESSION['mgrPermissions']['edit_plugin']) && $_SESSION['mgrPermissions']['edit_plugin'] == '1') { |
|
| 55 | +if (!isset($modx->config['_hide_configcheck_templateswitcher_present']) || $modx->config['_hide_configcheck_templateswitcher_present'] !== '1') { |
|
| 56 | + if (isset($_SESSION['mgrPermissions']['edit_plugin']) && $_SESSION['mgrPermissions']['edit_plugin'] == '1') { |
|
| 57 | 57 | $rs = $modx->db->select('name, disabled', $modx->getFullTableName('site_plugins'), "name IN ('TemplateSwitcher', 'Template Switcher', 'templateswitcher', 'template_switcher', 'template switcher') OR plugincode LIKE '%TemplateSwitcher%'"); |
| 58 | 58 | $row = $modx->db->getRow($rs); |
| 59 | - if($row && $row['disabled'] == 0) { |
|
| 59 | + if ($row && $row['disabled'] == 0) { |
|
| 60 | 60 | $warningspresent = 1; |
| 61 | 61 | $warnings[] = array($_lang['configcheck_templateswitcher_present']); |
| 62 | 62 | $tplName = $row['name']; |
@@ -117,36 +117,36 @@ discard block |
||
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | if (!function_exists('checkSiteCache')) { |
| 120 | - function checkSiteCache() { |
|
| 120 | + function checkSiteCache(){ |
|
| 121 | 121 | global $modx; |
| 122 | - $checked= true; |
|
| 123 | - if (file_exists($modx->config['base_path'] . 'assets/cache/siteCache.idx.php')) { |
|
| 124 | - $checked= @include_once ($modx->config['base_path'] . 'assets/cache/siteCache.idx.php'); |
|
| 122 | + $checked = true; |
|
| 123 | + if (file_exists($modx->config['base_path'].'assets/cache/siteCache.idx.php')) { |
|
| 124 | + $checked = @include_once ($modx->config['base_path'].'assets/cache/siteCache.idx.php'); |
|
| 125 | 125 | } |
| 126 | 126 | return $checked; |
| 127 | 127 | } |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | -if (!is_writable(MODX_BASE_PATH . "assets/cache/")) { |
|
| 130 | +if (!is_writable(MODX_BASE_PATH."assets/cache/")) { |
|
| 131 | 131 | $warningspresent = 1; |
| 132 | 132 | $warnings[] = array($_lang['configcheck_cache']); |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | if (!checkSiteCache()) { |
| 136 | 136 | $warningspresent = 1; |
| 137 | - $warnings[]= array($lang['configcheck_sitecache_integrity']); |
|
| 137 | + $warnings[] = array($lang['configcheck_sitecache_integrity']); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | -if (!is_writable(MODX_BASE_PATH . "assets/images/")) { |
|
| 140 | +if (!is_writable(MODX_BASE_PATH."assets/images/")) { |
|
| 141 | 141 | $warningspresent = 1; |
| 142 | 142 | $warnings[] = array($_lang['configcheck_images']); |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | -if(strpos($modx->config['rb_base_dir'],MODX_BASE_PATH)!==0) { |
|
| 145 | +if (strpos($modx->config['rb_base_dir'], MODX_BASE_PATH) !== 0) { |
|
| 146 | 146 | $warningspresent = 1; |
| 147 | 147 | $warnings[] = array($_lang['configcheck_rb_base_dir']); |
| 148 | 148 | } |
| 149 | -if(strpos($modx->config['filemanager_path'],MODX_BASE_PATH)!==0) { |
|
| 149 | +if (strpos($modx->config['filemanager_path'], MODX_BASE_PATH) !== 0) { |
|
| 150 | 150 | $warningspresent = 1; |
| 151 | 151 | $warnings[] = array($_lang['configcheck_filemanager_path']); |
| 152 | 152 | } |
@@ -154,36 +154,36 @@ discard block |
||
| 154 | 154 | // clear file info cache |
| 155 | 155 | clearstatcache(); |
| 156 | 156 | |
| 157 | -if ($warningspresent==1) { |
|
| 157 | +if ($warningspresent == 1) { |
|
| 158 | 158 | |
| 159 | -if(!isset($modx->config['send_errormail'])) $modx->config['send_errormail']='3'; |
|
| 159 | +if (!isset($modx->config['send_errormail'])) $modx->config['send_errormail'] = '3'; |
|
| 160 | 160 | $config_check_results = "<h3>".$_lang['configcheck_notok']."</h3>"; |
| 161 | 161 | |
| 162 | -for ($i=0;$i<count($warnings);$i++) { |
|
| 162 | +for ($i = 0; $i < count($warnings); $i++) { |
|
| 163 | 163 | switch ($warnings[$i][0]) { |
| 164 | 164 | case $_lang['configcheck_configinc']; |
| 165 | 165 | $warnings[$i][1] = $_lang['configcheck_configinc_msg']; |
| 166 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_configinc']); |
|
| 166 | + if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 3, $warnings[$i][1], $_lang['configcheck_configinc']); |
|
| 167 | 167 | break; |
| 168 | 168 | case $_lang['configcheck_installer'] : |
| 169 | 169 | $warnings[$i][1] = $_lang['configcheck_installer_msg']; |
| 170 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_installer']); |
|
| 170 | + if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 3, $warnings[$i][1], $_lang['configcheck_installer']); |
|
| 171 | 171 | break; |
| 172 | 172 | case $_lang['configcheck_cache'] : |
| 173 | 173 | $warnings[$i][1] = $_lang['configcheck_cache_msg']; |
| 174 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_cache']); |
|
| 174 | + if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 2, $warnings[$i][1], $_lang['configcheck_cache']); |
|
| 175 | 175 | break; |
| 176 | 176 | case $_lang['configcheck_images'] : |
| 177 | 177 | $warnings[$i][1] = $_lang['configcheck_images_msg']; |
| 178 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_images']); |
|
| 178 | + if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 2, $warnings[$i][1], $_lang['configcheck_images']); |
|
| 179 | 179 | break; |
| 180 | 180 | case $_lang['configcheck_sysfiles_mod']: |
| 181 | 181 | $warnings[$i][1] = $_lang["configcheck_sysfiles_mod_msg"]; |
| 182 | - $warnings[$i][2] = '<ul><li>'. join('</li><li>', $sysfiles_check) .'</li></ul>'; |
|
| 183 | - if($modx->hasPermission('settings')) { |
|
| 184 | - $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>'; |
|
| 182 | + $warnings[$i][2] = '<ul><li>'.join('</li><li>', $sysfiles_check).'</li></ul>'; |
|
| 183 | + if ($modx->hasPermission('settings')) { |
|
| 184 | + $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>'; |
|
| 185 | 185 | } |
| 186 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1]." ".join(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']); |
|
| 186 | + if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 3, $warnings[$i][1]." ".join(', ', $sysfiles_check), $_lang['configcheck_sysfiles_mod']); |
|
| 187 | 187 | break; |
| 188 | 188 | case $_lang['configcheck_lang_difference'] : |
| 189 | 189 | $warnings[$i][1] = $_lang['configcheck_lang_difference_msg']; |
@@ -205,18 +205,18 @@ discard block |
||
| 205 | 205 | break; |
| 206 | 206 | case $_lang['configcheck_validate_referer'] : |
| 207 | 207 | $msg = $_lang['configcheck_validate_referer_msg']; |
| 208 | - $msg .= '<br />' . sprintf($_lang["configcheck_hide_warning"], 'validate_referer'); |
|
| 208 | + $msg .= '<br />'.sprintf($_lang["configcheck_hide_warning"], 'validate_referer'); |
|
| 209 | 209 | $warnings[$i][1] = "<span id=\"validate_referer_warning_wrapper\">{$msg}</span>\n"; |
| 210 | 210 | break; |
| 211 | 211 | case $_lang['configcheck_templateswitcher_present'] : |
| 212 | 212 | $msg = $_lang["configcheck_templateswitcher_present_msg"]; |
| 213 | - if(isset($_SESSION['mgrPermissions']['save_plugin']) && $_SESSION['mgrPermissions']['save_plugin'] == '1') { |
|
| 214 | - $msg .= '<br />' . $_lang["configcheck_templateswitcher_present_disable"]; |
|
| 213 | + if (isset($_SESSION['mgrPermissions']['save_plugin']) && $_SESSION['mgrPermissions']['save_plugin'] == '1') { |
|
| 214 | + $msg .= '<br />'.$_lang["configcheck_templateswitcher_present_disable"]; |
|
| 215 | 215 | } |
| 216 | - if(isset($_SESSION['mgrPermissions']['delete_plugin']) && $_SESSION['mgrPermissions']['delete_plugin'] == '1') { |
|
| 217 | - $msg .= '<br />' . $_lang["configcheck_templateswitcher_present_delete"]; |
|
| 216 | + if (isset($_SESSION['mgrPermissions']['delete_plugin']) && $_SESSION['mgrPermissions']['delete_plugin'] == '1') { |
|
| 217 | + $msg .= '<br />'.$_lang["configcheck_templateswitcher_present_delete"]; |
|
| 218 | 218 | } |
| 219 | - $msg .= '<br />' . sprintf($_lang["configcheck_hide_warning"], 'templateswitcher_present'); |
|
| 219 | + $msg .= '<br />'.sprintf($_lang["configcheck_hide_warning"], 'templateswitcher_present'); |
|
| 220 | 220 | $warnings[$i][1] = "<span id=\"templateswitcher_present_warning_wrapper\">{$msg}</span>\n"; |
| 221 | 221 | break; |
| 222 | 222 | case $_lang['configcheck_rb_base_dir'] : |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | $warnings[$i][1] = $_lang['configcheck_default_msg']; |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | - $admin_warning = $_SESSION['mgrRole']!=1 ? $_lang['configcheck_admin'] : "" ; |
|
| 232 | + $admin_warning = $_SESSION['mgrRole'] != 1 ? $_lang['configcheck_admin'] : ""; |
|
| 233 | 233 | $config_check_results .= " |
| 234 | 234 | <fieldset> |
| 235 | 235 | <p><strong>".$_lang['configcheck_warning']."</strong> '".$warnings[$i][0]."'</p> |
@@ -238,11 +238,11 @@ discard block |
||
| 238 | 238 | ".(isset($warnings[$i][2]) ? '<div style="padding-left:1em">'.$warnings[$i][2].'</div>' : '')." |
| 239 | 239 | </fieldset> |
| 240 | 240 | "; |
| 241 | - if ($i!=count($warnings)-1) { |
|
| 241 | + if ($i != count($warnings) - 1) { |
|
| 242 | 242 | $config_check_results .= "<br />"; |
| 243 | 243 | } |
| 244 | 244 | } |
| 245 | - $_SESSION["mgrConfigCheck"]=true; |
|
| 245 | + $_SESSION["mgrConfigCheck"] = true; |
|
| 246 | 246 | } else { |
| 247 | 247 | $config_check_results = $_lang['configcheck_ok']; |
| 248 | 248 | } |
@@ -19,12 +19,12 @@ discard block |
||
| 19 | 19 | $warningspresent = 0; |
| 20 | 20 | |
| 21 | 21 | $sysfiles_check = $modx->manager->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; |
@@ -117,7 +117,8 @@ discard block |
||
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | if (!function_exists('checkSiteCache')) { |
| 120 | - function checkSiteCache() { |
|
| 120 | + function checkSiteCache() |
|
| 121 | + { |
|
| 121 | 122 | global $modx; |
| 122 | 123 | $checked= true; |
| 123 | 124 | if (file_exists($modx->config['base_path'] . 'assets/cache/siteCache.idx.php')) { |
@@ -156,26 +157,36 @@ discard block |
||
| 156 | 157 | |
| 157 | 158 | if ($warningspresent==1) { |
| 158 | 159 | |
| 159 | -if(!isset($modx->config['send_errormail'])) $modx->config['send_errormail']='3'; |
|
| 160 | +if(!isset($modx->config['send_errormail'])) { |
|
| 161 | + $modx->config['send_errormail']='3'; |
|
| 162 | +} |
|
| 160 | 163 | $config_check_results = "<h3>".$_lang['configcheck_notok']."</h3>"; |
| 161 | 164 | |
| 162 | 165 | for ($i=0;$i<count($warnings);$i++) { |
| 163 | 166 | switch ($warnings[$i][0]) { |
| 164 | 167 | case $_lang['configcheck_configinc']; |
| 165 | 168 | $warnings[$i][1] = $_lang['configcheck_configinc_msg']; |
| 166 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_configinc']); |
|
| 169 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
| 170 | + $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_configinc']); |
|
| 171 | + } |
|
| 167 | 172 | break; |
| 168 | 173 | case $_lang['configcheck_installer'] : |
| 169 | 174 | $warnings[$i][1] = $_lang['configcheck_installer_msg']; |
| 170 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_installer']); |
|
| 175 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
| 176 | + $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_installer']); |
|
| 177 | + } |
|
| 171 | 178 | break; |
| 172 | 179 | case $_lang['configcheck_cache'] : |
| 173 | 180 | $warnings[$i][1] = $_lang['configcheck_cache_msg']; |
| 174 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_cache']); |
|
| 181 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
| 182 | + $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_cache']); |
|
| 183 | + } |
|
| 175 | 184 | break; |
| 176 | 185 | case $_lang['configcheck_images'] : |
| 177 | 186 | $warnings[$i][1] = $_lang['configcheck_images_msg']; |
| 178 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_images']); |
|
| 187 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
| 188 | + $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_images']); |
|
| 189 | + } |
|
| 179 | 190 | break; |
| 180 | 191 | case $_lang['configcheck_sysfiles_mod']: |
| 181 | 192 | $warnings[$i][1] = $_lang["configcheck_sysfiles_mod_msg"]; |
@@ -183,7 +194,9 @@ discard block |
||
| 183 | 194 | if($modx->hasPermission('settings')) { |
| 184 | 195 | $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>'; |
| 185 | 196 | } |
| 186 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1]." ".join(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']); |
|
| 197 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
| 198 | + $modx->logEvent(0,3,$warnings[$i][1]." ".join(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']); |
|
| 199 | + } |
|
| 187 | 200 | break; |
| 188 | 201 | case $_lang['configcheck_lang_difference'] : |
| 189 | 202 | $warnings[$i][1] = $_lang['configcheck_lang_difference_msg']; |
@@ -9,178 +9,178 @@ |
||
| 9 | 9 | |
| 10 | 10 | Class TemplateParser {
|
| 11 | 11 | |
| 12 | - function __construct() {
|
|
| 13 | - } |
|
| 14 | - |
|
| 15 | - /** |
|
| 16 | - * @param array $config [action, tabs, toArray] |
|
| 17 | - * @param array $data |
|
| 18 | - * @return string |
|
| 19 | - */ |
|
| 20 | - public function output($config = array(), $data = array()) {
|
|
| 21 | - global $modx; |
|
| 22 | - |
|
| 23 | - $output = ''; |
|
| 24 | - $action = !empty($config['action']) ? $config['action'] : (!empty($_REQUEST['a']) ? $_REQUEST['a'] : ''); |
|
| 25 | - $tab = isset($config['tab']) ? ' AND tab IN(' . $config['tab'] . ')' : '';
|
|
| 26 | - |
|
| 27 | - if($action) {
|
|
| 28 | - $sql = $modx->db->query('SELECT t1.*, IF(t1.alias=\'\',t1.name,t1.alias) AS alias, t2.category AS category_name
|
|
| 12 | + function __construct() {
|
|
| 13 | + } |
|
| 14 | + |
|
| 15 | + /** |
|
| 16 | + * @param array $config [action, tabs, toArray] |
|
| 17 | + * @param array $data |
|
| 18 | + * @return string |
|
| 19 | + */ |
|
| 20 | + public function output($config = array(), $data = array()) {
|
|
| 21 | + global $modx; |
|
| 22 | + |
|
| 23 | + $output = ''; |
|
| 24 | + $action = !empty($config['action']) ? $config['action'] : (!empty($_REQUEST['a']) ? $_REQUEST['a'] : ''); |
|
| 25 | + $tab = isset($config['tab']) ? ' AND tab IN(' . $config['tab'] . ')' : '';
|
|
| 26 | + |
|
| 27 | + if($action) {
|
|
| 28 | + $sql = $modx->db->query('SELECT t1.*, IF(t1.alias=\'\',t1.name,t1.alias) AS alias, t2.category AS category_name
|
|
| 29 | 29 | FROM ' . $modx->getFullTableName('system_templates') . ' AS t1
|
| 30 | 30 | INNER JOIN ' . $modx->getFullTableName('categories') . ' AS t2 ON t2.id=t1.category
|
| 31 | 31 | WHERE t1.action IN(' . $action . ') ' . $tab . '
|
| 32 | 32 | ORDER BY t1.tab ASC, t1.rank ASC'); |
| 33 | 33 | |
| 34 | - if($modx->db->getRecordCount($sql)) {
|
|
| 35 | - $tabs = array(); |
|
| 36 | - while($row = $modx->db->getRow($sql)) {
|
|
| 37 | - if(!$row['value'] && !empty($data[$row['name']])) {
|
|
| 38 | - $row['value'] = $data[$row['name']]; |
|
| 39 | - } |
|
| 40 | - $tabs[$row['tab']]['category_name'] = $row['category_name']; |
|
| 41 | - $tabs[$row['tab']][$row['name']] = TemplateParser::render($row); |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - if(!empty($config['toArray'])) {
|
|
| 45 | - $output = $tabs; |
|
| 46 | - } else {
|
|
| 47 | - $output .= '<div class="tab-pane" id="pane_' . $action . '">'; |
|
| 48 | - $output .= ' |
|
| 34 | + if($modx->db->getRecordCount($sql)) {
|
|
| 35 | + $tabs = array(); |
|
| 36 | + while($row = $modx->db->getRow($sql)) {
|
|
| 37 | + if(!$row['value'] && !empty($data[$row['name']])) {
|
|
| 38 | + $row['value'] = $data[$row['name']]; |
|
| 39 | + } |
|
| 40 | + $tabs[$row['tab']]['category_name'] = $row['category_name']; |
|
| 41 | + $tabs[$row['tab']][$row['name']] = TemplateParser::render($row); |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + if(!empty($config['toArray'])) {
|
|
| 45 | + $output = $tabs; |
|
| 46 | + } else {
|
|
| 47 | + $output .= '<div class="tab-pane" id="pane_' . $action . '">'; |
|
| 48 | + $output .= ' |
|
| 49 | 49 | <script type="text/javascript"> |
| 50 | 50 | var pane_' . $action . ' = new WebFXTabPane(document.getElementById("pane_' . $action . '"), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . ');
|
| 51 | 51 | </script>'; |
| 52 | 52 | |
| 53 | - foreach($tabs as $idTab => $tab) {
|
|
| 54 | - $output .= '<div class="tab-page" id="tab_' . $action . '_' . $idTab . '">'; |
|
| 55 | - $output .= ' |
|
| 53 | + foreach($tabs as $idTab => $tab) {
|
|
| 54 | + $output .= '<div class="tab-page" id="tab_' . $action . '_' . $idTab . '">'; |
|
| 55 | + $output .= ' |
|
| 56 | 56 | <h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']) . '</h2> |
| 57 | 57 | <script type="text/javascript">pane_' . $action . '.addTabPage(document.getElementById("tab_' . $action . '_' . $idTab . '"));</script>';
|
| 58 | - unset($tab['category_name']); |
|
| 59 | - foreach($tab as $item) {
|
|
| 60 | - $output .= $item; |
|
| 61 | - } |
|
| 62 | - $output .= '</div>'; |
|
| 63 | - } |
|
| 64 | - $output .= '</div>'; |
|
| 65 | - } |
|
| 66 | - } |
|
| 67 | - } |
|
| 68 | - |
|
| 69 | - return $output; |
|
| 70 | - } |
|
| 71 | - |
|
| 72 | - private function render($data) {
|
|
| 73 | - global $modx, $_lang, $_country_lang; |
|
| 74 | - |
|
| 75 | - $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']); |
|
| 76 | - $data['value'] = (isset($_POST[$data['name']][$data['value']]) ? $_POST[$data['name']][$data['value']] : (isset($data['value']) ? $modx->htmlspecialchars($data['value']) : '')); |
|
| 77 | - $data['readonly'] = ($data['readonly'] ? ' readonly' : ''); |
|
| 78 | - |
|
| 79 | - $output = ''; |
|
| 80 | - $output .= '<div class="form-group row">'; |
|
| 81 | - |
|
| 82 | - switch($data['type']) {
|
|
| 83 | - |
|
| 84 | - case 'text': |
|
| 85 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
| 58 | + unset($tab['category_name']); |
|
| 59 | + foreach($tab as $item) {
|
|
| 60 | + $output .= $item; |
|
| 61 | + } |
|
| 62 | + $output .= '</div>'; |
|
| 63 | + } |
|
| 64 | + $output .= '</div>'; |
|
| 65 | + } |
|
| 66 | + } |
|
| 67 | + } |
|
| 68 | + |
|
| 69 | + return $output; |
|
| 70 | + } |
|
| 71 | + |
|
| 72 | + private function render($data) {
|
|
| 73 | + global $modx, $_lang, $_country_lang; |
|
| 74 | + |
|
| 75 | + $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']); |
|
| 76 | + $data['value'] = (isset($_POST[$data['name']][$data['value']]) ? $_POST[$data['name']][$data['value']] : (isset($data['value']) ? $modx->htmlspecialchars($data['value']) : '')); |
|
| 77 | + $data['readonly'] = ($data['readonly'] ? ' readonly' : ''); |
|
| 78 | + |
|
| 79 | + $output = ''; |
|
| 80 | + $output .= '<div class="form-group row">'; |
|
| 81 | + |
|
| 82 | + switch($data['type']) {
|
|
| 83 | + |
|
| 84 | + case 'text': |
|
| 85 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
| 86 | 86 | <div class="col-sm-7"> |
| 87 | 87 | <input type="text" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
| 88 | - $output .= $data['content']; |
|
| 89 | - $output .= '</div>'; |
|
| 88 | + $output .= $data['content']; |
|
| 89 | + $output .= '</div>'; |
|
| 90 | 90 | |
| 91 | - break; |
|
| 91 | + break; |
|
| 92 | 92 | |
| 93 | - case 'textarea': |
|
| 94 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
| 93 | + case 'textarea': |
|
| 94 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
| 95 | 95 | <div class="col-sm-7"> |
| 96 | 96 | <textarea name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;"[+readonly+]>[+value+]</textarea>'; |
| 97 | - $output .= $data['content']; |
|
| 98 | - $output .= '</div>'; |
|
| 97 | + $output .= $data['content']; |
|
| 98 | + $output .= '</div>'; |
|
| 99 | 99 | |
| 100 | - break; |
|
| 100 | + break; |
|
| 101 | 101 | |
| 102 | - case 'date': |
|
| 103 | - $data['value'] = (isset($_POST[$data['name']][$data['value']]) ? $modx->toDateFormat($_POST[$data['name']][$data['value']]) : (isset($data['value']) ? $modx->toDateFormat($data['value']) : '')); |
|
| 104 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
| 102 | + case 'date': |
|
| 103 | + $data['value'] = (isset($_POST[$data['name']][$data['value']]) ? $modx->toDateFormat($_POST[$data['name']][$data['value']]) : (isset($data['value']) ? $modx->toDateFormat($data['value']) : '')); |
|
| 104 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
| 105 | 105 | <div class="col-sm-7"> |
| 106 | 106 | <input type="text" name="[+name+]" class="form-control DatePicker" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
| 107 | - $output .= $data['content']; |
|
| 108 | - $output .= '</div>'; |
|
| 109 | - |
|
| 110 | - break; |
|
| 111 | - |
|
| 112 | - case 'select': |
|
| 113 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
| 114 | - $output .= '<div class="col-sm-7">'; |
|
| 115 | - $output .= '<select name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;">'; |
|
| 116 | - if($data['name'] == 'country' && isset($_country_lang)) {
|
|
| 117 | - $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $data['country']; |
|
| 118 | - $output .= '<option value=""' . (!isset($chosenCountry) ? ' selected' : '') . '> </option>'; |
|
| 119 | - foreach($_country_lang as $key => $value) {
|
|
| 120 | - $output .= '<option value="' . $key . '"' . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . '>' . $value . '</option>'; |
|
| 121 | - } |
|
| 122 | - } else {
|
|
| 123 | - if($data['elements']) {
|
|
| 124 | - $elements = explode('||', $data['elements']);
|
|
| 125 | - foreach($elements as $key => $value) {
|
|
| 126 | - $value = explode('==', $value);
|
|
| 127 | - $output .= '<option value="' . $value[1] . '">' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]) . '</option>'; |
|
| 128 | - } |
|
| 129 | - } |
|
| 130 | - } |
|
| 131 | - $output .= '</select>'; |
|
| 132 | - $output .= $data['content']; |
|
| 133 | - $output .= '</div>'; |
|
| 134 | - |
|
| 135 | - break; |
|
| 136 | - |
|
| 137 | - case 'checkbox': |
|
| 138 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
| 139 | - $output .= '<div class="col-sm-7">'; |
|
| 140 | - $output .= '<input type="checkbox" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
|
| 141 | - if($data['elements']) {
|
|
| 142 | - $elements = explode('||', $data['elements']);
|
|
| 143 | - foreach($elements as $key => $value) {
|
|
| 144 | - $value = explode('==', $value);
|
|
| 145 | - $output .= '<br /><input type="checkbox" name="' . $value[0] . '" class="form-control" id="' . $value[0] . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
| 146 | - } |
|
| 147 | - } |
|
| 148 | - $output .= $data['content']; |
|
| 149 | - $output .= '</div>'; |
|
| 150 | - |
|
| 151 | - break; |
|
| 152 | - |
|
| 153 | - case 'radio': |
|
| 154 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
| 155 | - $output .= '<div class="col-sm-7">'; |
|
| 156 | - $output .= '<input type="radio" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
|
| 157 | - if($data['elements']) {
|
|
| 158 | - $elements = explode('||', $data['elements']);
|
|
| 159 | - foreach($elements as $key => $value) {
|
|
| 160 | - $value = explode('==', $value);
|
|
| 161 | - $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_' . $key . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
| 162 | - } |
|
| 163 | - } |
|
| 164 | - $output .= $data['content']; |
|
| 165 | - $output .= '</div>'; |
|
| 166 | - |
|
| 167 | - break; |
|
| 168 | - |
|
| 169 | - case 'custom': |
|
| 170 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
| 171 | - $output .= '<div class="col-sm-7">'; |
|
| 172 | - $output .= $data['content']; |
|
| 173 | - $output .= '</div>'; |
|
| 174 | - |
|
| 175 | - break; |
|
| 176 | - } |
|
| 177 | - |
|
| 178 | - $output .= '</div>'; |
|
| 179 | - |
|
| 180 | - $output = $modx->parseText($output, $data); |
|
| 181 | - |
|
| 182 | - return $output; |
|
| 183 | - } |
|
| 107 | + $output .= $data['content']; |
|
| 108 | + $output .= '</div>'; |
|
| 109 | + |
|
| 110 | + break; |
|
| 111 | + |
|
| 112 | + case 'select': |
|
| 113 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
| 114 | + $output .= '<div class="col-sm-7">'; |
|
| 115 | + $output .= '<select name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;">'; |
|
| 116 | + if($data['name'] == 'country' && isset($_country_lang)) {
|
|
| 117 | + $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $data['country']; |
|
| 118 | + $output .= '<option value=""' . (!isset($chosenCountry) ? ' selected' : '') . '> </option>'; |
|
| 119 | + foreach($_country_lang as $key => $value) {
|
|
| 120 | + $output .= '<option value="' . $key . '"' . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . '>' . $value . '</option>'; |
|
| 121 | + } |
|
| 122 | + } else {
|
|
| 123 | + if($data['elements']) {
|
|
| 124 | + $elements = explode('||', $data['elements']);
|
|
| 125 | + foreach($elements as $key => $value) {
|
|
| 126 | + $value = explode('==', $value);
|
|
| 127 | + $output .= '<option value="' . $value[1] . '">' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]) . '</option>'; |
|
| 128 | + } |
|
| 129 | + } |
|
| 130 | + } |
|
| 131 | + $output .= '</select>'; |
|
| 132 | + $output .= $data['content']; |
|
| 133 | + $output .= '</div>'; |
|
| 134 | + |
|
| 135 | + break; |
|
| 136 | + |
|
| 137 | + case 'checkbox': |
|
| 138 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
| 139 | + $output .= '<div class="col-sm-7">'; |
|
| 140 | + $output .= '<input type="checkbox" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
|
| 141 | + if($data['elements']) {
|
|
| 142 | + $elements = explode('||', $data['elements']);
|
|
| 143 | + foreach($elements as $key => $value) {
|
|
| 144 | + $value = explode('==', $value);
|
|
| 145 | + $output .= '<br /><input type="checkbox" name="' . $value[0] . '" class="form-control" id="' . $value[0] . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
| 146 | + } |
|
| 147 | + } |
|
| 148 | + $output .= $data['content']; |
|
| 149 | + $output .= '</div>'; |
|
| 150 | + |
|
| 151 | + break; |
|
| 152 | + |
|
| 153 | + case 'radio': |
|
| 154 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
| 155 | + $output .= '<div class="col-sm-7">'; |
|
| 156 | + $output .= '<input type="radio" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
|
| 157 | + if($data['elements']) {
|
|
| 158 | + $elements = explode('||', $data['elements']);
|
|
| 159 | + foreach($elements as $key => $value) {
|
|
| 160 | + $value = explode('==', $value);
|
|
| 161 | + $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_' . $key . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
| 162 | + } |
|
| 163 | + } |
|
| 164 | + $output .= $data['content']; |
|
| 165 | + $output .= '</div>'; |
|
| 166 | + |
|
| 167 | + break; |
|
| 168 | + |
|
| 169 | + case 'custom': |
|
| 170 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
| 171 | + $output .= '<div class="col-sm-7">'; |
|
| 172 | + $output .= $data['content']; |
|
| 173 | + $output .= '</div>'; |
|
| 174 | + |
|
| 175 | + break; |
|
| 176 | + } |
|
| 177 | + |
|
| 178 | + $output .= '</div>'; |
|
| 179 | + |
|
| 180 | + $output = $modx->parseText($output, $data); |
|
| 181 | + |
|
| 182 | + return $output; |
|
| 183 | + } |
|
| 184 | 184 | |
| 185 | 185 | } |
| 186 | 186 | |
@@ -7,9 +7,9 @@ discard block |
||
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -Class TemplateParser {
|
|
| 10 | +Class TemplateParser{
|
|
| 11 | 11 | |
| 12 | - function __construct() {
|
|
| 12 | + function __construct(){
|
|
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | /** |
@@ -17,46 +17,46 @@ discard block |
||
| 17 | 17 | * @param array $data |
| 18 | 18 | * @return string |
| 19 | 19 | */ |
| 20 | - public function output($config = array(), $data = array()) {
|
|
| 20 | + public function output($config = array(), $data = array()){
|
|
| 21 | 21 | global $modx; |
| 22 | 22 | |
| 23 | 23 | $output = ''; |
| 24 | 24 | $action = !empty($config['action']) ? $config['action'] : (!empty($_REQUEST['a']) ? $_REQUEST['a'] : ''); |
| 25 | - $tab = isset($config['tab']) ? ' AND tab IN(' . $config['tab'] . ')' : '';
|
|
| 25 | + $tab = isset($config['tab']) ? ' AND tab IN('.$config['tab'].')' : '';
|
|
| 26 | 26 | |
| 27 | - if($action) {
|
|
| 27 | + if ($action) {
|
|
| 28 | 28 | $sql = $modx->db->query('SELECT t1.*, IF(t1.alias=\'\',t1.name,t1.alias) AS alias, t2.category AS category_name
|
| 29 | - FROM ' . $modx->getFullTableName('system_templates') . ' AS t1
|
|
| 30 | - INNER JOIN ' . $modx->getFullTableName('categories') . ' AS t2 ON t2.id=t1.category
|
|
| 31 | - WHERE t1.action IN(' . $action . ') ' . $tab . '
|
|
| 29 | + FROM ' . $modx->getFullTableName('system_templates').' AS t1
|
|
| 30 | + INNER JOIN ' . $modx->getFullTableName('categories').' AS t2 ON t2.id=t1.category
|
|
| 31 | + WHERE t1.action IN(' . $action.') '.$tab.'
|
|
| 32 | 32 | ORDER BY t1.tab ASC, t1.rank ASC'); |
| 33 | 33 | |
| 34 | - if($modx->db->getRecordCount($sql)) {
|
|
| 34 | + if ($modx->db->getRecordCount($sql)) {
|
|
| 35 | 35 | $tabs = array(); |
| 36 | - while($row = $modx->db->getRow($sql)) {
|
|
| 37 | - if(!$row['value'] && !empty($data[$row['name']])) {
|
|
| 36 | + while ($row = $modx->db->getRow($sql)) {
|
|
| 37 | + if (!$row['value'] && !empty($data[$row['name']])) {
|
|
| 38 | 38 | $row['value'] = $data[$row['name']]; |
| 39 | 39 | } |
| 40 | 40 | $tabs[$row['tab']]['category_name'] = $row['category_name']; |
| 41 | 41 | $tabs[$row['tab']][$row['name']] = TemplateParser::render($row); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - if(!empty($config['toArray'])) {
|
|
| 44 | + if (!empty($config['toArray'])) {
|
|
| 45 | 45 | $output = $tabs; |
| 46 | 46 | } else {
|
| 47 | - $output .= '<div class="tab-pane" id="pane_' . $action . '">'; |
|
| 47 | + $output .= '<div class="tab-pane" id="pane_'.$action.'">'; |
|
| 48 | 48 | $output .= ' |
| 49 | 49 | <script type="text/javascript"> |
| 50 | - var pane_' . $action . ' = new WebFXTabPane(document.getElementById("pane_' . $action . '"), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . ');
|
|
| 50 | + var pane_' . $action.' = new WebFXTabPane(document.getElementById("pane_'.$action.'"), '.($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').');
|
|
| 51 | 51 | </script>'; |
| 52 | 52 | |
| 53 | - foreach($tabs as $idTab => $tab) {
|
|
| 54 | - $output .= '<div class="tab-page" id="tab_' . $action . '_' . $idTab . '">'; |
|
| 53 | + foreach ($tabs as $idTab => $tab) {
|
|
| 54 | + $output .= '<div class="tab-page" id="tab_'.$action.'_'.$idTab.'">'; |
|
| 55 | 55 | $output .= ' |
| 56 | - <h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']) . '</h2> |
|
| 57 | - <script type="text/javascript">pane_' . $action . '.addTabPage(document.getElementById("tab_' . $action . '_' . $idTab . '"));</script>';
|
|
| 56 | + <h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']).'</h2> |
|
| 57 | + <script type="text/javascript">pane_' . $action.'.addTabPage(document.getElementById("tab_'.$action.'_'.$idTab.'"));</script>';
|
|
| 58 | 58 | unset($tab['category_name']); |
| 59 | - foreach($tab as $item) {
|
|
| 59 | + foreach ($tab as $item) {
|
|
| 60 | 60 | $output .= $item; |
| 61 | 61 | } |
| 62 | 62 | $output .= '</div>'; |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | return $output; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - private function render($data) {
|
|
| 72 | + private function render($data){
|
|
| 73 | 73 | global $modx, $_lang, $_country_lang; |
| 74 | 74 | |
| 75 | 75 | $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']); |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | $output = ''; |
| 80 | 80 | $output .= '<div class="form-group row">'; |
| 81 | 81 | |
| 82 | - switch($data['type']) {
|
|
| 82 | + switch ($data['type']) {
|
|
| 83 | 83 | |
| 84 | 84 | case 'text': |
| 85 | 85 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
@@ -113,18 +113,18 @@ discard block |
||
| 113 | 113 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
| 114 | 114 | $output .= '<div class="col-sm-7">'; |
| 115 | 115 | $output .= '<select name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;">'; |
| 116 | - if($data['name'] == 'country' && isset($_country_lang)) {
|
|
| 116 | + if ($data['name'] == 'country' && isset($_country_lang)) {
|
|
| 117 | 117 | $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $data['country']; |
| 118 | - $output .= '<option value=""' . (!isset($chosenCountry) ? ' selected' : '') . '> </option>'; |
|
| 119 | - foreach($_country_lang as $key => $value) {
|
|
| 120 | - $output .= '<option value="' . $key . '"' . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . '>' . $value . '</option>'; |
|
| 118 | + $output .= '<option value=""'.(!isset($chosenCountry) ? ' selected' : '').'> </option>'; |
|
| 119 | + foreach ($_country_lang as $key => $value) {
|
|
| 120 | + $output .= '<option value="'.$key.'"'.(isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '').'>'.$value.'</option>'; |
|
| 121 | 121 | } |
| 122 | 122 | } else {
|
| 123 | - if($data['elements']) {
|
|
| 123 | + if ($data['elements']) {
|
|
| 124 | 124 | $elements = explode('||', $data['elements']);
|
| 125 | - foreach($elements as $key => $value) {
|
|
| 125 | + foreach ($elements as $key => $value) {
|
|
| 126 | 126 | $value = explode('==', $value);
|
| 127 | - $output .= '<option value="' . $value[1] . '">' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]) . '</option>'; |
|
| 127 | + $output .= '<option value="'.$value[1].'">'.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]).'</option>'; |
|
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | 130 | } |
@@ -138,11 +138,11 @@ discard block |
||
| 138 | 138 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
| 139 | 139 | $output .= '<div class="col-sm-7">'; |
| 140 | 140 | $output .= '<input type="checkbox" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
| 141 | - if($data['elements']) {
|
|
| 141 | + if ($data['elements']) {
|
|
| 142 | 142 | $elements = explode('||', $data['elements']);
|
| 143 | - foreach($elements as $key => $value) {
|
|
| 143 | + foreach ($elements as $key => $value) {
|
|
| 144 | 144 | $value = explode('==', $value);
|
| 145 | - $output .= '<br /><input type="checkbox" name="' . $value[0] . '" class="form-control" id="' . $value[0] . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
| 145 | + $output .= '<br /><input type="checkbox" name="'.$value[0].'" class="form-control" id="'.$value[0].'" value="'.$value[1].'" onChange="documentDirty=true;"[+readonly+] /> '.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | $output .= $data['content']; |
@@ -154,11 +154,11 @@ discard block |
||
| 154 | 154 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
| 155 | 155 | $output .= '<div class="col-sm-7">'; |
| 156 | 156 | $output .= '<input type="radio" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
| 157 | - if($data['elements']) {
|
|
| 157 | + if ($data['elements']) {
|
|
| 158 | 158 | $elements = explode('||', $data['elements']);
|
| 159 | - foreach($elements as $key => $value) {
|
|
| 159 | + foreach ($elements as $key => $value) {
|
|
| 160 | 160 | $value = explode('==', $value);
|
| 161 | - $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_' . $key . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
| 161 | + $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_'.$key.'" value="'.$value[1].'" onChange="documentDirty=true;"[+readonly+] /> '.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | $output .= $data['content']; |
@@ -7,9 +7,11 @@ discard block |
||
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -Class TemplateParser {
|
|
| 10 | +Class TemplateParser |
|
| 11 | +{ |
|
| 11 | 12 | |
| 12 | - function __construct() {
|
|
| 13 | + function __construct() |
|
| 14 | + { |
|
| 13 | 15 | } |
| 14 | 16 | |
| 15 | 17 | /** |
@@ -17,46 +19,47 @@ discard block |
||
| 17 | 19 | * @param array $data |
| 18 | 20 | * @return string |
| 19 | 21 | */ |
| 20 | - public function output($config = array(), $data = array()) {
|
|
| 22 | + public function output($config = array(), $data = array()) |
|
| 23 | + { |
|
| 21 | 24 | global $modx; |
| 22 | 25 | |
| 23 | 26 | $output = ''; |
| 24 | 27 | $action = !empty($config['action']) ? $config['action'] : (!empty($_REQUEST['a']) ? $_REQUEST['a'] : ''); |
| 25 | 28 | $tab = isset($config['tab']) ? ' AND tab IN(' . $config['tab'] . ')' : '';
|
| 26 | 29 | |
| 27 | - if($action) {
|
|
| 30 | + if($action) { |
|
| 28 | 31 | $sql = $modx->db->query('SELECT t1.*, IF(t1.alias=\'\',t1.name,t1.alias) AS alias, t2.category AS category_name
|
| 29 | 32 | FROM ' . $modx->getFullTableName('system_templates') . ' AS t1
|
| 30 | 33 | INNER JOIN ' . $modx->getFullTableName('categories') . ' AS t2 ON t2.id=t1.category
|
| 31 | 34 | WHERE t1.action IN(' . $action . ') ' . $tab . '
|
| 32 | 35 | ORDER BY t1.tab ASC, t1.rank ASC'); |
| 33 | 36 | |
| 34 | - if($modx->db->getRecordCount($sql)) {
|
|
| 37 | + if($modx->db->getRecordCount($sql)) { |
|
| 35 | 38 | $tabs = array(); |
| 36 | - while($row = $modx->db->getRow($sql)) {
|
|
| 37 | - if(!$row['value'] && !empty($data[$row['name']])) {
|
|
| 39 | + while($row = $modx->db->getRow($sql)) { |
|
| 40 | + if(!$row['value'] && !empty($data[$row['name']])) { |
|
| 38 | 41 | $row['value'] = $data[$row['name']]; |
| 39 | 42 | } |
| 40 | 43 | $tabs[$row['tab']]['category_name'] = $row['category_name']; |
| 41 | 44 | $tabs[$row['tab']][$row['name']] = TemplateParser::render($row); |
| 42 | 45 | } |
| 43 | 46 | |
| 44 | - if(!empty($config['toArray'])) {
|
|
| 47 | + if(!empty($config['toArray'])) { |
|
| 45 | 48 | $output = $tabs; |
| 46 | - } else {
|
|
| 49 | + } else { |
|
| 47 | 50 | $output .= '<div class="tab-pane" id="pane_' . $action . '">'; |
| 48 | 51 | $output .= ' |
| 49 | 52 | <script type="text/javascript"> |
| 50 | 53 | var pane_' . $action . ' = new WebFXTabPane(document.getElementById("pane_' . $action . '"), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . ');
|
| 51 | 54 | </script>'; |
| 52 | 55 | |
| 53 | - foreach($tabs as $idTab => $tab) {
|
|
| 56 | + foreach($tabs as $idTab => $tab) { |
|
| 54 | 57 | $output .= '<div class="tab-page" id="tab_' . $action . '_' . $idTab . '">'; |
| 55 | 58 | $output .= ' |
| 56 | 59 | <h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']) . '</h2> |
| 57 | 60 | <script type="text/javascript">pane_' . $action . '.addTabPage(document.getElementById("tab_' . $action . '_' . $idTab . '"));</script>';
|
| 58 | 61 | unset($tab['category_name']); |
| 59 | - foreach($tab as $item) {
|
|
| 62 | + foreach($tab as $item) { |
|
| 60 | 63 | $output .= $item; |
| 61 | 64 | } |
| 62 | 65 | $output .= '</div>'; |
@@ -69,7 +72,8 @@ discard block |
||
| 69 | 72 | return $output; |
| 70 | 73 | } |
| 71 | 74 | |
| 72 | - private function render($data) {
|
|
| 75 | + private function render($data) |
|
| 76 | + { |
|
| 73 | 77 | global $modx, $_lang, $_country_lang; |
| 74 | 78 | |
| 75 | 79 | $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']); |
@@ -79,7 +83,7 @@ discard block |
||
| 79 | 83 | $output = ''; |
| 80 | 84 | $output .= '<div class="form-group row">'; |
| 81 | 85 | |
| 82 | - switch($data['type']) {
|
|
| 86 | + switch($data['type']) { |
|
| 83 | 87 | |
| 84 | 88 | case 'text': |
| 85 | 89 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
@@ -113,16 +117,16 @@ discard block |
||
| 113 | 117 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
| 114 | 118 | $output .= '<div class="col-sm-7">'; |
| 115 | 119 | $output .= '<select name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;">'; |
| 116 | - if($data['name'] == 'country' && isset($_country_lang)) {
|
|
| 120 | + if($data['name'] == 'country' && isset($_country_lang)) { |
|
| 117 | 121 | $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $data['country']; |
| 118 | 122 | $output .= '<option value=""' . (!isset($chosenCountry) ? ' selected' : '') . '> </option>'; |
| 119 | - foreach($_country_lang as $key => $value) {
|
|
| 123 | + foreach($_country_lang as $key => $value) { |
|
| 120 | 124 | $output .= '<option value="' . $key . '"' . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . '>' . $value . '</option>'; |
| 121 | 125 | } |
| 122 | - } else {
|
|
| 123 | - if($data['elements']) {
|
|
| 126 | + } else { |
|
| 127 | + if($data['elements']) { |
|
| 124 | 128 | $elements = explode('||', $data['elements']);
|
| 125 | - foreach($elements as $key => $value) {
|
|
| 129 | + foreach($elements as $key => $value) { |
|
| 126 | 130 | $value = explode('==', $value);
|
| 127 | 131 | $output .= '<option value="' . $value[1] . '">' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]) . '</option>'; |
| 128 | 132 | } |
@@ -138,9 +142,9 @@ discard block |
||
| 138 | 142 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
| 139 | 143 | $output .= '<div class="col-sm-7">'; |
| 140 | 144 | $output .= '<input type="checkbox" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
| 141 | - if($data['elements']) {
|
|
| 145 | + if($data['elements']) { |
|
| 142 | 146 | $elements = explode('||', $data['elements']);
|
| 143 | - foreach($elements as $key => $value) {
|
|
| 147 | + foreach($elements as $key => $value) { |
|
| 144 | 148 | $value = explode('==', $value);
|
| 145 | 149 | $output .= '<br /><input type="checkbox" name="' . $value[0] . '" class="form-control" id="' . $value[0] . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
| 146 | 150 | } |
@@ -154,9 +158,9 @@ discard block |
||
| 154 | 158 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
| 155 | 159 | $output .= '<div class="col-sm-7">'; |
| 156 | 160 | $output .= '<input type="radio" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
| 157 | - if($data['elements']) {
|
|
| 161 | + if($data['elements']) { |
|
| 158 | 162 | $elements = explode('||', $data['elements']);
|
| 159 | - foreach($elements as $key => $value) {
|
|
| 163 | + foreach($elements as $key => $value) { |
|
| 160 | 164 | $value = explode('==', $value);
|
| 161 | 165 | $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_' . $key . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
| 162 | 166 | } |
@@ -7,7 +7,7 @@ |
||
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -Class TemplateParser {
|
|
| 10 | +class TemplateParser {
|
|
| 11 | 11 | |
| 12 | 12 | function __construct() {
|
| 13 | 13 | } |