From 6a690b255b6c7c21778ee04f581e0ab688f602a1 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Fri, 15 Nov 2013 12:20:10 +0100 Subject: [PATCH] [-] BO : Model return html error messagae instead of json while image uploading --- classes/FileUploader.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/classes/FileUploader.php b/classes/FileUploader.php index 9c3758244..695217189 100755 --- a/classes/FileUploader.php +++ b/classes/FileUploader.php @@ -105,8 +105,10 @@ class QqUploadedFileForm $legends = Tools::getValue('legend'); if (is_array($legends)) foreach ($legends as $key => $legend) - if (!empty($legend)) + if (!empty($legend) && Validate::isGenericName($legend)) $image->legend[(int)$key] = $legend; + else + return array('error' => sprintf(Tools::displayError('Error on image legend "%1s." is not a valid legend.'), Tools::safeOutput($legend))); if (!Image::getCover($image->id_product)) $image->cover = 1; else @@ -192,8 +194,10 @@ class QqUploadedFileXhr $legends = Tools::getValue('legend'); if (is_array($legends)) foreach ($legends as $key => $legend) - if (!empty($legend)) + if (!empty($legend) && Validate::isGenericName($legend)) $image->legend[(int)$key] = $legend; + else + return array('error' => sprintf(Tools::displayError('Error on image legend "%1s." is not a valid legend.'), Tools::safeOutput($legend))); if (!Image::getCover($image->id_product)) $image->cover = 1; else