Skip to content

Commit

Permalink
MDL-37818 - RSS - Prevent access to blocks while RSS context errors a…
Browse files Browse the repository at this point in the history
…re displayed
  • Loading branch information
jsnfwlr authored and Damyon Wiese committed Jul 2, 2013
1 parent ad3ebb8 commit e73cb1a
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions rss/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,21 +122,18 @@
}
}

// Check the context actually exists
list($context, $course, $cm) = get_context_info_array($contextid);

$PAGE->set_context($context);

$user = get_complete_user_data('id', $userid);

// let enrol plugins deal with new enrolments if necessary
enrol_check_plugins($user);

session_set_user($user); //for login and capability checks

// Check the context actually exists
list($context, $course, $cm) = get_context_info_array($contextid);

if (!$context) {
rss_error();
}
$PAGE->set_context($context);

try {
$autologinguest = true;
$setwantsurltome = true;
Expand Down Expand Up @@ -165,7 +162,11 @@
if (function_exists($functionname)) {
// $pathname will be null if there was a problem (eg user doesn't have the necessary capabilities)
// NOTE:the component providing the feed must do its own capability checks and security
$pathname = $functionname($context, $args);
try {
$pathname = $functionname($context, $args);
} catch (Exception $e) {
rss_error('rsserror');
}
}
}

Expand Down

0 comments on commit e73cb1a

Please sign in to comment.