summaryrefslogtreecommitdiff
path: root/classes/rpc.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2013-08-25 17:34:27 +0400
committerAndrew Dolgov <[email protected]>2013-08-25 17:34:27 +0400
commite1f1857d95be8c226c67b588a21c78c964c8e3b0 (patch)
tree8426c7d8a105d110739b8bb2b71fe3592e9b5d1c /classes/rpc.php
parentf426c84787ed46790c16780053ab547ace3b7d1d (diff)
fix globalUpdateFeeds failing when no active session exists
Diffstat (limited to 'classes/rpc.php')
-rw-r--r--classes/rpc.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/classes/rpc.php b/classes/rpc.php
index cfd9c4f22..7d55e6ba8 100644
--- a/classes/rpc.php
+++ b/classes/rpc.php
@@ -508,6 +508,13 @@ class RPC extends Handler_Protected {
$random_qpart = sql_random_function();
+ // we could be invoked from public.php with no active session
+ if ($_SESSION["uid"]) {
+ $owner_check_qpart = "AND ttrss_feeds.owner_uid = '".$_SESSION["uid"]."'";
+ } else {
+ $owner_check_qpart = "";
+ }
+
// We search for feed needing update.
$result = $dbh->query("SELECT ttrss_feeds.feed_url,ttrss_feeds.id
FROM
@@ -516,8 +523,9 @@ class RPC extends Handler_Protected {
ttrss_feeds.owner_uid = ttrss_users.id
AND ttrss_users.id = ttrss_user_prefs.owner_uid
AND ttrss_user_prefs.pref_name = 'DEFAULT_UPDATE_INTERVAL'
- AND ttrss_feeds.owner_uid = ".$_SESSION["uid"]."
- $update_limit_qpart $updstart_thresh_qpart
+ $owner_check_qpart
+ $update_limit_qpart
+ $updstart_thresh_qpart
ORDER BY $random_qpart LIMIT 30");
$feed_id = -1;