Passed
Push — master ( 5a5c41...fade3b )
by Cody
04:50 queued 10s
created
classes/rpc.php 1 patch
Braces   +15 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,7 +11,9 @@  discard block
 block discarded – undo
11 11
 		$_SESSION["profile"] = (int) clean($_REQUEST["id"]);
12 12
 
13 13
 		// default value
14
-		if (!$_SESSION["profile"]) $_SESSION["profile"] = null;
14
+		if (!$_SESSION["profile"]) {
15
+			$_SESSION["profile"] = null;
16
+		}
15 17
 	}
16 18
 
17 19
 	public function remprofiles() {
@@ -173,7 +175,9 @@  discard block
 block discarded – undo
173 175
 				if ($row = $sth->fetch()) {
174 176
 					$feed_id = $row["id"];
175 177
 				} else {
176
-					if (!$title) $title = '[Unknown]';
178
+					if (!$title) {
179
+						$title = '[Unknown]';
180
+					}
177 181
 
178 182
 					$sth = $this->pdo->prepare("INSERT INTO ttrss_feeds
179 183
 							(owner_uid,feed_url,site_url,title,cat_id,auth_login,auth_pass,update_method)
@@ -216,7 +220,9 @@  discard block
 block discarded – undo
216 220
 	private function archive_article($id, $owner_uid) {
217 221
 		$this->pdo->beginTransaction();
218 222
 
219
-		if (!$owner_uid) $owner_uid = $_SESSION['uid'];
223
+		if (!$owner_uid) {
224
+			$owner_uid = $_SESSION['uid'];
225
+		}
220 226
 
221 227
 		$sth = $this->pdo->prepare("SELECT feed_id FROM ttrss_user_entries
222 228
 			WHERE ref_id = ? AND owner_uid = ?");
@@ -278,8 +284,9 @@  discard block
 block discarded – undo
278 284
 			'seq' => $seq
279 285
 		];
280 286
 
281
-		if ($seq % 2 == 0)
282
-			$reply['runtime-info'] = make_runtime_info();
287
+		if ($seq % 2 == 0) {
288
+					$reply['runtime-info'] = make_runtime_info();
289
+		}
283 290
 
284 291
 		print json_encode($reply);
285 292
 	}
@@ -353,7 +360,9 @@  discard block
 block discarded – undo
353 360
 		$payload = json_decode(clean($_REQUEST["payload"]), false);
354 361
 		$mode = clean($_REQUEST["mode"]);
355 362
 
356
-		if (!$payload || !is_array($payload)) return;
363
+		if (!$payload || !is_array($payload)) {
364
+			return;
365
+		}
357 366
 
358 367
 		if ($mode == 1) {
359 368
 			foreach ($payload as $feed) {
Please login to merge, or discard this patch.
classes/article.php 1 patch
Braces   +90 added lines, -53 removed lines patch added patch discarded remove patch
@@ -57,10 +57,16 @@  discard block
 block discarded – undo
57 57
 
58 58
 		$rc = false;
59 59
 
60
-		if (!$title) $title = $url;
61
-		if (!$title && !$url) return false;
60
+		if (!$title) {
61
+			$title = $url;
62
+		}
63
+		if (!$title && !$url) {
64
+			return false;
65
+		}
62 66
 
63
-		if (filter_var($url, FILTER_VALIDATE_URL) === FALSE) return false;
67
+		if (filter_var($url, FILTER_VALIDATE_URL) === FALSE) {
68
+			return false;
69
+		}
64 70
 
65 71
 		$pdo = Db::pdo();
66 72
 
@@ -271,7 +277,9 @@  discard block
 block discarded – undo
271 277
 		$tags_str = $this->format_tags_string($tags);
272 278
 		$tags_str_full = join(", ", $tags);
273 279
 
274
-		if (!$tags_str_full) $tags_str_full = __("no tags");
280
+		if (!$tags_str_full) {
281
+			$tags_str_full = __("no tags");
282
+		}
275 283
 
276 284
 		print json_encode([
277 285
 			"id" => (int) $id,
@@ -320,10 +328,11 @@  discard block
 block discarded – undo
320 328
 
321 329
 			foreach ($ids as $id) {
322 330
 
323
-				if ($assign)
324
-					Labels::add_article($id, $label, $_SESSION["uid"]);
325
-				else
326
-					Labels::remove_article($id, $label, $_SESSION["uid"]);
331
+				if ($assign) {
332
+									Labels::add_article($id, $label, $_SESSION["uid"]);
333
+				} else {
334
+									Labels::remove_article($id, $label, $_SESSION["uid"]);
335
+				}
327 336
 
328 337
 				$labels = $this->get_article_labels($id, $_SESSION["uid"]);
329 338
 
@@ -384,14 +393,18 @@  discard block
 block discarded – undo
384 393
 				$width = $line["width"];
385 394
 				$height = $line["height"];
386 395
 
387
-				if (!$ctype) $ctype = __("unknown type");
396
+				if (!$ctype) {
397
+					$ctype = __("unknown type");
398
+				}
388 399
 
389 400
 				//$filename = substr($url, strrpos($url, "/")+1);
390 401
 				$filename = basename($url);
391 402
 
392 403
 				$player = format_inline_player($url, $ctype);
393 404
 
394
-				if ($player) array_push($entries_inline, $player);
405
+				if ($player) {
406
+					array_push($entries_inline, $player);
407
+				}
395 408
 
396 409
 #				$entry .= " <a target=\"_blank\" href=\"" . htmlspecialchars($url) . "\" rel=\"noopener noreferrer\">" .
397 410
 #					$filename . " (" . $ctype . ")" . "</a>";
@@ -419,8 +432,9 @@  discard block
 block discarded – undo
419 432
 
420 433
 					foreach ($entries as $entry) {
421 434
 
422
-						foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ENCLOSURE) as $plugin)
423
-							$retval = $plugin->hook_render_enclosure($entry, $hide_images);
435
+						foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ENCLOSURE) as $plugin) {
436
+													$retval = $plugin->hook_render_enclosure($entry, $hide_images);
437
+						}
424 438
 
425 439
 
426 440
 						if ($retval) {
@@ -431,10 +445,12 @@  discard block
 block discarded – undo
431 445
 
432 446
 								if (!$hide_images) {
433 447
 									$encsize = '';
434
-									if ($entry['height'] > 0)
435
-										$encsize .= ' height="' . intval($entry['height']) . '"';
436
-									if ($entry['width'] > 0)
437
-										$encsize .= ' width="' . intval($entry['width']) . '"';
448
+									if ($entry['height'] > 0) {
449
+																			$encsize .= ' height="' . intval($entry['height']) . '"';
450
+									}
451
+									if ($entry['width'] > 0) {
452
+																			$encsize .= ' width="' . intval($entry['width']) . '"';
453
+									}
438 454
 									$rv .= "<p><img
439 455
 										alt=\"".htmlspecialchars($entry["filename"])."\"
440 456
 										src=\"" .htmlspecialchars($entry["url"]) . "\"
@@ -466,15 +482,17 @@  discard block
 block discarded – undo
466 482
 			$rv .= "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
467 483
 
468 484
 			foreach ($entries as $entry) {
469
-				if ($entry["title"])
470
-					$title = " &mdash; " . truncate_string($entry["title"], 30);
471
-				else
472
-					$title = "";
485
+				if ($entry["title"]) {
486
+									$title = " &mdash; " . truncate_string($entry["title"], 30);
487
+				} else {
488
+									$title = "";
489
+				}
473 490
 
474
-				if ($entry["filename"])
475
-					$filename = truncate_middle(htmlspecialchars($entry["filename"]), 60);
476
-				else
477
-					$filename = "";
491
+				if ($entry["filename"]) {
492
+									$filename = truncate_middle(htmlspecialchars($entry["filename"]), 60);
493
+				} else {
494
+									$filename = "";
495
+				}
478 496
 
479 497
 				$rv .= "<div onclick='popupOpenUrl(\"".htmlspecialchars($entry["url"])."\")'
480 498
 					dojoType=\"dijit.MenuItem\">".$filename . $title."</div>";
@@ -492,7 +510,9 @@  discard block
 block discarded – undo
492 510
 
493 511
 		$a_id = $id;
494 512
 
495
-		if (!$owner_uid) $owner_uid = $_SESSION["uid"];
513
+		if (!$owner_uid) {
514
+			$owner_uid = $_SESSION["uid"];
515
+		}
496 516
 
497 517
 		$pdo = Db::pdo();
498 518
 
@@ -510,7 +530,9 @@  discard block
 block discarded – undo
510 530
 				WHERE ref_id = ? AND owner_uid = ?");
511 531
 			$csth->execute([$id, $owner_uid]);
512 532
 
513
-			if ($row = $csth->fetch()) $tag_cache = $row["tag_cache"];
533
+			if ($row = $csth->fetch()) {
534
+				$tag_cache = $row["tag_cache"];
535
+			}
514 536
 		}
515 537
 
516 538
 		if ($tag_cache) {
@@ -551,8 +573,9 @@  discard block
 block discarded – undo
551 573
 
552 574
 			$tags_str = mb_substr($tags_str, 0, mb_strlen($tags_str)-2);
553 575
 
554
-			if (count($tags) > $maxtags)
555
-				$tags_str .= ", &hellip;";
576
+			if (count($tags) > $maxtags) {
577
+							$tags_str .= ", &hellip;";
578
+			}
556 579
 
557 580
 			return $tags_str;
558 581
 		}
@@ -560,7 +583,9 @@  discard block
 block discarded – undo
560 583
 
561 584
 	public static function format_article_labels($labels) {
562 585
 
563
-		if (!is_array($labels)) return '';
586
+		if (!is_array($labels)) {
587
+			return '';
588
+		}
564 589
 
565 590
 		$labels_str = "";
566 591
 
@@ -618,10 +643,11 @@  discard block
 block discarded – undo
618 643
 
619 644
         // purge orphaned posts in main content table
620 645
 
621
-        if (DB_TYPE == "mysql")
622
-            $limit_qpart = "LIMIT 5000";
623
-        else
624
-            $limit_qpart = "";
646
+        if (DB_TYPE == "mysql") {
647
+                    $limit_qpart = "LIMIT 5000";
648
+        } else {
649
+                    $limit_qpart = "";
650
+        }
625 651
 
626 652
         $pdo = Db::pdo();
627 653
         $res = $pdo->query("DELETE FROM ttrss_entries WHERE
@@ -635,7 +661,9 @@  discard block
 block discarded – undo
635 661
 
636 662
 	public static function catchupArticlesById($ids, $cmode, $owner_uid = false) {
637 663
 
638
-		if (!$owner_uid) $owner_uid = $_SESSION["uid"];
664
+		if (!$owner_uid) {
665
+			$owner_uid = $_SESSION["uid"];
666
+		}
639 667
 
640 668
 		$pdo = Db::pdo();
641 669
 
@@ -685,7 +713,9 @@  discard block
 block discarded – undo
685 713
 	public static function get_article_labels($id, $owner_uid = false) {
686 714
 		$rv = array();
687 715
 
688
-		if (!$owner_uid) $owner_uid = $_SESSION["uid"];
716
+		if (!$owner_uid) {
717
+			$owner_uid = $_SESSION["uid"];
718
+		}
689 719
 
690 720
 		$pdo = Db::pdo();
691 721
 
@@ -699,10 +729,11 @@  discard block
 block discarded – undo
699 729
 			if ($label_cache) {
700 730
 				$tmp = json_decode($label_cache, true);
701 731
 
702
-				if (!$tmp || $tmp["no-labels"] == 1)
703
-					return $rv;
704
-				else
705
-					return $tmp;
732
+				if (!$tmp || $tmp["no-labels"] == 1) {
733
+									return $rv;
734
+				} else {
735
+									return $tmp;
736
+				}
706 737
 			}
707 738
 		}
708 739
 
@@ -721,10 +752,11 @@  discard block
 block discarded – undo
721 752
 			array_push($rv, $rk);
722 753
 		}
723 754
 
724
-		if (count($rv) > 0)
725
-			Labels::update_cache($owner_uid, $id, $rv);
726
-		else
727
-			Labels::update_cache($owner_uid, $id, array("no-labels" => 1));
755
+		if (count($rv) > 0) {
756
+					Labels::update_cache($owner_uid, $id, $rv);
757
+		} else {
758
+					Labels::update_cache($owner_uid, $id, array("no-labels" => 1));
759
+		}
728 760
 
729 761
 		return $rv;
730 762
 	}
@@ -772,28 +804,33 @@  discard block
 block discarded – undo
772 804
 				}
773 805
 			}
774 806
 
775
-			if (!$article_image)
776
-				foreach ($enclosures as $enc) {
807
+			if (!$article_image) {
808
+							foreach ($enclosures as $enc) {
777 809
 					if (strpos($enc["content_type"], "image/") !== FALSE) {
778 810
 						$article_image = $enc["content_url"];
811
+			}
779 812
 						break;
780 813
 					}
781 814
 				}
782 815
 
783
-			if ($article_image)
784
-				$article_image = rewrite_relative_url($site_url, $article_image);
816
+			if ($article_image) {
817
+							$article_image = rewrite_relative_url($site_url, $article_image);
818
+			}
785 819
 
786
-			if ($article_stream)
787
-				$article_stream = rewrite_relative_url($site_url, $article_stream);
820
+			if ($article_stream) {
821
+							$article_stream = rewrite_relative_url($site_url, $article_stream);
822
+			}
788 823
 		}
789 824
 
790 825
 		$cache = new DiskCache("images");
791 826
 
792
-		if ($article_image && $cache->exists(sha1($article_image)))
793
-			$article_image = $cache->getUrl(sha1($article_image));
827
+		if ($article_image && $cache->exists(sha1($article_image))) {
828
+					$article_image = $cache->getUrl(sha1($article_image));
829
+		}
794 830
 
795
-		if ($article_stream && $cache->exists(sha1($article_stream)))
796
-			$article_stream = $cache->getUrl(sha1($article_stream));
831
+		if ($article_stream && $cache->exists(sha1($article_stream))) {
832
+					$article_stream = $cache->getUrl(sha1($article_stream));
833
+		}
797 834
 
798 835
 		return [$article_image, $article_stream];
799 836
 	}
Please login to merge, or discard this patch.
classes/feeds.php 1 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);
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
 	public static function catchup_feed($feed, $cat_view, $owner_uid = false, $mode = 'all', $search = false) {
853 871
 
854
-		if (!$owner_uid) $owner_uid = $_SESSION['uid'];
872
+		if (!$owner_uid) {
873
+			$owner_uid = $_SESSION['uid'];
874
+		}
855 875
 
856 876
 		$pdo = Db::pdo();
857 877
 
@@ -1026,7 +1046,9 @@  discard block
 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 = ?");
@@ -1287,13 +1313,17 @@  discard block
 block discarded – undo
1287 1313
 
1288 1314
 	public static function getCategoryUnread($cat, $owner_uid = false) {
1289 1315
 
1290
-		if (!$owner_uid) $owner_uid = $_SESSION["uid"];
1316
+		if (!$owner_uid) {
1317
+			$owner_uid = $_SESSION["uid"];
1318
+		}
1291 1319
 
1292 1320
 		$pdo = Db::pdo();
1293 1321
 
1294 1322
 		if ($cat >= 0) {
1295 1323
 
1296
-		    if (!$cat) $cat = null;
1324
+		    if (!$cat) {
1325
+		    	$cat = null;
1326
+		    }
1297 1327
 
1298 1328
 			$sth = $pdo->prepare("SELECT id FROM ttrss_feeds
1299 1329
                     WHERE (cat_id = :cat OR (:cat IS NULL AND cat_id IS NULL))
@@ -1306,7 +1336,9 @@  discard block
 block discarded – undo
1306 1336
 				array_push($cat_feeds, "feed_id = " . (int)$line["id"]);
1307 1337
 			}
1308 1338
 
1309
-			if (count($cat_feeds) == 0) return 0;
1339
+			if (count($cat_feeds) == 0) {
1340
+				return 0;
1341
+			}
1310 1342
 
1311 1343
 			$match_part = implode(" OR ", $cat_feeds);
1312 1344
 
@@ -1341,7 +1373,9 @@  discard block
 block discarded – undo
1341 1373
 
1342 1374
 	// only accepts real cats (>= 0)
1343 1375
 	public static function getCategoryChildrenUnread($cat, $owner_uid = false) {
1344
-		if (!$owner_uid) $owner_uid = $_SESSION["uid"];
1376
+		if (!$owner_uid) {
1377
+			$owner_uid = $_SESSION["uid"];
1378
+		}
1345 1379
 
1346 1380
 		$pdo = Db::pdo();
1347 1381
 
@@ -1361,7 +1395,9 @@  discard block
 block discarded – undo
1361 1395
 
1362 1396
 	public static function getGlobalUnread($user_id = false) {
1363 1397
 
1364
-		if (!$user_id) $user_id = $_SESSION["uid"];
1398
+		if (!$user_id) {
1399
+			$user_id = $_SESSION["uid"];
1400
+		}
1365 1401
 
1366 1402
 		$pdo = Db::pdo();
1367 1403
 
@@ -1396,7 +1432,9 @@  discard block
 block discarded – undo
1396 1432
 	}
1397 1433
 
1398 1434
 	public static function getLabelUnread($label_id, $owner_uid = false) {
1399
-		if (!$owner_uid) $owner_uid = $_SESSION["uid"];
1435
+		if (!$owner_uid) {
1436
+			$owner_uid = $_SESSION["uid"];
1437
+		}
1400 1438
 
1401 1439
 		$pdo = Db::pdo();
1402 1440
 
@@ -1491,8 +1529,9 @@  discard block
 block discarded – undo
1491 1529
 
1492 1530
 				$unread = getFeedUnread($feed, $cat_view);
1493 1531
 
1494
-				if ($cat_view && $feed > 0 && $include_children)
1495
-					$unread += Feeds::getCategoryChildrenUnread($feed);
1532
+				if ($cat_view && $feed > 0 && $include_children) {
1533
+									$unread += Feeds::getCategoryChildrenUnread($feed);
1534
+				}
1496 1535
 
1497 1536
 				if ($unread > 0) {
1498 1537
 					$view_query_part = " unread = true AND ";
@@ -1604,7 +1643,9 @@  discard block
 block discarded – undo
1604 1643
 			$allow_archived = true;
1605 1644
 			$ignore_vfeed_group = true;
1606 1645
 
1607
-			if (!$override_order) $override_order = "last_read DESC";
1646
+			if (!$override_order) {
1647
+				$override_order = "last_read DESC";
1648
+			}
1608 1649
 
1609 1650
 		} else if ($feed == -3) { // fresh virtual feed
1610 1651
 			$query_strategy_part = "unread = true AND score >= 0";
@@ -1715,13 +1756,16 @@  discard block
 block discarded – undo
1715 1756
 						LEFT JOIN ttrss_feeds ON (feed_id = ttrss_feeds.id)";
1716 1757
 			}
1717 1758
 
1718
-			if ($vfeed_query_part) $vfeed_query_part .= "favicon_avg_color,";
1759
+			if ($vfeed_query_part) {
1760
+				$vfeed_query_part .= "favicon_avg_color,";
1761
+			}
1719 1762
 
1720 1763
 			$first_id = 0;
1721 1764
 			$first_id_query_strategy_part = $query_strategy_part;
1722 1765
 
1723
-			if ($feed == -3)
1724
-				$first_id_query_strategy_part = "true";
1766
+			if ($feed == -3) {
1767
+							$first_id_query_strategy_part = "true";
1768
+			}
1725 1769
 
1726 1770
 			if (DB_TYPE == "pgsql") {
1727 1771
 				$sanity_interval_qpart = "date_entered >= NOW() - INTERVAL '1 hour' AND";
@@ -1853,7 +1897,9 @@  discard block
 block discarded – undo
1853 1897
 							$query_strategy_part ORDER BY $order_by
1854 1898
 							$limit_query_part $offset_query_part";
1855 1899
 
1856
-			if ($_REQUEST["debug"]) print $query;
1900
+			if ($_REQUEST["debug"]) {
1901
+				print $query;
1902
+			}
1857 1903
 
1858 1904
 			$res = $pdo->query($query);
1859 1905
 		}
@@ -2003,18 +2049,23 @@  discard block
 block discarded – undo
2003 2049
 			}
2004 2050
 		}
2005 2051
 
2006
-		if ($url != "http:///")
2007
-			return $url;
2008
-		else
2009
-			return '';
2052
+		if ($url != "http:///") {
2053
+					return $url;
2054
+		} else {
2055
+					return '';
2056
+		}
2010 2057
 	}
2011 2058
 
2012 2059
 	public static function add_feed_category($feed_cat, $parent_cat_id = false, $order_id = 0) {
2013 2060
 
2014
-		if (!$feed_cat) return false;
2061
+		if (!$feed_cat) {
2062
+			return false;
2063
+		}
2015 2064
 
2016 2065
 		$feed_cat = mb_substr($feed_cat, 0, 250);
2017
-		if (!$parent_cat_id) $parent_cat_id = null;
2066
+		if (!$parent_cat_id) {
2067
+			$parent_cat_id = null;
2068
+		}
2018 2069
 
2019 2070
 		$pdo = Db::pdo();
2020 2071
 		$tr_in_progress = false;
@@ -2036,7 +2087,9 @@  discard block
 block discarded – undo
2036 2087
 					VALUES (?, ?, ?, ?)");
2037 2088
 			$sth->execute([$_SESSION['uid'], $feed_cat, $parent_cat_id, (int)$order_id]);
2038 2089
 
2039
-			if (!$tr_in_progress) $pdo->commit();
2090
+			if (!$tr_in_progress) {
2091
+				$pdo->commit();
2092
+			}
2040 2093
 
2041 2094
 			return true;
2042 2095
 		}
@@ -2048,7 +2101,9 @@  discard block
 block discarded – undo
2048 2101
 
2049 2102
 	public static function get_feed_access_key($feed_id, $is_cat, $owner_uid = false) {
2050 2103
 
2051
-		if (!$owner_uid) $owner_uid = $_SESSION["uid"];
2104
+		if (!$owner_uid) {
2105
+			$owner_uid = $_SESSION["uid"];
2106
+		}
2052 2107
 
2053 2108
 		$is_cat = bool_to_sql_bool($is_cat);
2054 2109
 
@@ -2086,7 +2141,9 @@  discard block
 block discarded – undo
2086 2141
 	 */
2087 2142
 	public static function purge_feed($feed_id, $purge_interval) {
2088 2143
 
2089
-		if (!$purge_interval) $purge_interval = Feeds::feed_purge_interval($feed_id);
2144
+		if (!$purge_interval) {
2145
+			$purge_interval = Feeds::feed_purge_interval($feed_id);
2146
+		}
2090 2147
 
2091 2148
 		$pdo = Db::pdo();
2092 2149
 
@@ -2106,7 +2163,9 @@  discard block
 block discarded – undo
2106 2163
 			return;
2107 2164
 		}
2108 2165
 
2109
-		if (!$owner_uid) return;
2166
+		if (!$owner_uid) {
2167
+			return;
2168
+		}
2110 2169
 
2111 2170
 		if (FORCE_ARTICLE_PURGE == 0) {
2112 2171
 			$purge_unread = get_pref("PURGE_UNREAD_ARTICLES",
@@ -2116,10 +2175,11 @@  discard block
 block discarded – undo
2116 2175
 			$purge_interval = FORCE_ARTICLE_PURGE;
2117 2176
 		}
2118 2177
 
2119
-		if (!$purge_unread)
2120
-			$query_limit = " unread = false AND ";
2121
-		else
2122
-			$query_limit = "";
2178
+		if (!$purge_unread) {
2179
+					$query_limit = " unread = false AND ";
2180
+		} else {
2181
+					$query_limit = "";
2182
+		}
2123 2183
 
2124 2184
 		$purge_interval = (int) $purge_interval;
2125 2185
 
@@ -2166,8 +2226,10 @@  discard block
 block discarded – undo
2166 2226
 			$purge_interval = $row["purge_interval"];
2167 2227
 			$owner_uid = $row["owner_uid"];
2168 2228
 
2169
-			if ($purge_interval == 0) $purge_interval = get_pref(
2229
+			if ($purge_interval == 0) {
2230
+				$purge_interval = get_pref(
2170 2231
 				'PURGE_OLD_DAYS', $owner_uid);
2232
+			}
2171 2233
 
2172 2234
 			return $purge_interval;
2173 2235
 
@@ -2185,10 +2247,11 @@  discard block
 block discarded – undo
2185 2247
 
2186 2248
 		$pdo = Db::pdo();
2187 2249
 
2188
-		if ($search_language)
2189
-			$search_language = $pdo->quote(mb_strtolower($search_language));
2190
-		else
2191
-			$search_language = $pdo->quote("english");
2250
+		if ($search_language) {
2251
+					$search_language = $pdo->quote(mb_strtolower($search_language));
2252
+		} else {
2253
+					$search_language = $pdo->quote("english");
2254
+		}
2192 2255
 
2193 2256
 		foreach ($keywords as $k) {
2194 2257
 			if (strpos($k, "-") === 0) {
@@ -2223,56 +2286,68 @@  discard block
 block discarded – undo
2223 2286
 					break;
2224 2287
 				case "note":
2225 2288
 					if ($commandpair[1]) {
2226
-						if ($commandpair[1] == "true")
2227
-							array_push($query_keywords, "($not (note IS NOT NULL AND note != ''))");
2228
-						else if ($commandpair[1] == "false")
2229
-							array_push($query_keywords, "($not (note IS NULL OR note = ''))");
2230
-						else
2231
-							array_push($query_keywords, "($not (LOWER(note) LIKE ".
2289
+						if ($commandpair[1] == "true") {
2290
+													array_push($query_keywords, "($not (note IS NOT NULL AND note != ''))");
2291
+						} else if ($commandpair[1] == "false") {
2292
+													array_push($query_keywords, "($not (note IS NULL OR note = ''))");
2293
+						} else {
2294
+													array_push($query_keywords, "($not (LOWER(note) LIKE ".
2232 2295
 								$pdo->quote('%' . mb_strtolower($commandpair[1]) . '%')."))");
2296
+						}
2233 2297
 					} else {
2234 2298
 						array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").")
2235 2299
 								OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))");
2236
-						if (!$not) array_push($search_words, $k);
2300
+						if (!$not) {
2301
+							array_push($search_words, $k);
2302
+						}
2237 2303
 					}
2238 2304
 					break;
2239 2305
 				case "star":
2240 2306
 
2241 2307
 					if ($commandpair[1]) {
2242
-						if ($commandpair[1] == "true")
2243
-							array_push($query_keywords, "($not (marked = true))");
2244
-						else
2245
-							array_push($query_keywords, "($not (marked = false))");
2308
+						if ($commandpair[1] == "true") {
2309
+													array_push($query_keywords, "($not (marked = true))");
2310
+						} else {
2311
+													array_push($query_keywords, "($not (marked = false))");
2312
+						}
2246 2313
 					} else {
2247 2314
 						array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").")
2248 2315
 								OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))");
2249
-						if (!$not) array_push($search_words, $k);
2316
+						if (!$not) {
2317
+							array_push($search_words, $k);
2318
+						}
2250 2319
 					}
2251 2320
 					break;
2252 2321
 				case "pub":
2253 2322
 					if ($commandpair[1]) {
2254
-						if ($commandpair[1] == "true")
2255
-							array_push($query_keywords, "($not (published = true))");
2256
-						else
2257
-							array_push($query_keywords, "($not (published = false))");
2323
+						if ($commandpair[1] == "true") {
2324
+													array_push($query_keywords, "($not (published = true))");
2325
+						} else {
2326
+													array_push($query_keywords, "($not (published = false))");
2327
+						}
2258 2328
 
2259 2329
 					} else {
2260 2330
 						array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%')
2261 2331
 								OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))");
2262
-						if (!$not) array_push($search_words, $k);
2332
+						if (!$not) {
2333
+							array_push($search_words, $k);
2334
+						}
2263 2335
 					}
2264 2336
 					break;
2265 2337
 				case "unread":
2266 2338
 					if ($commandpair[1]) {
2267
-						if ($commandpair[1] == "true")
2268
-							array_push($query_keywords, "($not (unread = true))");
2269
-						else
2270
-							array_push($query_keywords, "($not (unread = false))");
2339
+						if ($commandpair[1] == "true") {
2340
+													array_push($query_keywords, "($not (unread = true))");
2341
+						} else {
2342
+													array_push($query_keywords, "($not (unread = false))");
2343
+						}
2271 2344
 
2272 2345
 					} else {
2273 2346
 						array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").")
2274 2347
 								OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))");
2275
-						if (!$not) array_push($search_words, $k);
2348
+						if (!$not) {
2349
+							array_push($search_words, $k);
2350
+						}
2276 2351
 					}
2277 2352
 					break;
2278 2353
 				default:
@@ -2295,7 +2370,9 @@  discard block
 block discarded – undo
2295 2370
 								OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))");
