Permalink
Browse files

MDL-37818 - RSS - Prevent access to blocks while RSS context errors a…

…re displayed
  • Loading branch information...
1 parent 204383e commit dafe65e43843af1171128c3de560fc9c3437024f @jsnfwlr jsnfwlr committed with damyon Mar 18, 2013
Showing with 10 additions and 9 deletions.
  1. +10 −9 rss/file.php
View
@@ -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;
@@ -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');
+ }
}
}

0 comments on commit dafe65e

Please sign in to comment.