further functions.php uid work

This commit is contained in:
Andrew Dolgov 2005-11-17 19:04:00 +01:00
parent 5d3f29da4b
commit 06da450f4c
1 changed files with 10 additions and 9 deletions

View File

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