2296 2371
 						}
2297 2372
 
2298
-						if (!$not) array_push($search_words, $k);
2373
+						if (!$not) {
2374
+							array_push($search_words, $k);
2375
+						}
2299 2376
 					}
2300 2377
 			}
2301 2378
 		}
Please login to merge, or discard this patch.
classes/pref/feeds.php 1 patch
Braces   +40 added lines, -26 removed lines patch added patch discarded remove patch
@@ -42,10 +42,11 @@  discard block
 block discarded – undo
42 42
 
43 43
 	private function get_category_items($cat_id) {
44 44
 
45
-		if (clean($_REQUEST['mode']) != 2)
46
-			$search = $_SESSION["prefs_feed_search"];
47
-		else
48
-			$search = "";
45
+		if (clean($_REQUEST['mode']) != 2) {
46
+					$search = $_SESSION["prefs_feed_search"];
47
+		} else {
48
+					$search = "";
49
+		}
49 50
 
50 51
 		// first one is set by API
51 52
 		$show_empty_cats = clean($_REQUEST['force_show_empty']) ||
@@ -76,8 +77,9 @@  discard block
 block discarded – undo
76 77
 			$num_children = $this->calculate_children_count($cat);
77 78
 			$cat['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', (int) $num_children), $num_children);
78 79
 
