Merge branch 'MDL-24870_rss_error' of git://github.com/andyjdavis/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2011-02-08 10:21:55 +01:00
commit cd03ecce8e
4 changed files with 24 additions and 22 deletions

View File

@ -110,7 +110,8 @@ class block_news_items extends block_base {
} else {
$userid = $USER->id;
}
$this->content->footer .= '<br />'.rss_get_link($this->page->context->id, $userid, 'mod_forum', $forum->id, $tooltiptext);
$this->content->footer .= '<br />'.rss_get_link($context->id, $userid, 'mod_forum', $forum->id, $tooltiptext);
}
}

View File

@ -12,13 +12,18 @@
return null;
}
if (!is_enrolled($context, null, 'mod/data:managetemplates') && !isguestuser()) {
return null;
$dataid = clean_param($args[3], PARAM_INT);
$cm = get_coursemodule_from_instance('data', $dataid, 0, false, MUST_EXIST);
if ($cm) {
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
//context id from db should match the submitted one
if ($context->id != $modcontext->id || !has_capability('mod/data:viewentry', $modcontext)) {
return null;
}
}
$dataid = clean_param($args[3], PARAM_INT);
$data = $DB->get_record('data', array('id' => $dataid), '*', MUST_EXIST);
if (!rss_enabled_for_mod('data', $data, false, true)) {
return null;
}

View File

@ -44,25 +44,17 @@ function forum_rss_get_feed($context, $args) {
}
$forumid = clean_param($args[3], PARAM_INT);
$uservalidated = false;
$cm = get_coursemodule_from_instance('forum', $forumid, 0, false, MUST_EXIST);
if ($cm) {
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
//context id from db should match the submitted one
if ($context->id==$modcontext->id && has_capability('mod/forum:viewdiscussion', $modcontext)) {
$uservalidated = true;
if ($context->id != $modcontext->id || !has_capability('mod/forum:viewdiscussion', $modcontext)) {
return null;
}
}
if (!$uservalidated) {
return null;
}
$forum = $DB->get_record('forum', array('id' => $forumid), '*', MUST_EXIST);
if (!rss_enabled_for_mod('forum', $forum)) {
return null;
}

View File

@ -6,22 +6,26 @@
function glossary_rss_get_feed($context, $args) {
global $CFG, $DB;
$status = true;
if (empty($CFG->glossary_enablerssfeeds)) {
debugging("DISABLED (module configuration)");
return null;
}
$status = true;
$glossaryid = clean_param($args[3], PARAM_INT);
$cm = get_coursemodule_from_instance('glossary', $glossaryid, 0, false, MUST_EXIST);
if ($cm) {
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
//check capabilities
//glossary module doesn't require any capabilities to view glossary entries (aside from being logged in)
if (!is_enrolled($context) && !isguestuser()) {
return null;
//context id from db should match the submitted one
//no specific capability required to view glossary entries so just check user is enrolled
if ($context->id != $modcontext->id || !is_enrolled($context)) {
return null;
}
}
$glossaryid = clean_param($args[3], PARAM_INT);
$glossary = $DB->get_record('glossary', array('id' => $glossaryid), '*', MUST_EXIST);
if (!rss_enabled_for_mod('glossary', $glossary)) {
return null;
}