Passed
Pull Request — master (#1)
by
unknown
04:51
created
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
 	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/rssutils.php 1 patch
Braces   +73 added lines, -46 removed lines patch added patch discarded remove patch
@@ -80,7 +80,9 @@  discard block
 block discarded – undo
80 80
 
81 81
 		// Update the least recently updated feeds first
82 82
 		$query_order = "ORDER BY last_updated";
83
-		if (DB_TYPE == "pgsql") $query_order .= " NULLS FIRST";
83
+		if (DB_TYPE == "pgsql") {
84
+			$query_order .= " NULLS FIRST";
85
+		}
84 86
 
85 87
 		$query = "SELECT DISTINCT ttrss_feeds.feed_url, ttrss_feeds.last_updated
86 88
 			FROM
@@ -139,8 +141,9 @@  discard block
 block discarded – undo
139 141
 			if ($tline = $usth->fetch()) {
140 142
 				Debug::log(" => " . $tline["last_updated"] . ", " . $tline["id"] . " " . $tline["owner_uid"]);
141 143
 
142
-				if (array_search($tline["owner_uid"], $batch_owners) === FALSE)
143
-					array_push($batch_owners, $tline["owner_uid"]);
144
+				if (array_search($tline["owner_uid"], $batch_owners) === FALSE) {
145
+									array_push($batch_owners, $tline["owner_uid"]);
146
+				}
144 147
 
145 148
 				$fstarted = microtime(true);
146 149
 
@@ -311,11 +314,13 @@  discard block
 block discarded – undo
311 314
 
312 315
 			$feed_language = mb_strtolower($row["feed_language"]);
313 316
 
314
-			if (!$feed_language)
315
-				$feed_language = mb_strtolower(get_pref('DEFAULT_SEARCH_LANGUAGE', $owner_uid));
317
+			if (!$feed_language) {
318
+							$feed_language = mb_strtolower(get_pref('DEFAULT_SEARCH_LANGUAGE', $owner_uid));
319
+			}
316 320
 
317
-			if (!$feed_language)
318
-				$feed_language = 'simple';
321
+			if (!$feed_language) {
322
+							$feed_language = 'simple';
323
+			}
319 324
 
320 325
 		} else {
321 326
 			return false;
@@ -514,8 +519,9 @@  discard block
 block discarded – undo
514 519
 				RSSUtils::check_feed_favicon($site_url, $feed);
515 520
 				$favicon_modified_new = @filemtime($favicon_file);
516 521
 
517
-				if ($favicon_modified_new > $favicon_modified)
518
-					$favicon_avg_color = '';
522
+				if ($favicon_modified_new > $favicon_modified) {
523
+									$favicon_avg_color = '';
524
+				}
519 525
 
520 526
 				$favicon_colorstring = "";
521 527
 				if (file_exists($favicon_file) && function_exists("imagecreatefromstring") && $favicon_avg_color == '') {
@@ -578,8 +584,12 @@  discard block
 block discarded – undo
578 584
 				}
579 585
 
580 586
 				$entry_guid = strip_tags($item->get_id());
581
-				if (!$entry_guid) $entry_guid = strip_tags($item->get_link());
582
-				if (!$entry_guid) $entry_guid = RSSUtils::make_guid_from_title($item->get_title());
587
+				if (!$entry_guid) {
588
+					$entry_guid = strip_tags($item->get_link());
589
+				}
590
+				if (!$entry_guid) {
591
+					$entry_guid = RSSUtils::make_guid_from_title($item->get_title());
592
+				}
583 593
 
584 594
 				if (!$entry_guid) {
585 595
 					$pdo->commit();
@@ -606,10 +616,15 @@  discard block
 block discarded – undo
606 616
 				Debug::log("link $entry_link", Debug::$LOG_VERBOSE);
607 617
 				Debug::log("language $entry_language", Debug::$LOG_VERBOSE);
608 618
 
609
-				if (!$entry_title) $entry_title = date("Y-m-d H:i:s", $entry_timestamp);;
619
+				if (!$entry_title) {
620
+					$entry_title = date("Y-m-d H:i:s", $entry_timestamp);
621
+				}
622
+				;
610 623
 
611 624
 				$entry_content = $item->get_content();
612
-				if (!$entry_content) $entry_content = $item->get_description();
625
+				if (!$entry_content) {
626
+					$entry_content = $item->get_description();
627
+				}
613 628
 
614 629
 				if (Debug::get_loglevel() >= 3) {
615 630
 					print "content: ";
@@ -824,8 +839,9 @@  discard block
 block discarded – undo
824 839
 
825 840
 				Debug::log("force catchup: $entry_force_catchup", Debug::$LOG_VERBOSE);
826 841
 
827
-				if ($cache_images)
828
-					RSSUtils::cache_media($entry_content, $site_url);
842
+				if ($cache_images) {
843
+									RSSUtils::cache_media($entry_content, $site_url);
844
+				}
829 845
 
830 846
 				$csth = $pdo->prepare("SELECT id FROM ttrss_entries
831 847
 					WHERE guid = ? OR guid = ?");
@@ -951,16 +967,18 @@  discard block
 block discarded – undo
951 967
 
952 968
 						$sth->execute([$ref_id, $owner_uid, $feed]);
953 969
 
954
-						if ($row = $sth->fetch())
955
-							$entry_int_id = $row['int_id'];
970
+						if ($row = $sth->fetch()) {
971
+													$entry_int_id = $row['int_id'];
972
+						}
956 973
 					}
957 974
 
958 975
 					Debug::log("resulting RID: $entry_ref_id, IID: $entry_int_id", Debug::$LOG_VERBOSE);
959 976
 
960
-					if (DB_TYPE == "pgsql")
961
-						$tsvector_qpart = "tsvector_combined = to_tsvector(:ts_lang, :ts_content),";
962
-					else
963
-						$tsvector_qpart = "";
977
+					if (DB_TYPE == "pgsql") {
978
+											$tsvector_qpart = "tsvector_combined = to_tsvector(:ts_lang, :ts_content),";
979
+					} else {
980
+											$tsvector_qpart = "";
981
+					}
964 982
 
965 983
 					$sth = $pdo->prepare("UPDATE ttrss_entries
966 984
 						SET title = :title,
@@ -1049,8 +1067,9 @@  discard block
 block discarded – undo
1049 1067
 					}
1050 1068
 				}
1051 1069
 
1052
-				if ($cache_images)
1053
-					RSSUtils::cache_enclosures($enclosures, $site_url);
1070
+				if ($cache_images) {
1071
+									RSSUtils::cache_enclosures($enclosures, $site_url);
1072
+				}
1054 1073
 
1055 1074
 				if (Debug::get_loglevel() >= Debug::$LOG_EXTENDED) {
1056 1075
 					Debug::log("article enclosures:", Debug::$LOG_VERBOSE);
@@ -1345,8 +1364,9 @@  discard block
 block discarded – undo
1345 1364
 				$reg_exp = str_replace('/', '\/', $rule["reg_exp"]);
1346 1365
 				$rule_inverse = $rule["inverse"];
1347 1366
 
1348
-				if (!$reg_exp)
1349
-					continue;
1367
+				if (!$reg_exp) {
1368
+									continue;
1369
+				}
1350 1370
 
1351 1371
 				switch ($rule["type"]) {
1352 1372
 					case "title":
@@ -1380,7 +1400,9 @@  discard block
 block discarded – undo
1380 1400
 						break;
1381 1401
 				}
1382 1402
 
1383
-				if ($rule_inverse) $match = !$match;
1403
+				if ($rule_inverse) {
1404
+					$match = !$match;
1405
+				}
1384 1406
 
1385 1407
 				if ($match_any_rule) {
1386 1408
 					if ($match) {
@@ -1395,17 +1417,25 @@  discard block
 block discarded – undo
1395 1417
 				}
1396 1418
 			}
1397 1419
 
1398
-			if ($inverse) $filter_match = !$filter_match;
1420
+			if ($inverse) {
1421
+				$filter_match = !$filter_match;
1422
+			}
1399 1423
 
1400 1424
 			if ($filter_match) {
1401
-				if (is_array($matched_rules)) array_push($matched_rules, $rule);
1402
-				if (is_array($matched_filters)) array_push($matched_filters, $filter);
1425
+				if (is_array($matched_rules)) {
1426
+					array_push($matched_rules, $rule);
1427
+				}
1428
+				if (is_array($matched_filters)) {
1429
+					array_push($matched_filters, $filter);
1430
+				}
1403 1431
 
1404 1432
 				foreach ($filter["actions"] AS $action) {
1405 1433
 					array_push($matches, $action);
1406 1434
 
1407 1435
 					// if Stop action encountered, perform no further processing
1408
-					if (isset($action["type"]) && $action["type"] == "stop") return $matches;
1436
+					if (isset($action["type"]) && $action["type"] == "stop") {
1437
+						return $matches;
1438
+					}
1409 1439
 				}
1410 1440
 			}
1411 1441
 		}
@@ -1531,24 +1561,19 @@  discard block
 block discarded – undo
1531 1561
 					if (preg_match('/^\x00\x00\x01\x00/', $contents)) {
1532 1562
 						// 0       string  \000\000\001\000        MS Windows icon resource
1533 1563
 						//error_log("check_feed_favicon: favicon_url=$favicon_url isa MS Windows icon resource");
1534
-					}
1535
-					elseif (preg_match('/^GIF8/', $contents)) {
1564
+					} elseif (preg_match('/^GIF8/', $contents)) {
1536 1565
 						// 0       string          GIF8            GIF image data
1537 1566
 						//error_log("check_feed_favicon: favicon_url=$favicon_url isa GIF image");
1538
-					}
1539
-					elseif (preg_match('/^\x89PNG\x0d\x0a\x1a\x0a/', $contents)) {
1567
+					} elseif (preg_match('/^\x89PNG\x0d\x0a\x1a\x0a/', $contents)) {
1540 1568
 						// 0       string          \x89PNG\x0d\x0a\x1a\x0a         PNG image data
1541 1569
 						//error_log("check_feed_favicon: favicon_url=$favicon_url isa PNG image");
1542
-					}
1543
-					elseif (preg_match('/^\xff\xd8/', $contents)) {
1570
+					} elseif (preg_match('/^\xff\xd8/', $contents)) {
1544 1571
 						// 0       beshort         0xffd8          JPEG image data
1545 1572
 						//error_log("check_feed_favicon: favicon_url=$favicon_url isa JPG image");
1546
-					}
1547
-					elseif (preg_match('/^BM/', $contents)) {
1573
+					} elseif (preg_match('/^BM/', $contents)) {
1548 1574
 						// 0	string		BM	PC bitmap (OS2, Windows BMP files)
1549 1575
 						//error_log("check_feed_favicon, favicon_url=$favicon_url isa BMP image");
1550
-					}
1551
-					else {
1576
+					} else {
1552 1577
 						//error_log("check_feed_favicon: favicon_url=$favicon_url isa UNKNOWN type");
1553 1578
 						$contents = "";
1554 1579
 					}
@@ -1579,10 +1604,11 @@  discard block
 block discarded – undo
1579 1604
 		$feed_id = (int) $feed_id;
1580 1605
 		$cat_id = (int)Feeds::getFeedCategory($feed_id);
1581 1606
 
1582
-		if ($cat_id == 0)
1583
-			$null_cat_qpart = "cat_id IS NULL OR";
1584
-		else
1585
-			$null_cat_qpart = "";
1607
+		if ($cat_id == 0) {
1608
+					$null_cat_qpart = "cat_id IS NULL OR";
1609
+		} else {
1610
+					$null_cat_qpart = "";
1611
+		}
1586 1612
 
1587 1613
 		$pdo = Db::pdo();
1588 1614
 
@@ -1718,8 +1744,9 @@  discard block
 block discarded – undo
1718 1744
 			}
1719 1745
 		}
1720 1746
 
1721
-		if (!$favicon_url)
1722
-			$favicon_url = rewrite_relative_url($url, "/favicon.ico");
1747
+		if (!$favicon_url) {
1748
+					$favicon_url = rewrite_relative_url($url, "/favicon.ico");
1749
+		}
1723 1750
 
1724 1751
 		return $favicon_url;
1725 1752
 	}
Please login to merge, or discard this patch.
classes/ccache.php 1 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 1 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 1 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 1 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 1 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.