Passed
Pull Request — master (#1)
by
unknown
04:51
created
classes/ccache.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 				$sth->execute([":uid" => $owner_uid, ":cat" => $feed_id]);
136 136
 
137 137
 				while ($line = $sth->fetch()) {
138
-					CCache::update((int)$line["id"], $owner_uid, false, false);
138
+					CCache::update((int) $line["id"], $owner_uid, false, false);
139 139
 				}
140 140
 			}
141 141
 
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 					$sth->execute([$owner_uid, $feed_id]);
198 198
 
199 199
 					if ($row = $sth->fetch()) {
200
-						CCache::update((int)$row["cat_id"], $owner_uid, true, true, true);
200
+						CCache::update((int) $row["cat_id"], $owner_uid, true, true, true);
201 201
 					}
202 202
 				}
203 203
 			}
Please login to merge, or discard this patch.
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -66,8 +66,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
classes/feeditem/common.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -175,7 +175,7 @@
 block discarded – undo
175 175
 
176 176
 			// we don't support numeric tags
177 177
 			if (is_numeric($cat))
178
-				$cat = 't:' . $cat;
178
+				$cat = 't:'.$cat;
179 179
 
180 180
 			$cat = preg_replace('/[,\'\"]/', "", $cat);
181 181
 
Please login to merge, or discard this patch.
Braces   +30 added lines, -16 removed lines patch added patch discarded remove patch
@@ -14,8 +14,9 @@  discard block
 block discarded – undo
14 14
 			$source = $elem->getElementsByTagName("source")->item(0);
15 15
 
16 16
 			// we don't need <source> element
17
-			if ($source)
18
-				$elem->removeChild($source);
17
+			if ($source) {
18
+							$elem->removeChild($source);
19
+			}
19 20
 		} catch (DOMException $e) {
20 21
 			//
21 22
 		}
@@ -31,14 +32,19 @@  discard block
 block discarded – undo
31 32
 		if ($author) {
32 33
 			$name = $author->getElementsByTagName("name")->item(0);
33 34
 
34
-			if ($name) return clean($name->nodeValue);
35
+			if ($name) {
36
+				return clean($name->nodeValue);
37
+			}
35 38
 
36 39
 			$email = $author->getElementsByTagName("email")->item(0);
37 40
 
38
-			if ($email) return clean($email->nodeValue);
41
+			if ($email) {
42
+				return clean($email->nodeValue);
43
+			}
39 44
 
40
-			if ($author->nodeValue)
41
-				return clean($author->nodeValue);
45
+			if ($author->nodeValue) {
46
+							return clean($author->nodeValue);
47
+			}
42 48
 		}
43 49
 
44 50
 		$author_elems = $this->xpath->query("dc:creator", $this->elem);
@@ -56,15 +62,17 @@  discard block
 block discarded – undo
56 62
 		//might give a wrong result if a default namespace was declared (possible with XPath 2.0)
57 63
 		$com_url = $this->xpath->query("comments", $this->elem)->item(0);
58 64
 
59
-		if ($com_url)
60
-			return clean($com_url->nodeValue);
65
+		if ($com_url) {
66
+					return clean($com_url->nodeValue);
67
+		}
61 68
 
62 69
 		//Atom Threading Extension (RFC 4685) stuff. Could be used in RSS feeds, so it's in common.
63 70
 		//'text/html' for type is too restrictive?
64 71
 		$com_url = $this->xpath->query("atom:link[@rel='replies' and contains(@type,'text/html')]/@href", $this->elem)->item(0);
65 72
 
66
-		if ($com_url)
67
-			return clean($com_url->nodeValue);
73
+		if ($com_url) {
74
+					return clean($com_url->nodeValue);
75
+		}
68 76
 	}
69 77
 
70 78
 	function get_comments_count() {
@@ -98,7 +106,9 @@  discard block
 block discarded – undo
98 106
 			}
99 107
 
100 108
 			$desc = $this->xpath->query("media:description", $enclosure)->item(0);
101
-			if ($desc) $enc->title = clean($desc->nodeValue);
109
+			if ($desc) {
110
+				$enc->title = clean($desc->nodeValue);
111
+			}
102 112
 
103 113
 			array_push($encs, $enc);
104 114
 		}
@@ -127,7 +137,9 @@  discard block
 block discarded – undo
127 137
 					$enc->title = clean($desc->nodeValue);
128 138
 				} else {
129 139
 					$desc = $this->xpath->query("media:description", $enclosure)->item(0);
130
-					if ($desc) $enc->title = clean($desc->nodeValue);
140
+					if ($desc) {
141
+						$enc->title = clean($desc->nodeValue);
142
+					}
131 143
 				}
132 144
 
133 145
 				array_push($encs, $enc);
@@ -174,8 +186,9 @@  discard block
 block discarded – undo
174 186
 			$cat = clean(trim(mb_strtolower($srccat)));
175 187
 
176 188
 			// we don't support numeric tags
177
-			if (is_numeric($cat))
178
-				$cat = 't:' . $cat;
189
+			if (is_numeric($cat)) {
190
+							$cat = 't:' . $cat;
191
+			}
179 192
 
180 193
 			$cat = preg_replace('/[,\'\"]/', "", $cat);
181 194
 
@@ -183,8 +196,9 @@  discard block
 block discarded – undo
183 196
 				$cat = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $cat);
184 197
 			}
185 198
 
186
-			if (mb_strlen($cat) > 250)
187
-				$cat = mb_substr($cat, 0, 250);
199
+			if (mb_strlen($cat) > 250) {
200
+							$cat = mb_substr($cat, 0, 250);
201
+			}
188 202
 
189 203
 			return $cat;
190 204
 		}, $tmp);
Please login to merge, or discard this patch.
classes/feeditem/atom.php 1 patch
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -43,10 +43,11 @@  discard block
 block discarded – undo
43 43
 					|| $link->getAttribute("rel") == "standout")) {
44 44
 				$base = $this->xpath->evaluate("string(ancestor-or-self::*[@xml:base][1]/@xml:base)", $link);
45 45
 
46
-				if ($base)
47
-					return rewrite_relative_url($base, clean(trim($link->getAttribute("href"))));
48
-				else
49
-					return clean(trim($link->getAttribute("href")));
46
+				if ($base) {
47
+									return rewrite_relative_url($base, clean(trim($link->getAttribute("href"))));
48
+				} else {
49
+									return clean(trim($link->getAttribute("href")));
50
+				}
50 51
 
51 52
 			}
52 53
 		}
@@ -106,8 +107,9 @@  discard block
 block discarded – undo
106 107
 		$cats = [];
107 108
 
108 109
 		foreach ($categories as $cat) {
109
-			if ($cat->hasAttribute("term"))
110
-				array_push($cats, $cat->getAttribute("term"));
110
+			if ($cat->hasAttribute("term")) {
111
+							array_push($cats, $cat->getAttribute("term"));
112
+			}
111 113
 		}
112 114
 
113 115
 		$categories = $this->xpath->query("dc:subject", $this->elem);
Please login to merge, or discard this patch.
classes/handler/public.php 4 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 
286 286
 				array_push($rv, [ "label" => $title, "value" => $id ]);
287 287
 			}
288
-	    }
288
+		}
289 289
 
290 290
 		print json_encode($rv);
291 291
 	}
@@ -358,37 +358,37 @@  discard block
 block discarded – undo
358 358
 
359 359
 			$enclosures = Article::get_article_enclosures($line["id"]);
360 360
 
361
-            header("Content-Type: text/html");
361
+			header("Content-Type: text/html");
362 362
 
363
-            $rv .= "<!DOCTYPE html>
363
+			$rv .= "<!DOCTYPE html>
364 364
                     <html><head>
365 365
                     <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
366 366
                     <title>".$line["title"]."</title>".
367
-                    stylesheet_tag("css/default.css")."
367
+					stylesheet_tag("css/default.css")."
368 368
                     <link rel='shortcut icon' type='image/png' href='images/favicon.png'>
369 369
                     <link rel='icon' type='image/png' sizes='72x72' href='images/favicon-72px.png'>";
370 370
 
371
-            $rv .= "<meta property='og:title' content=\"".htmlspecialchars(html_entity_decode($line["title"], ENT_NOQUOTES | ENT_HTML401))."\"/>\n";
372
-            $rv .= "<meta property='og:description' content=\"".
373
-                htmlspecialchars(
374
-                	truncate_string(
375
-                		preg_replace("/[\r\n\t]/", "",
371
+			$rv .= "<meta property='og:title' content=\"".htmlspecialchars(html_entity_decode($line["title"], ENT_NOQUOTES | ENT_HTML401))."\"/>\n";
372
+			$rv .= "<meta property='og:description' content=\"".
373
+				htmlspecialchars(
374
+					truncate_string(
375
+						preg_replace("/[\r\n\t]/", "",
376 376
 							preg_replace("/ {1,}/", " ",
377 377
 								strip_tags(html_entity_decode($line["content"], ENT_NOQUOTES | ENT_HTML401))
378 378
 							)
379 379
 					), 500, "...")
380 380
 				)."\"/>\n";
381 381
 
382
-            $rv .= "</head>";
382
+			$rv .= "</head>";
383 383
 
384
-            list ($og_image, $og_stream) = Article::get_article_image($enclosures, $line['content'], $line["site_url"]);
384
+			list ($og_image, $og_stream) = Article::get_article_image($enclosures, $line['content'], $line["site_url"]);
385 385
 
386
-            if ($og_image) {
387
-                $rv .= "<meta property='og:image' content=\"" . htmlspecialchars($og_image) . "\"/>";
388
-            }
386
+			if ($og_image) {
387
+				$rv .= "<meta property='og:image' content=\"" . htmlspecialchars($og_image) . "\"/>";
388
+			}
389 389
 
390
-            $rv .= "<body class='flat ttrss_utility ttrss_zoom'>";
391
-            $rv .= "<div class='container'>";
390
+			$rv .= "<body class='flat ttrss_utility ttrss_zoom'>";
391
+			$rv .= "<div class='container'>";
392 392
 
393 393
 			if ($line["link"]) {
394 394
 				$rv .= "<h1><a target='_blank' rel='noopener noreferrer'
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 				$owner_uid, true);
411 411
 
412 412
 			$rv .= "<div>".$line['author']."</div>";
413
-            $rv .= "<div>$parsed_updated</div>";
413
+			$rv .= "<div>$parsed_updated</div>";
414 414
 
415 415
 			$rv .= "</div>"; # row
416 416
 
@@ -425,10 +425,10 @@  discard block
 block discarded – undo
425 425
 
426 426
 			$rv .= $line["content"];
427 427
 
428
-            $rv .= Article::format_article_enclosures($id,
429
-                $line["always_display_enclosures"],
430
-                $line["content"],
431
-                $line["hide_images"]);
428
+			$rv .= Article::format_article_enclosures($id,
429
+				$line["always_display_enclosures"],
430
+				$line["content"],
431
+				$line["hide_images"]);
432 432
 
433 433
 			$rv .= "</div>"; # content
434 434
 
@@ -675,8 +675,8 @@  discard block
 block discarded – undo
675 675
 					if ($sth->fetch()) {
676 676
 						$_SESSION["profile"] = $profile;
677 677
  					} else {
678
-					    $_SESSION["profile"] = null;
679
-                    }
678
+						$_SESSION["profile"] = null;
679
+					}
680 680
 				}
681 681
 			} else {
682 682
 
Please login to merge, or discard this patch.
Switch Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -760,24 +760,24 @@
 block discarded – undo
760 760
 				$feed_urls = false;
761 761
 
762 762
 				switch ($rc['code']) {
763
-					case 0:
764
-						print_warning(T_sprintf("Already subscribed to <b>%s</b>.", $feed_url));
765
-						break;
766
-					case 1:
767
-						print_notice(T_sprintf("Subscribed to <b>%s</b>.", $feed_url));
768
-						break;
769
-					case 2:
770
-						print_error(T_sprintf("Could not subscribe to <b>%s</b>.", $feed_url));
771
-						break;
772
-					case 3:
773
-						print_error(T_sprintf("No feeds found in <b>%s</b>.", $feed_url));
774
-						break;
775
-					case 4:
776
-						$feed_urls = $rc["feeds"];
777
-						break;
778
-					case 5:
779
-						print_error(T_sprintf("Could not subscribe to <b>%s</b>.<br>Can't download the Feed URL.", $feed_url));
780
-						break;
763
+				case 0:
764
+					print_warning(T_sprintf("Already subscribed to <b>%s</b>.", $feed_url));
765
+					break;
766
+				case 1:
767
+					print_notice(T_sprintf("Subscribed to <b>%s</b>.", $feed_url));
768
+					break;
769
+				case 2:
770
+					print_error(T_sprintf("Could not subscribe to <b>%s</b>.", $feed_url));
771
+					break;
772
+				case 3:
773
+					print_error(T_sprintf("No feeds found in <b>%s</b>.", $feed_url));
774
+					break;
775
+				case 4:
776
+					$feed_urls = $rc["feeds"];
777
+					break;
778
+				case 5:
779
+					print_error(T_sprintf("Could not subscribe to <b>%s</b>.<br>Can't download the Feed URL.", $feed_url));
780
+					break;
781 781
 				}
782 782
 
783 783
 				if ($feed_urls) {
Please login to merge, or discard this patch.
Spacing   +28 added lines, -29 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 
8 8
 		require_once "lib/MiniTemplator.class.php";
9 9
 
10
-		$note_style = 	"background-color : #fff7d5;
10
+		$note_style = "background-color : #fff7d5;
11 11
 			border-width : 1px; ".
12 12
 			"padding : 5px; border-style : dashed; border-color : #e7d796;".
13 13
 			"margin-bottom : 1em; color : #9a8c59;";
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
 		$feed_site_url = $qfh_ret[2];
74 74
 		/* $last_error = $qfh_ret[3]; */
75 75
 
76
-		$feed_self_url = get_self_url_prefix() .
77
-			"/public.php?op=rss&id=$feed&key=" .
76
+		$feed_self_url = get_self_url_prefix().
77
+			"/public.php?op=rss&id=$feed&key=".
78 78
 			Feeds::get_feed_access_key($feed, false, $owner_uid);
79 79
 
80 80
 		if (!$feed_site_url) $feed_site_url = get_self_url_prefix();
@@ -102,8 +102,7 @@  discard block
 block discarded – undo
102 102
 				}
103 103
 
104 104
 				$tpl->setVariable('ARTICLE_ID',
105
-					htmlspecialchars($orig_guid ? $line['link'] :
106
-							$this->make_article_tag_uri($line['id'], $line['date_entered'])), true);
105
+					htmlspecialchars($orig_guid ? $line['link'] : $this->make_article_tag_uri($line['id'], $line['date_entered'])), true);
107 106
 				$tpl->setVariable('ARTICLE_LINK', htmlspecialchars($line['link']), true);
108 107
 				$tpl->setVariable('ARTICLE_TITLE', htmlspecialchars($line['title']), true);
109 108
 				$tpl->setVariable('ARTICLE_EXCERPT', $line["content_preview"], true);
@@ -112,7 +111,7 @@  discard block
 block discarded – undo
112 111
 					$feed_site_url, false, $line["id"]);
113 112
 
114 113
 				if ($line['note']) {
115
-					$content = "<div style=\"$note_style\">Article note: " . $line['note'] . "</div>" .
114
+					$content = "<div style=\"$note_style\">Article note: ".$line['note']."</div>".
116 115
 						$content;
117 116
 					$tpl->setVariable('ARTICLE_NOTE', htmlspecialchars($line['note']), true);
118 117
 				}
@@ -201,7 +200,7 @@  discard block
 block discarded – undo
201 200
 				$article = array();
202 201
 
203 202
 				$article['id'] = $line['link'];
204
-				$article['link']	= $line['link'];
203
+				$article['link'] = $line['link'];
205 204
 				$article['title'] = $line['title'];
206 205
 				$article['excerpt'] = $line["content_preview"];
207 206
 				$article['content'] = sanitize($line["content"], false, $owner_uid, $feed_site_url, false, $line["id"]);
@@ -277,13 +276,13 @@  discard block
 block discarded – undo
277 276
 			WHERE ttrss_users.id = ttrss_settings_profiles.owner_uid AND login = ? ORDER BY title");
278 277
 			$sth->execute([$login]);
279 278
 
280
-			$rv = [ [ "value" => 0, "label" => __("Default profile") ] ];
279
+			$rv = [["value" => 0, "label" => __("Default profile")]];
281 280
 
282 281
 			while ($line = $sth->fetch()) {
283 282
 				$id = $line["id"];
284 283
 				$title = $line["title"];
285 284
 
286
-				array_push($rv, [ "label" => $title, "value" => $id ]);
285
+				array_push($rv, ["label" => $title, "value" => $id]);
287 286
 			}
288 287
 	    }
289 288
 
@@ -384,7 +383,7 @@  discard block
 block discarded – undo
384 383
             list ($og_image, $og_stream) = Article::get_article_image($enclosures, $line['content'], $line["site_url"]);
385 384
 
386 385
             if ($og_image) {
387
-                $rv .= "<meta property='og:image' content=\"" . htmlspecialchars($og_image) . "\"/>";
386
+                $rv .= "<meta property='og:image' content=\"".htmlspecialchars($og_image)."\"/>";
388 387
             }
389 388
 
390 389
             $rv .= "<body class='flat ttrss_utility ttrss_zoom'>";
@@ -393,9 +392,9 @@  discard block
 block discarded – undo
