]> git.mxchange.org Git - friendica.git/blobdiff - mod/register.php
Merge pull request #5267 from miqrogroove/patch-2
[friendica.git] / mod / register.php
index a2f5ddc5185dec482608201df98ac7856b83c8d1..ee614f64d84d703735d1d8442c9221fe63ba48af 100644 (file)
@@ -2,7 +2,9 @@
 /**
  * @file mod/register.php
  */
+
 use Friendica\App;
+use Friendica\Content\Text\BBCode;
 use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
@@ -10,9 +12,10 @@ use Friendica\Core\PConfig;
 use Friendica\Core\System;
 use Friendica\Core\Worker;
 use Friendica\Model\User;
+use Friendica\Module\Tos;
+use Friendica\Util\DateTimeFormat;
 
 require_once 'include/enotify.php';
-require_once 'include/bbcode.php';
 
 function register_post(App $a)
 {
@@ -56,6 +59,7 @@ function register_post(App $a)
                        break;
        }
 
+       $netpublish = !empty($_POST['profile_publish_reg']);
 
        $arr = $_POST;
 
@@ -116,7 +120,7 @@ function register_post(App $a)
                $hash = random_string();
                $r = q("INSERT INTO `register` ( `hash`, `created`, `uid`, `password`, `language`, `note` ) VALUES ( '%s', '%s', %d, '%s', '%s', '%s' ) ",
                        dbesc($hash),
-                       dbesc(datetime_convert()),
+                       dbesc(DateTimeFormat::utcNow()),
                        intval($user['uid']),
                        dbesc($result['password']),
                        dbesc($lang),
@@ -130,7 +134,7 @@ function register_post(App $a)
                }
 
                // send email to admins
-               $admin_mail_list = "'" . implode("','", array_map(dbesc, explode(",", str_replace(" ", "", $a->config['admin_email'])))) . "'";
+               $admin_mail_list = "'" . implode("','", array_map("dbesc", explode(",", str_replace(" ", "", $a->config['admin_email'])))) . "'";
                $adminlist = q("SELECT uid, language, email FROM user WHERE email IN (%s)",
                        $admin_mail_list
                );
@@ -229,8 +233,8 @@ function register_content(App $a)
                $profile_publish = replace_macros($publish_tpl, [
                        '$instance' => 'reg',
                        '$pubdesc' => L10n::t('Include your profile in member directory?'),
-                       '$yes_selected' => ' checked="checked" ',
-                       '$no_selected' => '',
+                       '$yes_selected' => '',
+                       '$no_selected' => ' checked="checked"',
                        '$str_yes' => L10n::t('Yes'),
                        '$str_no' => L10n::t('No'),
                ]);
@@ -249,23 +253,25 @@ function register_content(App $a)
 
        $tpl = $arr['template'];
 
+       $tos = new Tos();
+
        $o = replace_macros($tpl, [
                '$oidhtml' => $oidhtml,
                '$invitations' => Config::get('system', 'invitation_only'),
                '$permonly'    => $a->config['register_policy'] == REGISTER_APPROVE,
                '$permonlybox' => ['permonlybox', L10n::t('Note for the admin'), '', L10n::t('Leave a message for the admin, why you want to join this node')],
                '$invite_desc' => L10n::t('Membership on this site is by invitation only.'),
-               '$invite_label' => L10n::t('Your invitation ID: '),
+               '$invite_label' => L10n::t('Your invitation code: '),
                '$invite_id'  => $invite_id,
                '$realpeople' => $realpeople,
                '$regtitle'  => L10n::t('Registration'),
-               '$registertext' => x($a->config, 'register_text') ? bbcode($a->config['register_text']) : "",
+               '$registertext' => BBCode::convert(Config::get('config', 'register_text', '')),
                '$fillwith'  => $fillwith,
                '$fillext'   => $fillext,
                '$oidlabel'  => $oidlabel,
                '$openid'    => $openid_url,
                '$namelabel' => L10n::t('Your Full Name ' . "\x28" . 'e.g. Joe Smith, real or real-looking' . "\x29" . ': '),
-               '$addrlabel' => L10n::t('Your Email Address: (Initial information will be send there, so this has to be an existing address.)'),
+               '$addrlabel' => L10n::t("Your Email Address: \x28Initial information will be send there, so this has to be an existing address.\x29"),
                '$passwords' => $passwords,
                '$password1' => ['password1', L10n::t('New Password:'), '', L10n::t('Leave empty for an auto generated password.')],
                '$password2' => ['confirm', L10n::t('Confirm:'), '', ''],
@@ -281,6 +287,11 @@ function register_content(App $a)
                '$sitename'  => $a->get_hostname(),
                '$importh'   => L10n::t('Import'),
                '$importt'   => L10n::t('Import your profile to this friendica instance'),
+               '$showtoslink' => Config::get('system', 'tosdisplay'),
+               '$tostext'   => L10n::t('Terms of Service'),
+               '$showprivstatement' => Config::get('system', 'tosprivstatement'),
+               '$privstatement' => $tos->privacy_complete,
+               '$baseurl'   => System::baseurl(),
                '$form_security_token' => get_form_security_token("register")
        ]);
        return $o;