i18n
This commit is contained in:
parent
6af2a79e90
commit
b38f875732
1 changed files with 17 additions and 16 deletions
|
@ -22,7 +22,7 @@ function register_post(&$a) {
|
||||||
default:
|
default:
|
||||||
case REGISTER_CLOSED:
|
case REGISTER_CLOSED:
|
||||||
if((! x($_SESSION,'authenticated') && (! x($_SESSION,'administrator')))) {
|
if((! x($_SESSION,'authenticated') && (! x($_SESSION,'administrator')))) {
|
||||||
notice( "Permission denied." . EOL );
|
notice( t('Permission denied.') . EOL );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$blocked = 1;
|
$blocked = 1;
|
||||||
|
@ -38,34 +38,34 @@ function register_post(&$a) {
|
||||||
$email = notags(trim($_POST['email']));
|
$email = notags(trim($_POST['email']));
|
||||||
|
|
||||||
if((! x($username)) || (! x($email)) || (! x($nickname))) {
|
if((! x($username)) || (! x($email)) || (! x($nickname))) {
|
||||||
notice( "Please enter the required information.". EOL );
|
notice( t('Please enter the required information.') . EOL );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$err = '';
|
$err = '';
|
||||||
|
|
||||||
if(!eregi('[A-Za-z0-9._%-]+@[A-Za-z0-9._%-]+\.[A-Za-z]{2,6}',$email))
|
if(!eregi('[A-Za-z0-9._%-]+@[A-Za-z0-9._%-]+\.[A-Za-z]{2,6}',$email))
|
||||||
$err .= " Not a valid email address.";
|
$err .= t(' Not a valid email address.');
|
||||||
if(strlen($username) > 48)
|
if(strlen($username) > 48)
|
||||||
$err .= " Please use a shorter name.";
|
$err .= t(' Please use a shorter name.');
|
||||||
if(strlen($username) < 3)
|
if(strlen($username) < 3)
|
||||||
$err .= " Name too short.";
|
$err .= t(' Name too short.');
|
||||||
$r = q("SELECT `uid` FROM `user`
|
$r = q("SELECT `uid` FROM `user`
|
||||||
WHERE `email` = '%s' LIMIT 1",
|
WHERE `email` = '%s' LIMIT 1",
|
||||||
dbesc($email)
|
dbesc($email)
|
||||||
);
|
);
|
||||||
|
|
||||||
if($r !== false && count($r))
|
if($r !== false && count($r))
|
||||||
$err .= " This email address is already registered on this system.";
|
$err .= t(' Your email address is already registered on this system.') ;
|
||||||
|
|
||||||
if(! preg_match("/^[a-zA-Z][a-zA-Z0-9\-\_]*$/",$nickname))
|
if(! preg_match("/^[a-zA-Z][a-zA-Z0-9\-\_]*$/",$nickname))
|
||||||
$err .= " Nickname <strong>must</strong> start with a letter and contain only letters, numbers, dashes, or underscore.";
|
$err .= t(' Nickname <strong>must</strong> start with a letter and contain only letters, numbers, dashes, or underscore.') ;
|
||||||
$r = q("SELECT `uid` FROM `user`
|
$r = q("SELECT `uid` FROM `user`
|
||||||
WHERE `nickname` = '%s' LIMIT 1",
|
WHERE `nickname` = '%s' LIMIT 1",
|
||||||
dbesc($nickname)
|
dbesc($nickname)
|
||||||
);
|
);
|
||||||
if(count($r))
|
if(count($r))
|
||||||
$err .= " Nickname is already registered. Please choose another." . EOL;
|
$err .= t(' Nickname is already registered. Please choose another.');
|
||||||
|
|
||||||
if(strlen($err)) {
|
if(strlen($err)) {
|
||||||
notice( $err . EOL );
|
notice( $err . EOL );
|
||||||
|
@ -115,7 +115,7 @@ function register_post(&$a) {
|
||||||
$newuid = intval($r[0]['uid']);
|
$newuid = intval($r[0]['uid']);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
notice( "An error occurred during registration. Please try again." . EOL );
|
notice( t('An error occurred during registration. Please try again.') . EOL );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ function register_post(&$a) {
|
||||||
|
|
||||||
);
|
);
|
||||||
if($r === false) {
|
if($r === false) {
|
||||||
notice( "An error occurred creating your default profile. Please try again." . EOL );
|
notice( t('An error occurred creating your default profile. Please try again.') . EOL );
|
||||||
// Start fresh next time.
|
// Start fresh next time.
|
||||||
$r = q("DELETE FROM `user` WHERE `uid` = %d",
|
$r = q("DELETE FROM `user` WHERE `uid` = %d",
|
||||||
intval($newuid));
|
intval($newuid));
|
||||||
|
@ -166,15 +166,16 @@ function register_post(&$a) {
|
||||||
'$password' => $new_password,
|
'$password' => $new_password,
|
||||||
'$uid' => $newuid ));
|
'$uid' => $newuid ));
|
||||||
|
|
||||||
$res = mail($email,"Registration details for {$a->config['sitename']}",$email_tpl,"From: Administrator@{$_SERVER[SERVER_NAME]}");
|
$res = mail($email, t('Registration details for ') . $a->config['sitename'],
|
||||||
|
$email_tpl, 'From: ' . t('Administrator@') . $_SERVER[SERVER_NAME]);
|
||||||
|
|
||||||
|
|
||||||
if($res) {
|
if($res) {
|
||||||
notice( "Registration successful. Please check your email for further instructions." . EOL ) ;
|
notice( t('Registration successful. Please check your email for further instructions.') . EOL ) ;
|
||||||
goaway($a->get_baseurl());
|
goaway($a->get_baseurl());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
notice( "Failed to send email message. Here is the message that failed. $email_tpl " . EOL );
|
notice( t('Failed to send email message. Here is the message that failed.') . $email_tpl . EOL );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif($a->config['register_policy'] == REGISTER_APPROVE) {
|
elseif($a->config['register_policy'] == REGISTER_APPROVE) {
|
||||||
|
@ -202,11 +203,11 @@ function register_post(&$a) {
|
||||||
'$hash' => $hash
|
'$hash' => $hash
|
||||||
));
|
));
|
||||||
|
|
||||||
$res = mail($a->config['admin_email'],"Registration request at {$a->config['sitename']}",
|
$res = mail($a->config['admin_email'], t('Registration request at ') . $a->config['sitename'],
|
||||||
$email_tpl,"From: Administrator@{$_SERVER[SERVER_NAME]}");
|
$email_tpl,'From: ' . t('Administrator@') . $_SERVER[SERVER_NAME]);
|
||||||
|
|
||||||
if($res) {
|
if($res) {
|
||||||
notice( "Your registration is pending approval by the site owner." . EOL ) ;
|
notice( t('Your registration is pending approval by the site owner.') . EOL ) ;
|
||||||
goaway($a->get_baseurl());
|
goaway($a->get_baseurl());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue