@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | -class DATEPICKER { |
|
3 | - function __construct() { |
|
2 | +class DATEPICKER{ |
|
3 | + function __construct(){ |
|
4 | 4 | } |
5 | - function getDP() { |
|
6 | - global $modx,$_lang; |
|
5 | + function getDP(){ |
|
6 | + global $modx, $_lang; |
|
7 | 7 | |
8 | 8 | $tpl = file_get_contents(dirname(__FILE__).'/datepicker.tpl'); |
9 | - return $modx->parseText($tpl,$_lang,'[%','%]'); |
|
9 | + return $modx->parseText($tpl, $_lang, '[%', '%]'); |
|
10 | 10 | } |
11 | 11 | } |
@@ -1,8 +1,11 @@ |
||
1 | 1 | <?php |
2 | -class DATEPICKER { |
|
3 | - function __construct() { |
|
2 | +class DATEPICKER |
|
3 | +{ |
|
4 | + function __construct() |
|
5 | + { |
|
4 | 6 | } |
5 | - function getDP() { |
|
7 | + function getDP() |
|
8 | + { |
|
6 | 9 | global $modx,$_lang; |
7 | 10 | |
8 | 11 | $tpl = file_get_contents(dirname(__FILE__).'/datepicker.tpl'); |
@@ -22,7 +22,8 @@ discard block |
||
22 | 22 | NOTE: http://www.w3.org/TR/NOTE-datetime |
23 | 23 | \*======================================================================*/ |
24 | 24 | |
25 | -function parse_w3cdtf ( $date_str ) { |
|
25 | +function parse_w3cdtf ( $date_str ) |
|
26 | +{ |
|
26 | 27 | |
27 | 28 | # regex to match wc3dtf |
28 | 29 | $pat = "/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(:(\d{2}))?(?:([-+])(\d{2}):?(\d{2})|(Z))?/"; |
@@ -37,8 +38,7 @@ discard block |
||
37 | 38 | $offset = 0; |
38 | 39 | if ( $match[10] == 'Z' ) { |
39 | 40 | # zulu time, aka GMT |
40 | - } |
|
41 | - else { |
|
41 | + } else { |
|
42 | 42 | list( $tz_mod, $tz_hour, $tz_min ) = |
43 | 43 | array( $match[8], $match[9], $match[10]); |
44 | 44 | |
@@ -58,8 +58,7 @@ discard block |
||
58 | 58 | } |
59 | 59 | $epoch = $epoch + $offset; |
60 | 60 | return $epoch; |
61 | - } |
|
62 | - else { |
|
61 | + } else { |
|
63 | 62 | return -1; |
64 | 63 | } |
65 | 64 | } |
@@ -22,35 +22,35 @@ |
||
22 | 22 | NOTE: http://www.w3.org/TR/NOTE-datetime |
23 | 23 | \*======================================================================*/ |
24 | 24 | |
25 | -function parse_w3cdtf ( $date_str ) { |
|
25 | +function parse_w3cdtf($date_str){ |
|
26 | 26 | |
27 | 27 | # regex to match wc3dtf |
28 | 28 | $pat = "/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(:(\d{2}))?(?:([-+])(\d{2}):?(\d{2})|(Z))?/"; |
29 | 29 | |
30 | - if ( preg_match( $pat, $date_str, $match ) ) { |
|
31 | - list( $year, $month, $day, $hours, $minutes, $seconds) = |
|
32 | - array( $match[1], $match[2], $match[3], $match[4], $match[5], $match[6]); |
|
30 | + if (preg_match($pat, $date_str, $match)) { |
|
31 | + list($year, $month, $day, $hours, $minutes, $seconds) = |
|
32 | + array($match[1], $match[2], $match[3], $match[4], $match[5], $match[6]); |
|
33 | 33 | |
34 | 34 | # calc epoch for current date assuming GMT |
35 | - $epoch = gmmktime( $hours, $minutes, $seconds, $month, $day, $year); |
|
35 | + $epoch = gmmktime($hours, $minutes, $seconds, $month, $day, $year); |
|
36 | 36 | |
37 | 37 | $offset = 0; |
38 | - if ( $match[10] == 'Z' ) { |
|
38 | + if ($match[10] == 'Z') { |
|
39 | 39 | # zulu time, aka GMT |
40 | 40 | } |
41 | 41 | else { |
42 | - list( $tz_mod, $tz_hour, $tz_min ) = |
|
43 | - array( $match[8], $match[9], $match[10]); |
|
42 | + list($tz_mod, $tz_hour, $tz_min) = |
|
43 | + array($match[8], $match[9], $match[10]); |
|
44 | 44 | |
45 | 45 | # zero out the variables |
46 | - if ( ! $tz_hour ) { $tz_hour = 0; } |
|
47 | - if ( ! $tz_min ) { $tz_min = 0; } |
|
46 | + if (!$tz_hour) { $tz_hour = 0; } |
|
47 | + if (!$tz_min) { $tz_min = 0; } |
|
48 | 48 | |
49 | - $offset_secs = (($tz_hour*60)+$tz_min)*60; |
|
49 | + $offset_secs = (($tz_hour * 60) + $tz_min) * 60; |
|
50 | 50 | |
51 | 51 | # is timezone ahead of GMT? then subtract offset |
52 | 52 | # |
53 | - if ( $tz_mod == '+' ) { |
|
53 | + if ($tz_mod == '+') { |
|
54 | 54 | $offset_secs = $offset_secs * -1; |
55 | 55 | } |
56 | 56 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -$c = &$settings; |
|
3 | +$c = &$settings; |
|
4 | 4 | |
5 | 5 | $c['site_name'] = 'My MODX Site'; |
6 | 6 | $c['site_start'] = 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(); |
@@ -65,26 +65,26 @@ |
||
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') $_['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'; |
|
83 | 83 | |
84 | 84 | $tpl = '<option value="%s" %s>%s</option>'; |
85 | 85 | $options = array(); |
86 | -foreach($_ as $value=>$label) { |
|
87 | - $selected = $value===$modx_charset ? 'selected' : ''; |
|
86 | +foreach ($_ as $value=>$label) { |
|
87 | + $selected = $value === $modx_charset ? 'selected' : ''; |
|
88 | 88 | $options[] = sprintf($tpl, $value, $selected, $label); |
89 | 89 | } |
90 | 90 | echo implode("\n", $options); |
@@ -55,7 +55,7 @@ |
||
55 | 55 | $modx->setPlaceholder($rvKey, $rvValue); |
56 | 56 | } |
57 | 57 | $param = $modx->mergePlaceholderContent($param); |
58 | - $rs = $modx->db->query("SELECT $param;"); |
|
58 | + $rs = $modx->db->query("select $param;"); |
|
59 | 59 | $output = $rs; |
60 | 60 | break; |
61 | 61 |
@@ -163,7 +163,7 @@ |
||
163 | 163 | * |
164 | 164 | * @param string $param |
165 | 165 | * @param array $tvsArray |
166 | - * @return mixed |
|
166 | + * @return string |
|
167 | 167 | */ |
168 | 168 | function parseTvValues($param, $tvsArray) |
169 | 169 | { |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | */ |
132 | 132 | function ProcessFile($file) { |
133 | 133 | // get the file |
134 | - $buffer = @file_get_contents($file); |
|
135 | - if ($buffer === false) $buffer = " Could not retrieve document '$file'."; |
|
134 | + $buffer = @file_get_contents($file); |
|
135 | + if ($buffer === false) $buffer = " Could not retrieve document '$file'."; |
|
136 | 136 | return $buffer; |
137 | 137 | } |
138 | 138 | |
@@ -167,21 +167,21 @@ discard block |
||
167 | 167 | */ |
168 | 168 | function parseTvValues($param, $tvsArray) |
169 | 169 | { |
170 | - global $modx; |
|
171 | - $tvsArray = is_array($modx->documentObject) ? array_merge($tvsArray, $modx->documentObject) : $tvsArray; |
|
172 | - if (strpos($param, '[*') !== false) { |
|
173 | - $matches = $modx->getTagsFromContent($param, '[*', '*]'); |
|
174 | - foreach ($matches[0] as $i=>$match) { |
|
175 | - if(isset($tvsArray[ $matches[1][$i] ])) { |
|
176 | - if(is_array($tvsArray[ $matches[1][$i] ])) { |
|
177 | - $value = $tvsArray[$matches[1][$i]]['value']; |
|
178 | - $value = $value === '' ? $tvsArray[$matches[1][$i]]['default_text'] : $value; |
|
179 | - } else { |
|
180 | - $value = $tvsArray[ $matches[1][$i] ]; |
|
181 | - } |
|
182 | - $param = str_replace($match, $value, $param); |
|
183 | - } |
|
184 | - } |
|
185 | - } |
|
186 | - return $param; |
|
170 | + global $modx; |
|
171 | + $tvsArray = is_array($modx->documentObject) ? array_merge($tvsArray, $modx->documentObject) : $tvsArray; |
|
172 | + if (strpos($param, '[*') !== false) { |
|
173 | + $matches = $modx->getTagsFromContent($param, '[*', '*]'); |
|
174 | + foreach ($matches[0] as $i=>$match) { |
|
175 | + if(isset($tvsArray[ $matches[1][$i] ])) { |
|
176 | + if(is_array($tvsArray[ $matches[1][$i] ])) { |
|
177 | + $value = $tvsArray[$matches[1][$i]]['value']; |
|
178 | + $value = $value === '' ? $tvsArray[$matches[1][$i]]['default_text'] : $value; |
|
179 | + } else { |
|
180 | + $value = $tvsArray[ $matches[1][$i] ]; |
|
181 | + } |
|
182 | + $param = str_replace($match, $value, $param); |
|
183 | + } |
|
184 | + } |
|
185 | + } |
|
186 | + return $param; |
|
187 | 187 | } |
@@ -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', |
@@ -22,13 +22,13 @@ discard block |
||
22 | 22 | * @param array $tvsArray |
23 | 23 | * @return string |
24 | 24 | */ |
25 | -function ProcessTVCommand($value, $name = '', $docid = '', $src='docform', $tvsArray = array()) { |
|
25 | +function ProcessTVCommand($value, $name = '', $docid = '', $src = 'docform', $tvsArray = array()){ |
|
26 | 26 | global $modx; |
27 | - $docid = (int)$docid > 0 ? (int)$docid : $modx->documentIdentifier; |
|
27 | + $docid = (int) $docid > 0 ? (int) $docid : $modx->documentIdentifier; |
|
28 | 28 | $nvalue = trim($value); |
29 | 29 | if (substr($nvalue, 0, 1) != '@') |
30 | 30 | return $value; |
31 | - elseif(isset($modx->config['enable_bindings']) && $modx->config['enable_bindings']!=1 && $src==='docform') { |
|
31 | + elseif (isset($modx->config['enable_bindings']) && $modx->config['enable_bindings'] != 1 && $src === 'docform') { |
|
32 | 32 | return '@Bindings is disabled.'; |
33 | 33 | } |
34 | 34 | else { |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | break; |
55 | 55 | |
56 | 56 | case "SELECT" : // selects a record from the cms database |
57 | - $rt = array (); |
|
58 | - $replacementVars = array ( |
|
57 | + $rt = array(); |
|
58 | + $replacementVars = array( |
|
59 | 59 | 'DBASE' => $modx->db->config['dbase'], |
60 | 60 | 'PREFIX' => $modx->db->config['table_prefix'] |
61 | 61 | ); |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | break; |
97 | 97 | |
98 | 98 | case 'DIRECTORY' : |
99 | - $files = array (); |
|
100 | - $path = $modx->config['base_path'] . $param; |
|
99 | + $files = array(); |
|
100 | + $path = $modx->config['base_path'].$param; |
|
101 | 101 | if (substr($path, -1, 1) != '/') { |
102 | 102 | $path .= '/'; |
103 | 103 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * @param $file |
130 | 130 | * @return string |
131 | 131 | */ |
132 | -function ProcessFile($file) { |
|
132 | +function ProcessFile($file){ |
|
133 | 133 | // get the file |
134 | 134 | $buffer = @file_get_contents($file); |
135 | 135 | if ($buffer === false) $buffer = " Could not retrieve document '$file'."; |
@@ -146,12 +146,12 @@ discard block |
||
146 | 146 | { |
147 | 147 | global $BINDINGS; |
148 | 148 | $binding_array = array(); |
149 | - foreach($BINDINGS as $cmd) |
|
149 | + foreach ($BINDINGS as $cmd) |
|
150 | 150 | { |
151 | - if(strpos($binding_string,'@'.$cmd)===0) |
|
151 | + if (strpos($binding_string, '@'.$cmd) === 0) |
|
152 | 152 | { |
153 | - $code = substr($binding_string,strlen($cmd)+1); |
|
154 | - $binding_array = array($cmd,trim($code)); |
|
153 | + $code = substr($binding_string, strlen($cmd) + 1); |
|
154 | + $binding_array = array($cmd, trim($code)); |
|
155 | 155 | break; |
156 | 156 | } |
157 | 157 | } |
@@ -172,12 +172,12 @@ discard block |
||
172 | 172 | if (strpos($param, '[*') !== false) { |
173 | 173 | $matches = $modx->getTagsFromContent($param, '[*', '*]'); |
174 | 174 | foreach ($matches[0] as $i=>$match) { |
175 | - if(isset($tvsArray[ $matches[1][$i] ])) { |
|
176 | - if(is_array($tvsArray[ $matches[1][$i] ])) { |
|
175 | + if (isset($tvsArray[$matches[1][$i]])) { |
|
176 | + if (is_array($tvsArray[$matches[1][$i]])) { |
|
177 | 177 | $value = $tvsArray[$matches[1][$i]]['value']; |
178 | 178 | $value = $value === '' ? $tvsArray[$matches[1][$i]]['default_text'] : $value; |
179 | 179 | } else { |
180 | - $value = $tvsArray[ $matches[1][$i] ]; |
|
180 | + $value = $tvsArray[$matches[1][$i]]; |
|
181 | 181 | } |
182 | 182 | $param = str_replace($match, $value, $param); |
183 | 183 | } |
@@ -22,16 +22,16 @@ discard block |
||
22 | 22 | * @param array $tvsArray |
23 | 23 | * @return string |
24 | 24 | */ |
25 | -function ProcessTVCommand($value, $name = '', $docid = '', $src='docform', $tvsArray = array()) { |
|
25 | +function ProcessTVCommand($value, $name = '', $docid = '', $src='docform', $tvsArray = array()) |
|
26 | +{ |
|
26 | 27 | global $modx; |
27 | 28 | $docid = (int)$docid > 0 ? (int)$docid : $modx->documentIdentifier; |
28 | 29 | $nvalue = trim($value); |
29 | - if (substr($nvalue, 0, 1) != '@') |
|
30 | - return $value; |
|
31 | - elseif(isset($modx->config['enable_bindings']) && $modx->config['enable_bindings']!=1 && $src==='docform') { |
|
30 | + if (substr($nvalue, 0, 1) != '@') { |
|
31 | + return $value; |
|
32 | + } elseif(isset($modx->config['enable_bindings']) && $modx->config['enable_bindings']!=1 && $src==='docform') { |
|
32 | 33 | return '@Bindings is disabled.'; |
33 | - } |
|
34 | - else { |
|
34 | + } else { |
|
35 | 35 | list ($cmd, $param) = ParseCommand($nvalue); |
36 | 36 | $cmd = trim($cmd); |
37 | 37 | $param = parseTvValues($param, $tvsArray); |
@@ -47,10 +47,11 @@ discard block |
||
47 | 47 | |
48 | 48 | case "DOCUMENT" : // retrieve a document and process it's content |
49 | 49 | $rs = $modx->getDocument($param); |
50 | - if (is_array($rs)) |
|
51 | - $output = $rs['content']; |
|
52 | - else |
|
53 | - $output = "Unable to locate document $param"; |
|
50 | + if (is_array($rs)) { |
|
51 | + $output = $rs['content']; |
|
52 | + } else { |
|
53 | + $output = "Unable to locate document $param"; |
|
54 | + } |
|
54 | 55 | break; |
55 | 56 | |
56 | 57 | case "SELECT" : // selects a record from the cms database |
@@ -80,8 +81,10 @@ discard block |
||
80 | 81 | |
81 | 82 | // Grab document regardless of publish status |
82 | 83 | $doc = $modx->getPageInfo($parent_id, 0, 'id,parent,published'); |
83 | - if ($doc['parent'] != 0 && !$doc['published']) |
|
84 | - continue; // hide unpublished docs if we're not at the top |
|
84 | + if ($doc['parent'] != 0 && !$doc['published']) { |
|
85 | + continue; |
|
86 | + } |
|
87 | + // hide unpublished docs if we're not at the top |
|
85 | 88 | |
86 | 89 | $tv = $modx->getTemplateVar($name, '*', $doc['id'], $doc['published']); |
87 | 90 | |
@@ -129,10 +132,13 @@ discard block |
||
129 | 132 | * @param $file |
130 | 133 | * @return string |
131 | 134 | */ |
132 | -function ProcessFile($file) { |
|
135 | +function ProcessFile($file) |
|
136 | +{ |
|
133 | 137 | // get the file |
134 | 138 | $buffer = @file_get_contents($file); |
135 | - if ($buffer === false) $buffer = " Could not retrieve document '$file'."; |
|
139 | + if ($buffer === false) { |
|
140 | + $buffer = " Could not retrieve document '$file'."; |
|
141 | + } |
|
136 | 142 | return $buffer; |
137 | 143 | } |
138 | 144 | |
@@ -146,10 +152,8 @@ discard block |
||
146 | 152 | { |
147 | 153 | global $BINDINGS; |
148 | 154 | $binding_array = array(); |
149 | - foreach($BINDINGS as $cmd) |
|
150 | - { |
|
151 | - if(strpos($binding_string,'@'.$cmd)===0) |
|
152 | - { |
|
155 | + foreach($BINDINGS as $cmd) { |
|
156 | + if(strpos($binding_string,'@'.$cmd)===0) { |
|
153 | 157 | $code = substr($binding_string,strlen($cmd)+1); |
154 | 158 | $binding_array = array($cmd,trim($code)); |
155 | 159 | break; |
@@ -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))) { |
@@ -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): { |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | * MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php" |
257 | 257 | * $extname - extension name in lowercase |
258 | 258 | * |
259 | - * @param $extname |
|
259 | + * @param string $extname |
|
260 | 260 | * @param bool $reload |
261 | 261 | * @return bool |
262 | 262 | */ |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * @param int $count_attempts |
300 | 300 | * @param string $type $type |
301 | 301 | * @param string $responseCode |
302 | - * @return bool|null |
|
302 | + * @return false|null |
|
303 | 303 | * @global string $base_url |
304 | 304 | * @global string $site_url |
305 | 305 | */ |
@@ -1001,7 +1001,7 @@ discard block |
||
1001 | 1001 | } |
1002 | 1002 | |
1003 | 1003 | /** |
1004 | - * @param $contents |
|
1004 | + * @param string $contents |
|
1005 | 1005 | * @return mixed |
1006 | 1006 | */ |
1007 | 1007 | public function RecoveryEscapedTags($contents) |
@@ -1025,7 +1025,7 @@ discard block |
||
1025 | 1025 | } |
1026 | 1026 | |
1027 | 1027 | /** |
1028 | - * @param $tstart |
|
1028 | + * @param double $tstart |
|
1029 | 1029 | * @return array |
1030 | 1030 | */ |
1031 | 1031 | public function getTimerStats($tstart) |
@@ -1777,7 +1777,7 @@ discard block |
||
1777 | 1777 | |
1778 | 1778 | /** |
1779 | 1779 | * Remove Comment-Tags from output like <!--@- Comment -@--> |
1780 | - * @param $content |
|
1780 | + * @param string $content |
|
1781 | 1781 | * @param string $left |
1782 | 1782 | * @param string $right |
1783 | 1783 | * @return mixed |
@@ -1950,7 +1950,7 @@ discard block |
||
1950 | 1950 | /** |
1951 | 1951 | * Run snippets as per the tags in $documentSource and replace the tags with the returned values. |
1952 | 1952 | * |
1953 | - * @param $content |
|
1953 | + * @param string $content |
|
1954 | 1954 | * @return string |
1955 | 1955 | * @internal param string $documentSource |
1956 | 1956 | */ |
@@ -2984,7 +2984,7 @@ discard block |
||
2984 | 2984 | |
2985 | 2985 | /** |
2986 | 2986 | * @param $templateID |
2987 | - * @return mixed |
|
2987 | + * @return string |
|
2988 | 2988 | */ |
2989 | 2989 | public function _getTemplateCodeFromDB($templateID) |
2990 | 2990 | { |
@@ -3027,7 +3027,7 @@ discard block |
||
3027 | 3027 | /** |
3028 | 3028 | * @param $id |
3029 | 3029 | * @param int $top |
3030 | - * @return mixed |
|
3030 | + * @return string |
|
3031 | 3031 | */ |
3032 | 3032 | public function getUltimateParentId($id, $top = 0) |
3033 | 3033 | { |
@@ -3358,7 +3358,7 @@ discard block |
||
3358 | 3358 | * |
3359 | 3359 | * @param int $type Types: 1=template, 2=tv, 3=chunk, 4=snippet, 5=plugin, 6=module, 7=resource, 8=role |
3360 | 3360 | * @param int $id Element- / Resource-id |
3361 | - * @return bool |
|
3361 | + * @return false|null |
|
3362 | 3362 | */ |
3363 | 3363 | public function lockElement($type, $id) |
3364 | 3364 | { |
@@ -3380,7 +3380,7 @@ discard block |
||
3380 | 3380 | * @param int $type Types: 1=template, 2=tv, 3=chunk, 4=snippet, 5=plugin, 6=module, 7=resource, 8=role |
3381 | 3381 | * @param int $id Element- / Resource-id |
3382 | 3382 | * @param bool $includeAllUsers true = Deletes not only own user-locks |
3383 | - * @return bool |
|
3383 | + * @return false|null |
|
3384 | 3384 | */ |
3385 | 3385 | public function unlockElement($type, $id, $includeAllUsers = false) |
3386 | 3386 | { |
@@ -3488,7 +3488,7 @@ discard block |
||
3488 | 3488 | * @param array $params |
3489 | 3489 | * @param string $msg |
3490 | 3490 | * @param array $files |
3491 | - * @return mixed |
|
3491 | + * @return boolean |
|
3492 | 3492 | */ |
3493 | 3493 | public function sendmail($params = array(), $msg = '', $files = array()) |
3494 | 3494 | { |
@@ -3984,7 +3984,7 @@ discard block |
||
3984 | 3984 | * |
3985 | 3985 | * @param string $type |
3986 | 3986 | * @param bool $report |
3987 | - * @return bool |
|
3987 | + * @return boolean|null |
|
3988 | 3988 | */ |
3989 | 3989 | public function clearCache($type = '', $report = false) |
3990 | 3990 | { |
@@ -4351,7 +4351,7 @@ discard block |
||
4351 | 4351 | * - Placeholders prefix. Default: '{'. |
4352 | 4352 | * @param string $suffix {string} |
4353 | 4353 | * - Placeholders suffix. Default: '}'. |
4354 | - * @return bool|mixed|string {string; false} - Parsed chunk or false if $chunkArr is not array. |
|
4354 | + * @return false|string {string; false} - Parsed chunk or false if $chunkArr is not array. |
|
4355 | 4355 | * - Parsed chunk or false if $chunkArr is not array. |
4356 | 4356 | */ |
4357 | 4357 | public function parseChunk($chunkName, $chunkArr, $prefix = '{', $suffix = '}') |
@@ -5327,7 +5327,7 @@ discard block |
||
5327 | 5327 | * Remove event listener - only for use within the current execution cycle |
5328 | 5328 | * |
5329 | 5329 | * @param string $evtName |
5330 | - * @return boolean |
|
5330 | + * @return false|null |
|
5331 | 5331 | */ |
5332 | 5332 | public function removeEventListener($evtName) |
5333 | 5333 | { |
@@ -5351,7 +5351,7 @@ discard block |
||
5351 | 5351 | * |
5352 | 5352 | * @param string $evtName |
5353 | 5353 | * @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. |
5354 | - * @return boolean|array |
|
5354 | + * @return false|null |
|
5355 | 5355 | */ |
5356 | 5356 | public function invokeEvent($evtName, $extParams = array()) |
5357 | 5357 | { |
@@ -5950,7 +5950,7 @@ discard block |
||
5950 | 5950 | |
5951 | 5951 | /** |
5952 | 5952 | * @param string $str |
5953 | - * @return bool|mixed|string |
|
5953 | + * @return string |
|
5954 | 5954 | */ |
5955 | 5955 | public function atBindFileContent($str = '') |
5956 | 5956 | { |
@@ -6001,8 +6001,8 @@ discard block |
||
6001 | 6001 | } |
6002 | 6002 | |
6003 | 6003 | /** |
6004 | - * @param $str |
|
6005 | - * @return bool|string |
|
6004 | + * @param string $str |
|
6005 | + * @return false|string |
|
6006 | 6006 | */ |
6007 | 6007 | public function getExtFromFilename($str) |
6008 | 6008 | { |
@@ -6030,7 +6030,7 @@ discard block |
||
6030 | 6030 | * @param string $text Error message |
6031 | 6031 | * @param string $file File where the error was detected |
6032 | 6032 | * @param string $line Line number within $file |
6033 | - * @return boolean |
|
6033 | + * @return boolean|null |
|
6034 | 6034 | */ |
6035 | 6035 | public function phpError($nr, $text, $file, $line) |
6036 | 6036 | { |
@@ -6082,7 +6082,7 @@ discard block |
||
6082 | 6082 | * @param string $text |
6083 | 6083 | * @param string $line |
6084 | 6084 | * @param string $output |
6085 | - * @return bool |
|
6085 | + * @return null|boolean |
|
6086 | 6086 | */ |
6087 | 6087 | public function messageQuit($msg = 'unspecified error', $query = '', $is_error = true, $nr = '', $file = '', $source = '', $text = '', $line = '', $output = '') |
6088 | 6088 | { |
@@ -6504,7 +6504,7 @@ discard block |
||
6504 | 6504 | |
6505 | 6505 | /** |
6506 | 6506 | * @param string $str |
6507 | - * @return bool|mixed|string |
|
6507 | + * @return string |
|
6508 | 6508 | */ |
6509 | 6509 | public function atBindInclude($str = '') |
6510 | 6510 | { |
@@ -6555,7 +6555,7 @@ discard block |
||
6555 | 6555 | * @param $str |
6556 | 6556 | * @param int $flags |
6557 | 6557 | * @param string $encode |
6558 | - * @return mixed |
|
6558 | + * @return string |
|
6559 | 6559 | */ |
6560 | 6560 | public function htmlspecialchars($str, $flags = ENT_COMPAT, $encode = '') |
6561 | 6561 | { |
@@ -6564,7 +6564,7 @@ discard block |
||
6564 | 6564 | } |
6565 | 6565 | |
6566 | 6566 | /** |
6567 | - * @param $string |
|
6567 | + * @param string $string |
|
6568 | 6568 | * @param bool $returnData |
6569 | 6569 | * @return bool|mixed |
6570 | 6570 | */ |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | */ |
206 | 206 | function __call($method_name, $arguments) |
207 | 207 | { |
208 | - include_once(MODX_MANAGER_PATH . 'includes/extenders/deprecated.functions.inc.php'); |
|
208 | + include_once(MODX_MANAGER_PATH.'includes/extenders/deprecated.functions.inc.php'); |
|
209 | 209 | if (method_exists($this->old, $method_name)) { |
210 | 210 | $error_type = 1; |
211 | 211 | } else { |
@@ -223,12 +223,12 @@ discard block |
||
223 | 223 | $info = debug_backtrace(); |
224 | 224 | $m[] = $msg; |
225 | 225 | if (!empty($this->currentSnippet)) { |
226 | - $m[] = 'Snippet - ' . $this->currentSnippet; |
|
226 | + $m[] = 'Snippet - '.$this->currentSnippet; |
|
227 | 227 | } elseif (!empty($this->event->activePlugin)) { |
228 | - $m[] = 'Plugin - ' . $this->event->activePlugin; |
|
228 | + $m[] = 'Plugin - '.$this->event->activePlugin; |
|
229 | 229 | } |
230 | 230 | $m[] = $this->decoded_request_uri; |
231 | - $m[] = str_replace('\\', '/', $info[0]['file']) . '(line:' . $info[0]['line'] . ')'; |
|
231 | + $m[] = str_replace('\\', '/', $info[0]['file']).'(line:'.$info[0]['line'].')'; |
|
232 | 232 | $msg = implode('<br />', $m); |
233 | 233 | $this->logEvent(0, $error_type, $msg, $title); |
234 | 234 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | { |
246 | 246 | $flag = false; |
247 | 247 | if (is_scalar($connector) && !empty($connector) && isset($this->{$connector}) && $this->{$connector} instanceof DBAPI) { |
248 | - $flag = (bool)$this->{$connector}->conn; |
|
248 | + $flag = (bool) $this->{$connector}->conn; |
|
249 | 249 | } |
250 | 250 | return $flag; |
251 | 251 | } |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | } |
273 | 273 | if (!$out && $flag) { |
274 | 274 | $extname = trim(str_replace(array('..', '/', '\\'), '', strtolower($extname))); |
275 | - $filename = MODX_MANAGER_PATH . "includes/extenders/ex_{$extname}.inc.php"; |
|
275 | + $filename = MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php"; |
|
276 | 276 | $out = is_file($filename) ? include $filename : false; |
277 | 277 | } |
278 | 278 | if ($out && !in_array($extname, $this->extensions)) { |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | public function getMicroTime() |
290 | 290 | { |
291 | 291 | list ($usec, $sec) = explode(' ', microtime()); |
292 | - return ((float)$usec + (float)$sec); |
|
292 | + return ((float) $usec + (float) $sec); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | /** |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | // append the redirect count string to the url |
314 | 314 | $currentNumberOfRedirects = isset ($_REQUEST['err']) ? $_REQUEST['err'] : 0; |
315 | 315 | if ($currentNumberOfRedirects > 3) { |
316 | - $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>' . $url . '</i></p>'); |
|
316 | + $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>'.$url.'</i></p>'); |
|
317 | 317 | } else { |
318 | 318 | $currentNumberOfRedirects += 1; |
319 | 319 | if (strpos($url, "?") > 0) { |
@@ -324,9 +324,9 @@ discard block |
||
324 | 324 | } |
325 | 325 | } |
326 | 326 | if ($type == 'REDIRECT_REFRESH') { |
327 | - $header = 'Refresh: 0;URL=' . $url; |
|
327 | + $header = 'Refresh: 0;URL='.$url; |
|
328 | 328 | } elseif ($type == 'REDIRECT_META') { |
329 | - $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=' . $url . '" />'; |
|
329 | + $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL='.$url.'" />'; |
|
330 | 330 | echo $header; |
331 | 331 | exit; |
332 | 332 | } elseif ($type == 'REDIRECT_HEADER' || empty ($type)) { |
@@ -334,10 +334,10 @@ discard block |
||
334 | 334 | global $base_url, $site_url; |
335 | 335 | if (substr($url, 0, strlen($base_url)) == $base_url) { |
336 | 336 | // append $site_url to make it work with Location: |
337 | - $url = $site_url . substr($url, strlen($base_url)); |
|
337 | + $url = $site_url.substr($url, strlen($base_url)); |
|
338 | 338 | } |
339 | 339 | if (strpos($url, "\n") === false) { |
340 | - $header = 'Location: ' . $url; |
|
340 | + $header = 'Location: '.$url; |
|
341 | 341 | } else { |
342 | 342 | $this->messageQuit('No newline allowed in redirect url.'); |
343 | 343 | } |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | header($responseCode); |
347 | 347 | } |
348 | 348 | |
349 | - if(!empty($header)) { |
|
349 | + if (!empty($header)) { |
|
350 | 350 | header($header); |
351 | 351 | } |
352 | 352 | |
@@ -451,8 +451,8 @@ discard block |
||
451 | 451 | |
452 | 452 | private function recoverySiteCache() |
453 | 453 | { |
454 | - $site_cache_dir = MODX_BASE_PATH . $this->getCacheFolder(); |
|
455 | - $site_cache_path = $site_cache_dir . 'siteCache.idx.php'; |
|
454 | + $site_cache_dir = MODX_BASE_PATH.$this->getCacheFolder(); |
|
455 | + $site_cache_path = $site_cache_dir.'siteCache.idx.php'; |
|
456 | 456 | |
457 | 457 | if (is_file($site_cache_path)) { |
458 | 458 | include($site_cache_path); |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | return; |
462 | 462 | } |
463 | 463 | |
464 | - include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php'); |
|
464 | + include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php'); |
|
465 | 465 | $cache = new synccache(); |
466 | 466 | $cache->setCachepath($site_cache_dir); |
467 | 467 | $cache->setReport(false); |
@@ -513,8 +513,8 @@ discard block |
||
513 | 513 | $this->invokeEvent("OnBeforeManagerPageInit"); |
514 | 514 | } |
515 | 515 | |
516 | - if (isset ($_SESSION[$usrType . 'UsrConfigSet'])) { |
|
517 | - $usrSettings = &$_SESSION[$usrType . 'UsrConfigSet']; |
|
516 | + if (isset ($_SESSION[$usrType.'UsrConfigSet'])) { |
|
517 | + $usrSettings = &$_SESSION[$usrType.'UsrConfigSet']; |
|
518 | 518 | } else { |
519 | 519 | if ($usrType == 'web') { |
520 | 520 | $from = $tbl_web_user_settings; |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | $usrSettings[$row['setting_name']] = $row['setting_value']; |
535 | 535 | } |
536 | 536 | if (isset ($usrType)) { |
537 | - $_SESSION[$usrType . 'UsrConfigSet'] = $usrSettings; |
|
537 | + $_SESSION[$usrType.'UsrConfigSet'] = $usrSettings; |
|
538 | 538 | } // store user settings in session |
539 | 539 | } |
540 | 540 | } |
@@ -679,10 +679,10 @@ discard block |
||
679 | 679 | $suf = $this->config['friendly_url_suffix']; |
680 | 680 | $pre = preg_quote($pre, '/'); |
681 | 681 | $suf = preg_quote($suf, '/'); |
682 | - if ($pre && preg_match('@^' . $pre . '(.*)$@', $q, $_)) { |
|
682 | + if ($pre && preg_match('@^'.$pre.'(.*)$@', $q, $_)) { |
|
683 | 683 | $q = $_[1]; |
684 | 684 | } |
685 | - if ($suf && preg_match('@(.*)' . $suf . '$@', $q, $_)) { |
|
685 | + if ($suf && preg_match('@(.*)'.$suf.'$@', $q, $_)) { |
|
686 | 686 | $q = $_[1]; |
687 | 687 | } |
688 | 688 | |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | 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 */ |
705 | 705 | /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */ |
706 | 706 | if ($this->config['use_alias_path'] == 1) { |
707 | - 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))))) { |
|
707 | + 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))))) { |
|
708 | 708 | $this->documentMethod = 'id'; |
709 | 709 | return $q; |
710 | 710 | } else { /* not a valid id in terms of virtualDir, treat as alias */ |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | */ |
739 | 739 | public function getHashFile($key) |
740 | 740 | { |
741 | - return $this->getCacheFolder() . "docid_" . $key . ".pageCache.php"; |
|
741 | + return $this->getCacheFolder()."docid_".$key.".pageCache.php"; |
|
742 | 742 | } |
743 | 743 | |
744 | 744 | /** |
@@ -749,9 +749,9 @@ discard block |
||
749 | 749 | $hash = $id; |
750 | 750 | $tmp = null; |
751 | 751 | $params = array(); |
752 | - if(!empty($this->systemCacheKey)){ |
|
752 | + if (!empty($this->systemCacheKey)) { |
|
753 | 753 | $hash = $this->systemCacheKey; |
754 | - }else { |
|
754 | + } else { |
|
755 | 755 | if (!empty($_GET)) { |
756 | 756 | // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID. |
757 | 757 | $params = $_GET; |
@@ -759,8 +759,8 @@ discard block |
||
759 | 759 | $hash .= '_'.md5(http_build_query($params)); |
760 | 760 | } |
761 | 761 | } |
762 | - $evtOut = $this->invokeEvent("OnMakePageCacheKey", array ("hash" => $hash, "id" => $id, 'params' => $params)); |
|
763 | - if (is_array($evtOut) && count($evtOut) > 0){ |
|
762 | + $evtOut = $this->invokeEvent("OnMakePageCacheKey", array("hash" => $hash, "id" => $id, 'params' => $params)); |
|
763 | + if (is_array($evtOut) && count($evtOut) > 0) { |
|
764 | 764 | $tmp = array_pop($evtOut); |
765 | 765 | } |
766 | 766 | return empty($tmp) ? $hash : $tmp; |
@@ -902,12 +902,12 @@ discard block |
||
902 | 902 | if ($js = $this->getRegisteredClientStartupScripts()) { |
903 | 903 | // change to just before closing </head> |
904 | 904 | // $this->documentContent = preg_replace("/(<head[^>]*>)/i", "\\1\n".$js, $this->documentContent); |
905 | - $this->documentOutput = preg_replace("/(<\/head>)/i", $js . "\n\\1", $this->documentOutput); |
|
905 | + $this->documentOutput = preg_replace("/(<\/head>)/i", $js."\n\\1", $this->documentOutput); |
|
906 | 906 | } |
907 | 907 | |
908 | 908 | // Insert jscripts & html block into template - template must have a </body> tag |
909 | 909 | if ($js = $this->getRegisteredClientScripts()) { |
910 | - $this->documentOutput = preg_replace("/(<\/body>)/i", $js . "\n\\1", $this->documentOutput); |
|
910 | + $this->documentOutput = preg_replace("/(<\/body>)/i", $js."\n\\1", $this->documentOutput); |
|
911 | 911 | } |
912 | 912 | // End fix by sirlancelot |
913 | 913 | |
@@ -918,7 +918,7 @@ discard block |
||
918 | 918 | // send out content-type and content-disposition headers |
919 | 919 | if (IN_PARSER_MODE == "true") { |
920 | 920 | $type = !empty ($this->contentTypes[$this->documentIdentifier]) ? $this->contentTypes[$this->documentIdentifier] : "text/html"; |
921 | - header('Content-Type: ' . $type . '; charset=' . $this->config['modx_charset']); |
|
921 | + header('Content-Type: '.$type.'; charset='.$this->config['modx_charset']); |
|
922 | 922 | // if (($this->documentIdentifier == $this->config['error_page']) || $redirect_error) |
923 | 923 | // header('HTTP/1.0 404 Not Found'); |
924 | 924 | if (!$this->checkPreview() && $this->documentObject['content_dispo'] == 1) { |
@@ -936,7 +936,7 @@ discard block |
||
936 | 936 | $name = preg_replace('|-+|', '-', $name); |
937 | 937 | $name = trim($name, '-'); |
938 | 938 | } |
939 | - $header = 'Content-Disposition: attachment; filename=' . $name; |
|
939 | + $header = 'Content-Disposition: attachment; filename='.$name; |
|
940 | 940 | header($header); |
941 | 941 | } |
942 | 942 | } |
@@ -944,7 +944,7 @@ discard block |
||
944 | 944 | |
945 | 945 | $stats = $this->getTimerStats($this->tstart); |
946 | 946 | |
947 | - $out =& $this->documentOutput; |
|
947 | + $out = & $this->documentOutput; |
|
948 | 948 | $out = str_replace("[^q^]", $stats['queries'], $out); |
949 | 949 | $out = str_replace("[^qt^]", $stats['queryTime'], $out); |
950 | 950 | $out = str_replace("[^p^]", $stats['phpTime'], $out); |
@@ -983,17 +983,17 @@ discard block |
||
983 | 983 | $sc .= sprintf("%s. %s (%s)<br>", $s, $sname, sprintf("%2.2f ms", $t)); // currentSnippet |
984 | 984 | $tt += $t; |
985 | 985 | } |
986 | - echo "<fieldset><legend><b>Snippets</b> (" . count($this->snippetsTime) . " / " . sprintf("%2.2f ms", $tt) . ")</legend>{$sc}</fieldset><br />"; |
|
986 | + echo "<fieldset><legend><b>Snippets</b> (".count($this->snippetsTime)." / ".sprintf("%2.2f ms", $tt).")</legend>{$sc}</fieldset><br />"; |
|
987 | 987 | echo $this->snippetsCode; |
988 | 988 | } |
989 | 989 | if ($this->dumpPlugins) { |
990 | 990 | $ps = ""; |
991 | 991 | $tt = 0; |
992 | 992 | foreach ($this->pluginsTime as $s => $t) { |
993 | - $ps .= "$s (" . sprintf("%2.2f ms", $t * 1000) . ")<br>"; |
|
993 | + $ps .= "$s (".sprintf("%2.2f ms", $t * 1000).")<br>"; |
|
994 | 994 | $tt += $t; |
995 | 995 | } |
996 | - echo "<fieldset><legend><b>Plugins</b> (" . count($this->pluginsTime) . " / " . sprintf("%2.2f ms", $tt * 1000) . ")</legend>{$ps}</fieldset><br />"; |
|
996 | + echo "<fieldset><legend><b>Plugins</b> (".count($this->pluginsTime)." / ".sprintf("%2.2f ms", $tt * 1000).")</legend>{$ps}</fieldset><br />"; |
|
997 | 997 | echo $this->pluginsCode; |
998 | 998 | } |
999 | 999 | |
@@ -1019,7 +1019,7 @@ discard block |
||
1019 | 1019 | $srcTags = explode(',', $tags); |
1020 | 1020 | $repTags = array(); |
1021 | 1021 | foreach ($srcTags as $tag) { |
1022 | - $repTags[] = '\\' . $tag[0] . '\\' . $tag[1]; |
|
1022 | + $repTags[] = '\\'.$tag[0].'\\'.$tag[1]; |
|
1023 | 1023 | } |
1024 | 1024 | return array($srcTags, $repTags); |
1025 | 1025 | } |
@@ -1041,7 +1041,7 @@ discard block |
||
1041 | 1041 | $stats['phpTime'] = sprintf("%2.4f s", $stats['phpTime']); |
1042 | 1042 | $stats['source'] = $this->documentGenerated == 1 ? "database" : "cache"; |
1043 | 1043 | $stats['queries'] = isset ($this->executedQueries) ? $this->executedQueries : 0; |
1044 | - $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024) . " mb"; |
|
1044 | + $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024)." mb"; |
|
1045 | 1045 | |
1046 | 1046 | return $stats; |
1047 | 1047 | } |
@@ -1074,7 +1074,7 @@ discard block |
||
1074 | 1074 | { |
1075 | 1075 | $cacheRefreshTime = 0; |
1076 | 1076 | $recent_update = 0; |
1077 | - @include(MODX_BASE_PATH . $this->getCacheFolder() . 'sitePublishing.idx.php'); |
|
1077 | + @include(MODX_BASE_PATH.$this->getCacheFolder().'sitePublishing.idx.php'); |
|
1078 | 1078 | $this->recentUpdate = $recent_update; |
1079 | 1079 | |
1080 | 1080 | $timeNow = $_SERVER['REQUEST_TIME'] + $this->config['server_offset_time']; |
@@ -1128,8 +1128,8 @@ discard block |
||
1128 | 1128 | } |
1129 | 1129 | |
1130 | 1130 | $docObjSerial = serialize($this->documentObject); |
1131 | - $cacheContent = $docObjSerial . "<!--__MODxCacheSpliter__-->" . $this->documentContent; |
|
1132 | - $page_cache_path = MODX_BASE_PATH . $this->getHashFile($this->cacheKey); |
|
1131 | + $cacheContent = $docObjSerial."<!--__MODxCacheSpliter__-->".$this->documentContent; |
|
1132 | + $page_cache_path = MODX_BASE_PATH.$this->getHashFile($this->cacheKey); |
|
1133 | 1133 | file_put_contents($page_cache_path, "<?php die('Unauthorized access.'); ?>$cacheContent"); |
1134 | 1134 | } |
1135 | 1135 | } |
@@ -1171,16 +1171,16 @@ discard block |
||
1171 | 1171 | return array(); |
1172 | 1172 | } |
1173 | 1173 | $spacer = md5('<<<EVO>>>'); |
1174 | - if($left==='{{' && strpos($content,';}}')!==false) $content = str_replace(';}}', sprintf(';}%s}', $spacer),$content); |
|
1175 | - if($left==='{{' && strpos($content,'{{}}')!==false) $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content); |
|
1176 | - if($left==='[[' && strpos($content,']]]]')!==false) $content = str_replace(']]]]',sprintf(']]%s]]', $spacer),$content); |
|
1177 | - if($left==='[[' && strpos($content,']]]')!==false) $content = str_replace(']]]', sprintf(']%s]]', $spacer),$content); |
|
1174 | + if ($left === '{{' && strpos($content, ';}}') !== false) $content = str_replace(';}}', sprintf(';}%s}', $spacer), $content); |
|
1175 | + if ($left === '{{' && strpos($content, '{{}}') !== false) $content = str_replace('{{}}', sprintf('{%$1s{}%$1s}', $spacer), $content); |
|
1176 | + if ($left === '[[' && strpos($content, ']]]]') !== false) $content = str_replace(']]]]', sprintf(']]%s]]', $spacer), $content); |
|
1177 | + if ($left === '[[' && strpos($content, ']]]') !== false) $content = str_replace(']]]', sprintf(']%s]]', $spacer), $content); |
|
1178 | 1178 | |
1179 | 1179 | $pos['<![CDATA['] = strpos($content, '<![CDATA['); |
1180 | 1180 | $pos[']]>'] = strpos($content, ']]>'); |
1181 | 1181 | |
1182 | 1182 | if ($pos['<![CDATA['] !== false && $pos[']]>'] !== false) { |
1183 | - $content = substr($content, 0, $pos['<![CDATA[']) . substr($content, $pos[']]>'] + 3); |
|
1183 | + $content = substr($content, 0, $pos['<![CDATA[']).substr($content, $pos[']]>'] + 3); |
|
1184 | 1184 | } |
1185 | 1185 | |
1186 | 1186 | $lp = explode($left, $content); |
@@ -1244,8 +1244,8 @@ discard block |
||
1244 | 1244 | } |
1245 | 1245 | } |
1246 | 1246 | } |
1247 | - foreach($tags as $i=>$tag) { |
|
1248 | - if(strpos($tag,$spacer)!==false) $tags[$i] = str_replace($spacer, '', $tag); |
|
1247 | + foreach ($tags as $i=>$tag) { |
|
1248 | + if (strpos($tag, $spacer) !== false) $tags[$i] = str_replace($spacer, '', $tag); |
|
1249 | 1249 | } |
1250 | 1250 | return $tags; |
1251 | 1251 | } |
@@ -1285,7 +1285,7 @@ discard block |
||
1285 | 1285 | } |
1286 | 1286 | |
1287 | 1287 | foreach ($matches[1] as $i => $key) { |
1288 | - if(strpos($key,'[+')!==false) continue; // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
1288 | + if (strpos($key, '[+') !== false) continue; // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
1289 | 1289 | if (substr($key, 0, 1) == '#') { |
1290 | 1290 | $key = substr($key, 1); |
1291 | 1291 | } // remove # for QuickEdit format |
@@ -1305,8 +1305,8 @@ discard block |
||
1305 | 1305 | } |
1306 | 1306 | |
1307 | 1307 | if (is_array($value)) { |
1308 | - include_once(MODX_MANAGER_PATH . 'includes/tmplvars.format.inc.php'); |
|
1309 | - include_once(MODX_MANAGER_PATH . 'includes/tmplvars.commands.inc.php'); |
|
1308 | + include_once(MODX_MANAGER_PATH.'includes/tmplvars.format.inc.php'); |
|
1309 | + include_once(MODX_MANAGER_PATH.'includes/tmplvars.commands.inc.php'); |
|
1310 | 1310 | $value = getTVDisplayFormat($value[0], $value[1], $value[2], $value[3], $value[4]); |
1311 | 1311 | } |
1312 | 1312 | |
@@ -1317,8 +1317,8 @@ discard block |
||
1317 | 1317 | |
1318 | 1318 | if (strpos($content, $s) !== false) { |
1319 | 1319 | $content = str_replace($s, $value, $content); |
1320 | - } elseif($this->debug) { |
|
1321 | - $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1320 | + } elseif ($this->debug) { |
|
1321 | + $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1322 | 1322 | } |
1323 | 1323 | } |
1324 | 1324 | |
@@ -1485,8 +1485,8 @@ discard block |
||
1485 | 1485 | $s = &$matches[0][$i]; |
1486 | 1486 | if (strpos($content, $s) !== false) { |
1487 | 1487 | $content = str_replace($s, $value, $content); |
1488 | - } elseif($this->debug) { |
|
1489 | - $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1488 | + } elseif ($this->debug) { |
|
1489 | + $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1490 | 1490 | } |
1491 | 1491 | } |
1492 | 1492 | return $content; |
@@ -1539,7 +1539,7 @@ discard block |
||
1539 | 1539 | } |
1540 | 1540 | |
1541 | 1541 | $value = $this->parseText($value, $params); // parse local scope placeholers for ConditionalTags |
1542 | - $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers |
|
1542 | + $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers |
|
1543 | 1543 | if ($this->config['enable_at_syntax']) { |
1544 | 1544 | $value = $this->mergeConditionalTagsContent($value); |
1545 | 1545 | } |
@@ -1554,8 +1554,8 @@ discard block |
||
1554 | 1554 | $s = &$matches[0][$i]; |
1555 | 1555 | if (strpos($content, $s) !== false) { |
1556 | 1556 | $content = str_replace($s, $value, $content); |
1557 | - } elseif($this->debug) { |
|
1558 | - $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1557 | + } elseif ($this->debug) { |
|
1558 | + $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1559 | 1559 | } |
1560 | 1560 | } |
1561 | 1561 | return $content; |
@@ -1613,8 +1613,8 @@ discard block |
||
1613 | 1613 | $s = &$matches[0][$i]; |
1614 | 1614 | if (strpos($content, $s) !== false) { |
1615 | 1615 | $content = str_replace($s, $value, $content); |
1616 | - } elseif($this->debug) { |
|
1617 | - $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1616 | + } elseif ($this->debug) { |
|
1617 | + $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1618 | 1618 | } |
1619 | 1619 | } |
1620 | 1620 | return $content; |
@@ -1638,7 +1638,7 @@ discard block |
||
1638 | 1638 | return $content; |
1639 | 1639 | } |
1640 | 1640 | |
1641 | - $sp = '#' . md5('ConditionalTags' . $_SERVER['REQUEST_TIME']) . '#'; |
|
1641 | + $sp = '#'.md5('ConditionalTags'.$_SERVER['REQUEST_TIME']).'#'; |
|
1642 | 1642 | $content = str_replace(array('<?php', '<?=', '<?', '?>'), array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), $content); |
1643 | 1643 | |
1644 | 1644 | $pieces = explode('<@IF:', $content); |
@@ -1649,7 +1649,7 @@ discard block |
||
1649 | 1649 | } |
1650 | 1650 | list($cmd, $text) = explode('>', $split, 2); |
1651 | 1651 | $cmd = str_replace("'", "\'", $cmd); |
1652 | - $content .= "<?php if(\$this->_parseCTagCMD('" . $cmd . "')): ?>"; |
|
1652 | + $content .= "<?php if(\$this->_parseCTagCMD('".$cmd."')): ?>"; |
|
1653 | 1653 | $content .= $text; |
1654 | 1654 | } |
1655 | 1655 | $pieces = explode('<@ELSEIF:', $content); |
@@ -1660,13 +1660,13 @@ discard block |
||
1660 | 1660 | } |
1661 | 1661 | list($cmd, $text) = explode('>', $split, 2); |
1662 | 1662 | $cmd = str_replace("'", "\'", $cmd); |
1663 | - $content .= "<?php elseif(\$this->_parseCTagCMD('" . $cmd . "')): ?>"; |
|
1663 | + $content .= "<?php elseif(\$this->_parseCTagCMD('".$cmd."')): ?>"; |
|
1664 | 1664 | $content .= $text; |
1665 | 1665 | } |
1666 | 1666 | |
1667 | 1667 | $content = str_replace(array('<@ELSE>', '<@ENDIF>'), array('<?php else:?>', '<?php endif;?>'), $content); |
1668 | 1668 | ob_start(); |
1669 | - $content = eval('?>' . $content); |
|
1669 | + $content = eval('?>'.$content); |
|
1670 | 1670 | $content = ob_get_clean(); |
1671 | 1671 | $content = str_replace(array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), array('<?php', '<?=', '<?', '?>'), $content); |
1672 | 1672 | |
@@ -1791,7 +1791,7 @@ discard block |
||
1791 | 1791 | $matches = $this->getTagsFromContent($content, $left, $right); |
1792 | 1792 | if (!empty($matches)) { |
1793 | 1793 | foreach ($matches[0] as $i => $v) { |
1794 | - $addBreakMatches[$i] = $v . "\n"; |
|
1794 | + $addBreakMatches[$i] = $v."\n"; |
|
1795 | 1795 | } |
1796 | 1796 | $content = str_replace($addBreakMatches, '', $content); |
1797 | 1797 | if (strpos($content, $left) !== false) { |
@@ -1824,8 +1824,8 @@ discard block |
||
1824 | 1824 | $s = &$matches[0][$i]; |
1825 | 1825 | if (strpos($content, $s) !== false) { |
1826 | 1826 | $content = str_replace($s, $v, $content); |
1827 | - } elseif($this->debug) { |
|
1828 | - $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1827 | + } elseif ($this->debug) { |
|
1828 | + $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1829 | 1829 | } |
1830 | 1830 | } |
1831 | 1831 | return $content; |
@@ -1889,7 +1889,7 @@ discard block |
||
1889 | 1889 | $msg = ($msg === false) ? 'ob_get_contents() error' : $msg; |
1890 | 1890 | $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Plugin', $error_info['message'], $error_info['line'], $msg); |
1891 | 1891 | if ($this->isBackend()) { |
1892 | - $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>' . $msg . '</p>'); |
|
1892 | + $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>'.$msg.'</p>'); |
|
1893 | 1893 | } |
1894 | 1894 | } |
1895 | 1895 | } else { |
@@ -1935,7 +1935,7 @@ discard block |
||
1935 | 1935 | $echo = ($echo === false) ? 'ob_get_contents() error' : $echo; |
1936 | 1936 | $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Snippet', $error_info['message'], $error_info['line'], $echo); |
1937 | 1937 | if ($this->isBackend()) { |
1938 | - $this->event->alert('An error occurred while loading. Please see the event log for more information<p>' . $echo . $return . '</p>'); |
|
1938 | + $this->event->alert('An error occurred while loading. Please see the event log for more information<p>'.$echo.$return.'</p>'); |
|
1939 | 1939 | } |
1940 | 1940 | } |
1941 | 1941 | } |
@@ -1943,7 +1943,7 @@ discard block |
||
1943 | 1943 | if (is_array($return) || is_object($return)) { |
1944 | 1944 | return $return; |
1945 | 1945 | } else { |
1946 | - return $echo . $return; |
|
1946 | + return $echo.$return; |
|
1947 | 1947 | } |
1948 | 1948 | } |
1949 | 1949 | |
@@ -1981,8 +1981,8 @@ discard block |
||
1981 | 1981 | } |
1982 | 1982 | if (strpos($content, $s) !== false) { |
1983 | 1983 | $content = str_replace($s, $value, $content); |
1984 | - } elseif($this->debug) { |
|
1985 | - $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1984 | + } elseif ($this->debug) { |
|
1985 | + $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1986 | 1986 | } |
1987 | 1987 | continue; |
1988 | 1988 | } |
@@ -1993,8 +1993,8 @@ discard block |
||
1993 | 1993 | |
1994 | 1994 | if (strpos($content, $s) !== false) { |
1995 | 1995 | $content = str_replace($s, $value, $content); |
1996 | - } elseif($this->debug) { |
|
1997 | - $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1996 | + } elseif ($this->debug) { |
|
1997 | + $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1998 | 1998 | } |
1999 | 1999 | } |
2000 | 2000 | |
@@ -2085,7 +2085,7 @@ discard block |
||
2085 | 2085 | $eventtime = sprintf('%2.2f ms', $eventtime * 1000); |
2086 | 2086 | $code = str_replace("\t", ' ', $this->htmlspecialchars($value)); |
2087 | 2087 | $piece = str_replace("\t", ' ', $this->htmlspecialchars($piece)); |
2088 | - $print_r_params = str_replace("\t", ' ', $this->htmlspecialchars('$modx->event->params = ' . print_r($params, true))); |
|
2088 | + $print_r_params = str_replace("\t", ' ', $this->htmlspecialchars('$modx->event->params = '.print_r($params, true))); |
|
2089 | 2089 | $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); |
2090 | 2090 | $this->snippetsTime[] = array('sname' => $key, 'time' => $eventtime); |
2091 | 2091 | } |
@@ -2329,7 +2329,7 @@ discard block |
||
2329 | 2329 | $rs = $this->db->select('name,snippet,properties', '[+prefix+]site_snippets', $where); |
2330 | 2330 | $count = $this->db->getRecordCount($rs); |
2331 | 2331 | if (1 < $count) { |
2332 | - exit('Error $modx->_getSnippetObject()' . $snip_name); |
|
2332 | + exit('Error $modx->_getSnippetObject()'.$snip_name); |
|
2333 | 2333 | } |
2334 | 2334 | if ($count) { |
2335 | 2335 | $row = $this->db->getRow($rs); |
@@ -2355,7 +2355,7 @@ discard block |
||
2355 | 2355 | public function toAlias($text) |
2356 | 2356 | { |
2357 | 2357 | $suff = $this->config['friendly_url_suffix']; |
2358 | - 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); |
|
2358 | + 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); |
|
2359 | 2359 | } |
2360 | 2360 | |
2361 | 2361 | /** |
@@ -2387,7 +2387,7 @@ discard block |
||
2387 | 2387 | $suff = '/'; |
2388 | 2388 | } |
2389 | 2389 | |
2390 | - $url = ($dir != '' ? $dir . '/' : '') . $pre . $alias . $suff; |
|
2390 | + $url = ($dir != '' ? $dir.'/' : '').$pre.$alias.$suff; |
|
2391 | 2391 | } |
2392 | 2392 | |
2393 | 2393 | $evtOut = $this->invokeEvent('OnMakeDocUrl', array( |
@@ -2424,7 +2424,7 @@ discard block |
||
2424 | 2424 | preg_match_all('!\[\~([0-9]+)\~\]!ise', $documentSource, $match); |
2425 | 2425 | $ids = implode(',', array_unique($match['1'])); |
2426 | 2426 | if ($ids) { |
2427 | - $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (" . $ids . ") AND isfolder = '0'"); |
|
2427 | + $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (".$ids.") AND isfolder = '0'"); |
|
2428 | 2428 | while ($row = $this->db->getRow($res)) { |
2429 | 2429 | if ($this->config['use_alias_path'] == '1' && $row['parent'] != 0) { |
2430 | 2430 | $parent = $row['parent']; |
@@ -2435,7 +2435,7 @@ discard block |
||
2435 | 2435 | $parent = $this->aliasListing[$parent]['parent']; |
2436 | 2436 | } |
2437 | 2437 | |
2438 | - $aliases[$row['id']] = $path . '/' . $row['alias']; |
|
2438 | + $aliases[$row['id']] = $path.'/'.$row['alias']; |
|
2439 | 2439 | } else { |
2440 | 2440 | $aliases[$row['id']] = $row['alias']; |
2441 | 2441 | } |
@@ -2447,7 +2447,7 @@ discard block |
||
2447 | 2447 | $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0); |
2448 | 2448 | $pref = $this->config['friendly_url_prefix']; |
2449 | 2449 | $suff = $this->config['friendly_url_suffix']; |
2450 | - $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
2450 | + $documentSource = preg_replace_callback($in, function($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
2451 | 2451 | global $modx; |
2452 | 2452 | $thealias = $aliases[$m[1]]; |
2453 | 2453 | $thefolder = $isfolder[$m[1]]; |
@@ -2463,7 +2463,7 @@ discard block |
||
2463 | 2463 | |
2464 | 2464 | } else { |
2465 | 2465 | $in = '!\[\~([0-9]+)\~\]!is'; |
2466 | - $out = "index.php?id=" . '\1'; |
|
2466 | + $out = "index.php?id=".'\1'; |
|
2467 | 2467 | $documentSource = preg_replace($in, $out, $documentSource); |
2468 | 2468 | } |
2469 | 2469 | |
@@ -2484,7 +2484,7 @@ discard block |
||
2484 | 2484 | $scheme = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http'; |
2485 | 2485 | $len_base_url = strlen($this->config['base_url']); |
2486 | 2486 | |
2487 | - $url_path = $q;//LANG |
|
2487 | + $url_path = $q; //LANG |
|
2488 | 2488 | |
2489 | 2489 | if (substr($url_path, 0, $len_base_url) === $this->config['base_url']) { |
2490 | 2490 | $url_path = substr($url_path, $len_base_url); |
@@ -2496,7 +2496,7 @@ discard block |
||
2496 | 2496 | $strictURL = substr($strictURL, $len_base_url); |
2497 | 2497 | } |
2498 | 2498 | $http_host = $_SERVER['HTTP_HOST']; |
2499 | - $requestedURL = "{$scheme}://{$http_host}" . '/' . $q; //LANG |
|
2499 | + $requestedURL = "{$scheme}://{$http_host}".'/'.$q; //LANG |
|
2500 | 2500 | |
2501 | 2501 | $site_url = $this->config['site_url']; |
2502 | 2502 | $url_query_string = explode('?', $_SERVER['REQUEST_URI'])[1]; |
@@ -2513,7 +2513,7 @@ discard block |
||
2513 | 2513 | } |
2514 | 2514 | if ($this->config['base_url'] != $_SERVER['REQUEST_URI']) { |
2515 | 2515 | if (empty($_POST)) { |
2516 | - if (($this->config['base_url'] . '?' . $qstring) != $_SERVER['REQUEST_URI']) { |
|
2516 | + if (($this->config['base_url'].'?'.$qstring) != $_SERVER['REQUEST_URI']) { |
|
2517 | 2517 | $this->sendRedirect($url, 0, 'REDIRECT_HEADER', 'HTTP/1.0 301 Moved Permanently'); |
2518 | 2518 | exit(0); |
2519 | 2519 | } |
@@ -2576,7 +2576,7 @@ discard block |
||
2576 | 2576 | $docgrp = implode(",", $docgrp); |
2577 | 2577 | } |
2578 | 2578 | // get document |
2579 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
2579 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
2580 | 2580 | $rs = $this->db->select('sc.*', "{$tblsc} sc |
2581 | 2581 | LEFT JOIN {$tbldg} dg ON dg.document = sc.id", "sc.{$method} = '{$identifier}' AND ({$access})", "", 1); |
2582 | 2582 | if ($this->db->getRecordCount($rs) < 1) { |
@@ -2612,9 +2612,9 @@ discard block |
||
2612 | 2612 | } |
2613 | 2613 | if ($documentObject['template']) { |
2614 | 2614 | // load TVs and merge with document - Orig by Apodigm - Docvars |
2615 | - $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars") . " tv |
|
2616 | - INNER JOIN " . $this->getFullTableName("site_tmplvar_templates") . " tvtpl ON tvtpl.tmplvarid = tv.id |
|
2617 | - LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues") . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'"); |
|
2615 | + $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars")." tv |
|
2616 | + INNER JOIN " . $this->getFullTableName("site_tmplvar_templates")." tvtpl ON tvtpl.tmplvarid = tv.id |
|
2617 | + LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues")." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'"); |
|
2618 | 2618 | $tmplvars = array(); |
2619 | 2619 | while ($row = $this->db->getRow($rs)) { |
2620 | 2620 | $tmplvars[$row['name']] = array( |
@@ -2660,7 +2660,7 @@ discard block |
||
2660 | 2660 | $st = md5($source); |
2661 | 2661 | } |
2662 | 2662 | if ($this->dumpSnippets == 1) { |
2663 | - $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>"; |
|
2663 | + $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>"; |
|
2664 | 2664 | } |
2665 | 2665 | |
2666 | 2666 | // invoke OnParseDocument event |
@@ -2702,7 +2702,7 @@ discard block |
||
2702 | 2702 | */ |
2703 | 2703 | public function executeParser() |
2704 | 2704 | { |
2705 | - if(MODX_CLI) { |
|
2705 | + if (MODX_CLI) { |
|
2706 | 2706 | throw new RuntimeException('Call DocumentParser::executeParser on CLI mode'); |
2707 | 2707 | } |
2708 | 2708 | |
@@ -2748,7 +2748,7 @@ discard block |
||
2748 | 2748 | |
2749 | 2749 | // Check use_alias_path and check if $this->virtualDir is set to anything, then parse the path |
2750 | 2750 | if ($this->config['use_alias_path'] == 1) { |
2751 | - $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir . '/' : '') . $this->documentIdentifier; |
|
2751 | + $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir.'/' : '').$this->documentIdentifier; |
|
2752 | 2752 | if (isset($this->documentListing[$alias])) { |
2753 | 2753 | $this->documentIdentifier = $this->documentListing[$alias]; |
2754 | 2754 | } else { |
@@ -2809,7 +2809,7 @@ discard block |
||
2809 | 2809 | } else { |
2810 | 2810 | $docAlias = $this->db->escape($this->documentIdentifier); |
2811 | 2811 | $rs = $this->db->select('id', $this->getFullTableName('site_content'), "deleted=0 and alias='{$docAlias}'"); |
2812 | - $this->documentIdentifier = (int)$this->db->getValue($rs); |
|
2812 | + $this->documentIdentifier = (int) $this->db->getValue($rs); |
|
2813 | 2813 | } |
2814 | 2814 | } |
2815 | 2815 | $this->documentMethod = 'id'; |
@@ -2866,7 +2866,7 @@ discard block |
||
2866 | 2866 | $_REQUEST[$n] = $_GET[$n] = $v; |
2867 | 2867 | } |
2868 | 2868 | } |
2869 | - $_SERVER['PHP_SELF'] = $this->config['base_url'] . $qp['path']; |
|
2869 | + $_SERVER['PHP_SELF'] = $this->config['base_url'].$qp['path']; |
|
2870 | 2870 | $this->q = $qp['path']; |
2871 | 2871 | return $qp['path']; |
2872 | 2872 | } |
@@ -2960,7 +2960,7 @@ discard block |
||
2960 | 2960 | $this->sendErrorPage(); |
2961 | 2961 | } else { |
2962 | 2962 | // Inculde the necessary files to check document permissions |
2963 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
2963 | + include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php'); |
|
2964 | 2964 | $udperms = new udperms(); |
2965 | 2965 | $udperms->user = $this->getLoginUserID(); |
2966 | 2966 | $udperms->document = $this->documentIdentifier; |
@@ -3014,7 +3014,7 @@ discard block |
||
3014 | 3014 | while ($id && $height--) { |
3015 | 3015 | $thisid = $id; |
3016 | 3016 | if ($this->config['aliaslistingfolder'] == 1) { |
3017 | - $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"); |
|
3017 | + $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"); |
|
3018 | 3018 | if (!$id || $id == '0') { |
3019 | 3019 | break; |
3020 | 3020 | } |
@@ -3065,15 +3065,15 @@ discard block |
||
3065 | 3065 | |
3066 | 3066 | if ($this->config['aliaslistingfolder'] == 1) { |
3067 | 3067 | |
3068 | - $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (" . $id . ") AND deleted = '0'"); |
|
3068 | + $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (".$id.") AND deleted = '0'"); |
|
3069 | 3069 | $idx = array(); |
3070 | 3070 | while ($row = $this->db->getRow($res)) { |
3071 | 3071 | $pAlias = ''; |
3072 | 3072 | if (isset($this->aliasListing[$row['parent']])) { |
3073 | - $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'] . '/' : ''; |
|
3074 | - $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'] . '/' : ''; |
|
3073 | + $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'].'/' : ''; |
|
3074 | + $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'].'/' : ''; |
|
3075 | 3075 | }; |
3076 | - $children[$pAlias . $row['alias']] = $row['id']; |
|
3076 | + $children[$pAlias.$row['alias']] = $row['id']; |
|
3077 | 3077 | if ($row['isfolder'] == 1) { |
3078 | 3078 | $idx[] = $row['id']; |
3079 | 3079 | } |
@@ -3105,7 +3105,7 @@ discard block |
||
3105 | 3105 | $depth--; |
3106 | 3106 | |
3107 | 3107 | foreach ($documentMap_cache[$id] as $childId) { |
3108 | - $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '') . $this->aliasListing[$childId]['alias']; |
|
3108 | + $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '').$this->aliasListing[$childId]['alias']; |
|
3109 | 3109 | if (!strlen($pkey)) { |
3110 | 3110 | $pkey = "{$childId}"; |
3111 | 3111 | } |
@@ -3134,7 +3134,7 @@ discard block |
||
3134 | 3134 | if (substr(strtolower($url), 0, 11) == "javascript:") { |
3135 | 3135 | $fnc = substr($url, 11); |
3136 | 3136 | } elseif ($url) { |
3137 | - $fnc = "window.location.href='" . addslashes($url) . "';"; |
|
3137 | + $fnc = "window.location.href='".addslashes($url)."';"; |
|
3138 | 3138 | } else { |
3139 | 3139 | $fnc = "history.back(-1);"; |
3140 | 3140 | } |
@@ -3143,7 +3143,7 @@ discard block |
||
3143 | 3143 | <meta http-equiv=\"Content-Type\" content=\"text/html; charset={$modx_manager_charset};\"> |
3144 | 3144 | <script> |
3145 | 3145 | function __alertQuit() { |
3146 | - alert('" . addslashes($msg) . "'); |
|
3146 | + alert('".addslashes($msg)."'); |
|
3147 | 3147 | {$fnc} |
3148 | 3148 | } |
3149 | 3149 | window.setTimeout('__alertQuit();',100); |
@@ -3165,9 +3165,9 @@ discard block |
||
3165 | 3165 | $state = 0; |
3166 | 3166 | $pms = $_SESSION['mgrPermissions']; |
3167 | 3167 | if ($pms) { |
3168 | - $state = ((bool)$pms[$pm] === true); |
|
3168 | + $state = ((bool) $pms[$pm] === true); |
|
3169 | 3169 | } |
3170 | - return (int)$state; |
|
3170 | + return (int) $state; |
|
3171 | 3171 | } |
3172 | 3172 | |
3173 | 3173 | /** |
@@ -3180,8 +3180,8 @@ discard block |
||
3180 | 3180 | */ |
3181 | 3181 | public function elementIsLocked($type, $id, $includeThisUser = false) |
3182 | 3182 | { |
3183 | - $id = (int)$id; |
|
3184 | - $type = (int)$type; |
|
3183 | + $id = (int) $id; |
|
3184 | + $type = (int) $type; |
|
3185 | 3185 | if (!$type || !$id) { |
3186 | 3186 | return null; |
3187 | 3187 | } |
@@ -3231,7 +3231,7 @@ discard block |
||
3231 | 3231 | return $lockedElements; |
3232 | 3232 | } |
3233 | 3233 | |
3234 | - $type = (int)$type; |
|
3234 | + $type = (int) $type; |
|
3235 | 3235 | if (isset($lockedElements[$type])) { |
3236 | 3236 | return $lockedElements[$type]; |
3237 | 3237 | } else { |
@@ -3248,7 +3248,7 @@ discard block |
||
3248 | 3248 | $this->lockedElements = array(); |
3249 | 3249 | $this->cleanupExpiredLocks(); |
3250 | 3250 | |
3251 | - $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks') . " ul |
|
3251 | + $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks')." ul |
|
3252 | 3252 | LEFT JOIN {$this->getFullTableName('manager_users')} mu on ul.internalKey = mu.id"); |
3253 | 3253 | while ($row = $this->db->getRow($rs)) { |
3254 | 3254 | $this->lockedElements[$row['elementType']][$row['elementId']] = array( |
@@ -3271,7 +3271,7 @@ discard block |
||
3271 | 3271 | public function cleanupExpiredLocks() |
3272 | 3272 | { |
3273 | 3273 | // Clean-up active_user_sessions first |
3274 | - $timeout = (int)$this->config['session_timeout'] < 2 ? 120 : $this->config['session_timeout'] * 60; // session.js pings every 10min, updateMail() in mainMenu pings every minute, so 2min is minimum |
|
3274 | + $timeout = (int) $this->config['session_timeout'] < 2 ? 120 : $this->config['session_timeout'] * 60; // session.js pings every 10min, updateMail() in mainMenu pings every minute, so 2min is minimum |
|
3275 | 3275 | $validSessionTimeLimit = $this->time - $timeout; |
3276 | 3276 | $this->db->delete($this->getFullTableName('active_user_sessions'), "lasthit < {$validSessionTimeLimit}"); |
3277 | 3277 | |
@@ -3284,7 +3284,7 @@ discard block |
||
3284 | 3284 | foreach ($rs as $row) { |
3285 | 3285 | $userSids[] = $row['sid']; |
3286 | 3286 | } |
3287 | - $userSids = "'" . implode("','", $userSids) . "'"; |
|
3287 | + $userSids = "'".implode("','", $userSids)."'"; |
|
3288 | 3288 | $this->db->delete($this->getFullTableName('active_user_locks'), "sid NOT IN({$userSids})"); |
3289 | 3289 | } else { |
3290 | 3290 | $this->db->delete($this->getFullTableName('active_user_locks')); |
@@ -3368,8 +3368,8 @@ discard block |
||
3368 | 3368 | public function lockElement($type, $id) |
3369 | 3369 | { |
3370 | 3370 | $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0; |
3371 | - $type = (int)$type; |
|
3372 | - $id = (int)$id; |
|
3371 | + $type = (int) $type; |
|
3372 | + $id = (int) $id; |
|
3373 | 3373 | if (!$type || !$id || !$userId) { |
3374 | 3374 | return false; |
3375 | 3375 | } |
@@ -3390,8 +3390,8 @@ discard block |
||
3390 | 3390 | public function unlockElement($type, $id, $includeAllUsers = false) |
3391 | 3391 | { |
3392 | 3392 | $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0; |
3393 | - $type = (int)$type; |
|
3394 | - $id = (int)$id; |
|
3393 | + $type = (int) $type; |
|
3394 | + $id = (int) $id; |
|
3395 | 3395 | if (!$type || !$id) { |
3396 | 3396 | return false; |
3397 | 3397 | } |
@@ -3458,8 +3458,8 @@ discard block |
||
3458 | 3458 | } |
3459 | 3459 | |
3460 | 3460 | $usertype = $this->isFrontend() ? 1 : 0; |
3461 | - $evtid = (int)$evtid; |
|
3462 | - $type = (int)$type; |
|
3461 | + $evtid = (int) $evtid; |
|
3462 | + $type = (int) $type; |
|
3463 | 3463 | |
3464 | 3464 | // Types: 1 = information, 2 = warning, 3 = error |
3465 | 3465 | if ($type < 1) { |
@@ -3481,8 +3481,8 @@ discard block |
||
3481 | 3481 | if (isset($this->config['send_errormail']) && $this->config['send_errormail'] !== '0') { |
3482 | 3482 | if ($this->config['send_errormail'] <= $type) { |
3483 | 3483 | $this->sendmail(array( |
3484 | - 'subject' => 'MODX System Error on ' . $this->config['site_name'], |
|
3485 | - 'body' => 'Source: ' . $source . ' - The details of the error could be seen in the MODX system events log.', |
|
3484 | + 'subject' => 'MODX System Error on '.$this->config['site_name'], |
|
3485 | + 'body' => 'Source: '.$source.' - The details of the error could be seen in the MODX system events log.', |
|
3486 | 3486 | 'type' => 'text' |
3487 | 3487 | )); |
3488 | 3488 | } |
@@ -3530,7 +3530,7 @@ discard block |
||
3530 | 3530 | $p['fromname'] = $userinfo['username']; |
3531 | 3531 | } |
3532 | 3532 | if ($msg === '' && !isset($p['body'])) { |
3533 | - $p['body'] = $_SERVER['REQUEST_URI'] . "\n" . $_SERVER['HTTP_USER_AGENT'] . "\n" . $_SERVER['HTTP_REFERER']; |
|
3533 | + $p['body'] = $_SERVER['REQUEST_URI']."\n".$_SERVER['HTTP_USER_AGENT']."\n".$_SERVER['HTTP_REFERER']; |
|
3534 | 3534 | } elseif (is_string($msg) && 0 < strlen($msg)) { |
3535 | 3535 | $p['body'] = $msg; |
3536 | 3536 | } |
@@ -3570,8 +3570,8 @@ discard block |
||
3570 | 3570 | $files = array(); |
3571 | 3571 | } |
3572 | 3572 | foreach ($files as $f) { |
3573 | - if (file_exists(MODX_BASE_PATH . $f) && is_file(MODX_BASE_PATH . $f) && is_readable(MODX_BASE_PATH . $f)) { |
|
3574 | - $this->mail->AddAttachment(MODX_BASE_PATH . $f); |
|
3573 | + if (file_exists(MODX_BASE_PATH.$f) && is_file(MODX_BASE_PATH.$f) && is_readable(MODX_BASE_PATH.$f)) { |
|
3574 | + $this->mail->AddAttachment(MODX_BASE_PATH.$f); |
|
3575 | 3575 | } |
3576 | 3576 | } |
3577 | 3577 | $rs = $this->mail->send(); |
@@ -3616,7 +3616,7 @@ discard block |
||
3616 | 3616 | */ |
3617 | 3617 | public function isFrontend() |
3618 | 3618 | { |
3619 | - return ! $this->isBackend(); |
|
3619 | + return !$this->isBackend(); |
|
3620 | 3620 | } |
3621 | 3621 | |
3622 | 3622 | /** |
@@ -3641,14 +3641,14 @@ discard block |
||
3641 | 3641 | $tblsc = $this->getFullTableName("site_content"); |
3642 | 3642 | $tbldg = $this->getFullTableName("document_groups"); |
3643 | 3643 | // modify field names to use sc. table reference |
3644 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3645 | - $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3644 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3645 | + $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3646 | 3646 | // get document groups for current user |
3647 | 3647 | if ($docgrp = $this->getUserDocGroups()) { |
3648 | 3648 | $docgrp = implode(",", $docgrp); |
3649 | 3649 | } |
3650 | 3650 | // build query |
3651 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3651 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3652 | 3652 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
3653 | 3653 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}"); |
3654 | 3654 | $resourceArray = $this->db->makeArray($result); |
@@ -3678,14 +3678,14 @@ discard block |
||
3678 | 3678 | $tbldg = $this->getFullTableName("document_groups"); |
3679 | 3679 | |
3680 | 3680 | // modify field names to use sc. table reference |
3681 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3682 | - $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3681 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3682 | + $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3683 | 3683 | // get document groups for current user |
3684 | 3684 | if ($docgrp = $this->getUserDocGroups()) { |
3685 | 3685 | $docgrp = implode(",", $docgrp); |
3686 | 3686 | } |
3687 | 3687 | // build query |
3688 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3688 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3689 | 3689 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
3690 | 3690 | 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}"); |
3691 | 3691 | $resourceArray = $this->db->makeArray($result); |
@@ -3720,16 +3720,16 @@ discard block |
||
3720 | 3720 | return $this->tmpCache[__FUNCTION__][$cacheKey]; |
3721 | 3721 | } |
3722 | 3722 | |
3723 | - $published = ($published !== 'all') ? 'AND sc.published = ' . $published : ''; |
|
3724 | - $deleted = ($deleted !== 'all') ? 'AND sc.deleted = ' . $deleted : ''; |
|
3723 | + $published = ($published !== 'all') ? 'AND sc.published = '.$published : ''; |
|
3724 | + $deleted = ($deleted !== 'all') ? 'AND sc.deleted = '.$deleted : ''; |
|
3725 | 3725 | |
3726 | 3726 | if ($where != '') { |
3727 | - $where = 'AND ' . $where; |
|
3727 | + $where = 'AND '.$where; |
|
3728 | 3728 | } |
3729 | 3729 | |
3730 | 3730 | // modify field names to use sc. table reference |
3731 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3732 | - $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3731 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3732 | + $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3733 | 3733 | |
3734 | 3734 | // get document groups for current user |
3735 | 3735 | if ($docgrp = $this->getUserDocGroups()) { |
@@ -3737,7 +3737,7 @@ discard block |
||
3737 | 3737 | } |
3738 | 3738 | |
3739 | 3739 | // build query |
3740 | - $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')'); |
|
3740 | + $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')'); |
|
3741 | 3741 | |
3742 | 3742 | $tblsc = $this->getFullTableName('site_content'); |
3743 | 3743 | $tbldg = $this->getFullTableName('document_groups'); |
@@ -3789,10 +3789,10 @@ discard block |
||
3789 | 3789 | return false; |
3790 | 3790 | } else { |
3791 | 3791 | // modify field names to use sc. table reference |
3792 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3793 | - $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3792 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3793 | + $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3794 | 3794 | if ($where != '') { |
3795 | - $where = 'AND ' . $where; |
|
3795 | + $where = 'AND '.$where; |
|
3796 | 3796 | } |
3797 | 3797 | |
3798 | 3798 | $published = ($published !== 'all') ? "AND sc.published = '{$published}'" : ''; |
@@ -3803,13 +3803,13 @@ discard block |
||
3803 | 3803 | $docgrp = implode(',', $docgrp); |
3804 | 3804 | } |
3805 | 3805 | |
3806 | - $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')'); |
|
3806 | + $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')'); |
|
3807 | 3807 | |
3808 | 3808 | $tblsc = $this->getFullTableName('site_content'); |
3809 | 3809 | $tbldg = $this->getFullTableName('document_groups'); |
3810 | 3810 | |
3811 | 3811 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
3812 | - 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); |
|
3812 | + 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); |
|
3813 | 3813 | |
3814 | 3814 | $resourceArray = $this->db->makeArray($result); |
3815 | 3815 | |
@@ -3914,12 +3914,12 @@ discard block |
||
3914 | 3914 | $tbldg = $this->getFullTableName("document_groups"); |
3915 | 3915 | $activeSql = $active == 1 ? "AND sc.published=1 AND sc.deleted=0" : ""; |
3916 | 3916 | // modify field names to use sc. table reference |
3917 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3917 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3918 | 3918 | // get document groups for current user |
3919 | 3919 | if ($docgrp = $this->getUserDocGroups()) { |
3920 | 3920 | $docgrp = implode(",", $docgrp); |
3921 | 3921 | } |
3922 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3922 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3923 | 3923 | $result = $this->db->select($fields, "{$tblsc} sc LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id='{$pageid}' {$activeSql}) AND ({$access})", "", 1); |
3924 | 3924 | $pageInfo = $this->db->getRow($result); |
3925 | 3925 | |
@@ -3966,7 +3966,7 @@ discard block |
||
3966 | 3966 | { |
3967 | 3967 | if ($this->currentSnippet) { |
3968 | 3968 | $tbl = $this->getFullTableName("site_snippets"); |
3969 | - $rs = $this->db->select('id', $tbl, "name='" . $this->db->escape($this->currentSnippet) . "'", '', 1); |
|
3969 | + $rs = $this->db->select('id', $tbl, "name='".$this->db->escape($this->currentSnippet)."'", '', 1); |
|
3970 | 3970 | if ($snippetId = $this->db->getValue($rs)) { |
3971 | 3971 | return $snippetId; |
3972 | 3972 | } |
@@ -3993,23 +3993,23 @@ discard block |
||
3993 | 3993 | */ |
3994 | 3994 | public function clearCache($type = '', $report = false) |
3995 | 3995 | { |
3996 | - $cache_dir = MODX_BASE_PATH . $this->getCacheFolder(); |
|
3996 | + $cache_dir = MODX_BASE_PATH.$this->getCacheFolder(); |
|
3997 | 3997 | if (is_array($type)) { |
3998 | 3998 | foreach ($type as $_) { |
3999 | 3999 | $this->clearCache($_, $report); |
4000 | 4000 | } |
4001 | 4001 | } elseif ($type == 'full') { |
4002 | - include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php'); |
|
4002 | + include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php'); |
|
4003 | 4003 | $sync = new synccache(); |
4004 | 4004 | $sync->setCachepath($cache_dir); |
4005 | 4005 | $sync->setReport($report); |
4006 | 4006 | $sync->emptyCache(); |
4007 | 4007 | } elseif (preg_match('@^[1-9][0-9]*$@', $type)) { |
4008 | 4008 | $key = ($this->config['cache_type'] == 2) ? $this->makePageCacheKey($type) : $type; |
4009 | - $file_name = "docid_" . $key . "_*.pageCache.php"; |
|
4010 | - $cache_path = $cache_dir . $file_name; |
|
4009 | + $file_name = "docid_".$key."_*.pageCache.php"; |
|
4010 | + $cache_path = $cache_dir.$file_name; |
|
4011 | 4011 | $files = glob($cache_path); |
4012 | - $files[] = $cache_dir . "docid_" . $key . ".pageCache.php"; |
|
4012 | + $files[] = $cache_dir."docid_".$key.".pageCache.php"; |
|
4013 | 4013 | foreach ($files as $file) { |
4014 | 4014 | if (!is_file($file)) { |
4015 | 4015 | continue; |
@@ -4017,7 +4017,7 @@ discard block |
||
4017 | 4017 | unlink($file); |
4018 | 4018 | } |
4019 | 4019 | } else { |
4020 | - $files = glob($cache_dir . '*'); |
|
4020 | + $files = glob($cache_dir.'*'); |
|
4021 | 4021 | foreach ($files as $file) { |
4022 | 4022 | $name = basename($file); |
4023 | 4023 | if (strpos($name, '.pageCache.php') === false) { |
@@ -4086,7 +4086,7 @@ discard block |
||
4086 | 4086 | $f_url_suffix = '/'; |
4087 | 4087 | } |
4088 | 4088 | |
4089 | - $alPath = !empty ($al['path']) ? $al['path'] . '/' : ''; |
|
4089 | + $alPath = !empty ($al['path']) ? $al['path'].'/' : ''; |
|
4090 | 4090 | |
4091 | 4091 | if ($al && $al['alias']) { |
4092 | 4092 | $alias = $al['alias']; |
@@ -4094,7 +4094,7 @@ discard block |
||
4094 | 4094 | |
4095 | 4095 | } |
4096 | 4096 | |
4097 | - $alias = $alPath . $f_url_prefix . $alias . $f_url_suffix; |
|
4097 | + $alias = $alPath.$f_url_prefix.$alias.$f_url_suffix; |
|
4098 | 4098 | $url = "{$alias}{$args}"; |
4099 | 4099 | } else { |
4100 | 4100 | $url = "index.php?id={$id}{$args}"; |
@@ -4113,7 +4113,7 @@ discard block |
||
4113 | 4113 | } |
4114 | 4114 | |
4115 | 4115 | //TODO: check to make sure that $site_url incudes the url :port (e.g. :8080) |
4116 | - $host = $scheme == 'full' ? $this->config['site_url'] : $scheme . '://' . $_SERVER['HTTP_HOST'] . $host; |
|
4116 | + $host = $scheme == 'full' ? $this->config['site_url'] : $scheme.'://'.$_SERVER['HTTP_HOST'].$host; |
|
4117 | 4117 | } |
4118 | 4118 | |
4119 | 4119 | //fix strictUrl by Bumkaka |
@@ -4122,9 +4122,9 @@ discard block |
||
4122 | 4122 | } |
4123 | 4123 | |
4124 | 4124 | if ($this->config['xhtml_urls']) { |
4125 | - $url = preg_replace("/&(?!amp;)/", "&", $host . $virtualDir . $url); |
|
4125 | + $url = preg_replace("/&(?!amp;)/", "&", $host.$virtualDir.$url); |
|
4126 | 4126 | } else { |
4127 | - $url = $host . $virtualDir . $url; |
|
4127 | + $url = $host.$virtualDir.$url; |
|
4128 | 4128 | } |
4129 | 4129 | |
4130 | 4130 | $evtOut = $this->invokeEvent('OnMakeDocUrl', array( |
@@ -4148,21 +4148,21 @@ discard block |
||
4148 | 4148 | if (isset($this->aliasListing[$id])) { |
4149 | 4149 | $out = $this->aliasListing[$id]; |
4150 | 4150 | } else { |
4151 | - $q = $this->db->query("SELECT id,alias,isfolder,parent FROM " . $this->getFullTableName("site_content") . " WHERE id=" . (int)$id); |
|
4151 | + $q = $this->db->query("SELECT id,alias,isfolder,parent FROM ".$this->getFullTableName("site_content")." WHERE id=".(int) $id); |
|
4152 | 4152 | if ($this->db->getRecordCount($q) == '1') { |
4153 | 4153 | $q = $this->db->getRow($q); |
4154 | 4154 | $this->aliasListing[$id] = array( |
4155 | - 'id' => (int)$q['id'], |
|
4155 | + 'id' => (int) $q['id'], |
|
4156 | 4156 | 'alias' => $q['alias'] == '' ? $q['id'] : $q['alias'], |
4157 | - 'parent' => (int)$q['parent'], |
|
4158 | - 'isfolder' => (int)$q['isfolder'], |
|
4157 | + 'parent' => (int) $q['parent'], |
|
4158 | + 'isfolder' => (int) $q['isfolder'], |
|
4159 | 4159 | ); |
4160 | 4160 | if ($this->aliasListing[$id]['parent'] > 0) { |
4161 | 4161 | //fix alias_path_usage |
4162 | 4162 | if ($this->config['use_alias_path'] == '1') { |
4163 | 4163 | //&& $tmp['path'] != '' - fix error slash with epty path |
4164 | 4164 | $tmp = $this->getAliasListing($this->aliasListing[$id]['parent']); |
4165 | - $this->aliasListing[$id]['path'] = $tmp['path'] . ($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '') . $tmp['alias'] : ''); |
|
4165 | + $this->aliasListing[$id]['path'] = $tmp['path'].($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '').$tmp['alias'] : ''); |
|
4166 | 4166 | } else { |
4167 | 4167 | $this->aliasListing[$id]['path'] = ''; |
4168 | 4168 | } |
@@ -4203,7 +4203,7 @@ discard block |
||
4203 | 4203 | $out = array(); |
4204 | 4204 | if (empty($this->version) || !is_array($this->version)) { |
4205 | 4205 | //include for compatibility modx version < 1.0.10 |
4206 | - include MODX_MANAGER_PATH . "includes/version.inc.php"; |
|
4206 | + include MODX_MANAGER_PATH."includes/version.inc.php"; |
|
4207 | 4207 | $this->version = array(); |
4208 | 4208 | $this->version['version'] = isset($modx_version) ? $modx_version : ''; |
4209 | 4209 | $this->version['branch'] = isset($modx_branch) ? $modx_branch : ''; |
@@ -4225,18 +4225,18 @@ discard block |
||
4225 | 4225 | { |
4226 | 4226 | if (isset ($this->snippetCache[$snippetName])) { |
4227 | 4227 | $snippet = $this->snippetCache[$snippetName]; |
4228 | - $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : ''; |
|
4228 | + $properties = !empty($this->snippetCache[$snippetName."Props"]) ? $this->snippetCache[$snippetName."Props"] : ''; |
|
4229 | 4229 | } else { // not in cache so let's check the db |
4230 | - $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;"; |
|
4230 | + $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;"; |
|
4231 | 4231 | $result = $this->db->query($sql); |
4232 | 4232 | if ($this->db->getRecordCount($result) == 1) { |
4233 | 4233 | $row = $this->db->getRow($result); |
4234 | 4234 | $snippet = $this->snippetCache[$snippetName] = $row['snippet']; |
4235 | 4235 | $mergedProperties = array_merge($this->parseProperties($row['properties']), $this->parseProperties($row['sharedproperties'])); |
4236 | - $properties = $this->snippetCache[$snippetName . "Props"] = json_encode($mergedProperties); |
|
4236 | + $properties = $this->snippetCache[$snippetName."Props"] = json_encode($mergedProperties); |
|
4237 | 4237 | } else { |
4238 | 4238 | $snippet = $this->snippetCache[$snippetName] = "return false;"; |
4239 | - $properties = $this->snippetCache[$snippetName . "Props"] = ''; |
|
4239 | + $properties = $this->snippetCache[$snippetName."Props"] = ''; |
|
4240 | 4240 | } |
4241 | 4241 | } |
4242 | 4242 | // load default params/properties |
@@ -4336,8 +4336,8 @@ discard block |
||
4336 | 4336 | } |
4337 | 4337 | if (strpos($tpl, $s) !== false) { |
4338 | 4338 | $tpl = str_replace($s, $value, $tpl); |
4339 | - } elseif($this->debug) { |
|
4340 | - $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
4339 | + } elseif ($this->debug) { |
|
4340 | + $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
4341 | 4341 | } |
4342 | 4342 | } |
4343 | 4343 | |
@@ -4386,7 +4386,7 @@ discard block |
||
4386 | 4386 | case 'CODE': |
4387 | 4387 | break; |
4388 | 4388 | case 'FILE': |
4389 | - $template = file_get_contents(MODX_BASE_PATH . $template); |
|
4389 | + $template = file_get_contents(MODX_BASE_PATH.$template); |
|
4390 | 4390 | break; |
4391 | 4391 | case 'CHUNK': |
4392 | 4392 | $template = $this->getChunk($template); |
@@ -4419,7 +4419,7 @@ discard block |
||
4419 | 4419 | if ($mode !== 'formatOnly' && empty($timestamp)) { |
4420 | 4420 | return '-'; |
4421 | 4421 | } |
4422 | - $timestamp = (int)$timestamp; |
|
4422 | + $timestamp = (int) $timestamp; |
|
4423 | 4423 | |
4424 | 4424 | switch ($this->config['datetime_format']) { |
4425 | 4425 | case 'YYYY/mm/dd': |
@@ -4439,7 +4439,7 @@ discard block |
||
4439 | 4439 | } |
4440 | 4440 | |
4441 | 4441 | if (empty($mode)) { |
4442 | - $strTime = strftime($dateFormat . " %H:%M:%S", $timestamp); |
|
4442 | + $strTime = strftime($dateFormat." %H:%M:%S", $timestamp); |
|
4443 | 4443 | } elseif ($mode == 'dateOnly') { |
4444 | 4444 | $strTime = strftime($dateFormat, $timestamp); |
4445 | 4445 | } elseif ($mode == 'formatOnly') { |
@@ -4493,7 +4493,7 @@ discard block |
||
4493 | 4493 | $S = 0; |
4494 | 4494 | } |
4495 | 4495 | $timeStamp = mktime($H, $M, $S, $m, $d, $Y); |
4496 | - $timeStamp = (int)$timeStamp; |
|
4496 | + $timeStamp = (int) $timeStamp; |
|
4497 | 4497 | return $timeStamp; |
4498 | 4498 | } |
4499 | 4499 | |
@@ -4535,7 +4535,7 @@ discard block |
||
4535 | 4535 | if ($v === 'value') { |
4536 | 4536 | unset($_[$i]); |
4537 | 4537 | } else { |
4538 | - $_[$i] = 'tv.' . $v; |
|
4538 | + $_[$i] = 'tv.'.$v; |
|
4539 | 4539 | } |
4540 | 4540 | } |
4541 | 4541 | $fields = implode(',', $_); |
@@ -4544,12 +4544,12 @@ discard block |
||
4544 | 4544 | } |
4545 | 4545 | |
4546 | 4546 | if ($tvsort != '') { |
4547 | - $tvsort = 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort)))); |
|
4547 | + $tvsort = 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort)))); |
|
4548 | 4548 | } |
4549 | 4549 | if ($tvidnames == "*") { |
4550 | 4550 | $query = "tv.id<>0"; |
4551 | 4551 | } else { |
4552 | - $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name") . " IN ('" . implode("','", $tvidnames) . "')"; |
|
4552 | + $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name")." IN ('".implode("','", $tvidnames)."')"; |
|
4553 | 4553 | } |
4554 | 4554 | |
4555 | 4555 | $this->getUserDocGroups(); |
@@ -4693,7 +4693,7 @@ discard block |
||
4693 | 4693 | return $this->tmpCache[__FUNCTION__][$cacheKey]; |
4694 | 4694 | } |
4695 | 4695 | |
4696 | - if (($idnames != '*' && !is_array($idnames)) || empty($idnames) ) { |
|
4696 | + if (($idnames != '*' && !is_array($idnames)) || empty($idnames)) { |
|
4697 | 4697 | return false; |
4698 | 4698 | } else { |
4699 | 4699 | |
@@ -4711,23 +4711,23 @@ discard block |
||
4711 | 4711 | } |
4712 | 4712 | |
4713 | 4713 | // get user defined template variables |
4714 | - $fields = ($fields == '') ? 'tv.*' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $fields)))); |
|
4715 | - $sort = ($sort == '') ? '' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $sort)))); |
|
4714 | + $fields = ($fields == '') ? 'tv.*' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $fields)))); |
|
4715 | + $sort = ($sort == '') ? '' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $sort)))); |
|
4716 | 4716 | |
4717 | 4717 | if ($idnames == '*') { |
4718 | 4718 | $query = 'tv.id<>0'; |
4719 | 4719 | } else { |
4720 | - $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name') . " IN ('" . implode("','", $idnames) . "')"; |
|
4720 | + $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name')." IN ('".implode("','", $idnames)."')"; |
|
4721 | 4721 | } |
4722 | 4722 | |
4723 | - $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars') . " tv |
|
4724 | - INNER JOIN " . $this->getFullTableName('site_tmplvar_templates') . " tvtpl ON tvtpl.tmplvarid = tv.id |
|
4725 | - 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}" : "")); |
|
4723 | + $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars')." tv |
|
4724 | + INNER JOIN " . $this->getFullTableName('site_tmplvar_templates')." tvtpl ON tvtpl.tmplvarid = tv.id |
|
4725 | + 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}" : "")); |
|
4726 | 4726 | |
4727 | 4727 | $result = $this->db->makeArray($rs); |
4728 | 4728 | |
4729 | 4729 | // get default/built-in template variables |
4730 | - if(is_array($docRow)){ |
|
4730 | + if (is_array($docRow)) { |
|
4731 | 4731 | ksort($docRow); |
4732 | 4732 | |
4733 | 4733 | foreach ($docRow as $key => $value) { |
@@ -4765,22 +4765,22 @@ discard block |
||
4765 | 4765 | */ |
4766 | 4766 | public function getTemplateVarOutput($idnames = array(), $docid = '', $published = 1, $sep = '') |
4767 | 4767 | { |
4768 | - if (is_array($idnames) && empty($idnames) ) { |
|
4768 | + if (is_array($idnames) && empty($idnames)) { |
|
4769 | 4769 | return false; |
4770 | 4770 | } else { |
4771 | 4771 | $output = array(); |
4772 | 4772 | $vars = ($idnames == '*' || is_array($idnames)) ? $idnames : array($idnames); |
4773 | 4773 | |
4774 | - $docid = (int)$docid > 0 ? (int)$docid : $this->documentIdentifier; |
|
4774 | + $docid = (int) $docid > 0 ? (int) $docid : $this->documentIdentifier; |
|
4775 | 4775 | // remove sort for speed |
4776 | 4776 | $result = $this->getTemplateVars($vars, '*', $docid, $published, '', ''); |
4777 | 4777 | |
4778 | 4778 | if ($result == false) { |
4779 | 4779 | return false; |
4780 | 4780 | } else { |
4781 | - $baspath = MODX_MANAGER_PATH . 'includes'; |
|
4782 | - include_once $baspath . '/tmplvars.format.inc.php'; |
|
4783 | - include_once $baspath . '/tmplvars.commands.inc.php'; |
|
4781 | + $baspath = MODX_MANAGER_PATH.'includes'; |
|
4782 | + include_once $baspath.'/tmplvars.format.inc.php'; |
|
4783 | + include_once $baspath.'/tmplvars.commands.inc.php'; |
|
4784 | 4784 | |
4785 | 4785 | for ($i = 0; $i < count($result); $i++) { |
4786 | 4786 | $row = $result[$i]; |
@@ -4805,7 +4805,7 @@ discard block |
||
4805 | 4805 | */ |
4806 | 4806 | public function getFullTableName($tbl) |
4807 | 4807 | { |
4808 | - return $this->db->config['dbase'] . ".`" . $this->db->config['table_prefix'] . $tbl . "`"; |
|
4808 | + return $this->db->config['dbase'].".`".$this->db->config['table_prefix'].$tbl."`"; |
|
4809 | 4809 | } |
4810 | 4810 | |
4811 | 4811 | /** |
@@ -4884,7 +4884,7 @@ discard block |
||
4884 | 4884 | public function getCachePath() |
4885 | 4885 | { |
4886 | 4886 | global $base_url; |
4887 | - $pth = $base_url . $this->getCacheFolder(); |
|
4887 | + $pth = $base_url.$this->getCacheFolder(); |
|
4888 | 4888 | return $pth; |
4889 | 4889 | } |
4890 | 4890 | |
@@ -4936,8 +4936,8 @@ discard block |
||
4936 | 4936 | $out = false; |
4937 | 4937 | |
4938 | 4938 | if (!empty($context)) { |
4939 | - if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) { |
|
4940 | - $out = $_SESSION[$context . 'InternalKey']; |
|
4939 | + if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) { |
|
4940 | + $out = $_SESSION[$context.'InternalKey']; |
|
4941 | 4941 | } |
4942 | 4942 | } else { |
4943 | 4943 | switch (true) { |
@@ -4965,8 +4965,8 @@ discard block |
||
4965 | 4965 | $out = false; |
4966 | 4966 | |
4967 | 4967 | if (!empty($context)) { |
4968 | - if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) { |
|
4969 | - $out = $_SESSION[$context . 'Shortname']; |
|
4968 | + if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) { |
|
4969 | + $out = $_SESSION[$context.'Shortname']; |
|
4970 | 4970 | } |
4971 | 4971 | } else { |
4972 | 4972 | switch (true) { |
@@ -5037,8 +5037,8 @@ discard block |
||
5037 | 5037 | */ |
5038 | 5038 | public function getWebUserInfo($uid) |
5039 | 5039 | { |
5040 | - $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users") . " wu |
|
5041 | - INNER JOIN " . $this->getFullTableName("web_user_attributes") . " wua ON wua.internalkey=wu.id", "wu.id='{$uid}'"); |
|
5040 | + $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users")." wu |
|
5041 | + INNER JOIN " . $this->getFullTableName("web_user_attributes")." wua ON wua.internalkey=wu.id", "wu.id='{$uid}'"); |
|
5042 | 5042 | if ($row = $this->db->getRow($rs)) { |
5043 | 5043 | if (!isset($row['usertype']) or !$row["usertype"]) { |
5044 | 5044 | $row["usertype"] = "web"; |
@@ -5074,7 +5074,7 @@ discard block |
||
5074 | 5074 | } else if (is_array($dg)) { |
5075 | 5075 | // resolve ids to names |
5076 | 5076 | $dgn = array(); |
5077 | - $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (" . implode(",", $dg) . ")"); |
|
5077 | + $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (".implode(",", $dg).")"); |
|
5078 | 5078 | while ($row = $this->db->getRow($ds)) { |
5079 | 5079 | $dgn[] = $row['name']; |
5080 | 5080 | } |
@@ -5102,7 +5102,7 @@ discard block |
||
5102 | 5102 | $rt = false; |
5103 | 5103 | if ($_SESSION["webValidated"] == 1) { |
5104 | 5104 | $tbl = $this->getFullTableName("web_users"); |
5105 | - $ds = $this->db->select('id, username, password', $tbl, "id='" . $this->getLoginUserID() . "'"); |
|
5105 | + $ds = $this->db->select('id, username, password', $tbl, "id='".$this->getLoginUserID()."'"); |
|
5106 | 5106 | if ($row = $this->db->getRow($ds)) { |
5107 | 5107 | if ($row["password"] == md5($oldPwd)) { |
5108 | 5108 | if (strlen($newPwd) < 6) { |
@@ -5112,7 +5112,7 @@ discard block |
||
5112 | 5112 | } else { |
5113 | 5113 | $this->db->update(array( |
5114 | 5114 | 'password' => $this->db->escape($newPwd), |
5115 | - ), $tbl, "id='" . $this->getLoginUserID() . "'"); |
|
5115 | + ), $tbl, "id='".$this->getLoginUserID()."'"); |
|
5116 | 5116 | // invoke OnWebChangePassword event |
5117 | 5117 | $this->invokeEvent("OnWebChangePassword", array( |
5118 | 5118 | "userid" => $row["id"], |
@@ -5143,8 +5143,8 @@ discard block |
||
5143 | 5143 | // check cache |
5144 | 5144 | $grpNames = isset ($_SESSION['webUserGroupNames']) ? $_SESSION['webUserGroupNames'] : false; |
5145 | 5145 | if (!is_array($grpNames)) { |
5146 | - $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names") . " wgn |
|
5147 | - INNER JOIN " . $this->getFullTableName("web_groups") . " wg ON wg.webgroup=wgn.id AND wg.webuser='" . $this->getLoginUserID() . "'"); |
|
5146 | + $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names")." wgn |
|
5147 | + INNER JOIN " . $this->getFullTableName("web_groups")." wg ON wg.webgroup=wgn.id AND wg.webuser='".$this->getLoginUserID()."'"); |
|
5148 | 5148 | $grpNames = $this->db->getColumn("name", $rs); |
5149 | 5149 | // save to cache |
5150 | 5150 | $_SESSION['webUserGroupNames'] = $grpNames; |
@@ -5177,7 +5177,7 @@ discard block |
||
5177 | 5177 | if (strpos(strtolower($src), "<style") !== false || strpos(strtolower($src), "<link") !== false) { |
5178 | 5178 | $this->sjscripts[$nextpos] = $src; |
5179 | 5179 | } else { |
5180 | - $this->sjscripts[$nextpos] = "\t" . '<link rel="stylesheet" type="text/css" href="' . $src . '" ' . ($media ? 'media="' . $media . '" ' : '') . '/>'; |
|
5180 | + $this->sjscripts[$nextpos] = "\t".'<link rel="stylesheet" type="text/css" href="'.$src.'" '.($media ? 'media="'.$media.'" ' : '').'/>'; |
|
5181 | 5181 | } |
5182 | 5182 | } |
5183 | 5183 | |
@@ -5256,7 +5256,7 @@ discard block |
||
5256 | 5256 | } |
5257 | 5257 | |
5258 | 5258 | if ($useThisVer && $plaintext != true && (strpos(strtolower($src), "<script") === false)) { |
5259 | - $src = "\t" . '<script type="text/javascript" src="' . $src . '"></script>'; |
|
5259 | + $src = "\t".'<script type="text/javascript" src="'.$src.'"></script>'; |
|
5260 | 5260 | } |
5261 | 5261 | if ($startup) { |
5262 | 5262 | $pos = isset($overwritepos) ? $overwritepos : max(array_merge(array(0), array_keys($this->sjscripts))) + 1; |
@@ -5403,7 +5403,7 @@ discard block |
||
5403 | 5403 | $eventtime = $this->getMicroTime() - $eventtime; |
5404 | 5404 | $this->pluginsCode .= sprintf('<fieldset><legend><b>%s / %s</b> (%2.2f ms)</legend>', $evtName, $pluginName, $eventtime * 1000); |
5405 | 5405 | foreach ($parameter as $k => $v) { |
5406 | - $this->pluginsCode .= "{$k} => " . print_r($v, true) . '<br>'; |
|
5406 | + $this->pluginsCode .= "{$k} => ".print_r($v, true).'<br>'; |
|
5407 | 5407 | } |
5408 | 5408 | $this->pluginsCode .= '</fieldset><br />'; |
5409 | 5409 | $this->pluginsTime["{$evtName} / {$pluginName}"] += $eventtime; |
@@ -5431,13 +5431,13 @@ discard block |
||
5431 | 5431 | $plugin = array(); |
5432 | 5432 | if (isset ($this->pluginCache[$pluginName])) { |
5433 | 5433 | $pluginCode = $this->pluginCache[$pluginName]; |
5434 | - $pluginProperties = isset($this->pluginCache[$pluginName . "Props"]) ? $this->pluginCache[$pluginName . "Props"] : ''; |
|
5434 | + $pluginProperties = isset($this->pluginCache[$pluginName."Props"]) ? $this->pluginCache[$pluginName."Props"] : ''; |
|
5435 | 5435 | } else { |
5436 | 5436 | $pluginName = $this->db->escape($pluginName); |
5437 | 5437 | $result = $this->db->select('name, plugincode, properties', $this->getFullTableName("site_plugins"), "name='{$pluginName}' AND disabled=0"); |
5438 | 5438 | if ($row = $this->db->getRow($result)) { |
5439 | 5439 | $pluginCode = $this->pluginCache[$row['name']] = $row['plugincode']; |
5440 | - $pluginProperties = $this->pluginCache[$row['name'] . "Props"] = $row['properties']; |
|
5440 | + $pluginProperties = $this->pluginCache[$row['name']."Props"] = $row['properties']; |
|
5441 | 5441 | } else { |
5442 | 5442 | $pluginCode = $this->pluginCache[$pluginName] = "return false;"; |
5443 | 5443 | $pluginProperties = ''; |
@@ -5544,7 +5544,7 @@ discard block |
||
5544 | 5544 | public function parseDocBlockFromFile($element_dir, $filename, $escapeValues = false) |
5545 | 5545 | { |
5546 | 5546 | $params = array(); |
5547 | - $fullpath = $element_dir . '/' . $filename; |
|
5547 | + $fullpath = $element_dir.'/'.$filename; |
|
5548 | 5548 | if (is_readable($fullpath)) { |
5549 | 5549 | $tpl = @fopen($fullpath, "r"); |
5550 | 5550 | if ($tpl) { |
@@ -5711,8 +5711,8 @@ discard block |
||
5711 | 5711 | $ph = array('site_url' => MODX_SITE_URL); |
5712 | 5712 | $regexUrl = "/((http|https|ftp|ftps)\:\/\/[^\/]+(\/[^\s]+[^,.?!:;\s])?)/"; |
5713 | 5713 | $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'; |
5714 | - $emailSubject = isset($parsed['name']) ? '?subject=' . $parsed['name'] : ''; |
|
5715 | - $emailSubject .= isset($parsed['version']) ? ' v' . $parsed['version'] : ''; |
|
5714 | + $emailSubject = isset($parsed['name']) ? '?subject='.$parsed['name'] : ''; |
|
5715 | + $emailSubject .= isset($parsed['version']) ? ' v'.$parsed['version'] : ''; |
|
5716 | 5716 | foreach ($parsed as $key => $val) { |
5717 | 5717 | if (is_array($val)) { |
5718 | 5718 | foreach ($val as $key2 => $val2) { |
@@ -5721,7 +5721,7 @@ discard block |
||
5721 | 5721 | $val2 = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val2); |
5722 | 5722 | } |
5723 | 5723 | if (preg_match($regexEmail, $val2, $url)) { |
5724 | - $val2 = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val2); |
|
5724 | + $val2 = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val2); |
|
5725 | 5725 | } |
5726 | 5726 | $parsed[$key][$key2] = $val2; |
5727 | 5727 | } |
@@ -5731,7 +5731,7 @@ discard block |
||
5731 | 5731 | $val = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val); |
5732 | 5732 | } |
5733 | 5733 | if (preg_match($regexEmail, $val, $url)) { |
5734 | - $val = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val); |
|
5734 | + $val = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val); |
|
5735 | 5735 | } |
5736 | 5736 | $parsed[$key] = $val; |
5737 | 5737 | } |
@@ -5745,32 +5745,32 @@ discard block |
||
5745 | 5745 | ); |
5746 | 5746 | |
5747 | 5747 | $nl = "\n"; |
5748 | - $list = isset($parsed['logo']) ? '<img src="' . $this->config['base_url'] . ltrim($parsed['logo'], "/") . '" style="float:right;max-width:100px;height:auto;" />' . $nl : ''; |
|
5749 | - $list .= '<p>' . $nl; |
|
5750 | - $list .= isset($parsed['name']) ? '<strong>' . $parsed['name'] . '</strong><br/>' . $nl : ''; |
|
5751 | - $list .= isset($parsed['description']) ? $parsed['description'] . $nl : ''; |
|
5752 | - $list .= '</p><br/>' . $nl; |
|
5753 | - $list .= isset($parsed['version']) ? '<p><strong>' . $_lang['version'] . ':</strong> ' . $parsed['version'] . '</p>' . $nl : ''; |
|
5754 | - $list .= isset($parsed['license']) ? '<p><strong>' . $_lang['license'] . ':</strong> ' . $parsed['license'] . '</p>' . $nl : ''; |
|
5755 | - $list .= isset($parsed['lastupdate']) ? '<p><strong>' . $_lang['last_update'] . ':</strong> ' . $parsed['lastupdate'] . '</p>' . $nl : ''; |
|
5756 | - $list .= '<br/>' . $nl; |
|
5748 | + $list = isset($parsed['logo']) ? '<img src="'.$this->config['base_url'].ltrim($parsed['logo'], "/").'" style="float:right;max-width:100px;height:auto;" />'.$nl : ''; |
|
5749 | + $list .= '<p>'.$nl; |
|
5750 | + $list .= isset($parsed['name']) ? '<strong>'.$parsed['name'].'</strong><br/>'.$nl : ''; |
|
5751 | + $list .= isset($parsed['description']) ? $parsed['description'].$nl : ''; |
|
5752 | + $list .= '</p><br/>'.$nl; |
|
5753 | + $list .= isset($parsed['version']) ? '<p><strong>'.$_lang['version'].':</strong> '.$parsed['version'].'</p>'.$nl : ''; |
|
5754 | + $list .= isset($parsed['license']) ? '<p><strong>'.$_lang['license'].':</strong> '.$parsed['license'].'</p>'.$nl : ''; |
|
5755 | + $list .= isset($parsed['lastupdate']) ? '<p><strong>'.$_lang['last_update'].':</strong> '.$parsed['lastupdate'].'</p>'.$nl : ''; |
|
5756 | + $list .= '<br/>'.$nl; |
|
5757 | 5757 | $first = true; |
5758 | 5758 | foreach ($arrayParams as $param => $label) { |
5759 | 5759 | if (isset($parsed[$param])) { |
5760 | 5760 | if ($first) { |
5761 | - $list .= '<p><strong>' . $_lang['references'] . '</strong></p>' . $nl; |
|
5762 | - $list .= '<ul class="docBlockList">' . $nl; |
|
5761 | + $list .= '<p><strong>'.$_lang['references'].'</strong></p>'.$nl; |
|
5762 | + $list .= '<ul class="docBlockList">'.$nl; |
|
5763 | 5763 | $first = false; |
5764 | 5764 | } |
5765 | - $list .= ' <li><strong>' . $label . '</strong>' . $nl; |
|
5766 | - $list .= ' <ul>' . $nl; |
|
5765 | + $list .= ' <li><strong>'.$label.'</strong>'.$nl; |
|
5766 | + $list .= ' <ul>'.$nl; |
|
5767 | 5767 | foreach ($parsed[$param] as $val) { |
5768 | - $list .= ' <li>' . $val . '</li>' . $nl; |
|
5768 | + $list .= ' <li>'.$val.'</li>'.$nl; |
|
5769 | 5769 | } |
5770 | - $list .= ' </ul></li>' . $nl; |
|
5770 | + $list .= ' </ul></li>'.$nl; |
|
5771 | 5771 | } |
5772 | 5772 | } |
5773 | - $list .= !$first ? '</ul>' . $nl : ''; |
|
5773 | + $list .= !$first ? '</ul>'.$nl : ''; |
|
5774 | 5774 | |
5775 | 5775 | return $list; |
5776 | 5776 | } |
@@ -5846,7 +5846,7 @@ discard block |
||
5846 | 5846 | */ |
5847 | 5847 | public function addSnippet($name, $phpCode) |
5848 | 5848 | { |
5849 | - $this->snippetCache['#' . $name] = $phpCode; |
|
5849 | + $this->snippetCache['#'.$name] = $phpCode; |
|
5850 | 5850 | } |
5851 | 5851 | |
5852 | 5852 | /** |
@@ -5855,7 +5855,7 @@ discard block |
||
5855 | 5855 | */ |
5856 | 5856 | public function addChunk($name, $text) |
5857 | 5857 | { |
5858 | - $this->chunkCache['#' . $name] = $text; |
|
5858 | + $this->chunkCache['#'.$name] = $text; |
|
5859 | 5859 | } |
5860 | 5860 | |
5861 | 5861 | /** |
@@ -5891,7 +5891,7 @@ discard block |
||
5891 | 5891 | } |
5892 | 5892 | |
5893 | 5893 | if (!$isSafe) { |
5894 | - $msg = $phpcode . "\n" . $this->currentSnippet . "\n" . print_r($_SERVER, true); |
|
5894 | + $msg = $phpcode."\n".$this->currentSnippet."\n".print_r($_SERVER, true); |
|
5895 | 5895 | $title = sprintf('Unknown eval was executed (%s)', $this->htmlspecialchars(substr(trim($phpcode), 0, 50))); |
5896 | 5896 | $this->messageQuit($title, '', true, '', '', 'Parser', $msg); |
5897 | 5897 | return; |
@@ -5905,7 +5905,7 @@ discard block |
||
5905 | 5905 | return 'array()'; |
5906 | 5906 | } |
5907 | 5907 | |
5908 | - $output = $echo . $return; |
|
5908 | + $output = $echo.$return; |
|
5909 | 5909 | modx_sanitize_gpc($output); |
5910 | 5910 | return $this->htmlspecialchars($output); // Maybe, all html tags are dangerous |
5911 | 5911 | } |
@@ -5923,8 +5923,8 @@ discard block |
||
5923 | 5923 | |
5924 | 5924 | $safe = explode(',', $safe_functions); |
5925 | 5925 | |
5926 | - $phpcode = rtrim($phpcode, ';') . ';'; |
|
5927 | - $tokens = token_get_all('<?php ' . $phpcode); |
|
5926 | + $phpcode = rtrim($phpcode, ';').';'; |
|
5927 | + $tokens = token_get_all('<?php '.$phpcode); |
|
5928 | 5928 | foreach ($tokens as $i => $token) { |
5929 | 5929 | if (!is_array($token)) { |
5930 | 5930 | continue; |
@@ -5960,7 +5960,7 @@ discard block |
||
5960 | 5960 | public function atBindFileContent($str = '') |
5961 | 5961 | { |
5962 | 5962 | |
5963 | - $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'] . 'files/', ''); |
|
5963 | + $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'].'files/', ''); |
|
5964 | 5964 | |
5965 | 5965 | if (stripos($str, '@FILE') !== 0) { |
5966 | 5966 | return $str; |
@@ -5983,7 +5983,7 @@ discard block |
||
5983 | 5983 | $errorMsg = sprintf("Could not retrieve string '%s'.", $str); |
5984 | 5984 | |
5985 | 5985 | foreach ($search_path as $path) { |
5986 | - $file_path = MODX_BASE_PATH . $path . $str; |
|
5986 | + $file_path = MODX_BASE_PATH.$path.$str; |
|
5987 | 5987 | if (strpos($file_path, MODX_MANAGER_PATH) === 0) { |
5988 | 5988 | return $errorMsg; |
5989 | 5989 | } elseif (is_file($file_path)) { |
@@ -5997,7 +5997,7 @@ discard block |
||
5997 | 5997 | return $errorMsg; |
5998 | 5998 | } |
5999 | 5999 | |
6000 | - $content = (string)file_get_contents($file_path); |
|
6000 | + $content = (string) file_get_contents($file_path); |
|
6001 | 6001 | if ($content === false) { |
6002 | 6002 | return $errorMsg; |
6003 | 6003 | } |
@@ -6110,22 +6110,22 @@ discard block |
||
6110 | 6110 | |
6111 | 6111 | $version = isset ($GLOBALS['modx_version']) ? $GLOBALS['modx_version'] : ''; |
6112 | 6112 | $release_date = isset ($GLOBALS['release_date']) ? $GLOBALS['release_date'] : ''; |
6113 | - $request_uri = "http://" . $_SERVER['HTTP_HOST'] . ($_SERVER["SERVER_PORT"] == 80 ? "" : (":" . $_SERVER["SERVER_PORT"])) . $_SERVER['REQUEST_URI']; |
|
6113 | + $request_uri = "http://".$_SERVER['HTTP_HOST'].($_SERVER["SERVER_PORT"] == 80 ? "" : (":".$_SERVER["SERVER_PORT"])).$_SERVER['REQUEST_URI']; |
|
6114 | 6114 | $request_uri = $this->htmlspecialchars($request_uri, ENT_QUOTES, $this->config['modx_charset']); |
6115 | 6115 | $ua = $this->htmlspecialchars($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, $this->config['modx_charset']); |
6116 | 6116 | $referer = $this->htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_QUOTES, $this->config['modx_charset']); |
6117 | 6117 | if ($is_error) { |
6118 | 6118 | $str = '<h2 style="color:red">« Evo Parse Error »</h2>'; |
6119 | 6119 | if ($msg != 'PHP Parse Error') { |
6120 | - $str .= '<h3 style="color:red">' . $msg . '</h3>'; |
|
6120 | + $str .= '<h3 style="color:red">'.$msg.'</h3>'; |
|
6121 | 6121 | } |
6122 | 6122 | } else { |
6123 | 6123 | $str = '<h2 style="color:#003399">« Evo Debug/ stop message »</h2>'; |
6124 | - $str .= '<h3 style="color:#003399">' . $msg . '</h3>'; |
|
6124 | + $str .= '<h3 style="color:#003399">'.$msg.'</h3>'; |
|
6125 | 6125 | } |
6126 | 6126 | |
6127 | 6127 | if (!empty ($query)) { |
6128 | - $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>'; |
|
6128 | + $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>'; |
|
6129 | 6129 | } |
6130 | 6130 | |
6131 | 6131 | $errortype = array( |
@@ -6148,13 +6148,13 @@ discard block |
||
6148 | 6148 | |
6149 | 6149 | if (!empty($nr) || !empty($file)) { |
6150 | 6150 | if ($text != '') { |
6151 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : ' . $text . '</div>'; |
|
6151 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : '.$text.'</div>'; |
|
6152 | 6152 | } |
6153 | 6153 | if ($output != '') { |
6154 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">' . $output . '</div>'; |
|
6154 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">'.$output.'</div>'; |
|
6155 | 6155 | } |
6156 | 6156 | if ($nr !== '') { |
6157 | - $table[] = array('ErrorType[num]', $errortype [$nr] . "[" . $nr . "]"); |
|
6157 | + $table[] = array('ErrorType[num]', $errortype [$nr]."[".$nr."]"); |
|
6158 | 6158 | } |
6159 | 6159 | if ($file) { |
6160 | 6160 | $table[] = array('File', $file); |
@@ -6174,7 +6174,7 @@ discard block |
||
6174 | 6174 | } |
6175 | 6175 | |
6176 | 6176 | if (!empty($this->event->activePlugin)) { |
6177 | - $table[] = array('Current Plugin', $this->event->activePlugin . '(' . $this->event->name . ')'); |
|
6177 | + $table[] = array('Current Plugin', $this->event->activePlugin.'('.$this->event->name.')'); |
|
6178 | 6178 | } |
6179 | 6179 | |
6180 | 6180 | $str .= $MakeTable->create($table, array('Error information', '')); |
@@ -6184,17 +6184,17 @@ discard block |
||
6184 | 6184 | $table[] = array('REQUEST_URI', $request_uri); |
6185 | 6185 | |
6186 | 6186 | if ($this->manager->action) { |
6187 | - include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
6187 | + include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php'); |
|
6188 | 6188 | global $action_list; |
6189 | 6189 | $actionName = (isset($action_list[$this->manager->action])) ? " - {$action_list[$this->manager->action]}" : ''; |
6190 | 6190 | |
6191 | - $table[] = array('Manager action', $this->manager->action . $actionName); |
|
6191 | + $table[] = array('Manager action', $this->manager->action.$actionName); |
|
6192 | 6192 | } |
6193 | 6193 | |
6194 | 6194 | if (preg_match('@^[0-9]+@', $this->documentIdentifier)) { |
6195 | 6195 | $resource = $this->getDocumentObject('id', $this->documentIdentifier); |
6196 | 6196 | $url = $this->makeUrl($this->documentIdentifier, '', '', 'full'); |
6197 | - $table[] = array('Resource', '[' . $this->documentIdentifier . '] <a href="' . $url . '" target="_blank">' . $resource['pagetitle'] . '</a>'); |
|
6197 | + $table[] = array('Resource', '['.$this->documentIdentifier.'] <a href="'.$url.'" target="_blank">'.$resource['pagetitle'].'</a>'); |
|
6198 | 6198 | } |
6199 | 6199 | $table[] = array('Referer', $referer); |
6200 | 6200 | $table[] = array('User Agent', $ua); |
@@ -6215,7 +6215,7 @@ discard block |
||
6215 | 6215 | |
6216 | 6216 | $mem = memory_get_peak_usage(true); |
6217 | 6217 | $total_mem = $mem - $this->mstart; |
6218 | - $total_mem = ($total_mem / 1024 / 1024) . ' mb'; |
|
6218 | + $total_mem = ($total_mem / 1024 / 1024).' mb'; |
|
6219 | 6219 | |
6220 | 6220 | $queryTime = $this->queryTime; |
6221 | 6221 | $phpTime = $totalTime - $queryTime; |
@@ -6236,18 +6236,18 @@ discard block |
||
6236 | 6236 | $str .= $this->get_backtrace(debug_backtrace()); |
6237 | 6237 | // Log error |
6238 | 6238 | if (!empty($this->currentSnippet)) { |
6239 | - $source = 'Snippet - ' . $this->currentSnippet; |
|
6239 | + $source = 'Snippet - '.$this->currentSnippet; |
|
6240 | 6240 | } elseif (!empty($this->event->activePlugin)) { |
6241 | - $source = 'Plugin - ' . $this->event->activePlugin; |
|
6241 | + $source = 'Plugin - '.$this->event->activePlugin; |
|
6242 | 6242 | } elseif ($source !== '') { |
6243 | - $source = 'Parser - ' . $source; |
|
6243 | + $source = 'Parser - '.$source; |
|
6244 | 6244 | } elseif ($query !== '') { |
6245 | 6245 | $source = 'SQL Query'; |
6246 | 6246 | } else { |
6247 | 6247 | $source = 'Parser'; |
6248 | 6248 | } |
6249 | 6249 | if ($msg) { |
6250 | - $source .= ' / ' . $msg; |
|
6250 | + $source .= ' / '.$msg; |
|
6251 | 6251 | } |
6252 | 6252 | if (isset($actionName) && !empty($actionName)) { |
6253 | 6253 | $source .= $actionName; |
@@ -6279,12 +6279,12 @@ discard block |
||
6279 | 6279 | |
6280 | 6280 | // Display error |
6281 | 6281 | if (isset($_SESSION['mgrValidated'])) { |
6282 | - 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> |
|
6282 | + 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> |
|
6283 | 6283 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
6284 | - <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'] . 'media/style/' . $this->config['manager_theme'] . '/style.css" /> |
|
6284 | + <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'].'media/style/'.$this->config['manager_theme'].'/style.css" /> |
|
6285 | 6285 | <style type="text/css">body { padding:10px; } td {font:inherit;}</style> |
6286 | 6286 | </head><body> |
6287 | - ' . $str . '</body></html>'; |
|
6287 | + ' . $str.'</body></html>'; |
|
6288 | 6288 | |
6289 | 6289 | } else { |
6290 | 6290 | echo 'Error'; |
@@ -6322,7 +6322,7 @@ discard block |
||
6322 | 6322 | switch ($val['type']) { |
6323 | 6323 | case '->': |
6324 | 6324 | case '::': |
6325 | - $functionName = $val['function'] = $val['class'] . $val['type'] . $val['function']; |
|
6325 | + $functionName = $val['function'] = $val['class'].$val['type'].$val['function']; |
|
6326 | 6326 | break; |
6327 | 6327 | default: |
6328 | 6328 | $functionName = $val['function']; |
@@ -6332,7 +6332,7 @@ discard block |
||
6332 | 6332 | $args = array_pad(array(), $_, '$var'); |
6333 | 6333 | $args = implode(", ", $args); |
6334 | 6334 | $modx = &$this; |
6335 | - $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) { |
|
6335 | + $args = preg_replace_callback('/\$var/', function() use ($modx, &$tmp, $val) { |
|
6336 | 6336 | $arg = $val['args'][$tmp - 1]; |
6337 | 6337 | switch (true) { |
6338 | 6338 | case is_null($arg): { |
@@ -6344,7 +6344,7 @@ discard block |
||
6344 | 6344 | break; |
6345 | 6345 | } |
6346 | 6346 | case is_scalar($arg): { |
6347 | - $out = strlen($arg) > 20 ? 'string $var' . $tmp : ("'" . $this->htmlspecialchars(str_replace("'", "\\'", $arg)) . "'"); |
|
6347 | + $out = strlen($arg) > 20 ? 'string $var'.$tmp : ("'".$this->htmlspecialchars(str_replace("'", "\\'", $arg))."'"); |
|
6348 | 6348 | break; |
6349 | 6349 | } |
6350 | 6350 | case is_bool($arg): { |
@@ -6352,23 +6352,23 @@ discard block |
||
6352 | 6352 | break; |
6353 | 6353 | } |
6354 | 6354 | case is_array($arg): { |
6355 | - $out = 'array $var' . $tmp; |
|
6355 | + $out = 'array $var'.$tmp; |
|
6356 | 6356 | break; |
6357 | 6357 | } |
6358 | 6358 | case is_object($arg): { |
6359 | - $out = get_class($arg) . ' $var' . $tmp; |
|
6359 | + $out = get_class($arg).' $var'.$tmp; |
|
6360 | 6360 | break; |
6361 | 6361 | } |
6362 | 6362 | default: { |
6363 | - $out = '$var' . $tmp; |
|
6363 | + $out = '$var'.$tmp; |
|
6364 | 6364 | } |
6365 | 6365 | } |
6366 | 6366 | $tmp++; |
6367 | 6367 | return $out; |
6368 | 6368 | }, $args); |
6369 | 6369 | $line = array( |
6370 | - "<strong>" . $functionName . "</strong>(" . $args . ")", |
|
6371 | - $path . " on line " . $val['line'] |
|
6370 | + "<strong>".$functionName."</strong>(".$args.")", |
|
6371 | + $path." on line ".$val['line'] |
|
6372 | 6372 | ); |
6373 | 6373 | $table[] = array(implode("<br />", $line)); |
6374 | 6374 | } |
@@ -6409,7 +6409,7 @@ discard block |
||
6409 | 6409 | $alias = strip_tags($alias); // strip HTML |
6410 | 6410 | $alias = preg_replace('/[^\.A-Za-z0-9 _-]/', '', $alias); // strip non-alphanumeric characters |
6411 | 6411 | $alias = preg_replace('/\s+/', '-', $alias); // convert white-space to dash |
6412 | - $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one |
|
6412 | + $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one |
|
6413 | 6413 | $alias = trim($alias, '-'); // trim excess |
6414 | 6414 | return $alias; |
6415 | 6415 | } |
@@ -6425,7 +6425,7 @@ discard block |
||
6425 | 6425 | $precisions = count($sizes) - 1; |
6426 | 6426 | foreach ($sizes as $unit => $bytes) { |
6427 | 6427 | if ($size >= $bytes) { |
6428 | - return number_format($size / $bytes, $precisions) . ' ' . $unit; |
|
6428 | + return number_format($size / $bytes, $precisions).' '.$unit; |
|
6429 | 6429 | } |
6430 | 6430 | $precisions--; |
6431 | 6431 | } |
@@ -6529,10 +6529,10 @@ discard block |
||
6529 | 6529 | |
6530 | 6530 | if (strpos($str, MODX_MANAGER_PATH) === 0) { |
6531 | 6531 | return false; |
6532 | - } elseif (is_file(MODX_BASE_PATH . $str)) { |
|
6533 | - $file_path = MODX_BASE_PATH . $str; |
|
6534 | - } elseif (is_file(MODX_BASE_PATH . "{$tpl_dir}{$str}")) { |
|
6535 | - $file_path = MODX_BASE_PATH . $tpl_dir . $str; |
|
6532 | + } elseif (is_file(MODX_BASE_PATH.$str)) { |
|
6533 | + $file_path = MODX_BASE_PATH.$str; |
|
6534 | + } elseif (is_file(MODX_BASE_PATH."{$tpl_dir}{$str}")) { |
|
6535 | + $file_path = MODX_BASE_PATH.$tpl_dir.$str; |
|
6536 | 6536 | } else { |
6537 | 6537 | return false; |
6538 | 6538 | } |
@@ -6658,7 +6658,7 @@ discard block |
||
6658 | 6658 | $title = 'no title'; |
6659 | 6659 | } |
6660 | 6660 | if (is_array($msg)) { |
6661 | - $msg = '<pre>' . print_r($msg, true) . '</pre>'; |
|
6661 | + $msg = '<pre>'.print_r($msg, true).'</pre>'; |
|
6662 | 6662 | } elseif ($msg === '') { |
6663 | 6663 | $msg = $_SERVER['REQUEST_URI']; |
6664 | 6664 | } |
@@ -6703,7 +6703,7 @@ discard block |
||
6703 | 6703 | if (is_array($SystemAlertMsgQueque)) { |
6704 | 6704 | $title = ''; |
6705 | 6705 | if ($this->name && $this->activePlugin) { |
6706 | - $title = "<div><b>" . $this->activePlugin . "</b> - <span style='color:maroon;'>" . $this->name . "</span></div>"; |
|
6706 | + $title = "<div><b>".$this->activePlugin."</b> - <span style='color:maroon;'>".$this->name."</span></div>"; |
|
6707 | 6707 | } |
6708 | 6708 | $SystemAlertMsgQueque[] = "$title<div style='margin-left:10px;margin-top:3px;'>$msg</div>"; |
6709 | 6709 | } |
@@ -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', |
@@ -88,7 +88,7 @@ |
||
88 | 88 | } |
89 | 89 | </script> |
90 | 90 | |
91 | -JS; |
|
91 | +js; |
|
92 | 92 | $modx->regClientScript($script); |
93 | 93 | } |
94 | 94 | } |
@@ -5,14 +5,14 @@ discard block |
||
5 | 5 | |
6 | 6 | // PROCESSOR FIRST |
7 | 7 | if($_SESSION['mgrRole'] == 1) { |
8 | - if($_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) { |
|
9 | - $current = $modx->manager->getSystemChecksum($modx->config['check_files_onlogin']); |
|
10 | - if(!empty($current)) { |
|
11 | - $modx->manager->setSystemChecksum($current); |
|
12 | - $modx->clearCache('full'); |
|
13 | - $modx->config['sys_files_checksum'] = $current; |
|
14 | - }; |
|
15 | - } |
|
8 | + if($_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) { |
|
9 | + $current = $modx->manager->getSystemChecksum($modx->config['check_files_onlogin']); |
|
10 | + if(!empty($current)) { |
|
11 | + $modx->manager->setSystemChecksum($current); |
|
12 | + $modx->clearCache('full'); |
|
13 | + $modx->config['sys_files_checksum'] = $current; |
|
14 | + }; |
|
15 | + } |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | // NOW CHECK CONFIG |
@@ -20,15 +20,15 @@ discard block |
||
20 | 20 | |
21 | 21 | $sysfiles_check = $modx->manager->checkSystemChecksum(); |
22 | 22 | if ($sysfiles_check!=='0'){ |
23 | - $warningspresent = 1; |
|
24 | - $warnings[] = array($_lang['configcheck_sysfiles_mod']); |
|
23 | + $warningspresent = 1; |
|
24 | + $warnings[] = array($_lang['configcheck_sysfiles_mod']); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | if (is_writable("includes/config.inc.php")){ |
28 | 28 | // Warn if world writable |
29 | 29 | if(@fileperms('includes/config.inc.php') & 0x0002) { |
30 | - $warningspresent = 1; |
|
31 | - $warnings[] = array($_lang['configcheck_configinc']); |
|
30 | + $warningspresent = 1; |
|
31 | + $warnings[] = array($_lang['configcheck_configinc']); |
|
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
@@ -179,10 +179,10 @@ discard block |
||
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>'. implode('</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 | - } |
|
182 | + $warnings[$i][2] = '<ul><li>'. implode('</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 | + } |
|
186 | 186 | if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1]." ".implode(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']); |
187 | 187 | break; |
188 | 188 | case $_lang['configcheck_lang_difference'] : |
@@ -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']; |
@@ -120,36 +120,36 @@ discard block |
||
120 | 120 | /** |
121 | 121 | * @return bool |
122 | 122 | */ |
123 | - function checkSiteCache() { |
|
123 | + function checkSiteCache(){ |
|
124 | 124 | global $modx; |
125 | - $checked= true; |
|
126 | - if (file_exists($modx->config['base_path'] . 'assets/cache/siteCache.idx.php')) { |
|
127 | - $checked= @include_once ($modx->config['base_path'] . 'assets/cache/siteCache.idx.php'); |
|
125 | + $checked = true; |
|
126 | + if (file_exists($modx->config['base_path'].'assets/cache/siteCache.idx.php')) { |
|
127 | + $checked = @include_once ($modx->config['base_path'].'assets/cache/siteCache.idx.php'); |
|
128 | 128 | } |
129 | 129 | return $checked; |
130 | 130 | } |
131 | 131 | } |
132 | 132 | |
133 | -if (!is_writable(MODX_BASE_PATH . "assets/cache/")) { |
|
133 | +if (!is_writable(MODX_BASE_PATH."assets/cache/")) { |
|
134 | 134 | $warningspresent = 1; |
135 | 135 | $warnings[] = array($_lang['configcheck_cache']); |
136 | 136 | } |
137 | 137 | |
138 | 138 | if (!checkSiteCache()) { |
139 | 139 | $warningspresent = 1; |
140 | - $warnings[]= array($lang['configcheck_sitecache_integrity']); |
|
140 | + $warnings[] = array($lang['configcheck_sitecache_integrity']); |
|
141 | 141 | } |
142 | 142 | |
143 | -if (!is_writable(MODX_BASE_PATH . "assets/images/")) { |
|
143 | +if (!is_writable(MODX_BASE_PATH."assets/images/")) { |
|
144 | 144 | $warningspresent = 1; |
145 | 145 | $warnings[] = array($_lang['configcheck_images']); |
146 | 146 | } |
147 | 147 | |
148 | -if(strpos($modx->config['rb_base_dir'],MODX_BASE_PATH)!==0) { |
|
148 | +if (strpos($modx->config['rb_base_dir'], MODX_BASE_PATH) !== 0) { |
|
149 | 149 | $warningspresent = 1; |
150 | 150 | $warnings[] = array($_lang['configcheck_rb_base_dir']); |
151 | 151 | } |
152 | -if(strpos($modx->config['filemanager_path'],MODX_BASE_PATH)!==0) { |
|
152 | +if (strpos($modx->config['filemanager_path'], MODX_BASE_PATH) !== 0) { |
|
153 | 153 | $warningspresent = 1; |
154 | 154 | $warnings[] = array($_lang['configcheck_filemanager_path']); |
155 | 155 | } |
@@ -157,36 +157,36 @@ discard block |
||
157 | 157 | // clear file info cache |
158 | 158 | clearstatcache(); |
159 | 159 | |
160 | -if ($warningspresent==1) { |
|
160 | +if ($warningspresent == 1) { |
|
161 | 161 | |
162 | -if(!isset($modx->config['send_errormail'])) $modx->config['send_errormail']='3'; |
|
162 | +if (!isset($modx->config['send_errormail'])) $modx->config['send_errormail'] = '3'; |
|
163 | 163 | $config_check_results = "<h3>".$_lang['configcheck_notok']."</h3>"; |
164 | 164 | |
165 | -for ($i=0;$i<count($warnings);$i++) { |
|
165 | +for ($i = 0; $i < count($warnings); $i++) { |
|
166 | 166 | switch ($warnings[$i][0]) { |
167 | 167 | case $_lang['configcheck_configinc']; |
168 | 168 | $warnings[$i][1] = $_lang['configcheck_configinc_msg']; |
169 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_configinc']); |
|
169 | + if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 3, $warnings[$i][1], $_lang['configcheck_configinc']); |
|
170 | 170 | break; |
171 | 171 | case $_lang['configcheck_installer'] : |
172 | 172 | $warnings[$i][1] = $_lang['configcheck_installer_msg']; |
173 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_installer']); |
|
173 | + if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 3, $warnings[$i][1], $_lang['configcheck_installer']); |
|
174 | 174 | break; |
175 | 175 | case $_lang['configcheck_cache'] : |
176 | 176 | $warnings[$i][1] = $_lang['configcheck_cache_msg']; |
177 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_cache']); |
|
177 | + if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 2, $warnings[$i][1], $_lang['configcheck_cache']); |
|
178 | 178 | break; |
179 | 179 | case $_lang['configcheck_images'] : |
180 | 180 | $warnings[$i][1] = $_lang['configcheck_images_msg']; |
181 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_images']); |
|
181 | + if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 2, $warnings[$i][1], $_lang['configcheck_images']); |
|
182 | 182 | break; |
183 | 183 | case $_lang['configcheck_sysfiles_mod']: |
184 | 184 | $warnings[$i][1] = $_lang["configcheck_sysfiles_mod_msg"]; |
185 | - $warnings[$i][2] = '<ul><li>'. implode('</li><li>', $sysfiles_check) .'</li></ul>'; |
|
186 | - if($modx->hasPermission('settings')) { |
|
187 | - $warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\'' . $_lang["reset_sysfiles_checksum_alert"] . '\')">' . $_lang["reset_sysfiles_checksum_button"] . '</a></li></ul>'; |
|
185 | + $warnings[$i][2] = '<ul><li>'.implode('</li><li>', $sysfiles_check).'</li></ul>'; |
|
186 | + if ($modx->hasPermission('settings')) { |
|
187 | + $warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\''.$_lang["reset_sysfiles_checksum_alert"].'\')">'.$_lang["reset_sysfiles_checksum_button"].'</a></li></ul>'; |
|
188 | 188 | } |
189 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1]." ".implode(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']); |
|
189 | + if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 3, $warnings[$i][1]." ".implode(', ', $sysfiles_check), $_lang['configcheck_sysfiles_mod']); |
|
190 | 190 | break; |
191 | 191 | case $_lang['configcheck_lang_difference'] : |
192 | 192 | $warnings[$i][1] = $_lang['configcheck_lang_difference_msg']; |
@@ -208,18 +208,18 @@ discard block |
||
208 | 208 | break; |
209 | 209 | case $_lang['configcheck_validate_referer'] : |
210 | 210 | $msg = $_lang['configcheck_validate_referer_msg']; |
211 | - $msg .= '<br />' . sprintf($_lang["configcheck_hide_warning"], 'validate_referer'); |
|
211 | + $msg .= '<br />'.sprintf($_lang["configcheck_hide_warning"], 'validate_referer'); |
|
212 | 212 | $warnings[$i][1] = "<span id=\"validate_referer_warning_wrapper\">{$msg}</span>\n"; |
213 | 213 | break; |
214 | 214 | case $_lang['configcheck_templateswitcher_present'] : |
215 | 215 | $msg = $_lang["configcheck_templateswitcher_present_msg"]; |
216 | - if(isset($_SESSION['mgrPermissions']['save_plugin']) && $_SESSION['mgrPermissions']['save_plugin'] == '1') { |
|
217 | - $msg .= '<br />' . $_lang["configcheck_templateswitcher_present_disable"]; |
|
216 | + if (isset($_SESSION['mgrPermissions']['save_plugin']) && $_SESSION['mgrPermissions']['save_plugin'] == '1') { |
|
217 | + $msg .= '<br />'.$_lang["configcheck_templateswitcher_present_disable"]; |
|
218 | 218 | } |
219 | - if(isset($_SESSION['mgrPermissions']['delete_plugin']) && $_SESSION['mgrPermissions']['delete_plugin'] == '1') { |
|
220 | - $msg .= '<br />' . $_lang["configcheck_templateswitcher_present_delete"]; |
|
219 | + if (isset($_SESSION['mgrPermissions']['delete_plugin']) && $_SESSION['mgrPermissions']['delete_plugin'] == '1') { |
|
220 | + $msg .= '<br />'.$_lang["configcheck_templateswitcher_present_delete"]; |
|
221 | 221 | } |
222 | - $msg .= '<br />' . sprintf($_lang["configcheck_hide_warning"], 'templateswitcher_present'); |
|
222 | + $msg .= '<br />'.sprintf($_lang["configcheck_hide_warning"], 'templateswitcher_present'); |
|
223 | 223 | $warnings[$i][1] = "<span id=\"templateswitcher_present_warning_wrapper\">{$msg}</span>\n"; |
224 | 224 | break; |
225 | 225 | case $_lang['configcheck_rb_base_dir'] : |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | $warnings[$i][1] = $_lang['configcheck_default_msg']; |
233 | 233 | } |
234 | 234 | |
235 | - $admin_warning = $_SESSION['mgrRole']!=1 ? $_lang['configcheck_admin'] : "" ; |
|
235 | + $admin_warning = $_SESSION['mgrRole'] != 1 ? $_lang['configcheck_admin'] : ""; |
|
236 | 236 | $config_check_results .= " |
237 | 237 | <fieldset> |
238 | 238 | <p><strong>".$_lang['configcheck_warning']."</strong> '".$warnings[$i][0]."'</p> |
@@ -241,11 +241,11 @@ discard block |
||
241 | 241 | ".(isset($warnings[$i][2]) ? '<div style="padding-left:1em">'.$warnings[$i][2].'</div>' : '')." |
242 | 242 | </fieldset> |
243 | 243 | "; |
244 | - if ($i!=count($warnings)-1) { |
|
244 | + if ($i != count($warnings) - 1) { |
|
245 | 245 | $config_check_results .= "<br />"; |
246 | 246 | } |
247 | 247 | } |
248 | - $_SESSION["mgrConfigCheck"]=true; |
|
248 | + $_SESSION["mgrConfigCheck"] = true; |
|
249 | 249 | } else { |
250 | 250 | $config_check_results = $_lang['configcheck_ok']; |
251 | 251 | } |
@@ -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; |
@@ -120,7 +120,8 @@ discard block |
||
120 | 120 | /** |
121 | 121 | * @return bool |
122 | 122 | */ |
123 | - function checkSiteCache() { |
|
123 | + function checkSiteCache() |
|
124 | + { |
|
124 | 125 | global $modx; |
125 | 126 | $checked= true; |
126 | 127 | if (file_exists($modx->config['base_path'] . 'assets/cache/siteCache.idx.php')) { |
@@ -159,26 +160,36 @@ discard block |
||
159 | 160 | |
160 | 161 | if ($warningspresent==1) { |
161 | 162 | |
162 | -if(!isset($modx->config['send_errormail'])) $modx->config['send_errormail']='3'; |
|
163 | +if(!isset($modx->config['send_errormail'])) { |
|
164 | + $modx->config['send_errormail']='3'; |
|
165 | +} |
|
163 | 166 | $config_check_results = "<h3>".$_lang['configcheck_notok']."</h3>"; |
164 | 167 | |
165 | 168 | for ($i=0;$i<count($warnings);$i++) { |
166 | 169 | switch ($warnings[$i][0]) { |
167 | 170 | case $_lang['configcheck_configinc']; |
168 | 171 | $warnings[$i][1] = $_lang['configcheck_configinc_msg']; |
169 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_configinc']); |
|
172 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
173 | + $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_configinc']); |
|
174 | + } |
|
170 | 175 | break; |
171 | 176 | case $_lang['configcheck_installer'] : |
172 | 177 | $warnings[$i][1] = $_lang['configcheck_installer_msg']; |
173 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_installer']); |
|
178 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
179 | + $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_installer']); |
|
180 | + } |
|
174 | 181 | break; |
175 | 182 | case $_lang['configcheck_cache'] : |
176 | 183 | $warnings[$i][1] = $_lang['configcheck_cache_msg']; |
177 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_cache']); |
|
184 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
185 | + $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_cache']); |
|
186 | + } |
|
178 | 187 | break; |
179 | 188 | case $_lang['configcheck_images'] : |
180 | 189 | $warnings[$i][1] = $_lang['configcheck_images_msg']; |
181 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_images']); |
|
190 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
191 | + $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_images']); |
|
192 | + } |
|
182 | 193 | break; |
183 | 194 | case $_lang['configcheck_sysfiles_mod']: |
184 | 195 | $warnings[$i][1] = $_lang["configcheck_sysfiles_mod_msg"]; |
@@ -186,7 +197,9 @@ discard block |
||
186 | 197 | if($modx->hasPermission('settings')) { |
187 | 198 | $warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\'' . $_lang["reset_sysfiles_checksum_alert"] . '\')">' . $_lang["reset_sysfiles_checksum_button"] . '</a></li></ul>'; |
188 | 199 | } |
189 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1]." ".implode(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']); |
|
200 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
201 | + $modx->logEvent(0,3,$warnings[$i][1]." ".implode(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']); |
|
202 | + } |
|
190 | 203 | break; |
191 | 204 | case $_lang['configcheck_lang_difference'] : |
192 | 205 | $warnings[$i][1] = $_lang['configcheck_lang_difference_msg']; |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | |
4 | 4 | // show debug information |
5 | 5 | if(isset($enable_debug) && $enable_debug==true) { |
6 | - ?> |
|
6 | + ?> |
|
7 | 7 | <script language="javascript"> |
8 | 8 | //document.onload = removeDebug(); |
9 | 9 | |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | } |
34 | 34 | </style> |
35 | 35 | <?php |
36 | - $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $tend = $mtime; $totaltime = ($tend - $tstart); |
|
37 | - ?> |
|
36 | + $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $tend = $mtime; $totaltime = ($tend - $tstart); |
|
37 | + ?> |
|
38 | 38 | <div class='debug' id='debug' name='debug' onClick="removeDebugDiv();"> |
39 | 39 | <table border="0" cellspacing="0" cellpadding="0"> |
40 | 40 | <tr> |
@@ -1,10 +1,10 @@ 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 | // show debug information |
7 | -if(isset($enable_debug) && $enable_debug==true) { |
|
7 | +if (isset($enable_debug) && $enable_debug == true) { |
|
8 | 8 | ?> |
9 | 9 | <script language="javascript"> |
10 | 10 | //document.onload = removeDebug(); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | } |
36 | 36 | </style> |
37 | 37 | <?php |
38 | - $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $tend = $mtime; $totaltime = ($tend - $tstart); |
|
38 | + $mtime = microtime(); $mtime = explode(" ", $mtime); $mtime = $mtime[1] + $mtime[0]; $tend = $mtime; $totaltime = ($tend - $tstart); |
|
39 | 39 | ?> |
40 | 40 | <div class='debug' id='debug' name='debug' onClick="removeDebugDiv();"> |
41 | 41 | <table border="0" cellspacing="0" cellpadding="0"> |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | </tr> |
45 | 45 | <tr> |
46 | 46 | <td width="70">Time taken</td> |
47 | - <td width="80"><?php echo printf ("%6.5f s", $totaltime); ?></td> |
|
47 | + <td width="80"><?php echo printf("%6.5f s", $totaltime); ?></td> |
|
48 | 48 | </tr> |
49 | 49 | </table> |
50 | 50 | </div> |