]> git.wh0rd.org - tt-rss.git/blobdiff - classes/feeds.php
remove expandable CDM headlines
[tt-rss.git] / classes / feeds.php
index 015418328729ccb3cc7849be80c99f399533e338..48e3337e02ebe4eb17fdcf8e3b372f9281e40735 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]);
@@ -277,7 +277,6 @@ class Feeds extends Handler_Protected {
         $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)) {
 
@@ -477,6 +476,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) {
 
@@ -495,10 +496,10 @@ class Feeds extends Handler_Protected {
                                                }
                                        }
 
-                                       $expanded_class = $expand_cdm ? "expanded" : "expandable";
+                    $content_encoded = htmlspecialchars(json_encode($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\">";
@@ -525,7 +526,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=\"".
@@ -539,13 +540,6 @@ class Feeds extends Handler_Protected {
                     <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) {
@@ -574,9 +568,7 @@ class Feeds extends Handler_Protected {
 
                                        $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);\" id=\"CICD-$id\">";
 
                                        $tmp_content .= "<div id=\"POSTNOTE-$id\">";
                                        if ($line['note']) {
@@ -586,6 +578,7 @@ class Feeds extends Handler_Protected {
 
                                        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"]) {
@@ -614,14 +607,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 +616,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 +1118,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"];
@@ -1466,6 +1455,10 @@ class Feeds extends Handler_Protected {
 
                $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)";
@@ -1474,10 +1467,6 @@ class Feeds extends Handler_Protected {
                        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);