check filters on feed update, update NEWS, TODO and schema
This commit is contained in:
parent
ea6774cf1d
commit
e6155a0699
3
NEWS
3
NEWS
|
@ -1,7 +1,8 @@
|
||||||
v1.0.3 (Sep xx, 2005)
|
v1.0.3 (Sep xx, 2005)
|
||||||
|
|
||||||
- OPML export/import
|
- OPML export/import
|
||||||
- Support for simple content filtering (expression should be valid regexp)
|
- Support for simple content filtering (expression should be valid regexp,
|
||||||
|
checking is case insensitive)
|
||||||
- Reworked preferences dialog
|
- Reworked preferences dialog
|
||||||
|
|
||||||
v1.0.2 (Sep 02, 2005)
|
v1.0.2 (Sep 02, 2005)
|
||||||
|
|
13
TODO
13
TODO
|
@ -1,17 +1,8 @@
|
||||||
1.0
|
|
||||||
|
|
||||||
+ feed editor
|
|
||||||
+ feed icons
|
|
||||||
+ background feed updates
|
|
||||||
+ update detection based on content checksum
|
|
||||||
+ cleanup posts older then specified number of days
|
|
||||||
~ keyboard navigation
|
|
||||||
+ support for channel -> image -> url (like in LJ feeds)
|
|
||||||
|
|
||||||
1.1
|
1.1
|
||||||
|
|
||||||
- better error handling
|
- better error handling
|
||||||
- keyboard navigation
|
- better keyboard navigation
|
||||||
|
- filters (by content/title/feed?)
|
||||||
|
|
||||||
Mysterious Future
|
Mysterious Future
|
||||||
|
|
||||||
|
|
|
@ -111,6 +111,19 @@
|
||||||
pg_query("UPDATE ttrss_feeds SET icon_url = '$icon_url' WHERE id = '$feed'");
|
pg_query("UPDATE ttrss_feeds SET icon_url = '$icon_url' WHERE id = '$feed'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$filters = array();
|
||||||
|
|
||||||
|
$result = pg_query("SELECT regexp,
|
||||||
|
(SELECT name FROM ttrss_filter_types
|
||||||
|
WHERE id = filter_type) as name
|
||||||
|
FROM ttrss_filters");
|
||||||
|
|
||||||
|
while ($line = pg_fetch_assoc($result)) {
|
||||||
|
if (!$filters[$line["name"]]) $filters[$line["name"]] = array();
|
||||||
|
array_push($filters[$line["name"]], $line["regexp"]);
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($rss->items as $item) {
|
foreach ($rss->items as $item) {
|
||||||
|
|
||||||
$entry_guid = $item["id"];
|
$entry_guid = $item["id"];
|
||||||
|
@ -168,6 +181,12 @@
|
||||||
|
|
||||||
if (pg_num_rows($result) == 0) {
|
if (pg_num_rows($result) == 0) {
|
||||||
|
|
||||||
|
error_reporting(0);
|
||||||
|
if (is_filtered($entry_title, $entry_content, $filters)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
error_reporting (E_ERROR | E_WARNING | E_PARSE);
|
||||||
|
|
||||||
//$entry_guid = pg_escape_string($entry_guid);
|
//$entry_guid = pg_escape_string($entry_guid);
|
||||||
$entry_content = pg_escape_string($entry_content);
|
$entry_content = pg_escape_string($entry_content);
|
||||||
$entry_title = pg_escape_string($entry_title);
|
$entry_title = pg_escape_string($entry_title);
|
||||||
|
@ -290,4 +309,30 @@
|
||||||
print "</select>";
|
print "</select>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function is_filtered($title, $content, $filters) {
|
||||||
|
|
||||||
|
if ($filters["title"]) {
|
||||||
|
foreach ($filters["title"] as $title_filter) {
|
||||||
|
if (preg_match("/$title_filter/i", $title))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($filters["content"]) {
|
||||||
|
foreach ($filters["content"] as $content_filter) {
|
||||||
|
if (preg_match("/$content_filter/i", $content))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($filters["both"]) {
|
||||||
|
foreach ($filters["both"] as $filter) {
|
||||||
|
if (preg_match("/$filter/i", $title) || preg_match("/$filter/i", $content))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -59,7 +59,3 @@ create table ttrss_filters (id serial primary key,
|
||||||
regexp varchar(250) not null,
|
regexp varchar(250) not null,
|
||||||
description varchar(250) not null default '');
|
description varchar(250) not null default '');
|
||||||
|
|
||||||
COPY ttrss_filters (id, filter_type, regexp, description) FROM stdin;
|
|
||||||
1 3 PIGGIES MOORE! MOOOOORE PIGGIES!
|
|
||||||
\.
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue