- $res = XDB::query('SELECT COUNT(*)
- FROM register_marketing
- WHERE uid={?} AND email={?}', $uid, $email);
- if (!$res->fetchOneCell()) {
- XDB::execute("INSERT INTO register_marketing (uid,sender,email,date,last,nb,type,hash)
- VALUES ({?}, {?}, {?}, NOW(), 0, 0, {?}, '')",
- $uid, S::v('uid'), $email, Env::v('market_from'));
- require_once('validations.inc.php');
- $req = new MarkReq(S::v('uid'), $uid, $email, Env::v('market_from') == 'user');
- $req->submit();
+ $market = Marketing::get($uid, $email);
+ if (!$market) {
+ $market = new Marketing($uid, $email, 'group', $globals->asso('nom'),
+ Env::v('market_from'), S::v('uid'));
+ $market->add();