Merge branch 'MDL-73427-311' of https://github.com/cameron1729/moodle into MOODLE_311_STABLE
This commit is contained in:
@@ -2727,11 +2727,6 @@ function require_login($courseorid = null, $autologinguest = true, $cm = null, $
|
||||
$SESSION->wantsurl = qualified_me();
|
||||
}
|
||||
|
||||
$referer = get_local_referer(false);
|
||||
if (!empty($referer)) {
|
||||
$SESSION->fromurl = $referer;
|
||||
}
|
||||
|
||||
// Give auth plugins an opportunity to authenticate or redirect to an external login page
|
||||
$authsequence = get_enabled_auth_plugins(); // Auths, in sequence.
|
||||
foreach($authsequence as $authname) {
|
||||
|
||||
+1
-6
@@ -588,12 +588,7 @@ function get_exception_info($ex) {
|
||||
$moreinfourl = $errordoclink . 'error/' . $modulelink . '/' . $errorcode;
|
||||
|
||||
if (empty($link)) {
|
||||
if (!empty($SESSION->fromurl)) {
|
||||
$link = $SESSION->fromurl;
|
||||
unset($SESSION->fromurl);
|
||||
} else {
|
||||
$link = $CFG->wwwroot .'/';
|
||||
}
|
||||
$link = get_local_referer(false) ?: ($CFG->wwwroot . '/');
|
||||
}
|
||||
|
||||
// When printing an error the continue button should never link offsite.
|
||||
|
||||
@@ -412,32 +412,6 @@ class core_setuplib_testcase extends advanced_testcase {
|
||||
$exception = new moodle_exception('none', 'error', $url);
|
||||
$infos = $this->get_exception_info($exception);
|
||||
$this->assertSame($CFG->wwwroot . '/', $infos->link);
|
||||
|
||||
// Internal link from fromurl.
|
||||
$SESSION->fromurl = $url = $CFG->wwwroot . '/something/here?really=yes';
|
||||
$exception = new moodle_exception('none');
|
||||
$infos = $this->get_exception_info($exception);
|
||||
$this->assertSame($url, $infos->link);
|
||||
|
||||
// Internal HTTPS link from fromurl.
|
||||
$SESSION->fromurl = $url = $httpswwwroot . '/something/here?really=yes';
|
||||
$exception = new moodle_exception('none');
|
||||
$infos = $this->get_exception_info($exception);
|
||||
$this->assertSame($url, $infos->link);
|
||||
|
||||
// External link from fromurl.
|
||||
$SESSION->fromurl = 'http://moodle.org/something/here?really=yes';
|
||||
$exception = new moodle_exception('none');
|
||||
$infos = $this->get_exception_info($exception);
|
||||
$this->assertSame($CFG->wwwroot . '/', $infos->link);
|
||||
|
||||
// External HTTPS link from fromurl.
|
||||
$SESSION->fromurl = 'https://moodle.org/something/here?really=yes';
|
||||
$exception = new moodle_exception('none');
|
||||
$infos = $this->get_exception_info($exception);
|
||||
$this->assertSame($CFG->wwwroot . '/', $infos->link);
|
||||
|
||||
$SESSION->fromurl = '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-7
@@ -160,8 +160,6 @@ if (!empty($forum)) {
|
||||
);
|
||||
}
|
||||
|
||||
$SESSION->fromurl = get_local_referer(false);
|
||||
|
||||
// Load up the $post variable.
|
||||
|
||||
$post = new stdClass();
|
||||
@@ -780,11 +778,7 @@ if ($mformpost->is_cancelled()) {
|
||||
}
|
||||
} else if ($mformpost->is_submitted() && !$mformpost->no_submit_button_pressed() && $fromform = $mformpost->get_data()) {
|
||||
|
||||
if (empty($SESSION->fromurl)) {
|
||||
$errordestination = $urlfactory->get_forum_view_url_from_forum($forumentity);
|
||||
} else {
|
||||
$errordestination = $SESSION->fromurl;
|
||||
}
|
||||
$errordestination = get_local_referer(false) ?: $urlfactory->get_forum_view_url_from_forum($forumentity);
|
||||
|
||||
$fromform->itemid = $fromform->message['itemid'];
|
||||
$fromform->messageformat = $fromform->message['format'];
|
||||
|
||||
Reference in New Issue
Block a user