@@ -30,7 +30,9 @@ discard block |
||
| 30 | 30 | $omap = array(); |
| 31 | 31 | |
| 32 | 32 | foreach ($imap[1] as $sequence => $action) { |
| 33 | - if (!isset($omap[$action])) $omap[$action] = array(); |
|
| 33 | + if (!isset($omap[$action])) { |
|
| 34 | + $omap[$action] = array(); |
|
| 35 | + } |
|
| 34 | 36 | |
| 35 | 37 | array_push($omap[$action], $sequence); |
| 36 | 38 | } |
@@ -40,7 +42,9 @@ discard block |
||
| 40 | 42 | $cur_section = ""; |
| 41 | 43 | foreach ($info as $section => $hotkeys) { |
| 42 | 44 | |
| 43 | - if ($cur_section) print "<li> </li>"; |
|
| 45 | + if ($cur_section) { |
|
| 46 | + print "<li> </li>"; |
|
| 47 | + } |
|
| 44 | 48 | print "<li><h3>" . $section . "</h3></li>"; |
| 45 | 49 | $cur_section = $section; |
| 46 | 50 | |
@@ -17,7 +17,9 @@ discard block |
||
| 17 | 17 | $feed_id, $is_cat, $search, |
| 18 | 18 | $error, $feed_last_updated) { |
| 19 | 19 | |
| 20 | - if ($is_cat) $cat_q = "&is_cat=$is_cat"; |
|
| 20 | + if ($is_cat) { |
|
| 21 | + $cat_q = "&is_cat=$is_cat"; |
|
| 22 | + } |
|
| 21 | 23 | |
| 22 | 24 | if ($search) { |
| 23 | 25 | $search_q = "&q=$search"; |
@@ -48,8 +50,9 @@ discard block |
||
| 48 | 50 | $reply .= strip_tags($feed_title); |
| 49 | 51 | } |
| 50 | 52 | |
| 51 | - if ($error) |
|
| 52 | - $reply .= " <i title=\"" . htmlspecialchars($error) . "\" class='material-icons icon-error'>error</i>"; |
|
| 53 | + if ($error) { |
|
| 54 | + $reply .= " <i title=\"" . htmlspecialchars($error) . "\" class='material-icons icon-error'>error</i>"; |
|
| 55 | + } |
|
| 53 | 56 | |
| 54 | 57 | $reply .= "</span>"; |
| 55 | 58 | $reply .= "<span id='feed_current_unread' style='display: none'></span>"; |
@@ -127,8 +130,12 @@ discard block |
||
| 127 | 130 | $rgba_cache = array(); |
| 128 | 131 | $topmost_article_ids = array(); |
| 129 | 132 | |
| 130 | - if (!$offset) $offset = 0; |
|
| 131 | - if ($method == "undefined") $method = ""; |
|
| 133 | + if (!$offset) { |
|
| 134 | + $offset = 0; |
|
| 135 | + } |
|
| 136 | + if ($method == "undefined") { |
|
| 137 | + $method = ""; |
|
| 138 | + } |
|
| 132 | 139 | |
| 133 | 140 | $method_split = explode(":", $method); |
| 134 | 141 | |
@@ -274,14 +281,17 @@ discard block |
||
| 274 | 281 | $label_cache = json_decode($label_cache, true); |
| 275 | 282 | |
| 276 | 283 | if ($label_cache) { |
| 277 | - if ($label_cache["no-labels"] == 1) |
|
| 278 | - $labels = array(); |
|
| 279 | - else |
|
| 280 | - $labels = $label_cache; |
|
| 284 | + if ($label_cache["no-labels"] == 1) { |
|
| 285 | + $labels = array(); |
|
| 286 | + } else { |
|
| 287 | + $labels = $label_cache; |
|
| 288 | + } |
|
| 281 | 289 | } |
| 282 | 290 | } |
| 283 | 291 | |
| 284 | - if (!is_array($labels)) $labels = Article::get_article_labels($id); |
|
| 292 | + if (!is_array($labels)) { |
|
| 293 | + $labels = Article::get_article_labels($id); |
|
| 294 | + } |
|
| 285 | 295 | |
| 286 | 296 | $labels_str = "<span class=\"HLLCTR-$id\">"; |
| 287 | 297 | $labels_str .= Article::format_article_labels($labels); |
@@ -293,7 +303,9 @@ discard block |
||
| 293 | 303 | array_push($topmost_article_ids, $id); |
| 294 | 304 | } |
| 295 | 305 | |
| 296 | - if (!$line["feed_title"]) $line["feed_title"] = ""; |
|
| 306 | + if (!$line["feed_title"]) { |
|
| 307 | + $line["feed_title"] = ""; |
|
| 308 | + } |
|
| 297 | 309 | |
| 298 | 310 | $line["buttons_left"] = ""; |
| 299 | 311 | foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ARTICLE_LEFT_BUTTON) as $p) { |
@@ -314,10 +326,11 @@ discard block |
||
| 314 | 326 | |
| 315 | 327 | $line['content'] = DiskCache::rewriteUrls($line['content']); |
| 316 | 328 | |
| 317 | - if ($line['note']) |
|
| 318 | - $line['note'] = Article::format_article_note($id, $line['note']); |
|
| 319 | - else |
|
| 320 | - $line['note'] = ""; |
|
| 329 | + if ($line['note']) { |
|
| 330 | + $line['note'] = Article::format_article_note($id, $line['note']); |
|
| 331 | + } else { |
|
| 332 | + $line['note'] = ""; |
|
| 333 | + } |
|
| 321 | 334 | |
| 322 | 335 | if (!get_pref("CDM_EXPANDED")) { |
| 323 | 336 | $line["cdm_excerpt"] = "<span class='collapse'> |
@@ -350,10 +363,11 @@ discard block |
||
| 350 | 363 | $line['imported'] = T_sprintf("Imported at %s", |
| 351 | 364 | make_local_datetime($line["date_entered"], false)); |
| 352 | 365 | |
| 353 | - if ($line["tag_cache"]) |
|
| 354 | - $tags = explode(",", $line["tag_cache"]); |
|
| 355 | - else |
|
| 356 | - $tags = false; |
|
| 366 | + if ($line["tag_cache"]) { |
|
| 367 | + $tags = explode(",", $line["tag_cache"]); |
|
| 368 | + } else { |
|
| 369 | + $tags = false; |
|
| 370 | + } |
|
| 357 | 371 | |
| 358 | 372 | $line["tags_str"] = Article::format_tags_string($tags); |
| 359 | 373 | |
@@ -383,8 +397,9 @@ discard block |
||
| 383 | 397 | /* we don't need those */ |
| 384 | 398 | |
| 385 | 399 | foreach (["date_entered", "guid", "last_published", "last_marked", "tag_cache", "favicon_avg_color", |
| 386 | - "uuid", "label_cache", "yyiw"] as $k) |
|
| 387 | - unset($line[$k]); |
|
| 400 | + "uuid", "label_cache", "yyiw"] as $k) { |
|
| 401 | + unset($line[$k]); |
|
| 402 | + } |
|
| 388 | 403 | |
| 389 | 404 | array_push($reply['content'], $line); |
| 390 | 405 | } |
@@ -474,7 +489,9 @@ discard block |
||
| 474 | 489 | $order_by = $_REQUEST["order_by"]; |
| 475 | 490 | $check_first_id = $_REQUEST["fid"]; |
| 476 | 491 | |
| 477 | - if (is_numeric($feed)) $feed = (int) $feed; |
|
| 492 | + if (is_numeric($feed)) { |
|
| 493 | + $feed = (int) $feed; |
|
| 494 | + } |
|
| 478 | 495 | |
| 479 | 496 | /* Feed -5 is a special case: it is used to display auxiliary information |
| 480 | 497 | * when there's nothing to load - e.g. no stuff in fresh feed */ |
@@ -562,10 +579,11 @@ discard block |
||
| 562 | 579 | $disable_cache = $ret[3]; |
| 563 | 580 | $reply['headlines'] = $ret[4]; |
| 564 | 581 | |
| 565 | - if (!$next_unread_feed) |
|
| 566 | - $reply['headlines']['id'] = $feed; |
|
| 567 | - else |
|
| 568 | - $reply['headlines']['id'] = $next_unread_feed; |
|
| 582 | + if (!$next_unread_feed) { |
|
| 583 | + $reply['headlines']['id'] = $feed; |
|
| 584 | + } else { |
|
| 585 | + $reply['headlines']['id'] = $next_unread_feed; |
|
| 586 | + } |
|
| 569 | 587 | |
| 570 | 588 | $reply['headlines']['is_cat'] = (bool) $cat_view; |
| 571 | 589 | |
@@ -851,7 +869,9 @@ discard block |
||
| 851 | 869 | |
| 852 | 870 | static function catchup_feed($feed, $cat_view, $owner_uid = false, $mode = 'all', $search = false) { |
| 853 | 871 | |
| 854 | - if (!$owner_uid) $owner_uid = $_SESSION['uid']; |
|
| 872 | + if (!$owner_uid) { |
|
| 873 | + $owner_uid = $_SESSION['uid']; |
|
| 874 | + } |
|
| 855 | 875 | |
| 856 | 876 | $pdo = Db::pdo(); |
| 857 | 877 | |
@@ -1026,7 +1046,9 @@ discard block |
||
| 1026 | 1046 | |
| 1027 | 1047 | $pdo = Db::pdo(); |
| 1028 | 1048 | |
| 1029 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
| 1049 | + if (!$owner_uid) { |
|
| 1050 | + $owner_uid = $_SESSION["uid"]; |
|
| 1051 | + } |
|
| 1030 | 1052 | |
| 1031 | 1053 | if ($unread_only) { |
| 1032 | 1054 | $unread_qpart = "unread = true"; |
@@ -1142,7 +1164,9 @@ discard block |
||
| 1142 | 1164 | |
| 1143 | 1165 | $url = Feeds::fix_url($url); |
| 1144 | 1166 | |
| 1145 | - if (!$url || !Feeds::validate_feed_url($url)) return array("code" => 2); |
|
| 1167 | + if (!$url || !Feeds::validate_feed_url($url)) { |
|
| 1168 | + return array("code" => 2); |
|
| 1169 | + } |
|
| 1146 | 1170 | |
| 1147 | 1171 | $contents = @fetch_file_contents($url, false, $auth_login, $auth_pass); |
| 1148 | 1172 | |
@@ -1170,7 +1194,9 @@ discard block |
||
| 1170 | 1194 | $url = key($feedUrls); |
| 1171 | 1195 | } |
| 1172 | 1196 | |
| 1173 | - if (!$cat_id) $cat_id = null; |
|
| 1197 | + if (!$cat_id) { |
|
| 1198 | + $cat_id = null; |
|
| 1199 | + } |
|
| 1174 | 1200 | |
| 1175 | 1201 | $sth = $pdo->prepare("SELECT id FROM ttrss_feeds |
| 1176 | 1202 | WHERE feed_url = ? AND owner_uid = ?"); |
@@ -1287,13 +1313,17 @@ discard block |
||
| 1287 | 1313 | |
| 1288 | 1314 | static function getCategoryUnread($cat, $owner_uid = false) { |
| 1289 | 1315 | |
| 1290 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
| 1316 | + if (!$owner_uid) { |
|
| 1317 | + $owner_uid = $_SESSION["uid"]; |
|
| 1318 | + } |
|
| 1291 | 1319 | |
| 1292 | 1320 | $pdo = Db::pdo(); |
| 1293 | 1321 | |
| 1294 | 1322 | if ($cat >= 0) { |
| 1295 | 1323 | |
| 1296 | - if (!$cat) $cat = null; |
|
| 1324 | + if (!$cat) { |
|
| 1325 | + $cat = null; |
|
| 1326 | + } |
|
| 1297 | 1327 | |
| 1298 | 1328 | $sth = $pdo->prepare("SELECT id FROM ttrss_feeds |
| 1299 | 1329 | WHERE (cat_id = :cat OR (:cat IS NULL AND cat_id IS NULL)) |
@@ -1306,7 +1336,9 @@ discard block |
||
| 1306 | 1336 | array_push($cat_feeds, "feed_id = " . (int)$line["id"]); |
| 1307 | 1337 | } |
| 1308 | 1338 | |
| 1309 | - if (count($cat_feeds) == 0) return 0; |
|
| 1339 | + if (count($cat_feeds) == 0) { |
|
| 1340 | + return 0; |
|
| 1341 | + } |
|
| 1310 | 1342 | |
| 1311 | 1343 | $match_part = implode(" OR ", $cat_feeds); |
| 1312 | 1344 | |
@@ -1341,7 +1373,9 @@ discard block |
||
| 1341 | 1373 | |
| 1342 | 1374 | // only accepts real cats (>= 0) |
| 1343 | 1375 | static function getCategoryChildrenUnread($cat, $owner_uid = false) { |
| 1344 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
| 1376 | + if (!$owner_uid) { |
|
| 1377 | + $owner_uid = $_SESSION["uid"]; |
|
| 1378 | + } |
|
| 1345 | 1379 | |
| 1346 | 1380 | $pdo = Db::pdo(); |
| 1347 | 1381 | |
@@ -1361,7 +1395,9 @@ discard block |
||
| 1361 | 1395 | |
| 1362 | 1396 | static function getGlobalUnread($user_id = false) { |
| 1363 | 1397 | |
| 1364 | - if (!$user_id) $user_id = $_SESSION["uid"]; |
|
| 1398 | + if (!$user_id) { |
|
| 1399 | + $user_id = $_SESSION["uid"]; |
|
| 1400 | + } |
|
| 1365 | 1401 | |
| 1366 | 1402 | $pdo = Db::pdo(); |
| 1367 | 1403 | |
@@ -1396,7 +1432,9 @@ discard block |
||
| 1396 | 1432 | } |
| 1397 | 1433 | |
| 1398 | 1434 | static function getLabelUnread($label_id, $owner_uid = false) { |
| 1399 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
| 1435 | + if (!$owner_uid) { |
|
| 1436 | + $owner_uid = $_SESSION["uid"]; |
|
| 1437 | + } |
|
| 1400 | 1438 | |
| 1401 | 1439 | $pdo = Db::pdo(); |
| 1402 | 1440 | |
@@ -1491,8 +1529,9 @@ discard block |
||
| 1491 | 1529 | |
| 1492 | 1530 | $unread = getFeedUnread($feed, $cat_view); |
| 1493 | 1531 | |
| 1494 | - if ($cat_view && $feed > 0 && $include_children) |
|
| 1495 | - $unread += Feeds::getCategoryChildrenUnread($feed); |
|
| 1532 | + if ($cat_view && $feed > 0 && $include_children) { |
|
| 1533 | + $unread += Feeds::getCategoryChildrenUnread($feed); |
|
| 1534 | + } |
|
| 1496 | 1535 | |
| 1497 | 1536 | if ($unread > 0) { |
| 1498 | 1537 | $view_query_part = " unread = true AND "; |
@@ -1604,7 +1643,9 @@ discard block |
||
| 1604 | 1643 | $allow_archived = true; |
| 1605 | 1644 | $ignore_vfeed_group = true; |
| 1606 | 1645 | |
| 1607 | - if (!$override_order) $override_order = "last_read DESC"; |
|
| 1646 | + if (!$override_order) { |
|
| 1647 | + $override_order = "last_read DESC"; |
|
| 1648 | + } |
|
| 1608 | 1649 | |
| 1609 | 1650 | } else if ($feed == -3) { // fresh virtual feed |
| 1610 | 1651 | $query_strategy_part = "unread = true AND score >= 0"; |
@@ -1715,13 +1756,16 @@ discard block |
||
| 1715 | 1756 | LEFT JOIN ttrss_feeds ON (feed_id = ttrss_feeds.id)"; |
| 1716 | 1757 | } |
| 1717 | 1758 | |
| 1718 | - if ($vfeed_query_part) $vfeed_query_part .= "favicon_avg_color,"; |
|
| 1759 | + if ($vfeed_query_part) { |
|
| 1760 | + $vfeed_query_part .= "favicon_avg_color,"; |
|
| 1761 | + } |
|
| 1719 | 1762 | |
| 1720 | 1763 | $first_id = 0; |
| 1721 | 1764 | $first_id_query_strategy_part = $query_strategy_part; |
| 1722 | 1765 | |
| 1723 | - if ($feed == -3) |
|
| 1724 | - $first_id_query_strategy_part = "true"; |
|
| 1766 | + if ($feed == -3) { |
|
| 1767 | + $first_id_query_strategy_part = "true"; |
|
| 1768 | + } |
|
| 1725 | 1769 | |
| 1726 | 1770 | if (DB_TYPE == "pgsql") { |
| 1727 | 1771 | $sanity_interval_qpart = "date_entered >= NOW() - INTERVAL '1 hour' AND"; |
@@ -1853,7 +1897,9 @@ discard block |
||
| 1853 | 1897 | $query_strategy_part ORDER BY $order_by |
| 1854 | 1898 | $limit_query_part $offset_query_part"; |
| 1855 | 1899 | |
| 1856 | - if ($_REQUEST["debug"]) print $query; |
|
| 1900 | + if ($_REQUEST["debug"]) { |
|
| 1901 | + print $query; |
|
| 1902 | + } |
|
| 1857 | 1903 | |
| 1858 | 1904 | $res = $pdo->query($query); |
| 1859 | 1905 | } |
@@ -2003,18 +2049,23 @@ discard block |
||
| 2003 | 2049 | } |
| 2004 | 2050 | } |
| 2005 | 2051 | |
| 2006 | - if ($url != "http:///") |
|
| 2007 | - return $url; |
|
| 2008 | - else |
|
| 2009 | - return ''; |
|
| 2052 | + if ($url != "http:///") { |
|
| 2053 | + return $url; |
|
| 2054 | + } else { |
|
| 2055 | + return ''; |
|
| 2056 | + } |
|
| 2010 | 2057 | } |
| 2011 | 2058 | |
| 2012 | 2059 | static function add_feed_category($feed_cat, $parent_cat_id = false, $order_id = 0) { |
| 2013 | 2060 | |
| 2014 | - if (!$feed_cat) return false; |
|
| 2061 | + if (!$feed_cat) { |
|
| 2062 | + return false; |
|
| 2063 | + } |
|
| 2015 | 2064 | |
| 2016 | 2065 | $feed_cat = mb_substr($feed_cat, 0, 250); |
| 2017 | - if (!$parent_cat_id) $parent_cat_id = null; |
|
| 2066 | + if (!$parent_cat_id) { |
|
| 2067 | + $parent_cat_id = null; |
|
| 2068 | + } |
|
| 2018 | 2069 | |
| 2019 | 2070 | $pdo = Db::pdo(); |
| 2020 | 2071 | $tr_in_progress = false; |
@@ -2036,7 +2087,9 @@ discard block |
||
| 2036 | 2087 | VALUES (?, ?, ?, ?)"); |
| 2037 | 2088 | $sth->execute([$_SESSION['uid'], $feed_cat, $parent_cat_id, (int)$order_id]); |
| 2038 | 2089 | |
| 2039 | - if (!$tr_in_progress) $pdo->commit(); |
|
| 2090 | + if (!$tr_in_progress) { |
|
| 2091 | + $pdo->commit(); |
|
| 2092 | + } |
|
| 2040 | 2093 | |
| 2041 | 2094 | return true; |
| 2042 | 2095 | } |
@@ -2048,7 +2101,9 @@ discard block |
||
| 2048 | 2101 | |
| 2049 | 2102 | static function get_feed_access_key($feed_id, $is_cat, $owner_uid = false) { |
| 2050 | 2103 | |
| 2051 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
| 2104 | + if (!$owner_uid) { |
|
| 2105 | + $owner_uid = $_SESSION["uid"]; |
|
| 2106 | + } |
|
| 2052 | 2107 | |
| 2053 | 2108 | $is_cat = bool_to_sql_bool($is_cat); |
| 2054 | 2109 | |
@@ -2086,7 +2141,9 @@ discard block |
||
| 2086 | 2141 | */ |
| 2087 | 2142 | static function purge_feed($feed_id, $purge_interval) { |
| 2088 | 2143 | |
| 2089 | - if (!$purge_interval) $purge_interval = Feeds::feed_purge_interval($feed_id); |
|
| 2144 | + if (!$purge_interval) { |
|
| 2145 | + $purge_interval = Feeds::feed_purge_interval($feed_id); |
|
| 2146 | + } |
|
| 2090 | 2147 | |
| 2091 | 2148 | $pdo = Db::pdo(); |
| 2092 | 2149 | |
@@ -2106,7 +2163,9 @@ discard block |
||
| 2106 | 2163 | return; |
| 2107 | 2164 | } |
| 2108 | 2165 | |
| 2109 | - if (!$owner_uid) return; |
|
| 2166 | + if (!$owner_uid) { |
|
| 2167 | + return; |
|
| 2168 | + } |
|
| 2110 | 2169 | |
| 2111 | 2170 | if (FORCE_ARTICLE_PURGE == 0) { |
| 2112 | 2171 | $purge_unread = get_pref("PURGE_UNREAD_ARTICLES", |
@@ -2116,10 +2175,11 @@ discard block |
||
| 2116 | 2175 | $purge_interval = FORCE_ARTICLE_PURGE; |
| 2117 | 2176 | } |
| 2118 | 2177 | |
| 2119 | - if (!$purge_unread) |
|
| 2120 | - $query_limit = " unread = false AND "; |
|
| 2121 | - else |
|
| 2122 | - $query_limit = ""; |
|
| 2178 | + if (!$purge_unread) { |
|
| 2179 | + $query_limit = " unread = false AND "; |
|
| 2180 | + } else { |
|
| 2181 | + $query_limit = ""; |
|
| 2182 | + } |
|
| 2123 | 2183 | |
| 2124 | 2184 | $purge_interval = (int) $purge_interval; |
| 2125 | 2185 | |
@@ -2166,8 +2226,10 @@ discard block |
||
| 2166 | 2226 | $purge_interval = $row["purge_interval"]; |
| 2167 | 2227 | $owner_uid = $row["owner_uid"]; |
| 2168 | 2228 | |
| 2169 | - if ($purge_interval == 0) $purge_interval = get_pref( |
|
| 2229 | + if ($purge_interval == 0) { |
|
| 2230 | + $purge_interval = get_pref( |
|
| 2170 | 2231 | 'PURGE_OLD_DAYS', $owner_uid); |
| 2232 | + } |
|
| 2171 | 2233 | |
| 2172 | 2234 | return $purge_interval; |
| 2173 | 2235 | |
@@ -2185,10 +2247,11 @@ discard block |
||
| 2185 | 2247 | |
| 2186 | 2248 | $pdo = Db::pdo(); |
| 2187 | 2249 | |
| 2188 | - if ($search_language) |
|
| 2189 | - $search_language = $pdo->quote(mb_strtolower($search_language)); |
|
| 2190 | - else |
|
| 2191 | - $search_language = $pdo->quote("english"); |
|
| 2250 | + if ($search_language) { |
|
| 2251 | + $search_language = $pdo->quote(mb_strtolower($search_language)); |
|
| 2252 | + } else { |
|
| 2253 | + $search_language = $pdo->quote("english"); |
|
| 2254 | + } |
|
| 2192 | 2255 | |
| 2193 | 2256 | foreach ($keywords as $k) { |
| 2194 | 2257 | if (strpos($k, "-") === 0) { |
@@ -2223,56 +2286,68 @@ discard block |
||
| 2223 | 2286 | break; |
| 2224 | 2287 | case "note": |
| 2225 | 2288 | if ($commandpair[1]) { |
| 2226 | - if ($commandpair[1] == "true") |
|
| 2227 | - array_push($query_keywords, "($not (note IS NOT NULL AND note != ''))"); |
|
| 2228 | - else if ($commandpair[1] == "false") |
|
| 2229 | - array_push($query_keywords, "($not (note IS NULL OR note = ''))"); |
|
| 2230 | - else |
|
| 2231 | - array_push($query_keywords, "($not (LOWER(note) LIKE ". |
|
| 2289 | + if ($commandpair[1] == "true") { |
|
| 2290 | + array_push($query_keywords, "($not (note IS NOT NULL AND note != ''))"); |
|
| 2291 | + } else if ($commandpair[1] == "false") { |
|
| 2292 | + array_push($query_keywords, "($not (note IS NULL OR note = ''))"); |
|
| 2293 | + } else { |
|
| 2294 | + array_push($query_keywords, "($not (LOWER(note) LIKE ". |
|
| 2232 | 2295 | $pdo->quote('%' . mb_strtolower($commandpair[1]) . '%')."))"); |
| 2296 | + } |
|
| 2233 | 2297 | } else { |
| 2234 | 2298 | array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
| 2235 | 2299 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
| 2236 | - if (!$not) array_push($search_words, $k); |
|
| 2300 | + if (!$not) { |
|
| 2301 | + array_push($search_words, $k); |
|
| 2302 | + } |
|
| 2237 | 2303 | } |
| 2238 | 2304 | break; |
| 2239 | 2305 | case "star": |
| 2240 | 2306 | |
| 2241 | 2307 | if ($commandpair[1]) { |
| 2242 | - if ($commandpair[1] == "true") |
|
| 2243 | - array_push($query_keywords, "($not (marked = true))"); |
|
| 2244 | - else |
|
| 2245 | - array_push($query_keywords, "($not (marked = false))"); |
|
| 2308 | + if ($commandpair[1] == "true") { |
|
| 2309 | + array_push($query_keywords, "($not (marked = true))"); |
|
| 2310 | + } else { |
|
| 2311 | + array_push($query_keywords, "($not (marked = false))"); |
|
| 2312 | + } |
|
| 2246 | 2313 | } else { |
| 2247 | 2314 | array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
| 2248 | 2315 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
| 2249 | - if (!$not) array_push($search_words, $k); |
|
| 2316 | + if (!$not) { |
|
| 2317 | + array_push($search_words, $k); |
|
| 2318 | + } |
|
| 2250 | 2319 | } |
| 2251 | 2320 | break; |
| 2252 | 2321 | case "pub": |
| 2253 | 2322 | if ($commandpair[1]) { |
| 2254 | - if ($commandpair[1] == "true") |
|
| 2255 | - array_push($query_keywords, "($not (published = true))"); |
|
| 2256 | - else |
|
| 2257 | - array_push($query_keywords, "($not (published = false))"); |
|
| 2323 | + if ($commandpair[1] == "true") { |
|
| 2324 | + array_push($query_keywords, "($not (published = true))"); |
|
| 2325 | + } else { |
|
| 2326 | + array_push($query_keywords, "($not (published = false))"); |
|
| 2327 | + } |
|
| 2258 | 2328 | |
| 2259 | 2329 | } else { |
| 2260 | 2330 | array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') |
| 2261 | 2331 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
| 2262 | - if (!$not) array_push($search_words, $k); |
|
| 2332 | + if (!$not) { |
|
| 2333 | + array_push($search_words, $k); |
|
| 2334 | + } |
|
| 2263 | 2335 | } |
| 2264 | 2336 | break; |
| 2265 | 2337 | case "unread": |
| 2266 | 2338 | if ($commandpair[1]) { |
| 2267 | - if ($commandpair[1] == "true") |
|
| 2268 | - array_push($query_keywords, "($not (unread = true))"); |
|
| 2269 | - else |
|
| 2270 | - array_push($query_keywords, "($not (unread = false))"); |
|
| 2339 | + if ($commandpair[1] == "true") { |
|
| 2340 | + array_push($query_keywords, "($not (unread = true))"); |
|
| 2341 | + } else { |
|
| 2342 | + array_push($query_keywords, "($not (unread = false))"); |
|
| 2343 | + } |
|
| 2271 | 2344 | |
| 2272 | 2345 | } else { |
| 2273 | 2346 | array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
| 2274 | 2347 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
| 2275 | - if (!$not) array_push($search_words, $k); |
|
| 2348 | + if (!$not) { |
|
| 2349 | + array_push($search_words, $k); |
|
| 2350 | + } |
|
| 2276 | 2351 | } |
| 2277 | 2352 | break; |
| 2278 | 2353 | default: |
@@ -2295,7 +2370,9 @@ discard block |
||
| 2295 | 2370 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
| 2296 | 2371 | } |
| 2297 | 2372 | |
| 2298 | - if (!$not) array_push($search_words, $k); |
|
| 2373 | + if (!$not) { |
|
| 2374 | + array_push($search_words, $k); |
|
| 2375 | + } |
|
| 2299 | 2376 | } |
| 2300 | 2377 | } |
| 2301 | 2378 | } |
@@ -120,10 +120,16 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | $rc = false; |
| 122 | 122 | |
| 123 | - if (!$title) $title = $url; |
|
| 124 | - if (!$title && !$url) return false; |
|
| 123 | + if (!$title) { |
|
| 124 | + $title = $url; |
|
| 125 | + } |
|
| 126 | + if (!$title && !$url) { |
|
| 127 | + return false; |
|
| 128 | + } |
|
| 125 | 129 | |
| 126 | - if (filter_var($url, FILTER_VALIDATE_URL) === FALSE) return false; |
|
| 130 | + if (filter_var($url, FILTER_VALIDATE_URL) === FALSE) { |
|
| 131 | + return false; |
|
| 132 | + } |
|
| 127 | 133 | |
| 128 | 134 | $pdo = Db::pdo(); |
| 129 | 135 | |
@@ -334,7 +340,9 @@ discard block |
||
| 334 | 340 | $tags_str = $this->format_tags_string($tags); |
| 335 | 341 | $tags_str_full = join(", ", $tags); |
| 336 | 342 | |
| 337 | - if (!$tags_str_full) $tags_str_full = __("no tags"); |
|
| 343 | + if (!$tags_str_full) { |
|
| 344 | + $tags_str_full = __("no tags"); |
|
| 345 | + } |
|
| 338 | 346 | |
| 339 | 347 | print json_encode([ |
| 340 | 348 | "id" => (int) $id, |
@@ -383,10 +391,11 @@ discard block |
||
| 383 | 391 | |
| 384 | 392 | foreach ($ids as $id) { |
| 385 | 393 | |
| 386 | - if ($assign) |
|
| 387 | - Labels::add_article($id, $label, $_SESSION["uid"]); |
|
| 388 | - else |
|
| 389 | - Labels::remove_article($id, $label, $_SESSION["uid"]); |
|
| 394 | + if ($assign) { |
|
| 395 | + Labels::add_article($id, $label, $_SESSION["uid"]); |
|
| 396 | + } else { |
|
| 397 | + Labels::remove_article($id, $label, $_SESSION["uid"]); |
|
| 398 | + } |
|
| 390 | 399 | |
| 391 | 400 | $labels = $this->get_article_labels($id, $_SESSION["uid"]); |
| 392 | 401 | |
@@ -447,14 +456,18 @@ discard block |
||
| 447 | 456 | $width = $line["width"]; |
| 448 | 457 | $height = $line["height"]; |
| 449 | 458 | |
| 450 | - if (!$ctype) $ctype = __("unknown type"); |
|
| 459 | + if (!$ctype) { |
|
| 460 | + $ctype = __("unknown type"); |
|
| 461 | + } |
|
| 451 | 462 | |
| 452 | 463 | //$filename = substr($url, strrpos($url, "/")+1); |
| 453 | 464 | $filename = basename($url); |
| 454 | 465 | |
| 455 | 466 | $player = format_inline_player($url, $ctype); |
| 456 | 467 | |
| 457 | - if ($player) array_push($entries_inline, $player); |
|
| 468 | + if ($player) { |
|
| 469 | + array_push($entries_inline, $player); |
|
| 470 | + } |
|
| 458 | 471 | |
| 459 | 472 | # $entry .= " <a target=\"_blank\" href=\"" . htmlspecialchars($url) . "\" rel=\"noopener noreferrer\">" . |
| 460 | 473 | # $filename . " (" . $ctype . ")" . "</a>"; |
@@ -482,8 +495,9 @@ discard block |
||
| 482 | 495 | |
| 483 | 496 | foreach ($entries as $entry) { |
| 484 | 497 | |
| 485 | - foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ENCLOSURE) as $plugin) |
|
| 486 | - $retval = $plugin->hook_render_enclosure($entry, $hide_images); |
|
| 498 | + foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ENCLOSURE) as $plugin) { |
|
| 499 | + $retval = $plugin->hook_render_enclosure($entry, $hide_images); |
|
| 500 | + } |
|
| 487 | 501 | |
| 488 | 502 | |
| 489 | 503 | if ($retval) { |
@@ -494,10 +508,12 @@ discard block |
||
| 494 | 508 | |
| 495 | 509 | if (!$hide_images) { |
| 496 | 510 | $encsize = ''; |
| 497 | - if ($entry['height'] > 0) |
|
| 498 | - $encsize .= ' height="' . intval($entry['height']) . '"'; |
|
| 499 | - if ($entry['width'] > 0) |
|
| 500 | - $encsize .= ' width="' . intval($entry['width']) . '"'; |
|
| 511 | + if ($entry['height'] > 0) { |
|
| 512 | + $encsize .= ' height="' . intval($entry['height']) . '"'; |
|
| 513 | + } |
|
| 514 | + if ($entry['width'] > 0) { |
|
| 515 | + $encsize .= ' width="' . intval($entry['width']) . '"'; |
|
| 516 | + } |
|
| 501 | 517 | $rv .= "<p><img |
| 502 | 518 | alt=\"".htmlspecialchars($entry["filename"])."\" |
| 503 | 519 | src=\"" .htmlspecialchars($entry["url"]) . "\" |
@@ -529,15 +545,17 @@ discard block |
||
| 529 | 545 | $rv .= "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; |
| 530 | 546 | |
| 531 | 547 | foreach ($entries as $entry) { |
| 532 | - if ($entry["title"]) |
|
| 533 | - $title = " — " . truncate_string($entry["title"], 30); |
|
| 534 | - else |
|
| 535 | - $title = ""; |
|
| 548 | + if ($entry["title"]) { |
|
| 549 | + $title = " — " . truncate_string($entry["title"], 30); |
|
| 550 | + } else { |
|
| 551 | + $title = ""; |
|
| 552 | + } |
|
| 536 | 553 | |
| 537 | - if ($entry["filename"]) |
|
| 538 | - $filename = truncate_middle(htmlspecialchars($entry["filename"]), 60); |
|
| 539 | - else |
|
| 540 | - $filename = ""; |
|
| 554 | + if ($entry["filename"]) { |
|
| 555 | + $filename = truncate_middle(htmlspecialchars($entry["filename"]), 60); |
|
| 556 | + } else { |
|
| 557 | + $filename = ""; |
|
| 558 | + } |
|
| 541 | 559 | |
| 542 | 560 | $rv .= "<div onclick='popupOpenUrl(\"".htmlspecialchars($entry["url"])."\")' |
| 543 | 561 | dojoType=\"dijit.MenuItem\">".$filename . $title."</div>"; |
@@ -555,7 +573,9 @@ discard block |
||
| 555 | 573 | |
| 556 | 574 | $a_id = $id; |
| 557 | 575 | |
| 558 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
| 576 | + if (!$owner_uid) { |
|
| 577 | + $owner_uid = $_SESSION["uid"]; |
|
| 578 | + } |
|
| 559 | 579 | |
| 560 | 580 | $pdo = Db::pdo(); |
| 561 | 581 | |
@@ -573,7 +593,9 @@ discard block |
||
| 573 | 593 | WHERE ref_id = ? AND owner_uid = ?"); |
| 574 | 594 | $csth->execute([$id, $owner_uid]); |
| 575 | 595 | |
| 576 | - if ($row = $csth->fetch()) $tag_cache = $row["tag_cache"]; |
|
| 596 | + if ($row = $csth->fetch()) { |
|
| 597 | + $tag_cache = $row["tag_cache"]; |
|
| 598 | + } |
|
| 577 | 599 | } |
| 578 | 600 | |
| 579 | 601 | if ($tag_cache) { |
@@ -614,8 +636,9 @@ discard block |
||
| 614 | 636 | |
| 615 | 637 | $tags_str = mb_substr($tags_str, 0, mb_strlen($tags_str)-2); |
| 616 | 638 | |
| 617 | - if (count($tags) > $maxtags) |
|
| 618 | - $tags_str .= ", …"; |
|
| 639 | + if (count($tags) > $maxtags) { |
|
| 640 | + $tags_str .= ", …"; |
|
| 641 | + } |
|
| 619 | 642 | |
| 620 | 643 | return $tags_str; |
| 621 | 644 | } |
@@ -623,7 +646,9 @@ discard block |
||
| 623 | 646 | |
| 624 | 647 | static function format_article_labels($labels) { |
| 625 | 648 | |
| 626 | - if (!is_array($labels)) return ''; |
|
| 649 | + if (!is_array($labels)) { |
|
| 650 | + return ''; |
|
| 651 | + } |
|
| 627 | 652 | |
| 628 | 653 | $labels_str = ""; |
| 629 | 654 | |
@@ -681,10 +706,11 @@ discard block |
||
| 681 | 706 | |
| 682 | 707 | // purge orphaned posts in main content table |
| 683 | 708 | |
| 684 | - if (DB_TYPE == "mysql") |
|
| 685 | - $limit_qpart = "LIMIT 5000"; |
|
| 686 | - else |
|
| 687 | - $limit_qpart = ""; |
|
| 709 | + if (DB_TYPE == "mysql") { |
|
| 710 | + $limit_qpart = "LIMIT 5000"; |
|
| 711 | + } else { |
|
| 712 | + $limit_qpart = ""; |
|
| 713 | + } |
|
| 688 | 714 | |
| 689 | 715 | $pdo = Db::pdo(); |
| 690 | 716 | $res = $pdo->query("DELETE FROM ttrss_entries WHERE |
@@ -698,7 +724,9 @@ discard block |
||
| 698 | 724 | |
| 699 | 725 | static function catchupArticlesById($ids, $cmode, $owner_uid = false) { |
| 700 | 726 | |
| 701 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
| 727 | + if (!$owner_uid) { |
|
| 728 | + $owner_uid = $_SESSION["uid"]; |
|
| 729 | + } |
|
| 702 | 730 | |
| 703 | 731 | $pdo = Db::pdo(); |
| 704 | 732 | |
@@ -748,7 +776,9 @@ discard block |
||
| 748 | 776 | static function get_article_labels($id, $owner_uid = false) { |
| 749 | 777 | $rv = array(); |
| 750 | 778 | |
| 751 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
| 779 | + if (!$owner_uid) { |
|
| 780 | + $owner_uid = $_SESSION["uid"]; |
|
| 781 | + } |
|
| 752 | 782 | |
| 753 | 783 | $pdo = Db::pdo(); |
| 754 | 784 | |
@@ -762,10 +792,11 @@ discard block |
||
| 762 | 792 | if ($label_cache) { |
| 763 | 793 | $tmp = json_decode($label_cache, true); |
| 764 | 794 | |
| 765 | - if (!$tmp || $tmp["no-labels"] == 1) |
|
| 766 | - return $rv; |
|
| 767 | - else |
|
| 768 | - return $tmp; |
|
| 795 | + if (!$tmp || $tmp["no-labels"] == 1) { |
|
| 796 | + return $rv; |
|
| 797 | + } else { |
|
| 798 | + return $tmp; |
|
| 799 | + } |
|
| 769 | 800 | } |
| 770 | 801 | } |
| 771 | 802 | |
@@ -784,10 +815,11 @@ discard block |
||
| 784 | 815 | array_push($rv, $rk); |
| 785 | 816 | } |
| 786 | 817 | |
| 787 | - if (count($rv) > 0) |
|
| 788 | - Labels::update_cache($owner_uid, $id, $rv); |
|
| 789 | - else |
|
| 790 | - Labels::update_cache($owner_uid, $id, array("no-labels" => 1)); |
|
| 818 | + if (count($rv) > 0) { |
|
| 819 | + Labels::update_cache($owner_uid, $id, $rv); |
|
| 820 | + } else { |
|
| 821 | + Labels::update_cache($owner_uid, $id, array("no-labels" => 1)); |
|
| 822 | + } |
|
| 791 | 823 | |
| 792 | 824 | return $rv; |
| 793 | 825 | } |
@@ -835,28 +867,33 @@ discard block |
||
| 835 | 867 | } |
| 836 | 868 | } |
| 837 | 869 | |
| 838 | - if (!$article_image) |
|
| 839 | - foreach ($enclosures as $enc) { |
|
| 870 | + if (!$article_image) { |
|
| 871 | + foreach ($enclosures as $enc) { |
|
| 840 | 872 | if (strpos($enc["content_type"], "image/") !== FALSE) { |
| 841 | 873 | $article_image = $enc["content_url"]; |
| 874 | + } |
|
| 842 | 875 | break; |
| 843 | 876 | } |
| 844 | 877 | } |
| 845 | 878 | |
| 846 | - if ($article_image) |
|
| 847 | - $article_image = rewrite_relative_url($site_url, $article_image); |
|
| 879 | + if ($article_image) { |
|
| 880 | + $article_image = rewrite_relative_url($site_url, $article_image); |
|
| 881 | + } |
|
| 848 | 882 | |
| 849 | - if ($article_stream) |
|
| 850 | - $article_stream = rewrite_relative_url($site_url, $article_stream); |
|
| 883 | + if ($article_stream) { |
|
| 884 | + $article_stream = rewrite_relative_url($site_url, $article_stream); |
|
| 885 | + } |
|
| 851 | 886 | } |
| 852 | 887 | |
| 853 | 888 | $cache = new DiskCache("images"); |
| 854 | 889 | |
| 855 | - if ($article_image && $cache->exists(sha1($article_image))) |
|
| 856 | - $article_image = $cache->getUrl(sha1($article_image)); |
|
| 890 | + if ($article_image && $cache->exists(sha1($article_image))) { |
|
| 891 | + $article_image = $cache->getUrl(sha1($article_image)); |
|
| 892 | + } |
|
| 857 | 893 | |
| 858 | - if ($article_stream && $cache->exists(sha1($article_stream))) |
|
| 859 | - $article_stream = $cache->getUrl(sha1($article_stream)); |
|
| 894 | + if ($article_stream && $cache->exists(sha1($article_stream))) { |
|
| 895 | + $article_stream = $cache->getUrl(sha1($article_stream)); |
|
| 896 | + } |
|
| 860 | 897 | |
| 861 | 898 | return [$article_image, $article_stream]; |
| 862 | 899 | } |