Post by dantheman50_98 » Mon Oct 11, 2010 3:07 pm

Agreed - there is no $pattern = '/^[A-Z0-9._%\-+]+@[A-Z0-9][A-Z0-9.-]{0,61}[A-Z0-9]\.[A-Z]{2,6}$/i'; in the admin\controller\sale\order.php file. Not even a $pattern.
Are we to ignore this file then and just proceed with the files that do contain this code?

Also, if we've already installed opencart how are we supposed to get the new code into the install/controller/step_3.php file?

Active Member

Posts

Joined
Sat Sep 18, 2010 2:18 am

Post by jones » Mon Oct 11, 2010 5:40 pm

dantheman50_98 wrote: Also, if we've already installed opencart how are we supposed to get the new code into the install/controller/step_3.php file?
this is for new fresh OC installation only, but you can add the mod to install/controller/step_3.php file

Active Member

Posts

Joined
Tue Aug 24, 2010 1:05 pm

Post by Shark » Sun Oct 31, 2010 9:52 pm

Qphoria wrote:I've searched around for the holy grail of email regex.. still not found one.
But I was a step ahead with the one place pattern. The day I made this fix I checked in a change to define the pattern once and use that constant. That will be in effect for 1.5.0
I noticed this bug before; I changed the code using:
if (!filter_var(filter_var($this->request->post['email'], FILTER_SANITIZE_EMAIL), FILTER_VALIDATE_EMAIL)) {
$this->error['email'] = $this->language->get('error_email');
}

See also: http://www.charles-reace.com/blog/2008/ ... ate_email/

Or is the change you made to the regex better? (I'm not an professional php-coder). thx.

User avatar
Active Member

Posts

Joined
Sun Oct 31, 2010 9:43 pm
Location - Haarlem

Post by Qphoria » Sun Oct 31, 2010 10:08 pm

Shark wrote:
Qphoria wrote:I've searched around for the holy grail of email regex.. still not found one.
But I was a step ahead with the one place pattern. The day I made this fix I checked in a change to define the pattern once and use that constant. That will be in effect for 1.5.0
I noticed this bug before; I changed the code using:
if (!filter_var(filter_var($this->request->post['email'], FILTER_SANITIZE_EMAIL), FILTER_VALIDATE_EMAIL)) {
$this->error['email'] = $this->language->get('error_email');
}

See also: http://www.charles-reace.com/blog/2008/ ... ate_email/

Or is the change you made to the regex better? (I'm not an professional php-coder). thx.
Actually it seems the FILTER_SANITIZE_EMAIL does use a regex in the background. I've never even thought about this function for email validation. I wonder if it would in fact be a better more standardized approach. I'll research it more. Thanks!

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by myjl » Tue Apr 12, 2011 2:39 pm

Qphoria wrote:Confirmed.

1. EDIT the following files:
catalog/controller/account/create.php
catalog/controller/account/edit.php
catalog/controller/checkout/guest_step_1.php
catalog/controller/information/contact.php
catalog/model/checkout/order.php
admin/controller/sale/customer.php
admin/controller/sale/order.php
admin/controller/setting/setting.php
install/controller/step_3.php

2. FIND:

Code: Select all

$pattern = '/^[A-Z0-9._%-+]+@[A-Z0-9][A-Z0-9.-]{0,61}[A-Z0-9]\.[A-Z]{2,6}$/i';
3. REPLACE WITH:

Code: Select all

$pattern = '/^[A-Z0-9._%\-+]+@[A-Z0-9][A-Z0-9.-]{0,61}[A-Z0-9]\.[A-Z]{2,6}$/i';
We can increase readability by positioning the dash at first or at last inside the brackets.
So, the string will be

Code: Select all

$pattern = '/^[A-Z0-9._%+-]+@[A-Z0-9][A-Z0-9.-]{0,61}[A-Z0-9]\.[A-Z]{2,6}$/i';
HTH !

=-.-=-.-=-.-=-.-=-.-=-.-=-.-=-.-=
MacBook Pro
MAMP 1.9.5
OpenCart 1.4.9.4


User avatar
Newbie

Posts

Joined
Tue Apr 12, 2011 2:22 am

Post by Qphoria » Tue Apr 12, 2011 9:20 pm

This has been changed in the latest version to be much simpler anyway. Just use the line from the 1.4.9.4 version of startup.php

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by ThePath » Fri Nov 04, 2011 11:03 pm

I did this fix and it seemed to break the orders coming through via email to the store admin?

Have tried reverting back to the old way for the admin->controller->setting->setting.php file see if that works.

Image

OpenCart Theme Options - See All My Extensions - OpenCart Themes and Mods


User avatar
Active Member

Posts

Joined
Fri Jun 26, 2009 11:53 pm
Location - Scotland
Who is online

Users browsing this forum: No registered users and 15 guests