@@ -308,20 +308,25 @@ discard block |
||
308 | 308 | $resumeFromStart = false; |
309 | 309 | $p = 0; |
310 | 310 | $cmd = ''; |
311 | - if (!$this->parseWord($cmdL, $p, $cmd)) return true; |
|
311 | + if (!$this->parseWord($cmdL, $p, $cmd)) { |
|
312 | + return true; |
|
313 | + } |
|
312 | 314 | $parms = substr($cmdL, $p); |
313 | 315 | switch (strtoupper($cmd)) { |
314 | 316 | case '$BEGINBLOCK': |
315 | - if (!$this->processBeginBlockCmd($parms, $cmdTPosBegin, $cmdTPosEnd)) |
|
316 | - return false; |
|
317 | + if (!$this->processBeginBlockCmd($parms, $cmdTPosBegin, $cmdTPosEnd)) { |
|
318 | + return false; |
|
319 | + } |
|
317 | 320 | break; |
318 | 321 | case '$ENDBLOCK': |
319 | - if (!$this->processEndBlockCmd($parms, $cmdTPosBegin, $cmdTPosEnd)) |
|
320 | - return false; |
|
322 | + if (!$this->processEndBlockCmd($parms, $cmdTPosBegin, $cmdTPosEnd)) { |
|
323 | + return false; |
|
324 | + } |
|
321 | 325 | break; |
322 | 326 | case '$INCLUDE': |
323 | - if (!$this->processincludeCmd($parms, $cmdTPosBegin, $cmdTPosEnd)) |
|
324 | - return false; |
|
327 | + if (!$this->processincludeCmd($parms, $cmdTPosBegin, $cmdTPosEnd)) { |
|
328 | + return false; |
|
329 | + } |
|
325 | 330 | $resumeFromStart = true; |
326 | 331 | break; |
327 | 332 | default: |
@@ -807,15 +812,17 @@ discard block |
||
807 | 812 | if ($subBtr['tPosBegin'] < $tPos2) { |
808 | 813 | $tPos2 = $subBtr['tPosBegin']; |
809 | 814 | $kind = 2; }} |
810 | - if ($tPos2 > $tPos) |
|
811 | - $this->writeString(substr($this->template, $tPos, $tPos2 - $tPos)); |
|
815 | + if ($tPos2 > $tPos) { |
|
816 | + $this->writeString(substr($this->template, $tPos, $tPos2 - $tPos)); |
|
817 | + } |
|
812 | 818 | switch ($kind) { |
813 | 819 | case 0: // end of block |
814 | 820 | return; |
815 | 821 | case 1: // variable |
816 | 822 | $vrtr = & $this->varRefTab[$varRefNo]; |
817 | - if ($vrtr['blockNo'] != $blockNo) |
|
818 | - $this->programLogicError(4); |
|
823 | + if ($vrtr['blockNo'] != $blockNo) { |
|
824 | + $this->programLogicError(4); |
|
825 | + } |
|
819 | 826 | $variableValue = $bitr['blockVarTab'][$vrtr['blockVarNo']]; |
820 | 827 | $this->writeString($variableValue); |
821 | 828 | $tPos = $vrtr['tPosEnd']; |
@@ -823,8 +830,9 @@ discard block |
||
823 | 830 | break; |
824 | 831 | case 2: // sub block |
825 | 832 | $subBtr = & $this->blockTab[$subBlockNo]; |
826 | - if ($subBtr['parentBlockNo'] != $blockNo) |
|
827 | - $this->programLogicError(3); |
|
833 | + if ($subBtr['parentBlockNo'] != $blockNo) { |
|
834 | + $this->programLogicError(3); |
|
835 | + } |
|
828 | 836 | $this->writeBlockInstances($subBlockNo, $bitr['instanceLevel']); // recursive call |
829 | 837 | $tPos = $subBtr['tPosEnd']; |
830 | 838 | $subBlockNo += 1; |
@@ -834,15 +842,20 @@ discard block |
||
834 | 842 | * @access private |
835 | 843 | */ |
836 | 844 | function writeString($s) { |
837 | - if ($this->outputError) return; |
|
845 | + if ($this->outputError) { |
|
846 | + return; |
|
847 | + } |
|
838 | 848 | switch ($this->outputMode) { |
839 | 849 | case 0: // output to PHP output stream |
840 | - if (!print($s)) |
|
841 | - $this->outputError = true; |
|
850 | + if (!print($s)) { |
|
851 | + $this->outputError = true; |
|
852 | + } |
|
842 | 853 | break; |
843 | 854 | case 1: // output to file |
844 | 855 | $rc = fwrite($this->outputFileHandle, $s); |
845 | - if ($rc === false) $this->outputError = true; |
|
856 | + if ($rc === false) { |
|
857 | + $this->outputError = true; |
|
858 | + } |
|
846 | 859 | break; |
847 | 860 | case 2: // output to string |
848 | 861 | $this->outputString .= $s; |
@@ -2286,56 +2286,68 @@ |
||
2286 | 2286 | break; |
2287 | 2287 | case "note": |
2288 | 2288 | if ($commandpair[1]) { |
2289 | - if ($commandpair[1] == "true") |
|
2290 | - array_push($query_keywords, "($not (note IS NOT NULL AND note != ''))"); |
|
2291 | - else if ($commandpair[1] == "false") |
|
2292 | - array_push($query_keywords, "($not (note IS NULL OR note = ''))"); |
|
2293 | - else |
|
2294 | - array_push($query_keywords, "($not (LOWER(note) LIKE ". |
|
2289 | + if ($commandpair[1] == "true") { |
|
2290 | + array_push($query_keywords, "($not (note IS NOT NULL AND note != ''))"); |
|
2291 | + } else if ($commandpair[1] == "false") { |
|
2292 | + array_push($query_keywords, "($not (note IS NULL OR note = ''))"); |
|
2293 | + } else { |
|
2294 | + array_push($query_keywords, "($not (LOWER(note) LIKE ". |
|
2295 | 2295 | $pdo->quote('%'.mb_strtolower($commandpair[1]).'%')."))"); |
2296 | + } |
|
2296 | 2297 | } else { |
2297 | 2298 | array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
2298 | 2299 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2299 | - if (!$not) array_push($search_words, $k); |
|
2300 | + if (!$not) { |
|
2301 | + array_push($search_words, $k); |
|
2302 | + } |
|
2300 | 2303 | } |
2301 | 2304 | break; |
2302 | 2305 | case "star": |
2303 | 2306 | |
2304 | 2307 | if ($commandpair[1]) { |
2305 | - if ($commandpair[1] == "true") |
|
2306 | - array_push($query_keywords, "($not (marked = true))"); |
|
2307 | - else |
|
2308 | - array_push($query_keywords, "($not (marked = false))"); |
|
2308 | + if ($commandpair[1] == "true") { |
|
2309 | + array_push($query_keywords, "($not (marked = true))"); |
|
2310 | + } else { |
|
2311 | + array_push($query_keywords, "($not (marked = false))"); |
|
2312 | + } |
|
2309 | 2313 | } else { |
2310 | 2314 | array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
2311 | 2315 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2312 | - if (!$not) array_push($search_words, $k); |
|
2316 | + if (!$not) { |
|
2317 | + array_push($search_words, $k); |
|
2318 | + } |
|
2313 | 2319 | } |
2314 | 2320 | break; |
2315 | 2321 | case "pub": |
2316 | 2322 | if ($commandpair[1]) { |
2317 | - if ($commandpair[1] == "true") |
|
2318 | - array_push($query_keywords, "($not (published = true))"); |
|
2319 | - else |
|
2320 | - array_push($query_keywords, "($not (published = false))"); |
|
2323 | + if ($commandpair[1] == "true") { |
|
2324 | + array_push($query_keywords, "($not (published = true))"); |
|
2325 | + } else { |
|
2326 | + array_push($query_keywords, "($not (published = false))"); |
|
2327 | + } |
|
2321 | 2328 | |
2322 | 2329 | } else { |
2323 | 2330 | array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') |
2324 | 2331 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2325 | - if (!$not) array_push($search_words, $k); |
|
2332 | + if (!$not) { |
|
2333 | + array_push($search_words, $k); |
|
2334 | + } |
|
2326 | 2335 | } |
2327 | 2336 | break; |
2328 | 2337 | case "unread": |
2329 | 2338 | if ($commandpair[1]) { |
2330 | - if ($commandpair[1] == "true") |
|
2331 | - array_push($query_keywords, "($not (unread = true))"); |
|
2332 | - else |
|
2333 | - array_push($query_keywords, "($not (unread = false))"); |
|
2339 | + if ($commandpair[1] == "true") { |
|
2340 | + array_push($query_keywords, "($not (unread = true))"); |
|
2341 | + } else { |
|
2342 | + array_push($query_keywords, "($not (unread = false))"); |
|
2343 | + } |
|
2334 | 2344 | |
2335 | 2345 | } else { |
2336 | 2346 | array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
2337 | 2347 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2338 | - if (!$not) array_push($search_words, $k); |
|
2348 | + if (!$not) { |
|
2349 | + array_push($search_words, $k); |
|
2350 | + } |
|
2339 | 2351 | } |
2340 | 2352 | break; |
2341 | 2353 | default: |
@@ -1043,8 +1043,9 @@ discard block |
||
1043 | 1043 | { |
1044 | 1044 | case SPH_FILTER_VALUES: |
1045 | 1045 | $req .= pack("N", count($filter["values"])); |
1046 | - foreach ($filter["values"] as $value) |
|
1047 | - $req .= sphPackI64($value); |
|
1046 | + foreach ($filter["values"] as $value) { |
|
1047 | + $req .= sphPackI64($value); |
|
1048 | + } |
|
1048 | 1049 | break; |
1049 | 1050 | |
1050 | 1051 | case SPH_FILTER_RANGE: |
@@ -1652,8 +1653,9 @@ discard block |
||
1652 | 1653 | { |
1653 | 1654 | $req .= pack("N", $mva ? count($v) : $v); |
1654 | 1655 | if ($mva) { |
1655 | - foreach ($v as $vv) |
|
1656 | - $req .= pack("N", $vv); |
|
1656 | + foreach ($v as $vv) { |
|
1657 | + $req .= pack("N", $vv); |
|
1658 | + } |
|
1657 | 1659 | } |
1658 | 1660 | } |
1659 | 1661 | } |
@@ -498,7 +498,8 @@ |
||
498 | 498 | PluginHost::getInstance()->run_commands($options); |
499 | 499 | |
500 | 500 | if (file_exists(LOCK_DIRECTORY."/$lock_filename")) { |
501 | - if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') |
|
502 | - fclose($lock_handle); |
|
501 | + if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { |
|
502 | + fclose($lock_handle); |
|
503 | + } |
|
503 | 504 | } |
504 | 505 | unlink(LOCK_DIRECTORY."/$lock_filename"); |