diff --git a/core/lib/Thelia/Config/I18n/en_US.php b/core/lib/Thelia/Config/I18n/en_US.php
index c2e166df4..79efadfe9 100644
--- a/core/lib/Thelia/Config/I18n/en_US.php
+++ b/core/lib/Thelia/Config/I18n/en_US.php
@@ -34,6 +34,7 @@ return array(
'All shipping methods' => 'All shipping methods',
'Alpha code 2 *' => 'Alpha code 2 *',
'Alpha code 3 *' => 'Alpha code 3 *',
+ 'An error occurred while reading the file %file' => 'An error occurred while reading the file %file',
'Apply exchange rates on price in %sym' => 'Apply exchange rates on price in %sym',
'At least one of cart products categories is %op% %categories_list%' => 'At least one of cart products categories is %op% %categories_list%',
'Attribute ID:Attribute AV ID' => 'Attribute ID:Attribute AV ID',
@@ -112,6 +113,7 @@ return array(
'Fax' => 'Fax',
'Feature value does not match FLOAT format' => 'Feature value does not match FLOAT format',
'File is too large, please retry with a file having a size less than %size%.' => 'File is too large, please retry with a file having a size less than %size%.',
+ 'Files with the following mime type are not allowed: %type, please do an archive of the file if you want to upload it' => 'Files with the following mime type are not allowed: %type, please do an archive of the file if you want to upload it',
'First Name' => 'First Name',
'Firstname' => 'Firstname',
'Fixed Amount Discount' => 'Fixed Amount Discount',
@@ -307,8 +309,10 @@ return array(
'The coupon applies to the selected delivery countries' => 'Ce code promo s\'applique seulement aux pays de facturation sélectionnés',
'The coupon is valid after a given date' => 'Le code promo est valide seulement à partir d\'une certaine date',
'The detailed description.' => 'The detailed description.',
+ 'The file %file could not be opened' => 'The file %file could not be opened',
'The image which replaces an undefined country flag (%file) was not found. Please check unknown-flag-path configuration variable, and check that the image exists.' => 'The image which replaces an undefined country flag (%file) was not found. Please check unknown-flag-path configuration variable, and check that the image exists.',
'The loop name \'%name\' is already defined in %className class' => 'The loop name \'%name\' is already defined in %className class',
+ 'There\'s a conflict between your file extension "%ext" and the mime type "%mime"' => 'There\'s a conflict between your file extension "%ext" and the mime type "%mime"',
'This brand is online' => 'This brand is online',
'This category is online.' => 'This category is online.',
'This condition is always true' => 'This condition is always true',
diff --git a/core/lib/Thelia/Config/I18n/fr_FR.php b/core/lib/Thelia/Config/I18n/fr_FR.php
index 12113b8c2..10dd0a841 100644
--- a/core/lib/Thelia/Config/I18n/fr_FR.php
+++ b/core/lib/Thelia/Config/I18n/fr_FR.php
@@ -34,6 +34,7 @@ return array(
'All shipping methods' => 'Tous les modes de livraison',
'Alpha code 2 *' => 'Code Alpha 2 *',
'Alpha code 3 *' => 'Code Alpha 3 *',
+ 'An error occurred while reading the file %file' => 'Une erreur s\'est produite pendant la lecture du fichier %file ',
'Apply exchange rates on price in %sym' => 'Appliquer le taux de change sur le prix en %sym',
'At least one of cart products categories is %op% %categories_list%' => 'Au moins une des catégories des produits présents dans le panier %op% %categories_list% ',
'Attribute ID:Attribute AV ID' => 'Déclinaison ID : Valeur de déclinaison ID',
@@ -112,6 +113,7 @@ return array(
'Fax' => 'Fax',
'Feature value does not match FLOAT format' => 'valeur de caractéristique n\'est pas un FLOAT',
'File is too large, please retry with a file having a size less than %size%.' => 'La taille de ce fichier est trop importante. Merci d\'envoyer des fichier dont la taille est inférieure à %size%.',
+ 'Files with the following mime type are not allowed: %type, please do an archive of the file if you want to upload it' => 'Les fichiers avec le type mieme: %type ne sont pas authorisés, veuillez en faire une archive avant de l\'envoyer',
'First Name' => 'Prénom',
'Firstname' => 'Prénom',
'Fixed Amount Discount' => 'Remise d\'un montant fixe',
@@ -307,8 +309,10 @@ return array(
'The coupon applies to the selected delivery countries' => 'Ce code promo s\'applique pour les pays de livraison sélectionnés',
'The coupon is valid after a given date' => 'Le code promo est valide à partir de cette date',
'The detailed description.' => 'La description détaillée',
+ 'The file %file could not be opened' => 'Le fichier %file n\'a pas pu être ouvert',
'The image which replaces an undefined country flag (%file) was not found. Please check unknown-flag-path configuration variable, and check that the image exists.' => 'L\'image qui remplace un drapeau de pays manquant (%file) n\'a pas été trouvée. Merci de vérifier la variable de configuration unknown-flag-path.',
'The loop name \'%name\' is already defined in %className class' => 'La boucle \'%name\' est déjà définir dans la classe %className',
+ 'There\'s a conflict between your file extension "%ext" and the mime type "%mime"' => 'Il y a un conflit entre l\'extension "%ext" et le type mome "%mime" ',
'This brand is online' => 'Cette marque est en ligne',
'This category is online.' => 'Cette catégorie est en ligne.',
'This condition is always true' => 'Cette condition est troujours vérifiée',
diff --git a/core/lib/Thelia/Tests/Tools/MimeTypesToolsTest.php b/core/lib/Thelia/Tests/Tools/MimeTypesToolsTest.php
index e52e8c809..d818d0be8 100644
--- a/core/lib/Thelia/Tests/Tools/MimeTypesToolsTest.php
+++ b/core/lib/Thelia/Tests/Tools/MimeTypesToolsTest.php
@@ -112,5 +112,11 @@ class MimeTypesToolsTest extends \PHPUnit_Framework_TestCase
$this->tool->validateMimeTypeExtension(
"thismimetype/doesntexists", "foo.bar"
));
+
+ $this->assertEquals(
+ MimeTypeTools::TYPE_UNKNOWN,
+ $this->tool->validateMimeTypeExtension(
+ "text/x-php", "foo.php"
+ ));
}
}
diff --git a/core/lib/Thelia/Tools/MimeTypeTools.php b/core/lib/Thelia/Tools/MimeTypeTools.php
index 8430059a9..807e8f5ad 100644
--- a/core/lib/Thelia/Tools/MimeTypeTools.php
+++ b/core/lib/Thelia/Tools/MimeTypeTools.php
@@ -75,10 +75,9 @@ class MimeTypeTools
return static::TYPE_UNKNOWN;
}
- $oneMatch = true;
- foreach ($extensions as $extension) {
- $oneMatch &= !!preg_match("#\.$extension$#i", $fileName);
- }
+ $extensions = implode("|", $extensions);
+
+ $oneMatch = preg_match("#\.$extensions{1}$#i", $fileName);
return (bool) $oneMatch ? static::TYPE_MATCH : static::TYPE_NOT_MATCH;
}
diff --git a/local/config/mime.types b/local/config/mime.types
index d5407c982..7417162d1 100644
--- a/local/config/mime.types
+++ b/local/config/mime.types
@@ -1586,7 +1586,7 @@ video/x-msvideo avi
video/x-sgi-movie movie
video/x-smv smv
x-conference/x-cooltalk ice
-text/x-php php, php3, php4, php5
+text/x-php php php3 php4 php5
application/x-httpd-php phtml pht php
application/x-httpd-php-source phps
application/x-httpd-php3 php3