]> git.wh0rd.org - tt-rss.git/blobdiff - classes/feeds.php
move to simpler CDM handling of encoded content (instead of CENCW... etc)
[tt-rss.git] / classes / feeds.php
index 47a6b56b87973356161d5129ebeda4020efcbb41..0c1db62b6765b5c2f607e50be7c7fb35fda44085 100755 (executable)
@@ -173,7 +173,7 @@ class Feeds extends Handler_Protected {
                $method_split = explode(":", $method);
 
                if ($method == "ForceUpdate" && $feed > 0 && is_numeric($feed)) {
-            $sth = $this->pdo->prepare("UPDATE ttrss_feeds 
+            $sth = $this->pdo->prepare("UPDATE ttrss_feeds
                             SET last_updated = '1970-01-01', last_update_started = '1970-01-01'
                             WHERE id = ?");
             $sth->execute([$feed]);
@@ -477,6 +477,8 @@ class Feeds extends Handler_Protected {
                                                $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) {
 
@@ -497,8 +499,10 @@ class Feeds extends Handler_Protected {
 
                                        $expanded_class = $expand_cdm ? "expanded" : "expandable";
 
-                                       $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>";
+                    $content_encoded = htmlspecialchars(json_encode($line["content"]));
+
+                    $tmp_content = "<div class=\"cdm $hlc_suffix $expanded_class $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\">";
@@ -525,7 +529,7 @@ class Feeds extends Handler_Protected {
                                        $tmp_content .= "<span id=\"RTITLE-$id\"
                     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=\"".
@@ -614,14 +618,7 @@ class Feeds extends Handler_Protected {
                                                }
                                        }
 
-                                       $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"];
@@ -630,7 +627,7 @@ class Feeds extends Handler_Protected {
 
                                        $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);
@@ -1132,6 +1129,9 @@ class Feeds extends Handler_Protected {
        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"];
@@ -1469,7 +1469,7 @@ class Feeds extends Handler_Protected {
                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)";