Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge branch 'MDL-64010-master' of git://github.com/abgreeve/moodle
- Loading branch information
Showing
with
25 additions
and
0 deletions.
-
+15
−0
badges/competency_form.php
-
+4
−0
badges/edit_form.php
-
+6
−0
badges/endorsement_form.php
|
@@ -76,4 +76,19 @@ public function definition() { |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
/** |
|
|
* Validate the data from the form. |
|
|
* |
|
|
* @param array $data form data |
|
|
* @param array $files form files |
|
|
* @return array An array of error messages. |
|
|
*/ |
|
|
public function validation($data, $files) { |
|
|
$errors = parent::validation($data, $files); |
|
|
if (!empty($data['targeturl']) && !preg_match('@^https?://.+@', $data['targeturl'])) { |
|
|
$errors['targeturl'] = get_string('invalidurl', 'badges'); |
|
|
} |
|
|
return $errors; |
|
|
} |
|
|
}
|
|
@@ -211,6 +211,10 @@ public function validation($data, $files) { |
|
|
$errors['name'] = get_string('error:duplicatename', 'badges'); |
|
|
} |
|
|
|
|
|
if ($data['imageauthorurl'] && !preg_match('@^https?://.+@', $data['imageauthorurl'])) { |
|
|
$errors['imageauthorurl'] = get_string('invalidurl', 'badges'); |
|
|
} |
|
|
|
|
|
return $errors; |
|
|
} |
|
|
} |
|
|
|
@@ -86,6 +86,12 @@ public function validation($data, $files) { |
|
|
if ($data['issueremail'] && !validate_email($data['issueremail'])) { |
|
|
$errors['issueremail'] = get_string('invalidemail'); |
|
|
} |
|
|
if ($data['issuerurl'] && !preg_match('@^https?://.+@', $data['issuerurl'])) { |
|
|
$errors['issuerurl'] = get_string('invalidurl', 'badges'); |
|
|
} |
|
|
if ($data['claimid'] && !preg_match('@^https?://.+@', $data['claimid'])) { |
|
|
$errors['claimid'] = get_string('invalidurl', 'badges'); |
|
|
} |
|
|
return $errors; |
|
|
} |
|
|
}
|