From c8e56625ad33d803e6449478bf5799c794264d2e Mon Sep 17 00:00:00 2001 From: gmorel Date: Fri, 27 Sep 2013 10:21:49 +0200 Subject: [PATCH 1/2] Working : upload file/image : fix sanitizeFileName --- core/lib/Thelia/Tests/Tools/FileManagerTest.php | 8 ++++---- core/lib/Thelia/Tools/FileManager.php | 7 +------ 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/core/lib/Thelia/Tests/Tools/FileManagerTest.php b/core/lib/Thelia/Tests/Tools/FileManagerTest.php index 8dce5afcc..8c1c9fe99 100644 --- a/core/lib/Thelia/Tests/Tools/FileManagerTest.php +++ b/core/lib/Thelia/Tests/Tools/FileManagerTest.php @@ -532,9 +532,9 @@ class FileManagerTest extends \PHPUnit_Framework_TestCase { ->getMock(); $fileManager = new FileManager($stubContainer); - $badFileName = 'azeéràçè§^"$*+-_°)(&é<>@#ty'; + $badFileName = 'a/ze\érà~çè§^"$*+-_°)(&é<>@#ty2/[\/:*?"<>|]/fi?.fUPPERile.exel../e*'; - $expected = 'azeyryZyy-_yty'; + $expected = 'azer-_ty2fi.fupperile.exel..e'; $actual = $fileManager->sanitizeFileName($badFileName); $this->assertEquals($expected, $actual); @@ -802,7 +802,7 @@ class FileManagerTest extends \PHPUnit_Framework_TestCase { $fileManager = new FileManager($stubContainer); - $expected = 'or1-g_nalyfilenme-1.yml'; + $expected = 'or1-g_nalfilenme-1.yml'; $actual = $fileManager->renameFile(1, $stubUploadedFile); $this->assertEquals($expected, $actual); @@ -830,7 +830,7 @@ class FileManagerTest extends \PHPUnit_Framework_TestCase { $fileManager = new FileManager($stubContainer); - $expected = 'or1-g_nalyfilenme-1'; + $expected = 'or1-g_nalfilenme-1'; $actual = $fileManager->renameFile(1, $stubUploadedFile); $this->assertEquals($expected, $actual); diff --git a/core/lib/Thelia/Tools/FileManager.php b/core/lib/Thelia/Tools/FileManager.php index 6c06fb416..ba5e1d24a 100644 --- a/core/lib/Thelia/Tools/FileManager.php +++ b/core/lib/Thelia/Tools/FileManager.php @@ -279,12 +279,7 @@ class FileManager */ public function sanitizeFileName($string) { - $cleanName = strtr($string, 'ŠŽšžŸÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ', 'SZszYAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy'); - $cleanName = strtr($cleanName, array('Þ' => 'TH', 'þ' => 'th', 'Ð' => 'DH', 'ð' => 'dh', 'ß' => 'ss', 'Œ' => 'OE', 'œ' => 'oe', 'Æ' => 'AE', 'æ' => 'ae', 'µ' => 'u')); - - $cleanName = preg_replace(array('/\s/', '/\.[\.]+/', '/[^\w_\.\-]/'), array('_', '.', ''), $cleanName); - - return $cleanName; + return strtolower(preg_replace('/[^a-zA-Z0-9-_\.]/', '', $string)); } /** From f60670c4122a8cc37859eed387495bc287001fc9 Mon Sep 17 00:00:00 2001 From: Etienne Roudeix Date: Fri, 27 Sep 2013 11:04:14 +0200 Subject: [PATCH 2/2] translations intl --- templates/default/cart.html | 50 +++++++-------- templates/default/order_delivery.html | 30 ++++----- templates/default/order_invoice.html | 90 ++++++++++++++++----------- templates/default/order_placed.html | 34 +++++----- 4 files changed, 112 insertions(+), 92 deletions(-) diff --git a/templates/default/cart.html b/templates/default/cart.html index b716686cb..d86ef48ff 100644 --- a/templates/default/cart.html +++ b/templates/default/cart.html @@ -2,10 +2,10 @@ {block name="breadcrumb"} {/block} @@ -14,13 +14,13 @@
-

Your Cart

+

{intl l="Your Cart"}

@@ -35,20 +35,20 @@ @@ -75,9 +75,9 @@
-
Available :
-
In Stock
-
No.
+
{intl l="Available"} :
+
{intl l="In Stock"}
+
{intl l="No."}
{$REF}
{*
Select Size
Large
@@ -87,13 +87,13 @@
Option 1
*}
- Remove + {intl l="Remove"} - +
  - - Name + + {intl l="Name"} - - Price + + {intl l="Price"} - - Qty + + {intl l="Qty"} - - Total + + {intl l="Total"}
{if $IS_PROMO == 1} {assign "real_price" $PROMO_TAXED_PRICE}
{currency attr="symbol"} {$PROMO_TAXED_PRICE}
- instead of {currency attr="symbol"} {$TAXED_PRICE} + {intl l="instead of"} {currency attr="symbol"} {$TAXED_PRICE} {else} {assign "real_price" $TAXED_PRICE}
{currency attr="symbol"} {$TAXED_PRICE}
@@ -122,7 +122,7 @@
 Total TTC{intl l="Total"} {intl l="TTC"}
{currency attr="symbol"} {cart attr="total_taxed_price"} @@ -132,14 +132,14 @@
- Continue Shopping - Proceed checkout + {intl l="Continue Shopping"} + {intl l="Proceed checkout"}