@@ -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 | { |
@@ -22,14 +22,14 @@ 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 | 27 | $modx = evolutionCMS(); |
28 | - $docid = (int)$docid > 0 ? (int)$docid : $modx->documentIdentifier; |
|
28 | + $docid = (int) $docid > 0 ? (int) $docid : $modx->documentIdentifier; |
|
29 | 29 | $nvalue = trim($value); |
30 | 30 | if (substr($nvalue, 0, 1) != '@') { |
31 | 31 | return $value; |
32 | - } elseif (isset($modx->config['enable_bindings']) && $modx->config['enable_bindings']!=1 && $src==='docform') { |
|
32 | + } elseif (isset($modx->config['enable_bindings']) && $modx->config['enable_bindings'] != 1 && $src === 'docform') { |
|
33 | 33 | return '@Bindings is disabled.'; |
34 | 34 | } else { |
35 | 35 | list($cmd, $param) = ParseCommand($nvalue); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | case 'DIRECTORY': |
101 | 101 | $files = array(); |
102 | - $path = $modx->config['base_path'] . $param; |
|
102 | + $path = $modx->config['base_path'].$param; |
|
103 | 103 | if (substr($path, -1, 1) != '/') { |
104 | 104 | $path .= '/'; |
105 | 105 | } |
@@ -152,9 +152,9 @@ discard block |
||
152 | 152 | global $BINDINGS; |
153 | 153 | $binding_array = array(); |
154 | 154 | foreach ($BINDINGS as $cmd) { |
155 | - if (strpos($binding_string, '@' . $cmd)===0) { |
|
156 | - $code = substr($binding_string, strlen($cmd)+1); |
|
157 | - $binding_array = array($cmd,trim($code)); |
|
155 | + if (strpos($binding_string, '@'.$cmd) === 0) { |
|
156 | + $code = substr($binding_string, strlen($cmd) + 1); |
|
157 | + $binding_array = array($cmd, trim($code)); |
|
158 | 158 | break; |
159 | 159 | } |
160 | 160 | } |
@@ -175,12 +175,12 @@ discard block |
||
175 | 175 | if (strpos($param, '[*') !== false) { |
176 | 176 | $matches = $modx->getTagsFromContent($param, '[*', '*]'); |
177 | 177 | foreach ($matches[0] as $i=>$match) { |
178 | - if (isset($tvsArray[ $matches[1][$i] ])) { |
|
179 | - if (is_array($tvsArray[ $matches[1][$i] ])) { |
|
178 | + if (isset($tvsArray[$matches[1][$i]])) { |
|
179 | + if (is_array($tvsArray[$matches[1][$i]])) { |
|
180 | 180 | $value = $tvsArray[$matches[1][$i]]['value']; |
181 | 181 | $value = $value === '' ? $tvsArray[$matches[1][$i]]['default_text'] : $value; |
182 | 182 | } else { |
183 | - $value = $tvsArray[ $matches[1][$i] ]; |
|
183 | + $value = $tvsArray[$matches[1][$i]]; |
|
184 | 184 | } |
185 | 185 | $param = str_replace($match, $value, $param); |
186 | 186 | } |
@@ -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))) { |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | * MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php" |
277 | 277 | * $extname - extension name in lowercase |
278 | 278 | * |
279 | - * @param $extname |
|
279 | + * @param string $extname |
|
280 | 280 | * @param bool $reload |
281 | 281 | * @return bool |
282 | 282 | */ |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | * @param int $count_attempts |
320 | 320 | * @param string $type $type |
321 | 321 | * @param string $responseCode |
322 | - * @return bool|null |
|
322 | + * @return false|null |
|
323 | 323 | * @global string $base_url |
324 | 324 | * @global string $site_url |
325 | 325 | */ |
@@ -1021,7 +1021,7 @@ discard block |
||
1021 | 1021 | } |
1022 | 1022 | |
1023 | 1023 | /** |
1024 | - * @param $contents |
|
1024 | + * @param string $contents |
|
1025 | 1025 | * @return mixed |
1026 | 1026 | */ |
1027 | 1027 | public function RecoveryEscapedTags($contents) |
@@ -1045,7 +1045,7 @@ discard block |
||
1045 | 1045 | } |
1046 | 1046 | |
1047 | 1047 | /** |
1048 | - * @param $tstart |
|
1048 | + * @param double $tstart |
|
1049 | 1049 | * @return array |
1050 | 1050 | */ |
1051 | 1051 | public function getTimerStats($tstart) |
@@ -1813,7 +1813,7 @@ discard block |
||
1813 | 1813 | |
1814 | 1814 | /** |
1815 | 1815 | * Remove Comment-Tags from output like <!--@- Comment -@--> |
1816 | - * @param $content |
|
1816 | + * @param string $content |
|
1817 | 1817 | * @param string $left |
1818 | 1818 | * @param string $right |
1819 | 1819 | * @return mixed |
@@ -1986,7 +1986,7 @@ discard block |
||
1986 | 1986 | /** |
1987 | 1987 | * Run snippets as per the tags in $documentSource and replace the tags with the returned values. |
1988 | 1988 | * |
1989 | - * @param $content |
|
1989 | + * @param string $content |
|
1990 | 1990 | * @return string |
1991 | 1991 | * @internal param string $documentSource |
1992 | 1992 | */ |
@@ -3022,7 +3022,7 @@ discard block |
||
3022 | 3022 | |
3023 | 3023 | /** |
3024 | 3024 | * @param $templateID |
3025 | - * @return mixed |
|
3025 | + * @return string |
|
3026 | 3026 | */ |
3027 | 3027 | public function _getTemplateCodeFromDB($templateID) |
3028 | 3028 | { |
@@ -3065,7 +3065,7 @@ discard block |
||
3065 | 3065 | /** |
3066 | 3066 | * @param $id |
3067 | 3067 | * @param int $top |
3068 | - * @return mixed |
|
3068 | + * @return string |
|
3069 | 3069 | */ |
3070 | 3070 | public function getUltimateParentId($id, $top = 0) |
3071 | 3071 | { |
@@ -3396,7 +3396,7 @@ discard block |
||
3396 | 3396 | * |
3397 | 3397 | * @param int $type Types: 1=template, 2=tv, 3=chunk, 4=snippet, 5=plugin, 6=module, 7=resource, 8=role |
3398 | 3398 | * @param int $id Element- / Resource-id |
3399 | - * @return bool |
|
3399 | + * @return false|null |
|
3400 | 3400 | */ |
3401 | 3401 | public function lockElement($type, $id) |
3402 | 3402 | { |
@@ -3418,7 +3418,7 @@ discard block |
||
3418 | 3418 | * @param int $type Types: 1=template, 2=tv, 3=chunk, 4=snippet, 5=plugin, 6=module, 7=resource, 8=role |
3419 | 3419 | * @param int $id Element- / Resource-id |
3420 | 3420 | * @param bool $includeAllUsers true = Deletes not only own user-locks |
3421 | - * @return bool |
|
3421 | + * @return false|null |
|
3422 | 3422 | */ |
3423 | 3423 | public function unlockElement($type, $id, $includeAllUsers = false) |
3424 | 3424 | { |
@@ -3526,7 +3526,7 @@ discard block |
||
3526 | 3526 | * @param array $params |
3527 | 3527 | * @param string $msg |
3528 | 3528 | * @param array $files |
3529 | - * @return mixed |
|
3529 | + * @return boolean |
|
3530 | 3530 | */ |
3531 | 3531 | public function sendmail($params = array(), $msg = '', $files = array()) |
3532 | 3532 | { |
@@ -3930,7 +3930,7 @@ discard block |
||
3930 | 3930 | * Default: 1 |
3931 | 3931 | * @param string $fields List of fields |
3932 | 3932 | * Default: id, pagetitle, description, alias |
3933 | - * @return boolean|array |
|
3933 | + * @return string |
|
3934 | 3934 | */ |
3935 | 3935 | public function getPageInfo($pageid = -1, $active = 1, $fields = 'id, pagetitle, description, alias') |
3936 | 3936 | { |
@@ -4022,7 +4022,7 @@ discard block |
||
4022 | 4022 | * |
4023 | 4023 | * @param string $type |
4024 | 4024 | * @param bool $report |
4025 | - * @return bool |
|
4025 | + * @return boolean|null |
|
4026 | 4026 | */ |
4027 | 4027 | public function clearCache($type = '', $report = false) |
4028 | 4028 | { |
@@ -4389,7 +4389,7 @@ discard block |
||
4389 | 4389 | * - Placeholders prefix. Default: '{'. |
4390 | 4390 | * @param string $suffix {string} |
4391 | 4391 | * - Placeholders suffix. Default: '}'. |
4392 | - * @return bool|mixed|string {string; false} - Parsed chunk or false if $chunkArr is not array. |
|
4392 | + * @return false|string {string; false} - Parsed chunk or false if $chunkArr is not array. |
|
4393 | 4393 | * - Parsed chunk or false if $chunkArr is not array. |
4394 | 4394 | */ |
4395 | 4395 | public function parseChunk($chunkName, $chunkArr, $prefix = '{', $suffix = '}') |
@@ -5365,7 +5365,7 @@ discard block |
||
5365 | 5365 | * Remove event listener - only for use within the current execution cycle |
5366 | 5366 | * |
5367 | 5367 | * @param string $evtName |
5368 | - * @return boolean |
|
5368 | + * @return false|null |
|
5369 | 5369 | */ |
5370 | 5370 | public function removeEventListener($evtName) |
5371 | 5371 | { |
@@ -5389,7 +5389,7 @@ discard block |
||
5389 | 5389 | * |
5390 | 5390 | * @param string $evtName |
5391 | 5391 | * @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. |
5392 | - * @return boolean|array |
|
5392 | + * @return false|null |
|
5393 | 5393 | */ |
5394 | 5394 | public function invokeEvent($evtName, $extParams = array()) |
5395 | 5395 | { |
@@ -5988,7 +5988,7 @@ discard block |
||
5988 | 5988 | |
5989 | 5989 | /** |
5990 | 5990 | * @param string $str |
5991 | - * @return bool|mixed|string |
|
5991 | + * @return string |
|
5992 | 5992 | */ |
5993 | 5993 | public function atBindFileContent($str = '') |
5994 | 5994 | { |
@@ -6039,8 +6039,8 @@ discard block |
||
6039 | 6039 | } |
6040 | 6040 | |
6041 | 6041 | /** |
6042 | - * @param $str |
|
6043 | - * @return bool|string |
|
6042 | + * @param string $str |
|
6043 | + * @return false|string |
|
6044 | 6044 | */ |
6045 | 6045 | public function getExtFromFilename($str) |
6046 | 6046 | { |
@@ -6068,7 +6068,7 @@ discard block |
||
6068 | 6068 | * @param string $text Error message |
6069 | 6069 | * @param string $file File where the error was detected |
6070 | 6070 | * @param string $line Line number within $file |
6071 | - * @return boolean |
|
6071 | + * @return boolean|null |
|
6072 | 6072 | */ |
6073 | 6073 | public function phpError($nr, $text, $file, $line) |
6074 | 6074 | { |
@@ -6120,7 +6120,7 @@ discard block |
||
6120 | 6120 | * @param string $text |
6121 | 6121 | * @param string $line |
6122 | 6122 | * @param string $output |
6123 | - * @return bool |
|
6123 | + * @return null|boolean |
|
6124 | 6124 | */ |
6125 | 6125 | public function messageQuit($msg = 'unspecified error', $query = '', $is_error = true, $nr = '', $file = '', $source = '', $text = '', $line = '', $output = '') |
6126 | 6126 | { |
@@ -6542,7 +6542,7 @@ discard block |
||
6542 | 6542 | |
6543 | 6543 | /** |
6544 | 6544 | * @param string $str |
6545 | - * @return bool|mixed|string |
|
6545 | + * @return string |
|
6546 | 6546 | */ |
6547 | 6547 | public function atBindInclude($str = '') |
6548 | 6548 | { |
@@ -6593,7 +6593,7 @@ discard block |
||
6593 | 6593 | * @param $str |
6594 | 6594 | * @param int $flags |
6595 | 6595 | * @param string $encode |
6596 | - * @return mixed |
|
6596 | + * @return string |
|
6597 | 6597 | */ |
6598 | 6598 | public function htmlspecialchars($str, $flags = ENT_COMPAT, $encode = '') |
6599 | 6599 | { |
@@ -6602,7 +6602,7 @@ discard block |
||
6602 | 6602 | } |
6603 | 6603 | |
6604 | 6604 | /** |
6605 | - * @param $string |
|
6605 | + * @param string $string |
|
6606 | 6606 | * @param bool $returnData |
6607 | 6607 | * @return bool|mixed |
6608 | 6608 | */ |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | */ |
226 | 226 | public function __call($method_name, $arguments) |
227 | 227 | { |
228 | - include_once(MODX_MANAGER_PATH . 'includes/extenders/deprecated.functions.inc.php'); |
|
228 | + include_once(MODX_MANAGER_PATH.'includes/extenders/deprecated.functions.inc.php'); |
|
229 | 229 | if (method_exists($this->old, $method_name)) { |
230 | 230 | $error_type = 1; |
231 | 231 | } else { |
@@ -243,12 +243,12 @@ discard block |
||
243 | 243 | $info = debug_backtrace(); |
244 | 244 | $m[] = $msg; |
245 | 245 | if (!empty($this->currentSnippet)) { |
246 | - $m[] = 'Snippet - ' . $this->currentSnippet; |
|
246 | + $m[] = 'Snippet - '.$this->currentSnippet; |
|
247 | 247 | } elseif (!empty($this->event->activePlugin)) { |
248 | - $m[] = 'Plugin - ' . $this->event->activePlugin; |
|
248 | + $m[] = 'Plugin - '.$this->event->activePlugin; |
|
249 | 249 | } |
250 | 250 | $m[] = $this->decoded_request_uri; |
251 | - $m[] = str_replace('\\', '/', $info[0]['file']) . '(line:' . $info[0]['line'] . ')'; |
|
251 | + $m[] = str_replace('\\', '/', $info[0]['file']).'(line:'.$info[0]['line'].')'; |
|
252 | 252 | $msg = implode('<br />', $m); |
253 | 253 | $this->logEvent(0, $error_type, $msg, $title); |
254 | 254 | } |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | { |
266 | 266 | $flag = false; |
267 | 267 | if (is_scalar($connector) && !empty($connector) && isset($this->{$connector}) && $this->{$connector} instanceof DBAPI) { |
268 | - $flag = (bool)$this->{$connector}->conn; |
|
268 | + $flag = (bool) $this->{$connector}->conn; |
|
269 | 269 | } |
270 | 270 | return $flag; |
271 | 271 | } |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | } |
293 | 293 | if (!$out && $flag) { |
294 | 294 | $extname = trim(str_replace(array('..', '/', '\\'), '', strtolower($extname))); |
295 | - $filename = MODX_MANAGER_PATH . "includes/extenders/ex_{$extname}.inc.php"; |
|
295 | + $filename = MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php"; |
|
296 | 296 | $out = is_file($filename) ? include $filename : false; |
297 | 297 | } |
298 | 298 | if ($out && !in_array($extname, $this->extensions)) { |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | public function getMicroTime() |
310 | 310 | { |
311 | 311 | list($usec, $sec) = explode(' ', microtime()); |
312 | - return ((float)$usec + (float)$sec); |
|
312 | + return ((float) $usec + (float) $sec); |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | /** |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | // append the redirect count string to the url |
334 | 334 | $currentNumberOfRedirects = isset($_REQUEST['err']) ? $_REQUEST['err'] : 0; |
335 | 335 | if ($currentNumberOfRedirects > 3) { |
336 | - $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>' . $url . '</i></p>'); |
|
336 | + $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>'.$url.'</i></p>'); |
|
337 | 337 | } else { |
338 | 338 | $currentNumberOfRedirects += 1; |
339 | 339 | if (strpos($url, "?") > 0) { |
@@ -344,9 +344,9 @@ discard block |
||
344 | 344 | } |
345 | 345 | } |
346 | 346 | if ($type == 'REDIRECT_REFRESH') { |
347 | - $header = 'Refresh: 0;URL=' . $url; |
|
347 | + $header = 'Refresh: 0;URL='.$url; |
|
348 | 348 | } elseif ($type == 'REDIRECT_META') { |
349 | - $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=' . $url . '" />'; |
|
349 | + $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL='.$url.'" />'; |
|
350 | 350 | echo $header; |
351 | 351 | exit; |
352 | 352 | } elseif ($type == 'REDIRECT_HEADER' || empty($type)) { |
@@ -354,10 +354,10 @@ discard block |
||
354 | 354 | global $base_url, $site_url; |
355 | 355 | if (substr($url, 0, strlen($base_url)) == $base_url) { |
356 | 356 | // append $site_url to make it work with Location: |
357 | - $url = $site_url . substr($url, strlen($base_url)); |
|
357 | + $url = $site_url.substr($url, strlen($base_url)); |
|
358 | 358 | } |
359 | 359 | if (strpos($url, "\n") === false) { |
360 | - $header = 'Location: ' . $url; |
|
360 | + $header = 'Location: '.$url; |
|
361 | 361 | } else { |
362 | 362 | $this->messageQuit('No newline allowed in redirect url.'); |
363 | 363 | } |
@@ -471,8 +471,8 @@ discard block |
||
471 | 471 | |
472 | 472 | private function recoverySiteCache() |
473 | 473 | { |
474 | - $site_cache_dir = MODX_BASE_PATH . $this->getCacheFolder(); |
|
475 | - $site_cache_path = $site_cache_dir . 'siteCache.idx.php'; |
|
474 | + $site_cache_dir = MODX_BASE_PATH.$this->getCacheFolder(); |
|
475 | + $site_cache_path = $site_cache_dir.'siteCache.idx.php'; |
|
476 | 476 | |
477 | 477 | if (is_file($site_cache_path)) { |
478 | 478 | include($site_cache_path); |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | return; |
482 | 482 | } |
483 | 483 | |
484 | - include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php'); |
|
484 | + include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php'); |
|
485 | 485 | $cache = new synccache(); |
486 | 486 | $cache->setCachepath($site_cache_dir); |
487 | 487 | $cache->setReport(false); |
@@ -533,8 +533,8 @@ discard block |
||
533 | 533 | $this->invokeEvent("OnBeforeManagerPageInit"); |
534 | 534 | } |
535 | 535 | |
536 | - if (isset($_SESSION[$usrType . 'UsrConfigSet'])) { |
|
537 | - $usrSettings = &$_SESSION[$usrType . 'UsrConfigSet']; |
|
536 | + if (isset($_SESSION[$usrType.'UsrConfigSet'])) { |
|
537 | + $usrSettings = &$_SESSION[$usrType.'UsrConfigSet']; |
|
538 | 538 | } else { |
539 | 539 | if ($usrType == 'web') { |
540 | 540 | $from = $tbl_web_user_settings; |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | $usrSettings[$row['setting_name']] = $row['setting_value']; |
555 | 555 | } |
556 | 556 | if (isset($usrType)) { |
557 | - $_SESSION[$usrType . 'UsrConfigSet'] = $usrSettings; |
|
557 | + $_SESSION[$usrType.'UsrConfigSet'] = $usrSettings; |
|
558 | 558 | } // store user settings in session |
559 | 559 | } |
560 | 560 | } |
@@ -699,10 +699,10 @@ discard block |
||
699 | 699 | $suf = $this->config['friendly_url_suffix']; |
700 | 700 | $pre = preg_quote($pre, '/'); |
701 | 701 | $suf = preg_quote($suf, '/'); |
702 | - if ($pre && preg_match('@^' . $pre . '(.*)$@', $q, $_)) { |
|
702 | + if ($pre && preg_match('@^'.$pre.'(.*)$@', $q, $_)) { |
|
703 | 703 | $q = $_[1]; |
704 | 704 | } |
705 | - if ($suf && preg_match('@(.*)' . $suf . '$@', $q, $_)) { |
|
705 | + if ($suf && preg_match('@(.*)'.$suf.'$@', $q, $_)) { |
|
706 | 706 | $q = $_[1]; |
707 | 707 | } |
708 | 708 | |
@@ -724,7 +724,7 @@ discard block |
||
724 | 724 | 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 */ |
725 | 725 | /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */ |
726 | 726 | if ($this->config['use_alias_path'] == 1) { |
727 | - 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))))) { |
|
727 | + 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))))) { |
|
728 | 728 | $this->documentMethod = 'id'; |
729 | 729 | return $q; |
730 | 730 | } else { /* not a valid id in terms of virtualDir, treat as alias */ |
@@ -758,7 +758,7 @@ discard block |
||
758 | 758 | */ |
759 | 759 | public function getHashFile($key) |
760 | 760 | { |
761 | - return $this->getCacheFolder() . "docid_" . $key . ".pageCache.php"; |
|
761 | + return $this->getCacheFolder()."docid_".$key.".pageCache.php"; |
|
762 | 762 | } |
763 | 763 | |
764 | 764 | /** |
@@ -777,7 +777,7 @@ discard block |
||
777 | 777 | // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID. |
778 | 778 | $params = $_GET; |
779 | 779 | ksort($params); |
780 | - $hash .= '_' . md5(http_build_query($params)); |
|
780 | + $hash .= '_'.md5(http_build_query($params)); |
|
781 | 781 | } |
782 | 782 | } |
783 | 783 | $evtOut = $this->invokeEvent("OnMakePageCacheKey", array("hash" => $hash, "id" => $id, 'params' => $params)); |
@@ -923,12 +923,12 @@ discard block |
||
923 | 923 | if ($js = $this->getRegisteredClientStartupScripts()) { |
924 | 924 | // change to just before closing </head> |
925 | 925 | // $this->documentContent = preg_replace("/(<head[^>]*>)/i", "\\1\n".$js, $this->documentContent); |
926 | - $this->documentOutput = preg_replace("/(<\/head>)/i", $js . "\n\\1", $this->documentOutput); |
|
926 | + $this->documentOutput = preg_replace("/(<\/head>)/i", $js."\n\\1", $this->documentOutput); |
|
927 | 927 | } |
928 | 928 | |
929 | 929 | // Insert jscripts & html block into template - template must have a </body> tag |
930 | 930 | if ($js = $this->getRegisteredClientScripts()) { |
931 | - $this->documentOutput = preg_replace("/(<\/body>)/i", $js . "\n\\1", $this->documentOutput); |
|
931 | + $this->documentOutput = preg_replace("/(<\/body>)/i", $js."\n\\1", $this->documentOutput); |
|
932 | 932 | } |
933 | 933 | // End fix by sirlancelot |
934 | 934 | |
@@ -939,7 +939,7 @@ discard block |
||
939 | 939 | // send out content-type and content-disposition headers |
940 | 940 | if (IN_PARSER_MODE == "true") { |
941 | 941 | $type = !empty($this->contentTypes[$this->documentIdentifier]) ? $this->contentTypes[$this->documentIdentifier] : "text/html"; |
942 | - header('Content-Type: ' . $type . '; charset=' . $this->config['modx_charset']); |
|
942 | + header('Content-Type: '.$type.'; charset='.$this->config['modx_charset']); |
|
943 | 943 | // if (($this->documentIdentifier == $this->config['error_page']) || $redirect_error) |
944 | 944 | // header('HTTP/1.0 404 Not Found'); |
945 | 945 | if (!$this->checkPreview() && $this->documentObject['content_dispo'] == 1) { |
@@ -957,7 +957,7 @@ discard block |
||
957 | 957 | $name = preg_replace('|-+|', '-', $name); |
958 | 958 | $name = trim($name, '-'); |
959 | 959 | } |
960 | - $header = 'Content-Disposition: attachment; filename=' . $name; |
|
960 | + $header = 'Content-Disposition: attachment; filename='.$name; |
|
961 | 961 | header($header); |
962 | 962 | } |
963 | 963 | } |
@@ -965,7 +965,7 @@ discard block |
||
965 | 965 | |
966 | 966 | $stats = $this->getTimerStats($this->tstart); |
967 | 967 | |
968 | - $out =& $this->documentOutput; |
|
968 | + $out = & $this->documentOutput; |
|
969 | 969 | $out = str_replace("[^q^]", $stats['queries'], $out); |
970 | 970 | $out = str_replace("[^qt^]", $stats['queryTime'], $out); |
971 | 971 | $out = str_replace("[^p^]", $stats['phpTime'], $out); |
@@ -1004,17 +1004,17 @@ discard block |
||
1004 | 1004 | $sc .= sprintf("%s. %s (%s)<br>", $s, $sname, sprintf("%2.2f ms", $t)); // currentSnippet |
1005 | 1005 | $tt += $t; |
1006 | 1006 | } |
1007 | - echo "<fieldset><legend><b>Snippets</b> (" . count($this->snippetsTime) . " / " . sprintf("%2.2f ms", $tt) . ")</legend>{$sc}</fieldset><br />"; |
|
1007 | + echo "<fieldset><legend><b>Snippets</b> (".count($this->snippetsTime)." / ".sprintf("%2.2f ms", $tt).")</legend>{$sc}</fieldset><br />"; |
|
1008 | 1008 | echo $this->snippetsCode; |
1009 | 1009 | } |
1010 | 1010 | if ($this->dumpPlugins) { |
1011 | 1011 | $ps = ""; |
1012 | 1012 | $tt = 0; |
1013 | 1013 | foreach ($this->pluginsTime as $s => $t) { |
1014 | - $ps .= "$s (" . sprintf("%2.2f ms", $t * 1000) . ")<br>"; |
|
1014 | + $ps .= "$s (".sprintf("%2.2f ms", $t * 1000).")<br>"; |
|
1015 | 1015 | $tt += $t; |
1016 | 1016 | } |
1017 | - echo "<fieldset><legend><b>Plugins</b> (" . count($this->pluginsTime) . " / " . sprintf("%2.2f ms", $tt * 1000) . ")</legend>{$ps}</fieldset><br />"; |
|
1017 | + echo "<fieldset><legend><b>Plugins</b> (".count($this->pluginsTime)." / ".sprintf("%2.2f ms", $tt * 1000).")</legend>{$ps}</fieldset><br />"; |
|
1018 | 1018 | echo $this->pluginsCode; |
1019 | 1019 | } |
1020 | 1020 | |
@@ -1040,7 +1040,7 @@ discard block |
||
1040 | 1040 | $srcTags = explode(',', $tags); |
1041 | 1041 | $repTags = array(); |
1042 | 1042 | foreach ($srcTags as $tag) { |
1043 | - $repTags[] = '\\' . $tag[0] . '\\' . $tag[1]; |
|
1043 | + $repTags[] = '\\'.$tag[0].'\\'.$tag[1]; |
|
1044 | 1044 | } |
1045 | 1045 | return array($srcTags, $repTags); |
1046 | 1046 | } |
@@ -1062,7 +1062,7 @@ discard block |
||
1062 | 1062 | $stats['phpTime'] = sprintf("%2.4f s", $stats['phpTime']); |
1063 | 1063 | $stats['source'] = $this->documentGenerated == 1 ? "database" : "cache"; |
1064 | 1064 | $stats['queries'] = isset($this->executedQueries) ? $this->executedQueries : 0; |
1065 | - $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024) . " mb"; |
|
1065 | + $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024)." mb"; |
|
1066 | 1066 | |
1067 | 1067 | return $stats; |
1068 | 1068 | } |
@@ -1095,7 +1095,7 @@ discard block |
||
1095 | 1095 | { |
1096 | 1096 | $cacheRefreshTime = 0; |
1097 | 1097 | $recent_update = 0; |
1098 | - @include(MODX_BASE_PATH . $this->getCacheFolder() . 'sitePublishing.idx.php'); |
|
1098 | + @include(MODX_BASE_PATH.$this->getCacheFolder().'sitePublishing.idx.php'); |
|
1099 | 1099 | $this->recentUpdate = $recent_update; |
1100 | 1100 | |
1101 | 1101 | $timeNow = $_SERVER['REQUEST_TIME'] + $this->config['server_offset_time']; |
@@ -1165,8 +1165,8 @@ discard block |
||
1165 | 1165 | } |
1166 | 1166 | |
1167 | 1167 | $docObjSerial = serialize($this->documentObject); |
1168 | - $cacheContent = $docObjSerial . "<!--__MODxCacheSpliter__-->" . $this->documentContent; |
|
1169 | - $page_cache_path = MODX_BASE_PATH . $this->getHashFile($this->cacheKey); |
|
1168 | + $cacheContent = $docObjSerial."<!--__MODxCacheSpliter__-->".$this->documentContent; |
|
1169 | + $page_cache_path = MODX_BASE_PATH.$this->getHashFile($this->cacheKey); |
|
1170 | 1170 | file_put_contents($page_cache_path, "<?php die('Unauthorized access.'); ?>$cacheContent"); |
1171 | 1171 | } |
1172 | 1172 | } |
@@ -1208,16 +1208,16 @@ discard block |
||
1208 | 1208 | return array(); |
1209 | 1209 | } |
1210 | 1210 | $spacer = md5('<<<EVO>>>'); |
1211 | - if ($left==='{{' && strpos($content, ';}}')!==false) { |
|
1211 | + if ($left === '{{' && strpos($content, ';}}') !== false) { |
|
1212 | 1212 | $content = str_replace(';}}', sprintf(';}%s}', $spacer), $content); |
1213 | 1213 | } |
1214 | - if ($left==='{{' && strpos($content, '{{}}')!==false) { |
|
1214 | + if ($left === '{{' && strpos($content, '{{}}') !== false) { |
|
1215 | 1215 | $content = str_replace('{{}}', sprintf('{%$1s{}%$1s}', $spacer), $content); |
1216 | 1216 | } |
1217 | - if ($left==='[[' && strpos($content, ']]]]')!==false) { |
|
1217 | + if ($left === '[[' && strpos($content, ']]]]') !== false) { |
|
1218 | 1218 | $content = str_replace(']]]]', sprintf(']]%s]]', $spacer), $content); |
1219 | 1219 | } |
1220 | - if ($left==='[[' && strpos($content, ']]]')!==false) { |
|
1220 | + if ($left === '[[' && strpos($content, ']]]') !== false) { |
|
1221 | 1221 | $content = str_replace(']]]', sprintf(']%s]]', $spacer), $content); |
1222 | 1222 | } |
1223 | 1223 | |
@@ -1225,7 +1225,7 @@ discard block |
||
1225 | 1225 | $pos[']]>'] = strpos($content, ']]>'); |
1226 | 1226 | |
1227 | 1227 | if ($pos['<![CDATA['] !== false && $pos[']]>'] !== false) { |
1228 | - $content = substr($content, 0, $pos['<![CDATA[']) . substr($content, $pos[']]>'] + 3); |
|
1228 | + $content = substr($content, 0, $pos['<![CDATA[']).substr($content, $pos[']]>'] + 3); |
|
1229 | 1229 | } |
1230 | 1230 | |
1231 | 1231 | $lp = explode($left, $content); |
@@ -1290,7 +1290,7 @@ discard block |
||
1290 | 1290 | } |
1291 | 1291 | } |
1292 | 1292 | foreach ($tags as $i=>$tag) { |
1293 | - if (strpos($tag, $spacer)!==false) { |
|
1293 | + if (strpos($tag, $spacer) !== false) { |
|
1294 | 1294 | $tags[$i] = str_replace($spacer, '', $tag); |
1295 | 1295 | } |
1296 | 1296 | } |
@@ -1332,7 +1332,7 @@ discard block |
||
1332 | 1332 | } |
1333 | 1333 | |
1334 | 1334 | foreach ($matches[1] as $i => $key) { |
1335 | - if (strpos($key, '[+')!==false) { |
|
1335 | + if (strpos($key, '[+') !== false) { |
|
1336 | 1336 | continue; |
1337 | 1337 | } // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
1338 | 1338 | if (substr($key, 0, 1) == '#') { |
@@ -1354,8 +1354,8 @@ discard block |
||
1354 | 1354 | } |
1355 | 1355 | |
1356 | 1356 | if (is_array($value)) { |
1357 | - include_once(MODX_MANAGER_PATH . 'includes/tmplvars.format.inc.php'); |
|
1358 | - include_once(MODX_MANAGER_PATH . 'includes/tmplvars.commands.inc.php'); |
|
1357 | + include_once(MODX_MANAGER_PATH.'includes/tmplvars.format.inc.php'); |
|
1358 | + include_once(MODX_MANAGER_PATH.'includes/tmplvars.commands.inc.php'); |
|
1359 | 1359 | $value = getTVDisplayFormat($value[0], $value[1], $value[2], $value[3], $value[4]); |
1360 | 1360 | } |
1361 | 1361 | |
@@ -1367,7 +1367,7 @@ discard block |
||
1367 | 1367 | if (strpos($content, $s) !== false) { |
1368 | 1368 | $content = str_replace($s, $value, $content); |
1369 | 1369 | } elseif ($this->debug) { |
1370 | - $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1370 | + $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1371 | 1371 | } |
1372 | 1372 | } |
1373 | 1373 | |
@@ -1535,7 +1535,7 @@ discard block |
||
1535 | 1535 | if (strpos($content, $s) !== false) { |
1536 | 1536 | $content = str_replace($s, $value, $content); |
1537 | 1537 | } elseif ($this->debug) { |
1538 | - $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1538 | + $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1539 | 1539 | } |
1540 | 1540 | } |
1541 | 1541 | return $content; |
@@ -1588,7 +1588,7 @@ discard block |
||
1588 | 1588 | } |
1589 | 1589 | |
1590 | 1590 | $value = $this->parseText($value, $params); // parse local scope placeholers for ConditionalTags |
1591 | - $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers |
|
1591 | + $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers |
|
1592 | 1592 | if ($this->config['enable_at_syntax']) { |
1593 | 1593 | $value = $this->mergeConditionalTagsContent($value); |
1594 | 1594 | } |
@@ -1604,7 +1604,7 @@ discard block |
||
1604 | 1604 | if (strpos($content, $s) !== false) { |
1605 | 1605 | $content = str_replace($s, $value, $content); |
1606 | 1606 | } elseif ($this->debug) { |
1607 | - $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1607 | + $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1608 | 1608 | } |
1609 | 1609 | } |
1610 | 1610 | return $content; |
@@ -1661,7 +1661,7 @@ discard block |
||
1661 | 1661 | if (strpos($content, $s) !== false) { |
1662 | 1662 | $content = str_replace($s, $value, $content); |
1663 | 1663 | } elseif ($this->debug) { |
1664 | - $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1664 | + $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1665 | 1665 | } |
1666 | 1666 | } |
1667 | 1667 | return $content; |
@@ -1685,7 +1685,7 @@ discard block |
||
1685 | 1685 | return $content; |
1686 | 1686 | } |
1687 | 1687 | |
1688 | - $sp = '#' . md5('ConditionalTags' . $_SERVER['REQUEST_TIME']) . '#'; |
|
1688 | + $sp = '#'.md5('ConditionalTags'.$_SERVER['REQUEST_TIME']).'#'; |
|
1689 | 1689 | $content = str_replace(array('<?php', '<?=', '<?', '?>'), array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), $content); |
1690 | 1690 | |
1691 | 1691 | $pieces = explode('<@IF:', $content); |
@@ -1696,7 +1696,7 @@ discard block |
||
1696 | 1696 | } |
1697 | 1697 | list($cmd, $text) = explode('>', $split, 2); |
1698 | 1698 | $cmd = str_replace("'", "\'", $cmd); |
1699 | - $content .= "<?php if(\$this->_parseCTagCMD('" . $cmd . "')): ?>"; |
|
1699 | + $content .= "<?php if(\$this->_parseCTagCMD('".$cmd."')): ?>"; |
|
1700 | 1700 | $content .= $text; |
1701 | 1701 | } |
1702 | 1702 | $pieces = explode('<@ELSEIF:', $content); |
@@ -1707,13 +1707,13 @@ discard block |
||
1707 | 1707 | } |
1708 | 1708 | list($cmd, $text) = explode('>', $split, 2); |
1709 | 1709 | $cmd = str_replace("'", "\'", $cmd); |
1710 | - $content .= "<?php elseif(\$this->_parseCTagCMD('" . $cmd . "')): ?>"; |
|
1710 | + $content .= "<?php elseif(\$this->_parseCTagCMD('".$cmd."')): ?>"; |
|
1711 | 1711 | $content .= $text; |
1712 | 1712 | } |
1713 | 1713 | |
1714 | 1714 | $content = str_replace(array('<@ELSE>', '<@ENDIF>'), array('<?php else:?>', '<?php endif;?>'), $content); |
1715 | 1715 | ob_start(); |
1716 | - $content = eval('?>' . $content); |
|
1716 | + $content = eval('?>'.$content); |
|
1717 | 1717 | $content = ob_get_clean(); |
1718 | 1718 | $content = str_replace(array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), array('<?php', '<?=', '<?', '?>'), $content); |
1719 | 1719 | |
@@ -1838,7 +1838,7 @@ discard block |
||
1838 | 1838 | $matches = $this->getTagsFromContent($content, $left, $right); |
1839 | 1839 | if (!empty($matches)) { |
1840 | 1840 | foreach ($matches[0] as $i => $v) { |
1841 | - $addBreakMatches[$i] = $v . "\n"; |
|
1841 | + $addBreakMatches[$i] = $v."\n"; |
|
1842 | 1842 | } |
1843 | 1843 | $content = str_replace($addBreakMatches, '', $content); |
1844 | 1844 | if (strpos($content, $left) !== false) { |
@@ -1872,7 +1872,7 @@ discard block |
||
1872 | 1872 | if (strpos($content, $s) !== false) { |
1873 | 1873 | $content = str_replace($s, $v, $content); |
1874 | 1874 | } elseif ($this->debug) { |
1875 | - $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1875 | + $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1876 | 1876 | } |
1877 | 1877 | } |
1878 | 1878 | return $content; |
@@ -1936,7 +1936,7 @@ discard block |
||
1936 | 1936 | $msg = ($msg === false) ? 'ob_get_contents() error' : $msg; |
1937 | 1937 | $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Plugin', $error_info['message'], $error_info['line'], $msg); |
1938 | 1938 | if ($this->isBackend()) { |
1939 | - $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>' . $msg . '</p>'); |
|
1939 | + $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>'.$msg.'</p>'); |
|
1940 | 1940 | } |
1941 | 1941 | } |
1942 | 1942 | } else { |
@@ -1982,7 +1982,7 @@ discard block |
||
1982 | 1982 | $echo = ($echo === false) ? 'ob_get_contents() error' : $echo; |
1983 | 1983 | $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Snippet', $error_info['message'], $error_info['line'], $echo); |
1984 | 1984 | if ($this->isBackend()) { |
1985 | - $this->event->alert('An error occurred while loading. Please see the event log for more information<p>' . $echo . $return . '</p>'); |
|
1985 | + $this->event->alert('An error occurred while loading. Please see the event log for more information<p>'.$echo.$return.'</p>'); |
|
1986 | 1986 | } |
1987 | 1987 | } |
1988 | 1988 | } |
@@ -1990,7 +1990,7 @@ discard block |
||
1990 | 1990 | if (is_array($return) || is_object($return)) { |
1991 | 1991 | return $return; |
1992 | 1992 | } else { |
1993 | - return $echo . $return; |
|
1993 | + return $echo.$return; |
|
1994 | 1994 | } |
1995 | 1995 | } |
1996 | 1996 | |
@@ -2029,7 +2029,7 @@ discard block |
||
2029 | 2029 | if (strpos($content, $s) !== false) { |
2030 | 2030 | $content = str_replace($s, $value, $content); |
2031 | 2031 | } elseif ($this->debug) { |
2032 | - $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
2032 | + $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
2033 | 2033 | } |
2034 | 2034 | continue; |
2035 | 2035 | } |
@@ -2041,7 +2041,7 @@ discard block |
||
2041 | 2041 | if (strpos($content, $s) !== false) { |
2042 | 2042 | $content = str_replace($s, $value, $content); |
2043 | 2043 | } elseif ($this->debug) { |
2044 | - $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
2044 | + $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
2045 | 2045 | } |
2046 | 2046 | } |
2047 | 2047 | |
@@ -2132,7 +2132,7 @@ discard block |
||
2132 | 2132 | $eventtime = sprintf('%2.2f ms', $eventtime * 1000); |
2133 | 2133 | $code = str_replace("\t", ' ', $this->htmlspecialchars($value)); |
2134 | 2134 | $piece = str_replace("\t", ' ', $this->htmlspecialchars($piece)); |
2135 | - $print_r_params = str_replace("\t", ' ', $this->htmlspecialchars('$modx->event->params = ' . print_r($params, true))); |
|
2135 | + $print_r_params = str_replace("\t", ' ', $this->htmlspecialchars('$modx->event->params = '.print_r($params, true))); |
|
2136 | 2136 | $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); |
2137 | 2137 | $this->snippetsTime[] = array('sname' => $key, 'time' => $eventtime); |
2138 | 2138 | } |
@@ -2377,7 +2377,7 @@ discard block |
||
2377 | 2377 | $rs = $this->db->select('name,snippet,properties', '[+prefix+]site_snippets', $where); |
2378 | 2378 | $count = $this->db->getRecordCount($rs); |
2379 | 2379 | if (1 < $count) { |
2380 | - exit('Error $modx->_getSnippetObject()' . $snip_name); |
|
2380 | + exit('Error $modx->_getSnippetObject()'.$snip_name); |
|
2381 | 2381 | } |
2382 | 2382 | if ($count) { |
2383 | 2383 | $row = $this->db->getRow($rs); |
@@ -2403,7 +2403,7 @@ discard block |
||
2403 | 2403 | public function toAlias($text) |
2404 | 2404 | { |
2405 | 2405 | $suff = $this->config['friendly_url_suffix']; |
2406 | - 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); |
|
2406 | + 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); |
|
2407 | 2407 | } |
2408 | 2408 | |
2409 | 2409 | /** |
@@ -2435,7 +2435,7 @@ discard block |
||
2435 | 2435 | $suff = '/'; |
2436 | 2436 | } |
2437 | 2437 | |
2438 | - $url = ($dir != '' ? $dir . '/' : '') . $pre . $alias . $suff; |
|
2438 | + $url = ($dir != '' ? $dir.'/' : '').$pre.$alias.$suff; |
|
2439 | 2439 | } |
2440 | 2440 | |
2441 | 2441 | $evtOut = $this->invokeEvent('OnMakeDocUrl', array( |
@@ -2472,7 +2472,7 @@ discard block |
||
2472 | 2472 | preg_match_all('!\[\~([0-9]+)\~\]!ise', $documentSource, $match); |
2473 | 2473 | $ids = implode(',', array_unique($match['1'])); |
2474 | 2474 | if ($ids) { |
2475 | - $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (" . $ids . ") AND isfolder = '0'"); |
|
2475 | + $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (".$ids.") AND isfolder = '0'"); |
|
2476 | 2476 | while ($row = $this->db->getRow($res)) { |
2477 | 2477 | if ($this->config['use_alias_path'] == '1' && $row['parent'] != 0) { |
2478 | 2478 | $parent = $row['parent']; |
@@ -2483,7 +2483,7 @@ discard block |
||
2483 | 2483 | $parent = $this->aliasListing[$parent]['parent']; |
2484 | 2484 | } |
2485 | 2485 | |
2486 | - $aliases[$row['id']] = $path . '/' . $row['alias']; |
|
2486 | + $aliases[$row['id']] = $path.'/'.$row['alias']; |
|
2487 | 2487 | } else { |
2488 | 2488 | $aliases[$row['id']] = $row['alias']; |
2489 | 2489 | } |
@@ -2495,7 +2495,7 @@ discard block |
||
2495 | 2495 | $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0); |
2496 | 2496 | $pref = $this->config['friendly_url_prefix']; |
2497 | 2497 | $suff = $this->config['friendly_url_suffix']; |
2498 | - $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
2498 | + $documentSource = preg_replace_callback($in, function($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
2499 | 2499 | global $modx; |
2500 | 2500 | $thealias = $aliases[$m[1]]; |
2501 | 2501 | $thefolder = $isfolder[$m[1]]; |
@@ -2510,7 +2510,7 @@ discard block |
||
2510 | 2510 | }, $documentSource); |
2511 | 2511 | } else { |
2512 | 2512 | $in = '!\[\~([0-9]+)\~\]!is'; |
2513 | - $out = "index.php?id=" . '\1'; |
|
2513 | + $out = "index.php?id=".'\1'; |
|
2514 | 2514 | $documentSource = preg_replace($in, $out, $documentSource); |
2515 | 2515 | } |
2516 | 2516 | |
@@ -2531,7 +2531,7 @@ discard block |
||
2531 | 2531 | $scheme = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http'; |
2532 | 2532 | $len_base_url = strlen($this->config['base_url']); |
2533 | 2533 | |
2534 | - $url_path = $q;//LANG |
|
2534 | + $url_path = $q; //LANG |
|
2535 | 2535 | |
2536 | 2536 | if (substr($url_path, 0, $len_base_url) === $this->config['base_url']) { |
2537 | 2537 | $url_path = substr($url_path, $len_base_url); |
@@ -2543,7 +2543,7 @@ discard block |
||
2543 | 2543 | $strictURL = substr($strictURL, $len_base_url); |
2544 | 2544 | } |
2545 | 2545 | $http_host = $_SERVER['HTTP_HOST']; |
2546 | - $requestedURL = "{$scheme}://{$http_host}" . '/' . $q; //LANG |
|
2546 | + $requestedURL = "{$scheme}://{$http_host}".'/'.$q; //LANG |
|
2547 | 2547 | |
2548 | 2548 | $site_url = $this->config['site_url']; |
2549 | 2549 | $url_query_string = explode('?', $_SERVER['REQUEST_URI']); |
@@ -2561,7 +2561,7 @@ discard block |
||
2561 | 2561 | } |
2562 | 2562 | if ($this->config['base_url'] != $_SERVER['REQUEST_URI']) { |
2563 | 2563 | if (empty($_POST)) { |
2564 | - if (($this->config['base_url'] . '?' . $qstring) != $_SERVER['REQUEST_URI']) { |
|
2564 | + if (($this->config['base_url'].'?'.$qstring) != $_SERVER['REQUEST_URI']) { |
|
2565 | 2565 | $this->sendRedirect($url, 0, 'REDIRECT_HEADER', 'HTTP/1.0 301 Moved Permanently'); |
2566 | 2566 | exit(0); |
2567 | 2567 | } |
@@ -2619,7 +2619,7 @@ discard block |
||
2619 | 2619 | $docgrp = implode(",", $docgrp); |
2620 | 2620 | } |
2621 | 2621 | // get document |
2622 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
2622 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
2623 | 2623 | $rs = $this->db->select('sc.*', "{$tblsc} sc |
2624 | 2624 | LEFT JOIN {$tbldg} dg ON dg.document = sc.id", "sc.{$method} = '{$identifier}' AND ({$access})", "", 1); |
2625 | 2625 | if ($this->db->getRecordCount($rs) < 1) { |
@@ -2655,9 +2655,9 @@ discard block |
||
2655 | 2655 | } |
2656 | 2656 | if ($documentObject['template']) { |
2657 | 2657 | // load TVs and merge with document - Orig by Apodigm - Docvars |
2658 | - $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars") . " tv |
|
2659 | - INNER JOIN " . $this->getFullTableName("site_tmplvar_templates") . " tvtpl ON tvtpl.tmplvarid = tv.id |
|
2660 | - LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues") . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'"); |
|
2658 | + $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars")." tv |
|
2659 | + INNER JOIN " . $this->getFullTableName("site_tmplvar_templates")." tvtpl ON tvtpl.tmplvarid = tv.id |
|
2660 | + LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues")." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'"); |
|
2661 | 2661 | $tmplvars = array(); |
2662 | 2662 | while ($row = $this->db->getRow($rs)) { |
2663 | 2663 | $tmplvars[$row['name']] = array( |
@@ -2703,7 +2703,7 @@ discard block |
||
2703 | 2703 | $st = md5($source); |
2704 | 2704 | } |
2705 | 2705 | if ($this->dumpSnippets == 1) { |
2706 | - $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>"; |
|
2706 | + $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>"; |
|
2707 | 2707 | } |
2708 | 2708 | |
2709 | 2709 | // invoke OnParseDocument event |
@@ -2791,7 +2791,7 @@ discard block |
||
2791 | 2791 | |
2792 | 2792 | // Check use_alias_path and check if $this->virtualDir is set to anything, then parse the path |
2793 | 2793 | if ($this->config['use_alias_path'] == 1) { |
2794 | - $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir . '/' : '') . $this->documentIdentifier; |
|
2794 | + $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir.'/' : '').$this->documentIdentifier; |
|
2795 | 2795 | if (isset($this->documentListing[$alias])) { |
2796 | 2796 | $this->documentIdentifier = $this->documentListing[$alias]; |
2797 | 2797 | } else { |
@@ -2852,7 +2852,7 @@ discard block |
||
2852 | 2852 | } else { |
2853 | 2853 | $docAlias = $this->db->escape($this->documentIdentifier); |
2854 | 2854 | $rs = $this->db->select('id', $this->getFullTableName('site_content'), "deleted=0 and alias='{$docAlias}'"); |
2855 | - $this->documentIdentifier = (int)$this->db->getValue($rs); |
|
2855 | + $this->documentIdentifier = (int) $this->db->getValue($rs); |
|
2856 | 2856 | } |
2857 | 2857 | } |
2858 | 2858 | $this->documentMethod = 'id'; |
@@ -2909,7 +2909,7 @@ discard block |
||
2909 | 2909 | $_REQUEST[$n] = $_GET[$n] = $v; |
2910 | 2910 | } |
2911 | 2911 | } |
2912 | - $_SERVER['PHP_SELF'] = $this->config['base_url'] . $qp['path']; |
|
2912 | + $_SERVER['PHP_SELF'] = $this->config['base_url'].$qp['path']; |
|
2913 | 2913 | $this->q = $qp['path']; |
2914 | 2914 | return $qp['path']; |
2915 | 2915 | } |
@@ -3003,7 +3003,7 @@ discard block |
||
3003 | 3003 | $this->sendErrorPage(); |
3004 | 3004 | } else { |
3005 | 3005 | // Inculde the necessary files to check document permissions |
3006 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
3006 | + include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php'); |
|
3007 | 3007 | $udperms = new udperms(); |
3008 | 3008 | $udperms->user = $this->getLoginUserID(); |
3009 | 3009 | $udperms->document = $this->documentIdentifier; |
@@ -3057,7 +3057,7 @@ discard block |
||
3057 | 3057 | while ($id && $height--) { |
3058 | 3058 | $thisid = $id; |
3059 | 3059 | if ($this->config['aliaslistingfolder'] == 1) { |
3060 | - $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"); |
|
3060 | + $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"); |
|
3061 | 3061 | if (!$id || $id == '0') { |
3062 | 3062 | break; |
3063 | 3063 | } |
@@ -3106,15 +3106,15 @@ discard block |
||
3106 | 3106 | } |
3107 | 3107 | |
3108 | 3108 | if ($this->config['aliaslistingfolder'] == 1) { |
3109 | - $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (" . $id . ") AND deleted = '0'"); |
|
3109 | + $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (".$id.") AND deleted = '0'"); |
|
3110 | 3110 | $idx = array(); |
3111 | 3111 | while ($row = $this->db->getRow($res)) { |
3112 | 3112 | $pAlias = ''; |
3113 | 3113 | if (isset($this->aliasListing[$row['parent']])) { |
3114 | - $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'] . '/' : ''; |
|
3115 | - $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'] . '/' : ''; |
|
3114 | + $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'].'/' : ''; |
|
3115 | + $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'].'/' : ''; |
|
3116 | 3116 | }; |
3117 | - $children[$pAlias . $row['alias']] = $row['id']; |
|
3117 | + $children[$pAlias.$row['alias']] = $row['id']; |
|
3118 | 3118 | if ($row['isfolder'] == 1) { |
3119 | 3119 | $idx[] = $row['id']; |
3120 | 3120 | } |
@@ -3145,7 +3145,7 @@ discard block |
||
3145 | 3145 | $depth--; |
3146 | 3146 | |
3147 | 3147 | foreach ($documentMap_cache[$id] as $childId) { |
3148 | - $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '') . $this->aliasListing[$childId]['alias']; |
|
3148 | + $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '').$this->aliasListing[$childId]['alias']; |
|
3149 | 3149 | if (!strlen($pkey)) { |
3150 | 3150 | $pkey = "{$childId}"; |
3151 | 3151 | } |
@@ -3173,7 +3173,7 @@ discard block |
||
3173 | 3173 | if (substr(strtolower($url), 0, 11) == "javascript:") { |
3174 | 3174 | $fnc = substr($url, 11); |
3175 | 3175 | } elseif ($url) { |
3176 | - $fnc = "window.location.href='" . addslashes($url) . "';"; |
|
3176 | + $fnc = "window.location.href='".addslashes($url)."';"; |
|
3177 | 3177 | } else { |
3178 | 3178 | $fnc = "history.back(-1);"; |
3179 | 3179 | } |
@@ -3182,7 +3182,7 @@ discard block |
||
3182 | 3182 | <meta http-equiv=\"Content-Type\" content=\"text/html; charset={$modx_manager_charset};\"> |
3183 | 3183 | <script> |
3184 | 3184 | function __alertQuit() { |
3185 | - alert('" . addslashes($msg) . "'); |
|
3185 | + alert('".addslashes($msg)."'); |
|
3186 | 3186 | {$fnc} |
3187 | 3187 | } |
3188 | 3188 | window.setTimeout('__alertQuit();',100); |
@@ -3204,9 +3204,9 @@ discard block |
||
3204 | 3204 | $state = 0; |
3205 | 3205 | $pms = $_SESSION['mgrPermissions']; |
3206 | 3206 | if ($pms) { |
3207 | - $state = ((bool)$pms[$pm] === true); |
|
3207 | + $state = ((bool) $pms[$pm] === true); |
|
3208 | 3208 | } |
3209 | - return (int)$state; |
|
3209 | + return (int) $state; |
|
3210 | 3210 | } |
3211 | 3211 | |
3212 | 3212 | /** |
@@ -3219,8 +3219,8 @@ discard block |
||
3219 | 3219 | */ |
3220 | 3220 | public function elementIsLocked($type, $id, $includeThisUser = false) |
3221 | 3221 | { |
3222 | - $id = (int)$id; |
|
3223 | - $type = (int)$type; |
|
3222 | + $id = (int) $id; |
|
3223 | + $type = (int) $type; |
|
3224 | 3224 | if (!$type || !$id) { |
3225 | 3225 | return null; |
3226 | 3226 | } |
@@ -3270,7 +3270,7 @@ discard block |
||
3270 | 3270 | return $lockedElements; |
3271 | 3271 | } |
3272 | 3272 | |
3273 | - $type = (int)$type; |
|
3273 | + $type = (int) $type; |
|
3274 | 3274 | if (isset($lockedElements[$type])) { |
3275 | 3275 | return $lockedElements[$type]; |
3276 | 3276 | } else { |
@@ -3287,7 +3287,7 @@ discard block |
||
3287 | 3287 | $this->lockedElements = array(); |
3288 | 3288 | $this->cleanupExpiredLocks(); |
3289 | 3289 | |
3290 | - $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks') . " ul |
|
3290 | + $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks')." ul |
|
3291 | 3291 | LEFT JOIN {$this->getFullTableName('manager_users')} mu on ul.internalKey = mu.id"); |
3292 | 3292 | while ($row = $this->db->getRow($rs)) { |
3293 | 3293 | $this->lockedElements[$row['elementType']][$row['elementId']] = array( |
@@ -3310,7 +3310,7 @@ discard block |
||
3310 | 3310 | public function cleanupExpiredLocks() |
3311 | 3311 | { |
3312 | 3312 | // Clean-up active_user_sessions first |
3313 | - $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 |
|
3313 | + $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 |
|
3314 | 3314 | $validSessionTimeLimit = $this->time - $timeout; |
3315 | 3315 | $this->db->delete($this->getFullTableName('active_user_sessions'), "lasthit < {$validSessionTimeLimit}"); |
3316 | 3316 | |
@@ -3323,7 +3323,7 @@ discard block |
||
3323 | 3323 | foreach ($rs as $row) { |
3324 | 3324 | $userSids[] = $row['sid']; |
3325 | 3325 | } |
3326 | - $userSids = "'" . implode("','", $userSids) . "'"; |
|
3326 | + $userSids = "'".implode("','", $userSids)."'"; |
|
3327 | 3327 | $this->db->delete($this->getFullTableName('active_user_locks'), "sid NOT IN({$userSids})"); |
3328 | 3328 | } else { |
3329 | 3329 | $this->db->delete($this->getFullTableName('active_user_locks')); |
@@ -3404,8 +3404,8 @@ discard block |
||
3404 | 3404 | public function lockElement($type, $id) |
3405 | 3405 | { |
3406 | 3406 | $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0; |
3407 | - $type = (int)$type; |
|
3408 | - $id = (int)$id; |
|
3407 | + $type = (int) $type; |
|
3408 | + $id = (int) $id; |
|
3409 | 3409 | if (!$type || !$id || !$userId) { |
3410 | 3410 | return false; |
3411 | 3411 | } |
@@ -3426,8 +3426,8 @@ discard block |
||
3426 | 3426 | public function unlockElement($type, $id, $includeAllUsers = false) |
3427 | 3427 | { |
3428 | 3428 | $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0; |
3429 | - $type = (int)$type; |
|
3430 | - $id = (int)$id; |
|
3429 | + $type = (int) $type; |
|
3430 | + $id = (int) $id; |
|
3431 | 3431 | if (!$type || !$id) { |
3432 | 3432 | return false; |
3433 | 3433 | } |
@@ -3494,8 +3494,8 @@ discard block |
||
3494 | 3494 | } |
3495 | 3495 | |
3496 | 3496 | $usertype = $this->isFrontend() ? 1 : 0; |
3497 | - $evtid = (int)$evtid; |
|
3498 | - $type = (int)$type; |
|
3497 | + $evtid = (int) $evtid; |
|
3498 | + $type = (int) $type; |
|
3499 | 3499 | |
3500 | 3500 | // Types: 1 = information, 2 = warning, 3 = error |
3501 | 3501 | if ($type < 1) { |
@@ -3517,8 +3517,8 @@ discard block |
||
3517 | 3517 | if (isset($this->config['send_errormail']) && $this->config['send_errormail'] !== '0') { |
3518 | 3518 | if ($this->config['send_errormail'] <= $type) { |
3519 | 3519 | $this->sendmail(array( |
3520 | - 'subject' => 'MODX System Error on ' . $this->config['site_name'], |
|
3521 | - 'body' => 'Source: ' . $source . ' - The details of the error could be seen in the MODX system events log.', |
|
3520 | + 'subject' => 'MODX System Error on '.$this->config['site_name'], |
|
3521 | + 'body' => 'Source: '.$source.' - The details of the error could be seen in the MODX system events log.', |
|
3522 | 3522 | 'type' => 'text' |
3523 | 3523 | )); |
3524 | 3524 | } |
@@ -3566,7 +3566,7 @@ discard block |
||
3566 | 3566 | $p['fromname'] = $userinfo['username']; |
3567 | 3567 | } |
3568 | 3568 | if ($msg === '' && !isset($p['body'])) { |
3569 | - $p['body'] = $_SERVER['REQUEST_URI'] . "\n" . $_SERVER['HTTP_USER_AGENT'] . "\n" . $_SERVER['HTTP_REFERER']; |
|
3569 | + $p['body'] = $_SERVER['REQUEST_URI']."\n".$_SERVER['HTTP_USER_AGENT']."\n".$_SERVER['HTTP_REFERER']; |
|
3570 | 3570 | } elseif (is_string($msg) && 0 < strlen($msg)) { |
3571 | 3571 | $p['body'] = $msg; |
3572 | 3572 | } |
@@ -3606,8 +3606,8 @@ discard block |
||
3606 | 3606 | $files = array(); |
3607 | 3607 | } |
3608 | 3608 | foreach ($files as $f) { |
3609 | - if (file_exists(MODX_BASE_PATH . $f) && is_file(MODX_BASE_PATH . $f) && is_readable(MODX_BASE_PATH . $f)) { |
|
3610 | - $this->mail->AddAttachment(MODX_BASE_PATH . $f); |
|
3609 | + if (file_exists(MODX_BASE_PATH.$f) && is_file(MODX_BASE_PATH.$f) && is_readable(MODX_BASE_PATH.$f)) { |
|
3610 | + $this->mail->AddAttachment(MODX_BASE_PATH.$f); |
|
3611 | 3611 | } |
3612 | 3612 | } |
3613 | 3613 | $rs = $this->mail->send(); |
@@ -3652,7 +3652,7 @@ discard block |
||
3652 | 3652 | */ |
3653 | 3653 | public function isFrontend() |
3654 | 3654 | { |
3655 | - return ! $this->isBackend(); |
|
3655 | + return !$this->isBackend(); |
|
3656 | 3656 | } |
3657 | 3657 | |
3658 | 3658 | /** |
@@ -3676,14 +3676,14 @@ discard block |
||
3676 | 3676 | $tblsc = $this->getFullTableName("site_content"); |
3677 | 3677 | $tbldg = $this->getFullTableName("document_groups"); |
3678 | 3678 | // modify field names to use sc. table reference |
3679 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3680 | - $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3679 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3680 | + $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3681 | 3681 | // get document groups for current user |
3682 | 3682 | if ($docgrp = $this->getUserDocGroups()) { |
3683 | 3683 | $docgrp = implode(",", $docgrp); |
3684 | 3684 | } |
3685 | 3685 | // build query |
3686 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3686 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3687 | 3687 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
3688 | 3688 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}"); |
3689 | 3689 | $resourceArray = $this->db->makeArray($result); |
@@ -3713,14 +3713,14 @@ discard block |
||
3713 | 3713 | $tbldg = $this->getFullTableName("document_groups"); |
3714 | 3714 | |
3715 | 3715 | // modify field names to use sc. table reference |
3716 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3717 | - $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3716 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3717 | + $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3718 | 3718 | // get document groups for current user |
3719 | 3719 | if ($docgrp = $this->getUserDocGroups()) { |
3720 | 3720 | $docgrp = implode(",", $docgrp); |
3721 | 3721 | } |
3722 | 3722 | // build query |
3723 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3723 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3724 | 3724 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
3725 | 3725 | 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}"); |
3726 | 3726 | $resourceArray = $this->db->makeArray($result); |
@@ -3754,16 +3754,16 @@ discard block |
||
3754 | 3754 | return $this->tmpCache[__FUNCTION__][$cacheKey]; |
3755 | 3755 | } |
3756 | 3756 | |
3757 | - $published = ($published !== 'all') ? 'AND sc.published = ' . $published : ''; |
|
3758 | - $deleted = ($deleted !== 'all') ? 'AND sc.deleted = ' . $deleted : ''; |
|
3757 | + $published = ($published !== 'all') ? 'AND sc.published = '.$published : ''; |
|
3758 | + $deleted = ($deleted !== 'all') ? 'AND sc.deleted = '.$deleted : ''; |
|
3759 | 3759 | |
3760 | 3760 | if ($where != '') { |
3761 | - $where = 'AND ' . $where; |
|
3761 | + $where = 'AND '.$where; |
|
3762 | 3762 | } |
3763 | 3763 | |
3764 | 3764 | // modify field names to use sc. table reference |
3765 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3766 | - $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3765 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3766 | + $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3767 | 3767 | |
3768 | 3768 | // get document groups for current user |
3769 | 3769 | if ($docgrp = $this->getUserDocGroups()) { |
@@ -3771,7 +3771,7 @@ discard block |
||
3771 | 3771 | } |
3772 | 3772 | |
3773 | 3773 | // build query |
3774 | - $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')'); |
|
3774 | + $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')'); |
|
3775 | 3775 | |
3776 | 3776 | $tblsc = $this->getFullTableName('site_content'); |
3777 | 3777 | $tbldg = $this->getFullTableName('document_groups'); |
@@ -3822,10 +3822,10 @@ discard block |
||
3822 | 3822 | return false; |
3823 | 3823 | } else { |
3824 | 3824 | // modify field names to use sc. table reference |
3825 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3826 | - $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3825 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3826 | + $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3827 | 3827 | if ($where != '') { |
3828 | - $where = 'AND ' . $where; |
|
3828 | + $where = 'AND '.$where; |
|
3829 | 3829 | } |
3830 | 3830 | |
3831 | 3831 | $published = ($published !== 'all') ? "AND sc.published = '{$published}'" : ''; |
@@ -3836,13 +3836,13 @@ discard block |
||
3836 | 3836 | $docgrp = implode(',', $docgrp); |
3837 | 3837 | } |
3838 | 3838 | |
3839 | - $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')'); |
|
3839 | + $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')'); |
|
3840 | 3840 | |
3841 | 3841 | $tblsc = $this->getFullTableName('site_content'); |
3842 | 3842 | $tbldg = $this->getFullTableName('document_groups'); |
3843 | 3843 | |
3844 | 3844 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
3845 | - 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); |
|
3845 | + 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); |
|
3846 | 3846 | |
3847 | 3847 | $resourceArray = $this->db->makeArray($result); |
3848 | 3848 | |
@@ -3946,12 +3946,12 @@ discard block |
||
3946 | 3946 | $tbldg = $this->getFullTableName("document_groups"); |
3947 | 3947 | $activeSql = $active == 1 ? "AND sc.published=1 AND sc.deleted=0" : ""; |
3948 | 3948 | // modify field names to use sc. table reference |
3949 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3949 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3950 | 3950 | // get document groups for current user |
3951 | 3951 | if ($docgrp = $this->getUserDocGroups()) { |
3952 | 3952 | $docgrp = implode(",", $docgrp); |
3953 | 3953 | } |
3954 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3954 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3955 | 3955 | $result = $this->db->select($fields, "{$tblsc} sc LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id='{$pageid}' {$activeSql}) AND ({$access})", "", 1); |
3956 | 3956 | $pageInfo = $this->db->getRow($result); |
3957 | 3957 | |
@@ -3998,7 +3998,7 @@ discard block |
||
3998 | 3998 | { |
3999 | 3999 | if ($this->currentSnippet) { |
4000 | 4000 | $tbl = $this->getFullTableName("site_snippets"); |
4001 | - $rs = $this->db->select('id', $tbl, "name='" . $this->db->escape($this->currentSnippet) . "'", '', 1); |
|
4001 | + $rs = $this->db->select('id', $tbl, "name='".$this->db->escape($this->currentSnippet)."'", '', 1); |
|
4002 | 4002 | if ($snippetId = $this->db->getValue($rs)) { |
4003 | 4003 | return $snippetId; |
4004 | 4004 | } |
@@ -4025,23 +4025,23 @@ discard block |
||
4025 | 4025 | */ |
4026 | 4026 | public function clearCache($type = '', $report = false) |
4027 | 4027 | { |
4028 | - $cache_dir = MODX_BASE_PATH . $this->getCacheFolder(); |
|
4028 | + $cache_dir = MODX_BASE_PATH.$this->getCacheFolder(); |
|
4029 | 4029 | if (is_array($type)) { |
4030 | 4030 | foreach ($type as $_) { |
4031 | 4031 | $this->clearCache($_, $report); |
4032 | 4032 | } |
4033 | 4033 | } elseif ($type == 'full') { |
4034 | - include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php'); |
|
4034 | + include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php'); |
|
4035 | 4035 | $sync = new synccache(); |
4036 | 4036 | $sync->setCachepath($cache_dir); |
4037 | 4037 | $sync->setReport($report); |
4038 | 4038 | $sync->emptyCache(); |
4039 | 4039 | } elseif (preg_match('@^[1-9][0-9]*$@', $type)) { |
4040 | 4040 | $key = ($this->config['cache_type'] == 2) ? $this->makePageCacheKey($type) : $type; |
4041 | - $file_name = "docid_" . $key . "_*.pageCache.php"; |
|
4042 | - $cache_path = $cache_dir . $file_name; |
|
4041 | + $file_name = "docid_".$key."_*.pageCache.php"; |
|
4042 | + $cache_path = $cache_dir.$file_name; |
|
4043 | 4043 | $files = glob($cache_path); |
4044 | - $files[] = $cache_dir . "docid_" . $key . ".pageCache.php"; |
|
4044 | + $files[] = $cache_dir."docid_".$key.".pageCache.php"; |
|
4045 | 4045 | foreach ($files as $file) { |
4046 | 4046 | if (!is_file($file)) { |
4047 | 4047 | continue; |
@@ -4049,7 +4049,7 @@ discard block |
||
4049 | 4049 | unlink($file); |
4050 | 4050 | } |
4051 | 4051 | } else { |
4052 | - $files = glob($cache_dir . '*'); |
|
4052 | + $files = glob($cache_dir.'*'); |
|
4053 | 4053 | foreach ($files as $file) { |
4054 | 4054 | $name = basename($file); |
4055 | 4055 | if (strpos($name, '.pageCache.php') === false) { |
@@ -4117,14 +4117,14 @@ discard block |
||
4117 | 4117 | $f_url_suffix = '/'; |
4118 | 4118 | } |
4119 | 4119 | |
4120 | - $alPath = !empty($al['path']) ? $al['path'] . '/' : ''; |
|
4120 | + $alPath = !empty($al['path']) ? $al['path'].'/' : ''; |
|
4121 | 4121 | |
4122 | 4122 | if ($al && $al['alias']) { |
4123 | 4123 | $alias = $al['alias']; |
4124 | 4124 | } |
4125 | 4125 | } |
4126 | 4126 | |
4127 | - $alias = $alPath . $f_url_prefix . $alias . $f_url_suffix; |
|
4127 | + $alias = $alPath.$f_url_prefix.$alias.$f_url_suffix; |
|
4128 | 4128 | $url = "{$alias}{$args}"; |
4129 | 4129 | } else { |
4130 | 4130 | $url = "index.php?id={$id}{$args}"; |
@@ -4143,7 +4143,7 @@ discard block |
||
4143 | 4143 | } |
4144 | 4144 | |
4145 | 4145 | //TODO: check to make sure that $site_url incudes the url :port (e.g. :8080) |
4146 | - $host = $scheme == 'full' ? $this->config['site_url'] : $scheme . '://' . $_SERVER['HTTP_HOST'] . $host; |
|
4146 | + $host = $scheme == 'full' ? $this->config['site_url'] : $scheme.'://'.$_SERVER['HTTP_HOST'].$host; |
|
4147 | 4147 | } |
4148 | 4148 | |
4149 | 4149 | //fix strictUrl by Bumkaka |
@@ -4152,9 +4152,9 @@ discard block |
||
4152 | 4152 | } |
4153 | 4153 | |
4154 | 4154 | if ($this->config['xhtml_urls']) { |
4155 | - $url = preg_replace("/&(?!amp;)/", "&", $host . $virtualDir . $url); |
|
4155 | + $url = preg_replace("/&(?!amp;)/", "&", $host.$virtualDir.$url); |
|
4156 | 4156 | } else { |
4157 | - $url = $host . $virtualDir . $url; |
|
4157 | + $url = $host.$virtualDir.$url; |
|
4158 | 4158 | } |
4159 | 4159 | |
4160 | 4160 | $evtOut = $this->invokeEvent('OnMakeDocUrl', array( |
@@ -4178,21 +4178,21 @@ discard block |
||
4178 | 4178 | if (isset($this->aliasListing[$id])) { |
4179 | 4179 | $out = $this->aliasListing[$id]; |
4180 | 4180 | } else { |
4181 | - $q = $this->db->query("SELECT id,alias,isfolder,parent FROM " . $this->getFullTableName("site_content") . " WHERE id=" . (int)$id); |
|
4181 | + $q = $this->db->query("SELECT id,alias,isfolder,parent FROM ".$this->getFullTableName("site_content")." WHERE id=".(int) $id); |
|
4182 | 4182 | if ($this->db->getRecordCount($q) == '1') { |
4183 | 4183 | $q = $this->db->getRow($q); |
4184 | 4184 | $this->aliasListing[$id] = array( |
4185 | - 'id' => (int)$q['id'], |
|
4185 | + 'id' => (int) $q['id'], |
|
4186 | 4186 | 'alias' => $q['alias'] == '' ? $q['id'] : $q['alias'], |
4187 | - 'parent' => (int)$q['parent'], |
|
4188 | - 'isfolder' => (int)$q['isfolder'], |
|
4187 | + 'parent' => (int) $q['parent'], |
|
4188 | + 'isfolder' => (int) $q['isfolder'], |
|
4189 | 4189 | ); |
4190 | 4190 | if ($this->aliasListing[$id]['parent'] > 0) { |
4191 | 4191 | //fix alias_path_usage |
4192 | 4192 | if ($this->config['use_alias_path'] == '1') { |
4193 | 4193 | //&& $tmp['path'] != '' - fix error slash with epty path |
4194 | 4194 | $tmp = $this->getAliasListing($this->aliasListing[$id]['parent']); |
4195 | - $this->aliasListing[$id]['path'] = $tmp['path'] . ($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '') . $tmp['alias'] : ''); |
|
4195 | + $this->aliasListing[$id]['path'] = $tmp['path'].($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '').$tmp['alias'] : ''); |
|
4196 | 4196 | } else { |
4197 | 4197 | $this->aliasListing[$id]['path'] = ''; |
4198 | 4198 | } |
@@ -4233,7 +4233,7 @@ discard block |
||
4233 | 4233 | $out = array(); |
4234 | 4234 | if (empty($this->version) || !is_array($this->version)) { |
4235 | 4235 | //include for compatibility modx version < 1.0.10 |
4236 | - include MODX_MANAGER_PATH . "includes/version.inc.php"; |
|
4236 | + include MODX_MANAGER_PATH."includes/version.inc.php"; |
|
4237 | 4237 | $this->version = array(); |
4238 | 4238 | $this->version['version'] = isset($modx_version) ? $modx_version : ''; |
4239 | 4239 | $this->version['branch'] = isset($modx_branch) ? $modx_branch : ''; |
@@ -4255,18 +4255,18 @@ discard block |
||
4255 | 4255 | { |
4256 | 4256 | if (isset($this->snippetCache[$snippetName])) { |
4257 | 4257 | $snippet = $this->snippetCache[$snippetName]; |
4258 | - $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : ''; |
|
4258 | + $properties = !empty($this->snippetCache[$snippetName."Props"]) ? $this->snippetCache[$snippetName."Props"] : ''; |
|
4259 | 4259 | } else { // not in cache so let's check the db |
4260 | - $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;"; |
|
4260 | + $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;"; |
|
4261 | 4261 | $result = $this->db->query($sql); |
4262 | 4262 | if ($this->db->getRecordCount($result) == 1) { |
4263 | 4263 | $row = $this->db->getRow($result); |
4264 | 4264 | $snippet = $this->snippetCache[$snippetName] = $row['snippet']; |
4265 | 4265 | $mergedProperties = array_merge($this->parseProperties($row['properties']), $this->parseProperties($row['sharedproperties'])); |
4266 | - $properties = $this->snippetCache[$snippetName . "Props"] = json_encode($mergedProperties); |
|
4266 | + $properties = $this->snippetCache[$snippetName."Props"] = json_encode($mergedProperties); |
|
4267 | 4267 | } else { |
4268 | 4268 | $snippet = $this->snippetCache[$snippetName] = "return false;"; |
4269 | - $properties = $this->snippetCache[$snippetName . "Props"] = ''; |
|
4269 | + $properties = $this->snippetCache[$snippetName."Props"] = ''; |
|
4270 | 4270 | } |
4271 | 4271 | } |
4272 | 4272 | // load default params/properties |
@@ -4366,7 +4366,7 @@ discard block |
||
4366 | 4366 | if (strpos($tpl, $s) !== false) { |
4367 | 4367 | $tpl = str_replace($s, $value, $tpl); |
4368 | 4368 | } elseif ($this->debug) { |
4369 | - $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
4369 | + $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
4370 | 4370 | } |
4371 | 4371 | } |
4372 | 4372 | |
@@ -4415,7 +4415,7 @@ discard block |
||
4415 | 4415 | case 'CODE': |
4416 | 4416 | break; |
4417 | 4417 | case 'FILE': |
4418 | - $template = file_get_contents(MODX_BASE_PATH . $template); |
|
4418 | + $template = file_get_contents(MODX_BASE_PATH.$template); |
|
4419 | 4419 | break; |
4420 | 4420 | case 'CHUNK': |
4421 | 4421 | $template = $this->getChunk($template); |
@@ -4448,7 +4448,7 @@ discard block |
||
4448 | 4448 | if ($mode !== 'formatOnly' && empty($timestamp)) { |
4449 | 4449 | return '-'; |
4450 | 4450 | } |
4451 | - $timestamp = (int)$timestamp; |
|
4451 | + $timestamp = (int) $timestamp; |
|
4452 | 4452 | |
4453 | 4453 | switch ($this->config['datetime_format']) { |
4454 | 4454 | case 'YYYY/mm/dd': |
@@ -4468,7 +4468,7 @@ discard block |
||
4468 | 4468 | } |
4469 | 4469 | |
4470 | 4470 | if (empty($mode)) { |
4471 | - $strTime = strftime($dateFormat . " %H:%M:%S", $timestamp); |
|
4471 | + $strTime = strftime($dateFormat." %H:%M:%S", $timestamp); |
|
4472 | 4472 | } elseif ($mode == 'dateOnly') { |
4473 | 4473 | $strTime = strftime($dateFormat, $timestamp); |
4474 | 4474 | } elseif ($mode == 'formatOnly') { |
@@ -4522,7 +4522,7 @@ discard block |
||
4522 | 4522 | $S = 0; |
4523 | 4523 | } |
4524 | 4524 | $timeStamp = mktime($H, $M, $S, $m, $d, $Y); |
4525 | - $timeStamp = (int)$timeStamp; |
|
4525 | + $timeStamp = (int) $timeStamp; |
|
4526 | 4526 | return $timeStamp; |
4527 | 4527 | } |
4528 | 4528 | |
@@ -4564,7 +4564,7 @@ discard block |
||
4564 | 4564 | if ($v === 'value') { |
4565 | 4565 | unset($_[$i]); |
4566 | 4566 | } else { |
4567 | - $_[$i] = 'tv.' . $v; |
|
4567 | + $_[$i] = 'tv.'.$v; |
|
4568 | 4568 | } |
4569 | 4569 | } |
4570 | 4570 | $fields = implode(',', $_); |
@@ -4573,12 +4573,12 @@ discard block |
||
4573 | 4573 | } |
4574 | 4574 | |
4575 | 4575 | if ($tvsort != '') { |
4576 | - $tvsort = 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort)))); |
|
4576 | + $tvsort = 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort)))); |
|
4577 | 4577 | } |
4578 | 4578 | if ($tvidnames == "*") { |
4579 | 4579 | $query = "tv.id<>0"; |
4580 | 4580 | } else { |
4581 | - $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name") . " IN ('" . implode("','", $tvidnames) . "')"; |
|
4581 | + $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name")." IN ('".implode("','", $tvidnames)."')"; |
|
4582 | 4582 | } |
4583 | 4583 | |
4584 | 4584 | $this->getUserDocGroups(); |
@@ -4739,18 +4739,18 @@ discard block |
||
4739 | 4739 | } |
4740 | 4740 | |
4741 | 4741 | // get user defined template variables |
4742 | - $fields = ($fields == '') ? 'tv.*' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $fields)))); |
|
4743 | - $sort = ($sort == '') ? '' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $sort)))); |
|
4742 | + $fields = ($fields == '') ? 'tv.*' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $fields)))); |
|
4743 | + $sort = ($sort == '') ? '' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $sort)))); |
|
4744 | 4744 | |
4745 | 4745 | if ($idnames == '*') { |
4746 | 4746 | $query = 'tv.id<>0'; |
4747 | 4747 | } else { |
4748 | - $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name') . " IN ('" . implode("','", $idnames) . "')"; |
|
4748 | + $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name')." IN ('".implode("','", $idnames)."')"; |
|
4749 | 4749 | } |
4750 | 4750 | |
4751 | - $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars') . " tv |
|
4752 | - INNER JOIN " . $this->getFullTableName('site_tmplvar_templates') . " tvtpl ON tvtpl.tmplvarid = tv.id |
|
4753 | - 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}" : "")); |
|
4751 | + $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars')." tv |
|
4752 | + INNER JOIN " . $this->getFullTableName('site_tmplvar_templates')." tvtpl ON tvtpl.tmplvarid = tv.id |
|
4753 | + 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}" : "")); |
|
4754 | 4754 | |
4755 | 4755 | $result = $this->db->makeArray($rs); |
4756 | 4756 | |
@@ -4799,16 +4799,16 @@ discard block |
||
4799 | 4799 | $output = array(); |
4800 | 4800 | $vars = ($idnames == '*' || is_array($idnames)) ? $idnames : array($idnames); |
4801 | 4801 | |
4802 | - $docid = (int)$docid > 0 ? (int)$docid : $this->documentIdentifier; |
|
4802 | + $docid = (int) $docid > 0 ? (int) $docid : $this->documentIdentifier; |
|
4803 | 4803 | // remove sort for speed |
4804 | 4804 | $result = $this->getTemplateVars($vars, '*', $docid, $published, '', ''); |
4805 | 4805 | |
4806 | 4806 | if ($result == false) { |
4807 | 4807 | return false; |
4808 | 4808 | } else { |
4809 | - $baspath = MODX_MANAGER_PATH . 'includes'; |
|
4810 | - include_once $baspath . '/tmplvars.format.inc.php'; |
|
4811 | - include_once $baspath . '/tmplvars.commands.inc.php'; |
|
4809 | + $baspath = MODX_MANAGER_PATH.'includes'; |
|
4810 | + include_once $baspath.'/tmplvars.format.inc.php'; |
|
4811 | + include_once $baspath.'/tmplvars.commands.inc.php'; |
|
4812 | 4812 | |
4813 | 4813 | for ($i = 0; $i < count($result); $i++) { |
4814 | 4814 | $row = $result[$i]; |
@@ -4833,7 +4833,7 @@ discard block |
||
4833 | 4833 | */ |
4834 | 4834 | public function getFullTableName($tbl) |
4835 | 4835 | { |
4836 | - return $this->db->config['dbase'] . ".`" . $this->db->config['table_prefix'] . $tbl . "`"; |
|
4836 | + return $this->db->config['dbase'].".`".$this->db->config['table_prefix'].$tbl."`"; |
|
4837 | 4837 | } |
4838 | 4838 | |
4839 | 4839 | /** |
@@ -4912,7 +4912,7 @@ discard block |
||
4912 | 4912 | public function getCachePath() |
4913 | 4913 | { |
4914 | 4914 | global $base_url; |
4915 | - $pth = $base_url . $this->getCacheFolder(); |
|
4915 | + $pth = $base_url.$this->getCacheFolder(); |
|
4916 | 4916 | return $pth; |
4917 | 4917 | } |
4918 | 4918 | |
@@ -4964,8 +4964,8 @@ discard block |
||
4964 | 4964 | $out = false; |
4965 | 4965 | |
4966 | 4966 | if (!empty($context)) { |
4967 | - if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) { |
|
4968 | - $out = $_SESSION[$context . 'InternalKey']; |
|
4967 | + if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) { |
|
4968 | + $out = $_SESSION[$context.'InternalKey']; |
|
4969 | 4969 | } |
4970 | 4970 | } else { |
4971 | 4971 | switch (true) { |
@@ -4993,8 +4993,8 @@ discard block |
||
4993 | 4993 | $out = false; |
4994 | 4994 | |
4995 | 4995 | if (!empty($context)) { |
4996 | - if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) { |
|
4997 | - $out = $_SESSION[$context . 'Shortname']; |
|
4996 | + if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) { |
|
4997 | + $out = $_SESSION[$context.'Shortname']; |
|
4998 | 4998 | } |
4999 | 4999 | } else { |
5000 | 5000 | switch (true) { |
@@ -5065,8 +5065,8 @@ discard block |
||
5065 | 5065 | */ |
5066 | 5066 | public function getWebUserInfo($uid) |
5067 | 5067 | { |
5068 | - $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users") . " wu |
|
5069 | - INNER JOIN " . $this->getFullTableName("web_user_attributes") . " wua ON wua.internalkey=wu.id", "wu.id='{$uid}'"); |
|
5068 | + $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users")." wu |
|
5069 | + INNER JOIN " . $this->getFullTableName("web_user_attributes")." wua ON wua.internalkey=wu.id", "wu.id='{$uid}'"); |
|
5070 | 5070 | if ($row = $this->db->getRow($rs)) { |
5071 | 5071 | if (!isset($row['usertype']) or !$row["usertype"]) { |
5072 | 5072 | $row["usertype"] = "web"; |
@@ -5102,7 +5102,7 @@ discard block |
||
5102 | 5102 | } elseif (is_array($dg)) { |
5103 | 5103 | // resolve ids to names |
5104 | 5104 | $dgn = array(); |
5105 | - $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (" . implode(",", $dg) . ")"); |
|
5105 | + $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (".implode(",", $dg).")"); |
|
5106 | 5106 | while ($row = $this->db->getRow($ds)) { |
5107 | 5107 | $dgn[] = $row['name']; |
5108 | 5108 | } |
@@ -5130,7 +5130,7 @@ discard block |
||
5130 | 5130 | $rt = false; |
5131 | 5131 | if ($_SESSION["webValidated"] == 1) { |
5132 | 5132 | $tbl = $this->getFullTableName("web_users"); |
5133 | - $ds = $this->db->select('id, username, password', $tbl, "id='" . $this->getLoginUserID() . "'"); |
|
5133 | + $ds = $this->db->select('id, username, password', $tbl, "id='".$this->getLoginUserID()."'"); |
|
5134 | 5134 | if ($row = $this->db->getRow($ds)) { |
5135 | 5135 | if ($row["password"] == md5($oldPwd)) { |
5136 | 5136 | if (strlen($newPwd) < 6) { |
@@ -5140,7 +5140,7 @@ discard block |
||
5140 | 5140 | } else { |
5141 | 5141 | $this->db->update(array( |
5142 | 5142 | 'password' => $this->db->escape($newPwd), |
5143 | - ), $tbl, "id='" . $this->getLoginUserID() . "'"); |
|
5143 | + ), $tbl, "id='".$this->getLoginUserID()."'"); |
|
5144 | 5144 | // invoke OnWebChangePassword event |
5145 | 5145 | $this->invokeEvent("OnWebChangePassword", array( |
5146 | 5146 | "userid" => $row["id"], |
@@ -5171,8 +5171,8 @@ discard block |
||
5171 | 5171 | // check cache |
5172 | 5172 | $grpNames = isset($_SESSION['webUserGroupNames']) ? $_SESSION['webUserGroupNames'] : false; |
5173 | 5173 | if (!is_array($grpNames)) { |
5174 | - $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names") . " wgn |
|
5175 | - INNER JOIN " . $this->getFullTableName("web_groups") . " wg ON wg.webgroup=wgn.id AND wg.webuser='" . $this->getLoginUserID() . "'"); |
|
5174 | + $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names")." wgn |
|
5175 | + INNER JOIN " . $this->getFullTableName("web_groups")." wg ON wg.webgroup=wgn.id AND wg.webuser='".$this->getLoginUserID()."'"); |
|
5176 | 5176 | $grpNames = $this->db->getColumn("name", $rs); |
5177 | 5177 | // save to cache |
5178 | 5178 | $_SESSION['webUserGroupNames'] = $grpNames; |
@@ -5205,7 +5205,7 @@ discard block |
||
5205 | 5205 | if (strpos(strtolower($src), "<style") !== false || strpos(strtolower($src), "<link") !== false) { |
5206 | 5206 | $this->sjscripts[$nextpos] = $src; |
5207 | 5207 | } else { |
5208 | - $this->sjscripts[$nextpos] = "\t" . '<link rel="stylesheet" type="text/css" href="' . $src . '" ' . ($media ? 'media="' . $media . '" ' : '') . '/>'; |
|
5208 | + $this->sjscripts[$nextpos] = "\t".'<link rel="stylesheet" type="text/css" href="'.$src.'" '.($media ? 'media="'.$media.'" ' : '').'/>'; |
|
5209 | 5209 | } |
5210 | 5210 | } |
5211 | 5211 | |
@@ -5284,7 +5284,7 @@ discard block |
||
5284 | 5284 | } |
5285 | 5285 | |
5286 | 5286 | if ($useThisVer && $plaintext != true && (strpos(strtolower($src), "<script") === false)) { |
5287 | - $src = "\t" . '<script type="text/javascript" src="' . $src . '"></script>'; |
|
5287 | + $src = "\t".'<script type="text/javascript" src="'.$src.'"></script>'; |
|
5288 | 5288 | } |
5289 | 5289 | if ($startup) { |
5290 | 5290 | $pos = isset($overwritepos) ? $overwritepos : max(array_merge(array(0), array_keys($this->sjscripts))) + 1; |
@@ -5431,7 +5431,7 @@ discard block |
||
5431 | 5431 | $eventtime = $this->getMicroTime() - $eventtime; |
5432 | 5432 | $this->pluginsCode .= sprintf('<fieldset><legend><b>%s / %s</b> (%2.2f ms)</legend>', $evtName, $pluginName, $eventtime * 1000); |
5433 | 5433 | foreach ($parameter as $k => $v) { |
5434 | - $this->pluginsCode .= "{$k} => " . print_r($v, true) . '<br>'; |
|
5434 | + $this->pluginsCode .= "{$k} => ".print_r($v, true).'<br>'; |
|
5435 | 5435 | } |
5436 | 5436 | $this->pluginsCode .= '</fieldset><br />'; |
5437 | 5437 | $this->pluginsTime["{$evtName} / {$pluginName}"] += $eventtime; |
@@ -5459,13 +5459,13 @@ discard block |
||
5459 | 5459 | $plugin = array(); |
5460 | 5460 | if (isset($this->pluginCache[$pluginName])) { |
5461 | 5461 | $pluginCode = $this->pluginCache[$pluginName]; |
5462 | - $pluginProperties = isset($this->pluginCache[$pluginName . "Props"]) ? $this->pluginCache[$pluginName . "Props"] : ''; |
|
5462 | + $pluginProperties = isset($this->pluginCache[$pluginName."Props"]) ? $this->pluginCache[$pluginName."Props"] : ''; |
|
5463 | 5463 | } else { |
5464 | 5464 | $pluginName = $this->db->escape($pluginName); |
5465 | 5465 | $result = $this->db->select('name, plugincode, properties', $this->getFullTableName("site_plugins"), "name='{$pluginName}' AND disabled=0"); |
5466 | 5466 | if ($row = $this->db->getRow($result)) { |
5467 | 5467 | $pluginCode = $this->pluginCache[$row['name']] = $row['plugincode']; |
5468 | - $pluginProperties = $this->pluginCache[$row['name'] . "Props"] = $row['properties']; |
|
5468 | + $pluginProperties = $this->pluginCache[$row['name']."Props"] = $row['properties']; |
|
5469 | 5469 | } else { |
5470 | 5470 | $pluginCode = $this->pluginCache[$pluginName] = "return false;"; |
5471 | 5471 | $pluginProperties = ''; |
@@ -5567,7 +5567,7 @@ discard block |
||
5567 | 5567 | public function parseDocBlockFromFile($element_dir, $filename, $escapeValues = false) |
5568 | 5568 | { |
5569 | 5569 | $params = array(); |
5570 | - $fullpath = $element_dir . '/' . $filename; |
|
5570 | + $fullpath = $element_dir.'/'.$filename; |
|
5571 | 5571 | if (is_readable($fullpath)) { |
5572 | 5572 | $tpl = @fopen($fullpath, "r"); |
5573 | 5573 | if ($tpl) { |
@@ -5734,8 +5734,8 @@ discard block |
||
5734 | 5734 | $ph = array('site_url' => MODX_SITE_URL); |
5735 | 5735 | $regexUrl = "/((http|https|ftp|ftps)\:\/\/[^\/]+(\/[^\s]+[^,.?!:;\s])?)/"; |
5736 | 5736 | $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'; |
5737 | - $emailSubject = isset($parsed['name']) ? '?subject=' . $parsed['name'] : ''; |
|
5738 | - $emailSubject .= isset($parsed['version']) ? ' v' . $parsed['version'] : ''; |
|
5737 | + $emailSubject = isset($parsed['name']) ? '?subject='.$parsed['name'] : ''; |
|
5738 | + $emailSubject .= isset($parsed['version']) ? ' v'.$parsed['version'] : ''; |
|
5739 | 5739 | foreach ($parsed as $key => $val) { |
5740 | 5740 | if (is_array($val)) { |
5741 | 5741 | foreach ($val as $key2 => $val2) { |
@@ -5744,7 +5744,7 @@ discard block |
||
5744 | 5744 | $val2 = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val2); |
5745 | 5745 | } |
5746 | 5746 | if (preg_match($regexEmail, $val2, $url)) { |
5747 | - $val2 = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val2); |
|
5747 | + $val2 = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val2); |
|
5748 | 5748 | } |
5749 | 5749 | $parsed[$key][$key2] = $val2; |
5750 | 5750 | } |
@@ -5754,7 +5754,7 @@ discard block |
||
5754 | 5754 | $val = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val); |
5755 | 5755 | } |
5756 | 5756 | if (preg_match($regexEmail, $val, $url)) { |
5757 | - $val = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val); |
|
5757 | + $val = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val); |
|
5758 | 5758 | } |
5759 | 5759 | $parsed[$key] = $val; |
5760 | 5760 | } |
@@ -5768,32 +5768,32 @@ discard block |
||
5768 | 5768 | ); |
5769 | 5769 | |
5770 | 5770 | $nl = "\n"; |
5771 | - $list = isset($parsed['logo']) ? '<img src="' . $this->config['base_url'] . ltrim($parsed['logo'], "/") . '" style="float:right;max-width:100px;height:auto;" />' . $nl : ''; |
|
5772 | - $list .= '<p>' . $nl; |
|
5773 | - $list .= isset($parsed['name']) ? '<strong>' . $parsed['name'] . '</strong><br/>' . $nl : ''; |
|
5774 | - $list .= isset($parsed['description']) ? $parsed['description'] . $nl : ''; |
|
5775 | - $list .= '</p><br/>' . $nl; |
|
5776 | - $list .= isset($parsed['version']) ? '<p><strong>' . $_lang['version'] . ':</strong> ' . $parsed['version'] . '</p>' . $nl : ''; |
|
5777 | - $list .= isset($parsed['license']) ? '<p><strong>' . $_lang['license'] . ':</strong> ' . $parsed['license'] . '</p>' . $nl : ''; |
|
5778 | - $list .= isset($parsed['lastupdate']) ? '<p><strong>' . $_lang['last_update'] . ':</strong> ' . $parsed['lastupdate'] . '</p>' . $nl : ''; |
|
5779 | - $list .= '<br/>' . $nl; |
|
5771 | + $list = isset($parsed['logo']) ? '<img src="'.$this->config['base_url'].ltrim($parsed['logo'], "/").'" style="float:right;max-width:100px;height:auto;" />'.$nl : ''; |
|
5772 | + $list .= '<p>'.$nl; |
|
5773 | + $list .= isset($parsed['name']) ? '<strong>'.$parsed['name'].'</strong><br/>'.$nl : ''; |
|
5774 | + $list .= isset($parsed['description']) ? $parsed['description'].$nl : ''; |
|
5775 | + $list .= '</p><br/>'.$nl; |
|
5776 | + $list .= isset($parsed['version']) ? '<p><strong>'.$_lang['version'].':</strong> '.$parsed['version'].'</p>'.$nl : ''; |
|
5777 | + $list .= isset($parsed['license']) ? '<p><strong>'.$_lang['license'].':</strong> '.$parsed['license'].'</p>'.$nl : ''; |
|
5778 | + $list .= isset($parsed['lastupdate']) ? '<p><strong>'.$_lang['last_update'].':</strong> '.$parsed['lastupdate'].'</p>'.$nl : ''; |
|
5779 | + $list .= '<br/>'.$nl; |
|
5780 | 5780 | $first = true; |
5781 | 5781 | foreach ($arrayParams as $param => $label) { |
5782 | 5782 | if (isset($parsed[$param])) { |
5783 | 5783 | if ($first) { |
5784 | - $list .= '<p><strong>' . $_lang['references'] . '</strong></p>' . $nl; |
|
5785 | - $list .= '<ul class="docBlockList">' . $nl; |
|
5784 | + $list .= '<p><strong>'.$_lang['references'].'</strong></p>'.$nl; |
|
5785 | + $list .= '<ul class="docBlockList">'.$nl; |
|
5786 | 5786 | $first = false; |
5787 | 5787 | } |
5788 | - $list .= ' <li><strong>' . $label . '</strong>' . $nl; |
|
5789 | - $list .= ' <ul>' . $nl; |
|
5788 | + $list .= ' <li><strong>'.$label.'</strong>'.$nl; |
|
5789 | + $list .= ' <ul>'.$nl; |
|
5790 | 5790 | foreach ($parsed[$param] as $val) { |
5791 | - $list .= ' <li>' . $val . '</li>' . $nl; |
|
5791 | + $list .= ' <li>'.$val.'</li>'.$nl; |
|
5792 | 5792 | } |
5793 | - $list .= ' </ul></li>' . $nl; |
|
5793 | + $list .= ' </ul></li>'.$nl; |
|
5794 | 5794 | } |
5795 | 5795 | } |
5796 | - $list .= !$first ? '</ul>' . $nl : ''; |
|
5796 | + $list .= !$first ? '</ul>'.$nl : ''; |
|
5797 | 5797 | |
5798 | 5798 | return $list; |
5799 | 5799 | } |
@@ -5869,7 +5869,7 @@ discard block |
||
5869 | 5869 | */ |
5870 | 5870 | public function addSnippet($name, $phpCode) |
5871 | 5871 | { |
5872 | - $this->snippetCache['#' . $name] = $phpCode; |
|
5872 | + $this->snippetCache['#'.$name] = $phpCode; |
|
5873 | 5873 | } |
5874 | 5874 | |
5875 | 5875 | /** |
@@ -5878,7 +5878,7 @@ discard block |
||
5878 | 5878 | */ |
5879 | 5879 | public function addChunk($name, $text) |
5880 | 5880 | { |
5881 | - $this->chunkCache['#' . $name] = $text; |
|
5881 | + $this->chunkCache['#'.$name] = $text; |
|
5882 | 5882 | } |
5883 | 5883 | |
5884 | 5884 | /** |
@@ -5914,7 +5914,7 @@ discard block |
||
5914 | 5914 | } |
5915 | 5915 | |
5916 | 5916 | if (!$isSafe) { |
5917 | - $msg = $phpcode . "\n" . $this->currentSnippet . "\n" . print_r($_SERVER, true); |
|
5917 | + $msg = $phpcode."\n".$this->currentSnippet."\n".print_r($_SERVER, true); |
|
5918 | 5918 | $title = sprintf('Unknown eval was executed (%s)', $this->htmlspecialchars(substr(trim($phpcode), 0, 50))); |
5919 | 5919 | $this->messageQuit($title, '', true, '', '', 'Parser', $msg); |
5920 | 5920 | return; |
@@ -5928,7 +5928,7 @@ discard block |
||
5928 | 5928 | return 'array()'; |
5929 | 5929 | } |
5930 | 5930 | |
5931 | - $output = $echo . $return; |
|
5931 | + $output = $echo.$return; |
|
5932 | 5932 | modx_sanitize_gpc($output); |
5933 | 5933 | return $this->htmlspecialchars($output); // Maybe, all html tags are dangerous |
5934 | 5934 | } |
@@ -5946,8 +5946,8 @@ discard block |
||
5946 | 5946 | |
5947 | 5947 | $safe = explode(',', $safe_functions); |
5948 | 5948 | |
5949 | - $phpcode = rtrim($phpcode, ';') . ';'; |
|
5950 | - $tokens = token_get_all('<?php ' . $phpcode); |
|
5949 | + $phpcode = rtrim($phpcode, ';').';'; |
|
5950 | + $tokens = token_get_all('<?php '.$phpcode); |
|
5951 | 5951 | foreach ($tokens as $i => $token) { |
5952 | 5952 | if (!is_array($token)) { |
5953 | 5953 | continue; |
@@ -5982,7 +5982,7 @@ discard block |
||
5982 | 5982 | */ |
5983 | 5983 | public function atBindFileContent($str = '') |
5984 | 5984 | { |
5985 | - $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'] . 'files/', ''); |
|
5985 | + $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'].'files/', ''); |
|
5986 | 5986 | |
5987 | 5987 | if (stripos($str, '@FILE') !== 0) { |
5988 | 5988 | return $str; |
@@ -6005,7 +6005,7 @@ discard block |
||
6005 | 6005 | $errorMsg = sprintf("Could not retrieve string '%s'.", $str); |
6006 | 6006 | |
6007 | 6007 | foreach ($search_path as $path) { |
6008 | - $file_path = MODX_BASE_PATH . $path . $str; |
|
6008 | + $file_path = MODX_BASE_PATH.$path.$str; |
|
6009 | 6009 | if (strpos($file_path, MODX_MANAGER_PATH) === 0) { |
6010 | 6010 | return $errorMsg; |
6011 | 6011 | } elseif (is_file($file_path)) { |
@@ -6019,7 +6019,7 @@ discard block |
||
6019 | 6019 | return $errorMsg; |
6020 | 6020 | } |
6021 | 6021 | |
6022 | - $content = (string)file_get_contents($file_path); |
|
6022 | + $content = (string) file_get_contents($file_path); |
|
6023 | 6023 | if ($content === false) { |
6024 | 6024 | return $errorMsg; |
6025 | 6025 | } |
@@ -6131,22 +6131,22 @@ discard block |
||
6131 | 6131 | |
6132 | 6132 | $version = isset($GLOBALS['modx_version']) ? $GLOBALS['modx_version'] : ''; |
6133 | 6133 | $release_date = isset($GLOBALS['release_date']) ? $GLOBALS['release_date'] : ''; |
6134 | - $request_uri = "http://" . $_SERVER['HTTP_HOST'] . ($_SERVER["SERVER_PORT"] == 80 ? "" : (":" . $_SERVER["SERVER_PORT"])) . $_SERVER['REQUEST_URI']; |
|
6134 | + $request_uri = "http://".$_SERVER['HTTP_HOST'].($_SERVER["SERVER_PORT"] == 80 ? "" : (":".$_SERVER["SERVER_PORT"])).$_SERVER['REQUEST_URI']; |
|
6135 | 6135 | $request_uri = $this->htmlspecialchars($request_uri, ENT_QUOTES, $this->config['modx_charset']); |
6136 | 6136 | $ua = $this->htmlspecialchars($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, $this->config['modx_charset']); |
6137 | 6137 | $referer = $this->htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_QUOTES, $this->config['modx_charset']); |
6138 | 6138 | if ($is_error) { |
6139 | 6139 | $str = '<h2 style="color:red">« Evo Parse Error »</h2>'; |
6140 | 6140 | if ($msg != 'PHP Parse Error') { |
6141 | - $str .= '<h3 style="color:red">' . $msg . '</h3>'; |
|
6141 | + $str .= '<h3 style="color:red">'.$msg.'</h3>'; |
|
6142 | 6142 | } |
6143 | 6143 | } else { |
6144 | 6144 | $str = '<h2 style="color:#003399">« Evo Debug/ stop message »</h2>'; |
6145 | - $str .= '<h3 style="color:#003399">' . $msg . '</h3>'; |
|
6145 | + $str .= '<h3 style="color:#003399">'.$msg.'</h3>'; |
|
6146 | 6146 | } |
6147 | 6147 | |
6148 | 6148 | if (!empty($query)) { |
6149 | - $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>'; |
|
6149 | + $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>'; |
|
6150 | 6150 | } |
6151 | 6151 | |
6152 | 6152 | $errortype = array( |
@@ -6169,13 +6169,13 @@ discard block |
||
6169 | 6169 | |
6170 | 6170 | if (!empty($nr) || !empty($file)) { |
6171 | 6171 | if ($text != '') { |
6172 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : ' . $text . '</div>'; |
|
6172 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : '.$text.'</div>'; |
|
6173 | 6173 | } |
6174 | 6174 | if ($output != '') { |
6175 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">' . $output . '</div>'; |
|
6175 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">'.$output.'</div>'; |
|
6176 | 6176 | } |
6177 | 6177 | if ($nr !== '') { |
6178 | - $table[] = array('ErrorType[num]', $errortype [$nr] . "[" . $nr . "]"); |
|
6178 | + $table[] = array('ErrorType[num]', $errortype [$nr]."[".$nr."]"); |
|
6179 | 6179 | } |
6180 | 6180 | if ($file) { |
6181 | 6181 | $table[] = array('File', $file); |
@@ -6194,7 +6194,7 @@ discard block |
||
6194 | 6194 | } |
6195 | 6195 | |
6196 | 6196 | if (!empty($this->event->activePlugin)) { |
6197 | - $table[] = array('Current Plugin', $this->event->activePlugin . '(' . $this->event->name . ')'); |
|
6197 | + $table[] = array('Current Plugin', $this->event->activePlugin.'('.$this->event->name.')'); |
|
6198 | 6198 | } |
6199 | 6199 | |
6200 | 6200 | $str .= $MakeTable->create($table, array('Error information', '')); |
@@ -6204,17 +6204,17 @@ discard block |
||
6204 | 6204 | $table[] = array('REQUEST_URI', $request_uri); |
6205 | 6205 | |
6206 | 6206 | if ($this->manager->action) { |
6207 | - include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
6207 | + include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php'); |
|
6208 | 6208 | global $action_list; |
6209 | 6209 | $actionName = (isset($action_list[$this->manager->action])) ? " - {$action_list[$this->manager->action]}" : ''; |
6210 | 6210 | |
6211 | - $table[] = array('Manager action', $this->manager->action . $actionName); |
|
6211 | + $table[] = array('Manager action', $this->manager->action.$actionName); |
|
6212 | 6212 | } |
6213 | 6213 | |
6214 | 6214 | if (preg_match('@^[0-9]+@', $this->documentIdentifier)) { |
6215 | 6215 | $resource = $this->getDocumentObject('id', $this->documentIdentifier); |
6216 | 6216 | $url = $this->makeUrl($this->documentIdentifier, '', '', 'full'); |
6217 | - $table[] = array('Resource', '[' . $this->documentIdentifier . '] <a href="' . $url . '" target="_blank">' . $resource['pagetitle'] . '</a>'); |
|
6217 | + $table[] = array('Resource', '['.$this->documentIdentifier.'] <a href="'.$url.'" target="_blank">'.$resource['pagetitle'].'</a>'); |
|
6218 | 6218 | } |
6219 | 6219 | $table[] = array('Referer', $referer); |
6220 | 6220 | $table[] = array('User Agent', $ua); |
@@ -6235,7 +6235,7 @@ discard block |
||
6235 | 6235 | |
6236 | 6236 | $mem = memory_get_peak_usage(true); |
6237 | 6237 | $total_mem = $mem - $this->mstart; |
6238 | - $total_mem = ($total_mem / 1024 / 1024) . ' mb'; |
|
6238 | + $total_mem = ($total_mem / 1024 / 1024).' mb'; |
|
6239 | 6239 | |
6240 | 6240 | $queryTime = $this->queryTime; |
6241 | 6241 | $phpTime = $totalTime - $queryTime; |
@@ -6256,18 +6256,18 @@ discard block |
||
6256 | 6256 | $str .= $this->get_backtrace(debug_backtrace()); |
6257 | 6257 | // Log error |
6258 | 6258 | if (!empty($this->currentSnippet)) { |
6259 | - $source = 'Snippet - ' . $this->currentSnippet; |
|
6259 | + $source = 'Snippet - '.$this->currentSnippet; |
|
6260 | 6260 | } elseif (!empty($this->event->activePlugin)) { |
6261 | - $source = 'Plugin - ' . $this->event->activePlugin; |
|
6261 | + $source = 'Plugin - '.$this->event->activePlugin; |
|
6262 | 6262 | } elseif ($source !== '') { |
6263 | - $source = 'Parser - ' . $source; |
|
6263 | + $source = 'Parser - '.$source; |
|
6264 | 6264 | } elseif ($query !== '') { |
6265 | 6265 | $source = 'SQL Query'; |
6266 | 6266 | } else { |
6267 | 6267 | $source = 'Parser'; |
6268 | 6268 | } |
6269 | 6269 | if ($msg) { |
6270 | - $source .= ' / ' . $msg; |
|
6270 | + $source .= ' / '.$msg; |
|
6271 | 6271 | } |
6272 | 6272 | if (isset($actionName) && !empty($actionName)) { |
6273 | 6273 | $source .= $actionName; |
@@ -6299,12 +6299,12 @@ discard block |
||
6299 | 6299 | |
6300 | 6300 | // Display error |
6301 | 6301 | if (isset($_SESSION['mgrValidated'])) { |
6302 | - 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> |
|
6302 | + 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> |
|
6303 | 6303 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
6304 | - <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'] . 'media/style/' . $this->config['manager_theme'] . '/style.css" /> |
|
6304 | + <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'].'media/style/'.$this->config['manager_theme'].'/style.css" /> |
|
6305 | 6305 | <style type="text/css">body { padding:10px; } td {font:inherit;}</style> |
6306 | 6306 | </head><body> |
6307 | - ' . $str . '</body></html>'; |
|
6307 | + ' . $str.'</body></html>'; |
|
6308 | 6308 | } else { |
6309 | 6309 | echo 'Error'; |
6310 | 6310 | } |
@@ -6341,7 +6341,7 @@ discard block |
||
6341 | 6341 | switch ($val['type']) { |
6342 | 6342 | case '->': |
6343 | 6343 | case '::': |
6344 | - $functionName = $val['function'] = $val['class'] . $val['type'] . $val['function']; |
|
6344 | + $functionName = $val['function'] = $val['class'].$val['type'].$val['function']; |
|
6345 | 6345 | break; |
6346 | 6346 | default: |
6347 | 6347 | $functionName = $val['function']; |
@@ -6351,7 +6351,7 @@ discard block |
||
6351 | 6351 | $args = array_pad(array(), $_, '$var'); |
6352 | 6352 | $args = implode(", ", $args); |
6353 | 6353 | $modx = &$this; |
6354 | - $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) { |
|
6354 | + $args = preg_replace_callback('/\$var/', function() use ($modx, &$tmp, $val) { |
|
6355 | 6355 | $arg = $val['args'][$tmp - 1]; |
6356 | 6356 | switch (true) { |
6357 | 6357 | case is_null($arg): { |
@@ -6363,7 +6363,7 @@ discard block |
||
6363 | 6363 | break; |
6364 | 6364 | } |
6365 | 6365 | case is_scalar($arg): { |
6366 | - $out = strlen($arg) > 20 ? 'string $var' . $tmp : ("'" . $this->htmlspecialchars(str_replace("'", "\\'", $arg)) . "'"); |
|
6366 | + $out = strlen($arg) > 20 ? 'string $var'.$tmp : ("'".$this->htmlspecialchars(str_replace("'", "\\'", $arg))."'"); |
|
6367 | 6367 | break; |
6368 | 6368 | } |
6369 | 6369 | case is_bool($arg): { |
@@ -6371,23 +6371,23 @@ discard block |
||
6371 | 6371 | break; |
6372 | 6372 | } |
6373 | 6373 | case is_array($arg): { |
6374 | - $out = 'array $var' . $tmp; |
|
6374 | + $out = 'array $var'.$tmp; |
|
6375 | 6375 | break; |
6376 | 6376 | } |
6377 | 6377 | case is_object($arg): { |
6378 | - $out = get_class($arg) . ' $var' . $tmp; |
|
6378 | + $out = get_class($arg).' $var'.$tmp; |
|
6379 | 6379 | break; |
6380 | 6380 | } |
6381 | 6381 | default: { |
6382 | - $out = '$var' . $tmp; |
|
6382 | + $out = '$var'.$tmp; |
|
6383 | 6383 | } |
6384 | 6384 | } |
6385 | 6385 | $tmp++; |
6386 | 6386 | return $out; |
6387 | 6387 | }, $args); |
6388 | 6388 | $line = array( |
6389 | - "<strong>" . $functionName . "</strong>(" . $args . ")", |
|
6390 | - $path . " on line " . $val['line'] |
|
6389 | + "<strong>".$functionName."</strong>(".$args.")", |
|
6390 | + $path." on line ".$val['line'] |
|
6391 | 6391 | ); |
6392 | 6392 | $table[] = array(implode("<br />", $line)); |
6393 | 6393 | } |
@@ -6428,7 +6428,7 @@ discard block |
||
6428 | 6428 | $alias = strip_tags($alias); // strip HTML |
6429 | 6429 | $alias = preg_replace('/[^\.A-Za-z0-9 _-]/', '', $alias); // strip non-alphanumeric characters |
6430 | 6430 | $alias = preg_replace('/\s+/', '-', $alias); // convert white-space to dash |
6431 | - $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one |
|
6431 | + $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one |
|
6432 | 6432 | $alias = trim($alias, '-'); // trim excess |
6433 | 6433 | return $alias; |
6434 | 6434 | } |
@@ -6444,7 +6444,7 @@ discard block |
||
6444 | 6444 | $precisions = count($sizes) - 1; |
6445 | 6445 | foreach ($sizes as $unit => $bytes) { |
6446 | 6446 | if ($size >= $bytes) { |
6447 | - return number_format($size / $bytes, $precisions) . ' ' . $unit; |
|
6447 | + return number_format($size / $bytes, $precisions).' '.$unit; |
|
6448 | 6448 | } |
6449 | 6449 | $precisions--; |
6450 | 6450 | } |
@@ -6548,10 +6548,10 @@ discard block |
||
6548 | 6548 | |
6549 | 6549 | if (strpos($str, MODX_MANAGER_PATH) === 0) { |
6550 | 6550 | return false; |
6551 | - } elseif (is_file(MODX_BASE_PATH . $str)) { |
|
6552 | - $file_path = MODX_BASE_PATH . $str; |
|
6553 | - } elseif (is_file(MODX_BASE_PATH . "{$tpl_dir}{$str}")) { |
|
6554 | - $file_path = MODX_BASE_PATH . $tpl_dir . $str; |
|
6551 | + } elseif (is_file(MODX_BASE_PATH.$str)) { |
|
6552 | + $file_path = MODX_BASE_PATH.$str; |
|
6553 | + } elseif (is_file(MODX_BASE_PATH."{$tpl_dir}{$str}")) { |
|
6554 | + $file_path = MODX_BASE_PATH.$tpl_dir.$str; |
|
6555 | 6555 | } else { |
6556 | 6556 | return false; |
6557 | 6557 | } |
@@ -6677,7 +6677,7 @@ discard block |
||
6677 | 6677 | $title = 'no title'; |
6678 | 6678 | } |
6679 | 6679 | if (is_array($msg)) { |
6680 | - $msg = '<pre>' . print_r($msg, true) . '</pre>'; |
|
6680 | + $msg = '<pre>'.print_r($msg, true).'</pre>'; |
|
6681 | 6681 | } elseif ($msg === '') { |
6682 | 6682 | $msg = $_SERVER['REQUEST_URI']; |
6683 | 6683 | } |
@@ -6721,7 +6721,7 @@ discard block |
||
6721 | 6721 | if (is_array($SystemAlertMsgQueque)) { |
6722 | 6722 | $title = ''; |
6723 | 6723 | if ($this->name && $this->activePlugin) { |
6724 | - $title = "<div><b>" . $this->activePlugin . "</b> - <span style='color:maroon;'>" . $this->name . "</span></div>"; |
|
6724 | + $title = "<div><b>".$this->activePlugin."</b> - <span style='color:maroon;'>".$this->name."</span></div>"; |
|
6725 | 6725 | } |
6726 | 6726 | $SystemAlertMsgQueque[] = "$title<div style='margin-left:10px;margin-top:3px;'>$msg</div>"; |
6727 | 6727 | } |
@@ -721,13 +721,15 @@ discard block |
||
721 | 721 | $this->virtualDir = ''; |
722 | 722 | } |
723 | 723 | |
724 | - 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 */ |
|
724 | + if (preg_match('@^[1-9][0-9]*$@', $q) && !isset($this->documentListing[$q])) { |
|
725 | +/* we got an ID returned, check to make sure it's not an alias */ |
|
725 | 726 | /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */ |
726 | 727 | if ($this->config['use_alias_path'] == 1) { |
727 | 728 | 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))))) { |
728 | 729 | $this->documentMethod = 'id'; |
729 | 730 | return $q; |
730 | - } else { /* not a valid id in terms of virtualDir, treat as alias */ |
|
731 | + } else { |
|
732 | +/* not a valid id in terms of virtualDir, treat as alias */ |
|
731 | 733 | $this->documentMethod = 'alias'; |
732 | 734 | return $q; |
733 | 735 | } |
@@ -735,7 +737,8 @@ discard block |
||
735 | 737 | $this->documentMethod = 'id'; |
736 | 738 | return $q; |
737 | 739 | } |
738 | - } else { /* we didn't get an ID back, so instead we assume it's an alias */ |
|
740 | + } else { |
|
741 | +/* we didn't get an ID back, so instead we assume it's an alias */ |
|
739 | 742 | if ($this->config['friendly_alias_urls'] != 1) { |
740 | 743 | $q = $qOrig; |
741 | 744 | } |
@@ -1108,7 +1111,8 @@ discard block |
||
1108 | 1111 | $where = "pub_date <= {$timeNow} AND pub_date!=0 AND published=0"; |
1109 | 1112 | $result_pub = $this->db->select('id', '[+prefix+]site_content', $where); |
1110 | 1113 | $this->db->update($field, '[+prefix+]site_content', $where); |
1111 | - if ($this->db->getRecordCount($result_pub) >= 1) { //Event unPublished doc |
|
1114 | + if ($this->db->getRecordCount($result_pub) >= 1) { |
|
1115 | +//Event unPublished doc |
|
1112 | 1116 | while ($row_pub = $this->db->getRow($result_pub)) { |
1113 | 1117 | $this->invokeEvent("OnDocUnPublished", array( |
1114 | 1118 | "docid" => $row_pub['id'] |
@@ -1121,7 +1125,8 @@ discard block |
||
1121 | 1125 | $where = "unpub_date <= {$timeNow} AND unpub_date!=0 AND published=1"; |
1122 | 1126 | $result_unpub = $this->db->select('id', '[+prefix+]site_content', $where); |
1123 | 1127 | $this->db->update($field, '[+prefix+]site_content', $where); |
1124 | - if ($this->db->getRecordCount($result_unpub) >= 1) { //Event unPublished doc |
|
1128 | + if ($this->db->getRecordCount($result_unpub) >= 1) { |
|
1129 | +//Event unPublished doc |
|
1125 | 1130 | while ($row_unpub = $this->db->getRow($result_unpub)) { |
1126 | 1131 | $this->invokeEvent("OnDocUnPublished", array( |
1127 | 1132 | "docid" => $row_unpub['id'] |
@@ -1272,7 +1277,8 @@ discard block |
||
1272 | 1277 | } |
1273 | 1278 | } |
1274 | 1279 | |
1275 | - if (!in_array($fetch, $tags)) { // Avoid double Matches |
|
1280 | + if (!in_array($fetch, $tags)) { |
|
1281 | +// Avoid double Matches |
|
1276 | 1282 | $tags[] = $fetch; // Fetch |
1277 | 1283 | }; |
1278 | 1284 | $fetch = ''; // and reset |
@@ -2057,7 +2063,8 @@ discard block |
||
2057 | 2063 | * @return mixed|string |
2058 | 2064 | */ |
2059 | 2065 | public function _getSGVar($value) |
2060 | - { // Get super globals |
|
2066 | + { |
|
2067 | +// Get super globals |
|
2061 | 2068 | $key = $value; |
2062 | 2069 | $_ = $this->config['enable_filter']; |
2063 | 2070 | $this->config['enable_filter'] = 1; |
@@ -2462,7 +2469,8 @@ discard block |
||
2462 | 2469 | if ($this->config['friendly_urls'] == 1) { |
2463 | 2470 | $aliases = array(); |
2464 | 2471 | if (is_array($this->documentListing)) { |
2465 | - foreach ($this->documentListing as $path => $docid) { // This is big Loop on large site! |
|
2472 | + foreach ($this->documentListing as $path => $docid) { |
|
2473 | +// This is big Loop on large site! |
|
2466 | 2474 | $aliases[$docid] = $path; |
2467 | 2475 | $isfolder[$docid] = $this->aliasListing[$docid]['isfolder']; |
2468 | 2476 | } |
@@ -2495,7 +2503,7 @@ discard block |
||
2495 | 2503 | $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0); |
2496 | 2504 | $pref = $this->config['friendly_url_prefix']; |
2497 | 2505 | $suff = $this->config['friendly_url_suffix']; |
2498 | - $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
2506 | + $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff){ |
|
2499 | 2507 | global $modx; |
2500 | 2508 | $thealias = $aliases[$m[1]]; |
2501 | 2509 | $thefolder = $isfolder[$m[1]]; |
@@ -4256,7 +4264,8 @@ discard block |
||
4256 | 4264 | if (isset($this->snippetCache[$snippetName])) { |
4257 | 4265 | $snippet = $this->snippetCache[$snippetName]; |
4258 | 4266 | $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : ''; |
4259 | - } else { // not in cache so let's check the db |
|
4267 | + } else { |
|
4268 | +// not in cache so let's check the db |
|
4260 | 4269 | $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;"; |
4261 | 4270 | $result = $this->db->query($sql); |
4262 | 4271 | if ($this->db->getRecordCount($result) == 1) { |
@@ -5234,10 +5243,12 @@ discard block |
||
5234 | 5243 | return ''; |
5235 | 5244 | } // nothing to register |
5236 | 5245 | if (!is_array($options)) { |
5237 | - if (is_bool($options)) { // backward compatibility with old plaintext parameter |
|
5246 | + if (is_bool($options)) { |
|
5247 | +// backward compatibility with old plaintext parameter |
|
5238 | 5248 | |
5239 | 5249 | $options = array('plaintext' => $options); |
5240 | - } elseif (is_string($options)) { // Also allow script name as 2nd param |
|
5250 | + } elseif (is_string($options)) { |
|
5251 | +// Also allow script name as 2nd param |
|
5241 | 5252 | |
5242 | 5253 | $options = array('name' => $options); |
5243 | 5254 | } else { |
@@ -5251,7 +5262,8 @@ discard block |
||
5251 | 5262 | unset($overwritepos); // probably unnecessary--just making sure |
5252 | 5263 | |
5253 | 5264 | $useThisVer = true; |
5254 | - if (isset($this->loadedjscripts[$key])) { // a matching script was found |
|
5265 | + if (isset($this->loadedjscripts[$key])) { |
|
5266 | +// a matching script was found |
|
5255 | 5267 | // if existing script is a startup script, make sure the candidate is also a startup script |
5256 | 5268 | if ($this->loadedjscripts[$key]['startup']) { |
5257 | 5269 | $startup = true; |
@@ -5271,7 +5283,8 @@ discard block |
||
5271 | 5283 | // overwrite the old script (the position may be important for dependent scripts) |
5272 | 5284 | $overwritepos = $this->loadedjscripts[$key]['pos']; |
5273 | 5285 | } |
5274 | - } else { // Use the original version |
|
5286 | + } else { |
|
5287 | +// Use the original version |
|
5275 | 5288 | if ($startup == true && $this->loadedjscripts[$key]['startup'] == false) { |
5276 | 5289 | // need to move the exisiting script to the head |
5277 | 5290 | $version = $this->loadedjscripts[$key][$version]; |
@@ -5396,7 +5409,8 @@ discard block |
||
5396 | 5409 | } |
5397 | 5410 | |
5398 | 5411 | $results = null; |
5399 | - foreach ($this->pluginEvent[$evtName] as $pluginName) { // start for loop |
|
5412 | + foreach ($this->pluginEvent[$evtName] as $pluginName) { |
|
5413 | +// start for loop |
|
5400 | 5414 | if ($this->dumpPlugins) { |
5401 | 5415 | $eventtime = $this->getMicroTime(); |
5402 | 5416 | } |
@@ -5939,7 +5953,8 @@ discard block |
||
5939 | 5953 | * @return bool |
5940 | 5954 | */ |
5941 | 5955 | public function isSafeCode($phpcode = '', $safe_functions = '') |
5942 | - { // return true or false |
|
5956 | + { |
|
5957 | +// return true or false |
|
5943 | 5958 | if ($safe_functions == '') { |
5944 | 5959 | return false; |
5945 | 5960 | } |
@@ -6351,7 +6366,7 @@ discard block |
||
6351 | 6366 | $args = array_pad(array(), $_, '$var'); |
6352 | 6367 | $args = implode(", ", $args); |
6353 | 6368 | $modx = &$this; |
6354 | - $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) { |
|
6369 | + $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val){ |
|
6355 | 6370 | $arg = $val['args'][$tmp - 1]; |
6356 | 6371 | switch (true) { |
6357 | 6372 | case is_null($arg): { |
@@ -69,4 +69,4 @@ |
||
69 | 69 | cm.style.visibility = 'hidden'; |
70 | 70 | } |
71 | 71 | </script> |
72 | -BLOCK; |
|
72 | +block; |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | $ContextMenuCnt++; |
26 | 26 | $this->html = ""; |
27 | 27 | $this->visible = $visible ? $visible : false; |
28 | - $this->width = is_numeric($width) ? (int)$width : 120; |
|
29 | - $this->id = $id ? $id : "cntxMnu" . $ContextMenuCnt; // set id |
|
28 | + $this->width = is_numeric($width) ? (int) $width : 120; |
|
29 | + $this->id = $id ? $id : "cntxMnu".$ContextMenuCnt; // set id |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | public function addItem($text, $action = "", $img = "", $disabled = 0) |
@@ -36,23 +36,23 @@ discard block |
||
36 | 36 | return; |
37 | 37 | } |
38 | 38 | if (!$img) { |
39 | - $img = $base_url . $_style['tx']; |
|
39 | + $img = $base_url.$_style['tx']; |
|
40 | 40 | } |
41 | 41 | if (substr($action, 0, 3) == "js:") { |
42 | 42 | $action = substr($action, 3); |
43 | 43 | } elseif (substr($action, 0, 3) == "hl:") { |
44 | - $action = "window.location.href='" . substr($action, 3) . "'"; |
|
44 | + $action = "window.location.href='".substr($action, 3)."'"; |
|
45 | 45 | } else { |
46 | - $action = "window.location.href='" . $action . "'"; |
|
46 | + $action = "window.location.href='".$action."'"; |
|
47 | 47 | } |
48 | - $action = " onmouseover=\"this.className='cntxMnuItemOver';\" onmouseout=\"this.className='cntxMnuItem';\" onclick=\"$action; hideCntxMenu('" . $this->id . "');\""; |
|
49 | - $this->html .= "<div class='" . ($disabled ? "cntxMnuItemDisabled" : "cntxMnuItem") . "' $action>"; |
|
48 | + $action = " onmouseover=\"this.className='cntxMnuItemOver';\" onmouseout=\"this.className='cntxMnuItem';\" onclick=\"$action; hideCntxMenu('".$this->id."');\""; |
|
49 | + $this->html .= "<div class='".($disabled ? "cntxMnuItemDisabled" : "cntxMnuItem")."' $action>"; |
|
50 | 50 | if (substr($img, 0, 5) == 'fa fa') { |
51 | - $img = '<i class="' . $img . '"></i>'; |
|
51 | + $img = '<i class="'.$img.'"></i>'; |
|
52 | 52 | } elseif (substr($img, 0, 1) != '<') { |
53 | - $img = '<img src="' . $img . '" />'; |
|
53 | + $img = '<img src="'.$img.'" />'; |
|
54 | 54 | } |
55 | - $this->html .= $img . ' ' . $text . '</div>'; |
|
55 | + $this->html .= $img.' '.$text.'</div>'; |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | public function addSeparator() |
@@ -66,14 +66,14 @@ discard block |
||
66 | 66 | { |
67 | 67 | global $ContextMenuScript; |
68 | 68 | |
69 | - $html = $ContextMenuScript . "<div id='" . $this->id . "' class='contextMenu' style='width:" . $this->width . "px; visibility:" . ($this->visible ? 'visible' : 'hidden') . "'>" . $this->html . "</div>"; |
|
69 | + $html = $ContextMenuScript."<div id='".$this->id."' class='contextMenu' style='width:".$this->width."px; visibility:".($this->visible ? 'visible' : 'hidden')."'>".$this->html."</div>"; |
|
70 | 70 | $ContextMenuScript = ""; // reset css |
71 | 71 | return $html; |
72 | 72 | } |
73 | 73 | |
74 | 74 | public function getClientScriptObject() |
75 | 75 | { |
76 | - return "getCntxMenu('" . $this->id . "')"; |
|
76 | + return "getCntxMenu('".$this->id."')"; |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 |
@@ -128,10 +128,10 @@ |
||
128 | 128 | } |
129 | 129 | |
130 | 130 | return base64_encode( |
131 | - 'user=' . |
|
132 | - $this->oauthUserEmail . |
|
133 | - "\001auth=Bearer " . |
|
134 | - $this->oauthToken . |
|
131 | + 'user='. |
|
132 | + $this->oauthUserEmail. |
|
133 | + "\001auth=Bearer ". |
|
134 | + $this->oauthToken. |
|
135 | 135 | "\001\001" |
136 | 136 | ); |
137 | 137 | } |
@@ -34,6 +34,6 @@ |
||
34 | 34 | */ |
35 | 35 | public function errorMessage() |
36 | 36 | { |
37 | - return '<strong>' . htmlspecialchars($this->getMessage()) . "</strong><br />\n"; |
|
37 | + return '<strong>'.htmlspecialchars($this->getMessage())."</strong><br />\n"; |
|
38 | 38 | } |
39 | 39 | } |
@@ -248,9 +248,9 @@ |
||
248 | 248 | echo '<span class="notok">' . $_lang['failed'] . '</span></b>' . $_lang['table_prefix_not_exist'] . '</p>'; |
249 | 249 | $errors++; |
250 | 250 | echo '<p>' . $_lang['table_prefix_not_exist_note'] . '</p>'; |
251 | - } else { |
|
251 | + } else { |
|
252 | 252 | echo '<span class="ok">' . $_lang['ok'] . '</span></p>'; |
253 | - } |
|
253 | + } |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | // check mysql version |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! function_exists('f_owc')){ |
|
2 | +if (!function_exists('f_owc')) { |
|
3 | 3 | /** |
4 | 4 | * @param $path |
5 | 5 | * @param $data |
@@ -12,30 +12,30 @@ discard block |
||
12 | 12 | fwrite($hnd, $data); |
13 | 13 | fclose($hnd); |
14 | 14 | |
15 | - if(null !== $mode) chmod($path, $mode); |
|
16 | - }catch(Exception $e){ |
|
15 | + if (null !== $mode) chmod($path, $mode); |
|
16 | + } catch (Exception $e) { |
|
17 | 17 | // Nothing, this is NOT normal |
18 | 18 | unset($e); |
19 | 19 | } |
20 | 20 | } |
21 | 21 | } |
22 | 22 | |
23 | -$installMode = isset($_POST['installmode']) ? (int)$_POST['installmode'] : 0; |
|
24 | -if( ! isset($_lang)) $_lang = array(); |
|
23 | +$installMode = isset($_POST['installmode']) ? (int) $_POST['installmode'] : 0; |
|
24 | +if (!isset($_lang)) $_lang = array(); |
|
25 | 25 | |
26 | 26 | echo '<div class="stepcontainer"> |
27 | 27 | <ul class="progressbar"> |
28 | - <li class="visited">' . $_lang['choose_language'] . '</li> |
|
29 | - <li class="visited">' . $_lang['installation_mode'] . '</li> |
|
30 | - <li class="visited">' . $_lang['optional_items'] . '</li> |
|
31 | - <li class="active">' . $_lang['preinstall_validation'] . '</li> |
|
32 | - <li>' . $_lang['install_results'] . '</li> |
|
28 | + <li class="visited">' . $_lang['choose_language'].'</li> |
|
29 | + <li class="visited">' . $_lang['installation_mode'].'</li> |
|
30 | + <li class="visited">' . $_lang['optional_items'].'</li> |
|
31 | + <li class="active">' . $_lang['preinstall_validation'].'</li> |
|
32 | + <li>' . $_lang['install_results'].'</li> |
|
33 | 33 | </ul> |
34 | 34 | <div class="clearleft"></div> |
35 | 35 | </div>'; |
36 | 36 | |
37 | -echo '<h2>' . $_lang['preinstall_validation'] . '</h2>'; |
|
38 | -echo '<h3>' . $_lang['summary_setup_check'] . '</h3>'; |
|
37 | +echo '<h2>'.$_lang['preinstall_validation'].'</h2>'; |
|
38 | +echo '<h3>'.$_lang['summary_setup_check'].'</h3>'; |
|
39 | 39 | |
40 | 40 | $errors = 0; |
41 | 41 | |
@@ -43,73 +43,73 @@ discard block |
||
43 | 43 | // check PHP version |
44 | 44 | define('PHP_MIN_VERSION', '5.4.0'); |
45 | 45 | $phpMinVersion = PHP_MIN_VERSION; // Maybe not necessary. For backward compatibility |
46 | -echo '<p>' . $_lang['checking_php_version']; |
|
46 | +echo '<p>'.$_lang['checking_php_version']; |
|
47 | 47 | // -1 if left is less, 0 if equal, +1 if left is higher |
48 | 48 | if (version_compare(phpversion(), PHP_MIN_VERSION) < 0) { |
49 | 49 | $errors++; |
50 | - $tmp = $_lang['you_running_php'] . phpversion() . str_replace('[+min_version+]', PHP_MIN_VERSION, $_lang["modx_requires_php"]); |
|
51 | - echo '<span class="notok">' . $_lang['failed'] . '</span>' . $tmp . '</p>'; |
|
50 | + $tmp = $_lang['you_running_php'].phpversion().str_replace('[+min_version+]', PHP_MIN_VERSION, $_lang["modx_requires_php"]); |
|
51 | + echo '<span class="notok">'.$_lang['failed'].'</span>'.$tmp.'</p>'; |
|
52 | 52 | } else { |
53 | - echo '<span class="ok">' . $_lang['ok'] . '</span></p>'; |
|
53 | + echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | |
57 | 57 | // check if iconv is available |
58 | -echo '<p>' . $_lang['checking_iconv']; |
|
58 | +echo '<p>'.$_lang['checking_iconv']; |
|
59 | 59 | $iconv = (int) function_exists('iconv'); |
60 | -if ($iconv == '0'){ |
|
61 | - echo '<span class="notok">' . $_lang['failed'].'</span></p><p><strong>'.$_lang['checking_iconv_note'].'</strong></p>'; |
|
60 | +if ($iconv == '0') { |
|
61 | + echo '<span class="notok">'.$_lang['failed'].'</span></p><p><strong>'.$_lang['checking_iconv_note'].'</strong></p>'; |
|
62 | 62 | $errors++; |
63 | 63 | } else { |
64 | - echo '<span class="ok">' . $_lang['ok'] . '</span></p>'; |
|
64 | + echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
|
65 | 65 | } |
66 | 66 | // check sessions |
67 | -echo '<p>' . $_lang['checking_sessions']; |
|
67 | +echo '<p>'.$_lang['checking_sessions']; |
|
68 | 68 | if ($_SESSION['test'] != 1) { |
69 | - echo '<span class="notok">' . $_lang['failed']. '</span></p>'; |
|
69 | + echo '<span class="notok">'.$_lang['failed'].'</span></p>'; |
|
70 | 70 | $errors++; |
71 | 71 | } else { |
72 | - echo '<span class="ok">' . $_lang['ok'] . '</span></p>'; |
|
72 | + echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | |
76 | 76 | // check directories |
77 | 77 | // cache exists? |
78 | -echo '<p>' . $_lang['checking_if_cache_exist']; |
|
78 | +echo '<p>'.$_lang['checking_if_cache_exist']; |
|
79 | 79 | if (!file_exists("../assets/cache") || !file_exists("../assets/cache/rss")) { |
80 | - echo '<span class="notok">' . $_lang['failed'] . '</span></p>'; |
|
80 | + echo '<span class="notok">'.$_lang['failed'].'</span></p>'; |
|
81 | 81 | $errors++; |
82 | 82 | } else { |
83 | - echo '<span class="ok">' . $_lang['ok'] . '</span></p>'; |
|
83 | + echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
87 | 87 | // cache writable? |
88 | -echo '<p>' . $_lang['checking_if_cache_writable']; |
|
88 | +echo '<p>'.$_lang['checking_if_cache_writable']; |
|
89 | 89 | if (!is_writable("../assets/cache")) { |
90 | 90 | $errors++; |
91 | - echo '<span class="notok">' . $_lang['failed'] . '</span></p>'; |
|
91 | + echo '<span class="notok">'.$_lang['failed'].'</span></p>'; |
|
92 | 92 | } else { |
93 | - echo '<span class="ok">' . $_lang['ok'] . '</span></p>'; |
|
93 | + echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | |
97 | 97 | // cache files writable? |
98 | -echo '<p>' . $_lang['checking_if_cache_file_writable']; |
|
98 | +echo '<p>'.$_lang['checking_if_cache_file_writable']; |
|
99 | 99 | $tmp = "../assets/cache/siteCache.idx.php"; |
100 | -if ( ! file_exists($tmp)) { |
|
100 | +if (!file_exists($tmp)) { |
|
101 | 101 | f_owc($tmp, "<?php //EVO site cache file ?>"); |
102 | 102 | } |
103 | -if ( ! is_writable($tmp)) { |
|
103 | +if (!is_writable($tmp)) { |
|
104 | 104 | $errors++; |
105 | - echo '<span class="notok">' . $_lang['failed'] . '</span></p>'; |
|
105 | + echo '<span class="notok">'.$_lang['failed'].'</span></p>'; |
|
106 | 106 | } else { |
107 | 107 | echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
108 | 108 | } |
109 | 109 | |
110 | 110 | |
111 | 111 | echo '<p>'.$_lang['checking_if_cache_file2_writable']; |
112 | -if ( ! is_writable("../assets/cache/sitePublishing.idx.php")) { |
|
112 | +if (!is_writable("../assets/cache/sitePublishing.idx.php")) { |
|
113 | 113 | $errors++; |
114 | 114 | echo '<span class="notok">'.$_lang['failed'].'</span></p>'; |
115 | 115 | } else { |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | |
120 | 120 | // File Browser directories exists? |
121 | 121 | echo '<p>'.$_lang['checking_if_images_exist']; |
122 | -switch(true){ |
|
122 | +switch (true) { |
|
123 | 123 | case !file_exists("../assets/images"): |
124 | 124 | case !file_exists("../assets/files"): |
125 | 125 | case !file_exists("../assets/backup"): |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | |
135 | 135 | // File Browser directories writable? |
136 | 136 | echo '<p>'.$_lang['checking_if_images_writable']; |
137 | -switch(true){ |
|
137 | +switch (true) { |
|
138 | 138 | case !is_writable("../assets/images"): |
139 | 139 | case !is_writable("../assets/files"): |
140 | 140 | case !is_writable("../assets/backup"): |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | $database_charset = substr($database_collation, 0, strpos($database_collation, '_') - 1); |
195 | 195 | $database_connection_charset = $_POST['database_connection_charset']; |
196 | 196 | $database_connection_method = $_POST['database_connection_method']; |
197 | - $dbase = '`' . $_POST['database_name'] . '`'; |
|
197 | + $dbase = '`'.$_POST['database_name'].'`'; |
|
198 | 198 | $table_prefix = $_POST['tableprefix']; |
199 | 199 | } |
200 | 200 | echo '<p>'.$_lang['creating_database_connection']; |
@@ -234,54 +234,54 @@ discard block |
||
234 | 234 | |
235 | 235 | // check table prefix |
236 | 236 | if ($conn && $installMode == 0) { |
237 | - echo '<p>' . $_lang['checking_table_prefix'] . $table_prefix . '`: '; |
|
238 | - if ($rs= mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) { |
|
239 | - echo '<span class="notok">' . $_lang['failed'] . '</span></b>' . $_lang['table_prefix_already_inuse'] . '</p>'; |
|
237 | + echo '<p>'.$_lang['checking_table_prefix'].$table_prefix.'`: '; |
|
238 | + if ($rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) { |
|
239 | + echo '<span class="notok">'.$_lang['failed'].'</span></b>'.$_lang['table_prefix_already_inuse'].'</p>'; |
|
240 | 240 | $errors++; |
241 | - echo "<p>" . $_lang['table_prefix_already_inuse_note'] . '</p>'; |
|
241 | + echo "<p>".$_lang['table_prefix_already_inuse_note'].'</p>'; |
|
242 | 242 | } else { |
243 | - echo '<span class="ok">' . $_lang['ok'] . '</span></p>'; |
|
243 | + echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
|
244 | 244 | } |
245 | 245 | } elseif ($conn && $installMode == 2) { |
246 | - echo '<p>' . $_lang['checking_table_prefix'] . $table_prefix . '`: '; |
|
247 | - if (!$rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) { |
|
248 | - echo '<span class="notok">' . $_lang['failed'] . '</span></b>' . $_lang['table_prefix_not_exist'] . '</p>'; |
|
246 | + echo '<p>'.$_lang['checking_table_prefix'].$table_prefix.'`: '; |
|
247 | + if (!$rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) { |
|
248 | + echo '<span class="notok">'.$_lang['failed'].'</span></b>'.$_lang['table_prefix_not_exist'].'</p>'; |
|
249 | 249 | $errors++; |
250 | - echo '<p>' . $_lang['table_prefix_not_exist_note'] . '</p>'; |
|
250 | + echo '<p>'.$_lang['table_prefix_not_exist_note'].'</p>'; |
|
251 | 251 | } else { |
252 | - echo '<span class="ok">' . $_lang['ok'] . '</span></p>'; |
|
252 | + echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
|
253 | 253 | } |
254 | 254 | } |
255 | 255 | |
256 | 256 | // check mysql version |
257 | 257 | if ($conn) { |
258 | - echo '<p>' . $_lang['checking_mysql_version']; |
|
259 | - if ( version_compare(mysqli_get_server_info($conn), '5.0.51', '=') ) { |
|
260 | - echo '<span class="notok">' . $_lang['warning'] . '</span></b> <strong>' . $_lang['mysql_5051'] . '</strong></p>'; |
|
261 | - echo '<p><span class="notok">' . $_lang['mysql_5051_warning'] . '</span></p>'; |
|
258 | + echo '<p>'.$_lang['checking_mysql_version']; |
|
259 | + if (version_compare(mysqli_get_server_info($conn), '5.0.51', '=')) { |
|
260 | + echo '<span class="notok">'.$_lang['warning'].'</span></b> <strong>'.$_lang['mysql_5051'].'</strong></p>'; |
|
261 | + echo '<p><span class="notok">'.$_lang['mysql_5051_warning'].'</span></p>'; |
|
262 | 262 | } else { |
263 | - echo '<span class="ok">' . $_lang['ok'] . '</span> <strong>' . $_lang['mysql_version_is'] . mysqli_get_server_info($conn) . '</strong></p>'; |
|
263 | + echo '<span class="ok">'.$_lang['ok'].'</span> <strong>'.$_lang['mysql_version_is'].mysqli_get_server_info($conn).'</strong></p>'; |
|
264 | 264 | } |
265 | 265 | } |
266 | 266 | |
267 | 267 | // check for strict mode |
268 | 268 | if ($conn) { |
269 | - echo '<p>'. $_lang['checking_mysql_strict_mode']; |
|
269 | + echo '<p>'.$_lang['checking_mysql_strict_mode']; |
|
270 | 270 | $mysqlmode = mysqli_query($conn, "SELECT @@global.sql_mode"); |
271 | - if (mysqli_num_rows($mysqlmode) > 0){ |
|
271 | + if (mysqli_num_rows($mysqlmode) > 0) { |
|
272 | 272 | $modes = mysqli_fetch_array($mysqlmode, MYSQLI_NUM); |
273 | 273 | //$modes = array("STRICT_TRANS_TABLES"); // for testing |
274 | 274 | // print_r($modes); |
275 | 275 | foreach ($modes as $mode) { |
276 | 276 | if (stristr($mode, "STRICT_TRANS_TABLES") !== false || stristr($mode, "STRICT_ALL_TABLES") !== false) { |
277 | - echo '<span class="notok">' . $_lang['warning'] . '</span></b> <strong> ' . $_lang['strict_mode'] . '</strong></p>'; |
|
278 | - echo '<p><span class="notok">' . $_lang['strict_mode_error'] . '</span></p>'; |
|
277 | + echo '<span class="notok">'.$_lang['warning'].'</span></b> <strong> '.$_lang['strict_mode'].'</strong></p>'; |
|
278 | + echo '<p><span class="notok">'.$_lang['strict_mode_error'].'</span></p>'; |
|
279 | 279 | } else { |
280 | - echo '<span class="ok">' . $_lang['ok'] . '</span></p>'; |
|
280 | + echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
|
281 | 281 | } |
282 | 282 | } |
283 | 283 | } else { |
284 | - echo '<span class="ok">' . $_lang['ok'] . '</span></p>'; |
|
284 | + echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
|
285 | 285 | } |
286 | 286 | } |
287 | 287 | // Version and strict mode check end |
@@ -297,18 +297,18 @@ discard block |
||
297 | 297 | f_owc("../assets/cache/installProc.inc.php", '<?php $installStartTime = '.time().'; ?>'); |
298 | 298 | } |
299 | 299 | |
300 | -if($installMode > 0 && $_POST['installdata'] == "1") { |
|
301 | - echo '<p class="notes"><strong>' . $_lang['sample_web_site'] . ':</strong> ' . $_lang['sample_web_site_note'] . '</p>'; |
|
300 | +if ($installMode > 0 && $_POST['installdata'] == "1") { |
|
301 | + echo '<p class="notes"><strong>'.$_lang['sample_web_site'].':</strong> '.$_lang['sample_web_site_note'].'</p>'; |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | if ($errors > 0) { |
305 | 305 | echo '<p>'; |
306 | - echo $_lang['setup_cannot_continue'] . ' '; |
|
306 | + echo $_lang['setup_cannot_continue'].' '; |
|
307 | 307 | |
308 | - if($errors > 1){ |
|
309 | - echo $errors . " " . $_lang['errors'] . $_lang['please_correct_errors'] . $_lang['and_try_again_plural']; |
|
310 | - }else{ |
|
311 | - echo $_lang['error'] . $_lang['please_correct_error'] . $_lang['and_try_again']; |
|
308 | + if ($errors > 1) { |
|
309 | + echo $errors." ".$_lang['errors'].$_lang['please_correct_errors'].$_lang['and_try_again_plural']; |
|
310 | + } else { |
|
311 | + echo $_lang['error'].$_lang['please_correct_error'].$_lang['and_try_again']; |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | echo $_lang['visit_forum']; |
@@ -317,10 +317,10 @@ discard block |
||
317 | 317 | |
318 | 318 | echo '<p> </p>'; |
319 | 319 | |
320 | -$nextAction= $errors > 0 ? 'summary' : 'install'; |
|
321 | -$nextButton= $errors > 0 ? $_lang['retry'] : $_lang['install']; |
|
322 | -$nextVisibility= $errors > 0 || isset($_POST['chkagree']) ? 'visible' : 'hidden'; |
|
323 | -$agreeToggle= $errors > 0 ? '' : ' onclick="if(document.getElementById(\'chkagree\').checked){document.getElementById(\'nextbutton\').style.visibility=\'visible\';}else{document.getElementById(\'nextbutton\').style.visibility=\'hidden\';}"'; |
|
320 | +$nextAction = $errors > 0 ? 'summary' : 'install'; |
|
321 | +$nextButton = $errors > 0 ? $_lang['retry'] : $_lang['install']; |
|
322 | +$nextVisibility = $errors > 0 || isset($_POST['chkagree']) ? 'visible' : 'hidden'; |
|
323 | +$agreeToggle = $errors > 0 ? '' : ' onclick="if(document.getElementById(\'chkagree\').checked){document.getElementById(\'nextbutton\').style.visibility=\'visible\';}else{document.getElementById(\'nextbutton\').style.visibility=\'hidden\';}"'; |
|
324 | 324 | ?> |
325 | 325 | <form name="install" id="install_form" action="index.php?action=<?php echo $nextAction ?>" method="post"> |
326 | 326 | <div> |
@@ -342,32 +342,32 @@ discard block |
||
342 | 342 | |
343 | 343 | <input type="hidden" value="<?php echo $_POST['installdata'] ?>" name="installdata" /> |
344 | 344 | <?php |
345 | - $templates = isset ($_POST['template']) ? $_POST['template'] : array (); |
|
345 | + $templates = isset ($_POST['template']) ? $_POST['template'] : array(); |
|
346 | 346 | foreach ($templates as $i => $template) echo '<input type="hidden" name="template[]" value="'.$template.'" />'; |
347 | 347 | |
348 | - $tvs = isset ($_POST['tv']) ? $_POST['tv'] : array (); |
|
348 | + $tvs = isset ($_POST['tv']) ? $_POST['tv'] : array(); |
|
349 | 349 | foreach ($tvs as $i => $tv) echo '<input type="hidden" name="tv[]" value="'.$tv.'" />'; |
350 | 350 | |
351 | - $chunks = isset ($_POST['chunk']) ? $_POST['chunk'] : array (); |
|
351 | + $chunks = isset ($_POST['chunk']) ? $_POST['chunk'] : array(); |
|
352 | 352 | foreach ($chunks as $i => $chunk) echo '<input type="hidden" name="chunk[]" value="'.$chunk.'" />'; |
353 | 353 | |
354 | - $snippets = isset ($_POST['snippet']) ? $_POST['snippet'] : array (); |
|
354 | + $snippets = isset ($_POST['snippet']) ? $_POST['snippet'] : array(); |
|
355 | 355 | foreach ($snippets as $i => $snippet) echo '<input type="hidden" name="snippet[]" value="'.$snippet.'" />'; |
356 | 356 | |
357 | - $plugins = isset ($_POST['plugin']) ? $_POST['plugin'] : array (); |
|
357 | + $plugins = isset ($_POST['plugin']) ? $_POST['plugin'] : array(); |
|
358 | 358 | foreach ($plugins as $i => $plugin) echo '<input type="hidden" name="plugin[]" value="'.$plugin.'" />'; |
359 | 359 | |
360 | - $modules = isset ($_POST['module']) ? $_POST['module'] : array (); |
|
360 | + $modules = isset ($_POST['module']) ? $_POST['module'] : array(); |
|
361 | 361 | foreach ($modules as $i => $module) echo '<input type="hidden" name="module[]" value="'.$module.'" />'; |
362 | 362 | ?> |
363 | 363 | </div> |
364 | 364 | |
365 | -<h2><?php echo $_lang['agree_to_terms'];?></h2> |
|
365 | +<h2><?php echo $_lang['agree_to_terms']; ?></h2> |
|
366 | 366 | <p> |
367 | -<input type="checkbox" value="1" id="chkagree" name="chkagree" style="line-height:18px" <?php echo isset($_POST['chkagree']) ? 'checked="checked" ':""; ?><?php echo $agreeToggle;?>/><label for="chkagree" style="display:inline;float:none;line-height:18px;"> <?php echo $_lang['iagree_box']?> </label> |
|
367 | +<input type="checkbox" value="1" id="chkagree" name="chkagree" style="line-height:18px" <?php echo isset($_POST['chkagree']) ? 'checked="checked" ' : ""; ?><?php echo $agreeToggle; ?>/><label for="chkagree" style="display:inline;float:none;line-height:18px;"> <?php echo $_lang['iagree_box']?> </label> |
|
368 | 368 | </p> |
369 | 369 | <p class="buttonlinks"> |
370 | 370 | <a href="javascript:document.getElementById('install_form').action='index.php?action=options&language=<?php echo $install_language?>';document.getElementById('install_form').submit();" class="prev" title="<?php echo $_lang['btnback_value']?>"><span><?php echo $_lang['btnback_value']?></span></a> |
371 | - <a id="nextbutton" href="javascript:document.getElementById('install_form').submit();" title="<?php echo $nextButton ?>" style="visibility:<?php echo $nextVisibility;?>"><span><?php echo $nextButton ?></span></a> |
|
371 | + <a id="nextbutton" href="javascript:document.getElementById('install_form').submit();" title="<?php echo $nextButton ?>" style="visibility:<?php echo $nextVisibility; ?>"><span><?php echo $nextButton ?></span></a> |
|
372 | 372 | </p> |
373 | 373 | </form> |
@@ -1,19 +1,22 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! function_exists('f_owc')){ |
|
2 | +if( ! function_exists('f_owc')) { |
|
3 | 3 | /** |
4 | 4 | * @param $path |
5 | 5 | * @param $data |
6 | 6 | * @param null|int $mode |
7 | 7 | */ |
8 | - function f_owc($path, $data, $mode = null){ |
|
8 | + function f_owc($path, $data, $mode = null) |
|
9 | + { |
|
9 | 10 | try { |
10 | 11 | // make an attempt to create the file |
11 | 12 | $hnd = fopen($path, 'w'); |
12 | 13 | fwrite($hnd, $data); |
13 | 14 | fclose($hnd); |
14 | 15 | |
15 | - if(null !== $mode) chmod($path, $mode); |
|
16 | - }catch(Exception $e){ |
|
16 | + if(null !== $mode) { |
|
17 | + chmod($path, $mode); |
|
18 | + } |
|
19 | + } catch(Exception $e) { |
|
17 | 20 | // Nothing, this is NOT normal |
18 | 21 | unset($e); |
19 | 22 | } |
@@ -21,7 +24,9 @@ discard block |
||
21 | 24 | } |
22 | 25 | |
23 | 26 | $installMode = isset($_POST['installmode']) ? (int)$_POST['installmode'] : 0; |
24 | -if( ! isset($_lang)) $_lang = array(); |
|
27 | +if( ! isset($_lang)) { |
|
28 | + $_lang = array(); |
|
29 | +} |
|
25 | 30 | |
26 | 31 | echo '<div class="stepcontainer"> |
27 | 32 | <ul class="progressbar"> |
@@ -57,7 +62,7 @@ discard block |
||
57 | 62 | // check if iconv is available |
58 | 63 | echo '<p>' . $_lang['checking_iconv']; |
59 | 64 | $iconv = (int) function_exists('iconv'); |
60 | -if ($iconv == '0'){ |
|
65 | +if ($iconv == '0') { |
|
61 | 66 | echo '<span class="notok">' . $_lang['failed'].'</span></p><p><strong>'.$_lang['checking_iconv_note'].'</strong></p>'; |
62 | 67 | $errors++; |
63 | 68 | } else { |
@@ -119,7 +124,7 @@ discard block |
||
119 | 124 | |
120 | 125 | // File Browser directories exists? |
121 | 126 | echo '<p>'.$_lang['checking_if_images_exist']; |
122 | -switch(true){ |
|
127 | +switch(true) { |
|
123 | 128 | case !file_exists("../assets/images"): |
124 | 129 | case !file_exists("../assets/files"): |
125 | 130 | case !file_exists("../assets/backup"): |
@@ -134,7 +139,7 @@ discard block |
||
134 | 139 | |
135 | 140 | // File Browser directories writable? |
136 | 141 | echo '<p>'.$_lang['checking_if_images_writable']; |
137 | -switch(true){ |
|
142 | +switch(true) { |
|
138 | 143 | case !is_writable("../assets/images"): |
139 | 144 | case !is_writable("../assets/files"): |
140 | 145 | case !is_writable("../assets/backup"): |
@@ -268,7 +273,7 @@ discard block |
||
268 | 273 | if ($conn) { |
269 | 274 | echo '<p>'. $_lang['checking_mysql_strict_mode']; |
270 | 275 | $mysqlmode = mysqli_query($conn, "SELECT @@global.sql_mode"); |
271 | - if (mysqli_num_rows($mysqlmode) > 0){ |
|
276 | + if (mysqli_num_rows($mysqlmode) > 0) { |
|
272 | 277 | $modes = mysqli_fetch_array($mysqlmode, MYSQLI_NUM); |
273 | 278 | //$modes = array("STRICT_TRANS_TABLES"); // for testing |
274 | 279 | // print_r($modes); |
@@ -305,9 +310,9 @@ discard block |
||
305 | 310 | echo '<p>'; |
306 | 311 | echo $_lang['setup_cannot_continue'] . ' '; |
307 | 312 | |
308 | - if($errors > 1){ |
|
313 | + if($errors > 1) { |
|
309 | 314 | echo $errors . " " . $_lang['errors'] . $_lang['please_correct_errors'] . $_lang['and_try_again_plural']; |
310 | - }else{ |
|
315 | + } else { |
|
311 | 316 | echo $_lang['error'] . $_lang['please_correct_error'] . $_lang['and_try_again']; |
312 | 317 | } |
313 | 318 | |
@@ -343,23 +348,35 @@ discard block |
||
343 | 348 | <input type="hidden" value="<?php echo $_POST['installdata'] ?>" name="installdata" /> |
344 | 349 | <?php |
345 | 350 | $templates = isset ($_POST['template']) ? $_POST['template'] : array (); |
346 | - foreach ($templates as $i => $template) echo '<input type="hidden" name="template[]" value="'.$template.'" />'; |
|
351 | + foreach ($templates as $i => $template) { |
|
352 | + echo '<input type="hidden" name="template[]" value="'.$template.'" />'; |
|
353 | + } |
|
347 | 354 | |
348 | 355 | $tvs = isset ($_POST['tv']) ? $_POST['tv'] : array (); |
349 | - foreach ($tvs as $i => $tv) echo '<input type="hidden" name="tv[]" value="'.$tv.'" />'; |
|
356 | + foreach ($tvs as $i => $tv) { |
|
357 | + echo '<input type="hidden" name="tv[]" value="'.$tv.'" />'; |
|
358 | + } |
|
350 | 359 | |
351 | 360 | $chunks = isset ($_POST['chunk']) ? $_POST['chunk'] : array (); |
352 | - foreach ($chunks as $i => $chunk) echo '<input type="hidden" name="chunk[]" value="'.$chunk.'" />'; |
|
361 | + foreach ($chunks as $i => $chunk) { |
|
362 | + echo '<input type="hidden" name="chunk[]" value="'.$chunk.'" />'; |
|
363 | + } |
|
353 | 364 | |
354 | 365 | $snippets = isset ($_POST['snippet']) ? $_POST['snippet'] : array (); |
355 | - foreach ($snippets as $i => $snippet) echo '<input type="hidden" name="snippet[]" value="'.$snippet.'" />'; |
|
366 | + foreach ($snippets as $i => $snippet) { |
|
367 | + echo '<input type="hidden" name="snippet[]" value="'.$snippet.'" />'; |
|
368 | + } |
|
356 | 369 | |
357 | 370 | $plugins = isset ($_POST['plugin']) ? $_POST['plugin'] : array (); |
358 | - foreach ($plugins as $i => $plugin) echo '<input type="hidden" name="plugin[]" value="'.$plugin.'" />'; |
|
371 | + foreach ($plugins as $i => $plugin) { |
|
372 | + echo '<input type="hidden" name="plugin[]" value="'.$plugin.'" />'; |
|
373 | + } |
|
359 | 374 | |
360 | 375 | $modules = isset ($_POST['module']) ? $_POST['module'] : array (); |
361 | - foreach ($modules as $i => $module) echo '<input type="hidden" name="module[]" value="'.$module.'" />'; |
|
362 | -?> |
|
376 | + foreach ($modules as $i => $module) { |
|
377 | + echo '<input type="hidden" name="module[]" value="'.$module.'" />'; |
|
378 | + } |
|
379 | + ?> |
|
363 | 380 | </div> |
364 | 381 | |
365 | 382 | <h2><?php echo $_lang['agree_to_terms'];?></h2> |
@@ -207,7 +207,7 @@ |
||
207 | 207 | |
208 | 208 | |
209 | 209 | // make sure we can use the database |
210 | -if ($installMode > 0 && !mysqli_query($conn, "USE {$dbase}")) { |
|
210 | +if ($installMode > 0 && !mysqli_query($conn, "use {$dbase}")) { |
|
211 | 211 | $errors++; |
212 | 212 | echo '<span class="notok">'.$_lang['database_use_failed'].'</span><p />'.$_lang["database_use_failed_note"].'</p>'; |
213 | 213 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | case 1: |
16 | 16 | include $base_path . MGR_DIR . '/includes/config.inc.php'; |
17 | 17 | if (@ $conn = mysqli_connect($database_server, $database_user, $database_password)) { |
18 | - if (@ mysqli_query($conn, "USE {$dbase}")) { |
|
18 | + if (@ mysqli_query($conn, "use {$dbase}")) { |
|
19 | 19 | if (!$rs = mysqli_query($conn, "show session variables like 'collation_database'")) { |
20 | 20 | $rs = mysqli_query($conn, "show session variables like 'collation_server'"); |
21 | 21 | } |
@@ -190,53 +190,53 @@ |
||
190 | 190 | } |
191 | 191 | |
192 | 192 | switch($installMode){ |
193 | - case 0: |
|
194 | - case 2: |
|
195 | - $database_collation = isset($_POST['database_collation']) ? $_POST['database_collation'] : 'utf8_general_ci'; |
|
196 | - $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
|
197 | - $_POST['database_connection_charset'] = $database_charset; |
|
198 | - if(empty($_SESSION['databaseloginpassword'])) |
|
199 | - $_SESSION['databaseloginpassword'] = $_POST['databaseloginpassword']; |
|
200 | - if(empty($_SESSION['databaseloginname'])) |
|
201 | - $_SESSION['databaseloginname'] = $_POST['databaseloginname']; |
|
202 | - break; |
|
203 | - case 1: |
|
204 | - include $base_path . MGR_DIR . '/includes/config.inc.php'; |
|
205 | - if (@ $conn = mysqli_connect($database_server, $database_user, $database_password)) { |
|
206 | - if (@ mysqli_query($conn, "USE {$dbase}")) { |
|
207 | - if (!$rs = mysqli_query($conn, "show session variables like 'collation_database'")) { |
|
208 | - $rs = mysqli_query($conn, "show session variables like 'collation_server'"); |
|
209 | - } |
|
210 | - if ($rs && $collation = mysqli_fetch_row($rs)) { |
|
211 | - $database_collation = trim($collation[1]); |
|
193 | + case 0: |
|
194 | + case 2: |
|
195 | + $database_collation = isset($_POST['database_collation']) ? $_POST['database_collation'] : 'utf8_general_ci'; |
|
196 | + $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
|
197 | + $_POST['database_connection_charset'] = $database_charset; |
|
198 | + if(empty($_SESSION['databaseloginpassword'])) |
|
199 | + $_SESSION['databaseloginpassword'] = $_POST['databaseloginpassword']; |
|
200 | + if(empty($_SESSION['databaseloginname'])) |
|
201 | + $_SESSION['databaseloginname'] = $_POST['databaseloginname']; |
|
202 | + break; |
|
203 | + case 1: |
|
204 | + include $base_path . MGR_DIR . '/includes/config.inc.php'; |
|
205 | + if (@ $conn = mysqli_connect($database_server, $database_user, $database_password)) { |
|
206 | + if (@ mysqli_query($conn, "USE {$dbase}")) { |
|
207 | + if (!$rs = mysqli_query($conn, "show session variables like 'collation_database'")) { |
|
208 | + $rs = mysqli_query($conn, "show session variables like 'collation_server'"); |
|
209 | + } |
|
210 | + if ($rs && $collation = mysqli_fetch_row($rs)) { |
|
211 | + $database_collation = trim($collation[1]); |
|
212 | + } |
|
212 | 213 | } |
213 | 214 | } |
214 | - } |
|
215 | - if (empty ($database_collation)) $database_collation = 'utf8_general_ci'; |
|
215 | + if (empty ($database_collation)) $database_collation = 'utf8_general_ci'; |
|
216 | 216 | |
217 | - $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
|
218 | - if (!isset ($database_connection_charset) || empty ($database_connection_charset)) { |
|
219 | - $database_connection_charset = $database_charset; |
|
220 | - } |
|
217 | + $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
|
218 | + if (!isset ($database_connection_charset) || empty ($database_connection_charset)) { |
|
219 | + $database_connection_charset = $database_charset; |
|
220 | + } |
|
221 | 221 | |
222 | - if (!isset ($database_connection_method) || empty ($database_connection_method)) { |
|
223 | - $database_connection_method = 'SET CHARACTER SET'; |
|
224 | - if (function_exists('mysqli_set_charset')) mysqli_set_charset($conn, $database_connection_charset); |
|
225 | - } |
|
226 | - if ($database_connection_method != 'SET NAMES' && $database_connection_charset != $database_charset) { |
|
227 | - $database_connection_method = 'SET NAMES'; |
|
228 | - } |
|
222 | + if (!isset ($database_connection_method) || empty ($database_connection_method)) { |
|
223 | + $database_connection_method = 'SET CHARACTER SET'; |
|
224 | + if (function_exists('mysqli_set_charset')) mysqli_set_charset($conn, $database_connection_charset); |
|
225 | + } |
|
226 | + if ($database_connection_method != 'SET NAMES' && $database_connection_charset != $database_charset) { |
|
227 | + $database_connection_method = 'SET NAMES'; |
|
228 | + } |
|
229 | 229 | |
230 | - $_POST['database_name'] = $dbase; |
|
231 | - $_POST['tableprefix'] = $table_prefix; |
|
232 | - $_POST['database_connection_charset'] = $database_connection_charset; |
|
233 | - $_POST['database_connection_method'] = $database_connection_method; |
|
234 | - $_POST['databasehost'] = $database_server; |
|
235 | - $_SESSION['databaseloginname'] = $database_user; |
|
236 | - $_SESSION['databaseloginpassword'] = $database_password; |
|
237 | - break; |
|
238 | - default: |
|
239 | - throw new Exception('installmode is undefined'); |
|
230 | + $_POST['database_name'] = $dbase; |
|
231 | + $_POST['tableprefix'] = $table_prefix; |
|
232 | + $_POST['database_connection_charset'] = $database_connection_charset; |
|
233 | + $_POST['database_connection_method'] = $database_connection_method; |
|
234 | + $_POST['databasehost'] = $database_server; |
|
235 | + $_SESSION['databaseloginname'] = $database_user; |
|
236 | + $_SESSION['databaseloginpassword'] = $database_password; |
|
237 | + break; |
|
238 | + default: |
|
239 | + throw new Exception('installmode is undefined'); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | $ph['install_language'] = $install_language; |
@@ -189,16 +189,18 @@ discard block |
||
189 | 189 | } |
190 | 190 | } |
191 | 191 | |
192 | -switch($installMode){ |
|
192 | +switch($installMode) { |
|
193 | 193 | case 0: |
194 | 194 | case 2: |
195 | 195 | $database_collation = isset($_POST['database_collation']) ? $_POST['database_collation'] : 'utf8_general_ci'; |
196 | 196 | $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
197 | 197 | $_POST['database_connection_charset'] = $database_charset; |
198 | - if(empty($_SESSION['databaseloginpassword'])) |
|
199 | - $_SESSION['databaseloginpassword'] = $_POST['databaseloginpassword']; |
|
200 | - if(empty($_SESSION['databaseloginname'])) |
|
201 | - $_SESSION['databaseloginname'] = $_POST['databaseloginname']; |
|
198 | + if(empty($_SESSION['databaseloginpassword'])) { |
|
199 | + $_SESSION['databaseloginpassword'] = $_POST['databaseloginpassword']; |
|
200 | + } |
|
201 | + if(empty($_SESSION['databaseloginname'])) { |
|
202 | + $_SESSION['databaseloginname'] = $_POST['databaseloginname']; |
|
203 | + } |
|
202 | 204 | break; |
203 | 205 | case 1: |
204 | 206 | include $base_path . MGR_DIR . '/includes/config.inc.php'; |
@@ -212,7 +214,9 @@ discard block |
||
212 | 214 | } |
213 | 215 | } |
214 | 216 | } |
215 | - if (empty ($database_collation)) $database_collation = 'utf8_general_ci'; |
|
217 | + if (empty ($database_collation)) { |
|
218 | + $database_collation = 'utf8_general_ci'; |
|
219 | + } |
|
216 | 220 | |
217 | 221 | $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
218 | 222 | if (!isset ($database_connection_charset) || empty ($database_connection_charset)) { |
@@ -221,7 +225,9 @@ discard block |
||
221 | 225 | |
222 | 226 | if (!isset ($database_connection_method) || empty ($database_connection_method)) { |
223 | 227 | $database_connection_method = 'SET CHARACTER SET'; |
224 | - if (function_exists('mysqli_set_charset')) mysqli_set_charset($conn, $database_connection_charset); |
|
228 | + if (function_exists('mysqli_set_charset')) { |
|
229 | + mysqli_set_charset($conn, $database_connection_charset); |
|
230 | + } |
|
225 | 231 | } |
226 | 232 | if ($database_connection_method != 'SET NAMES' && $database_connection_charset != $database_charset) { |
227 | 233 | $database_connection_method = 'SET NAMES'; |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -$installMode = isset($_POST['installmode']) ? (int)$_POST['installmode'] : 0; |
|
2 | +$installMode = isset($_POST['installmode']) ? (int) $_POST['installmode'] : 0; |
|
3 | 3 | |
4 | -if( ! function_exists('getTemplates')) { |
|
4 | +if (!function_exists('getTemplates')) { |
|
5 | 5 | /** |
6 | 6 | * @param array $presets |
7 | 7 | * @return string |
@@ -25,11 +25,11 @@ discard block |
||
25 | 25 | $_[] = parse($tpl, $ph); |
26 | 26 | $i++; |
27 | 27 | } |
28 | - return (0 < count($_)) ? '<h3>[%templates%]</h3>' . implode("\n", $_) : ''; |
|
28 | + return (0 < count($_)) ? '<h3>[%templates%]</h3>'.implode("\n", $_) : ''; |
|
29 | 29 | } |
30 | 30 | } |
31 | 31 | |
32 | -if( ! function_exists('getTVs')) { |
|
32 | +if (!function_exists('getTVs')) { |
|
33 | 33 | /** |
34 | 34 | * @param array $presets |
35 | 35 | * @return string |
@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | $_[] = parse($tpl, $ph); |
55 | 55 | $i++; |
56 | 56 | } |
57 | - return (0 < count($_)) ? '<h3>[%tvs%]</h3>' . implode("\n", $_) : ''; |
|
57 | + return (0 < count($_)) ? '<h3>[%tvs%]</h3>'.implode("\n", $_) : ''; |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
61 | -if( ! function_exists('getChunks')) { |
|
61 | +if (!function_exists('getChunks')) { |
|
62 | 62 | /** |
63 | 63 | * display chunks |
64 | 64 | * |
@@ -84,11 +84,11 @@ discard block |
||
84 | 84 | $_[] = parse($tpl, $ph); |
85 | 85 | $i++; |
86 | 86 | } |
87 | - return (0 < count($_)) ? '<h3>[%chunks%]</h3>' . implode("\n", $_) : ''; |
|
87 | + return (0 < count($_)) ? '<h3>[%chunks%]</h3>'.implode("\n", $_) : ''; |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
91 | -if( ! function_exists('getModules')) { |
|
91 | +if (!function_exists('getModules')) { |
|
92 | 92 | /** |
93 | 93 | * display modules |
94 | 94 | * |
@@ -114,11 +114,11 @@ discard block |
||
114 | 114 | $_[] = parse($tpl, $ph); |
115 | 115 | $i++; |
116 | 116 | } |
117 | - return (0 < count($_)) ? '<h3>[%modules%]</h3>' . implode("\n", $_) : ''; |
|
117 | + return (0 < count($_)) ? '<h3>[%modules%]</h3>'.implode("\n", $_) : ''; |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | |
121 | -if( ! function_exists('getPlugins')) { |
|
121 | +if (!function_exists('getPlugins')) { |
|
122 | 122 | /** |
123 | 123 | * display plugins |
124 | 124 | * |
@@ -148,11 +148,11 @@ discard block |
||
148 | 148 | $_[] = parse($tpl, $ph); |
149 | 149 | $i++; |
150 | 150 | } |
151 | - return (0 < count($_)) ? '<h3>[%plugins%]</h3>' . implode("\n", $_) : ''; |
|
151 | + return (0 < count($_)) ? '<h3>[%plugins%]</h3>'.implode("\n", $_) : ''; |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 | |
155 | -if( ! function_exists('getSnippets')) { |
|
155 | +if (!function_exists('getSnippets')) { |
|
156 | 156 | /** |
157 | 157 | * display snippets |
158 | 158 | * |
@@ -178,23 +178,23 @@ discard block |
||
178 | 178 | $_[] = parse($tpl, $ph); |
179 | 179 | $i++; |
180 | 180 | } |
181 | - return (0 < count($_)) ? '<h3>[%snippets%]</h3>' . implode("\n", $_) : ''; |
|
181 | + return (0 < count($_)) ? '<h3>[%snippets%]</h3>'.implode("\n", $_) : ''; |
|
182 | 182 | } |
183 | 183 | } |
184 | 184 | |
185 | -switch($installMode){ |
|
185 | +switch ($installMode) { |
|
186 | 186 | case 0: |
187 | 187 | case 2: |
188 | 188 | $database_collation = isset($_POST['database_collation']) ? $_POST['database_collation'] : 'utf8_general_ci'; |
189 | 189 | $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
190 | 190 | $_POST['database_connection_charset'] = $database_charset; |
191 | - if(empty($_SESSION['databaseloginpassword'])) |
|
191 | + if (empty($_SESSION['databaseloginpassword'])) |
|
192 | 192 | $_SESSION['databaseloginpassword'] = $_POST['databaseloginpassword']; |
193 | - if(empty($_SESSION['databaseloginname'])) |
|
193 | + if (empty($_SESSION['databaseloginname'])) |
|
194 | 194 | $_SESSION['databaseloginname'] = $_POST['databaseloginname']; |
195 | 195 | break; |
196 | 196 | case 1: |
197 | - include $base_path . MGR_DIR . '/includes/config.inc.php'; |
|
197 | + include $base_path.MGR_DIR.'/includes/config.inc.php'; |
|
198 | 198 | if (@ $conn = mysqli_connect($database_server, $database_user, $database_password)) { |
199 | 199 | if (@ mysqli_query($conn, "USE {$dbase}")) { |
200 | 200 | if (!$rs = mysqli_query($conn, "show session variables like 'collation_database'")) { |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | $ph['checked'] = isset ($_POST['installdata']) && $_POST['installdata'] == "1" ? 'checked' : ''; |
250 | 250 | |
251 | 251 | # load setup information file |
252 | -include($base_path . 'install/setup.info.php'); |
|
252 | +include($base_path.'install/setup.info.php'); |
|
253 | 253 | $ph['templates'] = getTemplates($moduleTemplates); |
254 | 254 | $ph['tvs'] = getTVs($moduleTVs); |
255 | 255 | $ph['chunks'] = getChunks($moduleChunks); |
@@ -259,6 +259,6 @@ discard block |
||
259 | 259 | |
260 | 260 | $ph['action'] = ($installMode == 1) ? 'mode' : 'connection'; |
261 | 261 | |
262 | -$tpl = file_get_contents($base_path . 'install/actions/tpl_options.html'); |
|
263 | -$content = parse($tpl,$ph); |
|
264 | -echo parse($content,$_lang,'[%','%]'); |
|
262 | +$tpl = file_get_contents($base_path.'install/actions/tpl_options.html'); |
|
263 | +$content = parse($tpl, $ph); |
|
264 | +echo parse($content, $_lang, '[%', '%]'); |
@@ -48,6 +48,9 @@ discard block |
||
48 | 48 | Input: url from wich the rss file was fetched |
49 | 49 | Output: true on sucess |
50 | 50 | \*=======================================================================*/ |
51 | + /** |
|
52 | + * @param string $url |
|
53 | + */ |
|
51 | 54 | function set ($url, $rss) { |
52 | 55 | $this->ERROR = ""; |
53 | 56 | $cache_file = $this->file_name( $url ); |
@@ -74,6 +77,9 @@ discard block |
||
74 | 77 | Input: url from wich the rss file was fetched |
75 | 78 | Output: cached object on HIT, false on MISS |
76 | 79 | \*=======================================================================*/ |
80 | + /** |
|
81 | + * @param string $url |
|
82 | + */ |
|
77 | 83 | function get ($url) { |
78 | 84 | $this->ERROR = ""; |
79 | 85 | $cache_file = $this->file_name( $url ); |
@@ -110,6 +116,9 @@ discard block |
||
110 | 116 | Input: url from wich the rss file was fetched |
111 | 117 | Output: cached object on HIT, false on MISS |
112 | 118 | \*=======================================================================*/ |
119 | + /** |
|
120 | + * @param string $url |
|
121 | + */ |
|
113 | 122 | function check_cache ( $url ) { |
114 | 123 | $this->ERROR = ""; |
115 | 124 | $filename = $this->file_name( $url ); |
@@ -156,6 +165,9 @@ discard block |
||
156 | 165 | /*=======================================================================*\ |
157 | 166 | Function: unserialize |
158 | 167 | \*=======================================================================*/ |
168 | + /** |
|
169 | + * @param string $data |
|
170 | + */ |
|
159 | 171 | function unserialize ( $data ) { |
160 | 172 | return unserialize( $data ); |
161 | 173 | } |
@@ -94,13 +94,13 @@ discard block |
||
94 | 94 | } |
95 | 95 | |
96 | 96 | if ($filesize = filesize($cache_file) ) { |
97 | - $data = fread( $fp, filesize($cache_file) ); |
|
98 | - $rss = $this->unserialize( $data ); |
|
97 | + $data = fread( $fp, filesize($cache_file) ); |
|
98 | + $rss = $this->unserialize( $data ); |
|
99 | 99 | |
100 | - return $rss; |
|
101 | - } |
|
100 | + return $rss; |
|
101 | + } |
|
102 | 102 | |
103 | - return 0; |
|
103 | + return 0; |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /*=======================================================================*\ |
@@ -134,17 +134,17 @@ discard block |
||
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
137 | - function cache_age( $cache_key ) { |
|
138 | - $filename = $this->file_name( $url ); |
|
139 | - if ( file_exists( $filename ) ) { |
|
140 | - $mtime = filemtime( $filename ); |
|
137 | + function cache_age( $cache_key ) { |
|
138 | + $filename = $this->file_name( $url ); |
|
139 | + if ( file_exists( $filename ) ) { |
|
140 | + $mtime = filemtime( $filename ); |
|
141 | 141 | $age = time() - $mtime; |
142 | - return $age; |
|
143 | - } |
|
144 | - else { |
|
145 | - return -1; |
|
146 | - } |
|
147 | - } |
|
142 | + return $age; |
|
143 | + } |
|
144 | + else { |
|
145 | + return -1; |
|
146 | + } |
|
147 | + } |
|
148 | 148 | |
149 | 149 | /*=======================================================================*\ |
150 | 150 | Function: serialize |
@@ -16,27 +16,27 @@ discard block |
||
16 | 16 | * |
17 | 17 | */ |
18 | 18 | |
19 | -class RSSCache { |
|
20 | - var $BASE_CACHE = './cache'; // where the cache files are stored |
|
21 | - var $MAX_AGE = 3600; // when are files stale, default one hour |
|
22 | - var $ERROR = ""; // accumulate error messages |
|
19 | +class RSSCache{ |
|
20 | + var $BASE_CACHE = './cache'; // where the cache files are stored |
|
21 | + var $MAX_AGE = 3600; // when are files stale, default one hour |
|
22 | + var $ERROR = ""; // accumulate error messages |
|
23 | 23 | |
24 | - function __construct($base='', $age='') { |
|
25 | - if ( $base ) { |
|
24 | + function __construct($base = '', $age = ''){ |
|
25 | + if ($base) { |
|
26 | 26 | $this->BASE_CACHE = $base; |
27 | 27 | } |
28 | - if ( $age ) { |
|
28 | + if ($age) { |
|
29 | 29 | $this->MAX_AGE = $age; |
30 | 30 | } |
31 | 31 | |
32 | 32 | // attempt to make the cache directory |
33 | - if ( ! file_exists( $this->BASE_CACHE ) ) { |
|
34 | - $status = @mkdir( $this->BASE_CACHE, 0755 ); |
|
33 | + if (!file_exists($this->BASE_CACHE)) { |
|
34 | + $status = @mkdir($this->BASE_CACHE, 0755); |
|
35 | 35 | |
36 | 36 | // if make failed |
37 | - if ( ! $status ) { |
|
37 | + if (!$status) { |
|
38 | 38 | $this->error( |
39 | - "Cache couldn't make dir '" . $this->BASE_CACHE . "'." |
|
39 | + "Cache couldn't make dir '".$this->BASE_CACHE."'." |
|
40 | 40 | ); |
41 | 41 | } |
42 | 42 | } |
@@ -48,12 +48,12 @@ discard block |
||
48 | 48 | Input: url from wich the rss file was fetched |
49 | 49 | Output: true on sucess |
50 | 50 | \*=======================================================================*/ |
51 | - function set ($url, $rss) { |
|
51 | + function set($url, $rss){ |
|
52 | 52 | $this->ERROR = ""; |
53 | - $cache_file = $this->file_name( $url ); |
|
54 | - $fp = @fopen( $cache_file, 'w' ); |
|
53 | + $cache_file = $this->file_name($url); |
|
54 | + $fp = @fopen($cache_file, 'w'); |
|
55 | 55 | |
56 | - if ( ! $fp ) { |
|
56 | + if (!$fp) { |
|
57 | 57 | $this->error( |
58 | 58 | "Cache unable to open file for writing: $cache_file" |
59 | 59 | ); |
@@ -61,9 +61,9 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | |
64 | - $data = $this->serialize( $rss ); |
|
65 | - fwrite( $fp, $data ); |
|
66 | - fclose( $fp ); |
|
64 | + $data = $this->serialize($rss); |
|
65 | + fwrite($fp, $data); |
|
66 | + fclose($fp); |
|
67 | 67 | |
68 | 68 | return $cache_file; |
69 | 69 | } |
@@ -74,11 +74,11 @@ discard block |
||
74 | 74 | Input: url from wich the rss file was fetched |
75 | 75 | Output: cached object on HIT, false on MISS |
76 | 76 | \*=======================================================================*/ |
77 | - function get ($url) { |
|
77 | + function get($url){ |
|
78 | 78 | $this->ERROR = ""; |
79 | - $cache_file = $this->file_name( $url ); |
|
79 | + $cache_file = $this->file_name($url); |
|
80 | 80 | |
81 | - if ( ! file_exists( $cache_file ) ) { |
|
81 | + if (!file_exists($cache_file)) { |
|
82 | 82 | $this->debug( |
83 | 83 | "Cache doesn't contain: $url (cache file: $cache_file)" |
84 | 84 | ); |
@@ -86,16 +86,16 @@ discard block |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | $fp = @fopen($cache_file, 'r'); |
89 | - if ( ! $fp ) { |
|
89 | + if (!$fp) { |
|
90 | 90 | $this->error( |
91 | 91 | "Failed to open cache file for reading: $cache_file" |
92 | 92 | ); |
93 | 93 | return 0; |
94 | 94 | } |
95 | 95 | |
96 | - if ($filesize = filesize($cache_file) ) { |
|
97 | - $data = fread( $fp, filesize($cache_file) ); |
|
98 | - $rss = $this->unserialize( $data ); |
|
96 | + if ($filesize = filesize($cache_file)) { |
|
97 | + $data = fread($fp, filesize($cache_file)); |
|
98 | + $rss = $this->unserialize($data); |
|
99 | 99 | |
100 | 100 | return $rss; |
101 | 101 | } |
@@ -110,16 +110,16 @@ discard block |
||
110 | 110 | Input: url from wich the rss file was fetched |
111 | 111 | Output: cached object on HIT, false on MISS |
112 | 112 | \*=======================================================================*/ |
113 | - function check_cache ( $url ) { |
|
113 | + function check_cache($url){ |
|
114 | 114 | $this->ERROR = ""; |
115 | - $filename = $this->file_name( $url ); |
|
115 | + $filename = $this->file_name($url); |
|
116 | 116 | |
117 | - if ( file_exists( $filename ) ) { |
|
117 | + if (file_exists($filename)) { |
|
118 | 118 | // find how long ago the file was added to the cache |
119 | 119 | // and whether that is longer then MAX_AGE |
120 | - $mtime = filemtime( $filename ); |
|
120 | + $mtime = filemtime($filename); |
|
121 | 121 | $age = time() - $mtime; |
122 | - if ( $this->MAX_AGE > $age ) { |
|
122 | + if ($this->MAX_AGE > $age) { |
|
123 | 123 | // object exists and is current |
124 | 124 | return 'HIT'; |
125 | 125 | } |
@@ -134,10 +134,10 @@ discard block |
||
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
137 | - function cache_age( $cache_key ) { |
|
138 | - $filename = $this->file_name( $url ); |
|
139 | - if ( file_exists( $filename ) ) { |
|
140 | - $mtime = filemtime( $filename ); |
|
137 | + function cache_age($cache_key){ |
|
138 | + $filename = $this->file_name($url); |
|
139 | + if (file_exists($filename)) { |
|
140 | + $mtime = filemtime($filename); |
|
141 | 141 | $age = time() - $mtime; |
142 | 142 | return $age; |
143 | 143 | } |
@@ -149,15 +149,15 @@ discard block |
||
149 | 149 | /*=======================================================================*\ |
150 | 150 | Function: serialize |
151 | 151 | \*=======================================================================*/ |
152 | - function serialize ( $rss ) { |
|
153 | - return serialize( $rss ); |
|
152 | + function serialize($rss){ |
|
153 | + return serialize($rss); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | /*=======================================================================*\ |
157 | 157 | Function: unserialize |
158 | 158 | \*=======================================================================*/ |
159 | - function unserialize ( $data ) { |
|
160 | - return unserialize( $data ); |
|
159 | + function unserialize($data){ |
|
160 | + return unserialize($data); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | /*=======================================================================*\ |
@@ -166,31 +166,31 @@ discard block |
||
166 | 166 | Input: url from wich the rss file was fetched |
167 | 167 | Output: a file name |
168 | 168 | \*=======================================================================*/ |
169 | - function file_name ($url) { |
|
170 | - $filename = md5( $url ); |
|
171 | - return implode( DIRECTORY_SEPARATOR, array( $this->BASE_CACHE, $filename ) ); |
|
169 | + function file_name($url){ |
|
170 | + $filename = md5($url); |
|
171 | + return implode(DIRECTORY_SEPARATOR, array($this->BASE_CACHE, $filename)); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | /*=======================================================================*\ |
175 | 175 | Function: error |
176 | 176 | Purpose: register error |
177 | 177 | \*=======================================================================*/ |
178 | - function error ($errormsg, $lvl=E_USER_WARNING) { |
|
178 | + function error($errormsg, $lvl = E_USER_WARNING){ |
|
179 | 179 | // append PHP's error message if track_errors enabled |
180 | - if ( isset($php_errormsg) ) { |
|
180 | + if (isset($php_errormsg)) { |
|
181 | 181 | $errormsg .= " ($php_errormsg)"; |
182 | 182 | } |
183 | 183 | $this->ERROR = $errormsg; |
184 | - if ( MAGPIE_DEBUG ) { |
|
185 | - trigger_error( $errormsg, $lvl); |
|
184 | + if (MAGPIE_DEBUG) { |
|
185 | + trigger_error($errormsg, $lvl); |
|
186 | 186 | } |
187 | 187 | else { |
188 | - error_log( $errormsg, 0); |
|
188 | + error_log($errormsg, 0); |
|
189 | 189 | } |
190 | 190 | } |
191 | 191 | |
192 | - function debug ($debugmsg, $lvl=E_USER_NOTICE) { |
|
193 | - if ( MAGPIE_DEBUG ) { |
|
192 | + function debug($debugmsg, $lvl = E_USER_NOTICE){ |
|
193 | + if (MAGPIE_DEBUG) { |
|
194 | 194 | $this->error("MagpieRSS [debug] $debugmsg", $lvl); |
195 | 195 | } |
196 | 196 | } |
@@ -16,12 +16,14 @@ discard block |
||
16 | 16 | * |
17 | 17 | */ |
18 | 18 | |
19 | -class RSSCache { |
|
19 | +class RSSCache |
|
20 | +{ |
|
20 | 21 | var $BASE_CACHE = './cache'; // where the cache files are stored |
21 | 22 | var $MAX_AGE = 3600; // when are files stale, default one hour |
22 | 23 | var $ERROR = ""; // accumulate error messages |
23 | 24 | |
24 | - function __construct($base='', $age='') { |
|
25 | + function __construct($base='', $age='') |
|
26 | + { |
|
25 | 27 | if ( $base ) { |
26 | 28 | $this->BASE_CACHE = $base; |
27 | 29 | } |
@@ -48,7 +50,8 @@ discard block |
||
48 | 50 | Input: url from wich the rss file was fetched |
49 | 51 | Output: true on sucess |
50 | 52 | \*=======================================================================*/ |
51 | - function set ($url, $rss) { |
|
53 | + function set ($url, $rss) |
|
54 | + { |
|
52 | 55 | $this->ERROR = ""; |
53 | 56 | $cache_file = $this->file_name( $url ); |
54 | 57 | $fp = @fopen( $cache_file, 'w' ); |
@@ -74,7 +77,8 @@ discard block |
||
74 | 77 | Input: url from wich the rss file was fetched |
75 | 78 | Output: cached object on HIT, false on MISS |
76 | 79 | \*=======================================================================*/ |
77 | - function get ($url) { |
|
80 | + function get ($url) |
|
81 | + { |
|
78 | 82 | $this->ERROR = ""; |
79 | 83 | $cache_file = $this->file_name( $url ); |
80 | 84 | |
@@ -110,7 +114,8 @@ discard block |
||
110 | 114 | Input: url from wich the rss file was fetched |
111 | 115 | Output: cached object on HIT, false on MISS |
112 | 116 | \*=======================================================================*/ |
113 | - function check_cache ( $url ) { |
|
117 | + function check_cache ( $url ) |
|
118 | + { |
|
114 | 119 | $this->ERROR = ""; |
115 | 120 | $filename = $this->file_name( $url ); |
116 | 121 | |
@@ -122,26 +127,24 @@ discard block |
||
122 | 127 | if ( $this->MAX_AGE > $age ) { |
123 | 128 | // object exists and is current |
124 | 129 | return 'HIT'; |
125 | - } |
|
126 | - else { |
|
130 | + } else { |
|
127 | 131 | // object exists but is old |
128 | 132 | return 'STALE'; |
129 | 133 | } |
130 | - } |
|
131 | - else { |
|
134 | + } else { |
|
132 | 135 | // object does not exist |
133 | 136 | return 'MISS'; |
134 | 137 | } |
135 | 138 | } |
136 | 139 | |
137 | - function cache_age( $cache_key ) { |
|
140 | + function cache_age( $cache_key ) |
|
141 | + { |
|
138 | 142 | $filename = $this->file_name( $url ); |
139 | 143 | if ( file_exists( $filename ) ) { |
140 | 144 | $mtime = filemtime( $filename ); |
141 | 145 | $age = time() - $mtime; |
142 | 146 | return $age; |
143 | - } |
|
144 | - else { |
|
147 | + } else { |
|
145 | 148 | return -1; |
146 | 149 | } |
147 | 150 | } |
@@ -149,14 +152,16 @@ discard block |
||
149 | 152 | /*=======================================================================*\ |
150 | 153 | Function: serialize |
151 | 154 | \*=======================================================================*/ |
152 | - function serialize ( $rss ) { |
|
155 | + function serialize ( $rss ) |
|
156 | + { |
|
153 | 157 | return serialize( $rss ); |
154 | 158 | } |
155 | 159 | |
156 | 160 | /*=======================================================================*\ |
157 | 161 | Function: unserialize |
158 | 162 | \*=======================================================================*/ |
159 | - function unserialize ( $data ) { |
|
163 | + function unserialize ( $data ) |
|
164 | + { |
|
160 | 165 | return unserialize( $data ); |
161 | 166 | } |
162 | 167 | |
@@ -166,7 +171,8 @@ discard block |
||
166 | 171 | Input: url from wich the rss file was fetched |
167 | 172 | Output: a file name |
168 | 173 | \*=======================================================================*/ |
169 | - function file_name ($url) { |
|
174 | + function file_name ($url) |
|
175 | + { |
|
170 | 176 | $filename = md5( $url ); |
171 | 177 | return implode( DIRECTORY_SEPARATOR, array( $this->BASE_CACHE, $filename ) ); |
172 | 178 | } |
@@ -175,7 +181,8 @@ discard block |
||
175 | 181 | Function: error |
176 | 182 | Purpose: register error |
177 | 183 | \*=======================================================================*/ |
178 | - function error ($errormsg, $lvl=E_USER_WARNING) { |
|
184 | + function error ($errormsg, $lvl=E_USER_WARNING) |
|
185 | + { |
|
179 | 186 | // append PHP's error message if track_errors enabled |
180 | 187 | if ( isset($php_errormsg) ) { |
181 | 188 | $errormsg .= " ($php_errormsg)"; |
@@ -183,13 +190,13 @@ discard block |
||
183 | 190 | $this->ERROR = $errormsg; |
184 | 191 | if ( MAGPIE_DEBUG ) { |
185 | 192 | trigger_error( $errormsg, $lvl); |
186 | - } |
|
187 | - else { |
|
193 | + } else { |
|
188 | 194 | error_log( $errormsg, 0); |
189 | 195 | } |
190 | 196 | } |
191 | 197 | |
192 | - function debug ($debugmsg, $lvl=E_USER_NOTICE) { |
|
198 | + function debug ($debugmsg, $lvl=E_USER_NOTICE) |
|
199 | + { |
|
193 | 200 | if ( MAGPIE_DEBUG ) { |
194 | 201 | $this->error("MagpieRSS [debug] $debugmsg", $lvl); |
195 | 202 | } |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | /** This file is part of KCFinder project |
4 | - * |
|
5 | - * @desc Base configuration file |
|
6 | - * @package KCFinder |
|
7 | - * @version 2.54 |
|
8 | - * @author Pavel Tzonkov <[email protected]> |
|
9 | - * @copyright 2010-2014 KCFinder Project |
|
10 | - * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
11 | - * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
12 | - * @link http://kcfinder.sunhater.com |
|
13 | - */ |
|
4 | + * |
|
5 | + * @desc Base configuration file |
|
6 | + * @package KCFinder |
|
7 | + * @version 2.54 |
|
8 | + * @author Pavel Tzonkov <[email protected]> |
|
9 | + * @copyright 2010-2014 KCFinder Project |
|
10 | + * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
11 | + * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
12 | + * @link http://kcfinder.sunhater.com |
|
13 | + */ |
|
14 | 14 | |
15 | 15 | // IMPORTANT!!! Do not remove uncommented settings in this file even if |
16 | 16 | // you are using session configuration. |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | 'dirnameChangeChars' => array( |
71 | 71 | ' ' => "_", |
72 | 72 | ':' => "." |
73 | - ), |
|
73 | + ), |
|
74 | 74 | 'mime_magic' => "", |
75 | 75 | |
76 | 76 | 'maxImageWidth' => $modx->config['maxImageWidth'], |
@@ -89,7 +89,7 @@ |
||
89 | 89 | |
90 | 90 | // THE FOLLOWING SETTINGS CANNOT BE OVERRIDED WITH SESSION CONFIGURATION |
91 | 91 | '_check4htaccess' => false, |
92 | - '_tinyMCEPath' => MODX_BASE_URL . "assets/plugins/tinymce/tiny_mce", |
|
92 | + '_tinyMCEPath' => MODX_BASE_URL."assets/plugins/tinymce/tiny_mce", |
|
93 | 93 | |
94 | 94 | '_sessionVar' => &$_SESSION['KCFINDER'], |
95 | 95 | //'_sessionLifetime' => 30, |