query(sprintf('select login from users where
login = "%s" or email = "%s" or xmpp = "%s"', $login, $email, $xmpp));
if ($set->getNumRows() > 0) {
$error = sprintf('No-no, user with this nick/email is already registered');
return false;
}
// registration clause // XXX hard coded, registration text
$qr_rc = $db->query('select node_content from nodes where node_id = '.REGISTRATION_TEXT_NODE);
$qr_rc->next();
$params['node_content'] = sprintf('%s
%s
E-mail address:: %s',
$qr_rc->getString('node_content'),
$content,
$email);
// XXX hard-coded
$params['node_parent'] = UNVERIFIED_REGISTRATIONS_NODE; // registrations_noverified forum
$params['node_name'] = 'request for access';
$params['flag'] = 'registration';
$user_id = nodes::addNode($params);
//puttin in the guild node is realized only after email verification
//nodes::putNode($user_id,$guild_id);
$q = sprintf('update nodes set node_system_access = "private" where node_id = %d', $user_id);
$db->update($q);
$pass = md5($pass);
$vercode = substr( md5( uniqid( rand() ) ), rand(0, 7), 23);
$q = sprintf('insert into users set password = "%s", user_id = %d,
header_id = 2091520, login = "%s", email = "%s",
hash = "%s", xmpp="%s", guild_id="%s"',
$pass, $user_id, $login, $email, $vercode, $xmpp, $guild_id);
$db->query($q); // XXX rewrite
$emailtext = sprintf(
'Vitaj %s! Prave som sa s radostou dozvedel, ze si vyplnil(a)
registracny formular na stranke '.SYSTEM_URL.' a chces sa stat
clenom tejto komunity.
Budem sa snazit urobit tento pokec trosku dlhsi,
lebo v povodnej kratkej forme ho pohlcuju spamfiltre, takze
ospravedln nasledujuce blabla a moj typicky atypicky zmysel
pre cierny humor, kedze sluzi ku dobrej veci :)
Pri registracii ti bol prideleny verifikacny kod.
Ten kod znie "%s" [bez uvodzoviek].
Ten musis zadat na adresu '.SYSTEM_URL.'/id/1976899/, kde
vyplnis formular s tvojim nickom a verifkacnym kodom.
Od tej chvile bude tvoja ziadost volne pristupna
uz zaregistrovanym clenom, ktori o nej budu hlasovat.
Pocet hlasov aby sa ziadosti vyhovelo je x.
Deadline na nazbieranie je 1 tyzden.
Takze fakticky dufam ze si o sebe napisal(a) nieco inteligentne :)
Prajem pekny zvysok dna',
$login, $vercode);
// edit by br
$headers = 'From: kyberia@'. SYSTEM_URL . "\r\n" . 'X-Mailer: PHP';
mail($email, SYSTEM_URL.' verification code', $emailtext, $headers);
$error = '