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

@ -1150,17 +1150,16 @@ RewriteRule ^invite/(.*)$ '.__PS_BASE_URI__.'modules/invite/sponsor.php?sponsor=
$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).'"
@ -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');
}