use Friendica\Model;
use Friendica\Model\User;
use Friendica\Util\Proxy;
-use Friendica\Util\Strings;
/**
* @author Hypolite Petovan <hypolite@mrpetovan.com>
const APPROVE = 1;
const OPEN = 2;
+ /** @var Tos */
+ protected $tos;
+
+ public function __construct(Tos $tos, L10n $l10n, array $parameters = [])
+ {
+ parent::__construct($l10n, $parameters);
+
+ $this->tos = $tos;
+ }
+
/**
* Module GET method to display any content
*
*
* @return string
*/
- public static function content(array $parameters = [])
+ public function content(): string
{
// logged in users can register others (people/pages/groups)
// even with closed registrations, unless specifically prohibited by site policy.
if ($max_dailies) {
$count = DBA::count('user', ['`register_date` > UTC_TIMESTAMP - INTERVAL 1 day']);
if ($count >= $max_dailies) {
- Logger::log('max daily registrations exceeded.');
+ Logger::notice('max daily registrations exceeded.');
notice(DI::l10n()->t('This site has exceeded the number of allowed daily account registrations. Please try again tomorrow.'));
return '';
}
$tpl = $arr['template'];
- $tos = new Tos();
-
$o = Renderer::replaceMacros($tpl, [
'$invitations' => DI::config()->get('system', 'invitation_only'),
'$permonly' => intval(DI::config()->get('config', 'register_policy')) === self::APPROVE,
'$showtoslink' => DI::config()->get('system', 'tosdisplay'),
'$tostext' => DI::l10n()->t('Terms of Service'),
'$showprivstatement' => DI::config()->get('system', 'tosprivstatement'),
- '$privstatement'=> $tos->privacy_complete,
+ '$privstatement'=> $this->tos->privacy_complete,
'$form_security_token' => BaseModule::getFormSecurityToken('register'),
'$explicit_content' => DI::config()->get('system', 'explicit_content', false),
'$explicit_content_note' => DI::l10n()->t('Note: This node explicitly contains adult content'),
* Extend this method if the module is supposed to process POST requests.
* Doesn't display any content
*/
- public static function post(array $parameters = [])
+ public function post()
{
BaseModule::checkFormSecurityTokenRedirectOnError('/register', 'register');
$using_invites = DI::config()->get('system', 'invitation_only');
$num_invites = DI::config()->get('system', 'number_invites');
- $invite_id = (!empty($_POST['invite_id']) ? Strings::escapeTags(trim($_POST['invite_id'])) : '');
+ $invite_id = (!empty($_POST['invite_id']) ? trim($_POST['invite_id']) : '');
if (intval(DI::config()->get('config', 'register_policy')) === self::OPEN) {
if ($using_invites && $invite_id) {
// send notification to admins
while ($admin = DBA::fetch($admins_stmt)) {
- \notification([
+ DI::notify()->createFromArray([
'type' => Model\Notification\Type::SYSTEM,
'event' => 'SYSTEM_REGISTER_REQUEST',
'uid' => $admin['uid'],
'source_mail' => $user['email'],
'source_nick' => $user['nickname'],
'source_link' => $base_url . '/admin/users/',
- 'source_photo' => User::getAvatarUrlForId($user['uid'], Proxy::SIZE_THUMB),
+ 'source_photo' => User::getAvatarUrl($user, Proxy::SIZE_THUMB),
'show_in_notification_page' => false
]);
}