@@ -26,7 +26,9 @@ |
||
26 | 26 | require_once "config.php"; |
27 | 27 | require_once "db-prefs.php"; |
28 | 28 | |
29 | - if (!init_plugins()) return; |
|
29 | + if (!init_plugins()) { |
|
30 | + return; |
|
31 | + } |
|
30 | 32 | |
31 | 33 | login_sequence(); |
32 | 34 |
@@ -11,7 +11,9 @@ discard block |
||
11 | 11 | $_SESSION["profile"] = (int) clean($_REQUEST["id"]); |
12 | 12 | |
13 | 13 | // default value |
14 | - if (!$_SESSION["profile"]) $_SESSION["profile"] = null; |
|
14 | + if (!$_SESSION["profile"]) { |
|
15 | + $_SESSION["profile"] = null; |
|
16 | + } |
|
15 | 17 | } |
16 | 18 | |
17 | 19 | public function remprofiles() { |
@@ -173,7 +175,9 @@ discard block |
||
173 | 175 | if ($row = $sth->fetch()) { |
174 | 176 | $feed_id = $row["id"]; |
175 | 177 | } else { |
176 | - if (!$title) $title = '[Unknown]'; |
|
178 | + if (!$title) { |
|
179 | + $title = '[Unknown]'; |
|
180 | + } |
|
177 | 181 | |
178 | 182 | $sth = $this->pdo->prepare("INSERT INTO ttrss_feeds |
179 | 183 | (owner_uid,feed_url,site_url,title,cat_id,auth_login,auth_pass,update_method) |
@@ -216,7 +220,9 @@ discard block |
||
216 | 220 | private function archive_article($id, $owner_uid) { |
217 | 221 | $this->pdo->beginTransaction(); |
218 | 222 | |
219 | - if (!$owner_uid) $owner_uid = $_SESSION['uid']; |
|
223 | + if (!$owner_uid) { |
|
224 | + $owner_uid = $_SESSION['uid']; |
|
225 | + } |
|
220 | 226 | |
221 | 227 | $sth = $this->pdo->prepare("SELECT feed_id FROM ttrss_user_entries |
222 | 228 | WHERE ref_id = ? AND owner_uid = ?"); |
@@ -278,8 +284,9 @@ discard block |
||
278 | 284 | 'seq' => $seq |
279 | 285 | ]; |
280 | 286 | |
281 | - if ($seq % 2 == 0) |
|
282 | - $reply['runtime-info'] = make_runtime_info(); |
|
287 | + if ($seq % 2 == 0) { |
|
288 | + $reply['runtime-info'] = make_runtime_info(); |
|
289 | + } |
|
283 | 290 | |
284 | 291 | print json_encode($reply); |
285 | 292 | } |
@@ -353,7 +360,9 @@ discard block |
||
353 | 360 | $payload = json_decode(clean($_REQUEST["payload"]), false); |
354 | 361 | $mode = clean($_REQUEST["mode"]); |
355 | 362 | |
356 | - if (!$payload || !is_array($payload)) return; |
|
363 | + if (!$payload || !is_array($payload)) { |
|
364 | + return; |
|
365 | + } |
|
357 | 366 | |
358 | 367 | if ($mode == 1) { |
359 | 368 | foreach ($payload as $feed) { |
@@ -57,7 +57,9 @@ discard block |
||
57 | 57 | $password = clean($_REQUEST["password"]); |
58 | 58 | $password_base64 = base64_decode(clean($_REQUEST["password"])); |
59 | 59 | |
60 | - if (SINGLE_USER_MODE) $login = "admin"; |
|
60 | + if (SINGLE_USER_MODE) { |
|
61 | + $login = "admin"; |
|
62 | + } |
|
61 | 63 | |
62 | 64 | $sth = $this->pdo->prepare("SELECT id FROM ttrss_users WHERE login = ?"); |
63 | 65 | $sth->execute([$login]); |
@@ -134,10 +136,11 @@ discard block |
||
134 | 136 | |
135 | 137 | // TODO do not return empty categories, return Uncategorized and standard virtual cats |
136 | 138 | |
137 | - if ($enable_nested) |
|
138 | - $nested_qpart = "parent_cat IS NULL"; |
|
139 | - else |
|
140 | - $nested_qpart = "true"; |
|
139 | + if ($enable_nested) { |
|
140 | + $nested_qpart = "parent_cat IS NULL"; |
|
141 | + } else { |
|
142 | + $nested_qpart = "true"; |
|
143 | + } |
|
141 | 144 | |
142 | 145 | $sth = $this->pdo->prepare("SELECT |
143 | 146 | id, title, order_id, (SELECT COUNT(id) FROM |
@@ -156,8 +159,9 @@ discard block |
||
156 | 159 | if ($include_empty || $line["num_feeds"] > 0 || $line["num_cats"] > 0) { |
157 | 160 | $unread = getFeedUnread($line["id"], true); |
158 | 161 | |
159 | - if ($enable_nested) |
|
160 | - $unread += Feeds::getCategoryChildrenUnread($line["id"]); |
|
162 | + if ($enable_nested) { |
|
163 | + $unread += Feeds::getCategoryChildrenUnread($line["id"]); |
|
164 | + } |
|
161 | 165 | |
162 | 166 | if ($unread || !$unread_only) { |
163 | 167 | array_push($cats, array("id" => $line["id"], |
@@ -188,11 +192,15 @@ discard block |
||
188 | 192 | $feed_id = clean($_REQUEST["feed_id"]); |
189 | 193 | if ($feed_id !== "") { |
190 | 194 | |
191 | - if (is_numeric($feed_id)) $feed_id = (int) $feed_id; |
|
195 | + if (is_numeric($feed_id)) { |
|
196 | + $feed_id = (int) $feed_id; |
|
197 | + } |
|
192 | 198 | |
193 | 199 | $limit = (int)clean($_REQUEST["limit"]); |
194 | 200 | |
195 | - if (!$limit || $limit >= 200) $limit = 200; |
|
201 | + if (!$limit || $limit >= 200) { |
|
202 | + $limit = 200; |
|
203 | + } |
|
196 | 204 | |
197 | 205 | $offset = (int)clean($_REQUEST["skip"]); |
198 | 206 | $filter = clean($_REQUEST["filter"]); |
@@ -287,7 +295,9 @@ discard block |
||
287 | 295 | break; |
288 | 296 | } |
289 | 297 | |
290 | - if ($field == "note") $set_to = $this->pdo->quote($data); |
|
298 | + if ($field == "note") { |
|
299 | + $set_to = $this->pdo->quote($data); |
|
300 | + } |
|
291 | 301 | |
292 | 302 | if ($field && $set_to && count($article_ids) > 0) { |
293 | 303 | |
@@ -443,10 +453,11 @@ discard block |
||
443 | 453 | WHERE owner_uid = ? ORDER BY caption"); |
444 | 454 | $sth->execute([$_SESSION['uid']]); |
445 | 455 | |
446 | - if ($article_id) |
|
447 | - $article_labels = Article::get_article_labels($article_id); |
|
448 | - else |
|
449 | - $article_labels = array(); |
|
456 | + if ($article_id) { |
|
457 | + $article_labels = Article::get_article_labels($article_id); |
|
458 | + } else { |
|
459 | + $article_labels = array(); |
|
460 | + } |
|
450 | 461 | |
451 | 462 | while ($line = $sth->fetch()) { |
452 | 463 | |
@@ -483,10 +494,11 @@ discard block |
||
483 | 494 | |
484 | 495 | foreach ($article_ids as $id) { |
485 | 496 | |
486 | - if ($assign) |
|
487 | - Labels::add_article($id, $label, $_SESSION["uid"]); |
|
488 | - else |
|
489 | - Labels::remove_article($id, $label, $_SESSION["uid"]); |
|
497 | + if ($assign) { |
|
498 | + Labels::add_article($id, $label, $_SESSION["uid"]); |
|
499 | + } else { |
|
500 | + Labels::remove_article($id, $label, $_SESSION["uid"]); |
|
501 | + } |
|
490 | 502 | |
491 | 503 | ++$num_updated; |
492 | 504 | |
@@ -738,14 +750,17 @@ discard block |
||
738 | 750 | $label_cache = json_decode($label_cache, true); |
739 | 751 | |
740 | 752 | if ($label_cache) { |
741 | - if ($label_cache["no-labels"] == 1) |
|
742 | - $labels = array(); |
|
743 | - else |
|
744 | - $labels = $label_cache; |
|
753 | + if ($label_cache["no-labels"] == 1) { |
|
754 | + $labels = array(); |
|
755 | + } else { |
|
756 | + $labels = $label_cache; |
|
757 | + } |
|
745 | 758 | } |
746 | 759 | } |
747 | 760 | |
748 | - if (!is_array($labels)) $labels = Article::get_article_labels($line["id"]); |
|
761 | + if (!is_array($labels)) { |
|
762 | + $labels = Article::get_article_labels($line["id"]); |
|
763 | + } |
|
749 | 764 | |
750 | 765 | $headline_row = array( |
751 | 766 | "id" => (int)$line["id"], |
@@ -763,11 +778,13 @@ discard block |
||
763 | 778 | |
764 | 779 | $enclosures = Article::get_article_enclosures($line['id']); |
765 | 780 | |
766 | - if ($include_attachments) |
|
767 | - $headline_row['attachments'] = $enclosures; |
|
781 | + if ($include_attachments) { |
|
782 | + $headline_row['attachments'] = $enclosures; |
|
783 | + } |
|
768 | 784 | |
769 | - if ($show_excerpt) |
|
770 | - $headline_row["excerpt"] = $line["content_preview"]; |
|
785 | + if ($show_excerpt) { |
|
786 | + $headline_row["excerpt"] = $line["content_preview"]; |
|
787 | + } |
|
771 | 788 | |
772 | 789 | if ($show_content) { |
773 | 790 | |
@@ -782,7 +799,9 @@ discard block |
||
782 | 799 | } |
783 | 800 | |
784 | 801 | // unify label output to ease parsing |
785 | - if ($labels["no-labels"] == 1) $labels = array(); |
|
802 | + if ($labels["no-labels"] == 1) { |
|
803 | + $labels = array(); |
|
804 | + } |
|
786 | 805 | |
787 | 806 | $headline_row["labels"] = $labels; |
788 | 807 |
@@ -12,7 +12,9 @@ discard block |
||
12 | 12 | "padding : 5px; border-style : dashed; border-color : #e7d796;". |
13 | 13 | "margin-bottom : 1em; color : #9a8c59;"; |
14 | 14 | |
15 | - if (!$limit) $limit = 60; |
|
15 | + if (!$limit) { |
|
16 | + $limit = 60; |
|
17 | + } |
|
16 | 18 | |
17 | 19 | $date_sort_field = "date_entered DESC, updated DESC"; |
18 | 20 | |
@@ -77,7 +79,9 @@ discard block |
||
77 | 79 | "/public.php?op=rss&id=$feed&key=" . |
78 | 80 | Feeds::get_feed_access_key($feed, false, $owner_uid); |
79 | 81 | |
80 | - if (!$feed_site_url) $feed_site_url = get_self_url_prefix(); |
|
82 | + if (!$feed_site_url) { |
|
83 | + $feed_site_url = get_self_url_prefix(); |
|
84 | + } |
|
81 | 85 | |
82 | 86 | if ($format == 'atom') { |
83 | 87 | $tpl = new MiniTemplator; |
@@ -207,8 +211,12 @@ discard block |
||
207 | 211 | $article['content'] = sanitize($line["content"], false, $owner_uid, $feed_site_url, false, $line["id"]); |
208 | 212 | $article['updated'] = date('c', strtotime($line["updated"])); |
209 | 213 | |
210 | - if ($line['note']) $article['note'] = $line['note']; |
|
211 | - if ($article['author']) $article['author'] = $line['author']; |
|
214 | + if ($line['note']) { |
|
215 | + $article['note'] = $line['note']; |
|
216 | + } |
|
217 | + if ($article['author']) { |
|
218 | + $article['author'] = $line['author']; |
|
219 | + } |
|
212 | 220 | |
213 | 221 | $tags = Article::get_article_tags($line["id"], $owner_uid); |
214 | 222 | |
@@ -459,7 +467,9 @@ discard block |
||
459 | 467 | $format = clean($_REQUEST['format']); |
460 | 468 | $orig_guid = clean($_REQUEST["orig_guid"]); |
461 | 469 | |
462 | - if (!$format) $format = 'atom'; |
|
470 | + if (!$format) { |
|
471 | + $format = 'atom'; |
|
472 | + } |
|
463 | 473 | |
464 | 474 | if (SINGLE_USER_MODE) { |
465 | 475 | authenticate_user("admin", null); |
@@ -472,8 +482,9 @@ discard block |
||
472 | 482 | ttrss_access_keys WHERE access_key = ? AND feed_id = ?"); |
473 | 483 | $sth->execute([$key, $feed]); |
474 | 484 | |
475 | - if ($row = $sth->fetch()) |
|
476 | - $owner_id = $row["owner_uid"]; |
|
485 | + if ($row = $sth->fetch()) { |
|
486 | + $owner_id = $row["owner_uid"]; |
|
487 | + } |
|
477 | 488 | } |
478 | 489 | |
479 | 490 | if ($owner_id) { |
@@ -683,8 +694,9 @@ discard block |
||
683 | 694 | // start an empty session to deliver login error message |
684 | 695 | @session_start(); |
685 | 696 | |
686 | - if (!isset($_SESSION["login_error_msg"])) |
|
687 | - $_SESSION["login_error_msg"] = __("Incorrect username or password"); |
|
697 | + if (!isset($_SESSION["login_error_msg"])) { |
|
698 | + $_SESSION["login_error_msg"] = __("Incorrect username or password"); |
|
699 | + } |
|
688 | 700 | |
689 | 701 | user_error("Failed login attempt for $login from {$_SERVER['REMOTE_ADDR']}", E_USER_WARNING); |
690 | 702 | } |
@@ -1007,7 +1019,9 @@ discard block |
||
1007 | 1019 | "subject" => __("[tt-rss] Password reset request"), |
1008 | 1020 | "message" => $message]); |
1009 | 1021 | |
1010 | - if (!$rc) print_error($mailer->error()); |
|
1022 | + if (!$rc) { |
|
1023 | + print_error($mailer->error()); |
|
1024 | + } |
|
1011 | 1025 | |
1012 | 1026 | $resetpass_token_full = time() . ":" . $resetpass_token; |
1013 | 1027 |
@@ -66,8 +66,9 @@ discard block |
||
66 | 66 | |
67 | 67 | // "" (null) is valid and should be cast to 0 (uncategorized) |
68 | 68 | // everything else i.e. tags are not |
69 | - if (!is_numeric($feed_id) && $feed_id) |
|
70 | - return; |
|
69 | + if (!is_numeric($feed_id) && $feed_id) { |
|
70 | + return; |
|
71 | + } |
|
71 | 72 | |
72 | 73 | $feed_id = (int) $feed_id; |
73 | 74 | |
@@ -102,8 +103,9 @@ discard block |
||
102 | 103 | |
103 | 104 | // "" (null) is valid and should be cast to 0 (uncategorized) |
104 | 105 | // everything else i.e. tags are not |
105 | - if (!is_numeric($feed_id) && $feed_id) |
|
106 | - return; |
|
106 | + if (!is_numeric($feed_id) && $feed_id) { |
|
107 | + return; |
|
108 | + } |
|
107 | 109 | |
108 | 110 | $feed_id = (int) $feed_id; |
109 | 111 | |
@@ -182,7 +184,9 @@ discard block |
||
182 | 184 | $sth->execute([$feed_id, $unread, $owner_uid]); |
183 | 185 | } |
184 | 186 | |
185 | - if (!$tr_in_progress) $pdo->commit(); |
|
187 | + if (!$tr_in_progress) { |
|
188 | + $pdo->commit(); |
|
189 | + } |
|
186 | 190 | |
187 | 191 | if ($feed_id > 0 && $prev_unread != $unread) { |
188 | 192 |
@@ -26,8 +26,10 @@ discard block |
||
26 | 26 | if ($error) { |
27 | 27 | foreach (libxml_get_errors() as $error) { |
28 | 28 | if ($error->level == LIBXML_ERR_FATAL) { |
29 | - if(!isset($this->error)) //currently only the first error is reported |
|
29 | + if(!isset($this->error)) { |
|
30 | + //currently only the first error is reported |
|
30 | 31 | $this->error = $this->format_error($error); |
32 | + } |
|
31 | 33 | $this->libxml_errors [] = $this->format_error($error); |
32 | 34 | } |
33 | 35 | } |
@@ -80,8 +82,9 @@ discard block |
||
80 | 82 | |
81 | 83 | $title = $xpath->query("//atom:feed/atom:title")->item(0); |
82 | 84 | |
83 | - if (!$title) |
|
84 | - $title = $xpath->query("//atom03:feed/atom03:title")->item(0); |
|
85 | + if (!$title) { |
|
86 | + $title = $xpath->query("//atom03:feed/atom03:title")->item(0); |
|
87 | + } |
|
85 | 88 | |
86 | 89 | |
87 | 90 | if ($title) { |
@@ -90,14 +93,17 @@ discard block |
||
90 | 93 | |
91 | 94 | $link = $xpath->query("//atom:feed/atom:link[not(@rel)]")->item(0); |
92 | 95 | |
93 | - if (!$link) |
|
94 | - $link = $xpath->query("//atom:feed/atom:link[@rel='alternate']")->item(0); |
|
96 | + if (!$link) { |
|
97 | + $link = $xpath->query("//atom:feed/atom:link[@rel='alternate']")->item(0); |
|
98 | + } |
|
95 | 99 | |
96 | - if (!$link) |
|
97 | - $link = $xpath->query("//atom03:feed/atom03:link[not(@rel)]")->item(0); |
|
100 | + if (!$link) { |
|
101 | + $link = $xpath->query("//atom03:feed/atom03:link[not(@rel)]")->item(0); |
|
102 | + } |
|
98 | 103 | |
99 | - if (!$link) |
|
100 | - $link = $xpath->query("//atom03:feed/atom03:link[@rel='alternate']")->item(0); |
|
104 | + if (!$link) { |
|
105 | + $link = $xpath->query("//atom03:feed/atom03:link[@rel='alternate']")->item(0); |
|
106 | + } |
|
101 | 107 | |
102 | 108 | if ($link && $link->hasAttributes()) { |
103 | 109 | $this->link = $link->getAttribute("href"); |
@@ -105,8 +111,9 @@ discard block |
||
105 | 111 | |
106 | 112 | $articles = $xpath->query("//atom:entry"); |
107 | 113 | |
108 | - if (!$articles || $articles->length == 0) |
|
109 | - $articles = $xpath->query("//atom03:entry"); |
|
114 | + if (!$articles || $articles->length == 0) { |
|
115 | + $articles = $xpath->query("//atom03:entry"); |
|
116 | + } |
|
110 | 117 | |
111 | 118 | foreach ($articles as $article) { |
112 | 119 | array_push($this->items, new FeedItem_Atom($article, $this->doc, $this->xpath)); |
@@ -123,10 +130,11 @@ discard block |
||
123 | 130 | $link = $xpath->query("//channel/link")->item(0); |
124 | 131 | |
125 | 132 | if ($link) { |
126 | - if ($link->getAttribute("href")) |
|
127 | - $this->link = $link->getAttribute("href"); |
|
128 | - else if ($link->nodeValue) |
|
129 | - $this->link = $link->nodeValue; |
|
133 | + if ($link->getAttribute("href")) { |
|
134 | + $this->link = $link->getAttribute("href"); |
|
135 | + } else if ($link->nodeValue) { |
|
136 | + $this->link = $link->nodeValue; |
|
137 | + } |
|
130 | 138 | } |
131 | 139 | |
132 | 140 | $articles = $xpath->query("//channel/item"); |
@@ -161,8 +169,12 @@ discard block |
||
161 | 169 | |
162 | 170 | } |
163 | 171 | |
164 | - if ($this->title) $this->title = trim($this->title); |
|
165 | - if ($this->link) $this->link = trim($this->link); |
|
172 | + if ($this->title) { |
|
173 | + $this->title = trim($this->title); |
|
174 | + } |
|
175 | + if ($this->link) { |
|
176 | + $this->link = trim($this->link); |
|
177 | + } |
|
166 | 178 | |
167 | 179 | } else { |
168 | 180 | if( !isset($this->error) ){ |
@@ -17,7 +17,9 @@ discard block |
||
17 | 17 | $feed_id, $is_cat, $search, |
18 | 18 | $error, $feed_last_updated) { |
19 | 19 | |
20 | - if ($is_cat) $cat_q = "&is_cat=$is_cat"; |
|
20 | + if ($is_cat) { |
|
21 | + $cat_q = "&is_cat=$is_cat"; |
|
22 | + } |
|
21 | 23 | |
22 | 24 | if ($search) { |
23 | 25 | $search_q = "&q=$search"; |
@@ -48,8 +50,9 @@ discard block |
||
48 | 50 | $reply .= strip_tags($feed_title); |
49 | 51 | } |
50 | 52 | |
51 | - if ($error) |
|
52 | - $reply .= " <i title=\"" . htmlspecialchars($error) . "\" class='material-icons icon-error'>error</i>"; |
|
53 | + if ($error) { |
|
54 | + $reply .= " <i title=\"" . htmlspecialchars($error) . "\" class='material-icons icon-error'>error</i>"; |
|
55 | + } |
|
53 | 56 | |
54 | 57 | $reply .= "</span>"; |
55 | 58 | $reply .= "<span id='feed_current_unread' style='display: none'></span>"; |
@@ -127,8 +130,12 @@ discard block |
||
127 | 130 | $rgba_cache = array(); |
128 | 131 | $topmost_article_ids = array(); |
129 | 132 | |
130 | - if (!$offset) $offset = 0; |
|
131 | - if ($method == "undefined") $method = ""; |
|
133 | + if (!$offset) { |
|
134 | + $offset = 0; |
|
135 | + } |
|
136 | + if ($method == "undefined") { |
|
137 | + $method = ""; |
|
138 | + } |
|
132 | 139 | |
133 | 140 | $method_split = explode(":", $method); |
134 | 141 | |
@@ -274,14 +281,17 @@ discard block |
||
274 | 281 | $label_cache = json_decode($label_cache, true); |
275 | 282 | |
276 | 283 | if ($label_cache) { |
277 | - if ($label_cache["no-labels"] == 1) |
|
278 | - $labels = array(); |
|
279 | - else |
|
280 | - $labels = $label_cache; |
|
284 | + if ($label_cache["no-labels"] == 1) { |
|
285 | + $labels = array(); |
|
286 | + } else { |
|
287 | + $labels = $label_cache; |
|
288 | + } |
|
281 | 289 | } |
282 | 290 | } |
283 | 291 | |
284 | - if (!is_array($labels)) $labels = Article::get_article_labels($id); |
|
292 | + if (!is_array($labels)) { |
|
293 | + $labels = Article::get_article_labels($id); |
|
294 | + } |
|
285 | 295 | |
286 | 296 | $labels_str = "<span class=\"HLLCTR-$id\">"; |
287 | 297 | $labels_str .= Article::format_article_labels($labels); |
@@ -293,7 +303,9 @@ discard block |
||
293 | 303 | array_push($topmost_article_ids, $id); |
294 | 304 | } |
295 | 305 | |
296 | - if (!$line["feed_title"]) $line["feed_title"] = ""; |
|
306 | + if (!$line["feed_title"]) { |
|
307 | + $line["feed_title"] = ""; |
|
308 | + } |
|
297 | 309 | |
298 | 310 | $line["buttons_left"] = ""; |
299 | 311 | foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ARTICLE_LEFT_BUTTON) as $p) { |
@@ -314,10 +326,11 @@ discard block |
||
314 | 326 | |
315 | 327 | $line['content'] = DiskCache::rewriteUrls($line['content']); |
316 | 328 | |
317 | - if ($line['note']) |
|
318 | - $line['note'] = Article::format_article_note($id, $line['note']); |
|
319 | - else |
|
320 | - $line['note'] = ""; |
|
329 | + if ($line['note']) { |
|
330 | + $line['note'] = Article::format_article_note($id, $line['note']); |
|
331 | + } else { |
|
332 | + $line['note'] = ""; |
|
333 | + } |
|
321 | 334 | |
322 | 335 | if (!get_pref("CDM_EXPANDED")) { |
323 | 336 | $line["cdm_excerpt"] = "<span class='collapse'> |
@@ -350,10 +363,11 @@ discard block |
||
350 | 363 | $line['imported'] = T_sprintf("Imported at %s", |
351 | 364 | make_local_datetime($line["date_entered"], false)); |
352 | 365 | |
353 | - if ($line["tag_cache"]) |
|
354 | - $tags = explode(",", $line["tag_cache"]); |
|
355 | - else |
|
356 | - $tags = false; |
|
366 | + if ($line["tag_cache"]) { |
|
367 | + $tags = explode(",", $line["tag_cache"]); |
|
368 | + } else { |
|
369 | + $tags = false; |
|
370 | + } |
|
357 | 371 | |
358 | 372 | $line["tags_str"] = Article::format_tags_string($tags); |
359 | 373 | |
@@ -383,8 +397,9 @@ discard block |
||
383 | 397 | /* we don't need those */ |
384 | 398 | |
385 | 399 | foreach (["date_entered", "guid", "last_published", "last_marked", "tag_cache", "favicon_avg_color", |
386 | - "uuid", "label_cache", "yyiw"] as $k) |
|
387 | - unset($line[$k]); |
|
400 | + "uuid", "label_cache", "yyiw"] as $k) { |
|
401 | + unset($line[$k]); |
|
402 | + } |
|
388 | 403 | |
389 | 404 | array_push($reply['content'], $line); |
390 | 405 | } |
@@ -474,7 +489,9 @@ discard block |
||
474 | 489 | $order_by = $_REQUEST["order_by"]; |
475 | 490 | $check_first_id = $_REQUEST["fid"]; |
476 | 491 | |
477 | - if (is_numeric($feed)) $feed = (int) $feed; |
|
492 | + if (is_numeric($feed)) { |
|
493 | + $feed = (int) $feed; |
|
494 | + } |
|
478 | 495 | |
479 | 496 | /* Feed -5 is a special case: it is used to display auxiliary information |
480 | 497 | * when there's nothing to load - e.g. no stuff in fresh feed */ |
@@ -562,10 +579,11 @@ discard block |
||
562 | 579 | $disable_cache = $ret[3]; |
563 | 580 | $reply['headlines'] = $ret[4]; |
564 | 581 | |
565 | - if (!$next_unread_feed) |
|
566 | - $reply['headlines']['id'] = $feed; |
|
567 | - else |
|
568 | - $reply['headlines']['id'] = $next_unread_feed; |
|
582 | + if (!$next_unread_feed) { |
|
583 | + $reply['headlines']['id'] = $feed; |
|
584 | + } else { |
|
585 | + $reply['headlines']['id'] = $next_unread_feed; |
|
586 | + } |
|
569 | 587 | |
570 | 588 | $reply['headlines']['is_cat'] = (bool) $cat_view; |
571 | 589 | |
@@ -851,7 +869,9 @@ discard block |
||
851 | 869 | |
852 | 870 | public static function catchup_feed($feed, $cat_view, $owner_uid = false, $mode = 'all', $search = false) { |
853 | 871 | |
854 | - if (!$owner_uid) $owner_uid = $_SESSION['uid']; |
|
872 | + if (!$owner_uid) { |
|
873 | + $owner_uid = $_SESSION['uid']; |
|
874 | + } |
|
855 | 875 | |
856 | 876 | $pdo = Db::pdo(); |
857 | 877 | |
@@ -1026,7 +1046,9 @@ discard block |
||
1026 | 1046 | |
1027 | 1047 | $pdo = Db::pdo(); |
1028 | 1048 | |
1029 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
1049 | + if (!$owner_uid) { |
|
1050 | + $owner_uid = $_SESSION["uid"]; |
|
1051 | + } |
|
1030 | 1052 | |
1031 | 1053 | if ($unread_only) { |
1032 | 1054 | $unread_qpart = "unread = true"; |
@@ -1142,7 +1164,9 @@ discard block |
||
1142 | 1164 | |
1143 | 1165 | $url = Feeds::fix_url($url); |
1144 | 1166 | |
1145 | - if (!$url || !Feeds::validate_feed_url($url)) return array("code" => 2); |
|
1167 | + if (!$url || !Feeds::validate_feed_url($url)) { |
|
1168 | + return array("code" => 2); |
|
1169 | + } |
|
1146 | 1170 | |
1147 | 1171 | $contents = @fetch_file_contents($url, false, $auth_login, $auth_pass); |
1148 | 1172 | |
@@ -1170,7 +1194,9 @@ discard block |
||
1170 | 1194 | $url = key($feedUrls); |
1171 | 1195 | } |
1172 | 1196 | |
1173 | - if (!$cat_id) $cat_id = null; |
|
1197 | + if (!$cat_id) { |
|
1198 | + $cat_id = null; |
|
1199 | + } |
|
1174 | 1200 | |
1175 | 1201 | $sth = $pdo->prepare("SELECT id FROM ttrss_feeds |
1176 | 1202 | WHERE feed_url = ? AND owner_uid = ?"); |
@@ -1287,13 +1313,17 @@ discard block |
||
1287 | 1313 | |
1288 | 1314 | public static function getCategoryUnread($cat, $owner_uid = false) { |
1289 | 1315 | |
1290 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
1316 | + if (!$owner_uid) { |
|
1317 | + $owner_uid = $_SESSION["uid"]; |
|
1318 | + } |
|
1291 | 1319 | |
1292 | 1320 | $pdo = Db::pdo(); |
1293 | 1321 | |
1294 | 1322 | if ($cat >= 0) { |
1295 | 1323 | |
1296 | - if (!$cat) $cat = null; |
|
1324 | + if (!$cat) { |
|
1325 | + $cat = null; |
|
1326 | + } |
|
1297 | 1327 | |
1298 | 1328 | $sth = $pdo->prepare("SELECT id FROM ttrss_feeds |
1299 | 1329 | WHERE (cat_id = :cat OR (:cat IS NULL AND cat_id IS NULL)) |
@@ -1306,7 +1336,9 @@ discard block |
||
1306 | 1336 | array_push($cat_feeds, "feed_id = " . (int)$line["id"]); |
1307 | 1337 | } |
1308 | 1338 | |
1309 | - if (count($cat_feeds) == 0) return 0; |
|
1339 | + if (count($cat_feeds) == 0) { |
|
1340 | + return 0; |
|
1341 | + } |
|
1310 | 1342 | |
1311 | 1343 | $match_part = implode(" OR ", $cat_feeds); |
1312 | 1344 | |
@@ -1341,7 +1373,9 @@ discard block |
||
1341 | 1373 | |
1342 | 1374 | // only accepts real cats (>= 0) |
1343 | 1375 | public static function getCategoryChildrenUnread($cat, $owner_uid = false) { |
1344 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
1376 | + if (!$owner_uid) { |
|
1377 | + $owner_uid = $_SESSION["uid"]; |
|
1378 | + } |
|
1345 | 1379 | |
1346 | 1380 | $pdo = Db::pdo(); |
1347 | 1381 | |
@@ -1361,7 +1395,9 @@ discard block |
||
1361 | 1395 | |
1362 | 1396 | public static function getGlobalUnread($user_id = false) { |
1363 | 1397 | |
1364 | - if (!$user_id) $user_id = $_SESSION["uid"]; |
|
1398 | + if (!$user_id) { |
|
1399 | + $user_id = $_SESSION["uid"]; |
|
1400 | + } |
|
1365 | 1401 | |
1366 | 1402 | $pdo = Db::pdo(); |
1367 | 1403 | |
@@ -1396,7 +1432,9 @@ discard block |
||
1396 | 1432 | } |
1397 | 1433 | |
1398 | 1434 | public static function getLabelUnread($label_id, $owner_uid = false) { |
1399 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
1435 | + if (!$owner_uid) { |
|
1436 | + $owner_uid = $_SESSION["uid"]; |
|
1437 | + } |
|
1400 | 1438 | |
1401 | 1439 | $pdo = Db::pdo(); |
1402 | 1440 | |
@@ -1491,8 +1529,9 @@ discard block |
||
1491 | 1529 | |
1492 | 1530 | $unread = getFeedUnread($feed, $cat_view); |
1493 | 1531 | |
1494 | - if ($cat_view && $feed > 0 && $include_children) |
|
1495 | - $unread += Feeds::getCategoryChildrenUnread($feed); |
|
1532 | + if ($cat_view && $feed > 0 && $include_children) { |
|
1533 | + $unread += Feeds::getCategoryChildrenUnread($feed); |
|
1534 | + } |
|
1496 | 1535 | |
1497 | 1536 | if ($unread > 0) { |
1498 | 1537 | $view_query_part = " unread = true AND "; |
@@ -1604,7 +1643,9 @@ discard block |
||
1604 | 1643 | $allow_archived = true; |
1605 | 1644 | $ignore_vfeed_group = true; |
1606 | 1645 | |
1607 | - if (!$override_order) $override_order = "last_read DESC"; |
|
1646 | + if (!$override_order) { |
|
1647 | + $override_order = "last_read DESC"; |
|
1648 | + } |
|
1608 | 1649 | |
1609 | 1650 | } else if ($feed == -3) { // fresh virtual feed |
1610 | 1651 | $query_strategy_part = "unread = true AND score >= 0"; |
@@ -1715,13 +1756,16 @@ discard block |
||
1715 | 1756 | LEFT JOIN ttrss_feeds ON (feed_id = ttrss_feeds.id)"; |
1716 | 1757 | } |
1717 | 1758 | |
1718 | - if ($vfeed_query_part) $vfeed_query_part .= "favicon_avg_color,"; |
|
1759 | + if ($vfeed_query_part) { |
|
1760 | + $vfeed_query_part .= "favicon_avg_color,"; |
|
1761 | + } |
|
1719 | 1762 | |
1720 | 1763 | $first_id = 0; |
1721 | 1764 | $first_id_query_strategy_part = $query_strategy_part; |
1722 | 1765 | |
1723 | - if ($feed == -3) |
|
1724 | - $first_id_query_strategy_part = "true"; |
|
1766 | + if ($feed == -3) { |
|
1767 | + $first_id_query_strategy_part = "true"; |
|
1768 | + } |
|
1725 | 1769 | |
1726 | 1770 | if (DB_TYPE == "pgsql") { |
1727 | 1771 | $sanity_interval_qpart = "date_entered >= NOW() - INTERVAL '1 hour' AND"; |
@@ -1853,7 +1897,9 @@ discard block |
||
1853 | 1897 | $query_strategy_part ORDER BY $order_by |
1854 | 1898 | $limit_query_part $offset_query_part"; |
1855 | 1899 | |
1856 | - if ($_REQUEST["debug"]) print $query; |
|
1900 | + if ($_REQUEST["debug"]) { |
|
1901 | + print $query; |
|
1902 | + } |
|
1857 | 1903 | |
1858 | 1904 | $res = $pdo->query($query); |
1859 | 1905 | } |
@@ -2003,18 +2049,23 @@ discard block |
||
2003 | 2049 | } |
2004 | 2050 | } |
2005 | 2051 | |
2006 | - if ($url != "http:///") |
|
2007 | - return $url; |
|
2008 | - else |
|
2009 | - return ''; |
|
2052 | + if ($url != "http:///") { |
|
2053 | + return $url; |
|
2054 | + } else { |
|
2055 | + return ''; |
|
2056 | + } |
|
2010 | 2057 | } |
2011 | 2058 | |
2012 | 2059 | public static function add_feed_category($feed_cat, $parent_cat_id = false, $order_id = 0) { |
2013 | 2060 | |
2014 | - if (!$feed_cat) return false; |
|
2061 | + if (!$feed_cat) { |
|
2062 | + return false; |
|
2063 | + } |
|
2015 | 2064 | |
2016 | 2065 | $feed_cat = mb_substr($feed_cat, 0, 250); |
2017 | - if (!$parent_cat_id) $parent_cat_id = null; |
|
2066 | + if (!$parent_cat_id) { |
|
2067 | + $parent_cat_id = null; |
|
2068 | + } |
|
2018 | 2069 | |
2019 | 2070 | $pdo = Db::pdo(); |
2020 | 2071 | $tr_in_progress = false; |
@@ -2036,7 +2087,9 @@ discard block |
||
2036 | 2087 | VALUES (?, ?, ?, ?)"); |
2037 | 2088 | $sth->execute([$_SESSION['uid'], $feed_cat, $parent_cat_id, (int)$order_id]); |
2038 | 2089 | |
2039 | - if (!$tr_in_progress) $pdo->commit(); |
|
2090 | + if (!$tr_in_progress) { |
|
2091 | + $pdo->commit(); |
|
2092 | + } |
|
2040 | 2093 | |
2041 | 2094 | return true; |
2042 | 2095 | } |
@@ -2048,7 +2101,9 @@ discard block |
||
2048 | 2101 | |
2049 | 2102 | public static function get_feed_access_key($feed_id, $is_cat, $owner_uid = false) { |
2050 | 2103 | |
2051 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
2104 | + if (!$owner_uid) { |
|
2105 | + $owner_uid = $_SESSION["uid"]; |
|
2106 | + } |
|
2052 | 2107 | |
2053 | 2108 | $is_cat = bool_to_sql_bool($is_cat); |
2054 | 2109 | |
@@ -2086,7 +2141,9 @@ discard block |
||
2086 | 2141 | */ |
2087 | 2142 | public static function purge_feed($feed_id, $purge_interval) { |
2088 | 2143 | |
2089 | - if (!$purge_interval) $purge_interval = Feeds::feed_purge_interval($feed_id); |
|
2144 | + if (!$purge_interval) { |
|
2145 | + $purge_interval = Feeds::feed_purge_interval($feed_id); |
|
2146 | + } |
|
2090 | 2147 | |
2091 | 2148 | $pdo = Db::pdo(); |
2092 | 2149 | |
@@ -2106,7 +2163,9 @@ discard block |
||
2106 | 2163 | return; |
2107 | 2164 | } |
2108 | 2165 | |
2109 | - if (!$owner_uid) return; |
|
2166 | + if (!$owner_uid) { |
|
2167 | + return; |
|
2168 | + } |
|
2110 | 2169 | |
2111 | 2170 | if (FORCE_ARTICLE_PURGE == 0) { |
2112 | 2171 | $purge_unread = get_pref("PURGE_UNREAD_ARTICLES", |
@@ -2116,10 +2175,11 @@ discard block |
||
2116 | 2175 | $purge_interval = FORCE_ARTICLE_PURGE; |
2117 | 2176 | } |
2118 | 2177 | |
2119 | - if (!$purge_unread) |
|
2120 | - $query_limit = " unread = false AND "; |
|
2121 | - else |
|
2122 | - $query_limit = ""; |
|
2178 | + if (!$purge_unread) { |
|
2179 | + $query_limit = " unread = false AND "; |
|
2180 | + } else { |
|
2181 | + $query_limit = ""; |
|
2182 | + } |
|
2123 | 2183 | |
2124 | 2184 | $purge_interval = (int) $purge_interval; |
2125 | 2185 | |
@@ -2166,8 +2226,10 @@ discard block |
||
2166 | 2226 | $purge_interval = $row["purge_interval"]; |
2167 | 2227 | $owner_uid = $row["owner_uid"]; |
2168 | 2228 | |
2169 | - if ($purge_interval == 0) $purge_interval = get_pref( |
|
2229 | + if ($purge_interval == 0) { |
|
2230 | + $purge_interval = get_pref( |
|
2170 | 2231 | 'PURGE_OLD_DAYS', $owner_uid); |
2232 | + } |
|
2171 | 2233 | |
2172 | 2234 | return $purge_interval; |
2173 | 2235 | |
@@ -2185,10 +2247,11 @@ discard block |
||
2185 | 2247 | |
2186 | 2248 | $pdo = Db::pdo(); |
2187 | 2249 | |
2188 | - if ($search_language) |
|
2189 | - $search_language = $pdo->quote(mb_strtolower($search_language)); |
|
2190 | - else |
|
2191 | - $search_language = $pdo->quote("english"); |
|
2250 | + if ($search_language) { |
|
2251 | + $search_language = $pdo->quote(mb_strtolower($search_language)); |
|
2252 | + } else { |
|
2253 | + $search_language = $pdo->quote("english"); |
|
2254 | + } |
|
2192 | 2255 | |
2193 | 2256 | foreach ($keywords as $k) { |
2194 | 2257 | if (strpos($k, "-") === 0) { |
@@ -2223,56 +2286,68 @@ discard block |
||
2223 | 2286 | break; |
2224 | 2287 | case "note": |
2225 | 2288 | if ($commandpair[1]) { |
2226 | - if ($commandpair[1] == "true") |
|
2227 | - array_push($query_keywords, "($not (note IS NOT NULL AND note != ''))"); |
|
2228 | - else if ($commandpair[1] == "false") |
|
2229 | - array_push($query_keywords, "($not (note IS NULL OR note = ''))"); |
|
2230 | - else |
|
2231 | - 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 ". |
|
2232 | 2295 | $pdo->quote('%' . mb_strtolower($commandpair[1]) . '%')."))"); |
2296 | + } |
|
2233 | 2297 | } else { |
2234 | 2298 | array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
2235 | 2299 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2236 | - if (!$not) array_push($search_words, $k); |
|
2300 | + if (!$not) { |
|
2301 | + array_push($search_words, $k); |
|
2302 | + } |
|
2237 | 2303 | } |
2238 | 2304 | break; |
2239 | 2305 | case "star": |
2240 | 2306 | |
2241 | 2307 | if ($commandpair[1]) { |
2242 | - if ($commandpair[1] == "true") |
|
2243 | - array_push($query_keywords, "($not (marked = true))"); |
|
2244 | - else |
|
2245 | - 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 | + } |
|
2246 | 2313 | } else { |
2247 | 2314 | array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
2248 | 2315 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2249 | - if (!$not) array_push($search_words, $k); |
|
2316 | + if (!$not) { |
|
2317 | + array_push($search_words, $k); |
|
2318 | + } |
|
2250 | 2319 | } |
2251 | 2320 | break; |
2252 | 2321 | case "pub": |
2253 | 2322 | if ($commandpair[1]) { |
2254 | - if ($commandpair[1] == "true") |
|
2255 | - array_push($query_keywords, "($not (published = true))"); |
|
2256 | - else |
|
2257 | - 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 | + } |
|
2258 | 2328 | |
2259 | 2329 | } else { |
2260 | 2330 | array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') |
2261 | 2331 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2262 | - if (!$not) array_push($search_words, $k); |
|
2332 | + if (!$not) { |
|
2333 | + array_push($search_words, $k); |
|
2334 | + } |
|
2263 | 2335 | } |
2264 | 2336 | break; |
2265 | 2337 | case "unread": |
2266 | 2338 | if ($commandpair[1]) { |
2267 | - if ($commandpair[1] == "true") |
|
2268 | - array_push($query_keywords, "($not (unread = true))"); |
|
2269 | - else |
|
2270 | - 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 | + } |
|
2271 | 2344 | |
2272 | 2345 | } else { |
2273 | 2346 | array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
2274 | 2347 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2275 | - if (!$not) array_push($search_words, $k); |
|
2348 | + if (!$not) { |
|
2349 | + array_push($search_words, $k); |
|
2350 | + } |
|
2276 | 2351 | } |
2277 | 2352 | break; |
2278 | 2353 | default: |
@@ -2295,7 +2370,9 @@ discard block |
||
2295 | 2370 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2296 | 2371 | } |
2297 | 2372 | |
2298 | - if (!$not) array_push($search_words, $k); |
|
2373 | + if (!$not) { |
|
2374 | + array_push($search_words, $k); |
|
2375 | + } |
|
2299 | 2376 | } |
2300 | 2377 | } |
2301 | 2378 | } |
@@ -42,10 +42,11 @@ discard block |
||
42 | 42 | |
43 | 43 | private function get_category_items($cat_id) { |
44 | 44 | |
45 | - if (clean($_REQUEST['mode']) != 2) |
|
46 | - $search = $_SESSION["prefs_feed_search"]; |
|
47 | - else |
|
48 | - $search = ""; |
|
45 | + if (clean($_REQUEST['mode']) != 2) { |
|
46 | + $search = $_SESSION["prefs_feed_search"]; |
|
47 | + } else { |
|
48 | + $search = ""; |
|
49 | + } |
|
49 | 50 | |
50 | 51 | // first one is set by API |
51 | 52 | $show_empty_cats = clean($_REQUEST['force_show_empty']) || |
@@ -76,8 +77,9 @@ discard block |
||
76 | 77 | $num_children = $this->calculate_children_count($cat); |
77 | 78 | $cat['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', (int) $num_children), $num_children); |
78 | 79 | |
79 | - if ($num_children > 0 || $show_empty_cats) |
|
80 | - array_push($items, $cat); |
|
80 | + if ($num_children > 0 || $show_empty_cats) { |
|
81 | + array_push($items, $cat); |
|
82 | + } |
|
81 | 83 | |
82 | 84 | } |
83 | 85 | |
@@ -117,10 +119,11 @@ discard block |
||
117 | 119 | |
118 | 120 | public function makefeedtree() { |
119 | 121 | |
120 | - if (clean($_REQUEST['mode']) != 2) |
|
121 | - $search = $_SESSION["prefs_feed_search"]; |
|
122 | - else |
|
123 | - $search = ""; |
|
122 | + if (clean($_REQUEST['mode']) != 2) { |
|
123 | + $search = $_SESSION["prefs_feed_search"]; |
|
124 | + } else { |
|
125 | + $search = ""; |
|
126 | + } |
|
124 | 127 | |
125 | 128 | $root = array(); |
126 | 129 | $root['id'] = 'root'; |
@@ -231,8 +234,9 @@ discard block |
||
231 | 234 | $num_children = $this->calculate_children_count($cat); |
232 | 235 | $cat['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', (int) $num_children), $num_children); |
233 | 236 | |
234 | - if ($num_children > 0 || $show_empty_cats) |
|
235 | - array_push($root['items'], $cat); |
|
237 | + if ($num_children > 0 || $show_empty_cats) { |
|
238 | + array_push($root['items'], $cat); |
|
239 | + } |
|
236 | 240 | |
237 | 241 | $root['param'] += count($cat['items']); |
238 | 242 | } |
@@ -279,8 +283,9 @@ discard block |
||
279 | 283 | |
280 | 284 | $cat['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', count($cat['items'])), count($cat['items'])); |
281 | 285 | |
282 | - if (count($cat['items']) > 0 || $show_empty_cats) |
|
283 | - array_push($root['items'], $cat); |
|
286 | + if (count($cat['items']) > 0 || $show_empty_cats) { |
|
287 | + array_push($root['items'], $cat); |
|
288 | + } |
|
284 | 289 | |
285 | 290 | $num_children = $this->calculate_children_count($root); |
286 | 291 | $root['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', (int) $num_children), $num_children); |
@@ -343,8 +348,9 @@ discard block |
||
343 | 348 | private function process_category_order(&$data_map, $item_id, $parent_id = false, $nest_level = 0) { |
344 | 349 | |
345 | 350 | $prefix = ""; |
346 | - for ($i = 0; $i < $nest_level; $i++) |
|
347 | - $prefix .= " "; |
|
351 | + for ($i = 0; $i < $nest_level; $i++) { |
|
352 | + $prefix .= " "; |
|
353 | + } |
|
348 | 354 | |
349 | 355 | Debug::log("$prefix C: $item_id P: $parent_id"); |
350 | 356 | |
@@ -409,8 +415,9 @@ discard block |
||
409 | 415 | #file_put_contents("/tmp/saveorder.json", clean($_POST['payload'])); |
410 | 416 | #$data = json_decode(file_get_contents("/tmp/saveorder.json"), true); |
411 | 417 | |
412 | - if (!is_array($data['items'])) |
|
413 | - $data['items'] = json_decode($data['items'], true); |
|
418 | + if (!is_array($data['items'])) { |
|
419 | + $data['items'] = json_decode($data['items'], true); |
|
420 | + } |
|
414 | 421 | |
415 | 422 | # print_r($data['items']); |
416 | 423 | |
@@ -494,7 +501,9 @@ discard block |
||
494 | 501 | } |
495 | 502 | } |
496 | 503 | |
497 | - if (is_file($icon_file)) @unlink($icon_file); |
|
504 | + if (is_file($icon_file)) { |
|
505 | + @unlink($icon_file); |
|
506 | + } |
|
498 | 507 | |
499 | 508 | print $rc; |
500 | 509 | return; |
@@ -590,8 +599,9 @@ discard block |
||
590 | 599 | if (DB_TYPE == "pgsql") { |
591 | 600 | $feed_language = $row["feed_language"]; |
592 | 601 | |
593 | - if (!$feed_language) |
|
594 | - $feed_language = get_pref('DEFAULT_SEARCH_LANGUAGE'); |
|
602 | + if (!$feed_language) { |
|
603 | + $feed_language = get_pref('DEFAULT_SEARCH_LANGUAGE'); |
|
604 | + } |
|
595 | 605 | |
596 | 606 | print "<fieldset>"; |
597 | 607 | |
@@ -1404,11 +1414,13 @@ discard block |
||
1404 | 1414 | $obj = array(); |
1405 | 1415 | $feed_id = (int) $feed_id; |
1406 | 1416 | |
1407 | - if (!$title) |
|
1408 | - $title = Feeds::getFeedTitle($feed_id, false); |
|
1417 | + if (!$title) { |
|
1418 | + $title = Feeds::getFeedTitle($feed_id, false); |
|
1419 | + } |
|
1409 | 1420 | |
1410 | - if ($unread === false) |
|
1411 | - $unread = getFeedUnread($feed_id, false); |
|
1421 | + if ($unread === false) { |
|
1422 | + $unread = getFeedUnread($feed_id, false); |
|
1423 | + } |
|
1412 | 1424 | |
1413 | 1425 | $obj['id'] = 'FEED:' . $feed_id; |
1414 | 1426 | $obj['name'] = $title; |
@@ -1738,7 +1750,9 @@ discard block |
||
1738 | 1750 | |
1739 | 1751 | |
1740 | 1752 | private function update_feed_access_key($feed_id, $is_cat, $owner_uid = false) { |
1741 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
1753 | + if (!$owner_uid) { |
|
1754 | + $owner_uid = $_SESSION["uid"]; |
|
1755 | + } |
|
1742 | 1756 | |
1743 | 1757 | // clear old value and generate new one |
1744 | 1758 | $sth = $this->pdo->prepare("DELETE FROM ttrss_access_keys |
@@ -160,7 +160,9 @@ discard block |
||
160 | 160 | $boolean_prefs = explode(",", clean($_POST["boolean_prefs"])); |
161 | 161 | |
162 | 162 | foreach ($boolean_prefs as $pref) { |
163 | - if (!isset($_POST[$pref])) $_POST[$pref] = 'false'; |
|
163 | + if (!isset($_POST[$pref])) { |
|
164 | + $_POST[$pref] = 'false'; |
|
165 | + } |
|
164 | 166 | } |
165 | 167 | |
166 | 168 | $need_reload = false; |
@@ -180,11 +182,15 @@ discard block |
||
180 | 182 | } |
181 | 183 | break; |
182 | 184 | case 'USER_LANGUAGE': |
183 | - if (!$need_reload) $need_reload = $_SESSION["language"] != $value; |
|
185 | + if (!$need_reload) { |
|
186 | + $need_reload = $_SESSION["language"] != $value; |
|
187 | + } |
|
184 | 188 | break; |
185 | 189 | |
186 | 190 | case 'USER_CSS_THEME': |
187 | - if (!$need_reload) $need_reload = get_pref($pref_name) != $value; |
|
191 | + if (!$need_reload) { |
|
192 | + $need_reload = get_pref($pref_name) != $value; |
|
193 | + } |
|
188 | 194 | break; |
189 | 195 | } |
190 | 196 | |
@@ -616,8 +622,9 @@ discard block |
||
616 | 622 | $pref_name = $line["pref_name"]; |
617 | 623 | $short_desc = $this->getShortDesc($pref_name); |
618 | 624 | |
619 | - if (!$short_desc) |
|
620 | - continue; |
|
625 | + if (!$short_desc) { |
|
626 | + continue; |
|
627 | + } |
|
621 | 628 | |
622 | 629 | $prefs_available[$pref_name] = [ |
623 | 630 | 'type_name' => $line["type_name"], |
@@ -669,7 +676,9 @@ discard block |
||
669 | 676 | $themes = array_filter($themes, "theme_exists"); |
670 | 677 | asort($themes); |
671 | 678 | |
672 | - if (!theme_exists($value)) $value = "default.php"; |
|
679 | + if (!theme_exists($value)) { |
|
680 | + $value = "default.php"; |
|
681 | + } |
|
673 | 682 | |
674 | 683 | print "<select name='$pref_name' id='$pref_name' dojoType='fox.form.Select'>"; |
675 | 684 | |
@@ -728,14 +737,15 @@ discard block |
||
728 | 737 | $disabled = ""; |
729 | 738 | } |
730 | 739 | |
731 | - if ($type_name == 'integer') |
|
732 | - print "<input dojoType=\"dijit.form.NumberSpinner\" |
|
740 | + if ($type_name == 'integer') { |
|
741 | + print "<input dojoType=\"dijit.form.NumberSpinner\" |
|
733 | 742 | required='1' $disabled |
734 | 743 | name=\"$pref_name\" value=\"$value\">"; |
735 | - else |
|
736 | - print "<input dojoType=\"dijit.form.TextBox\" |
|
744 | + } else { |
|
745 | + print "<input dojoType=\"dijit.form.TextBox\" |
|
737 | 746 | required='1' $regexp $disabled |
738 | 747 | name=\"$pref_name\" value=\"$value\">"; |
748 | + } |
|
739 | 749 | |
740 | 750 | } else if ($pref_name == "SSL_CERT_SERIAL") { |
741 | 751 | |
@@ -770,8 +780,9 @@ discard block |
||
770 | 780 | print "<input dojoType=\"dijit.form.ValidationTextBox\" $regexp name=\"$pref_name\" value=\"$value\">"; |
771 | 781 | } |
772 | 782 | |
773 | - if ($item['help_text']) |
|
774 | - print "<div class='help-text text-muted'><label for='CB_$pref_name'>".$item['help_text']."</label></div>"; |
|
783 | + if ($item['help_text']) { |
|
784 | + print "<div class='help-text text-muted'><label for='CB_$pref_name'>".$item['help_text']."</label></div>"; |
|
785 | + } |
|
775 | 786 | |
776 | 787 | print "</fieldset>"; |
777 | 788 | } |
@@ -1108,10 +1119,11 @@ discard block |
||
1108 | 1119 | } |
1109 | 1120 | |
1110 | 1121 | public function setplugins() { |
1111 | - if (is_array(clean($_REQUEST["plugins"]))) |
|
1112 | - $plugins = join(",", clean($_REQUEST["plugins"])); |
|
1113 | - else |
|
1114 | - $plugins = ""; |
|
1122 | + if (is_array(clean($_REQUEST["plugins"]))) { |
|
1123 | + $plugins = join(",", clean($_REQUEST["plugins"])); |
|
1124 | + } else { |
|
1125 | + $plugins = ""; |
|
1126 | + } |
|
1115 | 1127 | |
1116 | 1128 | set_pref("_ENABLED_PLUGINS", $plugins); |
1117 | 1129 | } |