79
-			if ($num_children > 0 || $show_empty_cats)
80
-				array_push($items, $cat);
80
+			if ($num_children > 0 || $show_empty_cats) {
81
+							array_push($items, $cat);
82
+			}
81 83
 
82 84
 		}
83 85
 
@@ -117,10 +119,11 @@  discard block
 block discarded – undo
117 119
 
118 120
 	public function makefeedtree() {
119 121
 
120
-		if (clean($_REQUEST['mode']) != 2)
121
-			$search = $_SESSION["prefs_feed_search"];
122
-		else
123
-			$search = "";
122
+		if (clean($_REQUEST['mode']) != 2) {
123
+					$search = $_SESSION["prefs_feed_search"];
124
+		} else {
125
+					$search = "";
126
+		}
124 127
 
125 128
 		$root = array();
126 129
 		$root['id'] = 'root';
@@ -231,8 +234,9 @@  discard block
 block discarded – undo
231 234
 				$num_children = $this->calculate_children_count($cat);
232 235
 				$cat['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', (int) $num_children), $num_children);
233 236
 
234
-				if ($num_children > 0 || $show_empty_cats)
235
-					array_push($root['items'], $cat);
237
+				if ($num_children > 0 || $show_empty_cats) {
238
+									array_push($root['items'], $cat);
239
+				}
236 240
 
