summaryrefslogtreecommitdiff
path: root/functions.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2008-04-30 08:20:33 +0100
committerAndrew Dolgov <[email protected]>2008-04-30 08:20:33 +0100
commitff6e357a62a050d0fddb844311717ea3ccfb40dd (patch)
tree625759b6e378a24a8ffc7d7c59dc5fc0d43f5b9b /functions.php
parentfdb7b03fc0e3fc1df83ee99257843e2dcfde223b (diff)
add some initial scoring work
Diffstat (limited to 'functions.php')
-rw-r--r--functions.php29
1 files changed, 26 insertions, 3 deletions
diff --git a/functions.php b/functions.php
index a93b36a67..bf0c55d3d 100644
--- a/functions.php
+++ b/functions.php
@@ -1161,6 +1161,12 @@
// error_reporting (DEFAULT_ERROR_LEVEL);
+ $score = calculate_article_score($article_filters);
+
+ if (defined('DAEMON_EXTENDED_DEBUG') || $_GET['xdebug']) {
+ _debug("update_rss_feed: initial score: $score");
+ }
+
$result = db_query($link,
"SELECT ref_id, int_id FROM ttrss_user_entries WHERE
ref_id = '$ref_id' AND owner_uid = '$owner_uid'
@@ -1195,9 +1201,10 @@
$result = db_query($link,
"INSERT INTO ttrss_user_entries
- (ref_id, owner_uid, feed_id, unread, last_read, marked, published)
+ (ref_id, owner_uid, feed_id, unread, last_read, marked,
+ published, score)
VALUES ('$ref_id', '$owner_uid', '$feed', $unread,
- $last_read_qpart, $marked, $published)");
+ $last_read_qpart, $marked, $published, '$score')");
$result = db_query($link,
"SELECT int_id FROM ttrss_user_entries WHERE
@@ -1510,6 +1517,18 @@
return false;
}
+ function calculate_article_score($filters) {
+ $score = 0;
+
+ foreach ($filters as $f) {
+ if ($f[0] == "score") {
+ $score += $f[1];
+ };
+ }
+ return $score;
+ }
+
+
function printFeedEntry($feed_id, $class, $feed_title, $unread, $icon_file, $link,
$rtl_content = false, $last_updated = false, $last_error = false) {
@@ -3289,7 +3308,7 @@
$vfeed_query_part
$content_query_part
".SUBSTRING_FOR_DATE."(updated,1,19) as updated_noms,
- author
+ author,score
FROM
ttrss_entries,ttrss_user_entries,ttrss_feeds
WHERE
@@ -4914,6 +4933,10 @@
100);
}
+ $score = $line["score"];
+
+ if ($score < 100) $score_pic = "score_low
+
$entry_author = $line["author"];
if ($entry_author) {