turn registration code into a standalone function for re-use

This commit is contained in:
friendica 2012-05-31 19:06:17 -07:00
parent 598fc1ae21
commit 93bc29a711
5 changed files with 494 additions and 436 deletions

View file

@ -9,7 +9,7 @@ require_once('include/nav.php');
require_once('include/cache.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_VERSION', '3.0.1359' );
define ( 'FRIENDICA_VERSION', '3.0.1360' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
define ( 'DB_UPDATE_VERSION', 1145 );

View file

@ -2059,8 +2059,8 @@ function diaspora_send_followup($item,$owner,$contact,$public_batch = false) {
// return the items ordered by `item`.`id`, in which case the wrong item is chosen as the parent.
// The only item with `parent` and `id` as the parent id is the parent item.
$p = q("select guid from item where parent = %d and id = %d limit 1",
$item['parent'],
$item['parent']
intval($item['parent']),
intval($item['parent'])
);
if(count($p))
$parent_guid = $p[0]['guid'];
@ -2119,8 +2119,8 @@ function diaspora_send_relay($item,$owner,$contact,$public_batch = false) {
// return the items ordered by `item`.`id`, in which case the wrong item is chosen as the parent.
// The only item with `parent` and `id` as the parent id is the parent item.
$p = q("select guid from item where parent = %d and id = %d limit 1",
$item['parent'],
$item['parent']
intval($item['parent']),
intval($item['parent'])
);
if(count($p))
$parent_guid = $p[0]['guid'];

325
include/user.php Normal file
View file

@ -0,0 +1,325 @@
<?php
require_once('include/config.php');
require_once('include/network.php');
require_once('include/plugin.php');
require_once('include/text.php');
require_once('include/pgettext.php');
require_once('include/datetime.php');
function create_user($arr) {
// Required: { username, nickname, email } or { openid_url }
$a = get_app();
$result = array('success' => false, 'user' => null, 'password' => '', 'message' => '');
$using_invites = get_config('system','invitation_only');
$num_invites = get_config('system','number_invites');
$invite_id = ((x($arr,'invite_id')) ? notags(trim($arr['invite_id'])) : '');
$username = ((x($arr,'username')) ? notags(trim($arr['username'])) : '');
$nickname = ((x($arr,'nickname')) ? notags(trim($arr['nickname'])) : '');
$email = ((x($arr,'email')) ? notags(trim($arr['email'])) : '');
$openid_url = ((x($arr,'openid_url')) ? notags(trim($arr['openid_url'])) : '');
$photo = ((x($arr,'photo')) ? notags(trim($arr['photo'])) : '');
$publish = ((x($arr,'profile_publish_reg') && intval($arr['profile_publish_reg'])) ? 1 : 0);
$password = ((x($arr,'password')) ? trim($arr['password']) : '');
$netpublish = ((strlen(get_config('system','directory_submit_url'))) ? $publish : 0);
$tmp_str = $openid_url;
if($using_invites) {
if(! $invite_id) {
$result['message'] .= t('An invitation is required.') . EOL;
return $result;
}
$r = q("select * from register where `hash` = '%s' limit 1", dbesc($invite_id));
if(! results($r)) {
$result['message'] .= t('Invitation could not be verified.') . EOL;
return $result;
}
}
if((! x($username)) || (! x($email)) || (! x($nickname))) {
if($openid_url) {
if(! validate_url($tmp_str)) {
$result['message'] .= t('Invalid OpenID url') . EOL;
return $result;
}
$_SESSION['register'] = 1;
$_SESSION['openid'] = $openid_url;
require_once('library/openid.php');
$openid = new LightOpenID;
$openid->identity = $openid_url;
$openid->returnUrl = $a->get_baseurl() . '/openid';
$openid->required = array('namePerson/friendly', 'contact/email', 'namePerson');
$openid->optional = array('namePerson/first','media/image/aspect11','media/image/default');
goaway($openid->authUrl());
// NOTREACHED
}
notice( t('Please enter the required information.') . EOL );
return;
}
if(! validate_url($tmp_str))
$openid_url = '';
$err = '';
// collapse multiple spaces in name
$username = preg_replace('/ +/',' ',$username);
if(mb_strlen($username) > 48)
$result['message'] .= t('Please use a shorter name.') . EOL;
if(mb_strlen($username) < 3)
$result['message'] .= t('Name too short.') . EOL;
// I don't really like having this rule, but it cuts down
// on the number of auto-registrations by Russian spammers
// Using preg_match was completely unreliable, due to mixed UTF-8 regex support
// $no_utf = get_config('system','no_utf');
// $pat = (($no_utf) ? '/^[a-zA-Z]* [a-zA-Z]*$/' : '/^\p{L}* \p{L}*$/u' );
// So now we are just looking for a space in the full name.
$loose_reg = get_config('system','no_regfullname');
if(! $loose_reg) {
$username = mb_convert_case($username,MB_CASE_TITLE,'UTF-8');
if(! strpos($username,' '))
$result['message'] .= t("That doesn't appear to be your full \x28First Last\x29 name.") . EOL;
}
if(! allowed_email($email))
$result['message'] .= t('Your email domain is not among those allowed on this site.') . EOL;
if((! valid_email($email)) || (! validate_email($email)))
$result['message'] .= t('Not a valid email address.') . EOL;
// Disallow somebody creating an account using openid that uses the admin email address,
// since openid bypasses email verification. We'll allow it if there is not yet an admin account.
if((x($a->config,'admin_email')) && (strcasecmp($email,$a->config['admin_email']) == 0) && strlen($openid_url)) {
$r = q("SELECT * FROM `user` WHERE `email` = '%s' LIMIT 1",
dbesc($email)
);
if(count($r))
$result['message'] .= t('Cannot use that email.') . EOL;
}
$nickname = $arr['nickname'] = strtolower($nickname);
if(! preg_match("/^[a-z][a-z0-9\-\_]*$/",$nickname))
$result['message'] .= t('Your "nickname" can only contain "a-z", "0-9", "-", and "_", and must also begin with a letter.') . EOL;
$r = q("SELECT `uid` FROM `user`
WHERE `nickname` = '%s' LIMIT 1",
dbesc($nickname)
);
if(count($r))
$result['message'] .= t('Nickname is already registered. Please choose another.') . EOL;
// Check deleted accounts that had this nickname. Doesn't matter to us,
// but could be a security issue for federated platforms.
$r = q("SELECT * FROM `userd`
WHERE `username` = '%s' LIMIT 1",
dbesc($nickname)
);
if(count($r))
$result['message'] .= t('Nickname was once registered here and may not be re-used. Please choose another.') . EOL;
if(strlen($result['message'])) {
return $result;
}
$new_password = ((strlen($password)) ? $password : autoname(6) . mt_rand(100,9999));
$new_password_encoded = hash('whirlpool',$new_password);
$result['password'] = $new_password;
require_once('include/crypto.php');
$keys = new_keypair(1024);
if($keys === false) {
$result['message'] .= t('SERIOUS ERROR: Generation of security keys failed.') . EOL;
return $result;
}
$prvkey = $keys['prvkey'];
$pubkey = $keys['pubkey'];
/**
*
* Create another keypair for signing/verifying
* salmon protocol messages. We have to use a slightly
* less robust key because this won't be using openssl
* but the phpseclib. Since it is PHP interpreted code
* it is not nearly as efficient, and the larger keys
* will take several minutes each to process.
*
*/
$sres = new_keypair(512);
$sprvkey = $sres['prvkey'];
$spubkey = $sres['pubkey'];
$r = q("INSERT INTO `user` ( `guid`, `username`, `password`, `email`, `openid`, `nickname`,
`pubkey`, `prvkey`, `spubkey`, `sprvkey`, `register_date`, `verified`, `blocked`, `timezone` )
VALUES ( '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, 'UTC' )",
dbesc(generate_user_guid()),
dbesc($username),
dbesc($new_password_encoded),
dbesc($email),
dbesc($openid_url),
dbesc($nickname),
dbesc($pubkey),
dbesc($prvkey),
dbesc($spubkey),
dbesc($sprvkey),
dbesc(datetime_convert()),
intval($verified),
intval($blocked)
);
if($r) {
$r = q("SELECT * FROM `user`
WHERE `username` = '%s' AND `password` = '%s' LIMIT 1",
dbesc($username),
dbesc($new_password_encoded)
);
if($r !== false && count($r)) {
$u = $r[0];
$newuid = intval($r[0]['uid']);
}
}
else {
$result['message'] .= t('An error occurred during registration. Please try again.') . EOL ;
return $result;
}
/**
* if somebody clicked submit twice very quickly, they could end up with two accounts
* due to race condition. Remove this one.
*/
$r = q("SELECT `uid` FROM `user`
WHERE `nickname` = '%s' ",
dbesc($nickname)
);
if((count($r) > 1) && $newuid) {
$result['message'] .= t('Nickname is already registered. Please choose another.') . EOL;
q("DELETE FROM `user` WHERE `uid` = %d LIMIT 1",
intval($newuid)
);
return $result;
}
if(x($newuid) !== false) {
$r = q("INSERT INTO `profile` ( `uid`, `profile-name`, `is-default`, `name`, `photo`, `thumb`, `publish`, `net-publish` )
VALUES ( %d, '%s', %d, '%s', '%s', '%s', %d, %d ) ",
intval($newuid),
t('default'),
1,
dbesc($username),
dbesc($a->get_baseurl() . "/photo/profile/{$newuid}.jpg"),
dbesc($a->get_baseurl() . "/photo/avatar/{$newuid}.jpg"),
intval($publish),
intval($netpublish)
);
if($r === false) {
$result['message'] .= t('An error occurred creating your default profile. Please try again.') . EOL;
// Start fresh next time.
$r = q("DELETE FROM `user` WHERE `uid` = %d",
intval($newuid));
return $result;
}
$r = q("INSERT INTO `contact` ( `uid`, `created`, `self`, `name`, `nick`, `photo`, `thumb`, `micro`, `blocked`, `pending`, `url`, `nurl`,
`request`, `notify`, `poll`, `confirm`, `poco`, `name-date`, `uri-date`, `avatar-date`, `closeness` )
VALUES ( %d, '%s', 1, '%s', '%s', '%s', '%s', '%s', 0, 0, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', 0 ) ",
intval($newuid),
datetime_convert(),
dbesc($username),
dbesc($nickname),
dbesc($a->get_baseurl() . "/photo/profile/{$newuid}.jpg"),
dbesc($a->get_baseurl() . "/photo/avatar/{$newuid}.jpg"),
dbesc($a->get_baseurl() . "/photo/micro/{$newuid}.jpg"),
dbesc($a->get_baseurl() . "/profile/$nickname"),
dbesc(normalise_link($a->get_baseurl() . "/profile/$nickname")),
dbesc($a->get_baseurl() . "/dfrn_request/$nickname"),
dbesc($a->get_baseurl() . "/dfrn_notify/$nickname"),
dbesc($a->get_baseurl() . "/dfrn_poll/$nickname"),
dbesc($a->get_baseurl() . "/dfrn_confirm/$nickname"),
dbesc($a->get_baseurl() . "/poco/$nickname"),
dbesc(datetime_convert()),
dbesc(datetime_convert()),
dbesc(datetime_convert())
);
// Create a group with no members. This allows somebody to use it
// right away as a default group for new contacts.
require_once('include/group.php');
group_add($newuid, t('Friends'));
}
// if we have no OpenID photo try to look up an avatar
if(! strlen($photo))
$photo = avatar_img($email);
// unless there is no avatar-plugin loaded
if(strlen($photo)) {
require_once('include/Photo.php');
$photo_failure = false;
$filename = basename($photo);
$img_str = fetch_url($photo,true);
$img = new Photo($img_str);
if($img->is_valid()) {
$img->scaleImageSquare(175);
$hash = photo_new_resource();
$r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 4 );
if($r === false)
$photo_failure = true;
$img->scaleImage(80);
$r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 5 );
if($r === false)
$photo_failure = true;
$img->scaleImage(48);
$r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 6 );
if($r === false)
$photo_failure = true;
if(! $photo_failure) {
q("UPDATE `photo` SET `profile` = 1 WHERE `resource-id` = '%s' ",
dbesc($hash)
);
}
}
}
call_hooks('register_account', $newuid);
$result['success'] = true;
$result['user'] = $u;
return $result;
}

