Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix notices: MDL-15974 Some systems that were upgraded have nullable …

…columns, leading to notices

A new install has NOT NULL DEFAULT 0.
  • Loading branch information...
commit 3ac1efe7fc4cc3dad6c9cbc30e727d1e2faf0a40 1 parent 2207d52
tjhunt authored
View
12 mod/quiz/attempt.php
@@ -118,12 +118,12 @@
$numberofpreviousattempts = count_records_select('quiz_attempts', "quiz = '{$quiz->id}' AND " .
"userid = '{$USER->id}' AND timefinish > 0 AND preview != 1");
- if ($quiz->attempts and $numberofpreviousattempts >= $quiz->attempts) {
+ if (!empty($quiz->attempts) and $numberofpreviousattempts >= $quiz->attempts) {
error(get_string('nomoreattempts', 'quiz'), "view.php?id={$cm->id}");
}
/// Check subnet access
- if ($quiz->subnet and !address_in_subnet(getremoteaddr(), $quiz->subnet)) {
+ if (!empty($quiz->subnet) and !address_in_subnet(getremoteaddr(), $quiz->subnet)) {
if ($isteacher) {
notify(get_string('subnetnotice', 'quiz'));
} else {
@@ -132,7 +132,7 @@
}
/// Check password access
- if ($quiz->password and empty($_POST['q'])) {
+ if (!empty($quiz->password) and empty($_POST['q'])) {
if (empty($_POST['quizpassword'])) {
if (trim(strip_tags($quiz->intro))) {
@@ -165,7 +165,7 @@
}
}
- if ($quiz->delay1 or $quiz->delay2) {
+ if (!empty($quiz->delay1) or !empty($quiz->delay2)) {
//quiz enforced time delay
if ($attempts = quiz_get_user_attempts($quiz->id, $USER->id)) {
$numattempts = count($attempts);
@@ -177,11 +177,11 @@
if ($lastattempt_obj) {
$lastattempt = $lastattempt_obj->timefinish;
}
- if ($numattempts == 1 && $quiz->delay1) {
+ if ($numattempts == 1 && !empty($quiz->delay1)) {
if ($timenow - $quiz->delay1 < $lastattempt) {
error(get_string('timedelay', 'quiz'), 'view.php?q='.$quiz->id);
}
- } else if($numattempts > 1 && $quiz->delay2) {
+ } else if($numattempts > 1 && !empty($quiz->delay2)) {
if ($timenow - $quiz->delay2 < $lastattempt) {
error(get_string('timedelay', 'quiz'), 'view.php?q='.$quiz->id);
}
View
2  question/type/multichoice/questiontype.php
@@ -164,7 +164,7 @@ function create_session_and_responses(&$question, &$state, $cmoptions, $attempt)
$answerids = array_values(array_map(create_function('$val',
'return $val->id;'), $question->options->answers));
// Shuffle the answers if required
- if ($cmoptions->shuffleanswers and $question->options->shuffleanswers) {
+ if (!empty($cmoptions->shuffleanswers) and !empty($question->options->shuffleanswers)) {
$answerids = swapshuffle($answerids);
}
$state->options->order = $answerids;

0 comments on commit 3ac1efe

Please sign in to comment.
Something went wrong with that request. Please try again.