@@ -81,14 +81,14 @@ discard block |
||
81 | 81 | |
82 | 82 | if (strpos($feed_id, "CAT:") === 0) { |
83 | 83 | $cat_id = (int) substr($feed_id, 4); |
84 | - array_push($scope_inner_qparts, "cat_id = " . $this->pdo->quote($cat_id)); |
|
84 | + array_push($scope_inner_qparts, "cat_id = ".$this->pdo->quote($cat_id)); |
|
85 | 85 | } else if ($feed_id > 0) { |
86 | - array_push($scope_inner_qparts, "feed_id = " . $this->pdo->quote($feed_id)); |
|
86 | + array_push($scope_inner_qparts, "feed_id = ".$this->pdo->quote($feed_id)); |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | |
90 | 90 | if (count($scope_inner_qparts) > 0) { |
91 | - array_push($scope_qparts, "(" . implode(" OR ", $scope_inner_qparts) . ")"); |
|
91 | + array_push($scope_qparts, "(".implode(" OR ", $scope_inner_qparts).")"); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | array_push($filter["rules"], $rule); |
@@ -206,11 +206,11 @@ discard block |
||
206 | 206 | foreach ($feeds as $feed_id) { |
207 | 207 | |
208 | 208 | if (strpos($feed_id, "CAT:") === 0) { |
209 | - $feed_id = (int)substr($feed_id, 4); |
|
209 | + $feed_id = (int) substr($feed_id, 4); |
|
210 | 210 | array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id)); |
211 | 211 | } else { |
212 | 212 | if ($feed_id) |
213 | - array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
213 | + array_push($feeds_fmt, Feeds::getFeedTitle((int) $feed_id)); |
|
214 | 214 | else |
215 | 215 | array_push($feeds_fmt, __("All feeds")); |
216 | 216 | } |
@@ -221,8 +221,7 @@ discard block |
||
221 | 221 | } else { |
222 | 222 | |
223 | 223 | $where = $line["cat_filter"] ? |
224 | - Feeds::getCategoryTitle($line["cat_id"]) : |
|
225 | - ($line["feed_id"] ? |
|
224 | + Feeds::getCategoryTitle($line["cat_id"]) : ($line["feed_id"] ? |
|
226 | 225 | Feeds::getFeedTitle($line["feed_id"]) : __("All feeds")); |
227 | 226 | } |
228 | 227 | |
@@ -537,11 +536,11 @@ discard block |
||
537 | 536 | foreach ($feeds as $feed_id) { |
538 | 537 | |
539 | 538 | if (strpos($feed_id, "CAT:") === 0) { |
540 | - $feed_id = (int)substr($feed_id, 4); |
|
539 | + $feed_id = (int) substr($feed_id, 4); |
|
541 | 540 | array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id)); |
542 | 541 | } else { |
543 | 542 | if ($feed_id) |
544 | - array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
543 | + array_push($feeds_fmt, Feeds::getFeedTitle((int) $feed_id)); |
|
545 | 544 | else |
546 | 545 | array_push($feeds_fmt, __("All feeds")); |
547 | 546 | } |
@@ -99,12 +99,16 @@ discard block |
||
99 | 99 | } |
100 | 100 | } |
101 | 101 | |
102 | - if (count($scope_qparts) == 0) $scope_qparts = ["true"]; |
|
102 | + if (count($scope_qparts) == 0) { |
|
103 | + $scope_qparts = ["true"]; |
|
104 | + } |
|
103 | 105 | |
104 | 106 | $glue = $filter['match_any_rule'] ? " OR " : " AND "; |
105 | 107 | $scope_qpart = join($glue, $scope_qparts); |
106 | 108 | |
107 | - if (!$scope_qpart) $scope_qpart = "true"; |
|
109 | + if (!$scope_qpart) { |
|
110 | + $scope_qpart = "true"; |
|
111 | + } |
|
108 | 112 | |
109 | 113 | $rv = array(); |
110 | 114 | |
@@ -209,10 +213,11 @@ discard block |
||
209 | 213 | $feed_id = (int)substr($feed_id, 4); |
210 | 214 | array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id)); |
211 | 215 | } else { |
212 | - if ($feed_id) |
|
213 | - array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
214 | - else |
|
215 | - array_push($feeds_fmt, __("All feeds")); |
|
216 | + if ($feed_id) { |
|
217 | + array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
218 | + } else { |
|
219 | + array_push($feeds_fmt, __("All feeds")); |
|
220 | + } |
|
216 | 221 | } |
217 | 222 | } |
218 | 223 | |
@@ -540,10 +545,11 @@ discard block |
||
540 | 545 | $feed_id = (int)substr($feed_id, 4); |
541 | 546 | array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id)); |
542 | 547 | } else { |
543 | - if ($feed_id) |
|
544 | - array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
545 | - else |
|
546 | - array_push($feeds_fmt, __("All feeds")); |
|
548 | + if ($feed_id) { |
|
549 | + array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); |
|
550 | + } else { |
|
551 | + array_push($feeds_fmt, __("All feeds")); |
|
552 | + } |
|
547 | 553 | } |
548 | 554 | } |
549 | 555 | |
@@ -582,8 +588,9 @@ discard block |
||
582 | 588 | $title = __($row["description"]); |
583 | 589 | |
584 | 590 | if ($action["action_id"] == 4 || $action["action_id"] == 6 || |
585 | - $action["action_id"] == 7) |
|
586 | - $title .= ": ".$action["action_param"]; |
|
591 | + $action["action_id"] == 7) { |
|
592 | + $title .= ": ".$action["action_param"]; |
|
593 | + } |
|
587 | 594 | |
588 | 595 | if ($action["action_id"] == 9) { |
589 | 596 | list ($pfclass, $pfaction) = explode(":", $action["action_param"]); |
@@ -1168,11 +1175,16 @@ discard block |
||
1168 | 1175 | $num_actions -= 1; |
1169 | 1176 | } |
1170 | 1177 | |
1171 | - if ($match_any_rule) $title .= " (".__("matches any rule").")"; |
|
1172 | - if ($inverse) $title .= " (".__("inverse").")"; |
|
1178 | + if ($match_any_rule) { |
|
1179 | + $title .= " (".__("matches any rule").")"; |
|
1180 | + } |
|
1181 | + if ($inverse) { |
|
1182 | + $title .= " (".__("inverse").")"; |
|
1183 | + } |
|
1173 | 1184 | |
1174 | - if ($num_actions > 0) |
|
1175 | - $actions = sprintf(_ngettext("%s (+%d action)", "%s (+%d actions)", (int) $num_actions), $actions, $num_actions); |
|
1185 | + if ($num_actions > 0) { |
|
1186 | + $actions = sprintf(_ngettext("%s (+%d action)", "%s (+%d actions)", (int) $num_actions), $actions, $num_actions); |
|
1187 | + } |
|
1176 | 1188 | |
1177 | 1189 | return [$title, $actions]; |
1178 | 1190 | } |
@@ -52,14 +52,14 @@ |
||
52 | 52 | |
53 | 53 | public function __construct() { |
54 | 54 | switch (LOG_DESTINATION) { |
55 | - case "sql": |
|
56 | - $this->adapter = new Logger_SQL(); |
|
57 | - break; |
|
58 | - case "syslog": |
|
59 | - $this->adapter = new Logger_Syslog(); |
|
60 | - break; |
|
61 | - default: |
|
62 | - $this->adapter = false; |
|
55 | + case "sql": |
|
56 | + $this->adapter = new Logger_SQL(); |
|
57 | + break; |
|
58 | + case "syslog": |
|
59 | + $this->adapter = new Logger_Syslog(); |
|
60 | + break; |
|
61 | + default: |
|
62 | + $this->adapter = false; |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 |
@@ -108,7 +108,7 @@ |
||
108 | 108 | $tags[$line["tag_name"]] = $line["count"]; |
109 | 109 | } |
110 | 110 | |
111 | - if(count($tags) == 0 ){ return; } |
|
111 | + if (count($tags) == 0) { return; } |
|
112 | 112 | |
113 | 113 | ksort($tags); |
114 | 114 |
@@ -24,8 +24,9 @@ |
||
24 | 24 | ]; |
25 | 25 | |
26 | 26 | foreach ($server_params as $n => $p) { |
27 | - if (isset($_SERVER[$p])) |
|
28 | - $context .= "\n$n: ".$_SERVER[$p]; |
|
27 | + if (isset($_SERVER[$p])) { |
|
28 | + $context .= "\n$n: ".$_SERVER[$p]; |
|
29 | + } |
|
29 | 30 | } |
30 | 31 | |
31 | 32 | // passed error message may contain invalid unicode characters, failing to insert an error here |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | if ($cur_section) { |
46 | 46 | print "<li> </li>"; |
47 | 47 | } |
48 | - print "<li><h3>" . $section . "</h3></li>"; |
|
48 | + print "<li><h3>".$section."</h3></li>"; |
|
49 | 49 | $cur_section = $section; |
50 | 50 | |
51 | 51 | foreach ($hotkeys as $action => $description) { |
@@ -65,10 +65,10 @@ discard block |
||
65 | 65 | foreach (str_split($keys[$i]) as $c) { |
66 | 66 | switch ($c) { |
67 | 67 | case '*': |
68 | - $tmp .= __('Shift') . '+'; |
|
68 | + $tmp .= __('Shift').'+'; |
|
69 | 69 | break; |
70 | 70 | case '^': |
71 | - $tmp .= __('Ctrl') . '+'; |
|
71 | + $tmp .= __('Ctrl').'+'; |
|
72 | 72 | break; |
73 | 73 | default: |
74 | 74 | $tmp .= $c; |
@@ -176,12 +176,16 @@ |
||
176 | 176 | |
177 | 177 | } |
178 | 178 | |
179 | - if (!$tr_in_progress) $pdo->commit(); |
|
179 | + if (!$tr_in_progress) { |
|
180 | + $pdo->commit(); |
|
181 | + } |
|
180 | 182 | } |
181 | 183 | |
182 | 184 | public static function create($caption, $fg_color = '', $bg_color = '', $owner_uid = false) { |
183 | 185 | |
184 | - if (!$owner_uid) $owner_uid = $_SESSION['uid']; |
|
186 | + if (!$owner_uid) { |
|
187 | + $owner_uid = $_SESSION['uid']; |
|
188 | + } |
|
185 | 189 | |
186 | 190 | $pdo = Db::pdo(); |
187 | 191 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | $ts = strftime("%H:%M:%S", time()); |
42 | 42 | if (function_exists('posix_getpid')) { |
43 | - $ts = "$ts/" . posix_getpid(); |
|
43 | + $ts = "$ts/".posix_getpid(); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | if (Debug::$logfile) { |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | if (!$locked) { |
62 | 62 | fclose($fp); |
63 | - user_error("Unable to lock debugging log file: " . Debug::$logfile, E_USER_WARNING); |
|
63 | + user_error("Unable to lock debugging log file: ".Debug::$logfile, E_USER_WARNING); |
|
64 | 64 | return; |
65 | 65 | } |
66 | 66 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | return; |
78 | 78 | |
79 | 79 | } else { |
80 | - user_error("Unable to open debugging log file: " . Debug::$logfile, E_USER_WARNING); |
|
80 | + user_error("Unable to open debugging log file: ".Debug::$logfile, E_USER_WARNING); |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 |
@@ -36,7 +36,9 @@ discard block |
||
36 | 36 | |
37 | 37 | public static function log($message, $level = 0) { |
38 | 38 | |
39 | - if (!Debug::$enabled || Debug::$loglevel < $level) return false; |
|
39 | + if (!Debug::$enabled || Debug::$loglevel < $level) { |
|
40 | + return false; |
|
41 | + } |
|
40 | 42 | |
41 | 43 | $ts = strftime("%H:%M:%S", time()); |
42 | 44 | if (function_exists('posix_getpid')) { |
@@ -73,8 +75,9 @@ discard block |
||
73 | 75 | |
74 | 76 | fclose($fp); |
75 | 77 | |
76 | - if (Debug::$quiet) |
|
77 | - return; |
|
78 | + if (Debug::$quiet) { |
|
79 | + return; |
|
80 | + } |
|
78 | 81 | |
79 | 82 | } else { |
80 | 83 | user_error("Unable to open debugging log file: " . Debug::$logfile, E_USER_WARNING); |
@@ -186,8 +186,9 @@ |
||
186 | 186 | $cat = clean(trim(mb_strtolower($srccat))); |
187 | 187 | |
188 | 188 | // we don't support numeric tags |
189 | - if (is_numeric($cat)) |
|
190 | - $cat = 't:'.$cat; |
|
189 | + if (is_numeric($cat)) { |
|
190 | + $cat = 't:'.$cat; |
|
191 | + } |
|
191 | 192 | |
192 | 193 | $cat = preg_replace('/[,\'\"]/', "", $cat); |
193 | 194 |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | foreach (json_decode($tmp_line["match_on"], true) as $feed_id) { |
222 | 222 | |
223 | 223 | if (strpos($feed_id, "CAT:") === 0) { |
224 | - $feed_id = (int)substr($feed_id, 4); |
|
224 | + $feed_id = (int) substr($feed_id, 4); |
|
225 | 225 | if ($feed_id) { |
226 | 226 | array_push($match, [Feeds::getCategoryTitle($feed_id), true, false]); |
227 | 227 | } else { |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | } |
230 | 230 | } else { |
231 | 231 | if ($feed_id) { |
232 | - array_push($match, [Feeds::getFeedTitle((int)$feed_id), false, false]); |
|
232 | + array_push($match, [Feeds::getFeedTitle((int) $feed_id), false, false]); |
|
233 | 233 | } else { |
234 | 234 | array_push($match, [0, false, true]); |
235 | 235 | } |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | list ($name, $is_cat, $is_id) = $match; |
430 | 430 | |
431 | 431 | if ($is_id) { |
432 | - array_push($match_on, ($is_cat ? "CAT:" : "") . $name); |
|
432 | + array_push($match_on, ($is_cat ? "CAT:" : "").$name); |
|
433 | 433 | } else { |
434 | 434 | |
435 | 435 | if (!$is_cat) { |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | } |
459 | 459 | |
460 | 460 | $reg_exp = $rule["reg_exp"]; |
461 | - $filter_type = (int)$rule["filter_type"]; |
|
461 | + $filter_type = (int) $rule["filter_type"]; |
|
462 | 462 | $inverse = bool_to_sql_bool($rule["inverse"]); |
463 | 463 | $match_on = json_encode($match_on); |
464 | 464 | |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | |
493 | 493 | $cat_filter = bool_to_sql_bool($rule["cat_filter"]); |
494 | 494 | $reg_exp = $rule["reg_exp"]; |
495 | - $filter_type = (int)$rule["filter_type"]; |
|
495 | + $filter_type = (int) $rule["filter_type"]; |
|
496 | 496 | $inverse = bool_to_sql_bool($rule["inverse"]); |
497 | 497 | |
498 | 498 | $usth = $this->pdo->prepare("INSERT INTO ttrss_filters2_rules |