|
|
@ -1111,117 +1111,6 @@ class Pref_Feeds extends Handler_Protected {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function clear() {
|
|
|
|
|
|
|
|
$id = $_REQUEST["id"];
|
|
|
|
|
|
|
|
$this->clear_feed_articles($id);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function rescore() {
|
|
|
|
|
|
|
|
$ids = explode(",", $_REQUEST["ids"]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($ids as $id) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$filters = load_filters($id, $_SESSION["uid"], 6);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$result = db_query("SELECT
|
|
|
|
|
|
|
|
title, content, link, ref_id, author,".
|
|
|
|
|
|
|
|
SUBSTRING_FOR_DATE."(updated, 1, 19) AS updated
|
|
|
|
|
|
|
|
FROM
|
|
|
|
|
|
|
|
ttrss_user_entries, ttrss_entries
|
|
|
|
|
|
|
|
WHERE ref_id = id AND feed_id = '$id' AND
|
|
|
|
|
|
|
|
owner_uid = " .$_SESSION['uid']."
|
|
|
|
|
|
|
|
");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scores = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while ($line = db_fetch_assoc($result)) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$tags = Article::get_article_tags($line["ref_id"]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$article_filters = RSSUtils::get_article_filters($filters, $line['title'],
|
|
|
|
|
|
|
|
$line['content'], $line['link'], strtotime($line['updated']),
|
|
|
|
|
|
|
|
$line['author'], $tags);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$new_score = RSSUtils::calculate_article_score($article_filters);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!$scores[$new_score]) $scores[$new_score] = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
array_push($scores[$new_score], $line['ref_id']);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (array_keys($scores) as $s) {
|
|
|
|
|
|
|
|
if ($s > 1000) {
|
|
|
|
|
|
|
|
db_query("UPDATE ttrss_user_entries SET score = '$s',
|
|
|
|
|
|
|
|
marked = true WHERE
|
|
|
|
|
|
|
|
ref_id IN (" . join(',', $scores[$s]) . ")");
|
|
|
|
|
|
|
|
} else if ($s < -500) {
|
|
|
|
|
|
|
|
db_query("UPDATE ttrss_user_entries SET score = '$s',
|
|
|
|
|
|
|
|
unread = false WHERE
|
|
|
|
|
|
|
|
ref_id IN (" . join(',', $scores[$s]) . ")");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
db_query("UPDATE ttrss_user_entries SET score = '$s' WHERE
|
|
|
|
|
|
|
|
ref_id IN (" . join(',', $scores[$s]) . ")");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print __("All done.");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function rescoreAll() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$result = db_query(
|
|
|
|
|
|
|
|
"SELECT id FROM ttrss_feeds WHERE owner_uid = " . $_SESSION['uid']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while ($feed_line = db_fetch_assoc($result)) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$id = $feed_line["id"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$filters = load_filters($id, $_SESSION["uid"], 6);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$tmp_result = db_query("SELECT
|
|
|
|
|
|
|
|
title, content, link, ref_id, author,".
|
|
|
|
|
|
|
|
SUBSTRING_FOR_DATE."(updated, 1, 19) AS updated
|
|
|
|
|
|
|
|
FROM
|
|
|
|
|
|
|
|
ttrss_user_entries, ttrss_entries
|
|
|
|
|
|
|
|
WHERE ref_id = id AND feed_id = '$id' AND
|
|
|
|
|
|
|
|
owner_uid = " .$_SESSION['uid']."
|
|
|
|
|
|
|
|
");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scores = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while ($line = db_fetch_assoc($tmp_result)) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$tags = Article::get_article_tags($line["ref_id"]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$article_filters = RSSUtils::get_article_filters($filters, $line['title'],
|
|
|
|
|
|
|
|
$line['content'], $line['link'], strtotime($line['updated']),
|
|
|
|
|
|
|
|
$line['author'], $tags);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$new_score = RSSUtils::calculate_article_score($article_filters);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!$scores[$new_score]) $scores[$new_score] = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
array_push($scores[$new_score], $line['ref_id']);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (array_keys($scores) as $s) {
|
|
|
|
|
|
|
|
if ($s > 1000) {
|
|
|
|
|
|
|
|
db_query("UPDATE ttrss_user_entries SET score = '$s',
|
|
|
|
|
|
|
|
marked = true WHERE
|
|
|
|
|
|
|
|
ref_id IN (" . join(',', $scores[$s]) . ")");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
db_query("UPDATE ttrss_user_entries SET score = '$s' WHERE
|
|
|
|
|
|
|
|
ref_id IN (" . join(',', $scores[$s]) . ")");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print __("All done.");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function categorize() {
|
|
|
|
function categorize() {
|
|
|
|
$ids = explode(",", $_REQUEST["ids"]);
|
|
|
|
$ids = explode(",", $_REQUEST["ids"]);
|
|
|
|
|
|
|
|
|
|
|
@ -1688,29 +1577,6 @@ class Pref_Feeds extends Handler_Protected {
|
|
|
|
print "</div>";
|
|
|
|
print "</div>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Purge a feed contents, marked articles excepted.
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param mixed $link The database connection.
|
|
|
|
|
|
|
|
* @param integer $id The id of the feed to purge.
|
|
|
|
|
|
|
|
* @return void
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
private function clear_feed_articles($id) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($id != 0) {
|
|
|
|
|
|
|
|
$result = db_query("DELETE FROM ttrss_user_entries
|
|
|
|
|
|
|
|
WHERE feed_id = '$id' AND marked = false AND owner_uid = " . $_SESSION["uid"]);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$result = db_query("DELETE FROM ttrss_user_entries
|
|
|
|
|
|
|
|
WHERE feed_id IS NULL AND marked = false AND owner_uid = " . $_SESSION["uid"]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$result = db_query("DELETE FROM ttrss_entries WHERE
|
|
|
|
|
|
|
|
(SELECT COUNT(int_id) FROM ttrss_user_entries WHERE ref_id = id) = 0");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CCache::update($id, $_SESSION['uid']);
|
|
|
|
|
|
|
|
} // function clear_feed_articles
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private function remove_feed_category($id, $owner_uid) {
|
|
|
|
private function remove_feed_category($id, $owner_uid) {
|
|
|
|
|
|
|
|
|
|
|
|
db_query("DELETE FROM ttrss_feed_categories
|
|
|
|
db_query("DELETE FROM ttrss_feed_categories
|
|
|
|