- global $globals;
- if (strpos($login, '@') === false) {
- $login = "$login@{$globals->mail->domain}";
+ $hash = implode(time(), $line) . rand();
+ $hash = md5($hash);
+ return $hash;
+ }
+
+ public function sendTo($user, $hash = null)
+ {
+ if (is_null($hash)) {
+ $hash = XDB::fetchOneCell("SELECT hash
+ FROM {$this->_subscriptionTable}
+ WHERE user_id = {?}", $user->id());
+ }
+ if (is_null($hash)) {
+ $hash = $this->createHash(array($user->displayName(), $user->fullName(),
+ $user->isFemale(), $user->isEmailFormatHtml(),
+ rand(), "X.org rulez"));
+ XDB::execute("UPDATE {$this->_subscriptionTable} as ni
+ SET ni.hash = {?}
+ WHERE ni.user_id != {?}",
+ $hash, $user->id());