moodle/course/jumpto.php
poltawski 97ee3e2242 course/jumpto.php MDL-19886 Don't depend on HTTP_REFFER header
thanks to Jordan Tomkinson for the patch, from MOODLE_19_STABLE
2009-08-26 09:52:14 +00:00

28 lines
676 B
PHP

<?php // $Id$
/*
* Jumps to a given relative or Moodle absolute URL.
* Mostly used for accessibility.
*
*/
require('../config.php');
$jump = optional_param('jump', '', PARAM_RAW);
if (!confirm_sesskey()) {
print_error('confirmsesskeybad');
}
if (strpos($jump, $CFG->wwwroot) === 0) { // Anything on this site
redirect(new moodle_url(urldecode($jump)));
} else if (preg_match('/^[a-z]+\.php\?/', $jump)) {
redirect(new moodle_url(urldecode($jump)));
}
if(isset($_SERVER['HTTP_REFERER'])) {
redirect(new moodle_url($_SERVER['HTTP_REFERER'])); // Return to sender, just in case
}
?>