Some robustness fixes

This commit is contained in:
moodler
2003-01-23 02:50:38 +00:00
parent 878ece7eca
commit 48d38fad63
2 changed files with 8 additions and 3 deletions
+6 -1
View File
@@ -1066,8 +1066,13 @@ function forum_set_return() {
global $CFG, $SESSION;
if (! isset($SESSION->fromdiscussion)) {
if (!empty($_SERVER['HTTP_REFERER'])) {
$referer = $_SERVER['HTTP_REFERER'];
} else {
$referer = "";
}
// If the referer is NOT a login screen then save it.
if (! strncasecmp("$CFG->wwwroot/login", $_SERVER["HTTP_REFERER"], 300)) {
if (! strncasecmp("$CFG->wwwroot/login", $referer, 300)) {
$SESSION->fromdiscussion = $_SERVER["HTTP_REFERER"];
save_session("SESSION");
}
+2 -2
View File
@@ -10,6 +10,8 @@
error(get_string("noguestpost", "forum"), $_SERVER["HTTP_REFERER"]);
}
require_login(); // Script is useless unless they're logged in
if ($post = data_submitted()) {
$post->subject = strip_tags($post->subject); // Strip all tags
@@ -21,8 +23,6 @@
error(get_string("emptymessage", "forum"));
}
require_login();
if ($post->edit) { // Updating a post
$post->id = $post->edit;
if (forum_update_post($post)) {