Merge branch 'MDL-33564-master' of git://github.com/danpoltawski/moodle

Conflicts:
	lib/upgrade.txt
This commit is contained in:
David Monllao 2015-09-15 17:56:20 +08:00
commit b3434ca51d
2 changed files with 15 additions and 10 deletions

View File

@ -136,6 +136,8 @@ information provided here is intended especially for developers.
i.e. a call to M.core.actionmenu.instance.hideMenu() should be change to M.core.actionmenu.instance.hideMenu(e)
* In the html_editors (tinyMCE, Atto), the manage files button can be hidden by changing the 'enable_filemanagement' option to false.
* external_api::validate_context now is public, it can be called from other classes.
* rss_error() now supports returning of correct HTTP status of error and will return '404 Not Found'
unless other status is specified.
=== 2.9.1 ===

View File

@ -39,7 +39,6 @@ require_once($CFG->libdir.'/rsslib.php');
// RSS feeds must be enabled site-wide.
if (empty($CFG->enablerssfeeds)) {
debugging('DISABLED (admin variables)');
rss_error();
}
@ -86,14 +85,14 @@ if ($token === "$inttoken") {
if (empty($context)) {
// This shouldnt happen. something bad is going on.
rss_error('rsserror');
rss_error();
}
// Make sure that $CFG->siteguest is set.
if (empty($CFG->siteguest)) {
if (!$guestid = $DB->get_field('user', 'id', array('username' => 'guest', 'mnethostid' => $CFG->mnet_localhost_id))) {
// Guest does not exist yet, weird.
rss_error('rsserror');
rss_error();
}
set_config('siteguest', $guestid);
}
@ -111,7 +110,7 @@ if ($token === "$inttoken") {
// Authenticate the user from the token.
$userid = rss_get_userid_from_token($token);
if (!$userid) {
rss_error('rsserrorauth');
rss_error('rsserrorauth', 'rss.xml', 0, '403 Forbidden');
}
}
@ -134,9 +133,9 @@ try {
require_login($course, $autologinguest, $cm, $setwantsurltome, $preventredirect);
} catch (Exception $e) {
if (isguestuser()) {
rss_error('rsserrorguest');
rss_error('rsserrorguest', 'rss.xml', 0, '403 Forbidden');
} else {
rss_error('rsserrorauth');
rss_error('rsserrorauth', 'rss.xml', 0, '403 Forbidden');
}
}
@ -177,11 +176,15 @@ send_file($pathname, 'rss.xml', 3600); // Cached by browsers for 1 hour.
* @category rss
*
* @param string $error the error type, default is rsserror
* @param string $filename the name of the file to create (NOT USED)
* @param int $lifetime UNSURE (NOT USED)
* @param string $filename the name of the file to created
* @param int $unused
* @param $statuscode http 1.1 statuscode indicicating the error
* @uses exit
*/
function rss_error($error='rsserror', $filename='rss.xml', $lifetime=0) {
send_file(rss_geterrorxmlfile($error), $filename, $lifetime, false, true);
function rss_error($error='rsserror', $filename='rss.xml', $unused=0, $statuscode='404 Not Found') {
header("HTTP/1.1 $statuscode");
header('Content-Disposition: inline; filename="'.$filename.'"');
header('Content-Type: application/xml');
echo rss_geterrorxmlfile($error);
exit;
}