diff --git a/modules/invite/sponsor.php b/modules/invite/sponsor.php index 31683c5c..2cf5cc2b 100644 --- a/modules/invite/sponsor.php +++ b/modules/invite/sponsor.php @@ -21,42 +21,57 @@ if(($sponsor = Tools::getValue('sponsor')) && strlen($sponsor) > 12) { } else { $cipherTool = new Blowfish(_COOKIE_KEY_, _COOKIE_IV_); } - - $url = parse_url($_SERVER['REQUEST_URI']); + $gclid = Tools::getIsset('gclid')?'&gclid='.Tools::getValue('gclid'):''; /** * @Override Antadis - Module ant_trackingtag */ - if(!class_exists('AntTrackingTag')){ + if (!class_exists('AntTrackingTag')){ require_once(_PS_MODULE_DIR_.'/ant_trackingtag/models/AntTrackingTag.php'); } $tags = AntTrackingTag::getTags(); $url_tag =''; - foreach ($tags as $tag) { - if(Tools::getIsset($tag['tag'])) { - $value = Tools::getValue($tag['tag']); - $url_tag .='&'.$tag['tag'].'='.$value; + if (count($tags) > 0) { + foreach ($tags as $tag) { + if(Tools::getIsset($tag['tag'])) { + $value = Tools::getValue($tag['tag']); + $url_tag .='&'.$tag['tag'].'='.$value; + } } } /* @End Override */ - if(Tools::getIsset('lpes')) { + if (Tools::getIsset('lpes')) { $lp = Tools::getValue('lpes'); - if( _THEME_NAME_ !== 'site_mobile') { + if(_THEME_NAME_ !== 'site_mobile') { Tools::redirect('?sponsor='.rawurlencode($cipherTool->encrypt('1|'.$email.'|')). (isset($lp)? '&lpes='.$lp: '').$url_tag.$gclid); } } - if(Tools::getIsset('lp')) { + if (Tools::getIsset('lp')) { $lp = Tools::getValue('lp'); } + + print_r($_REQUEST); + + $query = ''; + if (count($_REQUEST) > 0) { + foreach($_REQUEST as $k => $v) { + if ($k == 'sponsor') { + continue; + } + if ($k == 'lp') { + continue; + } + $query = '&'.$k.'='.$v; + } + } 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); + $query.(isset($lp)? '&lp='.$lp: '').$url_tag.$gclid); } }