mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
Merge branch 'MDL-49360-master' of git://github.com/lameze/moodle
This commit is contained in:
commit
5dee13ee92
20 changed files with 72 additions and 51 deletions
|
@ -216,6 +216,25 @@ function is_https() {
|
|||
return (strpos($CFG->httpswwwroot, 'https://') === 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the cleaned local URL of the HTTP_REFERER less the URL query string parameters if required.
|
||||
*
|
||||
* @param bool $stripquery if true, also removes the query part of the url.
|
||||
* @return string The resulting referer or empty string.
|
||||
*/
|
||||
function get_local_referer($stripquery = true) {
|
||||
if (isset($_SERVER['HTTP_REFERER'])) {
|
||||
$referer = clean_param($_SERVER['HTTP_REFERER'], PARAM_LOCALURL);
|
||||
if ($stripquery) {
|
||||
return strip_querystring($referer);
|
||||
} else {
|
||||
return $referer;
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for creating and manipulating urls.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue