Skip to content

Commit

Permalink
made multiple.php save to database in addition to $SESSION->modform a…
Browse files Browse the repository at this point in the history
…nd also introduced sesskey
  • Loading branch information
gustav_delius committed Jan 22, 2005
1 parent fc1bc87 commit 010ec02
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions mod/quiz/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1350,6 +1350,7 @@ function quiz_print_cat_question_list($categoryid, $quizselected=true, $recurse=
$randomcount[$i] = $i;
}
echo '<form method="post" action="multiple.php">';
echo "<input type=\"hidden\" name=\"sesskey\" value=\"$USER->sesskey\">";
print_string('addrandom1', 'quiz');
choose_from_menu($randomcount, 'randomcreate', '10', '');
print_string('addrandom2', 'quiz');
Expand Down
10 changes: 7 additions & 3 deletions mod/quiz/multiple.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
require_once('../../config.php');
require_once('locallib.php');

require_variable($category);
$category = required_param('category');

// This script can only be called while editing a quiz

Expand All @@ -29,10 +29,9 @@
}



/// If data submitted, then process and store.

if ($form = data_submitted()) {
if ($form = data_submitted() and confirm_sesskey()) {
if ($form->randomcreate > 0) {
$newquestionids = array(); // this will hold the ids of the random questions

Expand Down Expand Up @@ -91,6 +90,10 @@
$newquestionids = array_merge($questionids, $newquestionids);
$modform->questions = implode(',', $newquestionids);
$SESSION->modform = $modform;
if (!set_field('quiz', 'questions', $modform->questions, 'id', $modform->instance)) {
error('Could not save question list');
}
quiz_questiongrades_update($modform->grades, $modform->instance);
}
redirect('edit.php');
}
Expand Down Expand Up @@ -135,6 +138,7 @@

print_simple_box_start('center', '', $THEME->cellheading);
echo '<form method="POST" action="multiple.php">';
echo "<input type=\"hidden\" name=\"sesskey\" value=\"$USER->sesskey\">";
echo '<table cellpadding="5">';
echo '<tr><td align="right">';
print_string('category', 'quiz');
Expand Down

0 comments on commit 010ec02

Please sign in to comment.