bebeboutik/controllers/ValidationController.php
Srv Bebeboutik 340bc7c146 push site
2016-01-04 12:48:08 +01:00

36 lines
943 B
PHP

<?php
class ValidationControllerCore extends FrontController {
var $php_self = 'validation.php';
public function preProcess() {
global $cookie;
if(!$cookie->isLogged()) {
Tools::redirect();
}
}
public function displayContent() {
parent::displayContent();
global $cookie;
if($cookie->isLogged()) {
$sponsor = Db::getInstance()->ExecuteS('
SELECT *
FROM `'._DB_PREFIX_.'invite`
WHERE `id_customer` = '.(int) $cookie->id_customer
);
if(count($sponsor) > 0) {
$s = new Customer($sponsor[0]['id_sponsor']);
self::$smarty->assign(array('email_sponsor' => $s->email));
}
self::$smarty->assign(array(
'email_customer' => $cookie->email,
'id_customer' => (int) $cookie->id_customer,
'HOOK_ACCOUNT_VALIDATION' => Module::hookExec('accountValidation', array('sponsor' => $s)),
));
self::$smarty->display(_PS_THEME_DIR_.'validation.tpl');
} else {
Tools::redirect();
}
}
}