@@ -19,8 +19,9 @@ discard block |
||
19 | 19 | $from_combined = $from_name ? "$from_name <$from_address>" : $from_address; |
20 | 20 | $to_combined = $to_name ? "$to_name <$to_address>" : $to_address; |
21 | 21 | |
22 | - if (defined('_LOG_SENT_MAIL') && _LOG_SENT_MAIL) |
|
23 | - Logger::get()->log("Sending mail from $from_combined to $to_combined [$subject]: $message"); |
|
22 | + if (defined('_LOG_SENT_MAIL') && _LOG_SENT_MAIL) { |
|
23 | + Logger::get()->log("Sending mail from $from_combined to $to_combined [$subject]: $message"); |
|
24 | + } |
|
24 | 25 | |
25 | 26 | // HOOK_SEND_MAIL plugin instructions: |
26 | 27 | // 1. return 1 or true if mail is handled |
@@ -31,11 +32,13 @@ discard block |
||
31 | 32 | foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_SEND_MAIL) as $p) { |
32 | 33 | $rc = $p->hook_send_mail($this, $params); |
33 | 34 | |
34 | - if ($rc == 1) |
|
35 | - return $rc; |
|
35 | + if ($rc == 1) { |
|
36 | + return $rc; |
|
37 | + } |
|
36 | 38 | |
37 | - if ($rc == -1) |
|
38 | - return 0; |
|
39 | + if ($rc == -1) { |
|
40 | + return 0; |
|
41 | + } |
|
39 | 42 | } |
40 | 43 | |
41 | 44 | $headers = [ "From: $from_combined", "Content-Type: text/plain; charset=UTF-8" ]; |
@@ -57,7 +57,9 @@ discard block |
||
57 | 57 | $password = clean($_REQUEST["password"]); |
58 | 58 | $password_base64 = base64_decode(clean($_REQUEST["password"])); |
59 | 59 | |
60 | - if (SINGLE_USER_MODE) $login = "admin"; |
|
60 | + if (SINGLE_USER_MODE) { |
|
61 | + $login = "admin"; |
|
62 | + } |
|
61 | 63 | |
62 | 64 | $sth = $this->pdo->prepare("SELECT id FROM ttrss_users WHERE login = ?"); |
63 | 65 | $sth->execute([$login]); |
@@ -134,10 +136,11 @@ discard block |
||
134 | 136 | |
135 | 137 | // TODO do not return empty categories, return Uncategorized and standard virtual cats |
136 | 138 | |
137 | - if ($enable_nested) |
|
138 | - $nested_qpart = "parent_cat IS NULL"; |
|
139 | - else |
|
140 | - $nested_qpart = "true"; |
|
139 | + if ($enable_nested) { |
|
140 | + $nested_qpart = "parent_cat IS NULL"; |
|
141 | + } else { |
|
142 | + $nested_qpart = "true"; |
|
143 | + } |
|
141 | 144 | |
142 | 145 | $sth = $this->pdo->prepare("SELECT |
143 | 146 | id, title, order_id, (SELECT COUNT(id) FROM |
@@ -156,8 +159,9 @@ discard block |
||
156 | 159 | if ($include_empty || $line["num_feeds"] > 0 || $line["num_cats"] > 0) { |
157 | 160 | $unread = getFeedUnread($line["id"], true); |
158 | 161 | |
159 | - if ($enable_nested) |
|
160 | - $unread += Feeds::getCategoryChildrenUnread($line["id"]); |
|
162 | + if ($enable_nested) { |
|
163 | + $unread += Feeds::getCategoryChildrenUnread($line["id"]); |
|
164 | + } |
|
161 | 165 | |
162 | 166 | if ($unread || !$unread_only) { |
163 | 167 | array_push($cats, array("id" => $line["id"], |
@@ -188,11 +192,15 @@ discard block |
||
188 | 192 | $feed_id = clean($_REQUEST["feed_id"]); |
189 | 193 | if ($feed_id !== "") { |
190 | 194 | |
191 | - if (is_numeric($feed_id)) $feed_id = (int) $feed_id; |
|
195 | + if (is_numeric($feed_id)) { |
|
196 | + $feed_id = (int) $feed_id; |
|
197 | + } |
|
192 | 198 | |
193 | 199 | $limit = (int)clean($_REQUEST["limit"]); |
194 | 200 | |
195 | - if (!$limit || $limit >= 200) $limit = 200; |
|
201 | + if (!$limit || $limit >= 200) { |
|
202 | + $limit = 200; |
|
203 | + } |
|
196 | 204 | |
197 | 205 | $offset = (int)clean($_REQUEST["skip"]); |
198 | 206 | $filter = clean($_REQUEST["filter"]); |
@@ -287,7 +295,9 @@ discard block |
||
287 | 295 | break; |
288 | 296 | } |
289 | 297 | |
290 | - if ($field == "note") $set_to = $this->pdo->quote($data); |
|
298 | + if ($field == "note") { |
|
299 | + $set_to = $this->pdo->quote($data); |
|
300 | + } |
|
291 | 301 | |
292 | 302 | if ($field && $set_to && count($article_ids) > 0) { |
293 | 303 | |
@@ -443,10 +453,11 @@ discard block |
||
443 | 453 | WHERE owner_uid = ? ORDER BY caption"); |
444 | 454 | $sth->execute([$_SESSION['uid']]); |
445 | 455 | |
446 | - if ($article_id) |
|
447 | - $article_labels = Article::get_article_labels($article_id); |
|
448 | - else |
|
449 | - $article_labels = array(); |
|
456 | + if ($article_id) { |
|
457 | + $article_labels = Article::get_article_labels($article_id); |
|
458 | + } else { |
|
459 | + $article_labels = array(); |
|
460 | + } |
|
450 | 461 | |
451 | 462 | while ($line = $sth->fetch()) { |
452 | 463 | |
@@ -483,10 +494,11 @@ discard block |
||
483 | 494 | |
484 | 495 | foreach ($article_ids as $id) { |
485 | 496 | |
486 | - if ($assign) |
|
487 | - Labels::add_article($id, $label, $_SESSION["uid"]); |
|
488 | - else |
|
489 | - Labels::remove_article($id, $label, $_SESSION["uid"]); |
|
497 | + if ($assign) { |
|
498 | + Labels::add_article($id, $label, $_SESSION["uid"]); |
|
499 | + } else { |
|
500 | + Labels::remove_article($id, $label, $_SESSION["uid"]); |
|
501 | + } |
|
490 | 502 | |
491 | 503 | ++$num_updated; |
492 | 504 | |
@@ -738,14 +750,17 @@ discard block |
||
738 | 750 | $label_cache = json_decode($label_cache, true); |
739 | 751 | |
740 | 752 | if ($label_cache) { |
741 | - if ($label_cache["no-labels"] == 1) |
|
742 | - $labels = array(); |
|
743 | - else |
|
744 | - $labels = $label_cache; |
|
753 | + if ($label_cache["no-labels"] == 1) { |
|
754 | + $labels = array(); |
|
755 | + } else { |
|
756 | + $labels = $label_cache; |
|
757 | + } |
|
745 | 758 | } |
746 | 759 | } |
747 | 760 | |
748 | - if (!is_array($labels)) $labels = Article::get_article_labels($line["id"]); |
|
761 | + if (!is_array($labels)) { |
|
762 | + $labels = Article::get_article_labels($line["id"]); |
|
763 | + } |
|
749 | 764 | |
750 | 765 | $headline_row = array( |
751 | 766 | "id" => (int)$line["id"], |
@@ -763,11 +778,13 @@ discard block |
||
763 | 778 | |
764 | 779 | $enclosures = Article::get_article_enclosures($line['id']); |
765 | 780 | |
766 | - if ($include_attachments) |
|
767 | - $headline_row['attachments'] = $enclosures; |
|
781 | + if ($include_attachments) { |
|
782 | + $headline_row['attachments'] = $enclosures; |
|
783 | + } |
|
768 | 784 | |
769 | - if ($show_excerpt) |
|
770 | - $headline_row["excerpt"] = $line["content_preview"]; |
|
785 | + if ($show_excerpt) { |
|
786 | + $headline_row["excerpt"] = $line["content_preview"]; |
|
787 | + } |
|
771 | 788 | |
772 | 789 | if ($show_content) { |
773 | 790 | |
@@ -782,7 +799,9 @@ discard block |
||
782 | 799 | } |
783 | 800 | |
784 | 801 | // unify label output to ease parsing |
785 | - if ($labels["no-labels"] == 1) $labels = array(); |
|
802 | + if ($labels["no-labels"] == 1) { |
|
803 | + $labels = array(); |
|
804 | + } |
|
786 | 805 | |
787 | 806 | $headline_row["labels"] = $labels; |
788 | 807 |
@@ -36,7 +36,9 @@ discard block |
||
36 | 36 | |
37 | 37 | public static function log($message, $level = 0) { |
38 | 38 | |
39 | - if (!Debug::$enabled || Debug::$loglevel < $level) return false; |
|
39 | + if (!Debug::$enabled || Debug::$loglevel < $level) { |
|
40 | + return false; |
|
41 | + } |
|
40 | 42 | |
41 | 43 | $ts = strftime("%H:%M:%S", time()); |
42 | 44 | if (function_exists('posix_getpid')) { |
@@ -73,8 +75,9 @@ discard block |
||
73 | 75 | |
74 | 76 | fclose($fp); |
75 | 77 | |
76 | - if (Debug::$quiet) |
|
77 | - return; |
|
78 | + if (Debug::$quiet) { |
|
79 | + return; |
|
80 | + } |
|
78 | 81 | |
79 | 82 | } else { |
80 | 83 | user_error("Unable to open debugging log file: " . Debug::$logfile, E_USER_WARNING); |
@@ -80,7 +80,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -66,8 +66,9 @@ discard block |
||
66 | 66 | |
67 | 67 | // "" (null) is valid and should be cast to 0 (uncategorized) |
68 | 68 | // everything else i.e. tags are not |
69 | - if (!is_numeric($feed_id) && $feed_id) |
|
70 | - return; |
|
69 | + if (!is_numeric($feed_id) && $feed_id) { |
|
70 | + return; |
|
71 | + } |
|
71 | 72 | |
72 | 73 | $feed_id = (int) $feed_id; |
73 | 74 | |
@@ -102,8 +103,9 @@ discard block |
||
102 | 103 | |
103 | 104 | // "" (null) is valid and should be cast to 0 (uncategorized) |
104 | 105 | // everything else i.e. tags are not |
105 | - if (!is_numeric($feed_id) && $feed_id) |
|
106 | - return; |
|
106 | + if (!is_numeric($feed_id) && $feed_id) { |
|
107 | + return; |
|
108 | + } |
|
107 | 109 | |
108 | 110 | $feed_id = (int) $feed_id; |
109 | 111 | |
@@ -182,7 +184,9 @@ discard block |
||
182 | 184 | $sth->execute([$feed_id, $unread, $owner_uid]); |
183 | 185 | } |
184 | 186 | |
185 | - if (!$tr_in_progress) $pdo->commit(); |
|
187 | + if (!$tr_in_progress) { |
|
188 | + $pdo->commit(); |
|
189 | + } |
|
186 | 190 | |
187 | 191 | if ($feed_id > 0 && $prev_unread != $unread) { |
188 | 192 |
@@ -43,10 +43,11 @@ discard block |
||
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 |
||
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); |
@@ -12,7 +12,9 @@ discard block |
||
12 | 12 | "padding : 5px; border-style : dashed; border-color : #e7d796;". |
13 | 13 | "margin-bottom : 1em; color : #9a8c59;"; |
14 | 14 | |
15 | - if (!$limit) $limit = 60; |
|
15 | + if (!$limit) { |
|
16 | + $limit = 60; |
|
17 | + } |
|
16 | 18 | |
17 | 19 | $date_sort_field = "date_entered DESC, updated DESC"; |
18 | 20 | |
@@ -77,7 +79,9 @@ discard block |
||
77 | 79 | "/public.php?op=rss&id=$feed&key=" . |
78 | 80 | Feeds::get_feed_access_key($feed, false, $owner_uid); |
79 | 81 | |
80 | - if (!$feed_site_url) $feed_site_url = get_self_url_prefix(); |
|
82 | + if (!$feed_site_url) { |
|
83 | + $feed_site_url = get_self_url_prefix(); |
|
84 | + } |
|
81 | 85 | |
82 | 86 | if ($format == 'atom') { |
83 | 87 | $tpl = new MiniTemplator; |
@@ -207,8 +211,12 @@ discard block |
||
207 | 211 | $article['content'] = sanitize($line["content"], false, $owner_uid, $feed_site_url, false, $line["id"]); |
208 | 212 | $article['updated'] = date('c', strtotime($line["updated"])); |
209 | 213 | |
210 | - if ($line['note']) $article['note'] = $line['note']; |
|
211 | - if ($article['author']) $article['author'] = $line['author']; |
|
214 | + if ($line['note']) { |
|
215 | + $article['note'] = $line['note']; |
|
216 | + } |
|
217 | + if ($article['author']) { |
|
218 | + $article['author'] = $line['author']; |
|
219 | + } |
|
212 | 220 | |
213 | 221 | $tags = Article::get_article_tags($line["id"], $owner_uid); |
214 | 222 | |
@@ -459,7 +467,9 @@ discard block |
||
459 | 467 | $format = clean($_REQUEST['format']); |
460 | 468 | $orig_guid = clean($_REQUEST["orig_guid"]); |
461 | 469 | |
462 | - if (!$format) $format = 'atom'; |
|
470 | + if (!$format) { |
|
471 | + $format = 'atom'; |
|
472 | + } |
|
463 | 473 | |
464 | 474 | if (SINGLE_USER_MODE) { |
465 | 475 | authenticate_user("admin", null); |
@@ -472,8 +482,9 @@ discard block |
||
472 | 482 | ttrss_access_keys WHERE access_key = ? AND feed_id = ?"); |
473 | 483 | $sth->execute([$key, $feed]); |
474 | 484 | |
475 | - if ($row = $sth->fetch()) |
|
476 | - $owner_id = $row["owner_uid"]; |
|
485 | + if ($row = $sth->fetch()) { |
|
486 | + $owner_id = $row["owner_uid"]; |
|
487 | + } |
|
477 | 488 | } |
478 | 489 | |
479 | 490 | if ($owner_id) { |
@@ -683,8 +694,9 @@ discard block |
||
683 | 694 | // start an empty session to deliver login error message |
684 | 695 | @session_start(); |
685 | 696 | |
686 | - if (!isset($_SESSION["login_error_msg"])) |
|
687 | - $_SESSION["login_error_msg"] = __("Incorrect username or password"); |
|
697 | + if (!isset($_SESSION["login_error_msg"])) { |
|
698 | + $_SESSION["login_error_msg"] = __("Incorrect username or password"); |
|
699 | + } |
|
688 | 700 | |
689 | 701 | user_error("Failed login attempt for $login from {$_SERVER['REMOTE_ADDR']}", E_USER_WARNING); |
690 | 702 | } |
@@ -1007,7 +1019,9 @@ discard block |
||
1007 | 1019 | "subject" => __("[tt-rss] Password reset request"), |
1008 | 1020 | "message" => $message]); |
1009 | 1021 | |
1010 | - if (!$rc) print_error($mailer->error()); |
|
1022 | + if (!$rc) { |
|
1023 | + print_error($mailer->error()); |
|
1024 | + } |
|
1011 | 1025 | |
1012 | 1026 | $resetpass_token_full = time() . ":" . $resetpass_token; |
1013 | 1027 |
@@ -26,8 +26,10 @@ discard block |
||
26 | 26 | if ($error) { |
27 | 27 | foreach (libxml_get_errors() as $error) { |
28 | 28 | if ($error->level == LIBXML_ERR_FATAL) { |
29 | - if(!isset($this->error)) //currently only the first error is reported |
|
29 | + if(!isset($this->error)) { |
|
30 | + //currently only the first error is reported |
|
30 | 31 | $this->error = $this->format_error($error); |
32 | + } |
|
31 | 33 | $this->libxml_errors [] = $this->format_error($error); |
32 | 34 | } |
33 | 35 | } |
@@ -81,8 +83,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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) ){ |
@@ -95,10 +95,11 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |