require_login();
- $quizid = optional_param('quizid');
+ $quizid = optional_param('quizid', 0, PARAM_INT);
$strquizzes = get_string('modulenameplural', 'quiz');
$strquiz = get_string('modulename', 'quiz');
/// Now, check for commands on this page and modify variables as necessary
if (isset($_REQUEST['up']) and confirm_sesskey()) { /// Move the given question up a slot
+ $up = optional_param('up', 0, PARAM_INT);
$questions = explode(",", $modform->questions);
if ($up > 0 and isset($questions[$up])) {
$prevkey = ($questions[$up-1] == 0) ? $up-2 : $up-1;
}
if (isset($_REQUEST['down']) and confirm_sesskey()) { /// Move the given question down a slot
+ $down = optional_param('down', 0, PARAM_INT);
$questions = explode(",", $modform->questions);
if ($down < count($questions)) {
$nextkey = ($questions[$down+1] == 0) ? $down+2 : $down+1;
echo "<tr><th colspan=\"3\" nowrap=\"nowrap\" class=\"header\">$strorder</th><th class=\"header\">#</th><th align=\"left\" width=\"100%\" nowrap=\"nowrap\" class=\"header\">$strquestionname</th><th nowrap=\"nowrap\" class=\"header\">$strtype</th><th nowrap=\"nowrap\" class=\"header\">$strgrade</th><th align=\"center\" width=\"60\" nowrap=\"nowrap\" class=\"header\">$straction</th></tr>\n";
foreach ($order as $i => $qnum) {
- if (!$qnum or empty($questions[$qnum])) {
+ if ($qnum and empty($questions[$qnum])) {
continue;
}
// If the questiontype is missing change the question type
- if (!array_key_exists($questions[$qnum]->qtype, $QTYPES)) {
+ if ($qnum and !array_key_exists($questions[$qnum]->qtype, $QTYPES)) {
$questions[$qnum]->qtype = 'missingtype';
}