From 9b758e84db6506584cfdc67bfc4c1976959baf1a Mon Sep 17 00:00:00 2001 From: onli Date: Thu, 13 May 2021 21:26:58 +0200 Subject: [PATCH] fix: Show proper upload media popup when using filter after upload Add the needed parameters to the hidden form used in the media library form so that a reload of the ML after the first upload still crenders the correct ML variant - the one for selecting an image, not the generic --- include/functions_images.inc.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/functions_images.inc.php b/include/functions_images.inc.php index dae2c104..4fb8c864 100644 --- a/include/functions_images.inc.php +++ b/include/functions_images.inc.php @@ -3253,6 +3253,18 @@ function serendipity_showMedia(&$file, &$paths, $url = '', $manage = false, $lin } } + // Add variables to the hidden form, so they persist in the ML popup after an item as been uploaded and the + // form filter gets used + if ($serendipity['GET']['adminAction'] == 'add') { + $target_fields = ['textarea', 'htmltarget', 'filename_only', 'noBanner', 'noSidebar', 'noFooter', 'showMediaToolbar', 'multiselect', 'showUpload']; + foreach ($target_fields as $target_field) { + if (isset($serendipity['GET'][$target_field])) { + $form_hidden .= ' '."\n"; + } + } + $form_hidden .= ' '."\n"; + } + if (!is_object($serendipity['smarty'])) { serendipity_smarty_init(); }