237 241
 				$root['param'] += count($cat['items']);
238 242
 			}
@@ -279,8 +283,9 @@  discard block
 block discarded – undo
279 283
 
280 284
 			$cat['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', count($cat['items'])), count($cat['items']));
281 285
 
282
-			if (count($cat['items']) > 0 || $show_empty_cats)
283
-				array_push($root['items'], $cat);
286
+			if (count($cat['items']) > 0 || $show_empty_cats) {
287
+							array_push($root['items'], $cat);
288
+			}
284 289
 
285 290
 			$num_children = $this->calculate_children_count($root);
286 291
 			$root['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', (int) $num_children), $num_children);
@@ -343,8 +348,9 @@  discard block
 block discarded – undo
343 348
 	private function process_category_order(&$data_map, $item_id, $parent_id = false, $nest_level = 0) {
344 349
 
345 350
 		$prefix = "";
346
-		for ($i = 0; $i < $nest_level; $i++)
347
-			$prefix .= "   ";
351
+		for ($i = 0; $i < $nest_level; $i++) {
352
+					$prefix .= "   ";
353
+		}
348 354
 
349 355
 		Debug::log("$prefix C: $item_id P: $parent_id");
350 356
 
@@ -409,8 +415,9 @@  discard block
 block discarded – undo
409 415
 		#file_put_contents("/tmp/saveorder.json", clean($_POST['payload']));
410 416
 		#$data = json_decode(file_get_contents("/tmp/saveorder.json"), true);
411 417
 
412
-		if (!is_array($data['items']))
413
-			$data['items'] = json_decode($data['items'], true);
418
+		if (!is_array($data['items'])) {
419
+					$data['items'] = json_decode($data['items'], true);
420
+		}
414 421
 
415 422
 #		print_r($data['items']);
416 423
 
@@ -494,7 +501,9 @@  discard block
 block discarded – undo
494 501
 			}
