Пример #1
0
 public function addNonRegistered(PlPage $page, PlUser $user)
 {
     XDB::execute('INSERT IGNORE INTO  watch_nonins (uid, ni_id)
                               VALUES  ({?}, {?})', S::i('uid'), $user->id());
     if (XDB::affectedRows() > 0) {
         S::user()->invalidWatchCache();
         Platal::session()->updateNbNotifs();
         $page->trigSuccess('Contact ajouté : ' . $user->fullName(true));
     } else {
         $page->trigWarning('Contact déjà dans la liste : ' . $user->fullName(true));
     }
 }
Пример #2
0
 public static function relance(PlUser $user, $nbx = -1)
 {
     global $globals;
     if ($nbx < 0) {
         $nbx = $globals->core->NbIns;
     }
     $res = XDB::fetchOneCell('SELECT  r.date, r.email, r.bestalias
                                 FROM  register_pending
                                WHERE  r.hash = \'INSCRIT\' AND uid = {?}', $user->id());
     if (!$res) {
         return false;
     } else {
         list($date, $email, $alias) = $res;
     }
     $hash = rand_url_id(12);
     $pass = rand_pass();
     $pass_encrypted = sha1($pass);
     $fdate = strftime('%d %B %Y', strtotime($date));
     $mymail = new PlMailer('marketing/relance.mail.tpl');
     $mymail->assign('nbdix', $nbx);
     $mymail->assign('fdate', $fdate);
     $mymail->assign('lusername', $alias);
     $mymail->assign('nveau_pass', $pass);
     $mymail->assign('baseurl', $globals->baseurl);
     $mymail->assign('lins_id', $hash);
     $mymail->assign('lemail', $email);
     $mymail->assign('subj', ucfirst($globals->mail->domain) . ' : ' . $alias);
     $mymail->send();
     XDB::execute('UPDATE  register_pending
                      SET  hash={?}, password={?}, relance=NOW()
                    WHERE  uid={?}', $hash, $pass_encrypted, $user->id());
     return $user->fullName();
 }