View file

@ -43,331 +43,44 @@ function register_post(&$a) {
break;
}
$using_invites = get_config('system','invitation_only');
$num_invites = get_config('system','number_invites');
require_once('include/user.php');
$result = create_user($_POST);
$invite_id = ((x($_POST,'invite_id')) ? notags(trim($_POST['invite_id'])) : '');
$username = ((x($_POST,'username')) ? notags(trim($_POST['username'])) : '');
$nickname = ((x($_POST,'nickname')) ? notags(trim($_POST['nickname'])) : '');
$email = ((x($_POST,'email')) ? notags(trim($_POST['email'])) : '');
$openid_url = ((x($_POST,'openid_url')) ? notags(trim($_POST['openid_url'])) : '');
$photo = ((x($_POST,'photo')) ? notags(trim($_POST['photo'])) : '');
$publish = ((x($_POST,'profile_publish_reg') && intval($_POST['profile_publish_reg'])) ? 1 : 0);
$netpublish = ((strlen(get_config('system','directory_submit_url'))) ? $publish : 0);
$tmp_str = $openid_url;
if($using_invites) {
if(! $invite_id) {
notice( t('An invitation is required.') . EOL);
return;
}
$r = q("select * from register where `hash` = '%s' limit 1", dbesc($invite_id));
if(! results($r)) {
notice( t('Invitation could not be verified.') . EOL);
return;
}
}
if((! x($username)) || (! x($email)) || (! x($nickname))) {
if($openid_url) {
if(! validate_url($tmp_str)) {
notice( t('Invalid OpenID url') . EOL);
return;
}
$_SESSION['register'] = 1;
$_SESSION['openid'] = $openid_url;
require_once('library/openid.php');
$openid = new LightOpenID;
$openid->identity = $openid_url;
$openid->returnUrl = $a->get_baseurl() . '/openid';
$openid->required = array('namePerson/friendly', 'contact/email', 'namePerson');
$openid->optional = array('namePerson/first','media/image/aspect11','media/image/default');
goaway($openid->authUrl());
// NOTREACHED
}
notice( t('Please enter the required information.') . EOL );
if(! $result['success']) {
notice($result['message']);
return;
}
if(! validate_url($tmp_str))
$openid_url = '';
$err = '';
// collapse multiple spaces in name
$username = preg_replace('/ +/',' ',$username);
if(mb_strlen($username) > 48)
$err .= t('Please use a shorter name.') . EOL;
if(mb_strlen($username) < 3)
$err .= t('Name too short.') . EOL;
// I don't really like having this rule, but it cuts down
// on the number of auto-registrations by Russian spammers
// Using preg_match was completely unreliable, due to mixed UTF-8 regex support
// $no_utf = get_config('system','no_utf');
// $pat = (($no_utf) ? '/^[a-zA-Z]* [a-zA-Z]*$/' : '/^\p{L}* \p{L}*$/u' );
// So now we are just looking for a space in the full name.
$loose_reg = get_config('system','no_regfullname');
if(! $loose_reg) {
$username = mb_convert_case($username,MB_CASE_TITLE,'UTF-8');
if(! strpos($username,' '))
$err .= t("That doesn't appear to be your full \x28First Last\x29 name.") . EOL;
}
if(! allowed_email($email))
$err .= t('Your email domain is not among those allowed on this site.') . EOL;
if((! valid_email($email)) || (! validate_email($email)))
$err .= t('Not a valid email address.') . EOL;
// Disallow somebody creating an account using openid that uses the admin email address,
// since openid bypasses email verification. We'll allow it if there is not yet an admin account.
if((x($a->config,'admin_email')) && (strcasecmp($email,$a->config['admin_email']) == 0) && strlen($openid_url)) {
$r = q("SELECT * FROM `user` WHERE `email` = '%s' LIMIT 1",
dbesc($email)
);
if(count($r))
$err .= t('Cannot use that email.') . EOL;
}
$nickname = $_POST['nickname'] = strtolower($nickname);
if(! preg_match("/^[a-z][a-z0-9\-\_]*$/",$nickname))
$err .= t('Your "nickname" can only contain "a-z", "0-9", "-", and "_", and must also begin with a letter.') . EOL;
$r = q("SELECT `uid` FROM `user`
WHERE `nickname` = '%s' LIMIT 1",
dbesc($nickname)
);
if(count($r))
$err .= t('Nickname is already registered. Please choose another.') . EOL;
// Check deleted accounts that had this nickname. Doesn't matter to us,
// but could be a security issue for federated platforms.
$r = q("SELECT * FROM `userd`
WHERE `username` = '%s' LIMIT 1",
dbesc($nickname)
);
if(count($r))
$err .= t('Nickname was once registered here and may not be re-used. Please choose another.') . EOL;
if(strlen($err)) {
notice( $err );
return;
}
$new_password = autoname(6) . mt_rand(100,9999);
$new_password_encoded = hash('whirlpool',$new_password);
require_once('include/crypto.php');
$result = new_keypair(1024);
if($result === false) {
notice( t('SERIOUS ERROR: Generation of security keys failed.') . EOL);
return;
}
$prvkey = $result['prvkey'];
$pubkey = $result['pubkey'];
/**
*
* Create another keypair for signing/verifying
* salmon protocol messages. We have to use a slightly
* less robust key because this won't be using openssl
* but the phpseclib. Since it is PHP interpreted code
* it is not nearly as efficient, and the larger keys
* will take several minutes each to process.
*
*/
$sres = new_keypair(512);
$sprvkey = $sres['prvkey'];
$spubkey = $sres['pubkey'];
$r = q("INSERT INTO `user` ( `guid`, `username`, `password`, `email`, `openid`, `nickname`,
`pubkey`, `prvkey`, `spubkey`, `sprvkey`, `register_date`, `verified`, `blocked`, `timezone` )
VALUES ( '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, 'UTC' )",
dbesc(generate_user_guid()),
dbesc($username),
dbesc($new_password_encoded),
dbesc($email),
dbesc($openid_url),
dbesc($nickname),
dbesc($pubkey),
dbesc($prvkey),
dbesc($spubkey),
dbesc($sprvkey),
dbesc(datetime_convert()),
intval($verified),
intval($blocked)
);
if($r) {
$r = q("SELECT `uid` FROM `user`
WHERE `username` = '%s' AND `password` = '%s' LIMIT 1",
dbesc($username),
dbesc($new_password_encoded)
);
if($r !== false && count($r))
$newuid = intval($r[0]['uid']);
}
else {
notice( t('An error occurred during registration. Please try again.') . EOL );
return;
}
/**
* if somebody clicked submit twice very quickly, they could end up with two accounts
* due to race condition. Remove this one.
*/
$r = q("SELECT `uid` FROM `user`
WHERE `nickname` = '%s' ",
dbesc($nickname)
);
if((count($r) > 1) && $newuid) {
$err .= t('Nickname is already registered. Please choose another.') . EOL;
q("DELETE FROM `user` WHERE `uid` = %d LIMIT 1",
intval($newuid)
);
notice ($err);
return;
}
if(x($newuid) !== false) {
$r = q("INSERT INTO `profile` ( `uid`, `profile-name`, `is-default`, `name`, `photo`, `thumb`, `publish`, `net-publish` )
VALUES ( %d, '%s', %d, '%s', '%s', '%s', %d, %d ) ",
intval($newuid),
'default',
1,
dbesc($username),
dbesc($a->get_baseurl() . "/photo/profile/{$newuid}.jpg"),
dbesc($a->get_baseurl() . "/photo/avatar/{$newuid}.jpg"),
intval($publish),
intval($netpublish)
);
if($r === false) {
notice( t('An error occurred creating your default profile. Please try again.') . EOL );
// Start fresh next time.
$r = q("DELETE FROM `user` WHERE `uid` = %d",
intval($newuid));
return;
}
$r = q("INSERT INTO `contact` ( `uid`, `created`, `self`, `name`, `nick`, `photo`, `thumb`, `micro`, `blocked`, `pending`, `url`, `nurl`,
`request`, `notify`, `poll`, `confirm`, `poco`, `name-date`, `uri-date`, `avatar-date`, `closeness` )
VALUES ( %d, '%s', 1, '%s', '%s', '%s', '%s', '%s', 0, 0, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', 0 ) ",
intval($newuid),
datetime_convert(),
dbesc($username),
dbesc($nickname),
dbesc($a->get_baseurl() . "/photo/profile/{$newuid}.jpg"),
dbesc($a->get_baseurl() . "/photo/avatar/{$newuid}.jpg"),
dbesc($a->get_baseurl() . "/photo/micro/{$newuid}.jpg"),
dbesc($a->get_baseurl() . "/profile/$nickname"),
dbesc(normalise_link($a->get_baseurl() . "/profile/$nickname")),
dbesc($a->get_baseurl() . "/dfrn_request/$nickname"),
dbesc($a->get_baseurl() . "/dfrn_notify/$nickname"),
dbesc($a->get_baseurl() . "/dfrn_poll/$nickname"),
dbesc($a->get_baseurl() . "/dfrn_confirm/$nickname"),
dbesc($a->get_baseurl() . "/poco/$nickname"),
dbesc(datetime_convert()),
dbesc(datetime_convert()),
dbesc(datetime_convert())
);
// Create a group with no members. This allows somebody to use it
// right away as a default group for new contacts.
require_once('include/group.php');
group_add($newuid, t('Friends'));
}
// if we have no OpenID photo try to look up an avatar
if(! strlen($photo))
$photo = avatar_img($email);
// unless there is no avatar-plugin loaded
if(strlen($photo)) {
require_once('include/Photo.php');
$photo_failure = false;
$filename = basename($photo);
$img_str = fetch_url($photo,true);
$img = new Photo($img_str);
if($img->is_valid()) {
$img->scaleImageSquare(175);
$hash = photo_new_resource();
$r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 4 );
if($r === false)
$photo_failure = true;
$img->scaleImage(80);
$r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 5 );
if($r === false)
$photo_failure = true;
$img->scaleImage(48);
$r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 6 );
if($r === false)
$photo_failure = true;
if(! $photo_failure) {
q("UPDATE `photo` SET `profile` = 1 WHERE `resource-id` = '%s' ",
dbesc($hash)
);
}
}
}
$user = $result['user'];
if($netpublish && $a->config['register_policy'] != REGISTER_APPROVE) {
$url = $a->get_baseurl() . "/profile/$nickname";
$url = $a->get_baseurl() . '/profile/' . $user['nickname'];
proc_run('php',"include/directory.php","$url");
}
$using_invites = get_config('system','invitation_only');
$num_invites = get_config('system','number_invites');
$invite_id = ((x($_POST,'invite_id')) ? notags(trim($_POST['invite_id'])) : '');
call_hooks('register_account', $newuid);
if( $a->config['register_policy'] == REGISTER_OPEN ) {
if($using_invites && $invite_id) {
q("delete * from register where hash = '%s' limit 1", dbesc($invite_id));
set_pconfig($newuid,'system','invites_remaining',$num_invites);
set_pconfig($user['uid'],'system','invites_remaining',$num_invites);
}
$email_tpl = get_intltext_template("register_open_eml.tpl");
$email_tpl = replace_macros($email_tpl, array(
'$sitename' => $a->config['sitename'],
'$siteurl' => $a->get_baseurl(),
'$username' => $username,
'$email' => $email,
'$password' => $new_password,
'$uid' => $newuid ));
'$username' => $user['username'],
'$email' => $user['email'],
'$password' => $result['password'],
'$uid' => $user['uid'] ));
$res = mail($email, sprintf(t('Registration details for %s'), $a->config['sitename']),
$res = mail($user['email'], sprintf(t('Registration details for %s'), $a->config['sitename']),
$email_tpl,
'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n"
. 'Content-type: text/plain; charset=UTF-8' . "\n"
@ -392,8 +105,8 @@ function register_post(&$a) {
$r = q("INSERT INTO `register` ( `hash`, `created`, `uid`, `password`, `language` ) VALUES ( '%s', '%s', %d, '%s', '%s' ) ",
dbesc($hash),
dbesc(datetime_convert()),
intval($newuid),
dbesc($new_password),
intval($user['uid']),
dbesc($result['password']),
dbesc($lang)
);
@ -407,17 +120,17 @@ function register_post(&$a) {
if($using_invites && $invite_id) {
q("delete * from register where hash = '%s' limit 1", dbesc($invite_id));
set_pconfig($newuid,'system','invites_remaining',$num_invites);
set_pconfig($user['uid'],'system','invites_remaining',$num_invites);
}
$email_tpl = get_intltext_template("register_verify_eml.tpl");
$email_tpl = replace_macros($email_tpl, array(
'$sitename' => $a->config['sitename'],
'$siteurl' => $a->get_baseurl(),
'$username' => $username,
'$email' => $email,
'$password' => $new_password,
'$uid' => $newuid,
'$username' => $user['username'],
'$email' => $user['email'],
'$password' => $result['password'],
'$uid' => $user['uid'],
'$hash' => $hash
));

View file

@ -6,9 +6,9 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: 3.0.1359\n"
"Project-Id-Version: 3.0.1360\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-05-30 10:00-0700\n"
"POT-Creation-Date: 2012-05-31 10:00-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -55,7 +55,7 @@ msgstr ""
#: ../../mod/profiles.php:374 ../../mod/delegate.php:6
#: ../../mod/suggest.php:28 ../../mod/invite.php:13 ../../mod/invite.php:81
#: ../../mod/dfrn_confirm.php:53 ../../addon/facebook/facebook.php:503
#: ../../include/items.php:3293 ../../index.php:306
#: ../../include/items.php:3297 ../../index.php:306
msgid "Permission denied."
msgstr ""
@ -128,7 +128,7 @@ msgstr ""
#: ../../mod/install.php:245 ../../mod/install.php:283
#: ../../mod/localtime.php:45 ../../mod/contacts.php:322
#: ../../mod/settings.php:555 ../../mod/settings.php:701
#: ../../mod/settings.php:762 ../../mod/settings.php:970
#: ../../mod/settings.php:762 ../../mod/settings.php:969
#: ../../mod/manage.php:109 ../../mod/group.php:85 ../../mod/admin.php:417
#: ../../mod/admin.php:653 ../../mod/admin.php:789 ../../mod/admin.php:988
#: ../../mod/admin.php:1075 ../../mod/profiles.php:543
@ -216,7 +216,7 @@ msgstr ""
msgid "Edit event"
msgstr ""
#: ../../mod/events.php:300 ../../include/text.php:1060
#: ../../mod/events.php:300 ../../include/text.php:1064
msgid "link to source"
msgstr ""
@ -325,25 +325,25 @@ msgid ""
msgstr ""
#: ../../mod/api.php:105 ../../mod/dfrn_request.php:818
#: ../../mod/settings.php:880 ../../mod/settings.php:886
#: ../../mod/settings.php:894 ../../mod/settings.php:898
#: ../../mod/settings.php:903 ../../mod/settings.php:909
#: ../../mod/settings.php:915 ../../mod/settings.php:921
#: ../../mod/settings.php:957 ../../mod/settings.php:958
#: ../../mod/settings.php:959 ../../mod/settings.php:960
#: ../../mod/settings.php:961 ../../mod/register.php:516
#: ../../mod/settings.php:879 ../../mod/settings.php:885
#: ../../mod/settings.php:893 ../../mod/settings.php:897
#: ../../mod/settings.php:902 ../../mod/settings.php:908
#: ../../mod/settings.php:914 ../../mod/settings.php:920
#: ../../mod/settings.php:956 ../../mod/settings.php:957
#: ../../mod/settings.php:958 ../../mod/settings.php:959
#: ../../mod/settings.php:960 ../../mod/register.php:516
#: ../../mod/profiles.php:520
msgid "Yes"
msgstr ""
#: ../../mod/api.php:106 ../../mod/dfrn_request.php:819
#: ../../mod/settings.php:880 ../../mod/settings.php:886
#: ../../mod/settings.php:894 ../../mod/settings.php:898
#: ../../mod/settings.php:903 ../../mod/settings.php:909
#: ../../mod/settings.php:915 ../../mod/settings.php:921
#: ../../mod/settings.php:957 ../../mod/settings.php:958
#: ../../mod/settings.php:959 ../../mod/settings.php:960
#: ../../mod/settings.php:961 ../../mod/register.php:517
#: ../../mod/settings.php:879 ../../mod/settings.php:885
#: ../../mod/settings.php:893 ../../mod/settings.php:897
#: ../../mod/settings.php:902 ../../mod/settings.php:908
#: ../../mod/settings.php:914 ../../mod/settings.php:920
#: ../../mod/settings.php:956 ../../mod/settings.php:957
#: ../../mod/settings.php:958 ../../mod/settings.php:959
#: ../../mod/settings.php:960 ../../mod/register.php:517
#: ../../mod/profiles.php:521
msgid "No"
msgstr ""
@ -401,7 +401,7 @@ msgstr ""
#: ../../mod/photos.php:583 ../../mod/like.php:127 ../../mod/tagger.php:70
#: ../../addon/communityhome/communityhome.php:163
#: ../../view/theme/diabook/theme.php:570 ../../include/text.php:1311
#: ../../view/theme/diabook/theme.php:570 ../../include/text.php:1315
#: ../../include/diaspora.php:1662 ../../include/conversation.php:53
#: ../../include/conversation.php:126
msgid "photo"
@ -815,7 +815,7 @@ msgstr ""
msgid "Confirm"
msgstr ""
#: ../../mod/dfrn_request.php:700 ../../include/items.php:2729
#: ../../mod/dfrn_request.php:700 ../../include/items.php:2733
msgid "[Name Withheld]"
msgstr ""
@ -1713,7 +1713,7 @@ msgstr ""
#: ../../addon/facebook/facebook.php:688
#: ../../addon/facebook/facebook.php:1178
#: ../../addon/public_server/public_server.php:62
#: ../../addon/testdrive/testdrive.php:67 ../../include/items.php:2738
#: ../../addon/testdrive/testdrive.php:67 ../../include/items.php:2742
#: ../../boot.php:694
msgid "Administrator"
msgstr ""
@ -2032,32 +2032,32 @@ msgstr ""
msgid "Don't show emoticons"
msgstr ""
#: ../../mod/settings.php:840 ../../mod/admin.php:180 ../../mod/admin.php:634
msgid "Normal Account"
#: ../../mod/settings.php:840
msgid "Normal Account Page"
msgstr ""
#: ../../mod/settings.php:841
msgid "This account is a normal personal profile"
msgstr ""
#: ../../mod/settings.php:844 ../../mod/admin.php:181 ../../mod/admin.php:635
msgid "Soapbox Account"
#: ../../mod/settings.php:844
msgid "Soapbox Page"
msgstr ""
#: ../../mod/settings.php:845
msgid "Automatically approve all connection/friend requests as read-only fans"
msgstr ""
#: ../../mod/settings.php:848 ../../mod/admin.php:182 ../../mod/admin.php:636
msgid "Community/Celebrity Account"
#: ../../mod/settings.php:848
msgid "Community Forum/Celebrity Account"
msgstr ""
#: ../../mod/settings.php:849
msgid "Automatically approve all connection/friend requests as read-write fans"
msgstr ""
#: ../../mod/settings.php:852 ../../mod/admin.php:183 ../../mod/admin.php:637
msgid "Automatic Friend Account"
#: ../../mod/settings.php:852
msgid "Automatic Friend Page"
msgstr ""
#: ../../mod/settings.php:853
@ -2065,223 +2065,227 @@ msgid "Automatically approve all connection/friend requests as friends"
msgstr ""
#: ../../mod/settings.php:856
msgid "Private Forum"
msgid "Private Forum [Experimental]"
msgstr ""
#: ../../mod/settings.php:857
msgid "Private forum - approved members only [Experimental]"
msgid "Private forum - approved members only"
msgstr ""
#: ../../mod/settings.php:870
#: ../../mod/settings.php:869
msgid "OpenID:"
msgstr ""
#: ../../mod/settings.php:870
#: ../../mod/settings.php:869
msgid "(Optional) Allow this OpenID to login to this account."
msgstr ""
#: ../../mod/settings.php:880
#: ../../mod/settings.php:879
msgid "Publish your default profile in your local site directory?"
msgstr ""
#: ../../mod/settings.php:886
#: ../../mod/settings.php:885
msgid "Publish your default profile in the global social directory?"
msgstr ""
#: ../../mod/settings.php:894
#: ../../mod/settings.php:893
msgid "Hide your contact/friend list from viewers of your default profile?"
msgstr ""
#: ../../mod/settings.php:898
#: ../../mod/settings.php:897
msgid "Hide your profile details from unknown viewers?"
msgstr ""
#: ../../mod/settings.php:903
#: ../../mod/settings.php:902
msgid "Allow friends to post to your profile page?"
msgstr ""
#: ../../mod/settings.php:909
#: ../../mod/settings.php:908
msgid "Allow friends to tag your posts?"
msgstr ""
#: ../../mod/settings.php:915
#: ../../mod/settings.php:914
msgid "Allow us to suggest you as a potential friend to new members?"
msgstr ""
#: ../../mod/settings.php:921
#: ../../mod/settings.php:920
msgid "Permit unknown people to send you private mail?"
msgstr ""
#: ../../mod/settings.php:932
#: ../../mod/settings.php:931
msgid "Profile is <strong>not published</strong>."
msgstr ""
#: ../../mod/settings.php:938 ../../mod/profile_photo.php:211
#: ../../mod/settings.php:937 ../../mod/profile_photo.php:211
msgid "or"
msgstr ""
#: ../../mod/settings.php:943
#: ../../mod/settings.php:942
msgid "Your Identity Address is"
msgstr ""
#: ../../mod/settings.php:954
#: ../../mod/settings.php:953
msgid "Automatically expire posts after this many days:"
msgstr ""
#: ../../mod/settings.php:954
#: ../../mod/settings.php:953
msgid "If empty, posts will not expire. Expired posts will be deleted"
msgstr ""
#: ../../mod/settings.php:955
#: ../../mod/settings.php:954
msgid "Advanced expiration settings"
msgstr ""
#: ../../mod/settings.php:956
#: ../../mod/settings.php:955
msgid "Advanced Expiration"
msgstr ""
#: ../../mod/settings.php:957
#: ../../mod/settings.php:956
msgid "Expire posts:"
msgstr ""
#: ../../mod/settings.php:958
#: ../../mod/settings.php:957
msgid "Expire personal notes:"
msgstr ""
#: ../../mod/settings.php:959
#: ../../mod/settings.php:958
msgid "Expire starred posts:"
msgstr ""
#: ../../mod/settings.php:960
#: ../../mod/settings.php:959
msgid "Expire photos:"
msgstr ""
#: ../../mod/settings.php:961
#: ../../mod/settings.php:960
msgid "Only expire posts by others:"
msgstr ""
#: ../../mod/settings.php:968
#: ../../mod/settings.php:967
msgid "Account Settings"
msgstr ""
#: ../../mod/settings.php:976
#: ../../mod/settings.php:975
msgid "Password Settings"
msgstr ""
#: ../../mod/settings.php:977
#: ../../mod/settings.php:976
msgid "New Password:"
msgstr ""
#: ../../mod/settings.php:978
#: ../../mod/settings.php:977
msgid "Confirm:"
msgstr ""
#: ../../mod/settings.php:978
#: ../../mod/settings.php:977
msgid "Leave password fields blank unless changing"
msgstr ""
#: ../../mod/settings.php:982
#: ../../mod/settings.php:981
msgid "Basic Settings"
msgstr ""
#: ../../mod/settings.php:983 ../../include/profile_advanced.php:15
#: ../../mod/settings.php:982 ../../include/profile_advanced.php:15
msgid "Full Name:"
msgstr ""
#: ../../mod/settings.php:984
#: ../../mod/settings.php:983
msgid "Email Address:"
msgstr ""
#: ../../mod/settings.php:985
#: ../../mod/settings.php:984
msgid "Your Timezone:"
msgstr ""
#: ../../mod/settings.php:986
#: ../../mod/settings.php:985
msgid "Default Post Location:"
msgstr ""
#: ../../mod/settings.php:987
#: ../../mod/settings.php:986
msgid "Use Browser Location:"
msgstr ""
#: ../../mod/settings.php:990
#: ../../mod/settings.php:989
msgid "Security and Privacy Settings"
msgstr ""
#: ../../mod/settings.php:992
#: ../../mod/settings.php:991
msgid "Maximum Friend Requests/Day:"
msgstr ""
#: ../../mod/settings.php:992 ../../mod/settings.php:1011
#: ../../mod/settings.php:991 ../../mod/settings.php:1010
msgid "(to prevent spam abuse)"
msgstr ""
#: ../../mod/settings.php:993
#: ../../mod/settings.php:992
msgid "Default Post Permissions"
msgstr ""
#: ../../mod/settings.php:994
#: ../../mod/settings.php:993
msgid "(click to open/close)"
msgstr ""
#: ../../mod/settings.php:1011
#: ../../mod/settings.php:1010
msgid "Maximum private messages per day from unknown people:"
msgstr ""
#: ../../mod/settings.php:1014
#: ../../mod/settings.php:1013
msgid "Notification Settings"
msgstr ""
#: ../../mod/settings.php:1015
#: ../../mod/settings.php:1014
msgid "By default post a status message when:"
msgstr ""
#: ../../mod/settings.php:1016
#: ../../mod/settings.php:1015
msgid "accepting a friend request"
msgstr ""
#: ../../mod/settings.php:1017
#: ../../mod/settings.php:1016
msgid "joining a forum/community"
msgstr ""
#: ../../mod/settings.php:1018
#: ../../mod/settings.php:1017
msgid "making an <em>interesting</em> profile change"
msgstr ""
#: ../../mod/settings.php:1019
#: ../../mod/settings.php:1018
msgid "Send a notification email when:"
msgstr ""
#: ../../mod/settings.php:1020
#: ../../mod/settings.php:1019
msgid "You receive an introduction"
msgstr ""
#: ../../mod/settings.php:1021
#: ../../mod/settings.php:1020
msgid "Your introductions are confirmed"
msgstr ""
#: ../../mod/settings.php:1022
#: ../../mod/settings.php:1021
msgid "Someone writes on your profile wall"
msgstr ""
#: ../../mod/settings.php:1023
#: ../../mod/settings.php:1022
msgid "Someone writes a followup comment"
msgstr ""
#: ../../mod/settings.php:1024
#: ../../mod/settings.php:1023
msgid "You receive a private message"
msgstr ""
#: ../../mod/settings.php:1025
#: ../../mod/settings.php:1024
msgid "You receive a friend suggestion"
msgstr ""
#: ../../mod/settings.php:1026
#: ../../mod/settings.php:1025
msgid "You are tagged in a post"
msgstr ""
#: ../../mod/settings.php:1028
msgid "Advanced Account/Page Type Settings"
msgstr ""
#: ../../mod/settings.php:1029
msgid "Advanced Page Settings"
msgid "Change the behaviour of this account for special situations"
msgstr ""
#: ../../mod/manage.php:90
@ -2855,7 +2859,7 @@ msgstr ""
#: ../../mod/notice.php:15 ../../mod/viewsrc.php:15 ../../mod/admin.php:156
#: ../../mod/admin.php:697 ../../mod/admin.php:896 ../../mod/display.php:37
#: ../../mod/display.php:142 ../../include/items.php:3175
#: ../../mod/display.php:142 ../../include/items.php:3179
msgid "Item not found."
msgstr ""
@ -3117,6 +3121,22 @@ msgstr ""
msgid "User registrations waiting for confirmation"
msgstr ""
#: ../../mod/admin.php:180 ../../mod/admin.php:634
msgid "Normal Account"
msgstr ""
#: ../../mod/admin.php:181 ../../mod/admin.php:635
msgid "Soapbox Account"
msgstr ""
#: ../../mod/admin.php:182 ../../mod/admin.php:636
msgid "Community/Celebrity Account"
msgstr ""
#: ../../mod/admin.php:183 ../../mod/admin.php:637
msgid "Automatic Friend Account"
msgstr ""
#: ../../mod/admin.php:202
msgid "Message queues"
msgstr ""
@ -4733,7 +4753,7 @@ msgid "Latest likes"
msgstr ""
#: ../../addon/communityhome/communityhome.php:155
#: ../../view/theme/diabook/theme.php:562 ../../include/text.php:1309
#: ../../view/theme/diabook/theme.php:562 ../../include/text.php:1313
#: ../../include/conversation.php:45 ../../include/conversation.php:118
msgid "event"
msgstr ""
@ -5895,7 +5915,7 @@ msgid "j F"
msgstr ""
#: ../../include/profile_advanced.php:30 ../../include/datetime.php:448
#: ../../include/items.php:1419
#: ../../include/items.php:1423
msgid "Birthday:"
msgstr ""
@ -6303,127 +6323,127 @@ msgid_plural "%d Contacts"
msgstr[0] ""
msgstr[1] ""
#: ../../include/text.php:831
#: ../../include/text.php:835
msgid "Monday"
msgstr ""
#: ../../include/text.php:831
#: ../../include/text.php:835
msgid "Tuesday"
msgstr ""
#: ../../include/text.php:831
#: ../../include/text.php:835
msgid "Wednesday"
msgstr ""
#: ../../include/text.php:831
#: ../../include/text.php:835
msgid "Thursday"
msgstr ""
#: ../../include/text.php:831
#: ../../include/text.php:835
msgid "Friday"
msgstr ""
#: ../../include/text.php:831
#: ../../include/text.php:835
msgid "Saturday"
msgstr ""
#: ../../include/text.php:831
#: ../../include/text.php:835
msgid "Sunday"
msgstr ""
#: ../../include/text.php:835
#: ../../include/text.php:839
msgid "January"
msgstr ""
#: ../../include/text.php:835
#: ../../include/text.php:839
msgid "February"
msgstr ""
#: ../../include/text.php:835
#: ../../include/text.php:839
msgid "March"
msgstr ""
#: ../../include/text.php:835
#: ../../include/text.php:839
msgid "April"
msgstr ""
#: ../../include/text.php:835
#: ../../include/text.php:839
msgid "May"
msgstr ""
#: ../../include/text.php:835
#: ../../include/text.php:839
msgid "June"
msgstr ""
#: ../../include/text.php:835
#: ../../include/text.php:839
msgid "July"
msgstr ""
#: ../../include/text.php:835
#: ../../include/text.php:839
msgid "August"
msgstr ""
#: ../../include/text.php:835
#: ../../include/text.php:839
msgid "September"
msgstr ""
#: ../../include/text.php:835
#: ../../include/text.php:839
msgid "October"
msgstr ""
#: ../../include/text.php:835
#: ../../include/text.php:839
msgid "November"
msgstr ""
#: ../../include/text.php:835
#: ../../include/text.php:839
msgid "December"
msgstr ""
#: ../../include/text.php:920
#: ../../include/text.php:924
msgid "bytes"
msgstr ""
#: ../../include/text.php:940 ../../include/text.php:955
#: ../../include/text.php:944 ../../include/text.php:959
msgid "remove"
msgstr ""
#: ../../include/text.php:940 ../../include/text.php:955
#: ../../include/text.php:944 ../../include/text.php:959
msgid "[remove]"
msgstr ""
#: ../../include/text.php:943
#: ../../include/text.php:947
msgid "Categories:"
msgstr ""
#: ../../include/text.php:958
#: ../../include/text.php:962
msgid "Filed under:"
msgstr ""
#: ../../include/text.php:974 ../../include/text.php:986
#: ../../include/text.php:978 ../../include/text.php:990
msgid "Click to open/close"
msgstr ""
#: ../../include/text.php:1091
#: ../../include/text.php:1095
msgid "default"
msgstr ""
#: ../../include/text.php:1103
#: ../../include/text.php:1107
msgid "Select an alternate language"
msgstr ""
#: ../../include/text.php:1313
#: ../../include/text.php:1317
msgid "activity"
msgstr ""
#: ../../include/text.php:1315
#: ../../include/text.php:1319
msgid "comment"
msgstr ""
#: ../../include/text.php:1316
#: ../../include/text.php:1320
msgid "post"
msgstr ""
#: ../../include/text.php:1471
#: ../../include/text.php:1475
msgid "Item filed"
msgstr ""
@ -6958,11 +6978,11 @@ msgstr ""
msgid "Please visit %s to approve or reject the suggestion."
msgstr ""
#: ../../include/items.php:2736
#: ../../include/items.php:2740
msgid "A new person is sharing with you at "
msgstr ""
#: ../../include/items.php:2736
#: ../../include/items.php:2740
msgid "You have a new follower at "
msgstr ""