$method_split = explode(":", $method);
if ($method == "ForceUpdate" && $feed > 0 && is_numeric($feed)) {
- // Update the feed if required with some basic flood control
-
- $any_needs_curl = false;
-
- if (ini_get("open_basedir")) {
- $pluginhost = PluginHost::getInstance();
- foreach ($pluginhost->get_plugins() as $plugin) {
- $flags = $plugin->flags();
-
- if (isset($flags["needs_curl"]) && $flags["needs_curl"]) {
- $any_needs_curl = true;
- break;
- }
- }
- }
-
- //if ($_REQUEST["debug"]) print "<!-- any_needs_curl: $any_needs_curl -->";
-
- if (!$any_needs_curl) {
-
- $sth = $this->pdo->prepare("SELECT cache_images," . SUBSTRING_FOR_DATE . "(last_updated,1,19) AS last_updated
- FROM ttrss_feeds WHERE id = ?");
- $sth->execute([$feed]);
-
- if ($row = $sth->fetch()) {
- $last_updated = strtotime($row["last_updated"]);
- $cache_images = $row["cache_images"];
-
- if (!$cache_images && time() - $last_updated > 120) {
- try {
- RSSUtils::update_rss_feed($feed, true);
- } catch (PDOException $e) {
- user_error("PDO Exception while doing on-demand feed update for $feed: " . $e->getMessage(), E_USER_NOTICE);
- }
- } else {
- $sth = $this->pdo->prepare("UPDATE ttrss_feeds
- SET last_updated = '1970-01-01', last_update_started = '1970-01-01'
- WHERE id = ?");
- $sth->execute([$feed]);
- }
- }
- } else {
- $sth = $this->pdo->prepare("UPDATE ttrss_feeds
- SET last_updated = '1970-01-01', last_update_started = '1970-01-01'
- WHERE id = ?");
- $sth->execute([$feed]);
- }
+ $sth = $this->pdo->prepare("UPDATE ttrss_feeds
+ SET last_updated = '1970-01-01', last_update_started = '1970-01-01'
+ WHERE id = ?");
+ $sth->execute([$feed]);
}
if ($method_split[0] == "MarkAllReadGR") {
$lnum = $offset;
$num_unread = 0;
if ($_REQUEST["debug"]) $timing_info = print_checkpoint("PS", $timing_info);
- $expand_cdm = get_pref('CDM_EXPANDED');
if (is_object($result)) {
$entry_author = " — $entry_author";
}
- $has_feed_icon = feeds::feedHasIcon($feed_id);
-
- if ($has_feed_icon) {
+ if (feeds::feedHasIcon($feed_id)) {
$feed_icon_img = "<img class=\"tinyFeedIcon\" src=\"".ICONS_URL."/$feed_id.ico\" alt=\"\">";
} else {
$feed_icon_img = "<img class=\"tinyFeedIcon\" src=\"images/pub_set.png\" alt=\"\">";
$vf_catchup_link = "<a class='catchup' onclick='catchupFeedInGroup($feed_id);' href='#'>".__('mark feed as read')."</a>";
- $reply['content'] .= "<div data-feed-id='$feed_id' id='FTITLE-$feed_id' class='cdmFeedTitle'>".
+ $reply['content'] .= "<div data-feed-id='$feed_id' class='cdmFeedTitle'>".
"<div style='float : right'>$feed_icon_img</div>".
"<a class='title' href=\"#\" onclick=\"viewfeed({feed:$feed_id})\">".
$line["feed_title"]."</a>
$reply['content'] .= "<div onclick='return hlClicked(event, $id)'
class=\"hlTitle\"><span class='hlContent $hlc_suffix'>";
- $reply['content'] .= "<a id=\"RTITLE-$id\" class=\"title $hlc_suffix\"
+ $reply['content'] .= "<a class=\"title $hlc_suffix\"
href=\"" . htmlspecialchars($line["link"]) . "\"
onclick=\"\">" .
truncate_string($line["title"], 200);
$line = $p->hook_render_article_cdm($line);
}
+ $line['content'] = rewrite_cached_urls($line['content']);
+
if ($vfeed_group_enabled && $line["feed_title"]) {
if ($feed_id != $vgroup_last_feed) {
$feed_icon_src = Feeds::getFeedIcon($feed_id);
$feed_icon_img = "<img class=\"tinyFeedIcon\" src=\"$feed_icon_src\">";
- $reply['content'] .= "<div data-feed-id='$feed_id' id='FTITLE-$feed_id' class='cdmFeedTitle'>".
+ $reply['content'] .= "<div data-feed-id='$feed_id' class='cdmFeedTitle'>".
"<div style=\"float : right\">$feed_icon_img</div>".
"<a href=\"#\" class='title' onclick=\"viewfeed({feed:$feed_id})\">".
$line["feed_title"]."</a> $vf_catchup_link</div>";
}
}
- $expanded_class = $expand_cdm ? "expanded" : "expandable";
+ $content_encoded = htmlspecialchars($line["content"]);
- $tmp_content = "<div class=\"cdm $hlc_suffix $expanded_class $class\"
- id=\"RROW-$id\" data-article-id='$id' data-orig-feed-id='$feed_id' $mouseover_attrs>";
+ $tmp_content = "<div class=\"cdm expanded $hlc_suffix $class\"
+ id=\"RROW-$id\" data-content=\"$content_encoded\" data-article-id='$id' data-orig-feed-id='$feed_id' $mouseover_attrs>";
$tmp_content .= "<div class=\"cdmHeader\">";
$tmp_content .= "<div style=\"vertical-align : middle\">";
if ($highlight_words && count($highlight_words) > 0) {
foreach ($highlight_words as $word) {
- $line["title"] = preg_replace("/(\Q$word\E)/i",
+ $word = preg_quote($word, "/");
+
+ $line["title"] = preg_replace("/($word)/i",
"<span class=\"highlight\">$1</span>", $line["title"]);
}
}
// data-article-id included for context menu
- $tmp_content .= "<span id=\"RTITLE-$id\"
+ $tmp_content .= "<span
onclick=\"return cdmClicked(event, $id);\"
data-article-id=\"$id\"
- class=\"titleWrap hlMenuAttach $hlc_suffix\">
+ class=\"titleWrap hlMenuAttach $hlc_suffix\">
<a class=\"title $hlc_suffix\"
title=\"".htmlspecialchars($line["title"])."\"
target=\"_blank\" rel=\"noopener noreferrer\" href=\"".
$tmp_content .= $labels_str;
- $tmp_content .= "<span class='collapseBtn' style='display : none'>
- <img src=\"images/collapse.png\" onclick=\"cdmCollapseArticle(event, $id)\"
- title=\"".__("Collapse article")."\"/></span>";
-
- if (!$expand_cdm)
- $content_hidden = "style=\"display : none\"";
- else
- $excerpt_hidden = "style=\"display : none\"";
-
- $tmp_content .= "<span $excerpt_hidden id=\"CEXC-$id\" class=\"cdmExcerpt\">" . $content_preview . "</span>";
-
$tmp_content .= "</span>";
if (!$vfeed_group_enabled) {
$tmp_content .= "</div>"; //cdmHeader
- $tmp_content .= "<div class=\"cdmContent\" $content_hidden
- onclick=\"return cdmClicked(event, $id, true);\"
- id=\"CICD-$id\">";
+ $tmp_content .= "<div class=\"cdmContent\" onclick=\"return cdmClicked(event, $id, true);\">";
$tmp_content .= "<div id=\"POSTNOTE-$id\">";
if ($line['note']) {
if (!$line['lang']) $line['lang'] = 'en';
+ // this is filled from RROW data-content
$tmp_content .= "<div class=\"cdmContentInner\" lang=\"".$line['lang']."\">";
if ($line["orig_feed_id"]) {
}
}
- $tmp_content .= "<span id=\"CWRAP-$id\">";
- $tmp_content .= "<span id=\"CENCW-$id\" class=\"cencw\" style=\"display : none\">";
- $tmp_content .= htmlspecialchars($line["content"]);
- $tmp_content .= "</span>";
- $tmp_content .= "</span>";
-
$tmp_content .= "</div>"; //cdmContentInner
-
$tmp_content .= "<div class=\"cdmIntermediate\">";
$always_display_enclosures = $line["always_display_enclosures"];
$tmp_content .= "</div>"; // cdmIntermediate
- $tmp_content .= "<div class=\"cdmFooter\" onclick=\"cdmFooterClick(event)\">";
+ $tmp_content .= "<div class=\"cdmFooter\" onclick=\"event.stopPropagation()\">";
foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ARTICLE_LEFT_BUTTON) as $p) {
$tmp_content .= $p->hook_article_left_button($line);
}
function quickAddFeed() {
+ print "<form onsubmit='return false'>";
+
print_hidden("op", "rpc");
print_hidden("method", "addfeed");
<label for=\"feedDlg_loginCheck\">".
__('This feed requires authentication.')."</div>";
- print "</form>";
-
print "<div class=\"dlgButtons\">
- <button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('feedAddDlg').execute()\">".__('Subscribe')."</button>";
+ <button dojoType=\"dijit.form.Button\" class=\"btn-primary\" type=\"submit\" onclick=\"return dijit.byId('feedAddDlg').execute()\">".__('Subscribe')."</button>";
if (!(defined('_DISABLE_FEED_BROWSER') && _DISABLE_FEED_BROWSER)) {
print "<button dojoType=\"dijit.form.Button\" onclick=\"return feedBrowser()\">".__('More feeds')."</button>";
print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('feedAddDlg').hide()\">".__('Cancel')."</button>
</div>";
+ print "</form>";
+
//return;
}
$active_feed_id = sprintf("%d", $this->params[0]);
$is_cat = $this->params[1] != "false";
+ print "<form onsubmit='return false;'>";
+
print "<div class=\"dlgSec\">".__('Look for')."</div>";
print "<div class=\"dlgSecCont\">";
</div>";
}
- print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('searchDlg').execute()\">".__('Search')."</button>
+ print "<button dojoType=\"dijit.form.Button\" type=\"submit\" class=\"btn-primary\" onclick=\"dijit.byId('searchDlg').execute()\">".__('Search')."</button>
<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('searchDlg').hide()\">".__('Cancel')."</button>
</div>";
+
+ print "</form>";
}
function update_debugger() {
header("Content-type: text/html");
+ Debug::set_enabled(true);
+ Debug::set_loglevel($_REQUEST["xdebug"]);
+
$feed_id = (int)$_REQUEST["feed_id"];
@$do_update = $_REQUEST["action"] == "do_update";
$csrf_token = $_REQUEST["csrf_token"];
if ($feed > 0) {
$children = Feeds::getChildCategories($feed, $owner_uid);
array_push($children, $feed);
+ $children = array_map("intval", $children);
$children = join(",", $children);
} else if ($n_feed >= 0) {
if ($n_feed != 0) {
- $match_part = "feed_id = '$n_feed'";
+ $match_part = "feed_id = " . (int)$n_feed;
} else {
$match_part = "feed_id IS NULL";
}
$contents = @fetch_file_contents($url, false, $auth_login, $auth_pass);
+ foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_SUBSCRIBE_FEED) as $plugin) {
+ $contents = $plugin->hook_subscribe_feed($contents, $url, $auth_login, $auth_pass);
+ }
+
if (!$contents) {
if (preg_match("/cloudflare\.com/", $fetch_last_error_content)) {
$fetch_last_error .= " (feed behind Cloudflare)";
return array("code" => 5, "message" => $fetch_last_error);
}
- foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_SUBSCRIBE_FEED) as $plugin) {
- $contents = $plugin->hook_subscribe_feed($contents, $url, $auth_login, $auth_pass);
- }
-
if (is_html($contents)) {
$feedUrls = get_feeds_from_html($url, $contents);
(owner_uid,feed_url,title,cat_id, auth_login,auth_pass,update_method,auth_pass_encrypted)
VALUES (?, ?, ?, ?, ?, ?, 0, false)");
- $sth->execute([$_SESSION['uid'], $url, "[Unknown]", $cat_id, $auth_login, $auth_pass]);
+ $sth->execute([$_SESSION['uid'], $url, "[Unknown]", $cat_id, (string)$auth_login, (string)$auth_pass]);
$sth = $pdo->prepare("SELECT id FROM ttrss_feeds WHERE feed_url = ?
AND owner_uid = ?");
$cat_feeds = array();
while ($line = $sth->fetch()) {
- array_push($cat_feeds, "feed_id = " . $line["id"]);
+ array_push($cat_feeds, "feed_id = " . (int)$line["id"]);
}
if (count($cat_feeds) == 0) return 0;
if ($include_children) {
# sub-cats
$subcats = Feeds::getChildCategories($feed, $owner_uid);
-
array_push($subcats, $feed);
+ $subcats = array_map("intval", $subcats);
+
$query_strategy_part = "cat_id IN (".
implode(",", $subcats).")";
$sanity_interval_qpart
$first_id_query_strategy_part ORDER BY $order_by LIMIT 1";
- if ($_REQUEST["debug"]) {
+ /*if ($_REQUEST["debug"]) {
print $query;
- }
+ }*/
$res = $pdo->query($query);
$query_strategy_part ORDER BY $order_by
$limit_query_part $offset_query_part";
- if ($_REQUEST["debug"]) print $query;
+ //if ($_REQUEST["debug"]) print $query;
$res = $pdo->query($query);