]> git.wh0rd.org Git - tt-rss.git/commitdiff
filter_test: fix per-feed filter testing; misc tweaks
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 18 Apr 2011 04:24:24 +0000 (08:24 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 18 Apr 2011 04:24:24 +0000 (08:24 +0400)
modules/pref-filters.php

index a270ba8e60c36954ad007dd863aa6e19c3845808..bba4ff71e641ab43357cda4826eb6afa900bbdae 100644 (file)
 
                $filters[$type_name] = array($filter);
 
-               if ($feed_id != "NULL")
+               if ($feed_id)
                        $feed = $feed_id;
                else
                        $feed = -4;
 
-               $feed_title = getFeedTitle($line, $feed);
+               $feed_title = getFeedTitle($link, $feed);
 
                $qfh_ret = queryFeedHeadlines($link, $feed,
                        300, "", false, false, false,
-                       false, "updated DESC", 0, $_SESSION["uid"]);
+                       false, "date_entered DESC", 0, $_SESSION["uid"]);
 
                $result = $qfh_ret[0];
 
                $articles = array();
                $found = 0;
 
+               print __("Articles matching this filter:");
+
+               print "<div class=\"inactiveFeedHolder\">";
+               print "<table width=\"100%\" cellspacing=\"0\" id=\"prefErrorFeedList\">";
+
                while ($line = db_fetch_assoc($result)) {
 
                        $entry_timestamp = strtotime($line["updated"]);
                                if ($line["feed_title"])
                                        $feed_title = $line["feed_title"];
 
-                               array_push($articles, array("title" => $line["title"],
-                                       "content" => $content_preview, "feed" => $feed_title));
-
-                               $found++;
-                       }
-
-                       if ($found >= 30)
-                               break;
-               }
-
-               if ($found == 0) {
-                       print __("No recent articles matching this filter has been found.");
-               } else {
-
-                       print __("Recent articles matching this filter:");
-
-                       print "<div class=\"inactiveFeedHolder\">";
-                       print "<table width=\"100%\" cellspacing=\"0\" id=\"prefErrorFeedList\">";
-
-                       foreach ($articles as $article) {
                                print "<tr>";
 
                                print "<td width='5%' align='center'><input
                                        dojoType=\"dijit.form.CheckBox\" checked=\"1\"
-                                       disabled=\"1\"
-                                       type=\"checkbox\"></td>";
+                                       disabled=\"1\" type=\"checkbox\"></td>";
                                print "<td>";
 
-                               print $article["title"];
+                               print $line["title"];
                                print "&nbsp;(";
-                               print "<b>" . $article["feed"] . "</b>";
+                               print "<b>" . $feed_title . "</b>";
                                print "):&nbsp;";
-                               print "<span class=\"insensitive\">" . $article["content"] . "</span>";
+                               print "<span class=\"insensitive\">" . $content_preview . "</span>";
 
                                print "</td></tr>";
+
+                               $found++;
                        }
-                       print "</table>";
-                       print "</div>";
+
+                       if ($found >= 30)
+                               break;
+               }
+
+               if ($found == 0) {
+                       print "<tr><td align='center'>" .
+                               __("No recent articles matching this filter has been found.") . "</td></tr>";
                }
+
+               print "</table>";
+               print "</div>";
+
        }
 
        function module_pref_filters($link) {
 
                                filter_test($link, $filter_type, $reg_exp,
                                        $action_id, $action_param, $filter_param, sql_bool_to_bool($inverse),
-                                       $feed_id);
+                                       (int) $_REQUEST["feed_id"]);
 
                                print "<div align='center'>";
                                print "<button dojoType=\"dijit.form.Button\"
 
                                filter_test($link, $filter_type, $regexp,
                                        $action_id, $action_param, $filter_param, sql_bool_to_bool($inverse),
-                                       $feed_id);
+                                       (int) $_REQUEST["feed_id"]);
 
                                print "<div align='center'>";
                                print "<button dojoType=\"dijit.form.Button\"