From 2fc29c74ab41a5a9f25c8a5543709acdda87ade2 Mon Sep 17 00:00:00 2001 From: moodler Date: Mon, 5 Mar 2007 05:46:35 +0000 Subject: [PATCH] Fixed a notice when no REFERER was present --- lib/weblib.php | 10 +++++++--- mod/forum/post.php | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/weblib.php b/lib/weblib.php index 73e1a22d3f8..b55816955d0 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -180,12 +180,16 @@ function addslashes_js($var) { } /** - * Returns the URL of the HTTP_REFERER, less the querystring portion + * Returns the URL of the HTTP_REFERER, less the querystring portion if required * @return string */ -function get_referer() { +function get_referer($stripquery=true) { if (isset($_SERVER['HTTP_REFERER'])) { - return strip_querystring($_SERVER['HTTP_REFERER']); + if ($stripquery) { + return strip_querystring($_SERVER['HTTP_REFERER']); + } else { + return $_SERVER['HTTP_REFERER']; + } } else { return ''; } diff --git a/mod/forum/post.php b/mod/forum/post.php index 19951d7f6e6..1d2113aee43 100644 --- a/mod/forum/post.php +++ b/mod/forum/post.php @@ -66,7 +66,7 @@ '', '', true, "", navmenu($course, $cm)); } notice_yesno(get_string('noguestpost', 'forum').'

'.get_string('liketologin'), - $wwwroot, $_SERVER['HTTP_REFERER']); + $wwwroot, get_referer(false)); print_footer($course); exit; }