moodlelib: MDL-20702 New require_sesskey function.
Backported from head.
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user