@@ -2,8 +2,8 @@ discard block |
||
| 2 | 2 | require_once "colors.php"; |
| 3 | 3 | |
| 4 | 4 | class Feeds extends Handler_Protected { |
| 5 | - const NEVER_GROUP_FEEDS = [ -6, 0 ]; |
|
| 6 | - const NEVER_GROUP_BY_DATE = [ -2, -1, -3 ]; |
|
| 5 | + const NEVER_GROUP_FEEDS = [ -6, 0]; |
|
| 6 | + const NEVER_GROUP_BY_DATE = [ -2, -1, -3]; |
|
| 7 | 7 | |
| 8 | 8 | private $params; |
| 9 | 9 | |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | $reply = ""; |
| 29 | 29 | |
| 30 | - $rss_link = htmlspecialchars(get_self_url_prefix() . |
|
| 30 | + $rss_link = htmlspecialchars(get_self_url_prefix(). |
|
| 31 | 31 | "/public.php?op=rss&id=$feed_id$cat_q$search_q"); |
| 32 | 32 | |
| 33 | 33 | $reply .= "<span class='left'>"; |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | if ($error) |
| 52 | - $reply .= " <i title=\"" . htmlspecialchars($error) . "\" class='material-icons icon-error'>error</i>"; |
|
| 52 | + $reply .= " <i title=\"".htmlspecialchars($error)."\" class='material-icons icon-error'>error</i>"; |
|
| 53 | 53 | |
| 54 | 54 | $reply .= "</span>"; |
| 55 | 55 | $reply .= "<span id='feed_current_unread' style='display: none'></span>"; |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | $sth->execute([$feed]); |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - if ($method_split[0] == "MarkAllReadGR") { |
|
| 142 | + if ($method_split[0] == "MarkAllReadGR") { |
|
| 143 | 143 | $this->catchup_feed($method_split[1], false); |
| 144 | 144 | } |
| 145 | 145 | |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | if (!get_pref('SHOW_CONTENT_PREVIEW')) { |
| 244 | 244 | $line["content_preview"] = ""; |
| 245 | 245 | } else { |
| 246 | - $line["content_preview"] = "— " . truncate_string(strip_tags($line["content"]), 250); |
|
| 246 | + $line["content_preview"] = "— ".truncate_string(strip_tags($line["content"]), 250); |
|
| 247 | 247 | |
| 248 | 248 | foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) { |
| 249 | 249 | $line = $p->hook_query_headlines($line, 250, false); |
@@ -322,10 +322,10 @@ discard block |
||
| 322 | 322 | if (!get_pref("CDM_EXPANDED")) { |
| 323 | 323 | $line["cdm_excerpt"] = "<span class='collapse'> |
| 324 | 324 | <i class='material-icons' onclick='return Article.cdmUnsetActive(event)' |
| 325 | - title=\"" . __("Collapse article") . "\">remove_circle</i></span>"; |
|
| 325 | + title=\"" . __("Collapse article")."\">remove_circle</i></span>"; |
|
| 326 | 326 | |
| 327 | 327 | if (get_pref('SHOW_CONTENT_PREVIEW')) { |
| 328 | - $line["cdm_excerpt"] .= "<span class='excerpt'>" . $line["content_preview"] . "</span>"; |
|
| 328 | + $line["cdm_excerpt"] .= "<span class='excerpt'>".$line["content_preview"]."</span>"; |
|
| 329 | 329 | } |
| 330 | 330 | } |
| 331 | 331 | |
@@ -339,11 +339,11 @@ discard block |
||
| 339 | 339 | $ofgh->execute([$line["orig_feed_id"], $_SESSION['uid']]); |
| 340 | 340 | |
| 341 | 341 | if ($tmp_line = $ofgh->fetch()) { |
| 342 | - $line["orig_feed"] = [ $tmp_line["title"], $tmp_line["site_url"], $tmp_line["feed_url"] ]; |
|
| 342 | + $line["orig_feed"] = [$tmp_line["title"], $tmp_line["site_url"], $tmp_line["feed_url"]]; |
|
| 343 | 343 | } |
| 344 | 344 | } |
| 345 | 345 | |
| 346 | - $line["updated_long"] = make_local_datetime($line["updated"],true); |
|
| 346 | + $line["updated_long"] = make_local_datetime($line["updated"], true); |
|
| 347 | 347 | $line["updated"] = make_local_datetime($line["updated"], false, false, false, true); |
| 348 | 348 | |
| 349 | 349 | |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | if (isset($rgba_cache[$feed_id])) { |
| 380 | - $line['feed_bg_color'] = 'rgba(' . implode(",", $rgba_cache[$feed_id]) . ',0.3)'; |
|
| 380 | + $line['feed_bg_color'] = 'rgba('.implode(",", $rgba_cache[$feed_id]).',0.3)'; |
|
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | /* we don't need those */ |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | |
| 422 | 422 | $reply['content'] .= "<p><span class=\"text-muted\">"; |
| 423 | 423 | |
| 424 | - $sth = $this->pdo->prepare("SELECT " . SUBSTRING_FOR_DATE . "(MAX(last_updated), 1, 19) AS last_updated FROM ttrss_feeds |
|
| 424 | + $sth = $this->pdo->prepare("SELECT ".SUBSTRING_FOR_DATE."(MAX(last_updated), 1, 19) AS last_updated FROM ttrss_feeds |
|
| 425 | 425 | WHERE owner_uid = ?"); |
| 426 | 426 | $sth->execute([$_SESSION['uid']]); |
| 427 | 427 | $row = $sth->fetch(); |
@@ -439,8 +439,8 @@ discard block |
||
| 439 | 439 | |
| 440 | 440 | if ($num_errors > 0) { |
| 441 | 441 | $reply['content'] .= "<br/>"; |
| 442 | - $reply['content'] .= "<a class=\"text-muted\" href=\"#\" onclick=\"CommonDialogs.showFeedsWithErrors()\">" . |
|
| 443 | - __('Some feeds have update errors (click for details)') . "</a>"; |
|
| 442 | + $reply['content'] .= "<a class=\"text-muted\" href=\"#\" onclick=\"CommonDialogs.showFeedsWithErrors()\">". |
|
| 443 | + __('Some feeds have update errors (click for details)')."</a>"; |
|
| 444 | 444 | } |
| 445 | 445 | $reply['content'] .= "</span></p></div>"; |
| 446 | 446 | |
@@ -635,7 +635,7 @@ discard block |
||
| 635 | 635 | $reply['headlines']['is_cat'] = false; |
| 636 | 636 | |
| 637 | 637 | $reply['headlines']['toolbar'] = ''; |
| 638 | - $reply['headlines']['content'] = "<div class='whiteBox'>". $error . "</div>"; |
|
| 638 | + $reply['headlines']['content'] = "<div class='whiteBox'>".$error."</div>"; |
|
| 639 | 639 | |
| 640 | 640 | $reply['headlines-info'] = array("count" => 0, |
| 641 | 641 | "unread" => 0, |
@@ -669,7 +669,7 @@ discard block |
||
| 669 | 669 | print "<fieldset>"; |
| 670 | 670 | |
| 671 | 671 | if (get_pref('ENABLE_FEED_CATS')) { |
| 672 | - print "<label class='inline'>" . __('Place in category:') . "</label> "; |
|
| 672 | + print "<label class='inline'>".__('Place in category:')."</label> "; |
|
| 673 | 673 | print_feed_cat_select("cat", false, 'dojoType="fox.form.Select"'); |
| 674 | 674 | } |
| 675 | 675 | |
@@ -678,7 +678,7 @@ discard block |
||
| 678 | 678 | print "</section>"; |
| 679 | 679 | |
| 680 | 680 | print '<div id="feedDlg_feedsContainer" style="display : none"> |
| 681 | - <header>' . __('Available feeds') . '</header> |
|
| 681 | + <header>' . __('Available feeds').'</header> |
|
| 682 | 682 | <section> |
| 683 | 683 | <fieldset> |
| 684 | 684 | <select id="feedDlg_feedContainerSelect" |
@@ -743,7 +743,7 @@ discard block |
||
| 743 | 743 | |
| 744 | 744 | if (DB_TYPE == "pgsql") { |
| 745 | 745 | print "<fieldset>"; |
| 746 | - print "<label class='inline'>" . __("Language:") . "</label>"; |
|
| 746 | + print "<label class='inline'>".__("Language:")."</label>"; |
|
| 747 | 747 | print_select("search_language", get_pref('DEFAULT_SEARCH_LANGUAGE'), Pref_Feeds::get_ts_languages(), |
| 748 | 748 | "dojoType='fox.form.Select' title=\"".__('Used for word stemming')."\""); |
| 749 | 749 | print "</fieldset>"; |
@@ -772,7 +772,7 @@ discard block |
||
| 772 | 772 | Debug::set_enabled(true); |
| 773 | 773 | Debug::set_loglevel($_REQUEST["xdebug"]); |
| 774 | 774 | |
| 775 | - $feed_id = (int)$_REQUEST["feed_id"]; |
|
| 775 | + $feed_id = (int) $_REQUEST["feed_id"]; |
|
| 776 | 776 | @$do_update = $_REQUEST["action"] == "do_update"; |
| 777 | 777 | $csrf_token = $_REQUEST["csrf_token"]; |
| 778 | 778 | |
@@ -811,7 +811,7 @@ discard block |
||
| 811 | 811 | </script> |
| 812 | 812 | |
| 813 | 813 | <div class="container"> |
| 814 | - <h1>Feed Debugger: <?php echo "$feed_id: " . $this->getFeedTitle($feed_id) ?></h1> |
|
| 814 | + <h1>Feed Debugger: <?php echo "$feed_id: ".$this->getFeedTitle($feed_id) ?></h1> |
|
| 815 | 815 | <div class="content"> |
| 816 | 816 | <form method="GET" action=""> |
| 817 | 817 | <input type="hidden" name="op" value="feeds"> |
@@ -1074,7 +1074,7 @@ discard block |
||
| 1074 | 1074 | } else if ($n_feed >= 0) { |
| 1075 | 1075 | |
| 1076 | 1076 | if ($n_feed != 0) { |
| 1077 | - $match_part = "feed_id = " . (int)$n_feed; |
|
| 1077 | + $match_part = "feed_id = ".(int) $n_feed; |
|
| 1078 | 1078 | } else { |
| 1079 | 1079 | $match_part = "feed_id IS NULL"; |
| 1080 | 1080 | } |
@@ -1184,7 +1184,7 @@ discard block |
||
| 1184 | 1184 | (owner_uid,feed_url,title,cat_id, auth_login,auth_pass,update_method,auth_pass_encrypted) |
| 1185 | 1185 | VALUES (?, ?, ?, ?, ?, ?, 0, false)"); |
| 1186 | 1186 | |
| 1187 | - $sth->execute([$_SESSION['uid'], $url, "[Unknown]", $cat_id, (string)$auth_login, (string)$auth_pass]); |
|
| 1187 | + $sth->execute([$_SESSION['uid'], $url, "[Unknown]", $cat_id, (string) $auth_login, (string) $auth_pass]); |
|
| 1188 | 1188 | |
| 1189 | 1189 | $sth = $pdo->prepare("SELECT id FROM ttrss_feeds WHERE feed_url = ? |
| 1190 | 1190 | AND owner_uid = ?"); |
@@ -1203,11 +1203,11 @@ discard block |
||
| 1203 | 1203 | } |
| 1204 | 1204 | |
| 1205 | 1205 | static function getIconFile($feed_id) { |
| 1206 | - return ICONS_DIR . "/$feed_id.ico"; |
|
| 1206 | + return ICONS_DIR."/$feed_id.ico"; |
|
| 1207 | 1207 | } |
| 1208 | 1208 | |
| 1209 | 1209 | static function feedHasIcon($id) { |
| 1210 | - return is_file(ICONS_DIR . "/$id.ico") && filesize(ICONS_DIR . "/$id.ico") > 0; |
|
| 1210 | + return is_file(ICONS_DIR."/$id.ico") && filesize(ICONS_DIR."/$id.ico") > 0; |
|
| 1211 | 1211 | } |
| 1212 | 1212 | |
| 1213 | 1213 | static function getFeedIcon($id) { |
@@ -1231,7 +1231,7 @@ discard block |
||
| 1231 | 1231 | $icon = self::getIconFile($id); |
| 1232 | 1232 | |
| 1233 | 1233 | if ($icon && file_exists($icon)) { |
| 1234 | - return ICONS_URL . "/" . basename($icon) . "?" . filemtime($icon); |
|
| 1234 | + return ICONS_URL."/".basename($icon)."?".filemtime($icon); |
|
| 1235 | 1235 | } |
| 1236 | 1236 | } |
| 1237 | 1237 | } |
@@ -1303,7 +1303,7 @@ discard block |
||
| 1303 | 1303 | |
| 1304 | 1304 | $cat_feeds = array(); |
| 1305 | 1305 | while ($line = $sth->fetch()) { |
| 1306 | - array_push($cat_feeds, "feed_id = " . (int)$line["id"]); |
|
| 1306 | + array_push($cat_feeds, "feed_id = ".(int) $line["id"]); |
|
| 1307 | 1307 | } |
| 1308 | 1308 | |
| 1309 | 1309 | if (count($cat_feeds) == 0) return 0; |
@@ -1517,7 +1517,7 @@ discard block |
||
| 1517 | 1517 | } |
| 1518 | 1518 | |
| 1519 | 1519 | if ($limit > 0) { |
| 1520 | - $limit_query_part = "LIMIT " . (int)$limit; |
|
| 1520 | + $limit_query_part = "LIMIT ".(int) $limit; |
|
| 1521 | 1521 | } |
| 1522 | 1522 | |
| 1523 | 1523 | $allow_archived = false; |
@@ -1544,7 +1544,7 @@ discard block |
||
| 1544 | 1544 | implode(",", $subcats).")"; |
| 1545 | 1545 | |
| 1546 | 1546 | } else { |
| 1547 | - $query_strategy_part = "cat_id = " . $pdo->quote($feed); |
|
| 1547 | + $query_strategy_part = "cat_id = ".$pdo->quote($feed); |
|
| 1548 | 1548 | } |
| 1549 | 1549 | |
| 1550 | 1550 | } else { |
@@ -1554,7 +1554,7 @@ discard block |
||
| 1554 | 1554 | $vfeed_query_part = "ttrss_feeds.title AS feed_title,"; |
| 1555 | 1555 | |
| 1556 | 1556 | } else { |
| 1557 | - $query_strategy_part = "feed_id = " . $pdo->quote($feed); |
|
| 1557 | + $query_strategy_part = "feed_id = ".$pdo->quote($feed); |
|
| 1558 | 1558 | } |
| 1559 | 1559 | } else if ($feed == 0 && !$cat_view) { // archive virtual feed |
| 1560 | 1560 | $query_strategy_part = "feed_id IS NULL"; |
@@ -1676,7 +1676,7 @@ discard block |
||
| 1676 | 1676 | $content_query_part = "content, "; |
| 1677 | 1677 | |
| 1678 | 1678 | if ($limit_query_part) { |
| 1679 | - $offset_query_part = "OFFSET " . (int)$offset; |
|
| 1679 | + $offset_query_part = "OFFSET ".(int) $offset; |
|
| 1680 | 1680 | } else { |
| 1681 | 1681 | $offset_query_part = ""; |
| 1682 | 1682 | } |
@@ -1765,7 +1765,7 @@ discard block |
||
| 1765 | 1765 | $res = $pdo->query($query); |
| 1766 | 1766 | |
| 1767 | 1767 | if ($row = $res->fetch()) { |
| 1768 | - $first_id = (int)$row["id"]; |
|
| 1768 | + $first_id = (int) $row["id"]; |
|
| 1769 | 1769 | |
| 1770 | 1770 | if ($offset > 0 && $first_id && $check_first_id && $first_id != $check_first_id) { |
| 1771 | 1771 | return array(-1, $feed_title, $feed_site_url, $last_error, $last_updated, $search_words, $first_id, $vfeed_query_part != "", $query_error_override); |
@@ -1912,9 +1912,9 @@ discard block |
||
| 1912 | 1912 | } |
| 1913 | 1913 | |
| 1914 | 1914 | function color_of($name) { |
| 1915 | - $colormap = [ "#1cd7d7","#d91111","#1212d7","#8e16e5","#7b7b7b", |
|
| 1916 | - "#39f110","#0bbea6","#ec0e0e","#1534f2","#b9e416", |
|
| 1917 | - "#479af2","#f36b14","#10c7e9","#1e8fe7","#e22727" ]; |
|
| 1915 | + $colormap = ["#1cd7d7", "#d91111", "#1212d7", "#8e16e5", "#7b7b7b", |
|
| 1916 | + "#39f110", "#0bbea6", "#ec0e0e", "#1534f2", "#b9e416", |
|
| 1917 | + "#479af2", "#f36b14", "#10c7e9", "#1e8fe7", "#e22727"]; |
|
| 1918 | 1918 | |
| 1919 | 1919 | $sum = 0; |
| 1920 | 1920 | |
@@ -1978,13 +1978,13 @@ discard block |
||
| 1978 | 1978 | |
| 1979 | 1979 | // support schema-less urls |
| 1980 | 1980 | if (strpos($url, '//') === 0) { |
| 1981 | - $url = 'https:' . $url; |
|
| 1981 | + $url = 'https:'.$url; |
|
| 1982 | 1982 | } |
| 1983 | 1983 | |
| 1984 | 1984 | if (strpos($url, '://') === false) { |
| 1985 | - $url = 'http://' . $url; |
|
| 1985 | + $url = 'http://'.$url; |
|
| 1986 | 1986 | } else if (substr($url, 0, 5) == 'feed:') { |
| 1987 | - $url = 'http:' . substr($url, 5); |
|
| 1987 | + $url = 'http:'.substr($url, 5); |
|
| 1988 | 1988 | } |
| 1989 | 1989 | |
| 1990 | 1990 | //prepend slash if the URL has no slash in it |
@@ -2034,7 +2034,7 @@ discard block |
||
| 2034 | 2034 | |
| 2035 | 2035 | $sth = $pdo->prepare("INSERT INTO ttrss_feed_categories (owner_uid,title,parent_cat,order_id) |
| 2036 | 2036 | VALUES (?, ?, ?, ?)"); |
| 2037 | - $sth->execute([$_SESSION['uid'], $feed_cat, $parent_cat_id, (int)$order_id]); |
|
| 2037 | + $sth->execute([$_SESSION['uid'], $feed_cat, $parent_cat_id, (int) $order_id]); |
|
| 2038 | 2038 | |
| 2039 | 2039 | if (!$tr_in_progress) $pdo->commit(); |
| 2040 | 2040 | |
@@ -2134,7 +2134,7 @@ discard block |
||
| 2134 | 2134 | $sth->execute([$feed_id]); |
| 2135 | 2135 | |
| 2136 | 2136 | } else { |
| 2137 | - $sth = $pdo->prepare("DELETE FROM ttrss_user_entries |
|
| 2137 | + $sth = $pdo->prepare("DELETE FROM ttrss_user_entries |
|
| 2138 | 2138 | USING ttrss_user_entries, ttrss_entries |
| 2139 | 2139 | WHERE ttrss_entries.id = ref_id AND |
| 2140 | 2140 | marked = false AND |
@@ -2204,7 +2204,7 @@ discard block |
||
| 2204 | 2204 | case "title": |
| 2205 | 2205 | if ($commandpair[1]) { |
| 2206 | 2206 | array_push($query_keywords, "($not (LOWER(ttrss_entries.title) LIKE ". |
| 2207 | - $pdo->quote('%' . mb_strtolower($commandpair[1]) . '%') ."))"); |
|
| 2207 | + $pdo->quote('%'.mb_strtolower($commandpair[1]).'%')."))"); |
|
| 2208 | 2208 | } else { |
| 2209 | 2209 | array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') |
| 2210 | 2210 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
@@ -2214,7 +2214,7 @@ discard block |
||
| 2214 | 2214 | case "author": |
| 2215 | 2215 | if ($commandpair[1]) { |
| 2216 | 2216 | array_push($query_keywords, "($not (LOWER(author) LIKE ". |
| 2217 | - $pdo->quote('%' . mb_strtolower($commandpair[1]) . '%')."))"); |
|
| 2217 | + $pdo->quote('%'.mb_strtolower($commandpair[1]).'%')."))"); |
|
| 2218 | 2218 | } else { |
| 2219 | 2219 | array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') |
| 2220 | 2220 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
@@ -2229,7 +2229,7 @@ discard block |
||
| 2229 | 2229 | array_push($query_keywords, "($not (note IS NULL OR note = ''))"); |
| 2230 | 2230 | else |
| 2231 | 2231 | array_push($query_keywords, "($not (LOWER(note) LIKE ". |
| 2232 | - $pdo->quote('%' . mb_strtolower($commandpair[1]) . '%')."))"); |
|
| 2232 | + $pdo->quote('%'.mb_strtolower($commandpair[1]).'%')."))"); |
|
| 2233 | 2233 | } else { |
| 2234 | 2234 | array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
| 2235 | 2235 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
@@ -2306,7 +2306,7 @@ discard block |
||
| 2306 | 2306 | |
| 2307 | 2307 | // if there's no joiners consider this a "simple" search and |
| 2308 | 2308 | // concatenate everything with &, otherwise don't try to mess with tsquery syntax |
| 2309 | - if (preg_match("/[&|]/", implode(" " , $search_query_leftover))) { |
|
| 2309 | + if (preg_match("/[&|]/", implode(" ", $search_query_leftover))) { |
|
| 2310 | 2310 | $tsquery = $pdo->quote(implode(" ", $search_query_leftover)); |
| 2311 | 2311 | } else { |
| 2312 | 2312 | $tsquery = $pdo->quote(implode(" & ", $search_query_leftover)); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | static function create_published_article($title, $url, $content, $labels_str, |
| 94 | 94 | $owner_uid) { |
| 95 | 95 | |
| 96 | - $guid = 'SHA1:' . sha1("ttshared:" . $url . $owner_uid); // include owner_uid to prevent global GUID clash |
|
| 96 | + $guid = 'SHA1:'.sha1("ttshared:".$url.$owner_uid); // include owner_uid to prevent global GUID clash |
|
| 97 | 97 | |
| 98 | 98 | if (!$content) { |
| 99 | 99 | $pluginhost = new PluginHost(); |
@@ -148,12 +148,12 @@ discard block |
||
| 148 | 148 | content = ?, content_hash = ? WHERE id = ?"); |
| 149 | 149 | $sth->execute([$content, $content_hash, $ref_id]); |
| 150 | 150 | |
| 151 | - if (DB_TYPE == "pgsql"){ |
|
| 151 | + if (DB_TYPE == "pgsql") { |
|
| 152 | 152 | $sth = $pdo->prepare("UPDATE ttrss_entries |
| 153 | 153 | SET tsvector_combined = to_tsvector( :ts_content) |
| 154 | 154 | WHERE id = :id"); |
| 155 | 155 | $params = [ |
| 156 | - ":ts_content" => mb_substr(strip_tags($content ), 0, 900000), |
|
| 156 | + ":ts_content" => mb_substr(strip_tags($content), 0, 900000), |
|
| 157 | 157 | ":id" => $ref_id]; |
| 158 | 158 | $sth->execute($params); |
| 159 | 159 | } |
@@ -193,12 +193,12 @@ discard block |
||
| 193 | 193 | |
| 194 | 194 | if ($row = $sth->fetch()) { |
| 195 | 195 | $ref_id = $row["id"]; |
| 196 | - if (DB_TYPE == "pgsql"){ |
|
| 196 | + if (DB_TYPE == "pgsql") { |
|
| 197 | 197 | $sth = $pdo->prepare("UPDATE ttrss_entries |
| 198 | 198 | SET tsvector_combined = to_tsvector( :ts_content) |
| 199 | 199 | WHERE id = :id"); |
| 200 | 200 | $params = [ |
| 201 | - ":ts_content" => mb_substr(strip_tags($content ), 0, 900000), |
|
| 201 | + ":ts_content" => mb_substr(strip_tags($content), 0, 900000), |
|
| 202 | 202 | ":id" => $ref_id]; |
| 203 | 203 | $sth->execute($params); |
| 204 | 204 | } |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | print_hidden("op", "article"); |
| 237 | 237 | print_hidden("method", "setArticleTags"); |
| 238 | 238 | |
| 239 | - print "<header class='horizontal'>" . __("Tags for this article (separated by commas):")."</header>"; |
|
| 239 | + print "<header class='horizontal'>".__("Tags for this article (separated by commas):")."</header>"; |
|
| 240 | 240 | |
| 241 | 241 | print "<section>"; |
| 242 | 242 | print "<textarea dojoType='dijit.form.SimpleTextarea' rows='4' |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | |
| 258 | 258 | function setScore() { |
| 259 | 259 | $ids = explode(",", clean($_REQUEST['id'])); |
| 260 | - $score = (int)clean($_REQUEST['score']); |
|
| 260 | + $score = (int) clean($_REQUEST['score']); |
|
| 261 | 261 | |
| 262 | 262 | $ids_qmarks = arr_qmarks($ids); |
| 263 | 263 | |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | |
| 267 | 267 | $sth->execute(array_merge([$score], $ids, [$_SESSION['uid']])); |
| 268 | 268 | |
| 269 | - print json_encode(["id" => $ids, "score" => (int)$score]); |
|
| 269 | + print json_encode(["id" => $ids, "score" => (int) $score]); |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | function getScore() { |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | |
| 279 | 279 | $score = $row['score']; |
| 280 | 280 | |
| 281 | - print json_encode(["id" => $id, "score" => (int)$score]); |
|
| 281 | + print json_encode(["id" => $id, "score" => (int) $score]); |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | |
| 357 | 357 | print "<ul>"; |
| 358 | 358 | while ($line = $sth->fetch()) { |
| 359 | - print "<li>" . $line["tag_name"] . "</li>"; |
|
| 359 | + print "<li>".$line["tag_name"]."</li>"; |
|
| 360 | 360 | } |
| 361 | 361 | print "</ul>"; |
| 362 | 362 | } |
@@ -495,21 +495,21 @@ discard block |
||
| 495 | 495 | if (!$hide_images) { |
| 496 | 496 | $encsize = ''; |
| 497 | 497 | if ($entry['height'] > 0) |
| 498 | - $encsize .= ' height="' . intval($entry['height']) . '"'; |
|
| 498 | + $encsize .= ' height="'.intval($entry['height']).'"'; |
|
| 499 | 499 | if ($entry['width'] > 0) |
| 500 | - $encsize .= ' width="' . intval($entry['width']) . '"'; |
|
| 500 | + $encsize .= ' width="'.intval($entry['width']).'"'; |
|
| 501 | 501 | $rv .= "<p><img |
| 502 | 502 | alt=\"".htmlspecialchars($entry["filename"])."\" |
| 503 | - src=\"" .htmlspecialchars($entry["url"]) . "\" |
|
| 504 | - " . $encsize . " /></p>"; |
|
| 503 | + src=\"" .htmlspecialchars($entry["url"])."\" |
|
| 504 | + " . $encsize." /></p>"; |
|
| 505 | 505 | } else { |
| 506 | 506 | $rv .= "<p><a target=\"_blank\" rel=\"noopener noreferrer\" |
| 507 | 507 | href=\"".htmlspecialchars($entry["url"])."\" |
| 508 | - >" .htmlspecialchars($entry["url"]) . "</a></p>"; |
|
| 508 | + >" .htmlspecialchars($entry["url"])."</a></p>"; |
|
| 509 | 509 | } |
| 510 | 510 | |
| 511 | 511 | if ($entry['title']) { |
| 512 | - $rv.= "<div class=\"enclosure_title\">${entry['title']}</div>"; |
|
| 512 | + $rv .= "<div class=\"enclosure_title\">${entry['title']}</div>"; |
|
| 513 | 513 | } |
| 514 | 514 | } |
| 515 | 515 | } |
@@ -524,13 +524,13 @@ discard block |
||
| 524 | 524 | } |
| 525 | 525 | |
| 526 | 526 | $rv .= "<div class=\"attachments\" dojoType=\"fox.form.DropDownButton\">". |
| 527 | - "<span>" . __('Attachments')."</span>"; |
|
| 527 | + "<span>".__('Attachments')."</span>"; |
|
| 528 | 528 | |
| 529 | 529 | $rv .= "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; |
| 530 | 530 | |
| 531 | 531 | foreach ($entries as $entry) { |
| 532 | 532 | if ($entry["title"]) |
| 533 | - $title = " — " . truncate_string($entry["title"], 30); |
|
| 533 | + $title = " — ".truncate_string($entry["title"], 30); |
|
| 534 | 534 | else |
| 535 | 535 | $title = ""; |
| 536 | 536 | |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | $filename = ""; |
| 541 | 541 | |
| 542 | 542 | $rv .= "<div onclick='popupOpenUrl(\"".htmlspecialchars($entry["url"])."\")' |
| 543 | - dojoType=\"dijit.MenuItem\">".$filename . $title."</div>"; |
|
| 543 | + dojoType=\"dijit.MenuItem\">".$filename.$title."</div>"; |
|
| 544 | 544 | |
| 545 | 545 | }; |
| 546 | 546 | |
@@ -609,10 +609,10 @@ discard block |
||
| 609 | 609 | $tags_str = ""; |
| 610 | 610 | |
| 611 | 611 | for ($i = 0; $i < $maxtags; $i++) { |
| 612 | - $tags_str .= "<a class=\"tag\" href=\"#\" onclick=\"Feeds.open({feed:'".$tags[$i]."'})\">" . $tags[$i] . "</a>, "; |
|
| 612 | + $tags_str .= "<a class=\"tag\" href=\"#\" onclick=\"Feeds.open({feed:'".$tags[$i]."'})\">".$tags[$i]."</a>, "; |
|
| 613 | 613 | } |
| 614 | 614 | |
| 615 | - $tags_str = mb_substr($tags_str, 0, mb_strlen($tags_str)-2); |
|
| 615 | + $tags_str = mb_substr($tags_str, 0, mb_strlen($tags_str) - 2); |
|
| 616 | 616 | |
| 617 | 617 | if (count($tags) > $maxtags) |
| 618 | 618 | $tags_str .= ", …"; |
@@ -804,7 +804,7 @@ discard block |
||
| 804 | 804 | if (!$article_image && !$article_stream) { |
| 805 | 805 | $tmpdoc = new DOMDocument(); |
| 806 | 806 | |
| 807 | - if (@$tmpdoc->loadHTML('<?xml encoding="UTF-8">' . mb_substr($content, 0, 131070))) { |
|
| 807 | + if (@$tmpdoc->loadHTML('<?xml encoding="UTF-8">'.mb_substr($content, 0, 131070))) { |
|
| 808 | 808 | $tmpxpath = new DOMXPath($tmpdoc); |
| 809 | 809 | $elems = $tmpxpath->query('(//img[@src]|//video[@poster]|//iframe[contains(@src , "youtube.com/embed/")])'); |
| 810 | 810 | |
@@ -812,8 +812,8 @@ discard block |
||
| 812 | 812 | if ($e->nodeName == "iframe") { |
| 813 | 813 | $matches = []; |
| 814 | 814 | if (preg_match("/\/embed\/([\w-]+)/", $e->getAttribute("src"), $matches)) { |
| 815 | - $article_image = "https://img.youtube.com/vi/" . $matches[1] . "/hqdefault.jpg"; |
|
| 816 | - $article_stream = "https://youtu.be/" . $matches[1]; |
|
| 815 | + $article_image = "https://img.youtube.com/vi/".$matches[1]."/hqdefault.jpg"; |
|
| 816 | + $article_stream = "https://youtu.be/".$matches[1]; |
|
| 817 | 817 | break; |
| 818 | 818 | } |
| 819 | 819 | } else if ($e->nodeName == "video") { |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | function hook_house_keeping() { |
| 36 | 36 | /* since HOOK_UPDATE_TASK is not available to user plugins, this hook is a next best thing */ |
| 37 | 37 | |
| 38 | - Debug::log("caching media of starred articles for user " . $this->host->get_owner_uid() . "..."); |
|
| 38 | + Debug::log("caching media of starred articles for user ".$this->host->get_owner_uid()."..."); |
|
| 39 | 39 | |
| 40 | 40 | $sth = $this->pdo->prepare("SELECT content, ttrss_entries.title, |
| 41 | 41 | ttrss_user_entries.owner_uid, link, site_url, ttrss_entries.id, plugin_data |
@@ -53,13 +53,13 @@ discard block |
||
| 53 | 53 | $usth = $this->pdo->prepare("UPDATE ttrss_entries SET plugin_data = ? WHERE id = ?"); |
| 54 | 54 | |
| 55 | 55 | while ($line = $sth->fetch()) { |
| 56 | - Debug::log("processing article " . $line["title"], Debug::$LOG_VERBOSE); |
|
| 56 | + Debug::log("processing article ".$line["title"], Debug::$LOG_VERBOSE); |
|
| 57 | 57 | |
| 58 | 58 | if ($line["site_url"]) { |
| 59 | 59 | $success = $this->cache_article_images($line["content"], $line["site_url"], $line["owner_uid"], $line["id"]); |
| 60 | 60 | |
| 61 | 61 | if ($success) { |
| 62 | - $plugin_data = "starred_cache_images,${line['owner_uid']}:" . $line["plugin_data"]; |
|
| 62 | + $plugin_data = "starred_cache_images,${line['owner_uid']}:".$line["plugin_data"]; |
|
| 63 | 63 | |
| 64 | 64 | $usth->execute([$plugin_data, $line['id']]); |
| 65 | 65 | } |
@@ -69,9 +69,9 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | /* actual housekeeping */ |
| 71 | 71 | |
| 72 | - Debug::log("expiring " . $this->cache->getDir() . "..."); |
|
| 72 | + Debug::log("expiring ".$this->cache->getDir()."..."); |
|
| 73 | 73 | |
| 74 | - $files = glob($this->cache->getDir() . "/*.{png,mp4,status}", GLOB_BRACE); |
|
| 74 | + $files = glob($this->cache->getDir()."/*.{png,mp4,status}", GLOB_BRACE); |
|
| 75 | 75 | |
| 76 | 76 | $last_article_id = 0; |
| 77 | 77 | $article_exists = 1; |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | function hook_enclosure_entry($enc, $article_id) { |
| 98 | - $local_filename = $article_id . "-" . sha1($enc["content_url"]); |
|
| 98 | + $local_filename = $article_id."-".sha1($enc["content_url"]); |
|
| 99 | 99 | |
| 100 | 100 | if ($this->cache->exists($local_filename)) { |
| 101 | 101 | $enc["content_url"] = $this->cache->getUrl($local_filename); |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | if ($entry->hasAttribute('src')) { |
| 115 | 115 | $src = rewrite_relative_url($site_url, $entry->getAttribute('src')); |
| 116 | 116 | |
| 117 | - $local_filename = $article_id . "-" . sha1($src); |
|
| 117 | + $local_filename = $article_id."-".sha1($src); |
|
| 118 | 118 | |
| 119 | 119 | if ($this->cache->exists($local_filename)) { |
| 120 | 120 | $entry->setAttribute("src", $this->cache->getUrl($local_filename)); |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | private function cache_url($article_id, $url) { |
| 131 | - $local_filename = $article_id . "-" . sha1($url); |
|
| 131 | + $local_filename = $article_id."-".sha1($url); |
|
| 132 | 132 | |
| 133 | 133 | if (!$this->cache->exists($local_filename)) { |
| 134 | 134 | Debug::log("cache_images: downloading: $url to $local_filename", Debug::$LOG_VERBOSE); |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | $data = fetch_file_contents(["url" => $url, "max_size" => MAX_CACHE_FILE_SIZE]); |
| 137 | 137 | |
| 138 | 138 | if ($data) |
| 139 | - return $this->cache->put($local_filename, $data);; |
|
| 139 | + return $this->cache->put($local_filename, $data); ; |
|
| 140 | 140 | |
| 141 | 141 | } else { |
| 142 | 142 | //Debug::log("cache_images: local file exists for $url", Debug::$LOG_VERBOSE); |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | private function cache_article_images($content, $site_url, $owner_uid, $article_id) { |
| 151 | - $status_filename = $article_id . "-" . sha1($site_url) . ".status"; |
|
| 151 | + $status_filename = $article_id."-".sha1($site_url).".status"; |
|
| 152 | 152 | |
| 153 | 153 | /* housekeeping might run as a separate user, in this case status/media might not be writable */ |
| 154 | 154 | if (!$this->cache->isWritable($status_filename)) { |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | $has_images = false; |
| 182 | 182 | $success = false; |
| 183 | 183 | |
| 184 | - if ($doc->loadHTML('<?xml encoding="UTF-8">' . $content)) { |
|
| 184 | + if ($doc->loadHTML('<?xml encoding="UTF-8">'.$content)) { |
|
| 185 | 185 | $xpath = new DOMXPath($doc); |
| 186 | 186 | $entries = $xpath->query('(//img[@src])|(//video/source[@src])'); |
| 187 | 187 | |
@@ -79,11 +79,11 @@ discard block |
||
| 79 | 79 | return true; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - function ttrss_open () { |
|
| 82 | + function ttrss_open() { |
|
| 83 | 83 | return true; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - function ttrss_read ($id){ |
|
| 86 | + function ttrss_read($id) { |
|
| 87 | 87 | global $session_expire; |
| 88 | 88 | |
| 89 | 89 | $sth = Db::pdo()->prepare("SELECT data FROM ttrss_sessions WHERE id=?"); |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - function ttrss_write ($id, $data) { |
|
| 107 | + function ttrss_write($id, $data) { |
|
| 108 | 108 | global $session_expire; |
| 109 | 109 | |
| 110 | 110 | $data = base64_encode($data); |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | return true; |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - function ttrss_close () { |
|
| 128 | + function ttrss_close() { |
|
| 129 | 129 | return true; |
| 130 | 130 | } |
| 131 | 131 | |
@@ -136,8 +136,8 @@ discard block |
||
| 136 | 136 | return true; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - function ttrss_gc () { |
|
| 140 | - Db::pdo()->query("DELETE FROM ttrss_sessions WHERE expire < " . time()); |
|
| 139 | + function ttrss_gc() { |
|
| 140 | + Db::pdo()->query("DELETE FROM ttrss_sessions WHERE expire < ".time()); |
|
| 141 | 141 | |
| 142 | 142 | return true; |
| 143 | 143 | } |