@@ -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 | */ |
@@ -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): { |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | */ |
228 | 228 | public function __call($method_name, $arguments) |
229 | 229 | { |
230 | - include_once(MODX_MANAGER_PATH . 'includes/extenders/deprecated.functions.inc.php'); |
|
230 | + include_once(MODX_MANAGER_PATH.'includes/extenders/deprecated.functions.inc.php'); |
|
231 | 231 | if (method_exists($this->old, $method_name)) { |
232 | 232 | $error_type = 1; |
233 | 233 | } else { |
@@ -245,12 +245,12 @@ discard block |
||
245 | 245 | $info = debug_backtrace(); |
246 | 246 | $m[] = $msg; |
247 | 247 | if (!empty($this->currentSnippet)) { |
248 | - $m[] = 'Snippet - ' . $this->currentSnippet; |
|
248 | + $m[] = 'Snippet - '.$this->currentSnippet; |
|
249 | 249 | } elseif (!empty($this->event->activePlugin)) { |
250 | - $m[] = 'Plugin - ' . $this->event->activePlugin; |
|
250 | + $m[] = 'Plugin - '.$this->event->activePlugin; |
|
251 | 251 | } |
252 | 252 | $m[] = $this->decoded_request_uri; |
253 | - $m[] = str_replace('\\', '/', $info[0]['file']) . '(line:' . $info[0]['line'] . ')'; |
|
253 | + $m[] = str_replace('\\', '/', $info[0]['file']).'(line:'.$info[0]['line'].')'; |
|
254 | 254 | $msg = implode('<br />', $m); |
255 | 255 | $this->logEvent(0, $error_type, $msg, $title); |
256 | 256 | } |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | { |
268 | 268 | $flag = false; |
269 | 269 | if (is_scalar($connector) && !empty($connector) && isset($this->{$connector}) && $this->{$connector} instanceof DBAPI) { |
270 | - $flag = (bool)$this->{$connector}->conn; |
|
270 | + $flag = (bool) $this->{$connector}->conn; |
|
271 | 271 | } |
272 | 272 | return $flag; |
273 | 273 | } |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | } |
295 | 295 | if (!$out && $flag) { |
296 | 296 | $extname = trim(str_replace(array('..', '/', '\\'), '', strtolower($extname))); |
297 | - $filename = MODX_MANAGER_PATH . "includes/extenders/ex_{$extname}.inc.php"; |
|
297 | + $filename = MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php"; |
|
298 | 298 | $out = is_file($filename) ? include $filename : false; |
299 | 299 | } |
300 | 300 | if ($out && !in_array($extname, $this->extensions)) { |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | public function getMicroTime() |
312 | 312 | { |
313 | 313 | list($usec, $sec) = explode(' ', microtime()); |
314 | - return ((float)$usec + (float)$sec); |
|
314 | + return ((float) $usec + (float) $sec); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | /** |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | // append the redirect count string to the url |
336 | 336 | $currentNumberOfRedirects = isset($_REQUEST['err']) ? $_REQUEST['err'] : 0; |
337 | 337 | if ($currentNumberOfRedirects > 3) { |
338 | - $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>' . $url . '</i></p>'); |
|
338 | + $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>'.$url.'</i></p>'); |
|
339 | 339 | } else { |
340 | 340 | $currentNumberOfRedirects += 1; |
341 | 341 | if (strpos($url, "?") > 0) { |
@@ -346,9 +346,9 @@ discard block |
||
346 | 346 | } |
347 | 347 | } |
348 | 348 | if ($type == 'REDIRECT_REFRESH') { |
349 | - $header = 'Refresh: 0;URL=' . $url; |
|
349 | + $header = 'Refresh: 0;URL='.$url; |
|
350 | 350 | } elseif ($type == 'REDIRECT_META') { |
351 | - $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=' . $url . '" />'; |
|
351 | + $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL='.$url.'" />'; |
|
352 | 352 | echo $header; |
353 | 353 | exit; |
354 | 354 | } elseif ($type == 'REDIRECT_HEADER' || empty($type)) { |
@@ -356,10 +356,10 @@ discard block |
||
356 | 356 | global $base_url, $site_url; |
357 | 357 | if (substr($url, 0, strlen($base_url)) == $base_url) { |
358 | 358 | // append $site_url to make it work with Location: |
359 | - $url = $site_url . substr($url, strlen($base_url)); |
|
359 | + $url = $site_url.substr($url, strlen($base_url)); |
|
360 | 360 | } |
361 | 361 | if (strpos($url, "\n") === false) { |
362 | - $header = 'Location: ' . $url; |
|
362 | + $header = 'Location: '.$url; |
|
363 | 363 | } else { |
364 | 364 | $this->messageQuit('No newline allowed in redirect url.'); |
365 | 365 | } |
@@ -473,8 +473,8 @@ discard block |
||
473 | 473 | |
474 | 474 | private function recoverySiteCache() |
475 | 475 | { |
476 | - $site_cache_dir = MODX_BASE_PATH . $this->getCacheFolder(); |
|
477 | - $site_cache_path = $site_cache_dir . 'siteCache.idx.php'; |
|
476 | + $site_cache_dir = MODX_BASE_PATH.$this->getCacheFolder(); |
|
477 | + $site_cache_path = $site_cache_dir.'siteCache.idx.php'; |
|
478 | 478 | |
479 | 479 | if (is_file($site_cache_path)) { |
480 | 480 | include($site_cache_path); |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | return; |
484 | 484 | } |
485 | 485 | |
486 | - include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php'); |
|
486 | + include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php'); |
|
487 | 487 | $cache = new synccache(); |
488 | 488 | $cache->setCachepath($site_cache_dir); |
489 | 489 | $cache->setReport(false); |
@@ -535,8 +535,8 @@ discard block |
||
535 | 535 | $this->invokeEvent("OnBeforeManagerPageInit"); |
536 | 536 | } |
537 | 537 | |
538 | - if (isset($_SESSION[$usrType . 'UsrConfigSet'])) { |
|
539 | - $usrSettings = &$_SESSION[$usrType . 'UsrConfigSet']; |
|
538 | + if (isset($_SESSION[$usrType.'UsrConfigSet'])) { |
|
539 | + $usrSettings = &$_SESSION[$usrType.'UsrConfigSet']; |
|
540 | 540 | } else { |
541 | 541 | if ($usrType == 'web') { |
542 | 542 | $from = $tbl_web_user_settings; |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | $usrSettings[$row['setting_name']] = $row['setting_value']; |
557 | 557 | } |
558 | 558 | if (isset($usrType)) { |
559 | - $_SESSION[$usrType . 'UsrConfigSet'] = $usrSettings; |
|
559 | + $_SESSION[$usrType.'UsrConfigSet'] = $usrSettings; |
|
560 | 560 | } // store user settings in session |
561 | 561 | } |
562 | 562 | } |
@@ -701,10 +701,10 @@ discard block |
||
701 | 701 | $suf = $this->config['friendly_url_suffix']; |
702 | 702 | $pre = preg_quote($pre, '/'); |
703 | 703 | $suf = preg_quote($suf, '/'); |
704 | - if ($pre && preg_match('@^' . $pre . '(.*)$@', $q, $_)) { |
|
704 | + if ($pre && preg_match('@^'.$pre.'(.*)$@', $q, $_)) { |
|
705 | 705 | $q = $_[1]; |
706 | 706 | } |
707 | - if ($suf && preg_match('@(.*)' . $suf . '$@', $q, $_)) { |
|
707 | + if ($suf && preg_match('@(.*)'.$suf.'$@', $q, $_)) { |
|
708 | 708 | $q = $_[1]; |
709 | 709 | } |
710 | 710 | |
@@ -726,7 +726,7 @@ discard block |
||
726 | 726 | 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 */ |
727 | 727 | /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */ |
728 | 728 | if ($this->config['use_alias_path'] == 1) { |
729 | - 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))))) { |
|
729 | + 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))))) { |
|
730 | 730 | $this->documentMethod = 'id'; |
731 | 731 | return $q; |
732 | 732 | } else { /* not a valid id in terms of virtualDir, treat as alias */ |
@@ -760,7 +760,7 @@ discard block |
||
760 | 760 | */ |
761 | 761 | public function getHashFile($key) |
762 | 762 | { |
763 | - return $this->getCacheFolder() . "docid_" . $key . ".pageCache.php"; |
|
763 | + return $this->getCacheFolder()."docid_".$key.".pageCache.php"; |
|
764 | 764 | } |
765 | 765 | |
766 | 766 | /** |
@@ -779,7 +779,7 @@ discard block |
||
779 | 779 | // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID. |
780 | 780 | $params = $_GET; |
781 | 781 | ksort($params); |
782 | - $hash .= '_' . md5(http_build_query($params)); |
|
782 | + $hash .= '_'.md5(http_build_query($params)); |
|
783 | 783 | } |
784 | 784 | } |
785 | 785 | $evtOut = $this->invokeEvent("OnMakePageCacheKey", array("hash" => $hash, "id" => $id, 'params' => $params)); |
@@ -925,12 +925,12 @@ discard block |
||
925 | 925 | if ($js = $this->getRegisteredClientStartupScripts()) { |
926 | 926 | // change to just before closing </head> |
927 | 927 | // $this->documentContent = preg_replace("/(<head[^>]*>)/i", "\\1\n".$js, $this->documentContent); |
928 | - $this->documentOutput = preg_replace("/(<\/head>)/i", $js . "\n\\1", $this->documentOutput); |
|
928 | + $this->documentOutput = preg_replace("/(<\/head>)/i", $js."\n\\1", $this->documentOutput); |
|
929 | 929 | } |
930 | 930 | |
931 | 931 | // Insert jscripts & html block into template - template must have a </body> tag |
932 | 932 | if ($js = $this->getRegisteredClientScripts()) { |
933 | - $this->documentOutput = preg_replace("/(<\/body>)/i", $js . "\n\\1", $this->documentOutput); |
|
933 | + $this->documentOutput = preg_replace("/(<\/body>)/i", $js."\n\\1", $this->documentOutput); |
|
934 | 934 | } |
935 | 935 | // End fix by sirlancelot |
936 | 936 | |
@@ -941,7 +941,7 @@ discard block |
||
941 | 941 | // send out content-type and content-disposition headers |
942 | 942 | if (IN_PARSER_MODE == "true") { |
943 | 943 | $type = !empty($this->contentTypes[$this->documentIdentifier]) ? $this->contentTypes[$this->documentIdentifier] : "text/html"; |
944 | - header('Content-Type: ' . $type . '; charset=' . $this->config['modx_charset']); |
|
944 | + header('Content-Type: '.$type.'; charset='.$this->config['modx_charset']); |
|
945 | 945 | // if (($this->documentIdentifier == $this->config['error_page']) || $redirect_error) |
946 | 946 | // header('HTTP/1.0 404 Not Found'); |
947 | 947 | if (!$this->checkPreview() && $this->documentObject['content_dispo'] == 1) { |
@@ -959,7 +959,7 @@ discard block |
||
959 | 959 | $name = preg_replace('|-+|', '-', $name); |
960 | 960 | $name = trim($name, '-'); |
961 | 961 | } |
962 | - $header = 'Content-Disposition: attachment; filename=' . $name; |
|
962 | + $header = 'Content-Disposition: attachment; filename='.$name; |
|
963 | 963 | header($header); |
964 | 964 | } |
965 | 965 | } |
@@ -967,7 +967,7 @@ discard block |
||
967 | 967 | |
968 | 968 | $stats = $this->getTimerStats($this->tstart); |
969 | 969 | |
970 | - $out =& $this->documentOutput; |
|
970 | + $out = & $this->documentOutput; |
|
971 | 971 | $out = str_replace("[^q^]", $stats['queries'], $out); |
972 | 972 | $out = str_replace("[^qt^]", $stats['queryTime'], $out); |
973 | 973 | $out = str_replace("[^p^]", $stats['phpTime'], $out); |
@@ -1006,17 +1006,17 @@ discard block |
||
1006 | 1006 | $sc .= sprintf("%s. %s (%s)<br>", $s, $sname, sprintf("%2.2f ms", $t)); // currentSnippet |
1007 | 1007 | $tt += $t; |
1008 | 1008 | } |
1009 | - echo "<fieldset><legend><b>Snippets</b> (" . count($this->snippetsTime) . " / " . sprintf("%2.2f ms", $tt) . ")</legend>{$sc}</fieldset><br />"; |
|
1009 | + echo "<fieldset><legend><b>Snippets</b> (".count($this->snippetsTime)." / ".sprintf("%2.2f ms", $tt).")</legend>{$sc}</fieldset><br />"; |
|
1010 | 1010 | echo $this->snippetsCode; |
1011 | 1011 | } |
1012 | 1012 | if ($this->dumpPlugins) { |
1013 | 1013 | $ps = ""; |
1014 | 1014 | $tt = 0; |
1015 | 1015 | foreach ($this->pluginsTime as $s => $t) { |
1016 | - $ps .= "$s (" . sprintf("%2.2f ms", $t * 1000) . ")<br>"; |
|
1016 | + $ps .= "$s (".sprintf("%2.2f ms", $t * 1000).")<br>"; |
|
1017 | 1017 | $tt += $t; |
1018 | 1018 | } |
1019 | - echo "<fieldset><legend><b>Plugins</b> (" . count($this->pluginsTime) . " / " . sprintf("%2.2f ms", $tt * 1000) . ")</legend>{$ps}</fieldset><br />"; |
|
1019 | + echo "<fieldset><legend><b>Plugins</b> (".count($this->pluginsTime)." / ".sprintf("%2.2f ms", $tt * 1000).")</legend>{$ps}</fieldset><br />"; |
|
1020 | 1020 | echo $this->pluginsCode; |
1021 | 1021 | } |
1022 | 1022 | |
@@ -1042,7 +1042,7 @@ discard block |
||
1042 | 1042 | $srcTags = explode(',', $tags); |
1043 | 1043 | $repTags = array(); |
1044 | 1044 | foreach ($srcTags as $tag) { |
1045 | - $repTags[] = '\\' . $tag[0] . '\\' . $tag[1]; |
|
1045 | + $repTags[] = '\\'.$tag[0].'\\'.$tag[1]; |
|
1046 | 1046 | } |
1047 | 1047 | return array($srcTags, $repTags); |
1048 | 1048 | } |
@@ -1064,7 +1064,7 @@ discard block |
||
1064 | 1064 | $stats['phpTime'] = sprintf("%2.4f s", $stats['phpTime']); |
1065 | 1065 | $stats['source'] = $this->documentGenerated == 1 ? "database" : "cache"; |
1066 | 1066 | $stats['queries'] = isset($this->executedQueries) ? $this->executedQueries : 0; |
1067 | - $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024) . " mb"; |
|
1067 | + $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024)." mb"; |
|
1068 | 1068 | |
1069 | 1069 | return $stats; |
1070 | 1070 | } |
@@ -1097,7 +1097,7 @@ discard block |
||
1097 | 1097 | { |
1098 | 1098 | $cacheRefreshTime = 0; |
1099 | 1099 | $recent_update = 0; |
1100 | - @include(MODX_BASE_PATH . $this->getCacheFolder() . 'sitePublishing.idx.php'); |
|
1100 | + @include(MODX_BASE_PATH.$this->getCacheFolder().'sitePublishing.idx.php'); |
|
1101 | 1101 | $this->recentUpdate = $recent_update; |
1102 | 1102 | |
1103 | 1103 | $timeNow = $_SERVER['REQUEST_TIME'] + $this->config['server_offset_time']; |
@@ -1167,8 +1167,8 @@ discard block |
||
1167 | 1167 | } |
1168 | 1168 | |
1169 | 1169 | $docObjSerial = serialize($this->documentObject); |
1170 | - $cacheContent = $docObjSerial . "<!--__MODxCacheSpliter__-->" . $this->documentContent; |
|
1171 | - $page_cache_path = MODX_BASE_PATH . $this->getHashFile($this->cacheKey); |
|
1170 | + $cacheContent = $docObjSerial."<!--__MODxCacheSpliter__-->".$this->documentContent; |
|
1171 | + $page_cache_path = MODX_BASE_PATH.$this->getHashFile($this->cacheKey); |
|
1172 | 1172 | file_put_contents($page_cache_path, "<?php die('Unauthorized access.'); ?>$cacheContent"); |
1173 | 1173 | } |
1174 | 1174 | } |
@@ -1210,16 +1210,16 @@ discard block |
||
1210 | 1210 | return array(); |
1211 | 1211 | } |
1212 | 1212 | $spacer = md5('<<<EVO>>>'); |
1213 | - if ($left==='{{' && strpos($content, ';}}')!==false) { |
|
1213 | + if ($left === '{{' && strpos($content, ';}}') !== false) { |
|
1214 | 1214 | $content = str_replace(';}}', sprintf(';}%s}', $spacer), $content); |
1215 | 1215 | } |
1216 | - if ($left==='{{' && strpos($content, '{{}}')!==false) { |
|
1216 | + if ($left === '{{' && strpos($content, '{{}}') !== false) { |
|
1217 | 1217 | $content = str_replace('{{}}', sprintf('{%$1s{}%$1s}', $spacer), $content); |
1218 | 1218 | } |
1219 | - if ($left==='[[' && strpos($content, ']]]]')!==false) { |
|
1219 | + if ($left === '[[' && strpos($content, ']]]]') !== false) { |
|
1220 | 1220 | $content = str_replace(']]]]', sprintf(']]%s]]', $spacer), $content); |
1221 | 1221 | } |
1222 | - if ($left==='[[' && strpos($content, ']]]')!==false) { |
|
1222 | + if ($left === '[[' && strpos($content, ']]]') !== false) { |
|
1223 | 1223 | $content = str_replace(']]]', sprintf(']%s]]', $spacer), $content); |
1224 | 1224 | } |
1225 | 1225 | |
@@ -1227,7 +1227,7 @@ discard block |
||
1227 | 1227 | $pos[']]>'] = strpos($content, ']]>'); |
1228 | 1228 | |
1229 | 1229 | if ($pos['<![CDATA['] !== false && $pos[']]>'] !== false) { |
1230 | - $content = substr($content, 0, $pos['<![CDATA[']) . substr($content, $pos[']]>'] + 3); |
|
1230 | + $content = substr($content, 0, $pos['<![CDATA[']).substr($content, $pos[']]>'] + 3); |
|
1231 | 1231 | } |
1232 | 1232 | |
1233 | 1233 | $lp = explode($left, $content); |
@@ -1292,7 +1292,7 @@ discard block |
||
1292 | 1292 | } |
1293 | 1293 | } |
1294 | 1294 | foreach ($tags as $i=>$tag) { |
1295 | - if (strpos($tag, $spacer)!==false) { |
|
1295 | + if (strpos($tag, $spacer) !== false) { |
|
1296 | 1296 | $tags[$i] = str_replace($spacer, '', $tag); |
1297 | 1297 | } |
1298 | 1298 | } |
@@ -1334,7 +1334,7 @@ discard block |
||
1334 | 1334 | } |
1335 | 1335 | |
1336 | 1336 | foreach ($matches[1] as $i => $key) { |
1337 | - if (strpos($key, '[+')!==false) { |
|
1337 | + if (strpos($key, '[+') !== false) { |
|
1338 | 1338 | continue; |
1339 | 1339 | } // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
1340 | 1340 | if (substr($key, 0, 1) == '#') { |
@@ -1356,8 +1356,8 @@ discard block |
||
1356 | 1356 | } |
1357 | 1357 | |
1358 | 1358 | if (is_array($value)) { |
1359 | - include_once(MODX_MANAGER_PATH . 'includes/tmplvars.format.inc.php'); |
|
1360 | - include_once(MODX_MANAGER_PATH . 'includes/tmplvars.commands.inc.php'); |
|
1359 | + include_once(MODX_MANAGER_PATH.'includes/tmplvars.format.inc.php'); |
|
1360 | + include_once(MODX_MANAGER_PATH.'includes/tmplvars.commands.inc.php'); |
|
1361 | 1361 | $value = getTVDisplayFormat($value[0], $value[1], $value[2], $value[3], $value[4]); |
1362 | 1362 | } |
1363 | 1363 | |
@@ -1369,7 +1369,7 @@ discard block |
||
1369 | 1369 | if (strpos($content, $s) !== false) { |
1370 | 1370 | $content = str_replace($s, $value, $content); |
1371 | 1371 | } elseif ($this->debug) { |
1372 | - $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1372 | + $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1373 | 1373 | } |
1374 | 1374 | } |
1375 | 1375 | |
@@ -1537,7 +1537,7 @@ discard block |
||
1537 | 1537 | if (strpos($content, $s) !== false) { |
1538 | 1538 | $content = str_replace($s, $value, $content); |
1539 | 1539 | } elseif ($this->debug) { |
1540 | - $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1540 | + $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1541 | 1541 | } |
1542 | 1542 | } |
1543 | 1543 | return $content; |
@@ -1590,7 +1590,7 @@ discard block |
||
1590 | 1590 | } |
1591 | 1591 | |
1592 | 1592 | $value = $this->parseText($value, $params); // parse local scope placeholers for ConditionalTags |
1593 | - $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers |
|
1593 | + $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers |
|
1594 | 1594 | if ($this->config['enable_at_syntax']) { |
1595 | 1595 | $value = $this->mergeConditionalTagsContent($value); |
1596 | 1596 | } |
@@ -1606,7 +1606,7 @@ discard block |
||
1606 | 1606 | if (strpos($content, $s) !== false) { |
1607 | 1607 | $content = str_replace($s, $value, $content); |
1608 | 1608 | } elseif ($this->debug) { |
1609 | - $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1609 | + $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1610 | 1610 | } |
1611 | 1611 | } |
1612 | 1612 | return $content; |
@@ -1663,7 +1663,7 @@ discard block |
||
1663 | 1663 | if (strpos($content, $s) !== false) { |
1664 | 1664 | $content = str_replace($s, $value, $content); |
1665 | 1665 | } elseif ($this->debug) { |
1666 | - $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1666 | + $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1667 | 1667 | } |
1668 | 1668 | } |
1669 | 1669 | return $content; |
@@ -1687,7 +1687,7 @@ discard block |
||
1687 | 1687 | return $content; |
1688 | 1688 | } |
1689 | 1689 | |
1690 | - $sp = '#' . md5('ConditionalTags' . $_SERVER['REQUEST_TIME']) . '#'; |
|
1690 | + $sp = '#'.md5('ConditionalTags'.$_SERVER['REQUEST_TIME']).'#'; |
|
1691 | 1691 | $content = str_replace(array('<?php', '<?=', '<?', '?>'), array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), $content); |
1692 | 1692 | |
1693 | 1693 | $pieces = explode('<@IF:', $content); |
@@ -1698,7 +1698,7 @@ discard block |
||
1698 | 1698 | } |
1699 | 1699 | list($cmd, $text) = explode('>', $split, 2); |
1700 | 1700 | $cmd = str_replace("'", "\'", $cmd); |
1701 | - $content .= "<?php if(\$this->_parseCTagCMD('" . $cmd . "')): ?>"; |
|
1701 | + $content .= "<?php if(\$this->_parseCTagCMD('".$cmd."')): ?>"; |
|
1702 | 1702 | $content .= $text; |
1703 | 1703 | } |
1704 | 1704 | $pieces = explode('<@ELSEIF:', $content); |
@@ -1709,13 +1709,13 @@ discard block |
||
1709 | 1709 | } |
1710 | 1710 | list($cmd, $text) = explode('>', $split, 2); |
1711 | 1711 | $cmd = str_replace("'", "\'", $cmd); |
1712 | - $content .= "<?php elseif(\$this->_parseCTagCMD('" . $cmd . "')): ?>"; |
|
1712 | + $content .= "<?php elseif(\$this->_parseCTagCMD('".$cmd."')): ?>"; |
|
1713 | 1713 | $content .= $text; |
1714 | 1714 | } |
1715 | 1715 | |
1716 | 1716 | $content = str_replace(array('<@ELSE>', '<@ENDIF>'), array('<?php else:?>', '<?php endif;?>'), $content); |
1717 | 1717 | ob_start(); |
1718 | - $content = eval('?>' . $content); |
|
1718 | + $content = eval('?>'.$content); |
|
1719 | 1719 | $content = ob_get_clean(); |
1720 | 1720 | $content = str_replace(array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), array('<?php', '<?=', '<?', '?>'), $content); |
1721 | 1721 | |
@@ -1840,7 +1840,7 @@ discard block |
||
1840 | 1840 | $matches = $this->getTagsFromContent($content, $left, $right); |
1841 | 1841 | if (!empty($matches)) { |
1842 | 1842 | foreach ($matches[0] as $i => $v) { |
1843 | - $addBreakMatches[$i] = $v . "\n"; |
|
1843 | + $addBreakMatches[$i] = $v."\n"; |
|
1844 | 1844 | } |
1845 | 1845 | $content = str_replace($addBreakMatches, '', $content); |
1846 | 1846 | if (strpos($content, $left) !== false) { |
@@ -1874,7 +1874,7 @@ discard block |
||
1874 | 1874 | if (strpos($content, $s) !== false) { |
1875 | 1875 | $content = str_replace($s, $v, $content); |
1876 | 1876 | } elseif ($this->debug) { |
1877 | - $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1877 | + $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1878 | 1878 | } |
1879 | 1879 | } |
1880 | 1880 | return $content; |
@@ -1938,7 +1938,7 @@ discard block |
||
1938 | 1938 | $msg = ($msg === false) ? 'ob_get_contents() error' : $msg; |
1939 | 1939 | $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Plugin', $error_info['message'], $error_info['line'], $msg); |
1940 | 1940 | if ($this->isBackend()) { |
1941 | - $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>' . $msg . '</p>'); |
|
1941 | + $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>'.$msg.'</p>'); |
|
1942 | 1942 | } |
1943 | 1943 | } |
1944 | 1944 | } else { |
@@ -1984,7 +1984,7 @@ discard block |
||
1984 | 1984 | $echo = ($echo === false) ? 'ob_get_contents() error' : $echo; |
1985 | 1985 | $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Snippet', $error_info['message'], $error_info['line'], $echo); |
1986 | 1986 | if ($this->isBackend()) { |
1987 | - $this->event->alert('An error occurred while loading. Please see the event log for more information<p>' . $echo . $return . '</p>'); |
|
1987 | + $this->event->alert('An error occurred while loading. Please see the event log for more information<p>'.$echo.$return.'</p>'); |
|
1988 | 1988 | } |
1989 | 1989 | } |
1990 | 1990 | } |
@@ -1992,7 +1992,7 @@ discard block |
||
1992 | 1992 | if (is_array($return) || is_object($return)) { |
1993 | 1993 | return $return; |
1994 | 1994 | } else { |
1995 | - return $echo . $return; |
|
1995 | + return $echo.$return; |
|
1996 | 1996 | } |
1997 | 1997 | } |
1998 | 1998 | |
@@ -2031,7 +2031,7 @@ discard block |
||
2031 | 2031 | if (strpos($content, $s) !== false) { |
2032 | 2032 | $content = str_replace($s, $value, $content); |
2033 | 2033 | } elseif ($this->debug) { |
2034 | - $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
2034 | + $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
2035 | 2035 | } |
2036 | 2036 | continue; |
2037 | 2037 | } |
@@ -2043,7 +2043,7 @@ discard block |
||
2043 | 2043 | if (strpos($content, $s) !== false) { |
2044 | 2044 | $content = str_replace($s, $value, $content); |
2045 | 2045 | } elseif ($this->debug) { |
2046 | - $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
2046 | + $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
2047 | 2047 | } |
2048 | 2048 | } |
2049 | 2049 | |
@@ -2134,7 +2134,7 @@ discard block |
||
2134 | 2134 | $eventtime = sprintf('%2.2f ms', $eventtime * 1000); |
2135 | 2135 | $code = str_replace("\t", ' ', $this->htmlspecialchars($value)); |
2136 | 2136 | $piece = str_replace("\t", ' ', $this->htmlspecialchars($piece)); |
2137 | - $print_r_params = str_replace("\t", ' ', $this->htmlspecialchars('$modx->event->params = ' . print_r($params, true))); |
|
2137 | + $print_r_params = str_replace("\t", ' ', $this->htmlspecialchars('$modx->event->params = '.print_r($params, true))); |
|
2138 | 2138 | $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); |
2139 | 2139 | $this->snippetsTime[] = array('sname' => $key, 'time' => $eventtime); |
2140 | 2140 | } |
@@ -2379,7 +2379,7 @@ discard block |
||
2379 | 2379 | $rs = $this->db->select('name,snippet,properties', '[+prefix+]site_snippets', $where); |
2380 | 2380 | $count = $this->db->getRecordCount($rs); |
2381 | 2381 | if (1 < $count) { |
2382 | - exit('Error $modx->_getSnippetObject()' . $snip_name); |
|
2382 | + exit('Error $modx->_getSnippetObject()'.$snip_name); |
|
2383 | 2383 | } |
2384 | 2384 | if ($count) { |
2385 | 2385 | $row = $this->db->getRow($rs); |
@@ -2405,7 +2405,7 @@ discard block |
||
2405 | 2405 | public function toAlias($text) |
2406 | 2406 | { |
2407 | 2407 | $suff = $this->config['friendly_url_suffix']; |
2408 | - 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); |
|
2408 | + 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); |
|
2409 | 2409 | } |
2410 | 2410 | |
2411 | 2411 | /** |
@@ -2437,7 +2437,7 @@ discard block |
||
2437 | 2437 | $suff = '/'; |
2438 | 2438 | } |
2439 | 2439 | |
2440 | - $url = ($dir != '' ? $dir . '/' : '') . $pre . $alias . $suff; |
|
2440 | + $url = ($dir != '' ? $dir.'/' : '').$pre.$alias.$suff; |
|
2441 | 2441 | } |
2442 | 2442 | |
2443 | 2443 | $evtOut = $this->invokeEvent('OnMakeDocUrl', array( |
@@ -2474,7 +2474,7 @@ discard block |
||
2474 | 2474 | preg_match_all('!\[\~([0-9]+)\~\]!ise', $documentSource, $match); |
2475 | 2475 | $ids = implode(',', array_unique($match['1'])); |
2476 | 2476 | if ($ids) { |
2477 | - $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (" . $ids . ") AND isfolder = '0'"); |
|
2477 | + $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (".$ids.") AND isfolder = '0'"); |
|
2478 | 2478 | while ($row = $this->db->getRow($res)) { |
2479 | 2479 | if ($this->config['use_alias_path'] == '1' && $row['parent'] != 0) { |
2480 | 2480 | $parent = $row['parent']; |
@@ -2485,7 +2485,7 @@ discard block |
||
2485 | 2485 | $parent = $this->aliasListing[$parent]['parent']; |
2486 | 2486 | } |
2487 | 2487 | |
2488 | - $aliases[$row['id']] = $path . '/' . $row['alias']; |
|
2488 | + $aliases[$row['id']] = $path.'/'.$row['alias']; |
|
2489 | 2489 | } else { |
2490 | 2490 | $aliases[$row['id']] = $row['alias']; |
2491 | 2491 | } |
@@ -2497,7 +2497,7 @@ discard block |
||
2497 | 2497 | $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0); |
2498 | 2498 | $pref = $this->config['friendly_url_prefix']; |
2499 | 2499 | $suff = $this->config['friendly_url_suffix']; |
2500 | - $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
2500 | + $documentSource = preg_replace_callback($in, function($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
2501 | 2501 | global $modx; |
2502 | 2502 | $thealias = $aliases[$m[1]]; |
2503 | 2503 | $thefolder = $isfolder[$m[1]]; |
@@ -2512,7 +2512,7 @@ discard block |
||
2512 | 2512 | }, $documentSource); |
2513 | 2513 | } else { |
2514 | 2514 | $in = '!\[\~([0-9]+)\~\]!is'; |
2515 | - $out = "index.php?id=" . '\1'; |
|
2515 | + $out = "index.php?id=".'\1'; |
|
2516 | 2516 | $documentSource = preg_replace($in, $out, $documentSource); |
2517 | 2517 | } |
2518 | 2518 | |
@@ -2533,7 +2533,7 @@ discard block |
||
2533 | 2533 | $scheme = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http'; |
2534 | 2534 | $len_base_url = strlen($this->config['base_url']); |
2535 | 2535 | |
2536 | - $url_path = $q;//LANG |
|
2536 | + $url_path = $q; //LANG |
|
2537 | 2537 | |
2538 | 2538 | if (substr($url_path, 0, $len_base_url) === $this->config['base_url']) { |
2539 | 2539 | $url_path = substr($url_path, $len_base_url); |
@@ -2545,7 +2545,7 @@ discard block |
||
2545 | 2545 | $strictURL = substr($strictURL, $len_base_url); |
2546 | 2546 | } |
2547 | 2547 | $http_host = $_SERVER['HTTP_HOST']; |
2548 | - $requestedURL = "{$scheme}://{$http_host}" . '/' . $q; //LANG |
|
2548 | + $requestedURL = "{$scheme}://{$http_host}".'/'.$q; //LANG |
|
2549 | 2549 | |
2550 | 2550 | $site_url = $this->config['site_url']; |
2551 | 2551 | $url_query_string = explode('?', $_SERVER['REQUEST_URI']); |
@@ -2563,7 +2563,7 @@ discard block |
||
2563 | 2563 | } |
2564 | 2564 | if ($this->config['base_url'] != $_SERVER['REQUEST_URI']) { |
2565 | 2565 | if (empty($_POST)) { |
2566 | - if (($this->config['base_url'] . '?' . $qstring) != $_SERVER['REQUEST_URI']) { |
|
2566 | + if (($this->config['base_url'].'?'.$qstring) != $_SERVER['REQUEST_URI']) { |
|
2567 | 2567 | $this->sendRedirect($url, 0, 'REDIRECT_HEADER', 'HTTP/1.0 301 Moved Permanently'); |
2568 | 2568 | exit(0); |
2569 | 2569 | } |
@@ -2621,7 +2621,7 @@ discard block |
||
2621 | 2621 | $docgrp = implode(",", $docgrp); |
2622 | 2622 | } |
2623 | 2623 | // get document |
2624 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
2624 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
2625 | 2625 | $rs = $this->db->select('sc.*', "{$tblsc} sc |
2626 | 2626 | LEFT JOIN {$tbldg} dg ON dg.document = sc.id", "sc.{$method} = '{$identifier}' AND ({$access})", "", 1); |
2627 | 2627 | if ($this->db->getRecordCount($rs) < 1) { |
@@ -2657,9 +2657,9 @@ discard block |
||
2657 | 2657 | } |
2658 | 2658 | if ($documentObject['template']) { |
2659 | 2659 | // load TVs and merge with document - Orig by Apodigm - Docvars |
2660 | - $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars") . " tv |
|
2661 | - INNER JOIN " . $this->getFullTableName("site_tmplvar_templates") . " tvtpl ON tvtpl.tmplvarid = tv.id |
|
2662 | - LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues") . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'"); |
|
2660 | + $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars")." tv |
|
2661 | + INNER JOIN " . $this->getFullTableName("site_tmplvar_templates")." tvtpl ON tvtpl.tmplvarid = tv.id |
|
2662 | + LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues")." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'"); |
|
2663 | 2663 | $tmplvars = array(); |
2664 | 2664 | while ($row = $this->db->getRow($rs)) { |
2665 | 2665 | $tmplvars[$row['name']] = array( |
@@ -2705,7 +2705,7 @@ discard block |
||
2705 | 2705 | $st = md5($source); |
2706 | 2706 | } |
2707 | 2707 | if ($this->dumpSnippets == 1) { |
2708 | - $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>"; |
|
2708 | + $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>"; |
|
2709 | 2709 | } |
2710 | 2710 | |
2711 | 2711 | // invoke OnParseDocument event |
@@ -2793,7 +2793,7 @@ discard block |
||
2793 | 2793 | |
2794 | 2794 | // Check use_alias_path and check if $this->virtualDir is set to anything, then parse the path |
2795 | 2795 | if ($this->config['use_alias_path'] == 1) { |
2796 | - $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir . '/' : '') . $this->documentIdentifier; |
|
2796 | + $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir.'/' : '').$this->documentIdentifier; |
|
2797 | 2797 | if (isset($this->documentListing[$alias])) { |
2798 | 2798 | $this->documentIdentifier = $this->documentListing[$alias]; |
2799 | 2799 | } else { |
@@ -2854,7 +2854,7 @@ discard block |
||
2854 | 2854 | } else { |
2855 | 2855 | $docAlias = $this->db->escape($this->documentIdentifier); |
2856 | 2856 | $rs = $this->db->select('id', $this->getFullTableName('site_content'), "deleted=0 and alias='{$docAlias}'"); |
2857 | - $this->documentIdentifier = (int)$this->db->getValue($rs); |
|
2857 | + $this->documentIdentifier = (int) $this->db->getValue($rs); |
|
2858 | 2858 | } |
2859 | 2859 | } |
2860 | 2860 | $this->documentMethod = 'id'; |
@@ -2911,7 +2911,7 @@ discard block |
||
2911 | 2911 | $_REQUEST[$n] = $_GET[$n] = $v; |
2912 | 2912 | } |
2913 | 2913 | } |
2914 | - $_SERVER['PHP_SELF'] = $this->config['base_url'] . $qp['path']; |
|
2914 | + $_SERVER['PHP_SELF'] = $this->config['base_url'].$qp['path']; |
|
2915 | 2915 | $this->q = $qp['path']; |
2916 | 2916 | return $qp['path']; |
2917 | 2917 | } |
@@ -3005,7 +3005,7 @@ discard block |
||
3005 | 3005 | $this->sendErrorPage(); |
3006 | 3006 | } else { |
3007 | 3007 | // Inculde the necessary files to check document permissions |
3008 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
3008 | + include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php'); |
|
3009 | 3009 | $udperms = new udperms(); |
3010 | 3010 | $udperms->user = $this->getLoginUserID(); |
3011 | 3011 | $udperms->document = $this->documentIdentifier; |
@@ -3059,7 +3059,7 @@ discard block |
||
3059 | 3059 | while ($id && $height--) { |
3060 | 3060 | $thisid = $id; |
3061 | 3061 | if ($this->config['aliaslistingfolder'] == 1) { |
3062 | - $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"); |
|
3062 | + $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"); |
|
3063 | 3063 | if (!$id || $id == '0') { |
3064 | 3064 | break; |
3065 | 3065 | } |
@@ -3108,15 +3108,15 @@ discard block |
||
3108 | 3108 | } |
3109 | 3109 | |
3110 | 3110 | if ($this->config['aliaslistingfolder'] == 1) { |
3111 | - $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (" . $id . ") AND deleted = '0'"); |
|
3111 | + $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (".$id.") AND deleted = '0'"); |
|
3112 | 3112 | $idx = array(); |
3113 | 3113 | while ($row = $this->db->getRow($res)) { |
3114 | 3114 | $pAlias = ''; |
3115 | 3115 | if (isset($this->aliasListing[$row['parent']])) { |
3116 | - $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'] . '/' : ''; |
|
3117 | - $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'] . '/' : ''; |
|
3116 | + $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'].'/' : ''; |
|
3117 | + $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'].'/' : ''; |
|
3118 | 3118 | }; |
3119 | - $children[$pAlias . $row['alias']] = $row['id']; |
|
3119 | + $children[$pAlias.$row['alias']] = $row['id']; |
|
3120 | 3120 | if ($row['isfolder'] == 1) { |
3121 | 3121 | $idx[] = $row['id']; |
3122 | 3122 | } |
@@ -3147,7 +3147,7 @@ discard block |
||
3147 | 3147 | $depth--; |
3148 | 3148 | |
3149 | 3149 | foreach ($documentMap_cache[$id] as $childId) { |
3150 | - $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '') . $this->aliasListing[$childId]['alias']; |
|
3150 | + $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '').$this->aliasListing[$childId]['alias']; |
|
3151 | 3151 | if (!strlen($pkey)) { |
3152 | 3152 | $pkey = "{$childId}"; |
3153 | 3153 | } |
@@ -3175,7 +3175,7 @@ discard block |
||
3175 | 3175 | if (substr(strtolower($url), 0, 11) == "javascript:") { |
3176 | 3176 | $fnc = substr($url, 11); |
3177 | 3177 | } elseif ($url) { |
3178 | - $fnc = "window.location.href='" . addslashes($url) . "';"; |
|
3178 | + $fnc = "window.location.href='".addslashes($url)."';"; |
|
3179 | 3179 | } else { |
3180 | 3180 | $fnc = "history.back(-1);"; |
3181 | 3181 | } |
@@ -3184,7 +3184,7 @@ discard block |
||
3184 | 3184 | <meta http-equiv=\"Content-Type\" content=\"text/html; charset={$modx_manager_charset};\"> |
3185 | 3185 | <script> |
3186 | 3186 | function __alertQuit() { |
3187 | - alert('" . addslashes($msg) . "'); |
|
3187 | + alert('".addslashes($msg)."'); |
|
3188 | 3188 | {$fnc} |
3189 | 3189 | } |
3190 | 3190 | window.setTimeout('__alertQuit();',100); |
@@ -3206,9 +3206,9 @@ discard block |
||
3206 | 3206 | $state = 0; |
3207 | 3207 | $pms = $_SESSION['mgrPermissions']; |
3208 | 3208 | if ($pms) { |
3209 | - $state = ((bool)$pms[$pm] === true); |
|
3209 | + $state = ((bool) $pms[$pm] === true); |
|
3210 | 3210 | } |
3211 | - return (int)$state; |
|
3211 | + return (int) $state; |
|
3212 | 3212 | } |
3213 | 3213 | |
3214 | 3214 | /** |
@@ -3221,8 +3221,8 @@ discard block |
||
3221 | 3221 | */ |
3222 | 3222 | public function elementIsLocked($type, $id, $includeThisUser = false) |
3223 | 3223 | { |
3224 | - $id = (int)$id; |
|
3225 | - $type = (int)$type; |
|
3224 | + $id = (int) $id; |
|
3225 | + $type = (int) $type; |
|
3226 | 3226 | if (!$type || !$id) { |
3227 | 3227 | return null; |
3228 | 3228 | } |
@@ -3272,7 +3272,7 @@ discard block |
||
3272 | 3272 | return $lockedElements; |
3273 | 3273 | } |
3274 | 3274 | |
3275 | - $type = (int)$type; |
|
3275 | + $type = (int) $type; |
|
3276 | 3276 | if (isset($lockedElements[$type])) { |
3277 | 3277 | return $lockedElements[$type]; |
3278 | 3278 | } else { |
@@ -3289,7 +3289,7 @@ discard block |
||
3289 | 3289 | $this->lockedElements = array(); |
3290 | 3290 | $this->cleanupExpiredLocks(); |
3291 | 3291 | |
3292 | - $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks') . " ul |
|
3292 | + $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks')." ul |
|
3293 | 3293 | LEFT JOIN {$this->getFullTableName('manager_users')} mu on ul.internalKey = mu.id"); |
3294 | 3294 | while ($row = $this->db->getRow($rs)) { |
3295 | 3295 | $this->lockedElements[$row['elementType']][$row['elementId']] = array( |
@@ -3312,7 +3312,7 @@ discard block |
||
3312 | 3312 | public function cleanupExpiredLocks() |
3313 | 3313 | { |
3314 | 3314 | // Clean-up active_user_sessions first |
3315 | - $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 |
|
3315 | + $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 |
|
3316 | 3316 | $validSessionTimeLimit = $this->time - $timeout; |
3317 | 3317 | $this->db->delete($this->getFullTableName('active_user_sessions'), "lasthit < {$validSessionTimeLimit}"); |
3318 | 3318 | |
@@ -3325,7 +3325,7 @@ discard block |
||
3325 | 3325 | foreach ($rs as $row) { |
3326 | 3326 | $userSids[] = $row['sid']; |
3327 | 3327 | } |
3328 | - $userSids = "'" . implode("','", $userSids) . "'"; |
|
3328 | + $userSids = "'".implode("','", $userSids)."'"; |
|
3329 | 3329 | $this->db->delete($this->getFullTableName('active_user_locks'), "sid NOT IN({$userSids})"); |
3330 | 3330 | } else { |
3331 | 3331 | $this->db->delete($this->getFullTableName('active_user_locks')); |
@@ -3406,8 +3406,8 @@ discard block |
||
3406 | 3406 | public function lockElement($type, $id) |
3407 | 3407 | { |
3408 | 3408 | $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0; |
3409 | - $type = (int)$type; |
|
3410 | - $id = (int)$id; |
|
3409 | + $type = (int) $type; |
|
3410 | + $id = (int) $id; |
|
3411 | 3411 | if (!$type || !$id || !$userId) { |
3412 | 3412 | return false; |
3413 | 3413 | } |
@@ -3428,8 +3428,8 @@ discard block |
||
3428 | 3428 | public function unlockElement($type, $id, $includeAllUsers = false) |
3429 | 3429 | { |
3430 | 3430 | $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0; |
3431 | - $type = (int)$type; |
|
3432 | - $id = (int)$id; |
|
3431 | + $type = (int) $type; |
|
3432 | + $id = (int) $id; |
|
3433 | 3433 | if (!$type || !$id) { |
3434 | 3434 | return false; |
3435 | 3435 | } |
@@ -3496,8 +3496,8 @@ discard block |
||
3496 | 3496 | } |
3497 | 3497 | |
3498 | 3498 | $usertype = $this->isFrontend() ? 1 : 0; |
3499 | - $evtid = (int)$evtid; |
|
3500 | - $type = (int)$type; |
|
3499 | + $evtid = (int) $evtid; |
|
3500 | + $type = (int) $type; |
|
3501 | 3501 | |
3502 | 3502 | // Types: 1 = information, 2 = warning, 3 = error |
3503 | 3503 | if ($type < 1) { |
@@ -3519,8 +3519,8 @@ discard block |
||
3519 | 3519 | if (isset($this->config['send_errormail']) && $this->config['send_errormail'] !== '0') { |
3520 | 3520 | if ($this->config['send_errormail'] <= $type) { |
3521 | 3521 | $this->sendmail(array( |
3522 | - 'subject' => 'MODX System Error on ' . $this->config['site_name'], |
|
3523 | - 'body' => 'Source: ' . $source . ' - The details of the error could be seen in the MODX system events log.', |
|
3522 | + 'subject' => 'MODX System Error on '.$this->config['site_name'], |
|
3523 | + 'body' => 'Source: '.$source.' - The details of the error could be seen in the MODX system events log.', |
|
3524 | 3524 | 'type' => 'text' |
3525 | 3525 | )); |
3526 | 3526 | } |
@@ -3568,7 +3568,7 @@ discard block |
||
3568 | 3568 | $p['fromname'] = $userinfo['username']; |
3569 | 3569 | } |
3570 | 3570 | if ($msg === '' && !isset($p['body'])) { |
3571 | - $p['body'] = $_SERVER['REQUEST_URI'] . "\n" . $_SERVER['HTTP_USER_AGENT'] . "\n" . $_SERVER['HTTP_REFERER']; |
|
3571 | + $p['body'] = $_SERVER['REQUEST_URI']."\n".$_SERVER['HTTP_USER_AGENT']."\n".$_SERVER['HTTP_REFERER']; |
|
3572 | 3572 | } elseif (is_string($msg) && 0 < strlen($msg)) { |
3573 | 3573 | $p['body'] = $msg; |
3574 | 3574 | } |
@@ -3608,8 +3608,8 @@ discard block |
||
3608 | 3608 | $files = array(); |
3609 | 3609 | } |
3610 | 3610 | foreach ($files as $f) { |
3611 | - if (file_exists(MODX_BASE_PATH . $f) && is_file(MODX_BASE_PATH . $f) && is_readable(MODX_BASE_PATH . $f)) { |
|
3612 | - $this->mail->AddAttachment(MODX_BASE_PATH . $f); |
|
3611 | + if (file_exists(MODX_BASE_PATH.$f) && is_file(MODX_BASE_PATH.$f) && is_readable(MODX_BASE_PATH.$f)) { |
|
3612 | + $this->mail->AddAttachment(MODX_BASE_PATH.$f); |
|
3613 | 3613 | } |
3614 | 3614 | } |
3615 | 3615 | $rs = $this->mail->send(); |
@@ -3654,7 +3654,7 @@ discard block |
||
3654 | 3654 | */ |
3655 | 3655 | public function isFrontend() |
3656 | 3656 | { |
3657 | - return ! $this->isBackend(); |
|
3657 | + return !$this->isBackend(); |
|
3658 | 3658 | } |
3659 | 3659 | |
3660 | 3660 | /** |
@@ -3678,14 +3678,14 @@ discard block |
||
3678 | 3678 | $tblsc = $this->getFullTableName("site_content"); |
3679 | 3679 | $tbldg = $this->getFullTableName("document_groups"); |
3680 | 3680 | // modify field names to use sc. table reference |
3681 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3682 | - $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3681 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3682 | + $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3683 | 3683 | // get document groups for current user |
3684 | 3684 | if ($docgrp = $this->getUserDocGroups()) { |
3685 | 3685 | $docgrp = implode(",", $docgrp); |
3686 | 3686 | } |
3687 | 3687 | // build query |
3688 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3688 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3689 | 3689 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
3690 | 3690 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}"); |
3691 | 3691 | $resourceArray = $this->db->makeArray($result); |
@@ -3715,14 +3715,14 @@ discard block |
||
3715 | 3715 | $tbldg = $this->getFullTableName("document_groups"); |
3716 | 3716 | |
3717 | 3717 | // modify field names to use sc. table reference |
3718 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3719 | - $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3718 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3719 | + $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3720 | 3720 | // get document groups for current user |
3721 | 3721 | if ($docgrp = $this->getUserDocGroups()) { |
3722 | 3722 | $docgrp = implode(",", $docgrp); |
3723 | 3723 | } |
3724 | 3724 | // build query |
3725 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3725 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3726 | 3726 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
3727 | 3727 | 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}"); |
3728 | 3728 | $resourceArray = $this->db->makeArray($result); |
@@ -3756,16 +3756,16 @@ discard block |
||
3756 | 3756 | return $this->tmpCache[__FUNCTION__][$cacheKey]; |
3757 | 3757 | } |
3758 | 3758 | |
3759 | - $published = ($published !== 'all') ? 'AND sc.published = ' . $published : ''; |
|
3760 | - $deleted = ($deleted !== 'all') ? 'AND sc.deleted = ' . $deleted : ''; |
|
3759 | + $published = ($published !== 'all') ? 'AND sc.published = '.$published : ''; |
|
3760 | + $deleted = ($deleted !== 'all') ? 'AND sc.deleted = '.$deleted : ''; |
|
3761 | 3761 | |
3762 | 3762 | if ($where != '') { |
3763 | - $where = 'AND ' . $where; |
|
3763 | + $where = 'AND '.$where; |
|
3764 | 3764 | } |
3765 | 3765 | |
3766 | 3766 | // modify field names to use sc. table reference |
3767 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3768 | - $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3767 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3768 | + $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3769 | 3769 | |
3770 | 3770 | // get document groups for current user |
3771 | 3771 | if ($docgrp = $this->getUserDocGroups()) { |
@@ -3773,7 +3773,7 @@ discard block |
||
3773 | 3773 | } |
3774 | 3774 | |
3775 | 3775 | // build query |
3776 | - $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')'); |
|
3776 | + $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')'); |
|
3777 | 3777 | |
3778 | 3778 | $tblsc = $this->getFullTableName('site_content'); |
3779 | 3779 | $tbldg = $this->getFullTableName('document_groups'); |
@@ -3824,10 +3824,10 @@ discard block |
||
3824 | 3824 | return false; |
3825 | 3825 | } else { |
3826 | 3826 | // modify field names to use sc. table reference |
3827 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3828 | - $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3827 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3828 | + $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3829 | 3829 | if ($where != '') { |
3830 | - $where = 'AND ' . $where; |
|
3830 | + $where = 'AND '.$where; |
|
3831 | 3831 | } |
3832 | 3832 | |
3833 | 3833 | $published = ($published !== 'all') ? "AND sc.published = '{$published}'" : ''; |
@@ -3838,13 +3838,13 @@ discard block |
||
3838 | 3838 | $docgrp = implode(',', $docgrp); |
3839 | 3839 | } |
3840 | 3840 | |
3841 | - $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')'); |
|
3841 | + $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')'); |
|
3842 | 3842 | |
3843 | 3843 | $tblsc = $this->getFullTableName('site_content'); |
3844 | 3844 | $tbldg = $this->getFullTableName('document_groups'); |
3845 | 3845 | |
3846 | 3846 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
3847 | - 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); |
|
3847 | + 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); |
|
3848 | 3848 | |
3849 | 3849 | $resourceArray = $this->db->makeArray($result); |
3850 | 3850 | |
@@ -3948,12 +3948,12 @@ discard block |
||
3948 | 3948 | $tbldg = $this->getFullTableName("document_groups"); |
3949 | 3949 | $activeSql = $active == 1 ? "AND sc.published=1 AND sc.deleted=0" : ""; |
3950 | 3950 | // modify field names to use sc. table reference |
3951 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3951 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3952 | 3952 | // get document groups for current user |
3953 | 3953 | if ($docgrp = $this->getUserDocGroups()) { |
3954 | 3954 | $docgrp = implode(",", $docgrp); |
3955 | 3955 | } |
3956 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3956 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3957 | 3957 | $result = $this->db->select($fields, "{$tblsc} sc LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id='{$pageid}' {$activeSql}) AND ({$access})", "", 1); |
3958 | 3958 | $pageInfo = $this->db->getRow($result); |
3959 | 3959 | |
@@ -4000,7 +4000,7 @@ discard block |
||
4000 | 4000 | { |
4001 | 4001 | if ($this->currentSnippet) { |
4002 | 4002 | $tbl = $this->getFullTableName("site_snippets"); |
4003 | - $rs = $this->db->select('id', $tbl, "name='" . $this->db->escape($this->currentSnippet) . "'", '', 1); |
|
4003 | + $rs = $this->db->select('id', $tbl, "name='".$this->db->escape($this->currentSnippet)."'", '', 1); |
|
4004 | 4004 | if ($snippetId = $this->db->getValue($rs)) { |
4005 | 4005 | return $snippetId; |
4006 | 4006 | } |
@@ -4027,23 +4027,23 @@ discard block |
||
4027 | 4027 | */ |
4028 | 4028 | public function clearCache($type = '', $report = false) |
4029 | 4029 | { |
4030 | - $cache_dir = MODX_BASE_PATH . $this->getCacheFolder(); |
|
4030 | + $cache_dir = MODX_BASE_PATH.$this->getCacheFolder(); |
|
4031 | 4031 | if (is_array($type)) { |
4032 | 4032 | foreach ($type as $_) { |
4033 | 4033 | $this->clearCache($_, $report); |
4034 | 4034 | } |
4035 | 4035 | } elseif ($type == 'full') { |
4036 | - include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php'); |
|
4036 | + include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php'); |
|
4037 | 4037 | $sync = new synccache(); |
4038 | 4038 | $sync->setCachepath($cache_dir); |
4039 | 4039 | $sync->setReport($report); |
4040 | 4040 | $sync->emptyCache(); |
4041 | 4041 | } elseif (preg_match('@^[1-9][0-9]*$@', $type)) { |
4042 | 4042 | $key = ($this->config['cache_type'] == 2) ? $this->makePageCacheKey($type) : $type; |
4043 | - $file_name = "docid_" . $key . "_*.pageCache.php"; |
|
4044 | - $cache_path = $cache_dir . $file_name; |
|
4043 | + $file_name = "docid_".$key."_*.pageCache.php"; |
|
4044 | + $cache_path = $cache_dir.$file_name; |
|
4045 | 4045 | $files = glob($cache_path); |
4046 | - $files[] = $cache_dir . "docid_" . $key . ".pageCache.php"; |
|
4046 | + $files[] = $cache_dir."docid_".$key.".pageCache.php"; |
|
4047 | 4047 | foreach ($files as $file) { |
4048 | 4048 | if (!is_file($file)) { |
4049 | 4049 | continue; |
@@ -4051,7 +4051,7 @@ discard block |
||
4051 | 4051 | unlink($file); |
4052 | 4052 | } |
4053 | 4053 | } else { |
4054 | - $files = glob($cache_dir . '*'); |
|
4054 | + $files = glob($cache_dir.'*'); |
|
4055 | 4055 | foreach ($files as $file) { |
4056 | 4056 | $name = basename($file); |
4057 | 4057 | if (strpos($name, '.pageCache.php') === false) { |
@@ -4119,14 +4119,14 @@ discard block |
||
4119 | 4119 | $f_url_suffix = '/'; |
4120 | 4120 | } |
4121 | 4121 | |
4122 | - $alPath = !empty($al['path']) ? $al['path'] . '/' : ''; |
|
4122 | + $alPath = !empty($al['path']) ? $al['path'].'/' : ''; |
|
4123 | 4123 | |
4124 | 4124 | if ($al && $al['alias']) { |
4125 | 4125 | $alias = $al['alias']; |
4126 | 4126 | } |
4127 | 4127 | } |
4128 | 4128 | |
4129 | - $alias = $alPath . $f_url_prefix . $alias . $f_url_suffix; |
|
4129 | + $alias = $alPath.$f_url_prefix.$alias.$f_url_suffix; |
|
4130 | 4130 | $url = "{$alias}{$args}"; |
4131 | 4131 | } else { |
4132 | 4132 | $url = "index.php?id={$id}{$args}"; |
@@ -4145,7 +4145,7 @@ discard block |
||
4145 | 4145 | } |
4146 | 4146 | |
4147 | 4147 | //TODO: check to make sure that $site_url incudes the url :port (e.g. :8080) |
4148 | - $host = $scheme == 'full' ? $this->config['site_url'] : $scheme . '://' . $_SERVER['HTTP_HOST'] . $host; |
|
4148 | + $host = $scheme == 'full' ? $this->config['site_url'] : $scheme.'://'.$_SERVER['HTTP_HOST'].$host; |
|
4149 | 4149 | } |
4150 | 4150 | |
4151 | 4151 | //fix strictUrl by Bumkaka |
@@ -4154,9 +4154,9 @@ discard block |
||
4154 | 4154 | } |
4155 | 4155 | |
4156 | 4156 | if ($this->config['xhtml_urls']) { |
4157 | - $url = preg_replace("/&(?!amp;)/", "&", $host . $virtualDir . $url); |
|
4157 | + $url = preg_replace("/&(?!amp;)/", "&", $host.$virtualDir.$url); |
|
4158 | 4158 | } else { |
4159 | - $url = $host . $virtualDir . $url; |
|
4159 | + $url = $host.$virtualDir.$url; |
|
4160 | 4160 | } |
4161 | 4161 | |
4162 | 4162 | $evtOut = $this->invokeEvent('OnMakeDocUrl', array( |
@@ -4180,21 +4180,21 @@ discard block |
||
4180 | 4180 | if (isset($this->aliasListing[$id])) { |
4181 | 4181 | $out = $this->aliasListing[$id]; |
4182 | 4182 | } else { |
4183 | - $q = $this->db->query("SELECT id,alias,isfolder,parent FROM " . $this->getFullTableName("site_content") . " WHERE id=" . (int)$id); |
|
4183 | + $q = $this->db->query("SELECT id,alias,isfolder,parent FROM ".$this->getFullTableName("site_content")." WHERE id=".(int) $id); |
|
4184 | 4184 | if ($this->db->getRecordCount($q) == '1') { |
4185 | 4185 | $q = $this->db->getRow($q); |
4186 | 4186 | $this->aliasListing[$id] = array( |
4187 | - 'id' => (int)$q['id'], |
|
4187 | + 'id' => (int) $q['id'], |
|
4188 | 4188 | 'alias' => $q['alias'] == '' ? $q['id'] : $q['alias'], |
4189 | - 'parent' => (int)$q['parent'], |
|
4190 | - 'isfolder' => (int)$q['isfolder'], |
|
4189 | + 'parent' => (int) $q['parent'], |
|
4190 | + 'isfolder' => (int) $q['isfolder'], |
|
4191 | 4191 | ); |
4192 | 4192 | if ($this->aliasListing[$id]['parent'] > 0) { |
4193 | 4193 | //fix alias_path_usage |
4194 | 4194 | if ($this->config['use_alias_path'] == '1') { |
4195 | 4195 | //&& $tmp['path'] != '' - fix error slash with epty path |
4196 | 4196 | $tmp = $this->getAliasListing($this->aliasListing[$id]['parent']); |
4197 | - $this->aliasListing[$id]['path'] = $tmp['path'] . ($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '') . $tmp['alias'] : ''); |
|
4197 | + $this->aliasListing[$id]['path'] = $tmp['path'].($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '').$tmp['alias'] : ''); |
|
4198 | 4198 | } else { |
4199 | 4199 | $this->aliasListing[$id]['path'] = ''; |
4200 | 4200 | } |
@@ -4235,7 +4235,7 @@ discard block |
||
4235 | 4235 | $out = array(); |
4236 | 4236 | if (empty($this->version) || !is_array($this->version)) { |
4237 | 4237 | //include for compatibility modx version < 1.0.10 |
4238 | - include MODX_MANAGER_PATH . "includes/version.inc.php"; |
|
4238 | + include MODX_MANAGER_PATH."includes/version.inc.php"; |
|
4239 | 4239 | $this->version = array(); |
4240 | 4240 | $this->version['version'] = isset($modx_version) ? $modx_version : ''; |
4241 | 4241 | $this->version['branch'] = isset($modx_branch) ? $modx_branch : ''; |
@@ -4257,18 +4257,18 @@ discard block |
||
4257 | 4257 | { |
4258 | 4258 | if (isset($this->snippetCache[$snippetName])) { |
4259 | 4259 | $snippet = $this->snippetCache[$snippetName]; |
4260 | - $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : ''; |
|
4260 | + $properties = !empty($this->snippetCache[$snippetName."Props"]) ? $this->snippetCache[$snippetName."Props"] : ''; |
|
4261 | 4261 | } else { // not in cache so let's check the db |
4262 | - $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;"; |
|
4262 | + $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;"; |
|
4263 | 4263 | $result = $this->db->query($sql); |
4264 | 4264 | if ($this->db->getRecordCount($result) == 1) { |
4265 | 4265 | $row = $this->db->getRow($result); |
4266 | 4266 | $snippet = $this->snippetCache[$snippetName] = $row['snippet']; |
4267 | 4267 | $mergedProperties = array_merge($this->parseProperties($row['properties']), $this->parseProperties($row['sharedproperties'])); |
4268 | - $properties = $this->snippetCache[$snippetName . "Props"] = json_encode($mergedProperties); |
|
4268 | + $properties = $this->snippetCache[$snippetName."Props"] = json_encode($mergedProperties); |
|
4269 | 4269 | } else { |
4270 | 4270 | $snippet = $this->snippetCache[$snippetName] = "return false;"; |
4271 | - $properties = $this->snippetCache[$snippetName . "Props"] = ''; |
|
4271 | + $properties = $this->snippetCache[$snippetName."Props"] = ''; |
|
4272 | 4272 | } |
4273 | 4273 | } |
4274 | 4274 | // load default params/properties |
@@ -4368,7 +4368,7 @@ discard block |
||
4368 | 4368 | if (strpos($tpl, $s) !== false) { |
4369 | 4369 | $tpl = str_replace($s, $value, $tpl); |
4370 | 4370 | } elseif ($this->debug) { |
4371 | - $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
4371 | + $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
4372 | 4372 | } |
4373 | 4373 | } |
4374 | 4374 | |
@@ -4417,7 +4417,7 @@ discard block |
||
4417 | 4417 | case 'CODE': |
4418 | 4418 | break; |
4419 | 4419 | case 'FILE': |
4420 | - $template = file_get_contents(MODX_BASE_PATH . $template); |
|
4420 | + $template = file_get_contents(MODX_BASE_PATH.$template); |
|
4421 | 4421 | break; |
4422 | 4422 | case 'CHUNK': |
4423 | 4423 | $template = $this->getChunk($template); |
@@ -4450,7 +4450,7 @@ discard block |
||
4450 | 4450 | if ($mode !== 'formatOnly' && empty($timestamp)) { |
4451 | 4451 | return '-'; |
4452 | 4452 | } |
4453 | - $timestamp = (int)$timestamp; |
|
4453 | + $timestamp = (int) $timestamp; |
|
4454 | 4454 | |
4455 | 4455 | switch ($this->config['datetime_format']) { |
4456 | 4456 | case 'YYYY/mm/dd': |
@@ -4470,7 +4470,7 @@ discard block |
||
4470 | 4470 | } |
4471 | 4471 | |
4472 | 4472 | if (empty($mode)) { |
4473 | - $strTime = strftime($dateFormat . " %H:%M:%S", $timestamp); |
|
4473 | + $strTime = strftime($dateFormat." %H:%M:%S", $timestamp); |
|
4474 | 4474 | } elseif ($mode == 'dateOnly') { |
4475 | 4475 | $strTime = strftime($dateFormat, $timestamp); |
4476 | 4476 | } elseif ($mode == 'formatOnly') { |
@@ -4524,7 +4524,7 @@ discard block |
||
4524 | 4524 | $S = 0; |
4525 | 4525 | } |
4526 | 4526 | $timeStamp = mktime($H, $M, $S, $m, $d, $Y); |
4527 | - $timeStamp = (int)$timeStamp; |
|
4527 | + $timeStamp = (int) $timeStamp; |
|
4528 | 4528 | return $timeStamp; |
4529 | 4529 | } |
4530 | 4530 | |
@@ -4566,7 +4566,7 @@ discard block |
||
4566 | 4566 | if ($v === 'value') { |
4567 | 4567 | unset($_[$i]); |
4568 | 4568 | } else { |
4569 | - $_[$i] = 'tv.' . $v; |
|
4569 | + $_[$i] = 'tv.'.$v; |
|
4570 | 4570 | } |
4571 | 4571 | } |
4572 | 4572 | $fields = implode(',', $_); |
@@ -4575,12 +4575,12 @@ discard block |
||
4575 | 4575 | } |
4576 | 4576 | |
4577 | 4577 | if ($tvsort != '') { |
4578 | - $tvsort = 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort)))); |
|
4578 | + $tvsort = 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort)))); |
|
4579 | 4579 | } |
4580 | 4580 | if ($tvidnames == "*") { |
4581 | 4581 | $query = "tv.id<>0"; |
4582 | 4582 | } else { |
4583 | - $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name") . " IN ('" . implode("','", $tvidnames) . "')"; |
|
4583 | + $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name")." IN ('".implode("','", $tvidnames)."')"; |
|
4584 | 4584 | } |
4585 | 4585 | |
4586 | 4586 | $this->getUserDocGroups(); |
@@ -4741,18 +4741,18 @@ discard block |
||
4741 | 4741 | } |
4742 | 4742 | |
4743 | 4743 | // get user defined template variables |
4744 | - $fields = ($fields == '') ? 'tv.*' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $fields)))); |
|
4745 | - $sort = ($sort == '') ? '' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $sort)))); |
|
4744 | + $fields = ($fields == '') ? 'tv.*' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $fields)))); |
|
4745 | + $sort = ($sort == '') ? '' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $sort)))); |
|
4746 | 4746 | |
4747 | 4747 | if ($idnames == '*') { |
4748 | 4748 | $query = 'tv.id<>0'; |
4749 | 4749 | } else { |
4750 | - $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name') . " IN ('" . implode("','", $idnames) . "')"; |
|
4750 | + $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name')." IN ('".implode("','", $idnames)."')"; |
|
4751 | 4751 | } |
4752 | 4752 | |
4753 | - $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars') . " tv |
|
4754 | - INNER JOIN " . $this->getFullTableName('site_tmplvar_templates') . " tvtpl ON tvtpl.tmplvarid = tv.id |
|
4755 | - 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}" : "")); |
|
4753 | + $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars')." tv |
|
4754 | + INNER JOIN " . $this->getFullTableName('site_tmplvar_templates')." tvtpl ON tvtpl.tmplvarid = tv.id |
|
4755 | + 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}" : "")); |
|
4756 | 4756 | |
4757 | 4757 | $result = $this->db->makeArray($rs); |
4758 | 4758 | |
@@ -4801,16 +4801,16 @@ discard block |
||
4801 | 4801 | $output = array(); |
4802 | 4802 | $vars = ($idnames == '*' || is_array($idnames)) ? $idnames : array($idnames); |
4803 | 4803 | |
4804 | - $docid = (int)$docid > 0 ? (int)$docid : $this->documentIdentifier; |
|
4804 | + $docid = (int) $docid > 0 ? (int) $docid : $this->documentIdentifier; |
|
4805 | 4805 | // remove sort for speed |
4806 | 4806 | $result = $this->getTemplateVars($vars, '*', $docid, $published, '', ''); |
4807 | 4807 | |
4808 | 4808 | if ($result == false) { |
4809 | 4809 | return false; |
4810 | 4810 | } else { |
4811 | - $baspath = MODX_MANAGER_PATH . 'includes'; |
|
4812 | - include_once $baspath . '/tmplvars.format.inc.php'; |
|
4813 | - include_once $baspath . '/tmplvars.commands.inc.php'; |
|
4811 | + $baspath = MODX_MANAGER_PATH.'includes'; |
|
4812 | + include_once $baspath.'/tmplvars.format.inc.php'; |
|
4813 | + include_once $baspath.'/tmplvars.commands.inc.php'; |
|
4814 | 4814 | |
4815 | 4815 | for ($i = 0; $i < count($result); $i++) { |
4816 | 4816 | $row = $result[$i]; |
@@ -4835,7 +4835,7 @@ discard block |
||
4835 | 4835 | */ |
4836 | 4836 | public function getFullTableName($tbl) |
4837 | 4837 | { |
4838 | - return $this->db->config['dbase'] . ".`" . $this->db->config['table_prefix'] . $tbl . "`"; |
|
4838 | + return $this->db->config['dbase'].".`".$this->db->config['table_prefix'].$tbl."`"; |
|
4839 | 4839 | } |
4840 | 4840 | |
4841 | 4841 | /** |
@@ -4914,7 +4914,7 @@ discard block |
||
4914 | 4914 | public function getCachePath() |
4915 | 4915 | { |
4916 | 4916 | global $base_url; |
4917 | - $pth = $base_url . $this->getCacheFolder(); |
|
4917 | + $pth = $base_url.$this->getCacheFolder(); |
|
4918 | 4918 | return $pth; |
4919 | 4919 | } |
4920 | 4920 | |
@@ -4966,8 +4966,8 @@ discard block |
||
4966 | 4966 | $out = false; |
4967 | 4967 | |
4968 | 4968 | if (!empty($context)) { |
4969 | - if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) { |
|
4970 | - $out = $_SESSION[$context . 'InternalKey']; |
|
4969 | + if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) { |
|
4970 | + $out = $_SESSION[$context.'InternalKey']; |
|
4971 | 4971 | } |
4972 | 4972 | } else { |
4973 | 4973 | switch (true) { |
@@ -4995,8 +4995,8 @@ discard block |
||
4995 | 4995 | $out = false; |
4996 | 4996 | |
4997 | 4997 | if (!empty($context)) { |
4998 | - if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) { |
|
4999 | - $out = $_SESSION[$context . 'Shortname']; |
|
4998 | + if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) { |
|
4999 | + $out = $_SESSION[$context.'Shortname']; |
|
5000 | 5000 | } |
5001 | 5001 | } else { |
5002 | 5002 | switch (true) { |
@@ -5067,8 +5067,8 @@ discard block |
||
5067 | 5067 | */ |
5068 | 5068 | public function getWebUserInfo($uid) |
5069 | 5069 | { |
5070 | - $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users") . " wu |
|
5071 | - INNER JOIN " . $this->getFullTableName("web_user_attributes") . " wua ON wua.internalkey=wu.id", "wu.id='{$uid}'"); |
|
5070 | + $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users")." wu |
|
5071 | + INNER JOIN " . $this->getFullTableName("web_user_attributes")." wua ON wua.internalkey=wu.id", "wu.id='{$uid}'"); |
|
5072 | 5072 | if ($row = $this->db->getRow($rs)) { |
5073 | 5073 | if (!isset($row['usertype']) or !$row["usertype"]) { |
5074 | 5074 | $row["usertype"] = "web"; |
@@ -5104,7 +5104,7 @@ discard block |
||
5104 | 5104 | } elseif (is_array($dg)) { |
5105 | 5105 | // resolve ids to names |
5106 | 5106 | $dgn = array(); |
5107 | - $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (" . implode(",", $dg) . ")"); |
|
5107 | + $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (".implode(",", $dg).")"); |
|
5108 | 5108 | while ($row = $this->db->getRow($ds)) { |
5109 | 5109 | $dgn[] = $row['name']; |
5110 | 5110 | } |
@@ -5132,7 +5132,7 @@ discard block |
||
5132 | 5132 | $rt = false; |
5133 | 5133 | if ($_SESSION["webValidated"] == 1) { |
5134 | 5134 | $tbl = $this->getFullTableName("web_users"); |
5135 | - $ds = $this->db->select('id, username, password', $tbl, "id='" . $this->getLoginUserID() . "'"); |
|
5135 | + $ds = $this->db->select('id, username, password', $tbl, "id='".$this->getLoginUserID()."'"); |
|
5136 | 5136 | if ($row = $this->db->getRow($ds)) { |
5137 | 5137 | if ($row["password"] == md5($oldPwd)) { |
5138 | 5138 | if (strlen($newPwd) < 6) { |
@@ -5142,7 +5142,7 @@ discard block |
||
5142 | 5142 | } else { |
5143 | 5143 | $this->db->update(array( |
5144 | 5144 | 'password' => $this->db->escape($newPwd), |
5145 | - ), $tbl, "id='" . $this->getLoginUserID() . "'"); |
|
5145 | + ), $tbl, "id='".$this->getLoginUserID()."'"); |
|
5146 | 5146 | // invoke OnWebChangePassword event |
5147 | 5147 | $this->invokeEvent("OnWebChangePassword", array( |
5148 | 5148 | "userid" => $row["id"], |
@@ -5173,8 +5173,8 @@ discard block |
||
5173 | 5173 | // check cache |
5174 | 5174 | $grpNames = isset($_SESSION['webUserGroupNames']) ? $_SESSION['webUserGroupNames'] : false; |
5175 | 5175 | if (!is_array($grpNames)) { |
5176 | - $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names") . " wgn |
|
5177 | - INNER JOIN " . $this->getFullTableName("web_groups") . " wg ON wg.webgroup=wgn.id AND wg.webuser='" . $this->getLoginUserID() . "'"); |
|
5176 | + $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names")." wgn |
|
5177 | + INNER JOIN " . $this->getFullTableName("web_groups")." wg ON wg.webgroup=wgn.id AND wg.webuser='".$this->getLoginUserID()."'"); |
|
5178 | 5178 | $grpNames = $this->db->getColumn("name", $rs); |
5179 | 5179 | // save to cache |
5180 | 5180 | $_SESSION['webUserGroupNames'] = $grpNames; |
@@ -5207,7 +5207,7 @@ discard block |
||
5207 | 5207 | if (strpos(strtolower($src), "<style") !== false || strpos(strtolower($src), "<link") !== false) { |
5208 | 5208 | $this->sjscripts[$nextpos] = $src; |
5209 | 5209 | } else { |
5210 | - $this->sjscripts[$nextpos] = "\t" . '<link rel="stylesheet" type="text/css" href="' . $src . '" ' . ($media ? 'media="' . $media . '" ' : '') . '/>'; |
|
5210 | + $this->sjscripts[$nextpos] = "\t".'<link rel="stylesheet" type="text/css" href="'.$src.'" '.($media ? 'media="'.$media.'" ' : '').'/>'; |
|
5211 | 5211 | } |
5212 | 5212 | } |
5213 | 5213 | |
@@ -5286,7 +5286,7 @@ discard block |
||
5286 | 5286 | } |
5287 | 5287 | |
5288 | 5288 | if ($useThisVer && $plaintext != true && (strpos(strtolower($src), "<script") === false)) { |
5289 | - $src = "\t" . '<script type="text/javascript" src="' . $src . '"></script>'; |
|
5289 | + $src = "\t".'<script type="text/javascript" src="'.$src.'"></script>'; |
|
5290 | 5290 | } |
5291 | 5291 | if ($startup) { |
5292 | 5292 | $pos = isset($overwritepos) ? $overwritepos : max(array_merge(array(0), array_keys($this->sjscripts))) + 1; |
@@ -5433,7 +5433,7 @@ discard block |
||
5433 | 5433 | $eventtime = $this->getMicroTime() - $eventtime; |
5434 | 5434 | $this->pluginsCode .= sprintf('<fieldset><legend><b>%s / %s</b> (%2.2f ms)</legend>', $evtName, $pluginName, $eventtime * 1000); |
5435 | 5435 | foreach ($parameter as $k => $v) { |
5436 | - $this->pluginsCode .= "{$k} => " . print_r($v, true) . '<br>'; |
|
5436 | + $this->pluginsCode .= "{$k} => ".print_r($v, true).'<br>'; |
|
5437 | 5437 | } |
5438 | 5438 | $this->pluginsCode .= '</fieldset><br />'; |
5439 | 5439 | $this->pluginsTime["{$evtName} / {$pluginName}"] += $eventtime; |
@@ -5461,13 +5461,13 @@ discard block |
||
5461 | 5461 | $plugin = array(); |
5462 | 5462 | if (isset($this->pluginCache[$pluginName])) { |
5463 | 5463 | $pluginCode = $this->pluginCache[$pluginName]; |
5464 | - $pluginProperties = isset($this->pluginCache[$pluginName . "Props"]) ? $this->pluginCache[$pluginName . "Props"] : ''; |
|
5464 | + $pluginProperties = isset($this->pluginCache[$pluginName."Props"]) ? $this->pluginCache[$pluginName."Props"] : ''; |
|
5465 | 5465 | } else { |
5466 | 5466 | $pluginName = $this->db->escape($pluginName); |
5467 | 5467 | $result = $this->db->select('name, plugincode, properties', $this->getFullTableName("site_plugins"), "name='{$pluginName}' AND disabled=0"); |
5468 | 5468 | if ($row = $this->db->getRow($result)) { |
5469 | 5469 | $pluginCode = $this->pluginCache[$row['name']] = $row['plugincode']; |
5470 | - $pluginProperties = $this->pluginCache[$row['name'] . "Props"] = $row['properties']; |
|
5470 | + $pluginProperties = $this->pluginCache[$row['name']."Props"] = $row['properties']; |
|
5471 | 5471 | } else { |
5472 | 5472 | $pluginCode = $this->pluginCache[$pluginName] = "return false;"; |
5473 | 5473 | $pluginProperties = ''; |
@@ -5569,7 +5569,7 @@ discard block |
||
5569 | 5569 | public function parseDocBlockFromFile($element_dir, $filename, $escapeValues = false) |
5570 | 5570 | { |
5571 | 5571 | $params = array(); |
5572 | - $fullpath = $element_dir . '/' . $filename; |
|
5572 | + $fullpath = $element_dir.'/'.$filename; |
|
5573 | 5573 | if (is_readable($fullpath)) { |
5574 | 5574 | $tpl = @fopen($fullpath, "r"); |
5575 | 5575 | if ($tpl) { |
@@ -5736,8 +5736,8 @@ discard block |
||
5736 | 5736 | $ph = array('site_url' => MODX_SITE_URL); |
5737 | 5737 | $regexUrl = "/((http|https|ftp|ftps)\:\/\/[^\/]+(\/[^\s]+[^,.?!:;\s])?)/"; |
5738 | 5738 | $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'; |
5739 | - $emailSubject = isset($parsed['name']) ? '?subject=' . $parsed['name'] : ''; |
|
5740 | - $emailSubject .= isset($parsed['version']) ? ' v' . $parsed['version'] : ''; |
|
5739 | + $emailSubject = isset($parsed['name']) ? '?subject='.$parsed['name'] : ''; |
|
5740 | + $emailSubject .= isset($parsed['version']) ? ' v'.$parsed['version'] : ''; |
|
5741 | 5741 | foreach ($parsed as $key => $val) { |
5742 | 5742 | if (is_array($val)) { |
5743 | 5743 | foreach ($val as $key2 => $val2) { |
@@ -5746,7 +5746,7 @@ discard block |
||
5746 | 5746 | $val2 = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val2); |
5747 | 5747 | } |
5748 | 5748 | if (preg_match($regexEmail, $val2, $url)) { |
5749 | - $val2 = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val2); |
|
5749 | + $val2 = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val2); |
|
5750 | 5750 | } |
5751 | 5751 | $parsed[$key][$key2] = $val2; |
5752 | 5752 | } |
@@ -5756,7 +5756,7 @@ discard block |
||
5756 | 5756 | $val = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val); |
5757 | 5757 | } |
5758 | 5758 | if (preg_match($regexEmail, $val, $url)) { |
5759 | - $val = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val); |
|
5759 | + $val = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val); |
|
5760 | 5760 | } |
5761 | 5761 | $parsed[$key] = $val; |
5762 | 5762 | } |
@@ -5770,32 +5770,32 @@ discard block |
||
5770 | 5770 | ); |
5771 | 5771 | |
5772 | 5772 | $nl = "\n"; |
5773 | - $list = isset($parsed['logo']) ? '<img src="' . $this->config['base_url'] . ltrim($parsed['logo'], "/") . '" style="float:right;max-width:100px;height:auto;" />' . $nl : ''; |
|
5774 | - $list .= '<p>' . $nl; |
|
5775 | - $list .= isset($parsed['name']) ? '<strong>' . $parsed['name'] . '</strong><br/>' . $nl : ''; |
|
5776 | - $list .= isset($parsed['description']) ? $parsed['description'] . $nl : ''; |
|
5777 | - $list .= '</p><br/>' . $nl; |
|
5778 | - $list .= isset($parsed['version']) ? '<p><strong>' . $_lang['version'] . ':</strong> ' . $parsed['version'] . '</p>' . $nl : ''; |
|
5779 | - $list .= isset($parsed['license']) ? '<p><strong>' . $_lang['license'] . ':</strong> ' . $parsed['license'] . '</p>' . $nl : ''; |
|
5780 | - $list .= isset($parsed['lastupdate']) ? '<p><strong>' . $_lang['last_update'] . ':</strong> ' . $parsed['lastupdate'] . '</p>' . $nl : ''; |
|
5781 | - $list .= '<br/>' . $nl; |
|
5773 | + $list = isset($parsed['logo']) ? '<img src="'.$this->config['base_url'].ltrim($parsed['logo'], "/").'" style="float:right;max-width:100px;height:auto;" />'.$nl : ''; |
|
5774 | + $list .= '<p>'.$nl; |
|
5775 | + $list .= isset($parsed['name']) ? '<strong>'.$parsed['name'].'</strong><br/>'.$nl : ''; |
|
5776 | + $list .= isset($parsed['description']) ? $parsed['description'].$nl : ''; |
|
5777 | + $list .= '</p><br/>'.$nl; |
|
5778 | + $list .= isset($parsed['version']) ? '<p><strong>'.$_lang['version'].':</strong> '.$parsed['version'].'</p>'.$nl : ''; |
|
5779 | + $list .= isset($parsed['license']) ? '<p><strong>'.$_lang['license'].':</strong> '.$parsed['license'].'</p>'.$nl : ''; |
|
5780 | + $list .= isset($parsed['lastupdate']) ? '<p><strong>'.$_lang['last_update'].':</strong> '.$parsed['lastupdate'].'</p>'.$nl : ''; |
|
5781 | + $list .= '<br/>'.$nl; |
|
5782 | 5782 | $first = true; |
5783 | 5783 | foreach ($arrayParams as $param => $label) { |
5784 | 5784 | if (isset($parsed[$param])) { |
5785 | 5785 | if ($first) { |
5786 | - $list .= '<p><strong>' . $_lang['references'] . '</strong></p>' . $nl; |
|
5787 | - $list .= '<ul class="docBlockList">' . $nl; |
|
5786 | + $list .= '<p><strong>'.$_lang['references'].'</strong></p>'.$nl; |
|
5787 | + $list .= '<ul class="docBlockList">'.$nl; |
|
5788 | 5788 | $first = false; |
5789 | 5789 | } |
5790 | - $list .= ' <li><strong>' . $label . '</strong>' . $nl; |
|
5791 | - $list .= ' <ul>' . $nl; |
|
5790 | + $list .= ' <li><strong>'.$label.'</strong>'.$nl; |
|
5791 | + $list .= ' <ul>'.$nl; |
|
5792 | 5792 | foreach ($parsed[$param] as $val) { |
5793 | - $list .= ' <li>' . $val . '</li>' . $nl; |
|
5793 | + $list .= ' <li>'.$val.'</li>'.$nl; |
|
5794 | 5794 | } |
5795 | - $list .= ' </ul></li>' . $nl; |
|
5795 | + $list .= ' </ul></li>'.$nl; |
|
5796 | 5796 | } |
5797 | 5797 | } |
5798 | - $list .= !$first ? '</ul>' . $nl : ''; |
|
5798 | + $list .= !$first ? '</ul>'.$nl : ''; |
|
5799 | 5799 | |
5800 | 5800 | return $list; |
5801 | 5801 | } |
@@ -5871,7 +5871,7 @@ discard block |
||
5871 | 5871 | */ |
5872 | 5872 | public function addSnippet($name, $phpCode) |
5873 | 5873 | { |
5874 | - $this->snippetCache['#' . $name] = $phpCode; |
|
5874 | + $this->snippetCache['#'.$name] = $phpCode; |
|
5875 | 5875 | } |
5876 | 5876 | |
5877 | 5877 | /** |
@@ -5880,7 +5880,7 @@ discard block |
||
5880 | 5880 | */ |
5881 | 5881 | public function addChunk($name, $text) |
5882 | 5882 | { |
5883 | - $this->chunkCache['#' . $name] = $text; |
|
5883 | + $this->chunkCache['#'.$name] = $text; |
|
5884 | 5884 | } |
5885 | 5885 | |
5886 | 5886 | /** |
@@ -5916,7 +5916,7 @@ discard block |
||
5916 | 5916 | } |
5917 | 5917 | |
5918 | 5918 | if (!$isSafe) { |
5919 | - $msg = $phpcode . "\n" . $this->currentSnippet . "\n" . print_r($_SERVER, true); |
|
5919 | + $msg = $phpcode."\n".$this->currentSnippet."\n".print_r($_SERVER, true); |
|
5920 | 5920 | $title = sprintf('Unknown eval was executed (%s)', $this->htmlspecialchars(substr(trim($phpcode), 0, 50))); |
5921 | 5921 | $this->messageQuit($title, '', true, '', '', 'Parser', $msg); |
5922 | 5922 | return; |
@@ -5930,7 +5930,7 @@ discard block |
||
5930 | 5930 | return 'array()'; |
5931 | 5931 | } |
5932 | 5932 | |
5933 | - $output = $echo . $return; |
|
5933 | + $output = $echo.$return; |
|
5934 | 5934 | modx_sanitize_gpc($output); |
5935 | 5935 | return $this->htmlspecialchars($output); // Maybe, all html tags are dangerous |
5936 | 5936 | } |
@@ -5948,8 +5948,8 @@ discard block |
||
5948 | 5948 | |
5949 | 5949 | $safe = explode(',', $safe_functions); |
5950 | 5950 | |
5951 | - $phpcode = rtrim($phpcode, ';') . ';'; |
|
5952 | - $tokens = token_get_all('<?php ' . $phpcode); |
|
5951 | + $phpcode = rtrim($phpcode, ';').';'; |
|
5952 | + $tokens = token_get_all('<?php '.$phpcode); |
|
5953 | 5953 | foreach ($tokens as $i => $token) { |
5954 | 5954 | if (!is_array($token)) { |
5955 | 5955 | continue; |
@@ -5984,7 +5984,7 @@ discard block |
||
5984 | 5984 | */ |
5985 | 5985 | public function atBindFileContent($str = '') |
5986 | 5986 | { |
5987 | - $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'] . 'files/', ''); |
|
5987 | + $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'].'files/', ''); |
|
5988 | 5988 | |
5989 | 5989 | if (stripos($str, '@FILE') !== 0) { |
5990 | 5990 | return $str; |
@@ -6007,7 +6007,7 @@ discard block |
||
6007 | 6007 | $errorMsg = sprintf("Could not retrieve string '%s'.", $str); |
6008 | 6008 | |
6009 | 6009 | foreach ($search_path as $path) { |
6010 | - $file_path = MODX_BASE_PATH . $path . $str; |
|
6010 | + $file_path = MODX_BASE_PATH.$path.$str; |
|
6011 | 6011 | if (strpos($file_path, MODX_MANAGER_PATH) === 0) { |
6012 | 6012 | return $errorMsg; |
6013 | 6013 | } elseif (is_file($file_path)) { |
@@ -6021,7 +6021,7 @@ discard block |
||
6021 | 6021 | return $errorMsg; |
6022 | 6022 | } |
6023 | 6023 | |
6024 | - $content = (string)file_get_contents($file_path); |
|
6024 | + $content = (string) file_get_contents($file_path); |
|
6025 | 6025 | if ($content === false) { |
6026 | 6026 | return $errorMsg; |
6027 | 6027 | } |
@@ -6133,22 +6133,22 @@ discard block |
||
6133 | 6133 | |
6134 | 6134 | $version = isset($GLOBALS['modx_version']) ? $GLOBALS['modx_version'] : ''; |
6135 | 6135 | $release_date = isset($GLOBALS['release_date']) ? $GLOBALS['release_date'] : ''; |
6136 | - $request_uri = "http://" . $_SERVER['HTTP_HOST'] . ($_SERVER["SERVER_PORT"] == 80 ? "" : (":" . $_SERVER["SERVER_PORT"])) . $_SERVER['REQUEST_URI']; |
|
6136 | + $request_uri = "http://".$_SERVER['HTTP_HOST'].($_SERVER["SERVER_PORT"] == 80 ? "" : (":".$_SERVER["SERVER_PORT"])).$_SERVER['REQUEST_URI']; |
|
6137 | 6137 | $request_uri = $this->htmlspecialchars($request_uri, ENT_QUOTES, $this->config['modx_charset']); |
6138 | 6138 | $ua = $this->htmlspecialchars($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, $this->config['modx_charset']); |
6139 | 6139 | $referer = $this->htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_QUOTES, $this->config['modx_charset']); |
6140 | 6140 | if ($is_error) { |
6141 | 6141 | $str = '<h2 style="color:red">« Evo Parse Error »</h2>'; |
6142 | 6142 | if ($msg != 'PHP Parse Error') { |
6143 | - $str .= '<h3 style="color:red">' . $msg . '</h3>'; |
|
6143 | + $str .= '<h3 style="color:red">'.$msg.'</h3>'; |
|
6144 | 6144 | } |
6145 | 6145 | } else { |
6146 | 6146 | $str = '<h2 style="color:#003399">« Evo Debug/ stop message »</h2>'; |
6147 | - $str .= '<h3 style="color:#003399">' . $msg . '</h3>'; |
|
6147 | + $str .= '<h3 style="color:#003399">'.$msg.'</h3>'; |
|
6148 | 6148 | } |
6149 | 6149 | |
6150 | 6150 | if (!empty($query)) { |
6151 | - $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>'; |
|
6151 | + $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>'; |
|
6152 | 6152 | } |
6153 | 6153 | |
6154 | 6154 | $errortype = array( |
@@ -6171,13 +6171,13 @@ discard block |
||
6171 | 6171 | |
6172 | 6172 | if (!empty($nr) || !empty($file)) { |
6173 | 6173 | if ($text != '') { |
6174 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : ' . $text . '</div>'; |
|
6174 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : '.$text.'</div>'; |
|
6175 | 6175 | } |
6176 | 6176 | if ($output != '') { |
6177 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">' . $output . '</div>'; |
|
6177 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">'.$output.'</div>'; |
|
6178 | 6178 | } |
6179 | 6179 | if ($nr !== '') { |
6180 | - $table[] = array('ErrorType[num]', $errortype [$nr] . "[" . $nr . "]"); |
|
6180 | + $table[] = array('ErrorType[num]', $errortype [$nr]."[".$nr."]"); |
|
6181 | 6181 | } |
6182 | 6182 | if ($file) { |
6183 | 6183 | $table[] = array('File', $file); |
@@ -6196,7 +6196,7 @@ discard block |
||
6196 | 6196 | } |
6197 | 6197 | |
6198 | 6198 | if (!empty($this->event->activePlugin)) { |
6199 | - $table[] = array('Current Plugin', $this->event->activePlugin . '(' . $this->event->name . ')'); |
|
6199 | + $table[] = array('Current Plugin', $this->event->activePlugin.'('.$this->event->name.')'); |
|
6200 | 6200 | } |
6201 | 6201 | |
6202 | 6202 | $str .= $MakeTable->create($table, array('Error information', '')); |
@@ -6206,17 +6206,17 @@ discard block |
||
6206 | 6206 | $table[] = array('REQUEST_URI', $request_uri); |
6207 | 6207 | |
6208 | 6208 | if ($this->manager->action) { |
6209 | - include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
6209 | + include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php'); |
|
6210 | 6210 | global $action_list; |
6211 | 6211 | $actionName = (isset($action_list[$this->manager->action])) ? " - {$action_list[$this->manager->action]}" : ''; |
6212 | 6212 | |
6213 | - $table[] = array('Manager action', $this->manager->action . $actionName); |
|
6213 | + $table[] = array('Manager action', $this->manager->action.$actionName); |
|
6214 | 6214 | } |
6215 | 6215 | |
6216 | 6216 | if (preg_match('@^[0-9]+@', $this->documentIdentifier)) { |
6217 | 6217 | $resource = $this->getDocumentObject('id', $this->documentIdentifier); |
6218 | 6218 | $url = $this->makeUrl($this->documentIdentifier, '', '', 'full'); |
6219 | - $table[] = array('Resource', '[' . $this->documentIdentifier . '] <a href="' . $url . '" target="_blank">' . $resource['pagetitle'] . '</a>'); |
|
6219 | + $table[] = array('Resource', '['.$this->documentIdentifier.'] <a href="'.$url.'" target="_blank">'.$resource['pagetitle'].'</a>'); |
|
6220 | 6220 | } |
6221 | 6221 | $table[] = array('Referer', $referer); |
6222 | 6222 | $table[] = array('User Agent', $ua); |
@@ -6237,7 +6237,7 @@ discard block |
||
6237 | 6237 | |
6238 | 6238 | $mem = memory_get_peak_usage(true); |
6239 | 6239 | $total_mem = $mem - $this->mstart; |
6240 | - $total_mem = ($total_mem / 1024 / 1024) . ' mb'; |
|
6240 | + $total_mem = ($total_mem / 1024 / 1024).' mb'; |
|
6241 | 6241 | |
6242 | 6242 | $queryTime = $this->queryTime; |
6243 | 6243 | $phpTime = $totalTime - $queryTime; |
@@ -6258,18 +6258,18 @@ discard block |
||
6258 | 6258 | $str .= $this->get_backtrace(debug_backtrace()); |
6259 | 6259 | // Log error |
6260 | 6260 | if (!empty($this->currentSnippet)) { |
6261 | - $source = 'Snippet - ' . $this->currentSnippet; |
|
6261 | + $source = 'Snippet - '.$this->currentSnippet; |
|
6262 | 6262 | } elseif (!empty($this->event->activePlugin)) { |
6263 | - $source = 'Plugin - ' . $this->event->activePlugin; |
|
6263 | + $source = 'Plugin - '.$this->event->activePlugin; |
|
6264 | 6264 | } elseif ($source !== '') { |
6265 | - $source = 'Parser - ' . $source; |
|
6265 | + $source = 'Parser - '.$source; |
|
6266 | 6266 | } elseif ($query !== '') { |
6267 | 6267 | $source = 'SQL Query'; |
6268 | 6268 | } else { |
6269 | 6269 | $source = 'Parser'; |
6270 | 6270 | } |
6271 | 6271 | if ($msg) { |
6272 | - $source .= ' / ' . $msg; |
|
6272 | + $source .= ' / '.$msg; |
|
6273 | 6273 | } |
6274 | 6274 | if (isset($actionName) && !empty($actionName)) { |
6275 | 6275 | $source .= $actionName; |
@@ -6301,12 +6301,12 @@ discard block |
||
6301 | 6301 | |
6302 | 6302 | // Display error |
6303 | 6303 | if (isset($_SESSION['mgrValidated'])) { |
6304 | - 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> |
|
6304 | + 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> |
|
6305 | 6305 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
6306 | - <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'] . 'media/style/' . $this->config['manager_theme'] . '/style.css" /> |
|
6306 | + <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'].'media/style/'.$this->config['manager_theme'].'/style.css" /> |
|
6307 | 6307 | <style type="text/css">body { padding:10px; } td {font:inherit;}</style> |
6308 | 6308 | </head><body> |
6309 | - ' . $str . '</body></html>'; |
|
6309 | + ' . $str.'</body></html>'; |
|
6310 | 6310 | } else { |
6311 | 6311 | echo 'Error'; |
6312 | 6312 | } |
@@ -6343,7 +6343,7 @@ discard block |
||
6343 | 6343 | switch ($val['type']) { |
6344 | 6344 | case '->': |
6345 | 6345 | case '::': |
6346 | - $functionName = $val['function'] = $val['class'] . $val['type'] . $val['function']; |
|
6346 | + $functionName = $val['function'] = $val['class'].$val['type'].$val['function']; |
|
6347 | 6347 | break; |
6348 | 6348 | default: |
6349 | 6349 | $functionName = $val['function']; |
@@ -6353,7 +6353,7 @@ discard block |
||
6353 | 6353 | $args = array_pad(array(), $_, '$var'); |
6354 | 6354 | $args = implode(", ", $args); |
6355 | 6355 | $modx = &$this; |
6356 | - $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) { |
|
6356 | + $args = preg_replace_callback('/\$var/', function() use ($modx, &$tmp, $val) { |
|
6357 | 6357 | $arg = $val['args'][$tmp - 1]; |
6358 | 6358 | switch (true) { |
6359 | 6359 | case is_null($arg): { |
@@ -6365,7 +6365,7 @@ discard block |
||
6365 | 6365 | break; |
6366 | 6366 | } |
6367 | 6367 | case is_scalar($arg): { |
6368 | - $out = strlen($arg) > 20 ? 'string $var' . $tmp : ("'" . $this->htmlspecialchars(str_replace("'", "\\'", $arg)) . "'"); |
|
6368 | + $out = strlen($arg) > 20 ? 'string $var'.$tmp : ("'".$this->htmlspecialchars(str_replace("'", "\\'", $arg))."'"); |
|
6369 | 6369 | break; |
6370 | 6370 | } |
6371 | 6371 | case is_bool($arg): { |
@@ -6373,23 +6373,23 @@ discard block |
||
6373 | 6373 | break; |
6374 | 6374 | } |
6375 | 6375 | case is_array($arg): { |
6376 | - $out = 'array $var' . $tmp; |
|
6376 | + $out = 'array $var'.$tmp; |
|
6377 | 6377 | break; |
6378 | 6378 | } |
6379 | 6379 | case is_object($arg): { |
6380 | - $out = get_class($arg) . ' $var' . $tmp; |
|
6380 | + $out = get_class($arg).' $var'.$tmp; |
|
6381 | 6381 | break; |
6382 | 6382 | } |
6383 | 6383 | default: { |
6384 | - $out = '$var' . $tmp; |
|
6384 | + $out = '$var'.$tmp; |
|
6385 | 6385 | } |
6386 | 6386 | } |
6387 | 6387 | $tmp++; |
6388 | 6388 | return $out; |
6389 | 6389 | }, $args); |
6390 | 6390 | $line = array( |
6391 | - "<strong>" . $functionName . "</strong>(" . $args . ")", |
|
6392 | - $path . " on line " . $val['line'] |
|
6391 | + "<strong>".$functionName."</strong>(".$args.")", |
|
6392 | + $path." on line ".$val['line'] |
|
6393 | 6393 | ); |
6394 | 6394 | $table[] = array(implode("<br />", $line)); |
6395 | 6395 | } |
@@ -6430,7 +6430,7 @@ discard block |
||
6430 | 6430 | $alias = strip_tags($alias); // strip HTML |
6431 | 6431 | $alias = preg_replace('/[^\.A-Za-z0-9 _-]/', '', $alias); // strip non-alphanumeric characters |
6432 | 6432 | $alias = preg_replace('/\s+/', '-', $alias); // convert white-space to dash |
6433 | - $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one |
|
6433 | + $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one |
|
6434 | 6434 | $alias = trim($alias, '-'); // trim excess |
6435 | 6435 | return $alias; |
6436 | 6436 | } |
@@ -6446,7 +6446,7 @@ discard block |
||
6446 | 6446 | $precisions = count($sizes) - 1; |
6447 | 6447 | foreach ($sizes as $unit => $bytes) { |
6448 | 6448 | if ($size >= $bytes) { |
6449 | - return number_format($size / $bytes, $precisions) . ' ' . $unit; |
|
6449 | + return number_format($size / $bytes, $precisions).' '.$unit; |
|
6450 | 6450 | } |
6451 | 6451 | $precisions--; |
6452 | 6452 | } |
@@ -6550,10 +6550,10 @@ discard block |
||
6550 | 6550 | |
6551 | 6551 | if (strpos($str, MODX_MANAGER_PATH) === 0) { |
6552 | 6552 | return false; |
6553 | - } elseif (is_file(MODX_BASE_PATH . $str)) { |
|
6554 | - $file_path = MODX_BASE_PATH . $str; |
|
6555 | - } elseif (is_file(MODX_BASE_PATH . "{$tpl_dir}{$str}")) { |
|
6556 | - $file_path = MODX_BASE_PATH . $tpl_dir . $str; |
|
6553 | + } elseif (is_file(MODX_BASE_PATH.$str)) { |
|
6554 | + $file_path = MODX_BASE_PATH.$str; |
|
6555 | + } elseif (is_file(MODX_BASE_PATH."{$tpl_dir}{$str}")) { |
|
6556 | + $file_path = MODX_BASE_PATH.$tpl_dir.$str; |
|
6557 | 6557 | } else { |
6558 | 6558 | return false; |
6559 | 6559 | } |
@@ -6679,7 +6679,7 @@ discard block |
||
6679 | 6679 | $title = 'no title'; |
6680 | 6680 | } |
6681 | 6681 | if (is_array($msg)) { |
6682 | - $msg = '<pre>' . print_r($msg, true) . '</pre>'; |
|
6682 | + $msg = '<pre>'.print_r($msg, true).'</pre>'; |
|
6683 | 6683 | } elseif ($msg === '') { |
6684 | 6684 | $msg = $_SERVER['REQUEST_URI']; |
6685 | 6685 | } |
@@ -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, |