+ $hash = implode(time(), $line) . rand();
+ $hash = md5($hash);
+ return $hash;
+ }
+
+ public function sendTo($hruid, $email, $prenom, $nom, $sexe, $html, $hash = 0)
+ {
+ // If $email is not a real email address, tries to compute it up from
+ // the hruid. Otherwise, we suppose that caller will have used a valid
+ // and canonical email address.
+ if (strpos($email, '@') === false) {
+ if (!($user = User::getSilent($email))) {
+ Platal::page()->trigError("'$email' is neither a valid email address nor a valid login; did not send the email.");
+ }
+ $email = $user->bestEmail();
+ }
+
+ if ($hruid && (is_null($hash) || $hash == 0)) {
+ $hash = $this->createHash(array($email, $prenom, $nom, $sexe, $html, rand(), "X.org rulez"));
+ XDB::query("UPDATE {$this->_subscriptionTable} as ni
+ INNER JOIN auth_user_md5 AS u USING (user_id)
+ SET ni.hash = {?}
+ WHERE ni.user_id != 0 AND u.hruid = {?}",
+ $hash, $hruid);