global $globals;
if ($from == 'staff' || !($user = User::getSilent($sender))) {
- return '"L\'équipe de Polytechnique.org" <register@' . $globals->mail->domain . '>';
+ return "\"L'équipe de Polytechnique.org\" <register@" . $globals->mail->domain . '>';
}
return '"' . $user->fullName() . '" <' . $user->bestEmail() . '>';
}
}
$sender = substr($this->sender_mail, 1, strpos($this->sender_mail, '"', 2)-1);
$text = str_replace(array('%%hash%%', '%%sender%%', '%%personal_notes%%'),
- array($this->hash, $this->sender_mail, ''), $text);
+ array($this->hash, "Cordialement,\n-- \n" . $this->sender_mail, ''), $text);
$mailer = new PlMailer();
$mailer->setFrom($this->sender_mail);
$mailer->addTo($this->user['mail']);
$this->type, $this->data, $this->personal_notes);
$this->engine->process($this->user);
if ($valid) {
- require_once 'validations.inc.php';
- $valid = new MarkReq(User::getSilent($this->sender), $this->user['user'], $this->user['mail'],
+ $sender = User::getSilent($this->sender);
+ $valid = new MarkReq($sender, $this->user['user'], $this->user['mail'],
$this->from == 'user', $this->type, $this->data, $this->personal_notes);
$valid->submit();
}
if ($res->numRows() == 0) {
return null;
}
- list ($uid, $email, $type, $data, $from, $senderi, $personal_notes) = $res->fetchOneRow();
+ list ($uid, $email, $type, $data, $from, $sender, $personal_notes) = $res->fetchOneRow();
return new Marketing($uid, $email, $type, $data, $from, $sender, $personal_notes);
}
}
}
- static public function relance($uid, $nbx = -1)
+ static public function relance(PlUser &$user, $nbx = -1)
{
global $globals;
if ($nbx < 0) {
- $res = XDB::query("SELECT COUNT(*) FROM auth_user_md5 WHERE deces=0");
- $nbx = $res->fetchOneCell();
+ $nbx = $globals->core->NbIns;
}
- $res = XDB::query("SELECT r.date, u.promo, u.nom, u.prenom, r.email, r.bestalias
- FROM register_pending AS r
- INNER JOIN auth_user_md5 AS u ON u.user_id = r.uid
- WHERE hash != 'INSCRIT' AND uid = {?} AND
- (TO_DAYS(relance) IS NULL OR TO_DAYS(relance) < TO_DAYS(NOW()))",
- $uid);
- if (!list($date, $promo, $nom, $prenom, $email, $alias) = $res->fetchOneRow()) {
+ $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;
}
- require_once('secure_hash.inc.php');
$hash = rand_url_id(12);
$pass = rand_pass();
- $pass_encrypted = hash_encrypt($pass);
+ $pass_encrypted = sha1($pass);
$fdate = strftime('%d %B %Y', strtotime($date));
$mymail = new PlMailer('marketing/relance.mail.tpl');
$mymail->send();
XDB::execute('UPDATE register_pending
SET hash={?}, password={?}, relance=NOW()
- WHERE uid={?}', $hash, $pass_encrypted, $uid);
- return "$prenom $nom ($promo)";
+ WHERE uid={?}', $hash, $pass_encrypted, $user->id());
+ return $user->fullName();
}
}
. "Pour y figurer, il te suffit de visiter cette page ou de copier cette adresse "
. "dans la barre de ton navigateur :";
if ($from === null) {
- $this->signature = "L'équipe de Polytechnique.org,\n"
- . "Le portail des élèves & anciens élèves de l'École polytechnique";
+ $page = new XorgPage();
+ $page->changeTpl('include/signature.mail.tpl', NO_SKIN);
+ $page->assign('mail_part', 'text');
+ $this->signature = $page->raw();
} else {
- $this->signature = "%%sender%%";
+ $this->signature = '%%sender%%';
}
if (is_null($personal_notes) || $personal_notes == '') {
$this->personal_notes = '%%personal_notes%%';
$page->assign('intro', $this->getIntro());
$page->assign('u', $user);
$page->assign('sign', $this->getSignature());
- $res = XDB::query("SELECT COUNT(*) FROM auth_user_md5 WHERE perms IN ('user', 'admin') AND deces = 0");
- $page->assign('num_users', $res->fetchOneCell());
$page->assign('personal_notes', $this->getPersonalNotes());
}