@@ -29,7 +29,8 @@ discard block |
||
29 | 29 | // include MagPieRSS |
30 | 30 | require_once(MODX_MANAGER_PATH.'media/rss/rss_fetch.inc'); |
31 | 31 | // Convert relative path into absolute url |
32 | -function rel2abs( $rel, $base ) { |
|
32 | +function rel2abs( $rel, $base ) |
|
33 | +{ |
|
33 | 34 | // parse base URL and convert to local variables: $scheme, $host, $path |
34 | 35 | extract( parse_url( $base ) ); |
35 | 36 | if ( strpos( $rel,"//" ) === 0 ) { |
@@ -63,7 +64,7 @@ discard block |
||
63 | 64 | foreach ($urls as $section=>$url) { |
64 | 65 | $output = ''; |
65 | 66 | $rss = @fetch_rss($url); |
66 | - if( !$rss ){ |
|
67 | + if( !$rss ) { |
|
67 | 68 | $feedData[$section] = 'Failed to retrieve ' . $url; |
68 | 69 | continue; |
69 | 70 | } |
@@ -1,5 +1,7 @@ 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") { |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | +} |
|
3 | 5 | |
4 | 6 | /** |
5 | 7 | * Secure Web Documents |
@@ -10,7 +12,8 @@ discard block |
||
10 | 12 | * |
11 | 13 | */ |
12 | 14 | |
13 | -function secureWebDocument($docid='') { |
|
15 | +function secureWebDocument($docid='') |
|
16 | +{ |
|
14 | 17 | global $modx; |
15 | 18 | |
16 | 19 | $modx->db->update('privateweb = 0', $modx->getFullTableName("site_content"), ($docid>0 ? "id='$docid'":"privateweb = 1")); |
@@ -65,21 +65,37 @@ |
||
65 | 65 | $_['macintosh'] = 'Western European (Mac) - macintosh'; |
66 | 66 | $_['Windows-1252'] = 'Western European (Windows) - Windows-1252'; |
67 | 67 | |
68 | -if($modx_charset == 'euc-jp') $_['euc-jp'] = 'Japanese (EUC) - euc-jp'; |
|
69 | -elseif($modx_charset == 'shift_jis') $_['shift_jis'] = 'Japanese (Shift-JIS) - shift_jis'; |
|
70 | -elseif($modx_charset == 'iso-2022-jp') $_['iso-2022-jp'] = 'Japanese (JIS-Allow 1 byte Kana - SO/SI) - iso-2022-jp'; |
|
71 | -elseif($modx_charset == 'csISO2022JP') $_['csISO2022JP'] = 'Japanese (JIS-Allow 1 byte Kana) - csISO2022JP'; |
|
72 | -elseif($modx_charset == 'EUC-CN') $_['EUC-CN'] = 'Chinese Simplified (EUC) - EUC-CN'; |
|
73 | -elseif($modx_charset == 'hz-gb-2312') $_['hz-gb-2312'] = 'Chinese Simplified (HZ) - hz-gb-2312'; |
|
74 | -elseif($modx_charset == 'x-mac-chinesesimp') $_['x-mac-chinesesimp'] = 'Chinese Simplified (Mac) - x-mac-chinesesimp'; |
|
75 | -elseif($modx_charset == 'x-Chinese-CNS') $_['x-Chinese-CNS'] = 'Chinese Traditional (CNS) - x-Chinese-CNS'; |
|
76 | -elseif($modx_charset == 'x-Chinese-Eten') $_['x-Chinese-Eten'] = 'Chinese Traditional (Eten) - x-Chinese-Eten'; |
|
77 | -elseif($modx_charset == 'x-mac-chinesetrad') $_['x-mac-chinesetrad'] = 'Chinese Traditional (Mac) - x-mac-chinesetrad'; |
|
78 | -elseif($modx_charset == 'ks_c_5601-1987') $_['ks_c_5601-1987'] = 'Korean - ks_c_5601-1987'; |
|
79 | -elseif($modx_charset == 'euc-kr') $_['euc-kr'] = 'Korean (EUC) - euc-kr'; |
|
80 | -elseif($modx_charset == 'iso-2022-kr') $_['iso-2022-kr'] = 'Korean (ISO) - iso-2022-kr'; |
|
81 | -elseif($modx_charset == 'Johab') $_['Johab'] = 'Korean (Johab) - Johab'; |
|
82 | -elseif($modx_charset == 'x-mac-korean') $_['x-mac-korean'] = 'Korean (Mac) - x-mac-korean'; |
|
68 | +if($modx_charset == 'euc-jp') { |
|
69 | + $_['euc-jp'] = 'Japanese (EUC) - euc-jp'; |
|
70 | +} elseif($modx_charset == 'shift_jis') { |
|
71 | + $_['shift_jis'] = 'Japanese (Shift-JIS) - shift_jis'; |
|
72 | +} elseif($modx_charset == 'iso-2022-jp') { |
|
73 | + $_['iso-2022-jp'] = 'Japanese (JIS-Allow 1 byte Kana - SO/SI) - iso-2022-jp'; |
|
74 | +} elseif($modx_charset == 'csISO2022JP') { |
|
75 | + $_['csISO2022JP'] = 'Japanese (JIS-Allow 1 byte Kana) - csISO2022JP'; |
|
76 | +} elseif($modx_charset == 'EUC-CN') { |
|
77 | + $_['EUC-CN'] = 'Chinese Simplified (EUC) - EUC-CN'; |
|
78 | +} elseif($modx_charset == 'hz-gb-2312') { |
|
79 | + $_['hz-gb-2312'] = 'Chinese Simplified (HZ) - hz-gb-2312'; |
|
80 | +} elseif($modx_charset == 'x-mac-chinesesimp') { |
|
81 | + $_['x-mac-chinesesimp'] = 'Chinese Simplified (Mac) - x-mac-chinesesimp'; |
|
82 | +} elseif($modx_charset == 'x-Chinese-CNS') { |
|
83 | + $_['x-Chinese-CNS'] = 'Chinese Traditional (CNS) - x-Chinese-CNS'; |
|
84 | +} elseif($modx_charset == 'x-Chinese-Eten') { |
|
85 | + $_['x-Chinese-Eten'] = 'Chinese Traditional (Eten) - x-Chinese-Eten'; |
|
86 | +} elseif($modx_charset == 'x-mac-chinesetrad') { |
|
87 | + $_['x-mac-chinesetrad'] = 'Chinese Traditional (Mac) - x-mac-chinesetrad'; |
|
88 | +} elseif($modx_charset == 'ks_c_5601-1987') { |
|
89 | + $_['ks_c_5601-1987'] = 'Korean - ks_c_5601-1987'; |
|
90 | +} elseif($modx_charset == 'euc-kr') { |
|
91 | + $_['euc-kr'] = 'Korean (EUC) - euc-kr'; |
|
92 | +} elseif($modx_charset == 'iso-2022-kr') { |
|
93 | + $_['iso-2022-kr'] = 'Korean (ISO) - iso-2022-kr'; |
|
94 | +} elseif($modx_charset == 'Johab') { |
|
95 | + $_['Johab'] = 'Korean (Johab) - Johab'; |
|
96 | +} elseif($modx_charset == 'x-mac-korean') { |
|
97 | + $_['x-mac-korean'] = 'Korean (Mac) - x-mac-korean'; |
|
98 | +} |
|
83 | 99 | |
84 | 100 | $tpl = '<option value="%s" %s>%s</option>'; |
85 | 101 | $options = array(); |
@@ -3,7 +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") { |
|
7 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
8 | +} |
|
7 | 9 | |
8 | 10 | require_once(dirname(__FILE__) . '/protect.inc.php'); |
9 | 11 | |
@@ -20,7 +22,7 @@ discard block |
||
20 | 22 | $str = ''; |
21 | 23 | $emptyCache = false; |
22 | 24 | |
23 | -switch(true){ |
|
25 | +switch(true) { |
|
24 | 26 | case ($action == 'get' && preg_match('/^[A-z0-9_-]+$/',$lang) && file_exists(dirname(__FILE__) . '/lang/'.$lang.'.inc.php')):{ |
25 | 27 | include(dirname(__FILE__) . '/lang/'.$lang.'.inc.php'); |
26 | 28 | $str = isset($key,$_lang,$_lang[$key]) ? $_lang[$key] : "" ; |
@@ -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); |
@@ -3,18 +3,22 @@ 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 | 8 | global $modx; |
8 | 9 | $useTable = $modx->getFullTableName('categories'); |
9 | 10 | $categoryId = $modx->db->insert( |
10 | 11 | array( |
11 | 12 | 'category' => $modx->db->escape($newCat), |
12 | 13 | ), $useTable); |
13 | - if (!$categoryId) $categoryId = 0; |
|
14 | + if (!$categoryId) { |
|
15 | + $categoryId = 0; |
|
16 | + } |
|
14 | 17 | return $categoryId; |
15 | 18 | } |
16 | 19 | //check if new category already exists |
17 | -function checkCategory($newCat = '') { |
|
20 | +function checkCategory($newCat = '') |
|
21 | +{ |
|
18 | 22 | global $modx; |
19 | 23 | $useTable = $modx->getFullTableName('categories'); |
20 | 24 | $newCat = $modx->db->escape($newCat); |
@@ -25,13 +29,17 @@ discard block |
||
25 | 29 | return 0; |
26 | 30 | } |
27 | 31 | //Check for category, create new if not exists |
28 | -function getCategory($category='') { |
|
32 | +function getCategory($category='') |
|
33 | +{ |
|
29 | 34 | $categoryId = checkCategory($category); |
30 | - if(!$categoryId) $categoryId = newCategory($category); |
|
35 | + if(!$categoryId) { |
|
36 | + $categoryId = newCategory($category); |
|
37 | + } |
|
31 | 38 | return $categoryId; |
32 | 39 | } |
33 | 40 | //Get all categories |
34 | -function getCategories() { |
|
41 | +function getCategories() |
|
42 | +{ |
|
35 | 43 | global $modx; |
36 | 44 | $useTable = $modx->getFullTableName('categories'); |
37 | 45 | $cats = $modx->db->select('id, category', $modx->getFullTableName('categories'), '', 'category'); |
@@ -43,7 +51,8 @@ discard block |
||
43 | 51 | return $resourceArray; |
44 | 52 | } |
45 | 53 | //Delete category & associations |
46 | -function deleteCategory($catId=0) { |
|
54 | +function deleteCategory($catId=0) |
|
55 | +{ |
|
47 | 56 | global $modx; |
48 | 57 | if ($catId) { |
49 | 58 | $resetTables = array('site_plugins', 'site_snippets', 'site_htmlsnippets', 'site_templates', 'site_tmplvars', 'site_modules'); |
@@ -6,37 +6,50 @@ |
||
6 | 6 | error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED); |
7 | 7 | |
8 | 8 | // Null is evil |
9 | -if (isset($_SERVER['QUERY_STRING']) && strpos(urldecode($_SERVER['QUERY_STRING']), chr(0)) !== false) |
|
9 | +if (isset($_SERVER['QUERY_STRING']) && strpos(urldecode($_SERVER['QUERY_STRING']), chr(0)) !== false) { |
|
10 | 10 | die(); |
11 | +} |
|
11 | 12 | |
12 | 13 | global $sanitize_seed; |
13 | 14 | $sanitize_seed = 'sanitize_seed_' . base_convert(md5(__FILE__),16,36); |
14 | 15 | |
15 | 16 | // sanitize array |
16 | 17 | if (!function_exists('modx_sanitize_gpc')) { |
17 | - function modx_sanitize_gpc(& $values, $depth=0) { |
|
18 | - if(200 < $depth) exit('GPC Array nested too deep!'); |
|
18 | + function modx_sanitize_gpc(& $values, $depth=0) |
|
19 | + { |
|
20 | + if(200 < $depth) { |
|
21 | + exit('GPC Array nested too deep!'); |
|
22 | + } |
|
19 | 23 | if(is_array($values)) { |
20 | 24 | $depth++; |
21 | 25 | foreach ($values as $key => $value) { |
22 | - if (is_array($value)) modx_sanitize_gpc($value, $depth); |
|
23 | - else $values[$key] = getSanitizedValue($value); |
|
26 | + if (is_array($value)) { |
|
27 | + modx_sanitize_gpc($value, $depth); |
|
28 | + } else { |
|
29 | + $values[$key] = getSanitizedValue($value); |
|
30 | + } |
|
24 | 31 | } |
32 | + } else { |
|
33 | + $values = getSanitizedValue($values); |
|
25 | 34 | } |
26 | - else $values = getSanitizedValue($values); |
|
27 | 35 | |
28 | 36 | return $values; |
29 | 37 | } |
30 | 38 | } |
31 | 39 | |
32 | -function getSanitizedValue($value='') { |
|
40 | +function getSanitizedValue($value='') |
|
41 | +{ |
|
33 | 42 | global $sanitize_seed; |
34 | 43 | |
35 | - if(!$value) return $value; |
|
44 | + if(!$value) { |
|
45 | + return $value; |
|
46 | + } |
|
36 | 47 | |
37 | 48 | $brackets = explode(' ', '[[ ]] [! !] [* *] [( )] {{ }} [+ +] [~ ~] [^ ^]'); |
38 | 49 | foreach($brackets as $bracket) { |
39 | - if(strpos($value,$bracket)===false) continue; |
|
50 | + if(strpos($value,$bracket)===false) { |
|
51 | + continue; |
|
52 | + } |
|
40 | 53 | $sanitizedBracket = str_replace('#', $sanitize_seed, sprintf('#%s#%s#', substr($bracket,0,1), substr($bracket,1,1))); |
41 | 54 | $value = str_replace($bracket,$sanitizedBracket,$value); |
42 | 55 | } |
@@ -1,5 +1,7 @@ |
||
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") { |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | +} |
|
3 | 5 | |
4 | 6 | $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('user_messages'), "recipient=".$modx->getLoginUserID()." AND messageread=0"); |
5 | 7 | $nrnewmessages = $modx->db->getValue($rs); |
@@ -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> |