diff --git a/backend.php b/backend.php
index 956ff2e46..810097a41 100644
--- a/backend.php
+++ b/backend.php
@@ -1,18 +1,22 @@
+ session_start();
+
define(SCHEMA_VERSION, 2);
- $op = $_REQUEST["op"];
-
- if ($op == "rpc" || $op == "updateAllFeeds") {
- header("Content-Type: application/xml");
- }
-
require_once "config.php";
require_once "db.php";
require_once "db-prefs.php";
require_once "functions.php";
require_once "magpierss/rss_fetch.inc";
+ $_SESSION["uid"] = PLACEHOLDER_UID; // FIXME: placeholder
+
+ $op = $_REQUEST["op"];
+
+ if ($op == "rpc" || $op == "updateAllFeeds") {
+ header("Content-Type: application/xml");
+ }
+
$script_started = getmicrotime();
$link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
@@ -47,7 +51,7 @@
function getGlobalCounters($link) {
$result = db_query($link, "SELECT count(id) as c_id FROM ttrss_entries
- WHERE unread = true");
+ WHERE unread = true AND owner_uid = " . $_SESSION["uid"]);
$c_id = db_fetch_result($result, 0, "c_id");
print "";
}
@@ -55,9 +59,11 @@
function getTagCounters($link) {
$result = db_query($link, "SELECT tag_name,count(ttrss_entries.id) AS count
FROM ttrss_tags,ttrss_entries WHERE
+ ttrss_tags.owner_uid = ".$_SESSION["uid"]." AND
post_id = ttrss_entries.id AND unread = true GROUP BY tag_name
UNION
- select tag_name,0 as count FROM ttrss_tags");
+ select tag_name,0 as count FROM ttrss_tags
+ WHERE ttrss_tags.owner_uid = ".$_SESSION["uid"]);
$tags = array();
@@ -76,14 +82,14 @@
function getLabelCounters($link) {
$result = db_query($link, "SELECT count(id) as count FROM ttrss_entries
- WHERE marked = true AND unread = true");
+ WHERE marked = true AND unread = true AND owner_uid = ".$_SESSION["uid"]);
$count = db_fetch_result($result, 0, "count");
print "