From 2d33e22c0af65963d7617374427814846f419a2e Mon Sep 17 00:00:00 2001 From: Louis Racicot Date: Tue, 5 Mar 2013 15:29:51 -0500 Subject: Add unicode support in cart product name for unicode 00C000 to 00E01F. --- system/libraries/Cart.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/libraries') diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php index b7b0697fb..86c11d6f6 100644 --- a/system/libraries/Cart.php +++ b/system/libraries/Cart.php @@ -51,7 +51,7 @@ class CI_Cart { * * @var string */ - public $product_name_rules = '\.\:\-_ a-z0-9'; + public $product_name_rules = '\.\:\-_ a-zA-ZÀ-ÿ0-9'; /** * only allow safe product names @@ -544,4 +544,4 @@ class CI_Cart { } /* End of file Cart.php */ -/* Location: ./system/libraries/Cart.php */ \ No newline at end of file +/* Location: ./system/libraries/Cart.php */ -- cgit v1.2.3-24-g4f1b From 141e2cb8a20e84a4e521c47edd885102185b2419 Mon Sep 17 00:00:00 2001 From: Louis Racicot Date: Wed, 6 Mar 2013 09:29:45 -0500 Subject: Update Cart.php Regex were already case sensitive. --- system/libraries/Cart.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries') diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php index 86c11d6f6..84be7fa85 100644 --- a/system/libraries/Cart.php +++ b/system/libraries/Cart.php @@ -51,7 +51,7 @@ class CI_Cart { * * @var string */ - public $product_name_rules = '\.\:\-_ a-zA-ZÀ-ÿ0-9'; + public $product_name_rules = '\.\:\-_ a-z�-�0-9'; /** * only allow safe product names -- cgit v1.2.3-24-g4f1b From 837b203bcbd52fc8fc909a3dc8c5031fb4dc3379 Mon Sep 17 00:00:00 2001 From: Louis Racicot Date: Wed, 6 Mar 2013 09:31:31 -0500 Subject: Github broke the file encoding. I repaired it. --- system/libraries/Cart.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries') diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php index 84be7fa85..d5664f22c 100644 --- a/system/libraries/Cart.php +++ b/system/libraries/Cart.php @@ -51,7 +51,7 @@ class CI_Cart { * * @var string */ - public $product_name_rules = '\.\:\-_ a-z�-�0-9'; + public $product_name_rules = '\.\:\-_ a-zÀ-ÿ0-9'; /** * only allow safe product names -- cgit v1.2.3-24-g4f1b From 592e7d46895029f462369708085631d67494ec56 Mon Sep 17 00:00:00 2001 From: Louis Racicot Date: Wed, 6 Mar 2013 10:04:55 -0500 Subject: Full unicode support for the product name. --- system/libraries/Cart.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/libraries') diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php index d5664f22c..c224a6dc9 100644 --- a/system/libraries/Cart.php +++ b/system/libraries/Cart.php @@ -51,7 +51,7 @@ class CI_Cart { * * @var string */ - public $product_name_rules = '\.\:\-_ a-zÀ-ÿ0-9'; + public $product_name_rules = '\.\:\- \w'; /** * only allow safe product names @@ -214,7 +214,7 @@ class CI_Cart { // Validate the product name. It can only be alpha-numeric, dashes, underscores, colons or periods. // Note: These can be user-specified by setting the $this->product_name_rules variable. - if ($this->product_name_safe && ! preg_match('/^['.$this->product_name_rules.']+$/i', $items['name'])) + if ($this->product_name_safe && ! preg_match('/^['.$this->product_name_rules.']+$/iu', $items['name'])) { log_message('error', 'An invalid name was submitted as the product name: '.$items['name'].' The name can only contain alpha-numeric characters, dashes, underscores, colons, and spaces'); return FALSE; -- cgit v1.2.3-24-g4f1b From 025b6465c4baa7ba501b24df64672fd15f779a1a Mon Sep 17 00:00:00 2001 From: Louis Racicot Date: Thu, 7 Mar 2013 09:32:16 -0500 Subject: check if uft8 is enabled --- system/libraries/Cart.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries') diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php index c224a6dc9..6e203a8c7 100644 --- a/system/libraries/Cart.php +++ b/system/libraries/Cart.php @@ -214,7 +214,7 @@ class CI_Cart { // Validate the product name. It can only be alpha-numeric, dashes, underscores, colons or periods. // Note: These can be user-specified by setting the $this->product_name_rules variable. - if ($this->product_name_safe && ! preg_match('/^['.$this->product_name_rules.']+$/iu', $items['name'])) + if ($this->product_name_safe && ! preg_match('/^['.$this->product_name_rules.']+$/i'.(UTF8_ENABLED ? 'u' : ''), $items['name'])) { log_message('error', 'An invalid name was submitted as the product name: '.$items['name'].' The name can only contain alpha-numeric characters, dashes, underscores, colons, and spaces'); return FALSE; -- cgit v1.2.3-24-g4f1b From 65b8f835e572cc6ff73fe07024ffaa537fee912e Mon Sep 17 00:00:00 2001 From: Louis Racicot Date: Mon, 11 Mar 2013 09:03:25 -0400 Subject: reorder rules in product name regex by importance --- system/libraries/Cart.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/libraries') diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php index 6e203a8c7..edc300bd7 100644 --- a/system/libraries/Cart.php +++ b/system/libraries/Cart.php @@ -51,7 +51,7 @@ class CI_Cart { * * @var string */ - public $product_name_rules = '\.\:\- \w'; + public $product_name_rules = '\w \-\.\:'; /** * only allow safe product names @@ -544,4 +544,4 @@ class CI_Cart { } /* End of file Cart.php */ -/* Location: ./system/libraries/Cart.php */ +/* Location: ./system/libraries/Cart.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b