diff options
| author | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2023-03-24 20:45:45 +0000 |
|---|---|---|
| committer | David Siegfried <david.siegfried@uni-vechta.de> | 2023-03-24 20:45:45 +0000 |
| commit | 92683e73396d7a457f8f9e2789cc9612d588c4f5 (patch) | |
| tree | 3a3780b7dbe5790305943b30030fc4acb9c3afc4 /lib | |
| parent | 6721569c1a5325840cac1adfc1b7a80fa183737a (diff) | |
do not open iframe with invalid url and show hint in vue component, fixes #2169, fixes #2168
Closes #2169 and #2168
Merge request studip/studip!1640
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/models/QuestionnaireInfo.php | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/models/QuestionnaireInfo.php b/lib/models/QuestionnaireInfo.php index 0b1493c..ffc09ff 100644 --- a/lib/models/QuestionnaireInfo.php +++ b/lib/models/QuestionnaireInfo.php @@ -63,4 +63,15 @@ class QuestionnaireInfo extends QuestionnaireQuestion implements QuestionType { return []; } + + /** + * Return whether a given url is valid. + * @return bool + */ + public function hasValidURL(): bool + { + return !empty($this->questiondata['url']) + && trim($this->questiondata['url']) + && filter_var($this->questiondata['url'], FILTER_VALIDATE_URL); + } } |
