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,
|
$result = db_query($link, "SELECT title,link,content,feed_id,comments,int_id,
|
||||||
SUBSTRING(updated,1,16) as updated,
|
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
|
FROM ttrss_entries,ttrss_user_entries
|
||||||
WHERE id = '$id' AND ref_id = id");
|
WHERE id = '$id' AND ref_id = id");
|
||||||
|
|
||||||
|
@ -669,10 +670,26 @@
|
||||||
$feed_icon = " ";
|
$feed_icon = " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($line["comments"] && $line["link"] != $line["comments"]) {
|
/* if ($line["comments"] && $line["link"] != $line["comments"]) {
|
||||||
$entry_comments = "(<a href=\"".$line["comments"]."\">Comments</a>)";
|
$entry_comments = "(<a href=\"".$line["comments"]."\">Comments</a>)";
|
||||||
} else {
|
} else {
|
||||||
$entry_comments = "";
|
$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\">";
|
print "<div class=\"postReply\">";
|
||||||
|
|
103
functions.php
103
functions.php
|
@ -324,6 +324,12 @@
|
||||||
$entry_link = db_escape_string($entry_link);
|
$entry_link = db_escape_string($entry_link);
|
||||||
$entry_comments = db_escape_string($entry_comments);
|
$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) {
|
if (db_num_rows($result) == 0) {
|
||||||
|
|
||||||
// base post entry does not exist, create it
|
// base post entry does not exist, create it
|
||||||
|
@ -338,7 +344,8 @@
|
||||||
content_hash,
|
content_hash,
|
||||||
no_orig_date,
|
no_orig_date,
|
||||||
date_entered,
|
date_entered,
|
||||||
comments)
|
comments,
|
||||||
|
num_comments)
|
||||||
VALUES
|
VALUES
|
||||||
('$entry_title',
|
('$entry_title',
|
||||||
'$entry_guid',
|
'$entry_guid',
|
||||||
|
@ -348,71 +355,72 @@
|
||||||
'$content_hash',
|
'$content_hash',
|
||||||
$no_orig_date,
|
$no_orig_date,
|
||||||
NOW(),
|
NOW(),
|
||||||
'$entry_comments')");
|
'$entry_comments',
|
||||||
|
'$num_comments')");
|
||||||
}
|
}
|
||||||
|
|
||||||
// now it should exist, if not - bad luck then
|
// now it should exist, if not - bad luck then
|
||||||
|
|
||||||
$result = db_query($link, "SELECT
|
$result = db_query($link, "SELECT
|
||||||
id,content_hash,no_orig_date,title,
|
id,content_hash,no_orig_date,title,
|
||||||
substring(updated,1,19) as updated
|
substring(updated,1,19) as updated,
|
||||||
|
num_comments
|
||||||
FROM
|
FROM
|
||||||
ttrss_entries
|
ttrss_entries
|
||||||
WHERE guid = '$entry_guid'");
|
WHERE guid = '$entry_guid'");
|
||||||
|
|
||||||
if (db_num_rows($result) == 1) {
|
if (db_num_rows($result) == 1) {
|
||||||
|
|
||||||
// this will be used below in update handler
|
// this will be used below in update handler
|
||||||
$orig_content_hash = db_fetch_result($result, 0, "content_hash");
|
$orig_content_hash = db_fetch_result($result, 0, "content_hash");
|
||||||
// $orig_timestamp = strtotime(db_fetch_result($result, 0, "updated"));
|
$orig_title = db_fetch_result($result, 0, "title");
|
||||||
// $orig_no_orig_date = db_fetch_result($result, 0, "no_orig_date");
|
$orig_num_comments = db_fetch_result($result, 0, "num_comments");
|
||||||
$orig_title = db_fetch_result($result, 0, "title");
|
|
||||||
|
|
||||||
$ref_id = db_fetch_result($result, 0, "id");
|
$ref_id = db_fetch_result($result, 0, "id");
|
||||||
|
|
||||||
// check for user post link to main table
|
// check for user post link to main table
|
||||||
|
|
||||||
// do we allow duplicate posts with same GUID in different feeds?
|
// do we allow duplicate posts with same GUID in different feeds?
|
||||||
if (get_pref($link, "ALLOW_DUPLICATE_POSTS", $owner_uid)) {
|
if (get_pref($link, "ALLOW_DUPLICATE_POSTS", $owner_uid)) {
|
||||||
$dupcheck_qpart = "AND feed_id = '$feed'";
|
$dupcheck_qpart = "AND feed_id = '$feed'";
|
||||||
} else {
|
} else {
|
||||||
$dupcheck_qpart = "";
|
$dupcheck_qpart = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
// error_reporting(0);
|
// error_reporting(0);
|
||||||
|
|
||||||
$filter_name = get_filter_name($entry_title, $entry_content,
|
$filter_name = get_filter_name($entry_title, $entry_content,
|
||||||
$entry_link, $filters);
|
$entry_link, $filters);
|
||||||
|
|
||||||
if ($filter_name == "filter") {
|
if ($filter_name == "filter") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// error_reporting (DEFAULT_ERROR_LEVEL);
|
// error_reporting (DEFAULT_ERROR_LEVEL);
|
||||||
|
|
||||||
$result = db_query($link,
|
$result = db_query($link,
|
||||||
"SELECT ref_id FROM ttrss_user_entries WHERE
|
"SELECT ref_id FROM ttrss_user_entries WHERE
|
||||||
ref_id = '$ref_id' AND owner_uid = '$owner_uid'
|
ref_id = '$ref_id' AND owner_uid = '$owner_uid'
|
||||||
$dupcheck_qpart");
|
$dupcheck_qpart");
|
||||||
|
|
||||||
|
// okay it doesn't exist - create user entry
|
||||||
|
if (db_num_rows($result) == 0) {
|
||||||
|
|
||||||
// okay it doesn't exist - create user entry
|
if ($filter_name != 'catchup') {
|
||||||
if (db_num_rows($result) == 0) {
|
$unread = 'true';
|
||||||
|
$last_read_qpart = 'NULL';
|
||||||
if ($filter_name != 'catchup') {
|
} else {
|
||||||
$unread = 'true';
|
$unread = 'false';
|
||||||
$last_read_qpart = 'NULL';
|
$last_read_qpart = 'NOW()';
|
||||||
} else {
|
}
|
||||||
$unread = 'false';
|
|
||||||
$last_read_qpart = 'NOW()';
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = db_query($link,
|
$result = db_query($link,
|
||||||
"INSERT INTO ttrss_user_entries
|
"INSERT INTO ttrss_user_entries
|
||||||
(ref_id, owner_uid, feed_id, unread, last_read)
|
(ref_id, owner_uid, feed_id, unread, last_read)
|
||||||
VALUES ('$ref_id', '$owner_uid', '$feed', $unread,
|
VALUES ('$ref_id', '$owner_uid', '$feed', $unread,
|
||||||
$last_read_qpart)");
|
$last_read_qpart)");
|
||||||
}
|
}
|
||||||
|
|
||||||
$post_needs_update = false;
|
$post_needs_update = false;
|
||||||
|
|
||||||
if (get_pref($link, "UPDATE_POST_ON_CHECKSUM_CHANGE", $owner_uid) &&
|
if (get_pref($link, "UPDATE_POST_ON_CHECKSUM_CHANGE", $owner_uid) &&
|
||||||
|
@ -424,6 +432,10 @@
|
||||||
$post_needs_update = true;
|
$post_needs_update = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($orig_num_comments != $num_comments) {
|
||||||
|
$post_needs_update = true;
|
||||||
|
}
|
||||||
|
|
||||||
// this doesn't seem to be very reliable
|
// this doesn't seem to be very reliable
|
||||||
//
|
//
|
||||||
// if ($orig_timestamp != $entry_timestamp && !$orig_no_orig_date) {
|
// if ($orig_timestamp != $entry_timestamp && !$orig_no_orig_date) {
|
||||||
|
@ -437,7 +449,8 @@
|
||||||
// print "<!-- post $orig_title needs update : $post_needs_update -->";
|
// print "<!-- post $orig_title needs update : $post_needs_update -->";
|
||||||
|
|
||||||
db_query($link, "UPDATE ttrss_entries
|
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'");
|
WHERE id = '$ref_id'");
|
||||||
|
|
||||||
db_query($link, "UPDATE ttrss_user_entries
|
db_query($link, "UPDATE ttrss_user_entries
|
||||||
|
|
Loading…
Reference in New Issue