495 502
 		}
496 503
 
497
-		if (is_file($icon_file)) @unlink($icon_file);
504
+		if (is_file($icon_file)) {
505
+			@unlink($icon_file);
506
+		}
498 507
 
499 508
 		print $rc;
500 509
 		return;
@@ -590,8 +599,9 @@  discard block
 block discarded – undo
590 599
 			if (DB_TYPE == "pgsql") {
591 600
 				$feed_language = $row["feed_language"];
592 601
 
593
-				if (!$feed_language)
594
-					$feed_language = get_pref('DEFAULT_SEARCH_LANGUAGE');
602
+				if (!$feed_language) {
603
+									$feed_language = get_pref('DEFAULT_SEARCH_LANGUAGE');
604
+				}
595 605
 
596 606
 				print "<fieldset>";
597 607
 
@@ -1404,11 +1414,13 @@  discard block
 block discarded – undo
1404 1414
 		$obj = array();
1405 1415
 		$feed_id = (int) $feed_id;
1406 1416
 
1407
-		if (!$title)
1408
-			$title = Feeds::getFeedTitle($feed_id, false);
1417
+		if (!$title) {
1418
+					$title = Feeds::getFeedTitle($feed_id, false);
1419
+		}
1409 1420
 
1410
-		if ($unread === false)
1411
-			$unread = getFeedUnread($feed_id, false);
1421
+		if ($unread === false) {
1422
+					$unread = getFeedUnread($feed_id, false);
1423
+		}
1412 1424
 
1413 1425
 		$obj['id'] = 'FEED:' . $feed_id;
1414 1426
 		$obj['name'] = $title;
@@ -1738,7 +1750,9 @@  discard block
 block discarded – undo
1738 1750
 
1739 1751
 
1740 1752
 	private function update_feed_access_key($feed_id, $is_cat, $owner_uid = false) {
1741
-		if (!$owner_uid) $owner_uid = $_SESSION["uid"];
1753
+		if (!$owner_uid) {
1754
+			$owner_uid = $_SESSION["uid"];
1755
+		}
1742 1756
 
1743 1757
 		// clear old value and generate new one
1744 1758
 		$sth = $this->pdo->prepare("DELETE FROM ttrss_access_keys
Please login to merge, or discard this patch.
classes/pref/prefs.php 1 patch
Braces   +28 added lines, -16 removed lines patch added patch discarded remove patch
@@ -160,7 +160,9 @@  discard block
 block discarded – undo
160 160
 		$boolean_prefs = explode(",", clean($_POST["boolean_prefs"]));
161 161
 
162 162
 		foreach ($boolean_prefs as $pref) {
163
-			if (!isset($_POST[$pref])) $_POST[$pref] = 'false';
163
+			if (!isset($_POST[$pref])) {
164
+				$_POST[$pref] = 'false';
165
+			}
164 166
 		}
165 167
 
166 168
 		$need_reload = false;
@@ -180,11 +182,15 @@  discard block
 block discarded – undo
180 182
 					}
181 183
 					break;
182 184
 				case 'USER_LANGUAGE':
183
-					if (!$need_reload) $need_reload = $_SESSION["language"] != $value;
185
+					if (!$need_reload) {
186
+						$need_reload = $_SESSION["language"] != $value;
187
+					}
184 188
 					break;
185 189
 
186 190
 				case 'USER_CSS_THEME':
187
-					if (!$need_reload) $need_reload = get_pref($pref_name) != $value;
191
+					if (!$need_reload) {
192
+						$need_reload = get_pref($pref_name) != $value;
193
+					}
188 194
 					break;
189 195
 			}
190 196
 
@@ -616,8 +622,9 @@  discard block
 block discarded – undo
616 622
 			$pref_name = $line["pref_name"];
617 623
 			$short_desc = $this->getShortDesc($pref_name);
618 624
 
619
-			if (!$short_desc)
620
-				continue;
625
+			if (!$short_desc) {
626
+							continue;
627
+			}
621 628
 
622 629
 			$prefs_available[$pref_name] = [
623 630
 				'type_name' => $line["type_name"],
@@ -669,7 +676,9 @@  discard block
 block discarded – undo
669 676
 						$themes = array_filter($themes, "theme_exists");
670 677
 						asort($themes);
671 678
 
672
-						if (!theme_exists($value)) $value = "default.php";
679
+						if (!theme_exists($value)) {
680
+							$value = "default.php";
681
+						}
673 682
 
674 683
 						print "<select name='$pref_name' id='$pref_name' dojoType='fox.form.Select'>";
675 684
 
@@ -728,14 +737,15 @@  discard block
 block discarded – undo
728 737
 							$disabled = "";
729 738
 						}
730 739
 
731
-						if ($type_name == 'integer')
732
-							print "<input dojoType=\"dijit.form.NumberSpinner\"
740
+						if ($type_name == 'integer') {
741
+													print "<input dojoType=\"dijit.form.NumberSpinner\"
733 742
 								required='1' $disabled
734 743
 								name=\"$pref_name\" value=\"$value\">";
735
-						else
736
-							print "<input dojoType=\"dijit.form.TextBox\"
744
+						} else {
745
+													print "<input dojoType=\"dijit.form.TextBox\"
737 746
 								required='1' $regexp $disabled
738 747
 								name=\"$pref_name\" value=\"$value\">";
748
+						}
739 749
 
740 750
 					} else if ($pref_name == "SSL_CERT_SERIAL") {
741 751
 
@@ -770,8 +780,9 @@  discard block
 block discarded – undo
770 780
 						print "<input dojoType=\"dijit.form.ValidationTextBox\" $regexp name=\"$pref_name\" value=\"$value\">";
771 781
 					}
