Some robustness fixes
This commit is contained in:
+6
-1
@@ -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
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user