1
0
mirror of https://github.com/moodle/moodle.git synced 2025-04-24 18:04:43 +02:00

MDL-37411 Notes: unset courseid and userid when updating the note to prevent accidental changes. Thank you Sam Hemelryk for suggesting an alternative solution.

This commit is contained in:
Rossiani Wijaya 2013-03-05 15:17:11 +08:00 committed by Sam Hemelryk
parent 88906d068d
commit 6a9235c998

@ -70,6 +70,12 @@ if ($noteform->is_cancelled()) {
/// if data was submitted and validated, then save it to database
if ($note = $noteform->get_data()){
if ($noteid) {
// A noteid has been used, we don't allow editing of course or user so
// lets unset them to be sure we never change that by accident.
unset($note->courseid);
unset($note->userid);
}
note_save($note);
// redirect to notes list that contains this note
redirect($CFG->wwwroot . '/notes/index.php?course=' . $note->courseid . '&user=' . $note->userid);