772 782
 
773
-					if ($item['help_text'])
774
-						print "<div class='help-text text-muted'><label for='CB_$pref_name'>".$item['help_text']."</label></div>";
783
+					if ($item['help_text']) {
784
+											print "<div class='help-text text-muted'><label for='CB_$pref_name'>".$item['help_text']."</label></div>";
785
+					}
775 786
 
776 787
 					print "</fieldset>";
777 788
 				}
@@ -1108,10 +1119,11 @@  discard block
 block discarded – undo
1108 1119
 	}
1109 1120
 
1110 1121
 	public function setplugins() {
1111
-		if (is_array(clean($_REQUEST["plugins"])))
1112
-			$plugins = join(",", clean($_REQUEST["plugins"]));
1113
-		else
1114
-			$plugins = "";
1122
+		if (is_array(clean($_REQUEST["plugins"]))) {
1123
+					$plugins = join(",", clean($_REQUEST["plugins"]));
1124
+		} else {
1125
+					$plugins = "";
1126
+		}
1115 1127
 
1116 1128
 		set_pref("_ENABLED_PLUGINS", $plugins);
1117 1129
 	}
Please login to merge, or discard this patch.
classes/pref/filters.php 1 patch
Braces   +52 added lines, -25 removed lines patch added patch discarded remove patch
@@ -21,8 +21,9 @@  discard block
 block discarded – undo
21 21
 		#file_put_contents("/tmp/saveorder.json", clean($_POST['payload']));