393 392
 			if ($line["link"]) {
394 393
 				$rv .= "<h1><a target='_blank' rel='noopener noreferrer'
395 394
 					title=\"".htmlspecialchars($line['title'])."\"
396
-					href=\"" .htmlspecialchars($line["link"]) . "\">" .	$line["title"] . "</a></h1>";
395
+					href=\"" .htmlspecialchars($line["link"])."\">".$line["title"]."</a></h1>";
397 396
 			} else {
398
-				$rv .= "<h1>" . $line["title"] . "</h1>";
397
+				$rv .= "<h1>".$line["title"]."</h1>";
399 398
 			}
400 399
 
401 400
 			$rv .= "<div class='content post'>";
@@ -448,8 +447,8 @@  discard block
 block discarded – undo
448 447
 		$feed = clean($_REQUEST["id"]);
449 448
 		$key = clean($_REQUEST["key"]);
450 449
 		$is_cat = clean($_REQUEST["is_cat"]);
451
-		$limit = (int)clean($_REQUEST["limit"]);
452
-		$offset = (int)clean($_REQUEST["offset"]);
450
+		$limit = (int) clean($_REQUEST["limit"]);
451
+		$offset = (int) clean($_REQUEST["offset"]);
453 452
 
454 453
 		$search = clean($_REQUEST["q"]);
455 454
 		$view_mode = clean($_REQUEST["view-mode"]);
@@ -692,9 +691,9 @@  discard block
 block discarded – undo
692 691
 			$return = clean($_REQUEST['return']);
693 692
 
694 693
 			if ($_REQUEST['return'] && mb_strpos($return, SELF_URL_PATH) === 0) {
695
-				header("Location: " . clean($_REQUEST['return']));
694
+				header("Location: ".clean($_REQUEST['return']));
696 695
 			} else {
697
-				header("Location: " . get_self_url_prefix());
696
+				header("Location: ".get_self_url_prefix());
698 697
 			}
699 698
 		}
700 699
 	}
@@ -786,7 +785,7 @@  discard block
 block discarded – undo
786 785
 					print "<input type='hidden' name='op' value='subscribe'>";
787 786
 
788 787
 					print "<fieldset>";
789
-					print "<label style='display : inline'>" . __("Multiple feed URLs found:") . "</label>";
788
+					print "<label style='display : inline'>".__("Multiple feed URLs found:")."</label>";
790 789
 					print "<select name='feed_url' dojoType='dijit.form.Select'>";
791 790
 
792 791
 					foreach ($feed_urls as $url => $name) {
@@ -805,9 +804,9 @@  discard block
 block discarded – undo
805 804
 					print "</form>";
806 805
 				}
807 806
 
808
-				$tp_uri = get_self_url_prefix() . "/prefs.php";
807
+				$tp_uri = get_self_url_prefix()."/prefs.php";
809 808
 
