filters are now actually applied separately for each user
This commit is contained in:
parent
fe99ab12bb
commit
3a933f22b1
3 changed files with 18 additions and 7 deletions
|
@ -293,12 +293,6 @@
|
||||||
|
|
||||||
// base post entry does not exist, create it
|
// base post entry does not exist, create it
|
||||||
|
|
||||||
error_reporting(0);
|
|
||||||
if (is_filtered($entry_title, $entry_content, $filters)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
error_reporting (E_ERROR | E_WARNING | E_PARSE);
|
|
||||||
|
|
||||||
$result = db_query($link,
|
$result = db_query($link,
|
||||||
"INSERT INTO ttrss_entries
|
"INSERT INTO ttrss_entries
|
||||||
(title,
|
(title,
|
||||||
|
@ -350,6 +344,12 @@
|
||||||
$dupcheck_qpart = "";
|
$dupcheck_qpart = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
error_reporting(0);
|
||||||
|
if (is_filtered($entry_title, $entry_content, $entry_link, $filters)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
error_reporting (E_ERROR | E_WARNING | E_PARSE);
|
||||||
|
|
||||||
$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'
|
||||||
|
@ -470,7 +470,7 @@
|
||||||
print "</select>";
|
print "</select>";
|
||||||
}
|
}
|
||||||
|
|
||||||
function is_filtered($title, $content, $filters) {
|
function is_filtered($title, $content, $link, $filters) {
|
||||||
|
|
||||||
if ($filters["title"]) {
|
if ($filters["title"]) {
|
||||||
foreach ($filters["title"] as $title_filter) {
|
foreach ($filters["title"] as $title_filter) {
|
||||||
|
@ -493,6 +493,13 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($filters["link"]) {
|
||||||
|
foreach ($filters["link"] as $link_filter) {
|
||||||
|
if (preg_match("/$link_filter/i", $link))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,8 @@ insert into ttrss_filter_types (id,name,description) values (1, 'title', 'Title'
|
||||||
insert into ttrss_filter_types (id,name,description) values (2, 'content', 'Content');
|
insert into ttrss_filter_types (id,name,description) values (2, 'content', 'Content');
|
||||||
insert into ttrss_filter_types (id,name,description) values (3, 'both',
|
insert into ttrss_filter_types (id,name,description) values (3, 'both',
|
||||||
'Title or Content');
|
'Title or Content');
|
||||||
|
insert into ttrss_filter_types (id,name,description) values (4, 'link',
|
||||||
|
'Link');
|
||||||
|
|
||||||
create table ttrss_filters (id integer not null primary key auto_increment,
|
create table ttrss_filters (id integer not null primary key auto_increment,
|
||||||
owner_uid integer not null,
|
owner_uid integer not null,
|
||||||
|
|
|
@ -78,6 +78,8 @@ insert into ttrss_filter_types (id,name,description) values (1, 'title', 'Title'
|
||||||
insert into ttrss_filter_types (id,name,description) values (2, 'content', 'Content');
|
insert into ttrss_filter_types (id,name,description) values (2, 'content', 'Content');
|
||||||
insert into ttrss_filter_types (id,name,description) values (3, 'both',
|
insert into ttrss_filter_types (id,name,description) values (3, 'both',
|
||||||
'Title or Content');
|
'Title or Content');
|
||||||
|
insert into ttrss_filter_types (id,name,description) values (4, 'link',
|
||||||
|
'Link');
|
||||||
|
|
||||||
create table ttrss_filters (id serial not null primary key,
|
create table ttrss_filters (id serial not null primary key,
|
||||||
owner_uid integer not null references ttrss_users(id) on delete cascade,
|
owner_uid integer not null references ttrss_users(id) on delete cascade,
|
||||||
|
|
Loading…
Reference in a new issue