]> git.wh0rd.org - tt-rss.git/commitdiff
filters are now actually applied separately for each user
authorAndrew Dolgov <fox@madoka.spb.ru>
Mon, 21 Nov 2005 07:38:28 +0000 (08:38 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Mon, 21 Nov 2005 07:38:28 +0000 (08:38 +0100)
functions.php
schema/ttrss_schema_mysql.sql
schema/ttrss_schema_pgsql.sql

index 0d4ee78dec2971f7aae76ea498aed0a8e794b879..f1c56e98420a4b49f13f7f4452ec9d97a50cba53 100644 (file)
 
                                        // 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,
                                                "INSERT INTO ttrss_entries 
                                                        (title,
                                                        $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,
                                                        "SELECT ref_id FROM ttrss_user_entries WHERE
                                                                ref_id = '$ref_id' AND owner_uid = '$owner_uid'
                print "</select>";
        }
 
-       function is_filtered($title, $content, $filters) {
+       function is_filtered($title, $content, $link, $filters) {
 
                if ($filters["title"]) {
                        foreach ($filters["title"] as $title_filter) {                  
                        }
                }
 
+               if ($filters["link"]) {
+                       foreach ($filters["link"] as $link_filter) {                    
+                               if (preg_match("/$link_filter/i", $link)) 
+                                       return true;
+                       }
+               }
+
                return false;
        }
 
index 3b1a18b4ca44cc34a7f2dedd05812f3c41a56200..e2b9c7050e285a316e5b0e236e30ecb56675584b 100644 (file)
@@ -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 (3, 'both', 
        '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,
        owner_uid integer not null, 
index a6c19bedbb9da1bbaffc879c432301113c20f7d2..f7461d90266ba71ed3faae70f515351f949482e5 100644 (file)
@@ -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 (3, 'both', 
        '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, 
        owner_uid integer not null references ttrss_users(id) on delete cascade,