810
-				if ($rc['code'] <= 2){
809
+				if ($rc['code'] <= 2) {
811 810
 					$sth = $this->pdo->prepare("SELECT id FROM ttrss_feeds WHERE
812 811
 					feed_url = ? AND owner_uid = ?");
813 812
 					$sth->execute([$feed_url, $_SESSION['uid']]);
@@ -895,7 +894,7 @@  discard block
 block discarded – undo
895 894
 					list($timestamp, $resetpass_token) = explode(":", $resetpass_token_full);
896 895
 
897 896
 					if ($timestamp && $resetpass_token &&
898
-						$timestamp >= time() - 15*60*60 &&
897
+						$timestamp >= time() - 15 * 60 * 60 &&
899 898
 						$resetpass_token == $hash) {
900 899
 
901 900
 							$sth = $this->pdo->prepare("UPDATE ttrss_users SET resetpass_token = NULL
@@ -935,8 +934,8 @@  discard block
 block discarded – undo
935 934
 				<input dojoType='dijit.form.TextBox' type='email' name='email' value='' required>
936 935
 				</fieldset>";
937 936
 
938
-			$_SESSION["pwdreset:testvalue1"] = rand(1,10);
939
-			$_SESSION["pwdreset:testvalue2"] = rand(1,10);
937
+			$_SESSION["pwdreset:testvalue1"] = rand(1, 10);
938
+			$_SESSION["pwdreset:testvalue2"] = rand(1, 10);
940 939
 
941 940
 			print "<fieldset>
942 941
 				<label>".T_sprintf("How much is %d + %d:", $_SESSION["pwdreset:testvalue1"], $_SESSION["pwdreset:testvalue2"])."</label>
@@ -981,8 +980,8 @@  discard block
 block discarded – undo
981 980
 
982 981
 					if ($id) {
983 982
 						$resetpass_token = sha1(get_random_bytes(128));
984
-						$resetpass_link = get_self_url_prefix() . "/public.php?op=forgotpass&hash=" . $resetpass_token .
985
-							"&login=" . urlencode($login);
983
+						$resetpass_link = get_self_url_prefix()."/public.php?op=forgotpass&hash=".$resetpass_token.
984
+							"&login=".urlencode($login);
986 985
 
987 986
 						require_once "lib/MiniTemplator.class.php";
988 987
 
@@ -1009,7 +1008,7 @@  discard block
 block discarded – undo
1009 1008
 
1010 1009
 						if (!$rc) print_error($mailer->error());
1011 1010
 
1012
-						$resetpass_token_full = time() . ":" . $resetpass_token;
1011
+						$resetpass_token_full = time().":".$resetpass_token;
1013 1012
 
1014 1013
 						$sth = $this->pdo->prepare("UPDATE ttrss_users
1015 1014
 							SET resetpass_token = ?
@@ -1099,12 +1098,12 @@  discard block
 block discarded – undo
1099 1098
 				if ($op == "performupdate") {
1100 1099
 					if ($updater->isUpdateRequired()) {
1101 1100
 
1102
-						print "<h2>" . T_sprintf("Performing updates to version %d", SCHEMA_VERSION) . "</h2>";
1101
+						print "<h2>".T_sprintf("Performing updates to version %d", SCHEMA_VERSION)."</h2>";
1103 1102
 
1104 1103
 						for ($i = $updater->getSchemaVersion() + 1; $i <= SCHEMA_VERSION; $i++) {
1105 1104
 							print "<ul>";
1106 1105
 
1107
-							print "<li class='text-info'>" . T_sprintf("Updating to version %d", $i) . "</li>";
1106
+							print "<li class='text-info'>".T_sprintf("Updating to version %d", $i)."</li>";
1108 1107
 
1109 1108
 							print "<li>";
1110 1109
 							$result = $updater->performUpdateTo($i, true);
@@ -1123,7 +1122,7 @@  discard block
 block discarded – undo
1123 1122
 
1124 1123
 								return;
1125 1124
 							} else {
1126
-								print "<li class='text-success'>" . __("Completed.") . "</li>";
1125
+								print "<li class='text-success'>".__("Completed.")."</li>";
1127 1126
 								print "</ul>";
1128 1127
 							}
1129 1128
 						}
@@ -1191,7 +1190,7 @@  discard block
 block discarded – undo
1191 1190
 
1192 1191
 		$timestamp = date("Y-m-d", strtotime($timestamp));
1193 1192
 
1194
-		return "tag:" . parse_url(get_self_url_prefix(), PHP_URL_HOST) . ",$timestamp:/$id";
1193
+		return "tag:".parse_url(get_self_url_prefix(), PHP_URL_HOST).",$timestamp:/$id";
1195 1194
 	}
1196 1195
 
1197 1196
 	// this should be used very carefully because this endpoint is exposed to unauthenticated users
Please login to merge, or discard this patch.
Braces   +24 added lines, -10 removed lines patch added patch discarded remove patch
@@ -12,7 +12,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
classes/feedparser.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
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)) //currently only the first error is reported
30 30
 						$this->error = $this->format_error($error);
31 31
 					$this->libxml_errors [] = $this->format_error($error);
32 32
 				}
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 					$this->type = $this::FEED_ATOM;
70 70
 					break;
71 71
 				default:
72
-					if( !isset($this->error) ){
72
+					if (!isset($this->error)) {
73 73
 						$this->error = "Unknown/unsupported feed type";
74 74
 					}
75 75
 					return;
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 			if ($this->link) $this->link = trim($this->link);
167 167
 
168 168
 		} else {
169
-			if( !isset($this->error) ){
169
+			if (!isset($this->error)) {
170 170
 				$this->error = "Unknown/unsupported feed type";
171 171
 			}
172 172
 			return;
Please login to merge, or discard this patch.
Braces   +29 added lines, -17 removed lines patch added patch discarded remove patch
@@ -26,8 +26,10 @@  discard block
 block discarded – undo
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
 			}
@@ -81,8 +83,9 @@  discard block
 block discarded – undo
81 83
 
82 84
 				$title = $xpath->query("//atom:feed/atom:title")->item(0);
83 85
 
84
-				if (!$title)
85
-					$title = $xpath->query("//atom03:feed/atom03:title")->item(0);
86
+				if (!$title) {
87
+									$title = $xpath->query("//atom03:feed/atom03:title")->item(0);
88
+				}
86 89
 
87 90
 
88 91
 				if ($title) {
@@ -91,14 +94,17 @@  discard block
 block discarded – undo
91 94
 
92 95
 				$link = $xpath->query("//atom:feed/atom:link[not(@rel)]")->item(0);
93 96
 
94
-				if (!$link)
95
-					$link = $xpath->query("//atom:feed/atom:link[@rel='alternate']")->item(0);
97
+				if (!$link) {
98
+									$link = $xpath->query("//atom:feed/atom:link[@rel='alternate']")->item(0);
99
+				}
96 100
 
97
-				if (!$link)
98
-					$link = $xpath->query("//atom03:feed/atom03:link[not(@rel)]")->item(0);
101
+				if (!$link) {
102
+									$link = $xpath->query("//atom03:feed/atom03:link[not(@rel)]")->item(0);
103
+				}
99 104
 
100
-				if (!$link)
101
-					$link = $xpath->query("//atom03:feed/atom03:link[@rel='alternate']")->item(0);
105
+				if (!$link) {
106
+									$link = $xpath->query("//atom03:feed/atom03:link[@rel='alternate']")->item(0);
107
+				}
102 108
 
103 109
 				if ($link && $link->hasAttributes()) {
104 110
 					$this->link = $link->getAttribute("href");
@@ -106,8 +112,9 @@  discard block
 block discarded – undo
106 112
 
107 113
 				$articles = $xpath->query("//atom:entry");
108 114
 
109
-				if (!$articles || $articles->length == 0)
110
-					$articles = $xpath->query("//atom03:entry");
115
+				if (!$articles || $articles->length == 0) {
116
+									$articles = $xpath->query("//atom03:entry");
117
+				}
111 118
 
112 119
 				foreach ($articles as $article) {
113 120
 					array_push($this->items, new FeedItem_Atom($article, $this->doc, $this->xpath));
@@ -124,10 +131,11 @@  discard block
 block discarded – undo
124 131
 				$link = $xpath->query("//channel/link")->item(0);
125 132
 
126 133
 				if ($link) {
127
-					if ($link->getAttribute("href"))
128
-						$this->link = $link->getAttribute("href");
129
-					else if ($link->nodeValue)
130
-						$this->link = $link->nodeValue;
134
+					if ($link->getAttribute("href")) {
135
+											$this->link = $link->getAttribute("href");
136
+					} else if ($link->nodeValue) {
137
+											$this->link = $link->nodeValue;
138
+					}
131 139
 				}
132 140
 
133 141
 				$articles = $xpath->query("//channel/item");
@@ -162,8 +170,12 @@  discard block
 block discarded – undo
162 170
 
163 171
 			}
164 172
 
165
-			if ($this->title) $this->title = trim($this->title);
166
-			if ($this->link) $this->link = trim($this->link);
173
+			if ($this->title) {
174
+				$this->title = trim($this->title);
175
+			}
176
+			if ($this->link) {
177
+				$this->link = trim($this->link);
178
+			}
167 179
 
168 180
 		} else {
169 181
 			if( !isset($this->error) ){
Please login to merge, or discard this patch.
classes/opml.php 3 patches
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -202,36 +202,36 @@  discard block
 block discarded – undo
202 202
 					$cat_filter = $tmp_line["cat_filter"];
203 203
 
204 204
 					if (!$tmp_line["match_on"]) {
205
-                        if ($cat_filter && $tmp_line["cat_id"] || $tmp_line["feed_id"]) {
206
-                            $tmp_line["feed"] = Feeds::getFeedTitle(
207
-                                $cat_filter ? $tmp_line["cat_id"] : $tmp_line["feed_id"],
208
-                                $cat_filter);
209
-                        } else {
210
-                            $tmp_line["feed"] = "";
211
-                        }
212
-                    } else {
213
-					    $match = [];
214
-					    foreach (json_decode($tmp_line["match_on"], true) as $feed_id) {
215
-
216
-                            if (strpos($feed_id, "CAT:") === 0) {
217
-                                $feed_id = (int)substr($feed_id, 4);
218
-                                if ($feed_id) {
219
-                                    array_push($match, [Feeds::getCategoryTitle($feed_id), true, false]);
220
-                                } else {
221
-                                    array_push($match, [0, true, true]);
222
-                                }
223
-                            } else {
224
-                                if ($feed_id) {
225
-                                    array_push($match, [Feeds::getFeedTitle((int)$feed_id), false, false]);
226
-                                } else {
227
-                                    array_push($match, [0, false, true]);
228
-                                }
229
-                            }
230
-                        }
231
-
232
-                        $tmp_line["match"] = $match;
233
-					    unset($tmp_line["match_on"]);
234
-                    }
205
+						if ($cat_filter && $tmp_line["cat_id"] || $tmp_line["feed_id"]) {
206
+							$tmp_line["feed"] = Feeds::getFeedTitle(
207
+								$cat_filter ? $tmp_line["cat_id"] : $tmp_line["feed_id"],
208
+								$cat_filter);
209
+						} else {
210
+							$tmp_line["feed"] = "";
211
+						}
212
+					} else {
213
+						$match = [];
214
+						foreach (json_decode($tmp_line["match_on"], true) as $feed_id) {
215
+
216
+							if (strpos($feed_id, "CAT:") === 0) {
217
+								$feed_id = (int)substr($feed_id, 4);
218
+								if ($feed_id) {
219
+									array_push($match, [Feeds::getCategoryTitle($feed_id), true, false]);
220
+								} else {
221
+									array_push($match, [0, true, true]);
222
+								}
223
+							} else {
224
+								if ($feed_id) {
225
+									array_push($match, [Feeds::getFeedTitle((int)$feed_id), false, false]);
226
+								} else {
227
+									array_push($match, [0, false, true]);
228
+								}
229
+							}
230
+						}
231
+
232
+						$tmp_line["match"] = $match;
233
+						unset($tmp_line["match_on"]);
234
+					}
235 235
 
236 236
 					unset($tmp_line["feed_id"]);
237 237
 					unset($tmp_line["cat_id"]);
@@ -403,28 +403,28 @@  discard block
 block discarded – undo
403 403
 
404 404
 						if ($rule["match"]) {
405 405
 
406
-                            $match_on = [];
406
+							$match_on = [];
407 407
 
408
-						    foreach ($rule["match"] as $match) {
409
-						        list ($name, $is_cat, $is_id) = $match;
408
+							foreach ($rule["match"] as $match) {
409
+								list ($name, $is_cat, $is_id) = $match;
410 410
 
411
-						        if ($is_id) {
412
-						            array_push($match_on, ($is_cat ? "CAT:" : "") . $name);
413
-                                } else {
411
+								if ($is_id) {
412
+									array_push($match_on, ($is_cat ? "CAT:" : "") . $name);
413
+								} else {
414 414
 
415
-                                    if (!$is_cat) {
416
-                                        $tsth = $this->pdo->prepare("SELECT id FROM ttrss_feeds
415
+									if (!$is_cat) {
416
+										$tsth = $this->pdo->prepare("SELECT id FROM ttrss_feeds
417 417
                                     		WHERE title = ? AND owner_uid = ?");
418 418
 
419
-                                        $tsth->execute([$name, $_SESSION['uid']]);
419
+										$tsth->execute([$name, $_SESSION['uid']]);
420 420
 
421
-                                        if ($row = $tsth->fetch()) {
422
-                                            $match_id = $row['id'];
421
+										if ($row = $tsth->fetch()) {
422
+											$match_id = $row['id'];
423 423
 
424 424
 											array_push($match_on, $match_id);
425
-                                        }
426
-                                    } else {
427
-                                        $tsth = $this->pdo->prepare("SELECT id FROM ttrss_feed_categories
425
+										}
426
+									} else {
427
+										$tsth = $this->pdo->prepare("SELECT id FROM ttrss_feed_categories
428 428
                                     		WHERE title = ? AND owner_uid = ?");
429 429
 										$tsth->execute([$name, $_SESSION['uid']]);
430 430
 
@@ -433,33 +433,33 @@  discard block
 block discarded – undo
433 433
 
434 434
 											array_push($match_on, "CAT:$match_id");
435 435
 										}
436
-                                    }
437
-                                }
438
-                            }
436
+									}
437
+								}
438
+							}
439 439
 
440
-                            $reg_exp = $rule["reg_exp"];
441
-                            $filter_type = (int)$rule["filter_type"];
442
-                            $inverse = bool_to_sql_bool($rule["inverse"]);
443
-                            $match_on = json_encode($match_on);
440
+							$reg_exp = $rule["reg_exp"];
441
+							$filter_type = (int)$rule["filter_type"];
442
+							$inverse = bool_to_sql_bool($rule["inverse"]);
443
+							$match_on = json_encode($match_on);
444 444
 
445
-                            $usth = $this->pdo->prepare("INSERT INTO ttrss_filters2_rules
445
+							$usth = $this->pdo->prepare("INSERT INTO ttrss_filters2_rules
446 446
 								(feed_id,cat_id,match_on,filter_id,filter_type,reg_exp,cat_filter,inverse)
447 447
                                 VALUES
448 448
                                 (NULL, NULL, ?, ?, ?, ?, false, ?)");
449
-                            $usth->execute([$match_on, $filter_id, $filter_type, $reg_exp, $inverse]);
449
+							$usth->execute([$match_on, $filter_id, $filter_type, $reg_exp, $inverse]);
450 450
 
451
-                        } else {
451
+						} else {
452 452
 
453
-                            if (!$rule["cat_filter"]) {
454
-                                $tsth = $this->pdo->prepare("SELECT id FROM ttrss_feeds
453
+							if (!$rule["cat_filter"]) {
454
+								$tsth = $this->pdo->prepare("SELECT id FROM ttrss_feeds
455 455
                                     WHERE title = ? AND owner_uid = ?");
456 456
 
457
-                                $tsth->execute([$rule['feed'], $_SESSION['uid']]);
457
+								$tsth->execute([$rule['feed'], $_SESSION['uid']]);
458 458
 
459
-                                if ($row = $tsth->fetch()) {
460
-                                    $feed_id = $row['id'];
461
-                                }
462
-                            } else {
459
+								if ($row = $tsth->fetch()) {
460
+									$feed_id = $row['id'];
461
+								}
462
+							} else {
463 463
 								$tsth = $this->pdo->prepare("SELECT id FROM ttrss_feed_categories
464 464
                                     WHERE title = ? AND owner_uid = ?");
465 465
 
@@ -468,19 +468,19 @@  discard block
 block discarded – undo
468 468
 								if ($row = $tsth->fetch()) {
469 469
 									$feed_id = $row['id'];
470 470
 								}
471
-                            }
471
+							}
472 472
 
473
-                            $cat_filter = bool_to_sql_bool($rule["cat_filter"]);
474
-                            $reg_exp = $rule["reg_exp"];
475
-                            $filter_type = (int)$rule["filter_type"];
476
-                            $inverse = bool_to_sql_bool($rule["inverse"]);
473
+							$cat_filter = bool_to_sql_bool($rule["cat_filter"]);
474
+							$reg_exp = $rule["reg_exp"];
475
+							$filter_type = (int)$rule["filter_type"];
476
+							$inverse = bool_to_sql_bool($rule["inverse"]);
477 477
 
478
-                            $usth = $this->pdo->prepare("INSERT INTO ttrss_filters2_rules
478
+							$usth = $this->pdo->prepare("INSERT INTO ttrss_filters2_rules
479 479
 								(feed_id,cat_id,filter_id,filter_type,reg_exp,cat_filter,inverse)
480 480
                                 VALUES
481 481
                                 (?, ?, ?, ?, ?, ?, ?)");
482
-                            $usth->execute([$feed_id, $cat_id, $filter_id, $filter_type, $reg_exp, $cat_filter, $inverse]);
483
-                        }
482
+							$usth->execute([$feed_id, $cat_id, $filter_id, $filter_type, $reg_exp, $cat_filter, $inverse]);
483
+						}
484 484
 					}
485 485
 
486 486
 					foreach ($filter["actions"] as $action) {
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 			$cat_title = htmlspecialchars($row['title']);
71 71
 
72 72
 			if ($include_settings) {
73
-				$order_id = (int)$row["order_id"];
73
+				$order_id = (int) $row["order_id"];
74 74
 				$ttrss_specific_qpart = "ttrssSortOrder=\"$order_id\"";
75 75
 			}
76 76
 		} else {
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
 			$site_url = htmlspecialchars($fline["site_url"]);
104 104
 
105 105
 			if ($include_settings) {
106
-				$update_interval = (int)$fline["update_interval"];
107
-				$order_id = (int)$fline["order_id"];
106
+				$update_interval = (int) $fline["update_interval"];
107
+				$order_id = (int) $fline["order_id"];
108 108
 
109 109
 				$ttrss_specific_qpart = "ttrssSortOrder=\"$order_id\" ttrssUpdateInterval=\"$update_interval\"";
110 110
 			} else {
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 
131 131
 		if (!isset($_REQUEST["debug"])) {
132 132
 			header("Content-type: application/xml+opml");
133
-			header("Content-Disposition: attachment; filename=" . $name );
133
+			header("Content-Disposition: attachment; filename=".$name);
134 134
 		} else {
135 135
 			header("Content-type: text/xml");
136 136
 		}
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 
140 140
 		$out .= "<opml version=\"1.0\">";
141 141
 		$out .= "<head>
142
-			<dateCreated>" . date("r", time()) . "</dateCreated>
142
+			<dateCreated>" . date("r", time())."</dateCreated>
143 143
 			<title>Tiny Tiny RSS Feed Export</title>
144 144
 		</head>";
145 145
 		$out .= "<body>";
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 					    foreach (json_decode($tmp_line["match_on"], true) as $feed_id) {
215 215
 
216 216
                             if (strpos($feed_id, "CAT:") === 0) {
217
-                                $feed_id = (int)substr($feed_id, 4);
217
+                                $feed_id = (int) substr($feed_id, 4);
218 218
                                 if ($feed_id) {
219 219
                                     array_push($match, [Feeds::getCategoryTitle($feed_id), true, false]);
220 220
                                 } else {
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
                                 }
223 223
                             } else {
224 224
                                 if ($feed_id) {
225
-                                    array_push($match, [Feeds::getFeedTitle((int)$feed_id), false, false]);
225
+                                    array_push($match, [Feeds::getFeedTitle((int) $feed_id), false, false]);
226 226
                                 } else {
227 227
                                     array_push($match, [0, false, true]);
228 228
                                 }
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
 						        list ($name, $is_cat, $is_id) = $match;
410 410
 
411 411
 						        if ($is_id) {
412
-						            array_push($match_on, ($is_cat ? "CAT:" : "") . $name);
412
+						            array_push($match_on, ($is_cat ? "CAT:" : "").$name);
413 413
                                 } else {
414 414
 
415 415
                                     if (!$is_cat) {
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
                             }
439 439
 
440 440
                             $reg_exp = $rule["reg_exp"];
441
-                            $filter_type = (int)$rule["filter_type"];
441
+                            $filter_type = (int) $rule["filter_type"];
442 442
                             $inverse = bool_to_sql_bool($rule["inverse"]);
443 443
                             $match_on = json_encode($match_on);
444 444
 
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 
473 473
                             $cat_filter = bool_to_sql_bool($rule["cat_filter"]);
474 474
                             $reg_exp = $rule["reg_exp"];
475
-                            $filter_type = (int)$rule["filter_type"];
475
+                            $filter_type = (int) $rule["filter_type"];
476 476
                             $inverse = bool_to_sql_bool($rule["inverse"]);
477 477
 
478 478
                             $usth = $this->pdo->prepare("INSERT INTO ttrss_filters2_rules
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
 
486 486
 					foreach ($filter["actions"] as $action) {
487 487
 
488
-						$action_id = (int)$action["action_id"];
488
+						$action_id = (int) $action["action_id"];
489 489
 						$action_param = $action["action_param"];
490 490
 
491 491
 						$usth = $this->pdo->prepare("INSERT INTO ttrss_filters2_actions
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
 		}
586 586
 
587 587
 		if (is_uploaded_file($_FILES['opml_file']['tmp_name'])) {
588
-			$tmp_file = tempnam(CACHE_DIR . '/upload', 'opml');
588
+			$tmp_file = tempnam(CACHE_DIR.'/upload', 'opml');
589 589
 
590 590
 			$result = move_uploaded_file($_FILES['opml_file']['tmp_name'],
591 591
 				$tmp_file);
@@ -623,10 +623,10 @@  discard block
 block discarded – undo
623 623
 		print "$msg<br/>";
624 624
 	}
625 625
 
626
-	static function opml_publish_url(){
626
+	static function opml_publish_url() {
627 627
 
628 628
 		$url_path = get_self_url_prefix();
629
-		$url_path .= "/opml.php?op=publish&key=" .
629
+		$url_path .= "/opml.php?op=publish&key=".
630 630
 			Feeds::get_feed_access_key('OPML:Publish', false, $_SESSION["uid"]);
631 631
 
632 632
 		return $url_path;
Please login to merge, or discard this patch.
Braces   +47 added lines, -21 removed lines patch added patch discarded remove patch
@@ -52,10 +52,11 @@  discard block
 block discarded – undo
52 52
 
53 53
 		$cat_id = (int) $cat_id;
54 54
 
55
-		if ($hide_private_feeds)
56
-			$hide_qpart = "(private IS false AND auth_login = '' AND auth_pass = '')";
57
-		else
58
-			$hide_qpart = "true";
55
+		if ($hide_private_feeds) {
56
+					$hide_qpart = "(private IS false AND auth_login = '' AND auth_pass = '')";
57
+		} else {
58
+					$hide_qpart = "true";
59
+		}
59 60
 
60 61
 		$out = "";
61 62
 
@@ -77,7 +78,9 @@  discard block
 block discarded – undo
77 78
 			$cat_title = "";
78 79
 		}
79 80
 
80
-		if ($cat_title) $out .= "<outline text=\"$cat_title\" $ttrss_specific_qpart>\n";
81
+		if ($cat_title) {
82
+			$out .= "<outline text=\"$cat_title\" $ttrss_specific_qpart>\n";
83
+		}
81 84
 
82 85
 		$sth = $this->pdo->prepare("SELECT id,title
83 86
 			FROM ttrss_feed_categories WHERE
@@ -120,13 +123,17 @@  discard block
 block discarded – undo
120 123
 			$out .= "<outline type=\"rss\" text=\"$title\" xmlUrl=\"$url\" $ttrss_specific_qpart $html_url_qpart/>\n";
121 124
 		}
122 125
 
123
-		if ($cat_title) $out .= "</outline>\n";
126
+		if ($cat_title) {
127
+			$out .= "</outline>\n";
128
+		}
124 129
 
125 130
 		return $out;
126 131
 	}
127 132
 
128 133
 	function opml_export($name, $owner_uid, $hide_private_feeds = false, $include_settings = true) {
129
-		if (!$owner_uid) return;
134
+		if (!$owner_uid) {
135
+			return;
136
+		}
130 137
 
131 138
 		if (!isset($_REQUEST["debug"])) {
132 139
 			header("Content-type: application/xml+opml");
@@ -275,8 +282,9 @@  discard block
 block discarded – undo
275 282
 
276 283
 		// cleanup empty categories
277 284
 		foreach ($outlines as $node) {
278
-			if ($node->getElementsByTagName('outline')->length == 0)
279
-				$node->parentNode->removeChild($node);
285
+			if ($node->getElementsByTagName('outline')->length == 0) {
286
+							$node->parentNode->removeChild($node);
287
+			}
280 288
 		}
281 289
 
282 290
 		$res = $doc->saveXML();
@@ -297,10 +305,14 @@  discard block
 block discarded – undo
297 305
 		$attrs = $node->attributes;
298 306
 
299 307
 		$feed_title = mb_substr($attrs->getNamedItem('text')->nodeValue, 0, 250);
300
-		if (!$feed_title) $feed_title = mb_substr($attrs->getNamedItem('title')->nodeValue, 0, 250);
308
+		if (!$feed_title) {
309
+			$feed_title = mb_substr($attrs->getNamedItem('title')->nodeValue, 0, 250);
310
+		}
301 311
 
302 312
 		$feed_url = $attrs->getNamedItem('xmlUrl')->nodeValue;
303
-		if (!$feed_url) $feed_url = $attrs->getNamedItem('xmlURL')->nodeValue;
313
+		if (!$feed_url) {
314
+			$feed_url = $attrs->getNamedItem('xmlURL')->nodeValue;
315
+		}
304 316
 
305 317
 		$site_url = mb_substr($attrs->getNamedItem('htmlUrl')->nodeValue, 0, 250);
306 318
 
@@ -309,19 +321,27 @@  discard block
 block discarded – undo
309 321
 				feed_url = ? AND owner_uid = ?");
310 322
 			$sth->execute([$feed_url, $owner_uid]);
311 323
 
312
-			if (!$feed_title) $feed_title = '[Unknown]';
324
+			if (!$feed_title) {
325
+				$feed_title = '[Unknown]';
326
+			}
313 327
 
314 328
 			if (!$sth->fetch()) {
315 329
 				#$this->opml_notice("[FEED] [$feed_title/$feed_url] dst_CAT=$cat_id");
316 330
 				$this->opml_notice(T_sprintf("Adding feed: %s", $feed_title == '[Unknown]' ? $feed_url : $feed_title));
317 331
 
318
-				if (!$cat_id) $cat_id = null;
332
+				if (!$cat_id) {
333
+					$cat_id = null;
334
+				}
319 335
 
320 336
 				$update_interval = (int) $attrs->getNamedItem('ttrssUpdateInterval')->nodeValue;
321
-				if (!$update_interval) $update_interval = 0;
337
+				if (!$update_interval) {
338
+					$update_interval = 0;
339
+				}
322 340
 
323 341
 				$order_id = (int) $attrs->getNamedItem('ttrssSortOrder')->nodeValue;
324
-				if (!$order_id) $order_id = 0;
342
+				if (!$order_id) {
343
+					$order_id = 0;
344
+				}
325 345
 
326 346
 				$sth = $this->pdo->prepare("INSERT INTO ttrss_feeds
327 347
 					(title, feed_url, owner_uid, cat_id, site_url, order_id, update_interval) VALUES
@@ -505,15 +525,18 @@  discard block
 block discarded – undo
505 525
 		if ($root_node) {
506 526
 			$cat_title = mb_substr($root_node->attributes->getNamedItem('text')->nodeValue, 0, 250);
507 527
 
508
-			if (!$cat_title)
509
-				$cat_title = mb_substr($root_node->attributes->getNamedItem('title')->nodeValue, 0, 250);
528
+			if (!$cat_title) {
529
+							$cat_title = mb_substr($root_node->attributes->getNamedItem('title')->nodeValue, 0, 250);
530
+			}
510 531
 
511 532
 			if (!in_array($cat_title, array("tt-rss-filters", "tt-rss-labels", "tt-rss-prefs"))) {
512 533
 				$cat_id = $this->get_feed_category($cat_title, $parent_id);
513 534
 
514 535
 				if ($cat_id === false) {
515 536
 					$order_id = (int) $root_node->attributes->getNamedItem('ttrssSortOrder')->nodeValue;
516
-					if (!$order_id) $order_id = 0;
537
+					if (!$order_id) {
538
+						$order_id = 0;
539
+					}
517 540
 
518 541
 					Feeds::add_feed_category($cat_title, $parent_id, $order_id);
519 542
 					$cat_id = $this->get_feed_category($cat_title, $parent_id);
@@ -540,8 +563,9 @@  discard block
 block discarded – undo
540 563
 				$attrs = $node->attributes;
541 564
 				$node_cat_title = $attrs->getNamedItem('text')->nodeValue;
542 565
 
543
-				if (!$node_cat_title)
544
-					$node_cat_title = $attrs->getNamedItem('title')->nodeValue;
566
+				if (!$node_cat_title) {
567
+									$node_cat_title = $attrs->getNamedItem('title')->nodeValue;
568
+				}
545 569
 
546 570
 				$node_feed_url = $attrs->getNamedItem('xmlUrl')->nodeValue;
547 571
 
@@ -574,7 +598,9 @@  discard block
 block discarded – undo
574 598
 	}
575 599
 
576 600
 	function opml_import($owner_uid) {
577
-		if (!$owner_uid) return;
601
+		if (!$owner_uid) {
602
+			return;
603
+		}
578 604
 
579 605
 		$doc = false;
580 606
 
Please login to merge, or discard this patch.
classes/counters.php 1 patch
Braces   +20 added lines, -14 removed lines patch added patch discarded remove patch
@@ -95,10 +95,11 @@  discard block
 block discarded – undo
95 95
 
96 96
 			$count = getFeedUnread($i);
97 97
 
98
-			if ($i == 0 || $i == -1 || $i == -2)
99
-				$auxctr = Feeds::getFeedArticles($i, false);
100
-			else
101
-				$auxctr = 0;
98
+			if ($i == 0 || $i == -1 || $i == -2) {
99
+							$auxctr = Feeds::getFeedArticles($i, false);
100
+			} else {
101
+							$auxctr = 0;
102
+			}
102 103
 
103 104
 			$cv = array("id" => $i,
104 105
 				"counter" => (int) $count,
@@ -117,8 +118,9 @@  discard block
 block discarded – undo
117 118
 				$cv = array("id" => PluginHost::pfeed_to_feed_id($feed['id']),
118 119
 					"counter" => $feed['sender']->get_unread($feed['id']));
119 120
 
120
-				if (method_exists($feed['sender'], 'get_total'))
121
-					$cv["auxcounter"] = $feed['sender']->get_total($feed['id']);
121
+				if (method_exists($feed['sender'], 'get_total')) {
122
+									$cv["auxcounter"] = $feed['sender']->get_total($feed['id']);
123
+				}
122 124
 
123 125
 				array_push($ret_arr, $cv);
124 126
 			}
@@ -150,8 +152,9 @@  discard block
 block discarded – undo
150 152
 				"counter" => (int) $line["unread"],
151 153
 				"auxcounter" => (int) $line["total"]);
152 154
 
153
-			if ($descriptions)
154
-				$cv["description"] = $line["caption"];
155
+			if ($descriptions) {
156
+							$cv["description"] = $line["caption"];
157
+			}
155 158
 
156 159
 			array_push($ret_arr, $cv);
157 160
 		}
@@ -189,22 +192,25 @@  discard block
 block discarded – undo
189 192
 				$has_img = false;
190 193
 			}
191 194
 
192
-			if (date('Y') - date('Y', strtotime($line['last_updated'])) > 2)
193
-				$last_updated = '';
195
+			if (date('Y') - date('Y', strtotime($line['last_updated'])) > 2) {
196
+							$last_updated = '';
197
+			}
194 198
 
195 199
 			$cv = array("id" => $id,
196 200
 				"updated" => $last_updated,
197 201
 				"counter" => (int) $count,
198 202
 				"has_img" => (int) $has_img);
199 203
 
200
-			if ($last_error)
201
-				$cv["error"] = $last_error;
204
+			if ($last_error) {
205
+							$cv["error"] = $last_error;
206
+			}
202 207
 
203 208
 //			if (get_pref('EXTENDED_FEEDLIST'))
204 209
 //				$cv["xmsg"] = getFeedArticles($id)." ".__("total");
205 210
 
206
-			if ($active_feed && $id == $active_feed)
207
-				$cv["title"] = truncate_string($line["title"], 30);
211
+			if ($active_feed && $id == $active_feed) {
212
+							$cv["title"] = truncate_string($line["title"], 30);
213
+			}
208 214
 
209 215
 			array_push($ret_arr, $cv);
210 216
 
Please login to merge, or discard this patch.
classes/article.php 3 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 		$sth = $this->pdo->prepare("SELECT link FROM ttrss_entries, ttrss_user_entries
14 14
 						WHERE id = ? AND id = ref_id AND owner_uid = ?
15 15
 						LIMIT 1");
16
-        $sth->execute([$id, $_SESSION['uid']]);
16
+		$sth->execute([$id, $_SESSION['uid']]);
17 17
 
18 18
 		if ($row = $sth->fetch()) {
19 19
 			$article_url = $row['link'];
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 
140 140
 			$sth = $pdo->prepare("SELECT int_id FROM ttrss_user_entries WHERE
141 141
 				ref_id = ? AND owner_uid = ? LIMIT 1");
142
-            $sth->execute([$ref_id, $owner_uid]);
142
+			$sth->execute([$ref_id, $owner_uid]);
143 143
 
144 144
 			if ($row = $sth->fetch()) {
145 145
 				$int_id = $row['int_id'];
@@ -678,22 +678,22 @@  discard block
 block discarded – undo
678 678
 
679 679
 	static function purge_orphans() {
680 680
 
681
-        // purge orphaned posts in main content table
681
+		// purge orphaned posts in main content table
682 682
 
683
-        if (DB_TYPE == "mysql")
684
-            $limit_qpart = "LIMIT 5000";
685
-        else
686
-            $limit_qpart = "";
683
+		if (DB_TYPE == "mysql")
684
+			$limit_qpart = "LIMIT 5000";
685
+		else
686
+			$limit_qpart = "";
687 687
 
688
-        $pdo = Db::pdo();
689
-        $res = $pdo->query("DELETE FROM ttrss_entries WHERE
688
+		$pdo = Db::pdo();
689
+		$res = $pdo->query("DELETE FROM ttrss_entries WHERE
690 690
 			NOT EXISTS (SELECT ref_id FROM ttrss_user_entries WHERE ref_id = id) $limit_qpart");
691 691
 
692
-        if (Debug::enabled()) {
693
-            $rows = $res->rowCount();
694
-            Debug::log("Purged $rows orphaned posts.");
695
-        }
696
-    }
692
+		if (Debug::enabled()) {
693
+			$rows = $res->rowCount();
694
+			Debug::log("Purged $rows orphaned posts.");
695
+		}
696
+	}
697 697
 
698 698
 	static function catchupArticlesById($ids, $cmode, $owner_uid = false) {
699 699
 
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	static function create_published_article($title, $url, $content, $labels_str,
94 94
 			$owner_uid) {
95 95
 
96
-		$guid = 'SHA1:' . sha1("ttshared:" . $url . $owner_uid); // include owner_uid to prevent global GUID clash
96
+		$guid = 'SHA1:'.sha1("ttshared:".$url.$owner_uid); // include owner_uid to prevent global GUID clash
97 97
 
98 98
 		if (!$content) {
99 99
 			$pluginhost = new PluginHost();
@@ -148,12 +148,12 @@  discard block
 block discarded – undo
148 148
 					content = ?, content_hash = ? WHERE id = ?");
149 149
 				$sth->execute([$content, $content_hash, $ref_id]);
150 150
 
151
-				if (DB_TYPE == "pgsql"){
151
+				if (DB_TYPE == "pgsql") {
152 152
 					$sth = $pdo->prepare("UPDATE ttrss_entries
153 153
 					SET tsvector_combined = to_tsvector( :ts_content)
154 154
 					WHERE id = :id");
155 155
 					$params = [
156
-						":ts_content" => mb_substr(strip_tags($content ), 0, 900000),
156
+						":ts_content" => mb_substr(strip_tags($content), 0, 900000),
157 157
 						":id" => $ref_id];
158 158
 					$sth->execute($params);
159 159
 				}
@@ -193,12 +193,12 @@  discard block
 block discarded – undo
193 193
 
194 194
 			if ($row = $sth->fetch()) {
195 195
 				$ref_id = $row["id"];
196
-				if (DB_TYPE == "pgsql"){
196
+				if (DB_TYPE == "pgsql") {
197 197
 					$sth = $pdo->prepare("UPDATE ttrss_entries
198 198
 					SET tsvector_combined = to_tsvector( :ts_content)
199 199
 					WHERE id = :id");
200 200
 					$params = [
201
-						":ts_content" => mb_substr(strip_tags($content ), 0, 900000),
201
+						":ts_content" => mb_substr(strip_tags($content), 0, 900000),
202 202
 						":id" => $ref_id];
203 203
 					$sth->execute($params);
204 204
 				}
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 		print_hidden("op", "article");
237 237
 		print_hidden("method", "setArticleTags");
238 238
 
239
-		print "<header class='horizontal'>" . __("Tags for this article (separated by commas):")."</header>";
239
+		print "<header class='horizontal'>".__("Tags for this article (separated by commas):")."</header>";
240 240
 
241 241
 		print "<section>";
242 242
 		print "<textarea dojoType='dijit.form.SimpleTextarea' rows='4'
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 
258 258
 	function setScore() {
259 259
 		$ids = explode(",", clean($_REQUEST['id']));
260
-		$score = (int)clean($_REQUEST['score']);
260
+		$score = (int) clean($_REQUEST['score']);
261 261
 
262 262
 		$ids_qmarks = arr_qmarks($ids);
263 263
 
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 
267 267
 		$sth->execute(array_merge([$score], $ids, [$_SESSION['uid']]));
268 268
 
269
-		print json_encode(["id" => $ids, "score" => (int)$score]);
269
+		print json_encode(["id" => $ids, "score" => (int) $score]);
270 270
 	}
271 271
 
272 272
 	function getScore() {
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 
279 279
 		$score = $row['score'];
280 280
 
281
-		print json_encode(["id" => $id, "score" => (int)$score]);
281
+		print json_encode(["id" => $id, "score" => (int) $score]);
282 282
 	}
283 283
 
284 284
 
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 
337 337
 		if (!$tags_str_full) $tags_str_full = __("no tags");
338 338
 
339
-		print json_encode(array("id" => (int)$id,
339
+		print json_encode(array("id" => (int) $id,
340 340
 				"content" => $tags_str, "content_full" => $tags_str_full));
341 341
 	}
342 342
 
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 
354 354
 		print "<ul>";
355 355
 		while ($line = $sth->fetch()) {
356
-			print "<li>" . $line["tag_name"] . "</li>";
356
+			print "<li>".$line["tag_name"]."</li>";
357 357
 		}
358 358
 		print "</ul>";
359 359
 	}
@@ -492,21 +492,21 @@  discard block
 block discarded – undo
492 492
 								if (!$hide_images) {
493 493
 									$encsize = '';
494 494
 									if ($entry['height'] > 0)
495
-										$encsize .= ' height="' . intval($entry['height']) . '"';
495
+										$encsize .= ' height="'.intval($entry['height']).'"';
496 496
 									if ($entry['width'] > 0)
497
-										$encsize .= ' width="' . intval($entry['width']) . '"';
497
+										$encsize .= ' width="'.intval($entry['width']).'"';
498 498
 									$rv .= "<p><img
499 499
 										alt=\"".htmlspecialchars($entry["filename"])."\"
500
-										src=\"" .htmlspecialchars($entry["url"]) . "\"
501
-										" . $encsize . " /></p>";
500
+										src=\"" .htmlspecialchars($entry["url"])."\"
501
+										" . $encsize." /></p>";
502 502
 								} else {
503 503
 									$rv .= "<p><a target=\"_blank\" rel=\"noopener noreferrer\"
504 504
 										href=\"".htmlspecialchars($entry["url"])."\"
505
-										>" .htmlspecialchars($entry["url"]) . "</a></p>";
505
+										>" .htmlspecialchars($entry["url"])."</a></p>";
506 506
 								}
507 507
 
508 508
 								if ($entry['title']) {
509
-									$rv.= "<div class=\"enclosure_title\">${entry['title']}</div>";
509
+									$rv .= "<div class=\"enclosure_title\">${entry['title']}</div>";
510 510
 								}
511 511
 							}
512 512
 						}
@@ -521,13 +521,13 @@  discard block
 block discarded – undo
521 521
 			}
522 522
 
523 523
 			$rv .= "<div class=\"attachments\" dojoType=\"fox.form.DropDownButton\">".
524
-				"<span>" . __('Attachments')."</span>";
524
+				"<span>".__('Attachments')."</span>";
525 525
 
526 526
 			$rv .= "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
527 527
 
528 528
 			foreach ($entries as $entry) {
529 529
 				if ($entry["title"])
530
-					$title = " &mdash; " . truncate_string($entry["title"], 30);
530
+					$title = " &mdash; ".truncate_string($entry["title"], 30);
531 531
 				else
532 532
 					$title = "";
533 533
 
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
 					$filename = "";
538 538
 
539 539
 				$rv .= "<div onclick='popupOpenUrl(\"".htmlspecialchars($entry["url"])."\")'
540
-					dojoType=\"dijit.MenuItem\">".$filename . $title."</div>";
540
+					dojoType=\"dijit.MenuItem\">".$filename.$title."</div>";
541 541
 
542 542
 			};
543 543
 
@@ -606,10 +606,10 @@  discard block
 block discarded – undo
606 606
 			$tags_str = "";
607 607
 
608 608
 			for ($i = 0; $i < $maxtags; $i++) {
609
-				$tags_str .= "<a class=\"tag\" href=\"#\" onclick=\"Feeds.open({feed:'".$tags[$i]."'})\">" . $tags[$i] . "</a>, ";
609
+				$tags_str .= "<a class=\"tag\" href=\"#\" onclick=\"Feeds.open({feed:'".$tags[$i]."'})\">".$tags[$i]."</a>, ";
610 610
 			}
611 611
 
612
-			$tags_str = mb_substr($tags_str, 0, mb_strlen($tags_str)-2);
612
+			$tags_str = mb_substr($tags_str, 0, mb_strlen($tags_str) - 2);
613 613
 
614 614
 			if (count($tags) > $maxtags)
615 615
 				$tags_str .= ", &hellip;";
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
 		if (!$article_image && !$article_stream) {
804 804
 			$tmpdoc = new DOMDocument();
805 805
 
806
-			if (@$tmpdoc->loadHTML('<?xml encoding="UTF-8">' . mb_substr($content, 0, 131070))) {
806
+			if (@$tmpdoc->loadHTML('<?xml encoding="UTF-8">'.mb_substr($content, 0, 131070))) {
807 807
 				$tmpxpath = new DOMXPath($tmpdoc);
808 808
 				$elems = $tmpxpath->query('(//img[@src]|//video[@poster]|//iframe[contains(@src , "youtube.com/embed/")])');
809 809
 
@@ -811,8 +811,8 @@  discard block
 block discarded – undo
811 811
 					if ($e->nodeName == "iframe") {
812 812
 						$matches = [];
813 813
 						if ($rrr = preg_match("/\/embed\/([\w-]+)/", $e->getAttribute("src"), $matches)) {
814
-							$article_image = "https://img.youtube.com/vi/" . $matches[1] . "/hqdefault.jpg";
815
-							$article_stream = "https://youtu.be/" . $matches[1];
814
+							$article_image = "https://img.youtube.com/vi/".$matches[1]."/hqdefault.jpg";
815
+							$article_stream = "https://youtu.be/".$matches[1];
816 816
 							break;
817 817
 						}
818 818
 					} else if ($e->nodeName == "video") {
Please login to merge, or discard this patch.
Braces   +90 added lines, -53 removed lines patch added patch discarded remove patch
@@ -120,10 +120,16 @@  discard block
 block discarded – undo
120 120
 
121 121
 		$rc = false;
122 122
 
123
-		if (!$title) $title = $url;
124
-		if (!$title && !$url) return false;
123
+		if (!$title) {
124
+			$title = $url;
125
+		}
126
+		if (!$title && !$url) {
127
+			return false;
128
+		}
125 129
 
126
-		if (filter_var($url, FILTER_VALIDATE_URL) === FALSE) return false;
130
+		if (filter_var($url, FILTER_VALIDATE_URL) === FALSE) {
131
+			return false;
132
+		}
127 133
 
128 134
 		$pdo = Db::pdo();
129 135
 
@@ -334,7 +340,9 @@  discard block
 block discarded – undo
334 340
 		$tags_str = $this->format_tags_string($tags, $id);
335 341
 		$tags_str_full = join(", ", $tags);
336 342
 
337
-		if (!$tags_str_full) $tags_str_full = __("no tags");
343
+		if (!$tags_str_full) {
344
+			$tags_str_full = __("no tags");
345
+		}
338 346
 
339 347
 		print json_encode(array("id" => (int)$id,
340 348
 				"content" => $tags_str, "content_full" => $tags_str_full));
@@ -380,10 +388,11 @@  discard block
 block discarded – undo
380 388
 
381 389
 			foreach ($ids as $id) {
382 390
 
383
-				if ($assign)
384
-					Labels::add_article($id, $label, $_SESSION["uid"]);
385
-				else
386
-					Labels::remove_article($id, $label, $_SESSION["uid"]);
391
+				if ($assign) {
392
+									Labels::add_article($id, $label, $_SESSION["uid"]);
393
+				} else {
394
+									Labels::remove_article($id, $label, $_SESSION["uid"]);
395
+				}
387 396
 
388 397
 				$labels = $this->get_article_labels($id, $_SESSION["uid"]);
389 398
 
@@ -444,14 +453,18 @@  discard block
 block discarded – undo
444 453
 				$width = $line["width"];
445 454
 				$height = $line["height"];
446 455
 
447
-				if (!$ctype) $ctype = __("unknown type");
456
+				if (!$ctype) {
457
+					$ctype = __("unknown type");
458
+				}
448 459
 
449 460
 				//$filename = substr($url, strrpos($url, "/")+1);
450 461
 				$filename = basename($url);
451 462
 
452 463
 				$player = format_inline_player($url, $ctype);
453 464
 
454
-				if ($player) array_push($entries_inline, $player);
465
+				if ($player) {
466
+					array_push($entries_inline, $player);
467
+				}
455 468
 
456 469
 #				$entry .= " <a target=\"_blank\" href=\"" . htmlspecialchars($url) . "\" rel=\"noopener noreferrer\">" .
457 470
 #					$filename . " (" . $ctype . ")" . "</a>";
@@ -479,8 +492,9 @@  discard block
 block discarded – undo
479 492
 
480 493
 					foreach ($entries as $entry) {
481 494
 
482
-						foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ENCLOSURE) as $plugin)
483
-							$retval = $plugin->hook_render_enclosure($entry, $hide_images);
495
+						foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ENCLOSURE) as $plugin) {
496
+													$retval = $plugin->hook_render_enclosure($entry, $hide_images);
497
+						}
484 498
 
485 499
 
486 500
 						if ($retval) {
@@ -491,10 +505,12 @@  discard block
 block discarded – undo
491 505
 
492 506
 								if (!$hide_images) {
493 507
 									$encsize = '';
494
-									if ($entry['height'] > 0)
495
-										$encsize .= ' height="' . intval($entry['height']) . '"';
496
-									if ($entry['width'] > 0)
497
-										$encsize .= ' width="' . intval($entry['width']) . '"';
508
+									if ($entry['height'] > 0) {
509
+																			$encsize .= ' height="' . intval($entry['height']) . '"';
510
+									}
511
+									if ($entry['width'] > 0) {
512
+																			$encsize .= ' width="' . intval($entry['width']) . '"';
513
+									}
498 514
 									$rv .= "<p><img
499 515
 										alt=\"".htmlspecialchars($entry["filename"])."\"
500 516
 										src=\"" .htmlspecialchars($entry["url"]) . "\"
@@ -526,15 +542,17 @@  discard block
 block discarded – undo
526 542
 			$rv .= "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
527 543
 
528 544
 			foreach ($entries as $entry) {
529
-				if ($entry["title"])
530
-					$title = " &mdash; " . truncate_string($entry["title"], 30);
531
-				else
532
-					$title = "";
545
+				if ($entry["title"]) {
546
+									$title = " &mdash; " . truncate_string($entry["title"], 30);
547
+				} else {
548
+									$title = "";
549
+				}
533 550
 
534
-				if ($entry["filename"])
535
-					$filename = truncate_middle(htmlspecialchars($entry["filename"]), 60);
536
-				else
537
-					$filename = "";
551
+				if ($entry["filename"]) {
552
+									$filename = truncate_middle(htmlspecialchars($entry["filename"]), 60);
553
+				} else {
554
+									$filename = "";
555
+				}
538 556
 
539 557
 				$rv .= "<div onclick='popupOpenUrl(\"".htmlspecialchars($entry["url"])."\")'
540 558
 					dojoType=\"dijit.MenuItem\">".$filename . $title."</div>";
@@ -552,7 +570,9 @@  discard block
 block discarded – undo
552 570
 
553 571
 		$a_id = $id;
554 572
 
555
-		if (!$owner_uid) $owner_uid = $_SESSION["uid"];
573
+		if (!$owner_uid) {
574
+			$owner_uid = $_SESSION["uid"];
575
+		}
556 576
 
557 577
 		$pdo = Db::pdo();
558 578
 
@@ -570,7 +590,9 @@  discard block
 block discarded – undo
570 590
 				WHERE ref_id = ? AND owner_uid = ?");
571 591
 			$csth->execute([$id, $owner_uid]);
572 592
 
573
-			if ($row = $csth->fetch()) $tag_cache = $row["tag_cache"];
593
+			if ($row = $csth->fetch()) {
594
+				$tag_cache = $row["tag_cache"];
595
+			}
574 596
 		}
575 597
 
576 598
 		if ($tag_cache) {
@@ -611,8 +633,9 @@  discard block
 block discarded – undo
611 633
 
612 634
 			$tags_str = mb_substr($tags_str, 0, mb_strlen($tags_str)-2);
613 635
 
614
-			if (count($tags) > $maxtags)
615
-				$tags_str .= ", &hellip;";
636
+			if (count($tags) > $maxtags) {
637
+							$tags_str .= ", &hellip;";
638
+			}
616 639
 
617 640
 			return $tags_str;
618 641
 		}
@@ -620,7 +643,9 @@  discard block
 block discarded – undo
620 643
 
621 644
 	static function format_article_labels($labels) {
622 645
 
623
-		if (!is_array($labels)) return '';
646
+		if (!is_array($labels)) {
647
+			return '';
648
+		}
624 649
 
625 650
 		$labels_str = "";
626 651
 
@@ -680,10 +705,11 @@  discard block
 block discarded – undo
680 705
 
681 706
         // purge orphaned posts in main content table
682 707
 
683
-        if (DB_TYPE == "mysql")
684
-            $limit_qpart = "LIMIT 5000";
685
-        else
686
-            $limit_qpart = "";
708
+        if (DB_TYPE == "mysql") {
709
+                    $limit_qpart = "LIMIT 5000";
710
+        } else {
711
+                    $limit_qpart = "";
712
+        }
687 713
 
688 714
         $pdo = Db::pdo();
689 715
         $res = $pdo->query("DELETE FROM ttrss_entries WHERE
@@ -697,7 +723,9 @@  discard block
 block discarded – undo
697 723
 
698 724
 	static function catchupArticlesById($ids, $cmode, $owner_uid = false) {
699 725
 
700
-		if (!$owner_uid) $owner_uid = $_SESSION["uid"];
726
+		if (!$owner_uid) {
727
+			$owner_uid = $_SESSION["uid"];
728
+		}
701 729
 
702 730
 		$pdo = Db::pdo();
703 731
 
@@ -747,7 +775,9 @@  discard block
 block discarded – undo
747 775
 	static function get_article_labels($id, $owner_uid = false) {
748 776
 		$rv = array();
749 777
 
750
-		if (!$owner_uid) $owner_uid = $_SESSION["uid"];
778
+		if (!$owner_uid) {
779
+			$owner_uid = $_SESSION["uid"];
780
+		}
751 781
 
752 782
 		$pdo = Db::pdo();
753 783
 
@@ -761,10 +791,11 @@  discard block
 block discarded – undo
761 791
 			if ($label_cache) {
762 792
 				$tmp = json_decode($label_cache, true);
763 793
 
764
-				if (!$tmp || $tmp["no-labels"] == 1)
765
-					return $rv;
766
-				else
767
-					return $tmp;
794
+				if (!$tmp || $tmp["no-labels"] == 1) {
795
+									return $rv;
796
+				} else {
797
+									return $tmp;
798
+				}
768 799
 			}
769 800
 		}
770 801
 
@@ -783,10 +814,11 @@  discard block
 block discarded – undo
783 814
 			array_push($rv, $rk);
784 815
 		}
785 816
 
786
-		if (count($rv) > 0)
787
-			Labels::update_cache($owner_uid, $id, $rv);
788
-		else
789
-			Labels::update_cache($owner_uid, $id, array("no-labels" => 1));
817
+		if (count($rv) > 0) {
818
+					Labels::update_cache($owner_uid, $id, $rv);
819
+		} else {
820
+					Labels::update_cache($owner_uid, $id, array("no-labels" => 1));
821
+		}
790 822
 
791 823
 		return $rv;
792 824
 	}
@@ -834,28 +866,33 @@  discard block
 block discarded – undo
834 866
 				}
835 867
 			}
836 868
 
837
-			if (!$article_image)
838
-				foreach ($enclosures as $enc) {
869
+			if (!$article_image) {
870
+							foreach ($enclosures as $enc) {
839 871
 					if (strpos($enc["content_type"], "image/") !== FALSE) {
840 872
 						$article_image = $enc["content_url"];
873
+			}
841 874
 						break;
842 875
 					}
843 876
 				}
844 877
 
845
-			if ($article_image)
846
-				$article_image = rewrite_relative_url($site_url, $article_image);
878
+			if ($article_image) {
879
+							$article_image = rewrite_relative_url($site_url, $article_image);
880
+			}
847 881
 
848
-			if ($article_stream)
849
-				$article_stream = rewrite_relative_url($site_url, $article_stream);
882
+			if ($article_stream) {
883
+							$article_stream = rewrite_relative_url($site_url, $article_stream);
884
+			}
850 885
 		}
851 886
 
852 887
 		$cache = new DiskCache("images");
853 888
 
854
-		if ($article_image && $cache->exists(sha1($article_image)))
855
-			$article_image = $cache->getUrl(sha1($article_image));
889
+		if ($article_image && $cache->exists(sha1($article_image))) {
890
+					$article_image = $cache->getUrl(sha1($article_image));
891
+		}
856 892
 
857
-		if ($article_stream && $cache->exists(sha1($article_stream)))
858
-			$article_stream = $cache->getUrl(sha1($article_stream));
893
+		if ($article_stream && $cache->exists(sha1($article_stream))) {
894
+					$article_stream = $cache->getUrl(sha1($article_stream));
895
+		}
859 896
 
860 897
 		return [$article_image, $article_stream];
861 898
 	}
Please login to merge, or discard this patch.
classes/feeds.php 4 patches
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -5,9 +5,9 @@  discard block
 block discarded – undo
5 5
 	const NEVER_GROUP_FEEDS = [ -6, 0 ];
6 6
 	const NEVER_GROUP_BY_DATE = [ -2, -1, -3 ];
7 7
 
8
-    private $params;
8
+	private $params;
9 9
 
10
-    function csrf_ignore($method) {
10
+	function csrf_ignore($method) {
11 11
 		$csrf_ignored = array("index", "quickaddfeed", "search");
12 12
 
13 13
 		return array_search($method, $csrf_ignored) !== false;
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 		//$reply .= "<option value=\"catchupPage()\">".__('Mark as read')."</option>";
102 102
 
103 103
 		$reply .= "<option value=\"App.displayDlg('".__("Show as feed")."','generatedFeed', '$feed_id:$is_cat:$rss_link')\">".
104
-            __('Show as feed')."</option>";
104
+			__('Show as feed')."</option>";
105 105
 
106 106
 		$reply .= "</select>";
107 107
 
@@ -133,10 +133,10 @@  discard block
 block discarded – undo
133 133
 		$method_split = explode(":", $method);
134 134
 
135 135
 		if ($method == "ForceUpdate" && $feed > 0 && is_numeric($feed)) {
136
-            $sth = $this->pdo->prepare("UPDATE ttrss_feeds
136
+			$sth = $this->pdo->prepare("UPDATE ttrss_feeds
137 137
                             SET last_updated = '1970-01-01', last_update_started = '1970-01-01'
138 138
                             WHERE id = ?");
139
-            $sth->execute([$feed]);
139
+			$sth->execute([$feed]);
140 140
 		}
141 141
 
142 142
 		if ($method_split[0] == "MarkAllReadGR")  {
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 				"include_children" => $include_children,
198 198
 				"check_first_id" => $check_first_id,
199 199
 				"skip_first_id_check" => $skip_first_id_check,
200
-                "order_by" => $order_by
200
+				"order_by" => $order_by
201 201
 			);
202 202
 
203 203
 			$qfh_ret = $this->queryFeedHeadlines($params);
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 
236 236
 		$headlines_count = 0;
237 237
 
238
-        if (is_object($result)) {
238
+		if (is_object($result)) {
239 239
 			while ($line = $result->fetch(PDO::FETCH_ASSOC)) {
240 240
 
241 241
 				++$headlines_count;
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 					foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) {
249 249
 						$line = $p->hook_query_headlines($line, 250, false);
250 250
 					}
251
-                }
251
+				}
252 252
 
253 253
 				$id = $line["id"];
254 254
 
@@ -295,53 +295,53 @@  discard block
 block discarded – undo
295 295
 
296 296
 				if (!$line["feed_title"]) $line["feed_title"] = "";
297 297
 
298
-                $line["buttons_left"] = "";
299
-                foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ARTICLE_LEFT_BUTTON) as $p) {
300
-                    $line["buttons_left"] .= $p->hook_article_left_button($line);
301
-                }
298
+				$line["buttons_left"] = "";
299
+				foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ARTICLE_LEFT_BUTTON) as $p) {
300
+					$line["buttons_left"] .= $p->hook_article_left_button($line);
301
+				}
302 302
 
303
-                $line["buttons"] = "";
304
-                foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ARTICLE_BUTTON) as $p) {
305
-                    $line["buttons"] .= $p->hook_article_button($line);
306
-                }
303
+				$line["buttons"] = "";
304
+				foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ARTICLE_BUTTON) as $p) {
305
+					$line["buttons"] .= $p->hook_article_button($line);
306
+				}
307 307
 
308
-                $line["content"] = sanitize($line["content"],
309
-                    $line['hide_images'], false, $line["site_url"], $highlight_words, $line["id"]);
308
+				$line["content"] = sanitize($line["content"],
309
+					$line['hide_images'], false, $line["site_url"], $highlight_words, $line["id"]);
310 310
 
311
-                foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ARTICLE_CDM) as $p) {
312
-                    $line = $p->hook_render_article_cdm($line);
313
-                }
311
+				foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ARTICLE_CDM) as $p) {
312
+					$line = $p->hook_render_article_cdm($line);
313
+				}
314 314
 
315
-                $line['content'] = DiskCache::rewriteUrls($line['content']);
315
+				$line['content'] = DiskCache::rewriteUrls($line['content']);
316 316
 
317
-                if ($line['note'])
318
-                    $line['note'] = Article::format_article_note($id, $line['note']);
319
-                else
320
-                    $line['note'] = "";
317
+				if ($line['note'])
318
+					$line['note'] = Article::format_article_note($id, $line['note']);
319
+				else
320
+					$line['note'] = "";
321 321
 
322
-                if (!get_pref("CDM_EXPANDED")) {
323
-                    $line["cdm_excerpt"] = "<span class='collapse'>
322
+				if (!get_pref("CDM_EXPANDED")) {
323
+					$line["cdm_excerpt"] = "<span class='collapse'>
324 324
                         <i class='material-icons' onclick='return Article.cdmUnsetActive(event)'
325 325
                             title=\"" . __("Collapse article") . "\">remove_circle</i></span>";
326 326
 
327
-                    if (get_pref('SHOW_CONTENT_PREVIEW')) {
328
-                        $line["cdm_excerpt"] .= "<span class='excerpt'>" . $line["content_preview"] . "</span>";
329
-                    }
330
-                }
327
+					if (get_pref('SHOW_CONTENT_PREVIEW')) {
328
+						$line["cdm_excerpt"] .= "<span class='excerpt'>" . $line["content_preview"] . "</span>";
329
+					}
330
+				}
331 331
 
332
-                $line["enclosures"] = Article::format_article_enclosures($id, $line["always_display_enclosures"],
333
-                    $line["content"], $line["hide_images"]);
332
+				$line["enclosures"] = Article::format_article_enclosures($id, $line["always_display_enclosures"],
333
+					$line["content"], $line["hide_images"]);
334 334
 
335
-                if ($line["orig_feed_id"]) {
335
+				if ($line["orig_feed_id"]) {
336 336
 
337
-                    $ofgh = $this->pdo->prepare("SELECT * FROM ttrss_archived_feeds
337
+					$ofgh = $this->pdo->prepare("SELECT * FROM ttrss_archived_feeds
338 338
                     WHERE id = ? AND owner_uid = ?");
339
-                    $ofgh->execute([$line["orig_feed_id"], $_SESSION['uid']]);
339
+					$ofgh->execute([$line["orig_feed_id"], $_SESSION['uid']]);
340 340
 
341
-                    if ($tmp_line = $ofgh->fetch()) {
342
-                        $line["orig_feed"] = [ $tmp_line["title"], $tmp_line["site_url"], $tmp_line["feed_url"] ];
343
-                    }
344
-                }
341
+					if ($tmp_line = $ofgh->fetch()) {
342
+						$line["orig_feed"] = [ $tmp_line["title"], $tmp_line["site_url"], $tmp_line["feed_url"] ];
343
+					}
344
+				}
345 345
 
346 346
 				$line["updated_long"] = make_local_datetime($line["updated"],true);
347 347
 				$line["updated"] = make_local_datetime($line["updated"], false, false, false, true);
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 					$line['feed_icon'] = "<i class='icon-no-feed material-icons'>rss_feed</i>";
364 364
 				}
365 365
 
366
-			    //setting feed headline background color, needs to change text color based on dark/light
366
+				//setting feed headline background color, needs to change text color based on dark/light
367 367
 				$fav_color = $line['favicon_avg_color'];
368 368
 
369 369
 				require_once "colors.php";
@@ -377,18 +377,18 @@  discard block
 block discarded – undo
377 377
 				}
378 378
 
379 379
 				if (isset($rgba_cache[$feed_id])) {
380
-				    $line['feed_bg_color'] = 'rgba(' . implode(",", $rgba_cache[$feed_id]) . ',0.3)';
381
-                }
380
+					$line['feed_bg_color'] = 'rgba(' . implode(",", $rgba_cache[$feed_id]) . ',0.3)';
381
+				}
382 382
 
383 383
 				/* we don't need those */
384 384
 
385
-                foreach (["date_entered", "guid", "last_published", "last_marked", "tag_cache", "favicon_avg_color",
386
-                             "uuid", "label_cache", "yyiw"] as $k)
387
-                    unset($line[$k]);
385
+				foreach (["date_entered", "guid", "last_published", "last_marked", "tag_cache", "favicon_avg_color",
386
+							 "uuid", "label_cache", "yyiw"] as $k)
387
+					unset($line[$k]);
388 388
 
389 389
 				array_push($reply['content'], $line);
390 390
 			}
391
-        }
391
+		}
392 392
 
393 393
 		if (!$headlines_count) {
394 394
 
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
 		$reply['headlines']['is_cat'] = (bool) $cat_view;
571 571
 
572 572
 		$reply['headlines-info'] = ["count" => (int) $headlines_count,
573
-            						"disable_cache" => (bool) $disable_cache];
573
+									"disable_cache" => (bool) $disable_cache];
574 574
 
575 575
 		// this is parsed by handleRpcJson() on first viewfeed() to set cdm expanded, etc
576 576
 		$reply['runtime-info'] = make_runtime_info();
@@ -578,9 +578,9 @@  discard block
 block discarded – undo
578 578
 		$reply_json = json_encode($reply);
579 579
 
580 580
 		if (!$reply_json) {
581
-		    $reply_json = json_encode(["error" => ["code" => 15,
582
-                "message" => json_last_error_msg()]]);
583
-        }
581
+			$reply_json = json_encode(["error" => ["code" => 15,
582
+				"message" => json_last_error_msg()]]);
583
+		}
584 584
 
585 585
 		print $reply_json;
586 586
 
@@ -780,9 +780,9 @@  discard block
 block discarded – undo
780 780
 		$sth->execute([$feed_id, $_SESSION['uid']]);
781 781
 
782 782
 		if (!$sth->fetch()) {
783
-		    print "Access denied.";
784
-		    return;
785
-        }
783
+			print "Access denied.";
784
+			return;
785
+		}
786 786
 
787 787
 		$refetch_checked = isset($_REQUEST["force_refetch"]) ? "checked" : "";
788 788
 		$rehash_checked = isset($_REQUEST["force_rehash"]) ? "checked" : "";
@@ -1236,7 +1236,7 @@  discard block
 block discarded – undo
1236 1236
 				} else {
1237 1237
 					$icon = self::getIconFile($id);
1238 1238
 
1239
-                    if ($icon && file_exists($icon)) {
1239
+					if ($icon && file_exists($icon)) {
1240 1240
 						return ICONS_URL . "/" . basename($icon) . "?" . filemtime($icon);
1241 1241
 					}
1242 1242
 				}
@@ -1247,7 +1247,7 @@  discard block
 block discarded – undo
1247 1247
 	}
1248 1248
 
1249 1249
 	static function getFeedTitle($id, $cat = false) {
1250
-	    $pdo = Db::pdo();
1250
+		$pdo = Db::pdo();
1251 1251
 
1252 1252
 		if ($cat) {
1253 1253
 			return Feeds::getCategoryTitle($id);
@@ -1278,10 +1278,10 @@  discard block
 block discarded – undo
1278 1278
 
1279 1279
 		} else if (is_numeric($id) && $id > 0) {
1280 1280
 
1281
-		    $sth = $pdo->prepare("SELECT title FROM ttrss_feeds WHERE id = ?");
1282
-		    $sth->execute([$id]);
1281
+			$sth = $pdo->prepare("SELECT title FROM ttrss_feeds WHERE id = ?");
1282
+			$sth->execute([$id]);
1283 1283
 
1284
-		    if ($row = $sth->fetch()) {
1284
+			if ($row = $sth->fetch()) {
1285 1285
 				return $row["title"];
1286 1286
 			} else {
1287 1287
 				return "Unknown feed ($id)";
@@ -1300,7 +1300,7 @@  discard block
 block discarded – undo
1300 1300
 
1301 1301
 		if ($cat >= 0) {
1302 1302
 
1303
-		    if (!$cat) $cat = null;
1303
+			if (!$cat) $cat = null;
1304 1304
 
1305 1305
 			$sth = $pdo->prepare("SELECT id FROM ttrss_feeds
1306 1306
                     WHERE (cat_id = :cat OR (:cat IS NULL AND cat_id IS NULL))
@@ -1340,7 +1340,7 @@  discard block
 block discarded – undo
1340 1340
 				WHERE article_id = ref_id AND unread = true
1341 1341
 					AND ttrss_user_entries.owner_uid = ?");
1342 1342
 			$sth->execute([$owner_uid]);
1343
-            $row = $sth->fetch();
1343
+			$row = $sth->fetch();
1344 1344
 
1345 1345
 			return $row["unread"];
1346 1346
 		}
@@ -1388,7 +1388,7 @@  discard block
 block discarded – undo
1388 1388
 			return __("Labels");
1389 1389
 		} else {
1390 1390
 
1391
-		    $pdo = Db::pdo();
1391
+			$pdo = Db::pdo();
1392 1392
 
1393 1393
 			$sth = $pdo->prepare("SELECT title FROM ttrss_feed_categories WHERE
1394 1394
 				id = ?");
@@ -1424,7 +1424,7 @@  discard block
 block discarded – undo
1424 1424
 		$pdo = Db::pdo();
1425 1425
 
1426 1426
 		// WARNING: due to highly dynamic nature of this query its going to quote parameters
1427
-        // right before adding them to SQL part
1427
+		// right before adding them to SQL part
1428 1428
 
1429 1429
 		$feed = $params["feed"];
1430 1430
 		$limit = isset($params["limit"]) ? $params["limit"] : 30;
@@ -1668,7 +1668,7 @@  discard block
 block discarded – undo
1668 1668
 					$ssth = $pdo->prepare("SELECT title,site_url,last_error,last_updated
1669 1669
 							FROM ttrss_feeds WHERE id = ? AND owner_uid = ?");
1670 1670
 					$ssth->execute([$feed, $owner_uid]);
1671
-                    $row = $ssth->fetch();
1671
+					$row = $ssth->fetch();
1672 1672
 
1673 1673
 					$feed_title = $row["title"];
1674 1674
 					$feed_site_url = $row["site_url"];
@@ -1906,9 +1906,9 @@  discard block
 block discarded – undo
1906 1906
 	static function getFeedCategory($feed) {
1907 1907
 		$pdo = Db::pdo();
1908 1908
 
1909
-	    $sth = $pdo->prepare("SELECT cat_id FROM ttrss_feeds
1909
+		$sth = $pdo->prepare("SELECT cat_id FROM ttrss_feeds
1910 1910
 				WHERE id = ?");
1911
-	    $sth->execute([$feed]);
1911
+		$sth->execute([$feed]);
1912 1912
 
1913 1913
 		if ($row = $sth->fetch()) {
1914 1914
 			return $row["cat_id"];
@@ -1918,20 +1918,20 @@  discard block
 block discarded – undo
1918 1918
 
1919 1919
 	}
1920 1920
 
1921
-    function color_of($name) {
1922
-        $colormap = [ "#1cd7d7","#d91111","#1212d7","#8e16e5","#7b7b7b",
1923
-            "#39f110","#0bbea6","#ec0e0e","#1534f2","#b9e416",
1924
-            "#479af2","#f36b14","#10c7e9","#1e8fe7","#e22727" ];
1921
+	function color_of($name) {
1922
+		$colormap = [ "#1cd7d7","#d91111","#1212d7","#8e16e5","#7b7b7b",
1923
+			"#39f110","#0bbea6","#ec0e0e","#1534f2","#b9e416",
1924
+			"#479af2","#f36b14","#10c7e9","#1e8fe7","#e22727" ];
1925 1925
 
1926
-        $sum = 0;
1926
+		$sum = 0;
1927 1927
 
1928
-        for ($i = 0; $i < strlen($name); $i++) {
1929
-            $sum += ord($name[$i]);
1930
-        }
1928
+		for ($i = 0; $i < strlen($name); $i++) {
1929
+			$sum += ord($name[$i]);
1930
+		}
1931 1931
 
1932
-        $sum %= count($colormap);
1932
+		$sum %= count($colormap);
1933 1933
 
1934
-        return $colormap[$sum];
1934
+		return $colormap[$sum];
1935 1935
 	}
1936 1936
 
1937 1937
 	static function get_feeds_from_html($url, $content) {
Please login to merge, or discard this patch.
Switch Indentation   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -398,21 +398,21 @@  discard block
 block discarded – undo
398 398
 					$message = $query_error_override;
399 399
 				} else {
400 400
 					switch ($view_mode) {
401
-						case "unread":
402
-							$message = __("No unread articles found to display.");
403
-							break;
404
-						case "updated":
405
-							$message = __("No updated articles found to display.");
406
-							break;
407
-						case "marked":
408
-							$message = __("No starred articles found to display.");
409
-							break;
410
-						default:
411
-							if ($feed < LABEL_BASE_INDEX) {
412
-								$message = __("No articles found to display. You can assign articles to labels manually from article header context menu (applies to all selected articles) or use a filter.");
413
-							} else {
414
-								$message = __("No articles found to display.");
415
-							}
401
+					case "unread":
402
+						$message = __("No unread articles found to display.");
403
+						break;
404
+					case "updated":
405
+						$message = __("No updated articles found to display.");
406
+						break;
407
+					case "marked":
408
+						$message = __("No starred articles found to display.");
409
+						break;
410
+					default:
411
+						if ($feed < LABEL_BASE_INDEX) {
412
+							$message = __("No articles found to display. You can assign articles to labels manually from article header context menu (applies to all selected articles) or use a filter.");
413
+						} else {
414
+							$message = __("No articles found to display.");
415
+						}
416 416
 					}
417 417
 				}
418 418
 
@@ -874,29 +874,29 @@  discard block
 block discarded – undo
874 874
 		// TODO: all this interval stuff needs some generic generator function
875 875
 
876 876
 		switch ($mode) {
877
-			case "1day":
878
-				if (DB_TYPE == "pgsql") {
879
-					$date_qpart = "date_entered < NOW() - INTERVAL '1 day' ";
880
-				} else {
881
-					$date_qpart = "date_entered < DATE_SUB(NOW(), INTERVAL 1 DAY) ";
882
-				}
883
-				break;
884
-			case "1week":
885
-				if (DB_TYPE == "pgsql") {
886
-					$date_qpart = "date_entered < NOW() - INTERVAL '1 week' ";
887
-				} else {
888
-					$date_qpart = "date_entered < DATE_SUB(NOW(), INTERVAL 1 WEEK) ";
889
-				}
890
-				break;
891
-			case "2week":
892
-				if (DB_TYPE == "pgsql") {
893
-					$date_qpart = "date_entered < NOW() - INTERVAL '2 week' ";
894
-				} else {
895
-					$date_qpart = "date_entered < DATE_SUB(NOW(), INTERVAL 2 WEEK) ";
896
-				}
897
-				break;
898
-			default:
899
-				$date_qpart = "true";
877
+		case "1day":
878
+			if (DB_TYPE == "pgsql") {
879
+				$date_qpart = "date_entered < NOW() - INTERVAL '1 day' ";
880
+			} else {
881
+				$date_qpart = "date_entered < DATE_SUB(NOW(), INTERVAL 1 DAY) ";
882
+			}
883
+			break;
884
+		case "1week":
885
+			if (DB_TYPE == "pgsql") {
886
+				$date_qpart = "date_entered < NOW() - INTERVAL '1 week' ";
887
+			} else {
888
+				$date_qpart = "date_entered < DATE_SUB(NOW(), INTERVAL 1 WEEK) ";
889
+			}
890
+			break;
891
+		case "2week":
892
+			if (DB_TYPE == "pgsql") {
893
+				$date_qpart = "date_entered < NOW() - INTERVAL '2 week' ";
894
+			} else {
895
+				$date_qpart = "date_entered < DATE_SUB(NOW(), INTERVAL 2 WEEK) ";
896
+			}
897
+			break;
898
+		default:
899
+			$date_qpart = "true";
900 900
 		}
901 901
 
902 902
 		if (is_numeric($feed)) {
@@ -1212,35 +1212,35 @@  discard block
 block discarded – undo
1212 1212
 
1213 1213
 	static function getFeedIcon($id) {
1214 1214
 		switch ($id) {
1215
-			case 0:
1216
-				return "archive";
1217
-				break;
1218
-			case -1:
1219
-				return "star";
1220
-				break;
1221
-			case -2:
1222
-				return "rss_feed";
1223
-				break;
1224
-			case -3:
1225
-				return "whatshot";
1226
-				break;
1227
-			case -4:
1228
-				return "inbox";
1229
-				break;
1230
-			case -6:
1231
-				return "restore";
1232
-				break;
1233
-			default:
1234
-				if ($id < LABEL_BASE_INDEX) {
1235
-					return "label";
1236
-				} else {
1237
-					$icon = self::getIconFile($id);
1215
+		case 0:
1216
+			return "archive";
1217
+			break;
1218
+		case -1:
1219
+			return "star";
1220
+			break;
1221
+		case -2:
1222
+			return "rss_feed";
1223
+			break;
1224
+		case -3:
1225
+			return "whatshot";
1226
+			break;
1227
+		case -4:
1228
+			return "inbox";
1229
+			break;
1230
+		case -6:
1231
+			return "restore";
1232
+			break;
1233
+		default:
1234
+			if ($id < LABEL_BASE_INDEX) {
1235
+				return "label";
1236
+			} else {
1237
+				$icon = self::getIconFile($id);
1238 1238
 
1239 1239
                     if ($icon && file_exists($icon)) {
1240
-						return ICONS_URL . "/" . basename($icon) . "?" . filemtime($icon);
1241
-					}
1240
+					return ICONS_URL . "/" . basename($icon) . "?" . filemtime($icon);
1242 1241
 				}
1243
-				break;
1242
+			}
1243
+			break;
1244 1244
 		}
1245 1245
 
1246 1246
 		return false;
@@ -2208,102 +2208,102 @@  discard block
 block discarded – undo
2208 2208
 			$commandpair = explode(":", mb_strtolower($k), 2);
2209 2209
 
2210 2210
 			switch ($commandpair[0]) {
2211
-				case "title":
2212
-					if ($commandpair[1]) {
2213
-						array_push($query_keywords, "($not (LOWER(ttrss_entries.title) LIKE ".
2214
-							$pdo->quote('%' . mb_strtolower($commandpair[1]) . '%') ."))");
2215
-					} else {
2216
-						array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%')
2211
+			case "title":
2212
+				if ($commandpair[1]) {
2213
+					array_push($query_keywords, "($not (LOWER(ttrss_entries.title) LIKE ".
2214
+						$pdo->quote('%' . mb_strtolower($commandpair[1]) . '%') ."))");
2215
+				} else {
2216
+					array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%')
2217 2217
 								OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))");
2218
-						array_push($search_words, $k);
2219
-					}
2220
-					break;
2221
-				case "author":
2222
-					if ($commandpair[1]) {
2223
-						array_push($query_keywords, "($not (LOWER(author) LIKE ".
2224
-							$pdo->quote('%' . mb_strtolower($commandpair[1]) . '%')."))");
2225
-					} else {
2226
-						array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%')
2218
+					array_push($search_words, $k);
2219
+				}
2220
+				break;
2221
+			case "author":
2222
+				if ($commandpair[1]) {
2223
+					array_push($query_keywords, "($not (LOWER(author) LIKE ".
2224
+						$pdo->quote('%' . mb_strtolower($commandpair[1]) . '%')."))");
2225
+				} else {
2226
+					array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%')
2227 2227
 								OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))");
2228
-						array_push($search_words, $k);
2229
-					}
2230
-					break;
2231
-				case "note":
2232
-					if ($commandpair[1]) {
2233
-						if ($commandpair[1] == "true")
2234
-							array_push($query_keywords, "($not (note IS NOT NULL AND note != ''))");
2235
-						else if ($commandpair[1] == "false")
2236
-							array_push($query_keywords, "($not (note IS NULL OR note = ''))");
2237
-						else
2238
-							array_push($query_keywords, "($not (LOWER(note) LIKE ".
2239
-								$pdo->quote('%' . mb_strtolower($commandpair[1]) . '%')."))");
2240
-					} else {
2241
-						array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").")
2228
+					array_push($search_words, $k);
2229
+				}
2230
+				break;
2231
+			case "note":
2232
+				if ($commandpair[1]) {
2233
+					if ($commandpair[1] == "true")
2234
+						array_push($query_keywords, "($not (note IS NOT NULL AND note != ''))");
2235
+					else if ($commandpair[1] == "false")
2236
+						array_push($query_keywords, "($not (note IS NULL OR note = ''))");
2237
+					else
2238
+						array_push($query_keywords, "($not (LOWER(note) LIKE ".
2239
+							$pdo->quote('%' . mb_strtolower($commandpair[1]) . '%')."))");
2240
+				} else {
2241
+					array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").")
2242 2242
 								OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))");
2243
-						if (!$not) array_push($search_words, $k);
2244
-					}
2245
-					break;
2246
-				case "star":
2243
+					if (!$not) array_push($search_words, $k);
2244
+				}
2245
+				break;
2246
+			case "star":
2247 2247
 
2248
-					if ($commandpair[1]) {
2249
-						if ($commandpair[1] == "true")
2250
-							array_push($query_keywords, "($not (marked = true))");
2251
-						else
2252
-							array_push($query_keywords, "($not (marked = false))");
2253
-					} else {
2254
-						array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").")
2248
+				if ($commandpair[1]) {
2249
+					if ($commandpair[1] == "true")
2250
+						array_push($query_keywords, "($not (marked = true))");
2251
+					else
2252
+						array_push($query_keywords, "($not (marked = false))");
2253
+				} else {
2254
+					array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").")
2255 2255
 								OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))");
2256
-						if (!$not) array_push($search_words, $k);
2257
-					}
2258
-					break;
2259
-				case "pub":
2260
-					if ($commandpair[1]) {
2261
-						if ($commandpair[1] == "true")
2262
-							array_push($query_keywords, "($not (published = true))");
2263
-						else
2264
-							array_push($query_keywords, "($not (published = false))");
2256
+					if (!$not) array_push($search_words, $k);
2257
+				}
2258
+				break;
2259
+			case "pub":
2260
+				if ($commandpair[1]) {
2261
+					if ($commandpair[1] == "true")
2262
+						array_push($query_keywords, "($not (published = true))");
2263
+					else
2264
+						array_push($query_keywords, "($not (published = false))");
2265 2265
 
2266
-					} else {
2267
-						array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%')
2266
+				} else {
2267
+					array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%')
2268 2268
 								OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))");
2269
-						if (!$not) array_push($search_words, $k);
2270
-					}
2271
-					break;
2272
-				case "unread":
2273
-					if ($commandpair[1]) {
2274
-						if ($commandpair[1] == "true")
2275
-							array_push($query_keywords, "($not (unread = true))");
2276
-						else
2277
-							array_push($query_keywords, "($not (unread = false))");
2269
+					if (!$not) array_push($search_words, $k);
2270
+				}
2271
+				break;
2272
+			case "unread":
2273
+				if ($commandpair[1]) {
2274
+					if ($commandpair[1] == "true")
2275
+						array_push($query_keywords, "($not (unread = true))");
2276
+					else
2277
+						array_push($query_keywords, "($not (unread = false))");
2278 2278
 
2279
-					} else {
2280
-						array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").")
2279
+				} else {
2280
+					array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").")
2281 2281
 								OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))");
2282
-						if (!$not) array_push($search_words, $k);
2283
-					}
2284
-					break;
2285
-				default:
2286
-					if (strpos($k, "@") === 0) {
2282
+					if (!$not) array_push($search_words, $k);
2283
+				}
2284
+				break;
2285
+			default:
2286
+				if (strpos($k, "@") === 0) {
2287 2287
 
2288
-						$user_tz_string = get_pref('USER_TIMEZONE', $_SESSION['uid']);
2289
-						$orig_ts = strtotime(substr($k, 1));
2290
-						$k = date("Y-m-d", convert_timestamp($orig_ts, $user_tz_string, 'UTC'));
2288
+					$user_tz_string = get_pref('USER_TIMEZONE', $_SESSION['uid']);
2289
+					$orig_ts = strtotime(substr($k, 1));
2290
+					$k = date("Y-m-d", convert_timestamp($orig_ts, $user_tz_string, 'UTC'));
2291 2291
 
2292
-						//$k = date("Y-m-d", strtotime(substr($k, 1)));
2292
+					//$k = date("Y-m-d", strtotime(substr($k, 1)));
2293 2293
 
2294
-						array_push($query_keywords, "(".SUBSTRING_FOR_DATE."(updated,1,LENGTH('$k')) $not = '$k')");
2295
-					} else {
2294
+					array_push($query_keywords, "(".SUBSTRING_FOR_DATE."(updated,1,LENGTH('$k')) $not = '$k')");
2295
+				} else {
2296 2296
 
2297
-						if (DB_TYPE == "pgsql") {
2298
-							$k = mb_strtolower($k);
2299
-							array_push($search_query_leftover, $not ? "!$k" : $k);
2300
-						} else {
2301
-							array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").")
2297
+					if (DB_TYPE == "pgsql") {
2298
+						$k = mb_strtolower($k);
2299
+						array_push($search_query_leftover, $not ? "!$k" : $k);
2300
+					} else {
2301
+						array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").")
2302 2302
 								OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))");
2303
-						}
2304
-
2305
-						if (!$not) array_push($search_words, $k);
2306 2303
 					}
2304
+
2305
+					if (!$not) array_push($search_words, $k);
2306
+				}
2307 2307
 			}
2308 2308
 		}
2309 2309
 
Please login to merge, or discard this patch.
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@  discard block
 block discarded – undo
2 2
 require_once "colors.php";
3 3
 
4 4
 class Feeds extends Handler_Protected {
5
-	const NEVER_GROUP_FEEDS = [ -6, 0 ];
6
-	const NEVER_GROUP_BY_DATE = [ -2, -1, -3 ];
5
+	const NEVER_GROUP_FEEDS = [ -6, 0];
6
+	const NEVER_GROUP_BY_DATE = [ -2, -1, -3];
7 7
 
8 8
     private $params;
9 9
 
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
 		$reply = "";
29 29
 
30
-		$rss_link = htmlspecialchars(get_self_url_prefix() .
30
+		$rss_link = htmlspecialchars(get_self_url_prefix().
31 31
 			"/public.php?op=rss&id=$feed_id$cat_q$search_q");
32 32
 
33 33
 		$reply .= "<span class='left'>";
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 		}
50 50
 
51 51
 		if ($error)
52
-			$reply .= " <i title=\"" . htmlspecialchars($error) . "\" class='material-icons icon-error'>error</i>";
52
+			$reply .= " <i title=\"".htmlspecialchars($error)."\" class='material-icons icon-error'>error</i>";
53 53
 
54 54
 		$reply .= "</span>";
55 55
 		$reply .= "<span id='feed_current_unread' style='display: none'></span>";
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
             $sth->execute([$feed]);
140 140
 		}
141 141
 
142
-		if ($method_split[0] == "MarkAllReadGR")  {
142
+		if ($method_split[0] == "MarkAllReadGR") {
143 143
 			$this->catchup_feed($method_split[1], false);
144 144
 		}
145 145
 
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 				if (!get_pref('SHOW_CONTENT_PREVIEW')) {
244 244
 					$line["content_preview"] = "";
245 245
 				} else {
246
-					$line["content_preview"] =  "&mdash; " . truncate_string(strip_tags($line["content"]), 250);
246
+					$line["content_preview"] = "&mdash; ".truncate_string(strip_tags($line["content"]), 250);
247 247
 
248 248
 					foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) {
249 249
 						$line = $p->hook_query_headlines($line, 250, false);
@@ -322,10 +322,10 @@  discard block
 block discarded – undo
322 322
                 if (!get_pref("CDM_EXPANDED")) {
323 323
                     $line["cdm_excerpt"] = "<span class='collapse'>
324 324
                         <i class='material-icons' onclick='return Article.cdmUnsetActive(event)'
325
-                            title=\"" . __("Collapse article") . "\">remove_circle</i></span>";
325
+                            title=\"" . __("Collapse article")."\">remove_circle</i></span>";
326 326
 
327 327
                     if (get_pref('SHOW_CONTENT_PREVIEW')) {
328
-                        $line["cdm_excerpt"] .= "<span class='excerpt'>" . $line["content_preview"] . "</span>";
328
+                        $line["cdm_excerpt"] .= "<span class='excerpt'>".$line["content_preview"]."</span>";
329 329
                     }
330 330
                 }
331 331
 
@@ -339,11 +339,11 @@  discard block
 block discarded – undo
339 339
                     $ofgh->execute([$line["orig_feed_id"], $_SESSION['uid']]);
340 340
 
341 341
                     if ($tmp_line = $ofgh->fetch()) {
342
-                        $line["orig_feed"] = [ $tmp_line["title"], $tmp_line["site_url"], $tmp_line["feed_url"] ];
342
+                        $line["orig_feed"] = [$tmp_line["title"], $tmp_line["site_url"], $tmp_line["feed_url"]];
343 343
                     }
344 344
                 }
345 345
 
346
-				$line["updated_long"] = make_local_datetime($line["updated"],true);
346
+				$line["updated_long"] = make_local_datetime($line["updated"], true);
347 347
 				$line["updated"] = make_local_datetime($line["updated"], false, false, false, true);
348 348
 
349 349
 
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 				}
378 378
 
379 379
 				if (isset($rgba_cache[$feed_id])) {
380
-				    $line['feed_bg_color'] = 'rgba(' . implode(",", $rgba_cache[$feed_id]) . ',0.3)';
380
+				    $line['feed_bg_color'] = 'rgba('.implode(",", $rgba_cache[$feed_id]).',0.3)';
381 381
                 }
382 382
 
383 383
 				/* we don't need those */
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 
422 422
 					$reply['content'] .= "<p><span class=\"text-muted\">";
423 423
 
424
-					$sth = $this->pdo->prepare("SELECT " . SUBSTRING_FOR_DATE . "(MAX(last_updated), 1, 19) AS last_updated FROM ttrss_feeds
424
+					$sth = $this->pdo->prepare("SELECT ".SUBSTRING_FOR_DATE."(MAX(last_updated), 1, 19) AS last_updated FROM ttrss_feeds
425 425
                         WHERE owner_uid = ?");
426 426
 					$sth->execute([$_SESSION['uid']]);
427 427
 					$row = $sth->fetch();
@@ -439,8 +439,8 @@  discard block
 block discarded – undo
439 439
 
440 440
 					if ($num_errors > 0) {
441 441
 						$reply['content'] .= "<br/>";
442
-						$reply['content'] .= "<a class=\"text-muted\" href=\"#\" onclick=\"CommonDialogs.showFeedsWithErrors()\">" .
443
-							__('Some feeds have update errors (click for details)') . "</a>";
442
+						$reply['content'] .= "<a class=\"text-muted\" href=\"#\" onclick=\"CommonDialogs.showFeedsWithErrors()\">".
443
+							__('Some feeds have update errors (click for details)')."</a>";
444 444
 					}
445 445
 					$reply['content'] .= "</span></p></div>";
446 446
 
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
 		$reply['headlines']['is_cat'] = false;
636 636
 
637 637
 		$reply['headlines']['toolbar'] = '';
638
-		$reply['headlines']['content'] = "<div class='whiteBox'>". $error . "</div>";
638
+		$reply['headlines']['content'] = "<div class='whiteBox'>".$error."</div>";
639 639
 
640 640
 		$reply['headlines-info'] = array("count" => 0,
641 641
 			"unread" => 0,
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
 		print "<fieldset>";
670 670
 
671 671
 		if (get_pref('ENABLE_FEED_CATS')) {
672
-			print "<label class='inline'>" . __('Place in category:') . "</label> ";
672
+			print "<label class='inline'>".__('Place in category:')."</label> ";
673 673
 			print_feed_cat_select("cat", false, 'dojoType="fox.form.Select"');
674 674
 		}
675 675
 
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
 		print "</section>";
679 679
 
680 680
 		print '<div id="feedDlg_feedsContainer" style="display : none">
681
-				<header>' . __('Available feeds') . '</header>
681
+				<header>' . __('Available feeds').'</header>
682 682
 				<section>
683 683
 					<fieldset>
684 684
 						<select id="feedDlg_feedContainerSelect"
@@ -743,7 +743,7 @@  discard block
 block discarded – undo
743 743
 
744 744
 		if (DB_TYPE == "pgsql") {
745 745
 			print "<fieldset>";
746
-			print "<label class='inline'>" . __("Language:") . "</label>";
746
+			print "<label class='inline'>".__("Language:")."</label>";
747 747
 			print_select("search_language", get_pref('DEFAULT_SEARCH_LANGUAGE'), Pref_Feeds::get_ts_languages(),
748 748
 				"dojoType='fox.form.Select' title=\"".__('Used for word stemming')."\"");
749 749
 			print "</fieldset>";
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
 		Debug::set_enabled(true);
773 773
 		Debug::set_loglevel($_REQUEST["xdebug"]);
774 774
 
775
-		$feed_id = (int)$_REQUEST["feed_id"];
775
+		$feed_id = (int) $_REQUEST["feed_id"];
776 776
 		@$do_update = $_REQUEST["action"] == "do_update";
777 777
 		$csrf_token = $_REQUEST["csrf_token"];
778 778
 
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
 		</script>
812 812
 
813 813
 			<div class="container">
814
-				<h1>Feed Debugger: <?php echo "$feed_id: " . $this->getFeedTitle($feed_id) ?></h1>
814
+				<h1>Feed Debugger: <?php echo "$feed_id: ".$this->getFeedTitle($feed_id) ?></h1>
815 815
 				<div class="content">
816 816
 					<form method="GET" action="">
817 817
 						<input type="hidden" name="op" value="feeds">
@@ -1074,7 +1074,7 @@  discard block
 block discarded – undo
1074 1074
 		} else if ($n_feed >= 0) {
1075 1075
 
1076 1076
 			if ($n_feed != 0) {
1077
-				$match_part = "feed_id = " . (int)$n_feed;
1077
+				$match_part = "feed_id = ".(int) $n_feed;
1078 1078
 			} else {
1079 1079
 				$match_part = "feed_id IS NULL";
1080 1080
 			}
@@ -1184,7 +1184,7 @@  discard block
 block discarded – undo
1184 1184
 					(owner_uid,feed_url,title,cat_id, auth_login,auth_pass,update_method,auth_pass_encrypted)
1185 1185
 				VALUES (?, ?, ?, ?, ?, ?, 0, false)");
1186 1186
 
1187
-			$sth->execute([$_SESSION['uid'], $url, "[Unknown]", $cat_id, (string)$auth_login, (string)$auth_pass]);
1187
+			$sth->execute([$_SESSION['uid'], $url, "[Unknown]", $cat_id, (string) $auth_login, (string) $auth_pass]);
1188 1188
 
1189 1189
 			$sth = $pdo->prepare("SELECT id FROM ttrss_feeds WHERE feed_url = ?
1190 1190
 					AND owner_uid = ?");
@@ -1203,11 +1203,11 @@  discard block
 block discarded – undo
1203 1203
 	}
1204 1204
 
1205 1205
 	static function getIconFile($feed_id) {
1206
-		return ICONS_DIR . "/$feed_id.ico";
1206
+		return ICONS_DIR."/$feed_id.ico";
1207 1207
 	}
1208 1208
 
1209 1209
 	static function feedHasIcon($id) {
1210
-		return is_file(ICONS_DIR . "/$id.ico") && filesize(ICONS_DIR . "/$id.ico") > 0;
1210
+		return is_file(ICONS_DIR."/$id.ico") && filesize(ICONS_DIR."/$id.ico") > 0;
1211 1211
 	}
1212 1212
 
1213 1213
 	static function getFeedIcon($id) {
@@ -1237,7 +1237,7 @@  discard block
 block discarded – undo
1237 1237
 					$icon = self::getIconFile($id);
1238 1238
 
1239 1239
                     if ($icon && file_exists($icon)) {
1240
-						return ICONS_URL . "/" . basename($icon) . "?" . filemtime($icon);
1240
+						return ICONS_URL."/".basename($icon)."?".filemtime($icon);
1241 1241
 					}
1242 1242
 				}
1243 1243
 				break;
@@ -1310,7 +1310,7 @@  discard block
 block discarded – undo
1310 1310
 
1311 1311
 			$cat_feeds = array();
1312 1312
 			while ($line = $sth->fetch()) {
1313
-				array_push($cat_feeds, "feed_id = " . (int)$line["id"]);
1313
+				array_push($cat_feeds, "feed_id = ".(int) $line["id"]);
1314 1314
 			}
1315 1315
 
1316 1316
 			if (count($cat_feeds) == 0) return 0;
@@ -1524,7 +1524,7 @@  discard block
 block discarded – undo
1524 1524
 		}
1525 1525
 
1526 1526
 		if ($limit > 0) {
1527
-			$limit_query_part = "LIMIT " . (int)$limit;
1527
+			$limit_query_part = "LIMIT ".(int) $limit;
1528 1528
 		}
1529 1529
 
1530 1530
 		$allow_archived = false;
@@ -1551,7 +1551,7 @@  discard block
 block discarded – undo
1551 1551
 							implode(",", $subcats).")";
1552 1552
 
1553 1553
 					} else {
1554
-						$query_strategy_part = "cat_id = " . $pdo->quote($feed);
1554
+						$query_strategy_part = "cat_id = ".$pdo->quote($feed);
1555 1555
 					}
1556 1556
 
1557 1557
 				} else {
@@ -1561,7 +1561,7 @@  discard block
 block discarded – undo
1561 1561
 				$vfeed_query_part = "ttrss_feeds.title AS feed_title,";
1562 1562
 
1563 1563
 			} else {
1564
-				$query_strategy_part = "feed_id = " . $pdo->quote($feed);
1564
+				$query_strategy_part = "feed_id = ".$pdo->quote($feed);
1565 1565
 			}
1566 1566
 		} else if ($feed == 0 && !$cat_view) { // archive virtual feed
1567 1567
 			$query_strategy_part = "feed_id IS NULL";
@@ -1683,7 +1683,7 @@  discard block
 block discarded – undo
1683 1683
 		$content_query_part = "content, ";
1684 1684
 
1685 1685
 		if ($limit_query_part) {
1686
-			$offset_query_part = "OFFSET " . (int)$offset;
1686
+			$offset_query_part = "OFFSET ".(int) $offset;
1687 1687
 		} else {
1688 1688
 			$offset_query_part = "";
1689 1689
 		}
@@ -1772,7 +1772,7 @@  discard block
 block discarded – undo
1772 1772
 				$res = $pdo->query($query);
1773 1773
 
1774 1774
 				if ($row = $res->fetch()) {
1775
-					$first_id = (int)$row["id"];
1775
+					$first_id = (int) $row["id"];
1776 1776
 
1777 1777
 					if ($offset > 0 && $first_id && $check_first_id && $first_id != $check_first_id) {
1778 1778
 						return array(-1, $feed_title, $feed_site_url, $last_error, $last_updated, $search_words, $first_id, $vfeed_query_part != "", $query_error_override);
@@ -1919,9 +1919,9 @@  discard block
 block discarded – undo
1919 1919
 	}
1920 1920
 
1921 1921
     function color_of($name) {
1922
-        $colormap = [ "#1cd7d7","#d91111","#1212d7","#8e16e5","#7b7b7b",
1923
-            "#39f110","#0bbea6","#ec0e0e","#1534f2","#b9e416",
1924
-            "#479af2","#f36b14","#10c7e9","#1e8fe7","#e22727" ];
1922
+        $colormap = ["#1cd7d7", "#d91111", "#1212d7", "#8e16e5", "#7b7b7b",
1923
+            "#39f110", "#0bbea6", "#ec0e0e", "#1534f2", "#b9e416",
1924
+            "#479af2", "#f36b14", "#10c7e9", "#1e8fe7", "#e22727"];
1925 1925
 
1926 1926
         $sum = 0;
1927 1927
 
@@ -1985,13 +1985,13 @@  discard block
 block discarded – undo
1985 1985
 
1986 1986
 		// support schema-less urls
1987 1987
 		if (strpos($url, '//') === 0) {
1988
-			$url = 'https:' . $url;
1988
+			$url = 'https:'.$url;
1989 1989
 		}
1990 1990
 
1991 1991
 		if (strpos($url, '://') === false) {
1992
-			$url = 'http://' . $url;
1992
+			$url = 'http://'.$url;
1993 1993
 		} else if (substr($url, 0, 5) == 'feed:') {
1994
-			$url = 'http:' . substr($url, 5);
1994
+			$url = 'http:'.substr($url, 5);
1995 1995
 		}
1996 1996
 
1997 1997
 		//prepend slash if the URL has no slash in it
@@ -2041,7 +2041,7 @@  discard block
 block discarded – undo
2041 2041
 
2042 2042
 			$sth = $pdo->prepare("INSERT INTO ttrss_feed_categories (owner_uid,title,parent_cat,order_id)
2043 2043
 					VALUES (?, ?, ?, ?)");
2044
-			$sth->execute([$_SESSION['uid'], $feed_cat, $parent_cat_id, (int)$order_id]);
2044
+			$sth->execute([$_SESSION['uid'], $feed_cat, $parent_cat_id, (int) $order_id]);
2045 2045
 
2046 2046
 			if (!$tr_in_progress) $pdo->commit();
2047 2047
 
@@ -2141,7 +2141,7 @@  discard block
 block discarded – undo
2141 2141
 			$sth->execute([$feed_id]);
2142 2142
 
2143 2143
 		} else {
2144
-			$sth  = $pdo->prepare("DELETE FROM ttrss_user_entries
2144
+			$sth = $pdo->prepare("DELETE FROM ttrss_user_entries
2145 2145
 				USING ttrss_user_entries, ttrss_entries
2146 2146
 				WHERE ttrss_entries.id = ref_id AND
2147 2147
 				marked = false AND
@@ -2211,7 +2211,7 @@  discard block
 block discarded – undo
2211 2211
 				case "title":
2212 2212
 					if ($commandpair[1]) {
2213 2213
 						array_push($query_keywords, "($not (LOWER(ttrss_entries.title) LIKE ".
2214
-							$pdo->quote('%' . mb_strtolower($commandpair[1]) . '%') ."))");
2214
+							$pdo->quote('%'.mb_strtolower($commandpair[1]).'%')."))");
2215 2215
 					} else {
2216 2216
 						array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%')
2217 2217
 								OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))");
@@ -2221,7 +2221,7 @@  discard block
 block discarded – undo
2221 2221
 				case "author":
2222 2222
 					if ($commandpair[1]) {
2223 2223
 						array_push($query_keywords, "($not (LOWER(author) LIKE ".
2224
-							$pdo->quote('%' . mb_strtolower($commandpair[1]) . '%')."))");
2224
+							$pdo->quote('%'.mb_strtolower($commandpair[1]).'%')."))");
2225 2225
 					} else {
2226 2226
 						array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%')
2227 2227
 								OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))");
@@ -2236,7 +2236,7 @@  discard block
 block discarded – undo
2236 2236
 							array_push($query_keywords, "($not (note IS NULL OR note = ''))");
2237 2237
 						else
2238 2238
 							array_push($query_keywords, "($not (LOWER(note) LIKE ".
2239
-								$pdo->quote('%' . mb_strtolower($commandpair[1]) . '%')."))");
2239
+								$pdo->quote('%'.mb_strtolower($commandpair[1]).'%')."))");
2240 2240
 					} else {
2241 2241
 						array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").")
2242 2242
 								OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))");
@@ -2313,7 +2313,7 @@  discard block
 block discarded – undo
2313 2313
 
2314 2314
 				// if there's no joiners consider this a "simple" search and
2315 2315
 				// concatenate everything with &, otherwise don't try to mess with tsquery syntax
2316
-				if (preg_match("/[&|]/", implode(" " , $search_query_leftover))) {
2316
+				if (preg_match("/[&|]/", implode(" ", $search_query_leftover))) {
2317 2317
 					$tsquery = $pdo->quote(implode(" ", $search_query_leftover));
2318 2318
 				} else {
2319 2319
 					$tsquery = $pdo->quote(implode(" & ", $search_query_leftover));
Please login to merge, or discard this patch.
Braces   +162 added lines, -85 removed lines patch added patch discarded remove patch
@@ -17,7 +17,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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, $id);
359 373
 
@@ -383,8 +397,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
851 869
 
852 870
 	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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 = ?");
@@ -1294,13 +1320,17 @@  discard block
 block discarded – undo
1294 1320
 
1295 1321
 	static function getCategoryUnread($cat, $owner_uid = false) {
1296 1322
 
1297
-		if (!$owner_uid) $owner_uid = $_SESSION["uid"];
1323
+		if (!$owner_uid) {
1324
+			$owner_uid = $_SESSION["uid"];
1325
+		}
1298 1326
 
1299 1327
 		$pdo = Db::pdo();
1300 1328
 
1301 1329
 		if ($cat >= 0) {
1302 1330
 
1303
-		    if (!$cat) $cat = null;
1331
+		    if (!$cat) {
1332
+		    	$cat = null;
1333
+		    }
1304 1334
 
1305 1335
 			$sth = $pdo->prepare("SELECT id FROM ttrss_feeds
1306 1336
                     WHERE (cat_id = :cat OR (:cat IS NULL AND cat_id IS NULL))
@@ -1313,7 +1343,9 @@  discard block
 block discarded – undo
1313 1343
 				array_push($cat_feeds, "feed_id = " . (int)$line["id"]);
1314 1344
 			}
1315 1345
 
1316
-			if (count($cat_feeds) == 0) return 0;
1346
+			if (count($cat_feeds) == 0) {
1347
+				return 0;
1348
+			}
1317 1349
 
1318 1350
 			$match_part = implode(" OR ", $cat_feeds);
1319 1351
 
@@ -1348,7 +1380,9 @@  discard block
 block discarded – undo
1348 1380
 
1349 1381
 	// only accepts real cats (>= 0)
1350 1382
 	static function getCategoryChildrenUnread($cat, $owner_uid = false) {
1351
-		if (!$owner_uid) $owner_uid = $_SESSION["uid"];
1383
+		if (!$owner_uid) {
1384
+			$owner_uid = $_SESSION["uid"];
1385
+		}
1352 1386
 
1353 1387
 		$pdo = Db::pdo();
1354 1388
 
@@ -1368,7 +1402,9 @@  discard block
 block discarded – undo
1368 1402
 
1369 1403
 	static function getGlobalUnread($user_id = false) {
1370 1404
 
1371
-		if (!$user_id) $user_id = $_SESSION["uid"];
1405
+		if (!$user_id) {
1406
+			$user_id = $_SESSION["uid"];
1407
+		}
1372 1408
 
1373 1409
 		$pdo = Db::pdo();
1374 1410
 
@@ -1403,7 +1439,9 @@  discard block
 block discarded – undo
1403 1439
 	}
1404 1440
 
1405 1441
 	static function getLabelUnread($label_id, $owner_uid = false) {
1406
-		if (!$owner_uid) $owner_uid = $_SESSION["uid"];
1442
+		if (!$owner_uid) {
1443
+			$owner_uid = $_SESSION["uid"];
1444
+		}
1407 1445
 
1408 1446
 		$pdo = Db::pdo();
1409 1447
 
@@ -1498,8 +1536,9 @@  discard block
 block discarded – undo
1498 1536
 
1499 1537
 				$unread = getFeedUnread($feed, $cat_view);
1500 1538
 
1501
-				if ($cat_view && $feed > 0 && $include_children)
1502
-					$unread += Feeds::getCategoryChildrenUnread($feed);
1539
+				if ($cat_view && $feed > 0 && $include_children) {
1540
+									$unread += Feeds::getCategoryChildrenUnread($feed);
1541
+				}
1503 1542
 
1504 1543
 				if ($unread > 0) {
1505 1544
 					$view_query_part = " unread = true AND ";
@@ -1611,7 +1650,9 @@  discard block
 block discarded – undo
1611 1650
 			$allow_archived = true;
1612 1651
 			$ignore_vfeed_group = true;
1613 1652
 
1614
-			if (!$override_order) $override_order = "last_read DESC";
1653
+			if (!$override_order) {
1654
+				$override_order = "last_read DESC";
1655
+			}
1615 1656
 
1616 1657
 		} else if ($feed == -3) { // fresh virtual feed
1617 1658
 			$query_strategy_part = "unread = true AND score >= 0";
@@ -1722,13 +1763,16 @@  discard block
 block discarded – undo
1722 1763
 						LEFT JOIN ttrss_feeds ON (feed_id = ttrss_feeds.id)";
1723 1764
 			}
1724 1765
 
1725
-			if ($vfeed_query_part) $vfeed_query_part .= "favicon_avg_color,";
1766
+			if ($vfeed_query_part) {
1767
+				$vfeed_query_part .= "favicon_avg_color,";
1768
+			}
1726 1769
 
1727 1770
 			$first_id = 0;
1728 1771
 			$first_id_query_strategy_part = $query_strategy_part;
1729 1772
 
1730
-			if ($feed == -3)
1731
-				$first_id_query_strategy_part = "true";
1773
+			if ($feed == -3) {
1774
+							$first_id_query_strategy_part = "true";
1775
+			}
1732 1776
 
1733 1777
 			if (DB_TYPE == "pgsql") {
1734 1778
 				$sanity_interval_qpart = "date_entered >= NOW() - INTERVAL '1 hour' AND";
@@ -1860,7 +1904,9 @@  discard block
 block discarded – undo
1860 1904
 							$query_strategy_part ORDER BY $order_by
1861 1905
 							$limit_query_part $offset_query_part";
1862 1906
 
1863
-			if ($_REQUEST["debug"]) print $query;
1907
+			if ($_REQUEST["debug"]) {
1908
+				print $query;
1909
+			}
1864 1910
 
1865 1911
 			$res = $pdo->query($query);
1866 1912
 		}
@@ -2010,18 +2056,23 @@  discard block
 block discarded – undo
2010 2056
 			}
2011 2057
 		}
2012 2058
 
2013
-		if ($url != "http:///")
2014
-			return $url;
2015
-		else
2016
-			return '';
2059
+		if ($url != "http:///") {
2060
+					return $url;
2061
+		} else {
2062
+					return '';
2063
+		}
2017 2064
 	}
2018 2065
 
2019 2066
 	static function add_feed_category($feed_cat, $parent_cat_id = false, $order_id = 0) {
2020 2067
 
2021
-		if (!$feed_cat) return false;
2068
+		if (!$feed_cat) {
2069
+			return false;
2070
+		}
2022 2071
 
2023 2072
 		$feed_cat = mb_substr($feed_cat, 0, 250);
2024
-		if (!$parent_cat_id) $parent_cat_id = null;
2073
+		if (!$parent_cat_id) {
2074
+			$parent_cat_id = null;
2075
+		}
2025 2076
 
2026 2077
 		$pdo = Db::pdo();
2027 2078
 		$tr_in_progress = false;
@@ -2043,7 +2094,9 @@  discard block
 block discarded – undo
2043 2094
 					VALUES (?, ?, ?, ?)");
2044 2095
 			$sth->execute([$_SESSION['uid'], $feed_cat, $parent_cat_id, (int)$order_id]);
2045 2096
 
2046
-			if (!$tr_in_progress) $pdo->commit();
2097
+			if (!$tr_in_progress) {
2098
+				$pdo->commit();
2099
+			}
2047 2100
 
2048 2101
 			return true;
2049 2102
 		}
@@ -2055,7 +2108,9 @@  discard block
 block discarded – undo
2055 2108
 
2056 2109
 	static function get_feed_access_key($feed_id, $is_cat, $owner_uid = false) {
2057 2110
 
2058
-		if (!$owner_uid) $owner_uid = $_SESSION["uid"];
2111
+		if (!$owner_uid) {
2112
+			$owner_uid = $_SESSION["uid"];
2113
+		}
2059 2114
 
2060 2115
 		$is_cat = bool_to_sql_bool($is_cat);
2061 2116
 
@@ -2093,7 +2148,9 @@  discard block
 block discarded – undo
2093 2148
 	 */
2094 2149
 	static function purge_feed($feed_id, $purge_interval) {
2095 2150
 
2096
-		if (!$purge_interval) $purge_interval = Feeds::feed_purge_interval($feed_id);
2151
+		if (!$purge_interval) {
2152
+			$purge_interval = Feeds::feed_purge_interval($feed_id);
2153
+		}
2097 2154
 
2098 2155
 		$pdo = Db::pdo();
2099 2156
 
@@ -2113,7 +2170,9 @@  discard block
 block discarded – undo
2113 2170
 			return;
2114 2171
 		}
2115 2172
 
2116
-		if (!$owner_uid) return;
2173
+		if (!$owner_uid) {
2174
+			return;
2175
+		}
2117 2176
 
2118 2177
 		if (FORCE_ARTICLE_PURGE == 0) {
2119 2178
 			$purge_unread = get_pref("PURGE_UNREAD_ARTICLES",
@@ -2123,10 +2182,11 @@  discard block
 block discarded – undo
2123 2182
 			$purge_interval = FORCE_ARTICLE_PURGE;
2124 2183
 		}
2125 2184
 
2126
-		if (!$purge_unread)
2127
-			$query_limit = " unread = false AND ";
2128
-		else
2129
-			$query_limit = "";
2185
+		if (!$purge_unread) {
2186
+					$query_limit = " unread = false AND ";
2187
+		} else {
2188
+					$query_limit = "";
2189
+		}
2130 2190
 
2131 2191
 		$purge_interval = (int) $purge_interval;
2132 2192
 
@@ -2173,8 +2233,10 @@  discard block
 block discarded – undo
2173 2233
 			$purge_interval = $row["purge_interval"];
2174 2234
 			$owner_uid = $row["owner_uid"];
2175 2235
 
2176
-			if ($purge_interval == 0) $purge_interval = get_pref(
2236
+			if ($purge_interval == 0) {
2237
+				$purge_interval = get_pref(
2177 2238
 				'PURGE_OLD_DAYS', $owner_uid);
2239
+			}
2178 2240
 
2179 2241
 			return $purge_interval;
2180 2242
 
@@ -2192,10 +2254,11 @@  discard block
 block discarded – undo
2192 2254
 
2193 2255
 		$pdo = Db::pdo();
2194 2256
 
2195
-		if ($search_language)
2196
-			$search_language = $pdo->quote(mb_strtolower($search_language));
2197
-		else
2198
-			$search_language = $pdo->quote("english");
2257
+		if ($search_language) {
2258
+					$search_language = $pdo->quote(mb_strtolower($search_language));
2259
+		} else {
2260
+					$search_language = $pdo->quote("english");
2261
+		}
2199 2262
 
2200 2263
 		foreach ($keywords as $k) {
2201 2264
 			if (strpos($k, "-") === 0) {
@@ -2230,56 +2293,68 @@  discard block
 block discarded – undo
2230 2293
 					break;
2231 2294
 				case "note":
2232 2295
 					if ($commandpair[1]) {
2233
-						if ($commandpair[1] == "true")
2234
-							array_push($query_keywords, "($not (note IS NOT NULL AND note != ''))");
2235
-						else if ($commandpair[1] == "false")
2236
-							array_push($query_keywords, "($not (note IS NULL OR note = ''))");
2237
-						else
2238
-							array_push($query_keywords, "($not (LOWER(note) LIKE ".
2296
+						if ($commandpair[1] == "true") {
2297
+													array_push($query_keywords, "($not (note IS NOT NULL AND note != ''))");
2298
+						} else if ($commandpair[1] == "false") {
2299
+													array_push($query_keywords, "($not (note IS NULL OR note = ''))");
2300
+						} else {
2301
+													array_push($query_keywords, "($not (LOWER(note) LIKE ".
2239 2302
 								$pdo->quote('%' . mb_strtolower($commandpair[1]) . '%')."))");
2303
+						}
2240 2304
 					} else {
2241 2305
 						array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").")
2242 2306
 								OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))");
2243
-						if (!$not) array_push($search_words, $k);
2307
+						if (!$not) {
2308
+							array_push($search_words, $k);
2309
+						}
2244 2310
 					}
2245 2311
 					break;
2246 2312
 				case "star":
2247 2313
 
2248 2314
 					if ($commandpair[1]) {
2249
-						if ($commandpair[1] == "true")
2250
-							array_push($query_keywords, "($not (marked = true))");
2251
-						else
2252
-							array_push($query_keywords, "($not (marked = false))");
2315
+						if ($commandpair[1] == "true") {
2316
+													array_push($query_keywords, "($not (marked = true))");
2317
+						} else {
2318
+													array_push($query_keywords, "($not (marked = false))");
2319
+						}
2253 2320
 					} else {
2254 2321
 						array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").")
2255 2322
 								OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))");
2256
-						if (!$not) array_push($search_words, $k);
2323
+						if (!$not) {
2324
+							array_push($search_words, $k);
2325
+						}
2257 2326
 					}
2258 2327
 					break;
2259 2328
 				case "pub":
2260 2329
 					if ($commandpair[1]) {
2261
-						if ($commandpair[1] == "true")
2262
-							array_push($query_keywords, "($not (published = true))");
2263
-						else
2264
-							array_push($query_keywords, "($not (published = false))");
2330
+						if ($commandpair[1] == "true") {
2331
+													array_push($query_keywords, "($not (published = true))");
2332
+						} else {
2333
+													array_push($query_keywords, "($not (published = false))");
2334
+						}
2265 2335
 
2266 2336
 					} else {
2267 2337
 						array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%')
2268 2338
 								OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))");
2269
-						if (!$not) array_push($search_words, $k);
2339
+						if (!$not) {
2340
+							array_push($search_words, $k);
2341
+						}
2270 2342
 					}
2271 2343
 					break;
2272 2344
 				case "unread":
2273 2345
 					if ($commandpair[1]) {
2274
-						if ($commandpair[1] == "true")
2275
-							array_push($query_keywords, "($not (unread = true))");
2276
-						else
2277
-							array_push($query_keywords, "($not (unread = false))");
2346
+						if ($commandpair[1] == "true") {
2347
+													array_push($query_keywords, "($not (unread = true))");
2348
+						} else {
2349
+													array_push($query_keywords, "($not (unread = false))");
2350
+						}
2278 2351
 
2279 2352
 					} else {
2280 2353
 						array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").")
2281 2354
 								OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))");
2282
-						if (!$not) array_push($search_words, $k);
2355
+						if (!$not) {
2356
+							array_push($search_words, $k);
2357
+						}
2283 2358
 					}
2284 2359
 					break;
2285 2360
 				default:
@@ -2302,7 +2377,9 @@  discard block
 block discarded – undo
2302 2377
 								OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))");
2303 2378
 						}
2304 2379
 
2305
-						if (!$not) array_push($search_words, $k);
2380
+						if (!$not) {
2381
+							array_push($search_words, $k);
2382
+						}
2306 2383
 					}
2307 2384
 			}
2308 2385
 		}
Please login to merge, or discard this patch.