]> git.wh0rd.org Git - tt-rss.git/commitdiff
further functions.php uid work
authorAndrew Dolgov <fox@bah.spb.su>
Thu, 17 Nov 2005 18:04:00 +0000 (19:04 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Thu, 17 Nov 2005 18:04:00 +0000 (19:04 +0100)
functions.php

index da3ac87256b69f36fea5059344450a9ee8f76954..42d00c060e50dc68b9bd1e87e77bb773993e67c0 100644 (file)
@@ -1,11 +1,11 @@
 <?
        session_start();
 
-       $_SESSION["uid"] = 1; // FIXME: placeholder
-
        require_once 'config.php';
        require_once 'db-prefs.php';
 
+       $_SESSION["uid"] = PLACEHOLDER_UID; // FIXME: placeholder
+
        define('MAGPIE_OUTPUT_ENCODING', 'UTF-8');
 
        function purge_old_posts($link) {
                        $result = db_query($link, "SELECT reg_exp,
                                (SELECT name FROM ttrss_filter_types
                                        WHERE id = filter_type) as name
-                               FROM ttrss_filters");
+                               FROM ttrss_filters WHERE owner_uid = ".$_SESSION["uid"]);
 
                        while ($line = db_fetch_assoc($result)) {
                                if (!$filters[$line["name"]]) $filters[$line["name"]] = array();
                                        FROM
                                                ttrss_entries 
                                        WHERE
-                                               guid = '$entry_guid'");
+                                               guid = '$entry_guid' AND owner_uid = " . $_SESSION["uid"]);
 
 //                             print db_num_rows($result) . "$entry_guid<br/>";
 
                                                        feed_id, 
                                                        comments,                                                       
                                                        no_orig_date,
-                                                       date_entered) 
+                                                       date_entered,
+                                                       owner_uid) 
                                                VALUES
                                                        ('$entry_title', 
                                                        '$entry_guid', 
                                                        '$feed', 
                                                        '$entry_comments',
                                                        $no_orig_date,
-                                                       NOW())";
+                                                       NOW(),".$_SESSION["uid"].")";
 
                                        $result = db_query($link, $query);
 
                                                $tag = db_escape_string(strtolower($tag));
 
                                                $result = db_query($link, "SELECT id FROM ttrss_tags            
-                                                       WHERE tag_name = '$tag' AND post_id = '$entry_id' LIMIT 1");
+                                                       WHERE tag_name = '$tag' AND post_id = '$entry_id' AND owner_uid = ".$_SESSION["uid"]." LIMIT 1");
 
                                                if ($result && db_num_rows($result) == 0) {
                                                        
 //                                                     print "tagging $entry_id as $tag<br>";
 
-                                                       db_query($link, "INSERT INTO ttrss_tags (tag_name,post_id)
-                                                               VALUES ('$tag', '$entry_id')");
+                                                       db_query($link, "INSERT INTO ttrss_tags (owner_uid,tag_name,post_id)
+                                                               VALUES ('".$_SESSION["uid"]."','$tag', '$entry_id')");
                                                }                                                       
                                        }
                                }