From 27f447e0294d6532276aa02b3918676b0c9c243e Mon Sep 17 00:00:00 2001
From: Reinhold Kainhofer <reinhold@kainhofer.com>
Date: Wed, 27 Feb 2013 12:38:39 +0100
Subject: [PATCH] Better error message when download file is unavailable

---
 Makefile                                                 | 2 +-
 downloads_for_sale.php                                   | 4 ++--
 downloads_for_sale.xml                                   | 2 +-
 language/de-DE/de-DE.plg_vmcustom_downloads_for_sale.ini | 3 ++-
 language/en-GB/en-GB.plg_vmcustom_downloads_for_sale.ini | 3 ++-
 5 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index 5f96a18..c7cc0e5 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 BASE=downloads_for_sale
 PLUGINTYPE=vmcustom
-VERSION=1.2
+VERSION=1.3
 
 PLUGINFILES=$(BASE).php $(BASE).script.php $(BASE).xml index.html
 
diff --git a/downloads_for_sale.php b/downloads_for_sale.php
index 322553c..592f526 100644
--- a/downloads_for_sale.php
+++ b/downloads_for_sale.php
@@ -148,7 +148,7 @@ class plgVmCustomDownloads_for_Sale extends vmCustomPlugin {
 			jimport('joomla.filesystem.file');
 			$media = $this->getDownloadFile($media_id);
 			if (!$media) {
-				JFactory::getApplication()->enqueueMessage(JText::_('VMCUSTOM_DLSALE_ERROR_NO_FILE_SET'), 'error');
+				JFactory::getApplication()->enqueueMessage(JText::sprintf('VMCUSTOM_DLSALE_ERROR_MEDIA_NOT_CONFIGURED', $media_id), 'error');
 				return false;
 			}
 			header("Content-Type: " . $media->file_mimetype);
@@ -156,7 +156,7 @@ class plgVmCustomDownloads_for_Sale extends vmCustomPlugin {
 			if (!@readfile($media->file_url)) {
 				header_remove("Content-Type");
 				header_remove("Content-Disposition");
-				JFactory::getApplication()->enqueueMessage(JText::_('VMCUSTOM_DLSALE_ERROR_NO_FILE_SET'), 'error');
+				JFactory::getApplication()->enqueueMessage(JText::sprintf('VMCUSTOM_DLSALE_ERROR_NO_FILE_SET', $media_id, $media->file_url), 'error');
 				return false;
 			}
 			JExit();
diff --git a/downloads_for_sale.xml b/downloads_for_sale.xml
index 74c8793..872fd7b 100644
--- a/downloads_for_sale.xml
+++ b/downloads_for_sale.xml
@@ -6,7 +6,7 @@
     <authorUrl>http://www.kainhofer.com/</authorUrl>
     <copyright>Copyright (C) 2013 Reinhold Kainhofer. All rights reserved.</copyright>
     <license>http://www.gnu.org/licenses/gpl.html GNU/GPL v3+</license>
-    <version>1.2.0</version>
+    <version>1.3.0</version>
     <description>VMCUSTOM_DLSALE_DESC</description>
     <files>
         <filename plugin="downloads_for_sale">downloads_for_sale.php</filename>
diff --git a/language/de-DE/de-DE.plg_vmcustom_downloads_for_sale.ini b/language/de-DE/de-DE.plg_vmcustom_downloads_for_sale.ini
index 2aa1f75..b68221f 100644
--- a/language/de-DE/de-DE.plg_vmcustom_downloads_for_sale.ini
+++ b/language/de-DE/de-DE.plg_vmcustom_downloads_for_sale.ini
@@ -26,7 +26,8 @@ VMCUSTOM_DLSALE_DOWNLOAD_FILE="Datei zum Download"
 VMCUSTOM_DLSALE_ERROR_NOT_AUTHORIZED="Nicht zum Download authorisiert. Bitte loggen Sie sich als entsprechender Benutzer ein."
 VMCUSTOM_DLSALE_ERROR_CUSTOMFIELDID="Benutzerfeld-ID fehlt in der URL."
 VMCUSTOM_DLSALE_ERROR_LOAD_FAILURE="Konnte Benutzerfeld-Daten nicht laden."
-VMCUSTOM_DLSALE_ERROR_NO_FILE_SET="Mediendatei ist nicht verfügbar."
+VMCUSTOM_DLSALE_ERROR_MEDIA_NOT_CONFIGURED="Mediendatei nicht konfiguriert (ID=%s)."
+VMCUSTOM_DLSALE_ERROR_NO_FILE_SET="Mediendatei ist nicht verfügbar (ID=%s)."
 VMCUSTOM_DLSALE_ERROR_ORDER_NOT_FOUND="Konnte die Bestellungsinformationen nicht in der Datenbank finden."
 VMCUSTOM_DLSALE_ERROR_WRONG_PASSWD="Ungültige Bestellungsnummer und/oder Passwort."
 VMCUSTOM_DLSALE_ERROR_STATUS_NOT_AUTHORIZED="Bestellungsstatus erlaubt keinen Download."
diff --git a/language/en-GB/en-GB.plg_vmcustom_downloads_for_sale.ini b/language/en-GB/en-GB.plg_vmcustom_downloads_for_sale.ini
index f713c63..00db471 100644
--- a/language/en-GB/en-GB.plg_vmcustom_downloads_for_sale.ini
+++ b/language/en-GB/en-GB.plg_vmcustom_downloads_for_sale.ini
@@ -26,7 +26,8 @@ VMCUSTOM_DLSALE_DOWNLOAD_FILE="Download file"
 VMCUSTOM_DLSALE_ERROR_NOT_AUTHORIZED="Not authorized to download. Please log in."
 VMCUSTOM_DLSALE_ERROR_CUSTOMFIELDID="Custom field ID missing in the URL."
 VMCUSTOM_DLSALE_ERROR_LOAD_FAILURE="Unable to load custom field data."
-VMCUSTOM_DLSALE_ERROR_NO_FILE_SET="Media file is not available."
+VMCUSTOM_DLSALE_ERROR_MEDIA_NOT_CONFIGURED="Media file not configured (ID=%s)."
+VMCUSTOM_DLSALE_ERROR_NO_FILE_SET="Media file is not available (ID=%s, path=%s)."
 VMCUSTOM_DLSALE_ERROR_ORDER_NOT_FOUND="Unable to find order data in database."
 VMCUSTOM_DLSALE_ERROR_WRONG_PASSWD="Invalid combination of order number and password."
 VMCUSTOM_DLSALE_ERROR_STATUS_NOT_AUTHORIZED="Order status does not allow download."
-- 
GitLab