@@ -3,9 +3,9 @@ discard block |
||
3 | 3 | * mutate_settings.ajax.php |
4 | 4 | * |
5 | 5 | */ |
6 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
6 | +if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
7 | 7 | |
8 | -require_once(dirname(__FILE__) . '/protect.inc.php'); |
|
8 | +require_once(dirname(__FILE__).'/protect.inc.php'); |
|
9 | 9 | |
10 | 10 | $action = preg_replace('/[^A-Za-z0-9_\-\.\/]/', '', $_POST['action']); |
11 | 11 | $lang = preg_replace('/[^A-Za-z0-9_\s\+\-\.\/]/', '', $_POST['lang']); |
@@ -20,10 +20,10 @@ discard block |
||
20 | 20 | $str = ''; |
21 | 21 | $emptyCache = false; |
22 | 22 | |
23 | -switch(true){ |
|
24 | - case ($action == 'get' && preg_match('/^[A-z0-9_-]+$/',$lang) && file_exists(dirname(__FILE__) . '/lang/'.$lang.'.inc.php')):{ |
|
25 | - include(dirname(__FILE__) . '/lang/'.$lang.'.inc.php'); |
|
26 | - $str = isset($key,$_lang,$_lang[$key]) ? $_lang[$key] : "" ; |
|
23 | +switch (true) { |
|
24 | + case ($action == 'get' && preg_match('/^[A-z0-9_-]+$/', $lang) && file_exists(dirname(__FILE__).'/lang/'.$lang.'.inc.php')):{ |
|
25 | + include(dirname(__FILE__).'/lang/'.$lang.'.inc.php'); |
|
26 | + $str = isset($key, $_lang, $_lang[$key]) ? $_lang[$key] : ""; |
|
27 | 27 | break; |
28 | 28 | } |
29 | 29 | case ($action == 'setsetting' && !empty($key) && !empty($value)):{ |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
53 | -if($emptyCache) { |
|
53 | +if ($emptyCache) { |
|
54 | 54 | $modx->clearCache('full'); |
55 | 55 | } |
56 | 56 |
@@ -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,7 +3,7 @@ discard block |
||
3 | 3 | //Kyle Jaebker - 08/07/06 |
4 | 4 | |
5 | 5 | //Create a new category |
6 | -function newCategory($newCat) { |
|
6 | +function newCategory($newCat){ |
|
7 | 7 | global $modx; |
8 | 8 | $useTable = $modx->getFullTableName('categories'); |
9 | 9 | $categoryId = $modx->db->insert( |
@@ -14,36 +14,36 @@ discard block |
||
14 | 14 | return $categoryId; |
15 | 15 | } |
16 | 16 | //check if new category already exists |
17 | -function checkCategory($newCat = '') { |
|
17 | +function checkCategory($newCat = ''){ |
|
18 | 18 | global $modx; |
19 | 19 | $useTable = $modx->getFullTableName('categories'); |
20 | 20 | $newCat = $modx->db->escape($newCat); |
21 | 21 | $cats = $modx->db->select('id', $modx->getFullTableName('categories'), "category='{$newCat}'"); |
22 | - if($cat = $modx->db->getValue($cats)) { |
|
22 | + if ($cat = $modx->db->getValue($cats)) { |
|
23 | 23 | return $cat; |
24 | 24 | } |
25 | 25 | return 0; |
26 | 26 | } |
27 | 27 | //Check for category, create new if not exists |
28 | -function getCategory($category='') { |
|
28 | +function getCategory($category = ''){ |
|
29 | 29 | $categoryId = checkCategory($category); |
30 | - if(!$categoryId) $categoryId = newCategory($category); |
|
30 | + if (!$categoryId) $categoryId = newCategory($category); |
|
31 | 31 | return $categoryId; |
32 | 32 | } |
33 | 33 | //Get all categories |
34 | -function getCategories() { |
|
34 | +function getCategories(){ |
|
35 | 35 | global $modx; |
36 | 36 | $useTable = $modx->getFullTableName('categories'); |
37 | 37 | $cats = $modx->db->select('id, category', $modx->getFullTableName('categories'), '', 'category'); |
38 | 38 | $resourceArray = array(); |
39 | - while($row = $modx->db->getRow($cats)) { |
|
39 | + while ($row = $modx->db->getRow($cats)) { |
|
40 | 40 | $row['category'] = stripslashes($row['category']); |
41 | 41 | $resourceArray[] = $row; |
42 | 42 | } |
43 | 43 | return $resourceArray; |
44 | 44 | } |
45 | 45 | //Delete category & associations |
46 | -function deleteCategory($catId=0) { |
|
46 | +function deleteCategory($catId = 0){ |
|
47 | 47 | global $modx; |
48 | 48 | if ($catId) { |
49 | 49 | $resetTables = array('site_plugins', 'site_snippets', 'site_htmlsnippets', 'site_templates', 'site_tmplvars', 'site_modules'); |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | die(); |
11 | 11 | |
12 | 12 | global $sanitize_seed; |
13 | -$sanitize_seed = 'sanitize_seed_' . base_convert(md5(__FILE__),16,36); |
|
13 | +$sanitize_seed = 'sanitize_seed_'.base_convert(md5(__FILE__), 16, 36); |
|
14 | 14 | |
15 | 15 | // sanitize array |
16 | 16 | if (!function_exists('modx_sanitize_gpc')) { |
17 | - function modx_sanitize_gpc(& $values, $depth=0) { |
|
18 | - if(200 < $depth) exit('GPC Array nested too deep!'); |
|
19 | - if(is_array($values)) { |
|
17 | + function modx_sanitize_gpc(& $values, $depth = 0){ |
|
18 | + if (200 < $depth) exit('GPC Array nested too deep!'); |
|
19 | + if (is_array($values)) { |
|
20 | 20 | $depth++; |
21 | 21 | foreach ($values as $key => $value) { |
22 | 22 | if (is_array($value)) modx_sanitize_gpc($value, $depth); |
@@ -29,16 +29,16 @@ discard block |
||
29 | 29 | } |
30 | 30 | } |
31 | 31 | |
32 | -function getSanitizedValue($value='') { |
|
32 | +function getSanitizedValue($value = ''){ |
|
33 | 33 | global $sanitize_seed; |
34 | 34 | |
35 | - if(!$value) return $value; |
|
35 | + if (!$value) return $value; |
|
36 | 36 | |
37 | 37 | $brackets = explode(' ', '[[ ]] [! !] [* *] [( )] {{ }} [+ +] [~ ~] [^ ^]'); |
38 | - foreach($brackets as $bracket) { |
|
39 | - if(strpos($value,$bracket)===false) continue; |
|
40 | - $sanitizedBracket = str_replace('#', $sanitize_seed, sprintf('#%s#%s#', substr($bracket,0,1), substr($bracket,1,1))); |
|
41 | - $value = str_replace($bracket,$sanitizedBracket,$value); |
|
38 | + foreach ($brackets as $bracket) { |
|
39 | + if (strpos($value, $bracket) === false) continue; |
|
40 | + $sanitizedBracket = str_replace('#', $sanitize_seed, sprintf('#%s#%s#', substr($bracket, 0, 1), substr($bracket, 1, 1))); |
|
41 | + $value = str_replace($bracket, $sanitizedBracket, $value); |
|
42 | 42 | } |
43 | 43 | $value = str_ireplace('<script', 'sanitized_by_modx<s cript', $value); |
44 | 44 | $value = preg_replace('/&#(\d+);/', 'sanitized_by_modx& #$1', $value); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | modx_sanitize_gpc($_COOKIE); |
53 | 53 | modx_sanitize_gpc($_REQUEST); |
54 | 54 | |
55 | -foreach (array ('PHP_SELF', 'HTTP_USER_AGENT', 'HTTP_REFERER', 'QUERY_STRING') as $key) { |
|
55 | +foreach (array('PHP_SELF', 'HTTP_USER_AGENT', 'HTTP_REFERER', 'QUERY_STRING') as $key) { |
|
56 | 56 | $_SERVER[$key] = isset ($_SERVER[$key]) ? htmlspecialchars($_SERVER[$key], ENT_QUOTES) : null; |
57 | 57 | } |
58 | 58 |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
2 | +if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | 3 | |
4 | 4 | $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('user_messages'), "recipient=".$modx->getLoginUserID()." AND messageread=0"); |
5 | 5 | $nrnewmessages = $modx->db->getValue($rs); |
@@ -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,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
2 | +if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | 3 | |
4 | 4 | // START HACK |
5 | 5 | if (isset ($modx)) { |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | $which_browser_default = $which_browser; |
17 | 17 | while ($row = $modx->db->getRow($rs)) { |
18 | - if($row['setting_name'] == 'which_browser' && $row['setting_value'] == 'default') $row['setting_value'] = $which_browser_default; |
|
18 | + if ($row['setting_name'] == 'which_browser' && $row['setting_value'] == 'default') $row['setting_value'] = $which_browser_default; |
|
19 | 19 | $settings[$row['setting_name']] = $row['setting_value']; |
20 | 20 | if (isset($modx->config)) { |
21 | 21 | $modx->config[$row['setting_name']] = $row['setting_value']; |
@@ -18,7 +18,7 @@ |
||
18 | 18 | var stay = document.getElementById('stay'); |
19 | 19 | // Trigger unlock |
20 | 20 | if ((stay && stay.value !== '2') || !form_save) { |
21 | - var url = '<?php echo MODX_MANAGER_URL; ?>?a=67&type=<?php echo $lockElementType;?>&id=<?php echo $lockElementId;?>&o=' + Math.random(); |
|
21 | + var url = '<?php echo MODX_MANAGER_URL; ?>?a=67&type=<?php echo $lockElementType; ?>&id=<?php echo $lockElementId; ?>&o=' + Math.random(); |
|
22 | 22 | if (navigator.sendBeacon) { |
23 | 23 | navigator.sendBeacon(url) |
24 | 24 | } else { |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * Created by Raymond Irving Feb, 2005 |
5 | 5 | */ |
6 | 6 | global $BINDINGS; // Array of supported bindings. must be upper case |
7 | -$BINDINGS = array ( |
|
7 | +$BINDINGS = array( |
|
8 | 8 | 'FILE', |
9 | 9 | 'CHUNK', |
10 | 10 | 'DOCUMENT', |
@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | 'DIRECTORY' |
15 | 15 | ); |
16 | 16 | |
17 | -function ProcessTVCommand($value, $name = '', $docid = '', $src='docform', $tvsArray = array()) { |
|
17 | +function ProcessTVCommand($value, $name = '', $docid = '', $src = 'docform', $tvsArray = array()){ |
|
18 | 18 | global $modx; |
19 | 19 | $docid = intval($docid) ? intval($docid) : $modx->documentIdentifier; |
20 | 20 | $nvalue = trim($value); |
21 | 21 | if (substr($nvalue, 0, 1) != '@') |
22 | 22 | return $value; |
23 | - elseif(isset($modx->config['enable_bindings']) && $modx->config['enable_bindings']!=1 && $src==='docform') { |
|
23 | + elseif (isset($modx->config['enable_bindings']) && $modx->config['enable_bindings'] != 1 && $src === 'docform') { |
|
24 | 24 | return '@Bindings is disabled.'; |
25 | 25 | } |
26 | 26 | else { |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | break; |
47 | 47 | |
48 | 48 | case "SELECT" : // selects a record from the cms database |
49 | - $rt = array (); |
|
50 | - $replacementVars = array ( |
|
49 | + $rt = array(); |
|
50 | + $replacementVars = array( |
|
51 | 51 | 'DBASE' => $modx->db->config['dbase'], |
52 | 52 | 'PREFIX' => $modx->db->config['table_prefix'] |
53 | 53 | ); |
@@ -88,8 +88,8 @@ discard block |
||
88 | 88 | break; |
89 | 89 | |
90 | 90 | case 'DIRECTORY' : |
91 | - $files = array (); |
|
92 | - $path = $modx->config['base_path'] . $param; |
|
91 | + $files = array(); |
|
92 | + $path = $modx->config['base_path'].$param; |
|
93 | 93 | if (substr($path, -1, 1) != '/') { |
94 | 94 | $path .= '/'; |
95 | 95 | } |
@@ -117,10 +117,10 @@ discard block |
||
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
120 | -function ProcessFile($file) { |
|
120 | +function ProcessFile($file){ |
|
121 | 121 | // get the file |
122 | 122 | $buffer = @file_get_contents($file); |
123 | - if ($buffer===false) $buffer = " Could not retrieve document '$file'."; |
|
123 | + if ($buffer === false) $buffer = " Could not retrieve document '$file'."; |
|
124 | 124 | return $buffer; |
125 | 125 | } |
126 | 126 | |
@@ -129,12 +129,12 @@ discard block |
||
129 | 129 | { |
130 | 130 | global $BINDINGS; |
131 | 131 | $binding_array = array(); |
132 | - foreach($BINDINGS as $cmd) |
|
132 | + foreach ($BINDINGS as $cmd) |
|
133 | 133 | { |
134 | - if(strpos($binding_string,'@'.$cmd)===0) |
|
134 | + if (strpos($binding_string, '@'.$cmd) === 0) |
|
135 | 135 | { |
136 | - $code = substr($binding_string,strlen($cmd)+1); |
|
137 | - $binding_array = array($cmd,trim($code)); |
|
136 | + $code = substr($binding_string, strlen($cmd) + 1); |
|
137 | + $binding_array = array($cmd, trim($code)); |
|
138 | 138 | break; |
139 | 139 | } |
140 | 140 | } |
@@ -149,12 +149,12 @@ discard block |
||
149 | 149 | if (strpos($param, '[*') !== false) { |
150 | 150 | $matches = $modx->getTagsFromContent($param, '[*', '*]'); |
151 | 151 | foreach ($matches[0] as $i=>$match) { |
152 | - if(isset($tvsArray[ $matches[1][$i] ])) { |
|
153 | - if(is_array($tvsArray[ $matches[1][$i] ])) { |
|
152 | + if (isset($tvsArray[$matches[1][$i]])) { |
|
153 | + if (is_array($tvsArray[$matches[1][$i]])) { |
|
154 | 154 | $value = $tvsArray[$matches[1][$i]]['value']; |
155 | 155 | $value = $value === '' ? $tvsArray[$matches[1][$i]]['default_text'] : $value; |
156 | 156 | } else { |
157 | - $value = $tvsArray[ $matches[1][$i] ]; |
|
157 | + $value = $tvsArray[$matches[1][$i]]; |
|
158 | 158 | } |
159 | 159 | $param = str_replace($match, $value, $param); |
160 | 160 | } |