diff --git a/blocks/rss_client/block_rss_client_action.php b/blocks/rss_client/block_rss_client_action.php index f0bf3e6b896..5577237c41f 100644 --- a/blocks/rss_client/block_rss_client_action.php +++ b/blocks/rss_client/block_rss_client_action.php @@ -28,7 +28,7 @@ $act = optional_param('act', 'none' ); $rssid = optional_param('rssid', 'none' ); - $courseid = optional_param('courseid', 0, PARAM_INT); + $courseid = optional_param('courseid', SITEID, PARAM_INT); $url = optional_param('url'); $preferredtitle = optional_param('preferredtitle', ''); $item = optional_param('item'); @@ -67,12 +67,12 @@ //if the user is an admin or course teacher then allow the user to //assign categories to other uses than personal if (!( isadmin() || $submitters == SUBMITTERS_ALL_ACCOUNT_HOLDERS || ($submitters == SUBMITTERS_ADMIN_AND_TEACHER && $isteacher) ) ) { - error(get_string('noguestpost', 'forum'), $referrer); + error(get_string('noguestpost', 'forum').' You are not allowed to make modifications to this RSS feed at this time.', $referrer); } if ($act == 'none') { rss_display_feeds(); - rss_get_form($act, $url, $rssid, $preferredtitle); + rss_get_form($act, $url, $rssid, $preferredtitle, $courseid); } else if ($act == 'updfeed') { if (empty($url)) { @@ -155,7 +155,7 @@ redirect($referrer, $message); /* rss_display_feeds(); - rss_get_form($act, $dataobject->url, $dataobject->id, $dataobject->preferredtitle); + rss_get_form($act, $dataobject->url, $dataobject->id, $dataobject->preferredtitle, $courseid); */ } else if ( $act == 'rss_edit') { @@ -166,7 +166,7 @@ } $url = stripslashes_safe($rss_record->url); rss_display_feeds('', $rssid); - rss_get_form($act, $url, $rssid, $preferredtitle); + rss_get_form($act, $url, $rssid, $preferredtitle, $courseid); } else if ($act == 'delfeed') { @@ -234,7 +234,7 @@ } } else { rss_display_feeds(); - rss_get_form($act, $url, $rssid, $preferredtitle); + rss_get_form($act, $url, $rssid, $preferredtitle, $courseid); } print_footer(); diff --git a/blocks/rss_client/config_instance.html b/blocks/rss_client/config_instance.html index 18d4c391387..8239d514355 100644 --- a/blocks/rss_client/config_instance.html +++ b/blocks/rss_client/config_instance.html @@ -1,6 +1,8 @@ libdir .'/rsslib.php'); +$courseid = optional_param('courseid', SITEID, PARAM_INT); + //create a page object for url_get_full() $page = page_create_object($this->instance->pagetype, $this->instance->pageid); @@ -87,7 +89,7 @@ if ($currentaction == 'configblock') { } else { print_string('nofeeds', 'block_rss_client'); if ( isadmin() ) { - print '  '. get_string('editnewsfeeds', 'block_rss_client') .'
'; + print '  '. get_string('editnewsfeeds', 'block_rss_client') .'
'; } } ?> @@ -149,6 +151,6 @@ if ($currentaction == 'configblock') { print ''; rss_display_feeds(); print ''; //not sure that this is needed - rss_get_form($act, $url, $rssid, $preferredtitle); + rss_get_form($act, $url, $rssid, $preferredtitle, $courseid); print ''; } ?> diff --git a/lib/rsslib.php b/lib/rsslib.php index bb4f1ab0981..cde563b138f 100644 --- a/lib/rsslib.php +++ b/lib/rsslib.php @@ -427,12 +427,14 @@ function rss_unhtmlentities($string) { /** * Prints or returns a form for managing rss feed entries. - * @param string $act . - * @param string $url . - * @param int $rssid . + * @param string $act The current action. If "rss_edit" then and "update" button is used, otherwise "add" is used. + * @param string $url The url of the feed that is being updated or NULL + * @param int $rssid The dataabse id of the feed that is being updated or NULL * @param bool $printnow True if the generated form should be printed out, false if the string should be returned from this function quietly + * @param int $courseid The course that is currently being viewed if applicable + * @return string Either the form is printed directly and nothing is returned or the form is returned as a string */ -function rss_get_form($act='none', $url='', $rssid='', $preferredtitle='', $printnow=true) { +function rss_get_form($act='none', $url='', $rssid='', $preferredtitle='', $printnow=true, $courseid=SITEID) { global $USER, $CFG, $_SERVER, $blockid, $blockaction; global $blogid; //hackish, but if there is a blogid it would be good to preserve it $stredit = get_string('edit'); @@ -470,6 +472,7 @@ function rss_get_form($act='none', $url='', $rssid='', $preferredtitle='', $prin if ($act == 'rss_edit') { $returnstring .= ''. "\n"; } + $returnstring .= ''."\n"; $returnstring .= ''."\n"; $returnstring .= ''."\n"; $returnstring .= '