begin debug zentity
This commit is contained in:
@@ -73,100 +73,6 @@ function zentity_post(&$a) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$user = $result['user'];
|
||||
|
||||
$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'])) : '');
|
||||
|
||||
|
||||
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($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' => $user['username'],
|
||||
'$email' => $user['email'],
|
||||
'$password' => $result['password'],
|
||||
'$uid' => $user['uid'] ));
|
||||
|
||||
$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"
|
||||
. 'Content-transfer-encoding: 8bit' );
|
||||
|
||||
|
||||
if($res) {
|
||||
info( t('Registration successful. Please check your email for further instructions.') . EOL ) ;
|
||||
goaway(z_root());
|
||||
}
|
||||
}
|
||||
elseif($a->config['register_policy'] == REGISTER_APPROVE) {
|
||||
|
||||
if(! strlen($a->config['admin_email'])) {
|
||||
notice( t('Your registration can not be processed.') . EOL);
|
||||
goaway(z_root());
|
||||
}
|
||||
|
||||
$hash = random_string();
|
||||
$r = q("INSERT INTO `register` ( `hash`, `created`, `uid`, `password`, `language` ) VALUES ( '%s', '%s', %d, '%s', '%s' ) ",
|
||||
dbesc($hash),
|
||||
dbesc(datetime_convert()),
|
||||
intval($user['uid']),
|
||||
dbesc($result['password']),
|
||||
dbesc($a->language)
|
||||
);
|
||||
|
||||
$r = q("SELECT `language` FROM `user` WHERE `email` = '%s' LIMIT 1",
|
||||
dbesc($a->config['admin_email'])
|
||||
);
|
||||
if(count($r))
|
||||
push_lang($r[0]['language']);
|
||||
else
|
||||
push_lang('en');
|
||||
|
||||
if($using_invites && $invite_id) {
|
||||
q("delete * from register where hash = '%s' limit 1", dbesc($invite_id));
|
||||
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' => $user['username'],
|
||||
'$email' => $user['email'],
|
||||
'$password' => $result['password'],
|
||||
'$uid' => $user['uid'],
|
||||
'$hash' => $hash
|
||||
));
|
||||
|
||||
$res = mail($a->config['admin_email'], sprintf(t('Registration request at %s'), $a->config['sitename']),
|
||||
$email_tpl,
|
||||
'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n"
|
||||
. 'Content-type: text/plain; charset=UTF-8' . "\n"
|
||||
. 'Content-transfer-encoding: 8bit' );
|
||||
|
||||
pop_lang();
|
||||
|
||||
if($res) {
|
||||
info( t('Your registration is pending approval by the site owner.') . EOL ) ;
|
||||
goaway(z_root());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user