]> git.wh0rd.org - tt-rss.git/commitdiff
allow filtering by article author (bump schema)
authorAndrew Dolgov <fox@bah.org.ru>
Tue, 23 Mar 2010 11:38:58 +0000 (14:38 +0300)
committerAndrew Dolgov <fox@bah.org.ru>
Tue, 23 Mar 2010 11:38:58 +0000 (14:38 +0300)
functions.php
sanity_check.php
schema/ttrss_schema_mysql.sql
schema/ttrss_schema_pgsql.sql
schema/versions/mysql/66.sql [new file with mode: 0644]
schema/versions/pgsql/66.sql [new file with mode: 0644]

index a1aabf9a56296993b374a9c0d5f5af2b225e25a4..28f49b61e8302704bbd6cf5cab4b619a9250d68a 100644 (file)
 //                                     error_reporting(0);
 
                                        $article_filters = get_article_filters($filters, $entry_title, 
-                                                       $entry_content, $entry_link, $entry_timestamp);
+                                                       $entry_content, $entry_link, $entry_timestamp, $entry_author);
 
                                        if (defined('DAEMON_EXTENDED_DEBUG') || $_REQUEST['xdebug']) {
                                                _debug("update_rss_feed: article filters: ");
                print "</select>";
        }
 
-       function get_article_filters($filters, $title, $content, $link, $timestamp) {
+       function get_article_filters($filters, $title, $content, $link, $timestamp, $author) {
                $matches = array();
 
                if ($filters["title"]) {
                        }
                } 
 
+               if ($filters["author"]) {
+                       foreach ($filters["author"] as $filter) {
+                               $reg_exp = $filter["reg_exp"];          
+                               $inverse = $filter["inverse"];  
+                               if ((!$inverse && preg_match("/$reg_exp/i", $author)) || 
+                                               ($inverse && !preg_match("/$reg_exp/i", $author))) {
+
+                                       array_push($matches, array($filter["action"], $filter["action_param"]));
+                               }
+                       }
+               }
+
                return $matches;
        }
 
index f23704000ea2386d1d75f554a8abd9d5b11a7533..d112896e0a5d71f34dd6430111981da54f7b6551 100644 (file)
@@ -2,7 +2,7 @@
        require_once "functions.php";
 
        define('EXPECTED_CONFIG_VERSION', 18);
-       define('SCHEMA_VERSION', 65);
+       define('SCHEMA_VERSION', 66);
 
        if (!file_exists("config.php")) {
                print "<b>Fatal Error</b>: You forgot to copy 
index b9bb777ecfa08496418a9e9eb44b7eed3f94c902..0f4acf900d85dbd4167433a99851de625ee58f58 100644 (file)
@@ -183,6 +183,7 @@ insert into ttrss_filter_types (id,name,description) values (4, 'link',
        'Link');
 insert into ttrss_filter_types (id,name,description) values (5, 'date', 
        'Article Date');
+insert into ttrss_filter_types (id,name,description) values (6, 'author', 'Author');
 
 create table ttrss_filter_actions (id integer not null primary key, 
        name varchar(120) unique not null, 
@@ -239,7 +240,7 @@ create table ttrss_tags (id integer primary key auto_increment,
 
 create table ttrss_version (schema_version int not null) TYPE=InnoDB;
 
-insert into ttrss_version values (65);
+insert into ttrss_version values (66);
 
 create table ttrss_enclosures (id integer primary key auto_increment,
        content_url text not null,
index 55b07b6ea7cd482eda5ca506da60cd8e1e04dfc8..7225f10f8d30e02f25555ef4d7a61de577514775 100644 (file)
@@ -165,6 +165,7 @@ insert into ttrss_filter_types (id,name,description) values (4, 'link',
        'Link');
 insert into ttrss_filter_types (id,name,description) values (5, 'date', 
        'Article Date');
+insert into ttrss_filter_types (id,name,description) values (6, 'author', 'Author');
 
 create table ttrss_filter_actions (id integer not null primary key, 
        name varchar(120) unique not null, 
@@ -211,7 +212,7 @@ create index ttrss_tags_owner_uid_index on ttrss_tags(owner_uid);
 
 create table ttrss_version (schema_version int not null);
 
-insert into ttrss_version values (65);
+insert into ttrss_version values (66);
 
 create table ttrss_enclosures (id serial not null primary key,
        content_url text not null,
diff --git a/schema/versions/mysql/66.sql b/schema/versions/mysql/66.sql
new file mode 100644 (file)
index 0000000..f90c0a1
--- /dev/null
@@ -0,0 +1,7 @@
+begin;
+
+insert into ttrss_filter_types (id, name, description) values (6, 'author', 'Author');
+
+update ttrss_version set schema_version = 66;
+
+commit;
diff --git a/schema/versions/pgsql/66.sql b/schema/versions/pgsql/66.sql
new file mode 100644 (file)
index 0000000..f90c0a1
--- /dev/null
@@ -0,0 +1,7 @@
+begin;
+
+insert into ttrss_filter_types (id, name, description) values (6, 'author', 'Author');
+
+update ttrss_version set schema_version = 66;
+
+commit;