]> git.wh0rd.org Git - tt-rss.git/commitdiff
support for generated feeds based on searches
authorAndrew Dolgov <fox@bah.spb.su>
Mon, 31 Jul 2006 11:55:15 +0000 (12:55 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Mon, 31 Jul 2006 11:55:15 +0000 (12:55 +0100)
backend.php
functions.php

index 107074fb4d5ab878ba4b52f612cdfe6b22b46061..bd53354f2f35518e54130d652ef5c3db6ce61567 100644 (file)
 
                function print_headline_subtoolbar($link, $feed_site_url, $feed_title, 
                        $bottom = false, $rtl_content = false, $feed_id = 0,
-                       $is_cat = false) {
+                       $is_cat = false, $search = false, $match_on = false,
+                       $search_mode = false) {
 
                        if (!$bottom) {
                                $class = "headlinesSubToolbar";
                                print $feed_title;
                        }
 
+                       if ($search) {
+                               $search_q = "&q=$search&m=$match_on&smode=$search_mode";
+                       }
+
                        print "&nbsp;
                                <a target=\"_new\" 
-                                       href=\"backend.php?op=rss&id=$feed_id&is_cat=$is_cat\"
+                                       href=\"backend.php?op=rss&id=$feed_id&is_cat=$is_cat$search_q\"
                                        <img class=\"noborder\" 
                                                alt=\"Generated feed\" src=\"images/feed-icon-12x12.png\">
                                </a>";
                if (db_num_rows($result) > 0) {
 
                        print_headline_subtoolbar($link, $feed_site_url, $feed_title, false, 
-                               $rtl_content, $feed, $cat_view);
+                               $rtl_content, $feed, $cat_view, $search, $match_on, $search_mode);
 
                        if (!get_pref($link, 'COMBINED_DISPLAY_MODE')) {
                                print "<table class=\"headlinesList\" id=\"headlinesList\" 
                $pass = db_escape_string($_GET["pass"]);
                $is_cat = $_GET["is_cat"] != false;
 
+               $search = db_escape_string($_GET["q"]);
+               $match_on = db_escape_string($_GET["m"]);
+               $search_mode = db_escape_string($_GET["smode"]);
+
                if (!$_SESSION["uid"] && $user && $pass) {
                        authenticate_user($link, $user, $pass);
                }
                if ($_SESSION["uid"] ||
                        http_authenticate_user($link)) {
 
-                               generate_syndicated_feed($link, $feed, $is_cat);
+                               generate_syndicated_feed($link, $feed, $is_cat, 
+                                       $search, $search_mode, $match_on);
                }
        }
 
index e77f2d5a0450c05d9a8edf924151708c20b8099e..5fd65c1d6f93c0bc89dcf551f8b760454c22914d 100644 (file)
                        if ($search && $search_mode == "all_feeds") {
                                $feed_title = "Global search results ($search)";
                        } else if ($search && preg_match('/^-?[0-9][0-9]*$/', $feed) == false) {
-                               $feed_title = "Feed search results ($search, $feed)";
+                               $feed_title = "Tag search results ($search, $feed)";
                        } else if (preg_match('/^-?[0-9][0-9]*$/', $feed) == false) {
                                $feed_title = $feed;
                        } else if (preg_match('/^-?[0-9][0-9]*$/', $feed) != false && $feed >= 0) {
                                        } else {
                                                $feed_title = "Uncategorized";
                                        }
+
+                                       if ($search) {
+                                               $feed_title = "Category search results ($search, $feed_title)";
+                                       }
+
                                } else {
                                        
                                        $result = db_query($link, "SELECT title,site_url,last_error FROM ttrss_feeds 
                                        $feed_title = db_fetch_result($result, 0, "title");
                                        $feed_site_url = db_fetch_result($result, 0, "site_url");
                                        $last_error = db_fetch_result($result, 0, "last_error");
-       
+
+                                       if ($search) {
+                                               $feed_title = "Feed search results ($search, $feed_title)";
+                                       }
                                }
        
                        } else if ($feed == -1) {
                        
        }
 
-       function generate_syndicated_feed($link, $feed, $is_cat) {
+       function generate_syndicated_feed($link, $feed, $is_cat,
+               $search, $search_mode, $match_on) {
 
                $qfh_ret = queryFeedHeadlines($link, $feed, 
-                               30, false, $is_cat, false, false, false);
+                               30, false, $is_cat, $search, $search_mode, $match_on);
 
                $result = $qfh_ret[0];
                $feed_title = $qfh_ret[1];