display slash:comments in view mode
This commit is contained in:
parent
eb40e11b14
commit
11b0dce2a7
21
backend.php
21
backend.php
|
@ -631,7 +631,8 @@
|
|||
|
||||
$result = db_query($link, "SELECT title,link,content,feed_id,comments,int_id,
|
||||
SUBSTRING(updated,1,16) as updated,
|
||||
(SELECT icon_url FROM ttrss_feeds WHERE id = feed_id) as icon_url
|
||||
(SELECT icon_url FROM ttrss_feeds WHERE id = feed_id) as icon_url,
|
||||
num_comments
|
||||
FROM ttrss_entries,ttrss_user_entries
|
||||
WHERE id = '$id' AND ref_id = id");
|
||||
|
||||
|
@ -669,10 +670,26 @@
|
|||
$feed_icon = " ";
|
||||
}
|
||||
|
||||
if ($line["comments"] && $line["link"] != $line["comments"]) {
|
||||
/* if ($line["comments"] && $line["link"] != $line["comments"]) {
|
||||
$entry_comments = "(<a href=\"".$line["comments"]."\">Comments</a>)";
|
||||
} else {
|
||||
$entry_comments = "";
|
||||
} */
|
||||
|
||||
$num_comments = $line["num_comments"];
|
||||
$entry_comments = "";
|
||||
|
||||
if ($num_comments > 0) {
|
||||
if ($line["comments"]) {
|
||||
$comments_url = $line["comments"];
|
||||
} else {
|
||||
$comments_url = $line["link"];
|
||||
}
|
||||
$entry_comments = "(<a href=\"$comments_url\">$num_comments comments</a>)";
|
||||
} else {
|
||||
if ($line["comments"] && $line["link"] != $line["comments"]) {
|
||||
$entry_comments = "(<a href=\"".$line["comments"]."\">Comments</a>)";
|
||||
}
|
||||
}
|
||||
|
||||
print "<div class=\"postReply\">";
|
||||
|
|
|
@ -324,6 +324,12 @@
|
|||
$entry_link = db_escape_string($entry_link);
|
||||
$entry_comments = db_escape_string($entry_comments);
|
||||
|
||||
$num_comments = 0;
|
||||
|
||||
if ($item["slash"]) {
|
||||
$num_comments = db_escape_string($item["slash"]["comments"]);
|
||||
}
|
||||
|
||||
if (db_num_rows($result) == 0) {
|
||||
|
||||
// base post entry does not exist, create it
|
||||
|
@ -338,7 +344,8 @@
|
|||
content_hash,
|
||||
no_orig_date,
|
||||
date_entered,
|
||||
comments)
|
||||
comments,
|
||||
num_comments)
|
||||
VALUES
|
||||
('$entry_title',
|
||||
'$entry_guid',
|
||||
|
@ -348,14 +355,16 @@
|
|||
'$content_hash',
|
||||
$no_orig_date,
|
||||
NOW(),
|
||||
'$entry_comments')");
|
||||
'$entry_comments',
|
||||
'$num_comments')");
|
||||
}
|
||||
|
||||
// now it should exist, if not - bad luck then
|
||||
|
||||
$result = db_query($link, "SELECT
|
||||
id,content_hash,no_orig_date,title,
|
||||
substring(updated,1,19) as updated
|
||||
substring(updated,1,19) as updated,
|
||||
num_comments
|
||||
FROM
|
||||
ttrss_entries
|
||||
WHERE guid = '$entry_guid'");
|
||||
|
@ -364,9 +373,8 @@
|
|||
|
||||
// this will be used below in update handler
|
||||
$orig_content_hash = db_fetch_result($result, 0, "content_hash");
|
||||
// $orig_timestamp = strtotime(db_fetch_result($result, 0, "updated"));
|
||||
// $orig_no_orig_date = db_fetch_result($result, 0, "no_orig_date");
|
||||
$orig_title = db_fetch_result($result, 0, "title");
|
||||
$orig_num_comments = db_fetch_result($result, 0, "num_comments");
|
||||
|
||||
$ref_id = db_fetch_result($result, 0, "id");
|
||||
|
||||
|
@ -424,6 +432,10 @@
|
|||
$post_needs_update = true;
|
||||
}
|
||||
|
||||
if ($orig_num_comments != $num_comments) {
|
||||
$post_needs_update = true;
|
||||
}
|
||||
|
||||
// this doesn't seem to be very reliable
|
||||
//
|
||||
// if ($orig_timestamp != $entry_timestamp && !$orig_no_orig_date) {
|
||||
|
@ -437,7 +449,8 @@
|
|||
// print "<!-- post $orig_title needs update : $post_needs_update -->";
|
||||
|
||||
db_query($link, "UPDATE ttrss_entries
|
||||
SET title = '$entry_title', content = '$entry_content'
|
||||
SET title = '$entry_title', content = '$entry_content',
|
||||
num_comments = '$num_comments'
|
||||
WHERE id = '$ref_id'");
|
||||
|
||||
db_query($link, "UPDATE ttrss_user_entries
|
||||
|
|
Loading…
Reference in New Issue