]> git.mxchange.org Git - friendica.git/blobdiff - mod/register.php
Merge pull request #1057 from annando/master
[friendica.git] / mod / register.php
index 6bf287d4245b0c70ce12d3395b9f4ad216216d10..5e011cb9a94a0edd358cb1aa1ccdb974e80a52e7 100644 (file)
@@ -1,5 +1,8 @@
 <?php
 
+require_once('include/email.php');
+require_once('include/bbcode.php');
+
 if(! function_exists('register_post')) {
 function register_post(&$a) {
 
@@ -21,7 +24,7 @@ function register_post(&$a) {
 
        switch($a->config['register_policy']) {
 
-       
+
        case REGISTER_OPEN:
                $blocked = 0;
                $verified = 1;
@@ -42,6 +45,7 @@ function register_post(&$a) {
                $verified = 0;
                break;
        }
+    
 
        require_once('include/user.php');
 
@@ -85,9 +89,9 @@ function register_post(&$a) {
                                '$password' => $result['password'],
                                '$uid' => $user['uid'] ));
 
-               $res = mail($user['email'], sprintf(t('Registration details for %s'), $a->config['sitename']),
+               $res = mail($user['email'], email_header_encode( sprintf( t('Registration details for %s'), $a->config['sitename']),'UTF-8'),
                        $email_tpl, 
-                               'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n"
+                               'From: ' . 'Administrator' . '@' . $_SERVER['SERVER_NAME'] . "\n"
                                . 'Content-type: text/plain; charset=UTF-8' . "\n"
                                . 'Content-transfer-encoding: 8bit' );
 
@@ -115,8 +119,11 @@ function register_post(&$a) {
                        dbesc($lang)
                );
 
+               $adminlist = explode(",", str_replace(" ", "", $a->config['admin_email']));
+
                $r = q("SELECT `language` FROM `user` WHERE `email` = '%s' LIMIT 1",
-                       dbesc($a->config['admin_email'])
+                       //dbesc($a->config['admin_email'])
+                       dbesc($adminlist[0])
                );
                if(count($r))
                        push_lang($r[0]['language']);
@@ -139,9 +146,9 @@ function register_post(&$a) {
                                '$hash' => $hash
                 ));
 
-               $res = mail($a->config['admin_email'], sprintf(t('Registration request at %s'), $a->config['sitename']),
+               $res = mail($a->config['admin_email'], email_header_encode( sprintf(t('Registration request at %s'), $a->config['sitename']),'UTF-8'),
                        $email_tpl,
-                               'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n"
+                               'From: ' . 'Administrator' . '@' . $_SERVER['SERVER_NAME'] . "\n"
                                . 'Content-type: text/plain; charset=UTF-8' . "\n"
                                . 'Content-transfer-encoding: 8bit' );
 
@@ -234,11 +241,10 @@ function register_content(&$a) {
                        '$yes_selected' => ' checked="checked" ',
                        '$no_selected'  => '',
                        '$str_yes'      => t('Yes'),
-                       '$str_no'       => t('No')
+                       '$str_no'       => t('No'),
                ));
        }
 
-
        $license = '';
 
        $o = get_markup_template("register.tpl");
@@ -247,6 +253,8 @@ function register_content(&$a) {
 
        call_hooks('register_form',$arr);
 
+       $o = $arr['template'];
+
        $o = replace_macros($o, array(
                '$oidhtml' => $oidhtml,
                '$invitations' => get_config('system','invitation_only'),
@@ -256,7 +264,7 @@ function register_content(&$a) {
                '$realpeople' => $realpeople,
                '$regtitle'  => t('Registration'),
                '$registertext' =>((x($a->config,'register_text'))
-                       ? '<div class="error-message">' . $a->config['register_text'] . '</div>'
+                       ? bbcode($a->config['register_text'])
                        : "" ),
                '$fillwith'  => $fillwith,
                '$fillext'   => $fillext,
@@ -264,7 +272,7 @@ function register_content(&$a) {
                '$openid'    => $openid_url,
                '$namelabel' => t('Your Full Name ' . "\x28" . 'e.g. Joe Smith' . "\x29" . ': '),
                '$addrlabel' => t('Your Email Address: '),
-               '$nickdesc'  => t('Choose a profile nickname. This must begin with a text character. Your profile address on this site will then be \'<strong>nickname@$sitename</strong>\'.'),
+               '$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 \'<strong>nickname@$sitename</strong>\'.')),
                '$nicklabel' => t('Choose a nickname: '),
                '$photo'     => $photo,
                '$publish'   => $profile_publish,
@@ -273,7 +281,10 @@ function register_content(&$a) {
                '$email'     => $email,
                '$nickname'  => $nickname,
                '$license'   => $license,
-               '$sitename'  => $a->get_hostname()
+               '$sitename'  => $a->get_hostname(),
+               '$importh'   => t('Import'),
+               '$importt'   => t('Import your profile to this friendica instance'),
+
        ));
        return $o;