moodlelib: MDL-20702 New require_sesskey function.

Backported from head.
This commit is contained in:
Tim Hunt
2009-11-02 16:50:26 +00:00
parent dff5e4d153
commit 2fb0138721
+10
View File
@@ -1603,6 +1603,16 @@ function confirm_sesskey($sesskey=NULL) {
return ($USER->sesskey === $sesskey);
}
/**
* Check the session key using {@link confirm_sesskey()},
* and cause a fatal error if it does not match.
*/
function require_sesskey() {
if (!confirm_sesskey()) {
print_error('invalidsesskey');
}
}
/**
* Setup all global $CFG course variables, set locale and also themes
* This function can be used on pages that do not require login instead of require_login()