function isDataInvalid($edit, $questions = null) { $errors = ''; if ($edit['defaulted']) { switch ($defaulted) { case 'us': case 'them': case '': return false; // Ignore other data in cases of default. // Ignore other data in cases of default. default: return 'An invalid value was specified for default.'; } } if (!validate_score_value($edit['score_for'])) { $errors .= '<br>You must enter a valid number for your score.'; } if (!validate_score_value($edit['score_against'])) { $errors .= '<br>You must enter a valid number for your opponent\'s score.'; } if ($questions != null) { $invalid_answers = $questions->answers_invalid(); if ($invalid_answers) { $errors .= $invalid_answers; } } if ($edit['field_report']) { if (preg_match("/</", $edit['field_report'])) { $errors .= '<br>Please do not use the > or < characters in your comment'; } } if (strlen($errors) > 0) { return $errors; } else { return false; } }
function isDataInvalid($edit) { $errors = ""; if ($edit['status'] == 'normal') { if (!validate_score_value($edit['home_score'])) { $errors .= '<br>You must enter a valid number for the home score.'; } if (!validate_score_value($edit['away_score'])) { $errors .= '<br>You must enter a valid number for the away score.'; } } if (strlen($errors) > 0) { return $errors; } else { return false; } }