Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit 6b4c491cb49c71f89cc3a14ef1f85cd09b432d21 1 parent f2867a8
Dan Poltawski danpoltawski authored samhemelryk committed
Showing with 6 additions and 5 deletions.
  1. +6 −5 lib/rsslib.php
11 lib/rsslib.php
View
@@ -405,11 +405,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);
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.