X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fregister.php;h=3e124bd5bf0e0e5a0944e2466d9006a2cf958559;hb=27a2e44d8949eda0dacb54eedcdec92843ac6fe3;hp=eb6fda737fc69cf22e8216e9ac8e9a3643658671;hpb=db2e20eb2e94b7faf7e52c249eefeffc246ef829;p=friendica.git diff --git a/mod/register.php b/mod/register.php index eb6fda737f..3e124bd5bf 100644 --- a/mod/register.php +++ b/mod/register.php @@ -48,12 +48,11 @@ function register_post(&$a) { } - require_once('include/user.php'); - $arr = $_POST; $arr['blocked'] = $blocked; $arr['verified'] = $verified; + $arr['language'] = get_browser_language(); $result = create_user($arr); @@ -66,7 +65,7 @@ function register_post(&$a) { if($netpublish && $a->config['register_policy'] != REGISTER_APPROVE) { $url = $a->get_baseurl() . '/profile/' . $user['nickname']; - proc_run('php',"include/directory.php","$url"); + proc_run(PRIORITY_LOW, "include/directory.php", $url); } $using_invites = get_config('system','invitation_only'); @@ -81,21 +80,31 @@ function register_post(&$a) { set_pconfig($user['uid'],'system','invites_remaining',$num_invites); } - send_register_open_eml( - $user['email'], - $a->config['sitename'], - $a->get_baseurl(), - $user['username'], - $result['password']); - - - if($res) { - info( t('Registration successful. Please check your email for further instructions.') . EOL ) ; + // Only send a password mail when the password wasn't manually provided + if (!x($_POST,'password1') OR !x($_POST,'confirm')) { + $res = send_register_open_eml( + $user['email'], + $a->config['sitename'], + $a->get_baseurl(), + $user['username'], + $result['password']); + + if($res) { + info( t('Registration successful. Please check your email for further instructions.') . EOL ) ; + goaway(z_root()); + } else { + notice( + sprintf( + t('Failed to send email message. Here your accout details:
login: %s
password: %s

You can change your password after login.'), + $user['email'], + $result['password'] + ). EOL + ); + } + } else { + info( t('Registration successful.') . EOL ) ; goaway(z_root()); } - else { - notice( t('Failed to send email message. Here is the message that failed.') . $email_tpl . EOL ); - } } elseif($a->config['register_policy'] == REGISTER_APPROVE) { if(! strlen($a->config['admin_email'])) { @@ -124,7 +133,6 @@ function register_post(&$a) { $admin_mail_list ); - foreach ($adminlist as $admin) { notification(array( 'type' => NOTIFY_SYSTEM, @@ -135,13 +143,13 @@ function register_post(&$a) { 'source_link' => $a->get_baseurl()."/admin/users/", 'link' => $a->get_baseurl()."/admin/users/", 'source_photo' => $a->get_baseurl() . "/photo/avatar/".$user['uid'].".jpg", - 'to_email' => $admin['mail'], + 'to_email' => $admin['email'], 'uid' => $admin['uid'], - 'language' => ($admin['language']?$admin['language']:'en')) - ); + 'language' => ($admin['language']?$admin['language']:'en'), + 'show_in_notification_page' => false + )); } - info( t('Your registration is pending approval by the site owner.') . EOL ) ; goaway(z_root()); @@ -232,6 +240,9 @@ function register_content(&$a) { )); } + $r = q("SELECT count(*) AS `contacts` FROM `contact`"); + $passwords = !$r[0]["contacts"]; + $license = ''; $o = get_markup_template("register.tpl"); @@ -257,8 +268,11 @@ function register_content(&$a) { '$fillext' => $fillext, '$oidlabel' => $oidlabel, '$openid' => $openid_url, - '$namelabel' => t('Your Full Name ' . "\x28" . 'e.g. Joe Smith' . "\x29" . ': '), + '$namelabel' => t('Your Full Name ' . "\x28" . 'e.g. Joe Smith, real or real-looking' . "\x29" . ': '), '$addrlabel' => t('Your Email Address: '), + '$passwords' => $passwords, + '$password1' => array('password1', t('New Password:'), '', t('Leave empty for an auto generated password.')), + '$password2' => array('confirm', t('Confirm:'), '', ''), '$nickdesc' => str_replace('$sitename',$a->get_hostname(),t('Choose a profile nickname. This must begin with a text character. Your profile address on this site will then be \'nickname@$sitename\'.')), '$nicklabel' => t('Choose a nickname: '), '$photo' => $photo,