The NULL_DATE constant is defined conditionally in the DBA static class.
This causes issues with static analyzing tools like PHPStan, because
they can not really know if the constant is defined or not.
We could make PHPStan ignore this, but since there already is a
`get_null_date()` method on the `dba_driver` class, this patch
changes the code to use this method instead.
We could also use the public static attribute `$null_date` on the DBA
class directly, but using a method feels cleaner, and allows for making
the attribute private, or even removing it completely at some later
time.
I'm not removing the NULL_DATE constant for now, in case it is in use by
any extensions.
Existing function account_allow() does not seem to be used a whole
lot, and certainly not when approving a registration request.
Created new function send_reg_confirmation_email_from_register
(going for longest-function-name-in-Hubzilla) which attempts to
send such a confirmation email, and also a new email template.
Plugged this into the create_account_from_register function.
Open question: Should the sending of this email be among the success
criteria for the create_account_from_register function?
Since there is no easy way to produce direct links to approve/reject
registrations, create new email template which simply links to the
Accounts admin page.
In response to comments:
- Add type annotations
- Simplify some 'if' statements
- add and fix some whitespace
- simplify input arguments to the function
Current send_reg_approval_email function expects account to already
exist, and does not seem to be called anywhere. New function takes
necessary information from the register table.
Added call to new function in Regate.php after verification is
done. Will fail and roll back if the function call fails or if no
admin accounts were found to notify (delivered<1).
- Add type annotations, and change arg to a string instead of array.
Only the email address was used anyways.
- Fix indentation
- Improve API doc and remove unnecessary comments.