diff options
| author | Jan-Hendrik Willms <tleilax+github@gmail.com> | 2023-12-20 09:53:37 +0100 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+github@gmail.com> | 2024-04-08 14:26:27 +0200 |
| commit | 8142b3f34ba92644acbcac8f0ec974316db80e10 (patch) | |
| tree | e5b85b8b5dc74f17d8dc2fa863018c12b7553377 /app/controllers/admin/banner.php | |
| parent | bcd76d3c5ac715a33668d4c6611b7be8f11e3404 (diff) | |
implement use image validator service, fixes #3593tic-3593
Diffstat (limited to 'app/controllers/admin/banner.php')
| -rw-r--r-- | app/controllers/admin/banner.php | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/app/controllers/admin/banner.php b/app/controllers/admin/banner.php index 5199bbc..e41eab6 100644 --- a/app/controllers/admin/banner.php +++ b/app/controllers/admin/banner.php @@ -264,17 +264,16 @@ class Admin_BannerController extends AuthenticatedController } //Dateiendung bestimmen - $dot = mb_strrpos($img_name, '.'); - if ($dot) { - $l = mb_strlen($img_name) - $dot; - $ext = mb_strtolower(mb_substr($img_name, $dot + 1, $l)); - } + $ext = pathinfo($img_name, PATHINFO_EXTENSION); + $ext = strtolower($ext); //passende Endung ? - if (!in_array($ext, words('gif jpeg jpg png'))) { - $errors[] = sprintf(_('Der Dateityp der Bilddatei ist falsch (%s).<br>' - .'Es sind nur die Dateiendungen .gif, .png und .jpg erlaubt!') - , htmlReady($ext)); + if (!app(\Studip\Services\ImageValidator::class)->validateName($img_name)) { + $errors[] = sprintf( + _('Der Dateityp der Bilddatei ist falsch (%s).<br>' + .'Es sind nur die Dateiendungen .gif, .png, .jpg und .webp erlaubt!'), + htmlReady($ext) + ); return false; } |