22 22
 		#$data = json_decode(file_get_contents("/tmp/saveorder.json"), true);
23 23
 
24
-		if (!is_array($data['items']))
25
-			$data['items'] = json_decode($data['items'], true);
24
+		if (!is_array($data['items'])) {
25
+					$data['items'] = json_decode($data['items'], true);
26
+		}
26 27
 
27 28
 		$index = 0;
28 29
 
@@ -98,12 +99,16 @@  discard block
 block discarded – undo
98 99
 			}
99 100
 		}
100 101
 
101
-		if (count($scope_qparts) == 0) $scope_qparts = ["true"];
102
+		if (count($scope_qparts) == 0) {
103
+			$scope_qparts = ["true"];
104
+		}
102 105
 
103 106
 		$glue = $filter['match_any_rule'] ? " OR " :  " AND ";
104 107
 		$scope_qpart = join($glue, $scope_qparts);
105 108
 
106
-		if (!$scope_qpart) $scope_qpart = "true";
109
+		if (!$scope_qpart) {
110
+			$scope_qpart = "true";
111
+		}
107 112
 
108 113
 		$rv = array();
109 114
 
@@ -161,7 +166,9 @@  discard block
 block discarded – undo
161 166
 
162 167
 	public function testFilter() {
163 168
 
164
-		if (isset($_REQUEST["offset"])) return $this->testFilterDo();
169
+		if (isset($_REQUEST["offset"])) {
170
+			return $this->testFilterDo();
171
+		}
165 172
 
166 173
 		//print __("Articles matching this filter:");
167 174
 
@@ -206,10 +213,11 @@  discard block
 block discarded – undo
206 213
                         $feed_id = (int)substr($feed_id, 4);
207 214
                         array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id));
208 215
                     } else {
209
-                        if ($feed_id)
210
-                            array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id));
211
-                        else
212
-                            array_push($feeds_fmt, __("All feeds"));
216
+                        if ($feed_id) {
217
+                                                    array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id));
218
+                        } else {
219
+                                                    array_push($feeds_fmt, __("All feeds"));
220
+                        }
213 221
                     }
214 222
                 }
215 223
 
@@ -396,7 +404,9 @@  discard block
 block discarded – undo
396 404
 				unset($line["cat_id"]);
397 405
 				unset($line["filter_id"]);
398 406
 				unset($line["id"]);
399
-				if (!$line["inverse"]) unset($line["inverse"]);
407
+				if (!$line["inverse"]) {
408
+					unset($line["inverse"]);
409
+				}
400 410
 				unset($line["match_on"]);
401 411
 
402 412
 				$data = htmlspecialchars(json_encode($line));
@@ -518,12 +528,16 @@  discard block
 block discarded – undo
518 528
 	}
519 529
 
520 530
 	private function getRuleName($rule) {
521
-		if (!$rule) $rule = json_decode(clean($_REQUEST["rule"]), true);
531
+		if (!$rule) {
532
+			$rule = json_decode(clean($_REQUEST["rule"]), true);
533
+		}
522 534
 
523 535
 		$feeds = $rule["feed_id"];
524 536
 		$feeds_fmt = [];
525 537
 
526
-		if (!is_array($feeds)) $feeds = [$feeds];
538
+		if (!is_array($feeds)) {
539
+			$feeds = [$feeds];
540
+		}
527 541
 
528 542
 		foreach ($feeds as $feed_id) {
529 543
 
@@ -531,10 +545,11 @@  discard block
 block discarded – undo
531 545
                 $feed_id = (int)substr($feed_id, 4);
532 546
                 array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id));
533 547
             } else {
534
-                if ($feed_id)
535
-                    array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id));
536
-                else
537
-                    array_push($feeds_fmt, __("All feeds"));
548
+                if ($feed_id) {
549
+                                    array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id));
550
+                } else {
551
+                                    array_push($feeds_fmt, __("All feeds"));
552
+                }
538 553
             }
539 554
         }
540 555
 
@@ -573,8 +588,9 @@  discard block
 block discarded – undo
573 588
 			$title = __($row["description"]);
574 589
 
575 590
 			if ($action["action_id"] == 4 || $action["action_id"] == 6 ||
576
-				$action["action_id"] == 7)
577
-				$title .= ": " . $action["action_param"];
591
+				$action["action_id"] == 7) {
592
+							$title .= ": " . $action["action_param"];
593
+			}
578 594
 
579 595
 			if ($action["action_id"] == 9) {
580 596
 				list ($pfclass, $pfaction) = explode(":", $action["action_param"]);
@@ -644,8 +660,12 @@  discard block
 block discarded – undo
644 660
 		$sth = $this->pdo->prepare("DELETE FROM ttrss_filters2_actions WHERE filter_id = ?");
645 661
 		$sth->execute([$filter_id]);
646 662
 
647
-		if (!is_array(clean($_REQUEST["rule"]))) $_REQUEST["rule"] = [];
648
-		if (!is_array(clean($_REQUEST["action"]))) $_REQUEST["action"] = [];
663
+		if (!is_array(clean($_REQUEST["rule"]))) {
664
+			$_REQUEST["rule"] = [];
665
+		}
666
+		if (!is_array(clean($_REQUEST["action"]))) {
667
+			$_REQUEST["action"] = [];
668
+		}
649 669
 
650 670
 		if ($filter_id) {
651 671
 			/* create rules */
@@ -1137,7 +1157,9 @@  discard block
 block discarded – undo
1137 1157
 			$match_any_rule = $row["match_any_rule"];
1138 1158
 			$inverse = $row["inverse"];
1139 1159
 
1140
-			if (!$title) $title = __("[No caption]");
1160
+			if (!$title) {
1161
+				$title = __("[No caption]");
1162
+			}
1141 1163
 
1142 1164
 			$title = sprintf(_ngettext("%s (%d rule)", "%s (%d rules)", (int) $num_rules), $title, $num_rules);
1143 1165
 
@@ -1153,11 +1175,16 @@  discard block
 block discarded – undo
1153 1175
 				$num_actions -= 1;
1154 1176
 			}
1155 1177
 
1156
-			if ($match_any_rule) $title .= " (" . __("matches any rule") . ")";
1157
-			if ($inverse) $title .= " (" . __("inverse") . ")";
1178
+			if ($match_any_rule) {
1179
+				$title .= " (" . __("matches any rule") . ")";
1180
+			}
1181
+			if ($inverse) {
1182
+				$title .= " (" . __("inverse") . ")";
1183
+			}
1158 1184
 
1159
-			if ($num_actions > 0)
1160
-				$actions = sprintf(_ngettext("%s (+%d action)", "%s (+%d actions)", (int) $num_actions), $actions, $num_actions);
1185
+			if ($num_actions > 0) {
1186
+							$actions = sprintf(_ngettext("%s (+%d action)", "%s (+%d actions)", (int) $num_actions), $actions, $num_actions);
1187
+			}
1161 1188
 
1162 1189
 			return [$title, $actions];
1163 1190
 		}
