Skip to content

Commit

Permalink
redirect MDL-20546 Set page type to embedded to avoid ever printing h…
Browse files Browse the repository at this point in the history
…eader/blocks/footer on redirects
  • Loading branch information
moodler committed Oct 13, 2009
1 parent b3a8a88 commit 8449364
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/weblib.php
Original file line number Diff line number Diff line change
Expand Up @@ -2717,7 +2717,7 @@ function notice ($message, $link='', $course=NULL) {
* @return void
*/
function redirect($url, $message='', $delay=-1) {
global $OUTPUT, $SESSION, $CFG;
global $OUTPUT, $PAGE, $SESSION, $CFG;

if ($url instanceof moodle_url) {
$url = $url->out(false, array(), false);
Expand Down Expand Up @@ -2781,6 +2781,7 @@ function redirect($url, $message='', $delay=-1) {
}

// Include a redirect message, even with a HTTP redirect, because that is recommended practice.
$PAGE->set_generaltype('embedded'); // No header and footer needed
$CFG->docroot = false; // to prevent the link to moodle docs from being displayed on redirect page.
echo $OUTPUT->redirect_message($encodedurl, $message, $delay, $debugdisableredirect);
exit;
Expand Down

0 comments on commit 8449364

Please sign in to comment.