Do not allow '0' as a value for width or height in QR code (#321)

This commit is contained in:
Mark Nelson 2020-03-09 14:48:24 +01:00
parent 4e9421c6f9
commit d007e56589

View file

@ -72,8 +72,12 @@ class element extends \mod_customcert\element {
$errors = []; $errors = [];
// Check if height is not set, or not numeric or less than 0. // Check if height is not set, or not numeric or less than 0.
if ((!isset($data['height'])) || (!is_numeric($data['height'])) || ($data['height'] < 0)) { if ((!isset($data['height'])) || (!is_numeric($data['height'])) || ($data['height'] <= 0)) {
$errors['height'] = get_string('invalidheight', 'customcertelement_qrcode'); $errors['height'] = get_string('invalidheight', 'mod_customcert');
}
if ((!isset($data['width'])) || (!is_numeric($data['width'])) || ($data['width'] <= 0)) {
$errors['width'] = get_string('invalidwidth', 'mod_customcert');
} }
if ($this->showposxy) { if ($this->showposxy) {