Please login to merge, or discard this patch.
classes/pref/users.php 1 patch
Braces   +17 added lines, -10 removed lines patch added patch discarded remove patch
@@ -235,7 +235,10 @@  discard block
 block discarded – undo
235 235
 			$salt = substr(bin2hex(get_random_bytes(125)), 0, 250);
236 236
 			$pwd_hash = encrypt_password($tmp_user_pwd, $salt, true);
237 237
 
238
-			if (!$login) return; // no blank usernames
238
+			if (!$login) {
239
+				return;
240
+			}
241
+			// no blank usernames
239 242
 
240 243
 			$sth = $this->pdo->prepare("SELECT id FROM ttrss_users WHERE
241 244
 				login = ?");
@@ -294,10 +297,11 @@  discard block
 block discarded – undo
294 297
 
295 298
 				$message = T_sprintf("Changed password of user %s to %s", "<strong>$login</strong>", "<strong>$tmp_user_pwd</strong>");
296 299
 
297
-				if ($format_output)
298
-					print_notice($message);
299
-				else
300
-					print $message;
300
+				if ($format_output) {
301
+									print_notice($message);
302
+				} else {
303
+									print $message;
304
+				}
301 305
 
302 306
 			}
303 307
 		}
@@ -365,7 +369,9 @@  discard block
 block discarded – undo
365 369
 			$sort = $this->validate_field($sort,
366 370
 				["login", "access_level", "created", "num_feeds", "created", "last_login"], "login");
367 371
 
368
-			if ($sort != "login") $sort = "$sort DESC";
372
+			if ($sort != "login") {
373
+				$sort = "$sort DESC";
374
+			}
369 375
 
370 376
 			$sth = $this->pdo->prepare("SELECT
371 377
 					tu.id,
@@ -437,10 +443,11 @@  discard block
 block discarded – undo
437 443
 		}
438 444
 
439 445
 		public function validate_field($string, $allowed, $default = "") {
440
-			if (in_array($string, $allowed))
441
-				return $string;
442
-			else
443
-				return $default;
446
+			if (in_array($string, $allowed)) {
447
+							return $string;
448
+			} else {
449
+							return $default;
450
+			}
444 451
 		}
445 452
 
446 453
 }
Please login to merge, or discard this patch.
classes/logger/sql.php 1 patch
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,7 +6,9 @@  discard block
 block discarded – undo
6 6
 	public function log_error($errno, $errstr, $file, $line, $context) {
7 7
 
8 8
 		// separate PDO connection object is used for logging
9
-		if (!$this->pdo) $this->pdo = Db::instance()->pdo_connect();
9
+		if (!$this->pdo) {
10
+			$this->pdo = Db::instance()->pdo_connect();
11
+		}
10 12
 
11 13
 		if ($this->pdo && get_schema_version() > 117) {
12 14
 
@@ -22,8 +24,9 @@  discard block
 block discarded – undo
22 24
 			];
23 25
 
24 26
 			foreach ($server_params as $n => $p) {
25
-				if (isset($_SERVER[$p]))
26
-					$context .= "\n$n: " . $_SERVER[$p];
27
+				if (isset($_SERVER[$p])) {
28
+									$context .= "\n$n: " . $_SERVER[$p];
29
+				}
27 30
 			}
28 31
 
29 32
 			// passed error message may contain invalid unicode characters, failing to insert an error here
Please login to merge, or discard this patch.
classes/db/prefs.php 1 patch
Braces   +21 added lines, -9 removed lines patch added patch discarded remove patch
@@ -8,12 +8,15 @@  discard block
 block discarded – undo
8 8
 		$this->pdo = Db::pdo();
9 9
 		$this->cache = array();
10 10
 
11
-		if ($_SESSION["uid"]) $this->cache();
11
+		if ($_SESSION["uid"]) {
12
+			$this->cache();
13
+		}
12 14
 	}
13 15
 
14 16
 	public static function get() {
15
-		if (self::$instance == null)
16
-			self::$instance = new self();
17
+		if (self::$instance == null) {
18
+					self::$instance = new self();
19
+		}
17 20
 
18 21
 		return self::$instance;
19 22
 	}
@@ -22,7 +25,9 @@  discard block
 block discarded – undo
22 25
 		$user_id = $_SESSION["uid"];
23 26
 		@$profile = $_SESSION["profile"];
24 27
 
25
-		if (!is_numeric($profile) || !$profile || get_schema_version() < 63) $profile = null;
28
+		if (!is_numeric($profile) || !$profile || get_schema_version() < 63) {
29
+			$profile = null;
30
+		}
26 31
 
27 32
 		$sth = $this->pdo->prepare("SELECT
28 33
 			value,ttrss_prefs_types.type_name as type_name,ttrss_prefs.pref_name AS pref_name
@@ -61,7 +66,9 @@  discard block
 block discarded – undo
61 66
 			return $this->convert($tuple["value"], $tuple["type"]);
62 67
 		}
63 68
 
64
-		if (!is_numeric($profile) || !$profile || get_schema_version() < 63) $profile = null;
69
+		if (!is_numeric($profile) || !$profile || get_schema_version() < 63) {
70
+			$profile = null;
71
+		}
65 72
 
66 73
 		$sth = $this->pdo->prepare("SELECT
67 74
 			value,ttrss_prefs_types.type_name as type_name
@@ -105,7 +112,9 @@  discard block
 block discarded – undo
105 112
 	}
106 113
 
107 114
 	public function write($pref_name, $value, $user_id = false, $strip_tags = true) {
108
-		if ($strip_tags) $value = strip_tags($value);
115
+		if ($strip_tags) {
116
+			$value = strip_tags($value);
117
+		}
109 118
 
110 119
 		if (!$user_id) {
111 120
 			$user_id = $_SESSION["uid"];
@@ -114,7 +123,9 @@  discard block
 block discarded – undo
114 123
 			$profile = null;
115 124
 		}
116 125
 
117
-		if (!is_numeric($profile) || !$profile || get_schema_version() < 63) $profile = null;
126
+		if (!is_numeric($profile) || !$profile || get_schema_version() < 63) {
127
+			$profile = null;
128
+		}
118 129
 
119 130
 		$type_name = "";
120 131
 		$current_value = "";
@@ -130,8 +141,9 @@  discard block
 block discarded – undo
130 141
 				WHERE pref_name = ? AND type_id = ttrss_prefs_types.id");
131 142
 			$sth->execute([$pref_name]);
132 143
 
133
-			if ($row = $sth->fetch())
134
-				$type_name = $row["type_name"];
144
+			if ($row = $sth->fetch()) {
145
+							$type_name = $row["type_name"];
146
+			}
135 147
 
136 148
 		} else if ($current_value == $value) {
137 149
 			return;
Please login to merge, or discard this patch.