Merge branch 'ticket/r16108-test-sponsor' into develop

This commit is contained in:
Michael RICOIS 2018-02-14 12:25:46 +01:00
commit 688adfedb4

View File

@ -1131,7 +1131,7 @@ RewriteRule ^invite/(.*)$ '.__PS_BASE_URI__.'modules/invite/sponsor.php?sponsor=
public function hookCreateAccountForm($params)
{
global $smarty, $site_version_front;
if ($firstname = Tools::getValue('firstname')) {
$_POST['firstname'] = $firstname;
}
@ -1149,18 +1149,17 @@ RewriteRule ^invite/(.*)$ '.__PS_BASE_URI__.'modules/invite/sponsor.php?sponsor=
} else {
$cipherTool = new Blowfish(_COOKIE_KEY_, _COOKIE_IV_);
}
$customer = new Customer();
$explodeResult = explode('|', $cipherTool->decrypt(rawurldecode(Tools::getValue('sponsor'))));
if ($explodeResult && count($explodeResult) > 1) {
list($id_invite, $email) = $explodeResult;
$customer = new Customer();
if ((int) $id_invite && !empty($email) && Validate::isEmail($email)
&& ($customer = $customer->getByEmail($email))
&& Validate::isLoadedObject($customer)) {
if(Module::isInstalled('trackingtag') && Db::getInstance()->getRow('
if (!empty($email) && Validate::isEmail($email)) {
$customer = $customer->getByEmail($email);
}
if ((int)$id_invite && Validate::isLoadedObject($customer)) {
if (Module::isInstalled('trackingtag') && Db::getInstance()->getRow('
SELECT `id_trackingtag`
FROM `'._DB_PREFIX_.'trackingtag`
WHERE `sponsor` = "'.pSQL($email).'"
@ -1198,7 +1197,7 @@ RewriteRule ^invite/(.*)$ '.__PS_BASE_URI__.'modules/invite/sponsor.php?sponsor=
}
}
}
// Cookie
$referal_email = '';
$cName = '4598484FDSFDSREFERAL8849FDS';
@ -1207,14 +1206,15 @@ RewriteRule ^invite/(.*)$ '.__PS_BASE_URI__.'modules/invite/sponsor.php?sponsor=
} elseif (isset($_COOKIE[$cName])) {
$referal_email = base64_decode($_COOKIE[$cName]);
}
$smarty->assign('sponsor_email', $referal_email);
// Init cookie
if ($_COOKIE[$cName] != base64_encode($referal_email)) {
unset($_COOKIE[$cName]);
}
setcookie($cName, base64_encode($referal_email), time() + 3600 * 24, '/', 'bebeboutik.com');
$smarty->assign('sponsor_email', $referal_email);
return $this->display(__FILE__, 'authentication.tpl');
}