namespace Friendica\Module;
+use Friendica\App\BaseURL;
use Friendica\BaseModule;
use Friendica\Content\Text\BBCode;
use Friendica\Core\Config;
*
* @return string
*/
- public static function content()
+ public static function content(array $parameters = [])
{
// logged in users can register others (people/pages/groups)
// even with closed registrations, unless specifically prohibited by site policy.
}
}
- $username = defaults($_REQUEST, 'username' , '');
- $email = defaults($_REQUEST, 'email' , '');
- $openid_url = defaults($_REQUEST, 'openid_url', '');
- $nickname = defaults($_REQUEST, 'nickname' , '');
- $photo = defaults($_REQUEST, 'photo' , '');
- $invite_id = defaults($_REQUEST, 'invite_id' , '');
+ $username = $_REQUEST['username'] ?? '';
+ $email = $_REQUEST['email'] ?? '';
+ $openid_url = $_REQUEST['openid_url'] ?? '';
+ $nickname = $_REQUEST['nickname'] ?? '';
+ $photo = $_REQUEST['photo'] ?? '';
+ $invite_id = $_REQUEST['invite_id'] ?? '';
if (Config::get('system', 'no_openid')) {
$fillwith = '';
* Extend this method if the module is supposed to process POST requests.
* Doesn't display any content
*/
- public static function post()
+ public static function post(array $parameters = [])
{
BaseModule::checkFormSecurityTokenRedirectOnError('/register', 'register');
$user = $result['user'];
+ $base_url = self::getClass(BaseURL::class)->get();
+
if ($netpublish && intval(Config::get('config', 'register_policy')) !== self::APPROVE) {
- $url = $a->getBaseUrl() . '/profile/' . $user['nickname'];
+ $url = $base_url . '/profile/' . $user['nickname'];
Worker::add(PRIORITY_LOW, 'Directory', $url);
}
$res = Model\User::sendRegisterOpenEmail(
$user,
Config::get('config', 'sitename'),
- $a->getBaseUrl(),
+ $base_url,
$result['password']
);
L10n::t('Failed to send email message. Here your accout details:<br> login: %s<br> password: %s<br><br>You can change your password after login.',
$user['email'],
$result['password'])
- . EOL
);
}
} else {
$a->internalRedirect('register/');
}
+ // Is there text in the tar pit?
+ if (!empty($_POST['registertarpit'])) {
+ \notice(L10n::t('You have entered too much information.'));
+ $a->internalRedirect('register/');
+ }
Model\Register::createForApproval($user['uid'], Config::get('system', 'language'), $_POST['permonlybox']);
'source_name' => $user['username'],
'source_mail' => $user['email'],
'source_nick' => $user['nickname'],
- 'source_link' => $a->getBaseUrl() . '/admin/users/',
- 'link' => $a->getBaseUrl() . '/admin/users/',
- 'source_photo' => $a->getBaseUrl() . '/photo/avatar/' . $user['uid'] . '.jpg',
+ 'source_link' => $base_url . '/admin/users/',
+ 'link' => $base_url . '/admin/users/',
+ 'source_photo' => $base_url . '/photo/avatar/' . $user['uid'] . '.jpg',
'to_email' => $admin['email'],
'uid' => $admin['uid'],
- 'language' => defaults($admin, 'language', 'en'),
+ 'language' => ($admin['language'] ?? '') ?: 'en',
'show_in_notification_page' => false
]);
}
Model\User::sendRegisterPendingEmail(
$user,
Config::get('config', 'sitename'),
- $a->getBaseURL(),
+ $base_url,
$result['password']
);