diff --git a/downloads_for_sale.php b/downloads_for_sale.php index 5738b69e4b0c3793f7a2b50d9096961f7a0f6541..d7f6ccf2488733ab211af2e08e308093e13bf2e2 100644 --- a/downloads_for_sale.php +++ b/downloads_for_sale.php @@ -184,16 +184,16 @@ class plgVmCustomDownloads_for_Sale extends vmCustomPlugin { JFactory::getApplication()->enqueueMessage(JText::sprintf('VMCUSTOM_DLSALE_ERROR_MEDIA_NOT_CONFIGURED', $media_id), 'error'); return false; } - flush(); - ob_flush(); + if (!is_file($media->file_url) || !is_readable($media->file_url)) { + JFactory::getApplication()->enqueueMessage(JText::sprintf('VMCUSTOM_DLSALE_ERROR_NO_FILE_SET', $media_id, $media->file_url), 'error'); + return false; + } header("Content-Type: " . $media->file_mimetype); header("Content-Disposition: attachment; filename=\"".JFile::getName($media->file_url)."\""); + header("Content-Length: ".filesize($media->file_url)); if (@$this->readfile_chunked($media->file_url)) { return true; } else { - header_remove("Content-Type"); - header_remove("Content-Disposition"); - JFactory::getApplication()->enqueueMessage(JText::sprintf('VMCUSTOM_DLSALE_ERROR_NO_FILE_SET', $media_id, $media->file_url), 'error'); return false; } } else { diff --git a/downloads_for_sale/tmpl/product_compact.php b/downloads_for_sale/tmpl/product_compact.php index b96ef00bac9afc1038dc75e7f538bdbeaf46ac31..ec4758f458829fbe07d9fd54fc535690adbdf6ab 100644 --- a/downloads_for_sale/tmpl/product_compact.php +++ b/downloads_for_sale/tmpl/product_compact.php @@ -11,4 +11,4 @@ defined('_JEXEC') or die(); ?> -<p><img style="vertical-align:middle; display: inline;" src="<?php echo JURI::root().VMDLSALE_PLUGINWEBROOT.'/downloads_for_sale/assets/download_small.png'; ?>" alt=""/> <a href="<?php echo $viewData[0]; ?>"><?php echo $viewData[2]->file_title; ?></a></p> +<p><img style="vertical-align:middle; display: inline;" src="<?php echo JURI::root().VMDLSALE_PLUGINWEBROOT.'/downloads_for_sale/assets/download_small.png'; ?>" alt=""/> <a href="<?php echo $viewData[0]; ?>"><?php echo $viewData[2]->file_title; ?></a></p> diff --git a/releases/plg_vmcustom_downloads_for_sale_v1.5.4.zip b/releases/plg_vmcustom_downloads_for_sale_v1.5.4.zip index 019ca0909ab9bc5e8e84b078318e9ddfce9237d1..61d87f92a084c4ea51b262c0575b3a30088716c7 100644 Binary files a/releases/plg_vmcustom_downloads_for_sale_v1.5.4.zip and b/releases/plg_vmcustom_downloads_for_sale_v1.5.4.zip differ