Debug, CS
This commit is contained in:
parent
fc5991dce9
commit
08f522bc36
@ -2,7 +2,8 @@
|
||||
if (!defined('_PS_VERSION_'))
|
||||
exit;
|
||||
|
||||
class Invite extends Module {
|
||||
class Invite extends Module
|
||||
{
|
||||
public function __construct() {
|
||||
$this->name = 'invite';
|
||||
$this->tab = 'advertising_marketing';
|
||||
@ -1127,38 +1128,38 @@ RewriteRule ^invite/(.*)$ '.__PS_BASE_URI__.'modules/invite/sponsor.php?sponsor=
|
||||
return $this->hookCustomerAccount($params);
|
||||
}
|
||||
|
||||
public function hookCreateAccountForm($params) {
|
||||
public function hookCreateAccountForm($params)
|
||||
{
|
||||
global $smarty, $site_version_front;
|
||||
|
||||
if($firstname = Tools::getValue('firstname')) {
|
||||
if ($firstname = Tools::getValue('firstname')) {
|
||||
$_POST['firstname'] = $firstname;
|
||||
}
|
||||
|
||||
if($lastname = Tools::getValue('lastname')) {
|
||||
if ($lastname = Tools::getValue('lastname')) {
|
||||
$_POST['lastname'] = $lastname;
|
||||
}
|
||||
|
||||
if($email = Tools::getValue('email')) {
|
||||
if ($email = Tools::getValue('email')) {
|
||||
$_POST['email'] = $email;
|
||||
}
|
||||
|
||||
if(Configuration::get('PS_CIPHER_ALGORITHM')) {
|
||||
if (Configuration::get('PS_CIPHER_ALGORITHM')) {
|
||||
$cipherTool = new Rijndael(_RIJNDAEL_KEY_, _RIJNDAEL_IV_);
|
||||
} else {
|
||||
$cipherTool = new Blowfish(_COOKIE_KEY_, _COOKIE_IV_);
|
||||
}
|
||||
|
||||
$explodeResult = explode('|', $cipherTool->decrypt(rawurldecode(Tools::getValue('sponsor'))));
|
||||
|
||||
if($explodeResult
|
||||
&& count($explodeResult) > 1) {
|
||||
list($id_invite, $email) = $explodeResult;
|
||||
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 ((int) $id_invite && !empty($email) && Validate::isEmail($email)
|
||||
&& ($customer = $customer->getByEmail($email))
|
||||
&& Validate::isLoadedObject($customer)) {
|
||||
|
||||
$smarty->assign(array(
|
||||
'sponsor_email' => $email,
|
||||
));
|
||||
@ -1211,13 +1212,6 @@ RewriteRule ^invite/(.*)$ '.__PS_BASE_URI__.'modules/invite/sponsor.php?sponsor=
|
||||
setcookie('4598484FDSFDSREFERAL8849FDS', base64_encode($customer->email), time() + 3600 * 24, '/', 'bebeboutik.com');
|
||||
}
|
||||
}
|
||||
// setcookie('554b43403edef30d31412286d5098965', $sponsor, time() + 3600 * 24, '/', 'bebeboutik.com');
|
||||
|
||||
// if(isset($_COOKIE['554b43403edef30d31412286d5098965'])){
|
||||
// $sponsor = $_COOKIE['554b43403edef30d31412286d5098965'];
|
||||
// $email = base64_decode(strrev(substr($sponsor, 12)));
|
||||
// $smarty->assign('referralprogram', $email);
|
||||
// }
|
||||
|
||||
return $this->display(__FILE__, 'authentication.tpl');
|
||||
}
|
||||
@ -1523,7 +1517,8 @@ RewriteRule ^invite/(.*)$ '.__PS_BASE_URI__.'modules/invite/sponsor.php?sponsor=
|
||||
return $discount;
|
||||
}
|
||||
|
||||
public function hookUpdateOrderStatus($params) {
|
||||
public function hookUpdateOrderStatus($params)
|
||||
{
|
||||
if(!Validate::isLoadedObject($params['newOrderStatus'])) {
|
||||
die (Tools::displayError('Missing parameters'));
|
||||
}
|
||||
@ -1564,7 +1559,8 @@ RewriteRule ^invite/(.*)$ '.__PS_BASE_URI__.'modules/invite/sponsor.php?sponsor=
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
public function hookCreateAccount($params) {
|
||||
public function hookCreateAccount($params)
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$newCustomer = $params['newCustomer'];
|
||||
@ -1584,15 +1580,16 @@ RewriteRule ^invite/(.*)$ '.__PS_BASE_URI__.'modules/invite/sponsor.php?sponsor=
|
||||
}
|
||||
|
||||
$sponsor = new Customer();
|
||||
if($sponsor = $sponsor->getByEmail($sponsorEmail)) {
|
||||
// Looks for sponsor exist as a customer
|
||||
if ($sponsor = $sponsor->getByEmail($sponsorEmail)) {
|
||||
$invite = Db::getInstance()->ExecuteS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'invite`
|
||||
WHERE `email` = "'.pSQL($newCustomer->email).'"
|
||||
');
|
||||
|
||||
// The new customer was not invited by the sponsor, so we force to create invite dynamically
|
||||
if(count($invite) == 0) {
|
||||
// If the customer was not invited by the sponsor, we create the invitation dynamically
|
||||
Db::getInstance()->ExecuteS('
|
||||
INSERT INTO `'._DB_PREFIX_.'invite`
|
||||
VALUES (
|
||||
@ -1616,7 +1613,9 @@ RewriteRule ^invite/(.*)$ '.__PS_BASE_URI__.'modules/invite/sponsor.php?sponsor=
|
||||
FROM `'._DB_PREFIX_.'invite`
|
||||
WHERE `email` = "'.pSQL($newCustomer->email).'"
|
||||
');
|
||||
} else {
|
||||
}
|
||||
// Associate sponsor with the new customer
|
||||
else {
|
||||
Db::getInstance()->Execute('
|
||||
UPDATE `'._DB_PREFIX_.'invite`
|
||||
SET `id_customer` = '.$newCustomer->id.' , `date_upd` = NOW()
|
||||
@ -1628,20 +1627,21 @@ RewriteRule ^invite/(.*)$ '.__PS_BASE_URI__.'modules/invite/sponsor.php?sponsor=
|
||||
$invite = $invite[0];
|
||||
|
||||
if(Configuration::get('INVITE_REWARD_SPONSOR_ON') == 0) {
|
||||
$this->_make_rewards($sponsor, FALSE, $invite);
|
||||
$this->_make_rewards($sponsor, false, $invite);
|
||||
}
|
||||
|
||||
if(Configuration::get('INVITE_REWARD_SPONSORED_ON') == 0) {
|
||||
$this->_make_rewards($newCustomer, TRUE, $invite);
|
||||
$this->_make_rewards($newCustomer, true, $invite);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
public function hookShoppingCart($params) {
|
||||
public function hookShoppingCart($params)
|
||||
{
|
||||
global $cookie, $cart, $smarty;
|
||||
|
||||
if($cookie->isLogged() && $cart->getOrderTotal() > 0) {
|
||||
|
@ -7,11 +7,11 @@ if(($sponsor = Tools::getValue('sponsor')) && strlen($sponsor) > 12) {
|
||||
setcookie('554b43403edef30d31412286d5098965', $sponsor, time() + 3600 * 24 * 365, '/', '.bebeboutik.com');
|
||||
|
||||
$email = base64_decode(strrev(substr($sponsor, 12)));
|
||||
if(count(Db::getInstance()->ExecuteS('
|
||||
SELECT `id_customer`
|
||||
FROM `'._DB_PREFIX_.'customer`
|
||||
WHERE `email` = "'.pSQL($email).'"
|
||||
')) > 0) {
|
||||
|
||||
$isExist = Db::getInstance()->ExecuteS('
|
||||
SELECT `id_customer` FROM `'._DB_PREFIX_.'customer`
|
||||
WHERE `email` = "'.pSQL($email).'"');
|
||||
if(count($isExist) > 0) {
|
||||
if(Configuration::get('PS_CIPHER_ALGORITHM')) {
|
||||
$cipherTool = new Rijndael(_RIJNDAEL_KEY_, _RIJNDAEL_IV_);
|
||||
} else {
|
||||
@ -40,16 +40,20 @@ if(($sponsor = Tools::getValue('sponsor')) && strlen($sponsor) > 12) {
|
||||
if(Tools::getIsset('lpes')) {
|
||||
$lp = Tools::getValue('lpes');
|
||||
if( _THEME_NAME_ !== 'site_mobile') {
|
||||
Tools::redirect('?sponsor='.rawurlencode($cipherTool->encrypt('1|'.$email.'|')).(isset($lp)? '&lpes='.$lp: '').$url_tag.$gclid);
|
||||
Tools::redirect('?sponsor='.rawurlencode($cipherTool->encrypt('1|'.$email.'|')).
|
||||
(isset($lp)? '&lpes='.$lp: '').$url_tag.$gclid);
|
||||
}
|
||||
}
|
||||
|
||||
if(Tools::getIsset('lp')) {
|
||||
$lp = Tools::getValue('lp');
|
||||
}
|
||||
|
||||
Tools::redirectLink($link->getPageLink('authentication.php').'?create_account=1&sponsor='.rawurlencode($cipherTool->encrypt('1|'.$email.'|')).(isset($url['query'])? '&'.$url['query']: '').(isset($lp)? '&lp='.$lp: '').$url_tag.$gclid);
|
||||
// Tools::redirectLink($link->getPageLink('authentication.php').'?create_account=1&sponsor='.rawurlencode($cipherTool->encrypt('1|'.$email.'|')).(isset($url['query'])? '&'.$url['query']: ''));
|
||||
|
||||
Tools::redirectLink($link->getPageLink('authentication.php').
|
||||
'?create_account=1&sponsor='.rawurlencode($cipherTool->encrypt('1|'.$email.'|')).
|
||||
(isset($url['query'])? '&'.$url['query']: '').
|
||||
(isset($lp)? '&lp='.$lp: '').$url_tag.$gclid);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user