Permalink
Browse files

MDL-33514 - rss: only retrieve RSS feeds for valid users

  • Loading branch information...
1 parent a6dfc10 commit 331de0b54626e4b124cd8c1ca3872242ffd00a12 @danpoltawski danpoltawski committed Jun 6, 2012
Showing with 6 additions and 5 deletions.
  1. +6 −5 lib/rsslib.php
View
@@ -346,11 +346,12 @@ function rss_geterrorxmlfile($errortype = 'rsserror') {
function rss_get_userid_from_token($token) {
global $DB;
- $record = $DB->get_record('user_private_key', array('script'=>'rss','value' => $token), 'userid', IGNORE_MISSING);
- if ($record) {
- return $record->userid;
- }
- return null;
+
+ $sql = 'SELECT u.id FROM {user} u
+ JOIN {user_private_key} k ON u.id = k.userid
+ WHERE u.deleted = 0 AND u.confirmed = 1
+ AND k.value = ?';
+ return $DB->get_field_sql($sql, array($token), IGNORE_MISSING);
}
function rss_get_token($userid) {

0 comments on commit 331de0b

Please sign in to comment.