]> git.wh0rd.org Git - tt-rss.git/commitdiff
make update_rss_feed() neutral to logged in user
authorAndrew Dolgov <fox@bah.spb.su>
Sun, 20 Nov 2005 10:25:50 +0000 (11:25 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Sun, 20 Nov 2005 10:25:50 +0000 (11:25 +0100)
functions.php

index b6c426f54285f8dc39d4648956ee0289a2a6c0ed..e6b5b8e6eee44e2e6abac8de757cc47a6c7e3beb 100644 (file)
                                check_feed_favicon($feed_url, $feed, $link);
                        }
                
-                       $result = db_query($link, "SELECT title,icon_url,site_url 
+                       $result = db_query($link, "SELECT title,icon_url,site_url,owner_uid 
                                FROM ttrss_feeds WHERE id = '$feed'");
 
                        $registered_title = db_fetch_result($result, 0, "title");
                        $orig_icon_url = db_fetch_result($result, 0, "icon_url");
                        $orig_site_url = db_fetch_result($result, 0, "site_url");
 
+                       $owner_uid = db_fetch_result($result, 0, "owner_uid");
+
                        if (!$registered_title) {
                                $feed_title = db_escape_string($rss->channel["title"]);
                                db_query($link, "UPDATE ttrss_feeds SET 
                        $result = db_query($link, "SELECT reg_exp,
                                (SELECT name FROM ttrss_filter_types
                                        WHERE id = filter_type) as name
-                               FROM ttrss_filters WHERE owner_uid = ".$_SESSION["uid"]);
+                               FROM ttrss_filters WHERE owner_uid = $owner_uid");
 
                        while ($line = db_fetch_assoc($result)) {
                                if (!$filters[$line["name"]]) $filters[$line["name"]] = array();
                                $result = db_query($link, "SELECT id FROM       ttrss_entries 
                                        WHERE guid = '$entry_guid'");
 
-                               $owner_uid = $_SESSION["uid"];
-
                                $entry_content = db_escape_string($entry_content);
                                $entry_title = db_escape_string($entry_title);
                                $entry_link = db_escape_string($entry_link);
                                                FROM ttrss_entries,ttrss_user_entries 
                                                WHERE guid = '$entry_guid' 
                                                AND feed_id = '$feed' AND ref_id = id
-                                               AND owner_uid = " . $_SESSION["uid"]);
+                                               AND owner_uid = '$owner_uid'");
 
                                        if (!$result || db_num_rows($result) != 1) {
                                                return;
 
                                                $result = db_query($link, "SELECT id FROM ttrss_tags            
                                                        WHERE tag_name = '$tag' AND post_int_id = '$entry_int_id' AND 
-                                                       owner_uid = ".$_SESSION["uid"]." LIMIT 1");
+                                                       owner_uid = '$owner_uid' LIMIT 1");
 
 //                                             print db_fetch_result($result, 0, "id");
 
 
                                                        db_query($link, "INSERT INTO ttrss_tags 
                                                                (owner_uid,tag_name,post_int_id)
-                                                               VALUES ('".$_SESSION["uid"]."','$tag', '$entry_int_id')");
+                                                               VALUES ('$owner_uid','$tag', '$entry_int_id')");
                                                }                                                       
                                        }
                                }