}
if (isset($_REQUEST['savechanges']) and confirm_sesskey()) {
+ $savequizid = required_param('savequizid', PARAM_INT);
+ if ($modform->id != $savequizid) {
+ error("Error saving quiz settings, please do not change two quizes from the same browser", $CFG->wwwroot.'/mod/quiz/edit.php?quizid='.$savequizid);
+ }
/// We need to save the new ordering (if given) and the new grades
$oldquestions = explode(",", $modform->questions); // the questions in the old order
$questions = array(); // for questions in the new order
echo '<td width="50">Page break</td>';
echo '<td><hr noshade="noshade" /></td><td width="45">';
if ($count > 1) {
- echo "<a title=\"$strmoveup\" href=\"edit.php?up=$count&sesskey=$USER->sesskey\"><img
+ echo "<a title=\"$strmoveup\" href=\"edit.php?up=$count&quizid=$quiz->id&sesskey=$USER->sesskey\"><img
src=\"$CFG->pixpath/t/up.gif\" border=\"0\" alt=\"$strmoveup\" /></a>";
}
echo ' ';
if ($count < $lastindex) {
- echo "<a title=\"$strmovedown\" href=\"edit.php?down=$count&sesskey=$USER->sesskey\"><img
+ echo "<a title=\"$strmovedown\" href=\"edit.php?down=$count&quizid=$quiz->id&sesskey=$USER->sesskey\"><img
src=\"$CFG->pixpath/t/down.gif\" border=\"0\" alt=\"$strmovedown\" /></a>";
- echo "<a title=\"$strremove\" href=\"edit.php?delete=$count&sesskey=$USER->sesskey\">
+ echo "<a title=\"$strremove\" href=\"edit.php?delete=$count&quizid=$quiz->id&sesskey=$USER->sesskey\">
<img src=\"$CFG->pixpath/t/delete.gif\" border=\"0\" alt=\"$strremove\" /></a>";
}
echo '</td></tr></table></td>';
echo "<td>";
if ($count != 0) {
- echo "<a title=\"$strmoveup\" href=\"edit.php?up=$count&sesskey=$USER->sesskey\"><img
+ echo "<a title=\"$strmoveup\" href=\"edit.php?up=$count&quizid=$quiz->id&sesskey=$USER->sesskey\"><img
src=\"$CFG->pixpath/t/up.gif\" border=\"0\" alt=\"$strmoveup\" /></a>";
}
echo "</td>";
echo "<td>";
if ($count < $lastindex-1) {
- echo "<a title=\"$strmovedown\" href=\"edit.php?down=$count&sesskey=$USER->sesskey\"><img
+ echo "<a title=\"$strmovedown\" href=\"edit.php?down=$count&quizid=$quiz->id&sesskey=$USER->sesskey\"><img
src=\"$CFG->pixpath/t/down.gif\" border=\"0\" alt=\"$strmovedown\" /></a>";
}
echo "</td>";
<img src=\"$CFG->pixpath/t/edit.gif\" border=\"0\" alt=\"$stredit\" /></a>";
}
if ($allowdelete) {
- echo "<a title=\"$strremove\" href=\"edit.php?delete=$count&sesskey=$USER->sesskey\">
+ echo "<a title=\"$strremove\" href=\"edit.php?delete=$count&quizid=$quiz->id&sesskey=$USER->sesskey\">
<img src=\"$CFG->pixpath/t/removeright.gif\" border=\"0\" alt=\"$strremove\" /></a>";
}
echo '<div align="center"><input type="submit" value="'.get_string('savechanges').'" />';
echo '<input type="hidden" name="savechanges" value="save" /></div>';
+ echo '<input type="hidden" name="savequizid" value="'.$quiz->id.'" /></div>'; // ugly hack to prevent modform session "mistakes"
print_simple_box_end();
echo "</form>\n";
foreach ($questions as $question) {
echo "<tr>\n<td nowrap=\"nowrap\">\n";
if ($quizid) {
- echo "<a title=\"$straddtoquiz\" href=\"edit.php?addquestion=$question->id&sesskey=$USER->sesskey\"><img
+ echo "<a title=\"$straddtoquiz\" href=\"edit.php?addquestion=$question->id&quizid=$quizid&sesskey=$USER->sesskey\"><img
src=\"$CFG->pixpath/t/moveleft.gif\" border=\"0\" alt=\"$straddtoquiz\" /></a> ";
}
echo "<a title=\"$strpreview\" href=\"javascript:void();\" onClick=\"openpopup('/question/preview.php?id=$question->id&quizid=$quizid','$strpreview','scrollbars=yes,resizable=yes,width=700,height=480', false)\"><img