From 3b3c218b9c868e9f12c54d7670e69d84c9ee79c0 Mon Sep 17 00:00:00 2001 From: Yassine Doghri Date: Thu, 8 Apr 2021 10:45:58 +0000 Subject: [PATCH] fix(episode-form): show warning to set `memory_limit`, `upload_max_filesize` & `post_max_size` remove undefined "my-podcasts" route closes #5, #86 --- app/Config/Routes.php | 4 -- app/Controllers/Admin/Episode.php | 8 ++-- app/Language/en/Episode.php | 2 + app/Language/fr/Episode.php | 2 + app/Views/admin/episode/create.php | 63 ++++++++++++++------------ app/Views/admin/episode/edit.php | 72 ++++++++++++++++-------------- app/Views/admin/podcast/import.php | 9 ++-- 7 files changed, 85 insertions(+), 75 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 2d986c40..4c1fb430 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -90,10 +90,6 @@ $routes->group( 'as' => 'admin', ]); - $routes->get('my-podcasts', 'Podcast::myPodcasts', [ - 'as' => 'my-podcasts', - ]); - $routes->group('persons', function ($routes) { $routes->get('/', 'Person', [ 'as' => 'person-list', diff --git a/app/Controllers/Admin/Episode.php b/app/Controllers/Admin/Episode.php index a2742d48..01c8412f 100644 --- a/app/Controllers/Admin/Episode.php +++ b/app/Controllers/Admin/Episode.php @@ -111,8 +111,8 @@ class Episode extends BaseController 'enclosure' => 'uploaded[enclosure]|ext_in[enclosure,mp3,m4a]', 'image' => 'is_image[image]|ext_in[image,jpg,png]|min_dims[image,1400,1400]|is_image_squared[image]', - 'transcript' => 'ext_in[transcript,txt,html,srt,json]', - 'chapters' => 'ext_in[chapters,json]', + 'transcript' => 'ext_in[transcript,txt,html,srt,json]|permit_empty', + 'chapters' => 'ext_in[chapters,json]|permit_empty', ]; if (!$this->validate($rules)) { @@ -205,8 +205,8 @@ class Episode extends BaseController 'uploaded[enclosure]|ext_in[enclosure,mp3,m4a]|permit_empty', 'image' => 'is_image[image]|ext_in[image,jpg,png]|min_dims[image,1400,1400]|is_image_squared[image]', - 'transcript' => 'ext_in[transcript,txt,html,srt,json]', - 'chapters' => 'ext_in[chapters,json]', + 'transcript' => 'ext_in[transcript,txt,html,srt,json]|permit_empty', + 'chapters' => 'ext_in[chapters,json]|permit_empty', ]; if (!$this->validate($rules)) { diff --git a/app/Language/en/Episode.php b/app/Language/en/Episode.php index 457df6fe..83210875 100644 --- a/app/Language/en/Episode.php +++ b/app/Language/en/Episode.php @@ -43,6 +43,8 @@ return [ 'not_published' => 'Not published', ], 'form' => [ + 'warning' => + 'In case of fatal error, try increasing the `memory_limit`, `upload_max_filesize` and `post_max_size` values in your php configuration file then restart your web server.
These values must be higher than the audio file you wish to upload.', 'enclosure' => 'Audio file', 'enclosure_hint' => 'Choose an .mp3 or .m4a audio file.', 'info_section_title' => 'Episode info', diff --git a/app/Language/fr/Episode.php b/app/Language/fr/Episode.php index f9d38684..a2989f67 100644 --- a/app/Language/fr/Episode.php +++ b/app/Language/fr/Episode.php @@ -43,6 +43,8 @@ return [ 'not_published' => 'Non publié', ], 'form' => [ + 'warning' => + 'En cas d’erreur fatale, essayez d’augmenter les valeurs de `memory_limit`, `upload_max_filesize` et `post_max_size` dans votre fichier de configuration php puis redémarrez votre serveur web.
Les valeurs doivent être plus grandes que le fichier audio que vous souhaitez téléverser.', 'enclosure' => 'Fichier audio', 'enclosure_hint' => 'Sélectionnez un fichier audio .mp3 ou .m4a.', 'info_section_title' => 'Informations épisode', diff --git a/app/Views/admin/episode/create.php b/app/Views/admin/episode/create.php index 37de291c..4d6061c9 100644 --- a/app/Views/admin/episode/create.php +++ b/app/Views/admin/episode/create.php @@ -18,16 +18,21 @@ + + 'enclosure', @@ -43,7 +48,7 @@ 'image', [], lang('Episode.form.image_hint'), - true + true, ) ?> 'image', @@ -53,14 +58,14 @@ 'accept' => '.jpg,.jpeg,.png', ]) ?> 'title', @@ -75,7 +80,7 @@ lang('Episode.form.slug'), 'slug', [], - lang('Episode.form.slug_hint') + lang('Episode.form.slug_hint'), ) ?> 'slug', @@ -118,7 +123,7 @@ 'full', 'name' => 'type', 'class' => 'form-radio-btn'], 'full', - old('type') ? old('type') == 'full' : true + old('type') ? old('type') == 'full' : true, ) ?>