]> git.mjollnir.org Git - moodle.git/commitdiff
Fixed wrong context bug
authorvyshane <vyshane>
Fri, 29 Sep 2006 08:58:02 +0000 (08:58 +0000)
committervyshane <vyshane>
Fri, 29 Sep 2006 08:58:02 +0000 (08:58 +0000)
blocks/rss_client/block_rss_client_action.php

index 19d30380e655bded03477b10f4da08c329d53b7a..b515bd8787850f370fcd20eafbc68f5d56d15c50 100644 (file)
@@ -55,12 +55,18 @@ if (!defined('MAGPIE_OUTPUT_ENCODING')) {
     define('MAGPIE_OUTPUT_ENCODING', current_charset());  // see bug 3107
 }
 
+
 if (!empty($id)) {
     // we get the complete $course object here because print_header assumes this is 
     // a complete object (needed for proper course theme settings)
-    $course = get_record('course', 'id', $id);
+    if ($course = get_record('course', 'id', $id)) {
+        $context = get_context_instance(CONTEXT_COURSE, $id);
+    }
+} else {
+    $context = get_context_instance(CONTEXT_SYSTEM, SITEID);
 }
 
+
 $straddedit = get_string('feedsaddedit', 'block_rss_client');
 
 if (!empty($course)) {
@@ -84,11 +90,6 @@ if ( isset($rssid) ) {
 }
 
 
-$block = get_record('block', 'name', 'rss_client');
-$blockinstance = get_record('block_instance', 'blockid', $block->id, 'pagetype', 'course-view', 'pageid', $id);
-$context = get_context_instance(CONTEXT_BLOCK, $blockinstance->id);
-
-
 if (isset($rss_record)) {
     $managefeeds = ($rss_record->userid == $USER->id && has_capability('block/rss_client:manageownfeeds', $context))
                 || ($rss_record->userid != $USER->id && has_capability('block/rss_client:manageanyfeeds', $context));