Logout
extends Login2
in package
Logs the user out.
Table of Contents
Properties
- $subaction : string
- $subactions : array<string|int, mixed>
- $obj : static
Methods
- buildRoute() : array<string|int, mixed>
- Builds a routing path based on URL query parameters.
- call() : void
- Convenience method to load() and execute() an instance of this class.
- canBeLogged() : bool
- Determines whether this action can be logged in the online log.
- canShowDebuggingInfo() : bool
- Determines whether debugging info should be shown.
- canShowInMaintenanceMode() : bool
- Determines whether this action allows access in maintenance mode.
- checkAjax() : void
- Checks whether this is an AJAX request.
- checkCookie() : void
- Double check the cookie.
- execute() : void
- Logs the current user out of their account.
- getOutputType() : OutputTypeInterface
- Gets the output type for this action.
- isAgreementAction() : bool
- Determines whether this action can be accessed without accepting the registration agreement and privacy policy.
- isRestrictedGuestAccessAllowed() : bool
- Determines whether this action allows access if guest access is disabled.
- isSimpleAction() : bool
- Determines whether this is a simple action.
- load() : static
- Static wrapper for constructor.
- main() : void
- Performs checks and then logs the guest in (if they pass the tests).
- parseRoute() : array<string|int, mixed>
- Parses a route to get URL query parameters.
- updateSalt() : void
- Update the user's password salt.
- validatePasswordFlood() : void
- This protects against brute force attacks on a member's password.
- __construct() : mixed
- Constructor. Protected to force instantiation via self::load().
- buildActionRoute() : array<string|int, mixed>
- Builds a routing path for an action based on URL query parameters.
- checkActivation() : bool
- Check activation status of the current user.
- checkPasswordFallbacks() : bool
- Checks $_POST['passwrd'] against other possible encrypted strings.
- DoLogin() : void
- Perform the logging in. (set cookie, call hooks, etc)
- parseActionRoute() : array<string|int, mixed>
- Parses a route for an action to get URL query parameters.
- phpBB3_password_check() : string|null
- Custom encryption for phpBB3 based passwords.
- validateInput() : bool
- Checks that $_POST['user'] and $_POST['passwrd'] aren't obviously valid.
Properties
$subaction
public
string
$subaction
= 'main'
The requested sub-action. This should be set by the constructor.
$subactions
public
static array<string|int, mixed>
$subactions
= ['main' => 'main', 'salt' => 'updateSalt', 'check' => 'checkCookie']
Available sub-actions.
$obj
protected
static static
$obj
An instance of this class. This is used by the load() method to prevent multiple instantiations.
Methods
buildRoute()
Builds a routing path based on URL query parameters.
public
static buildRoute(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
- $params : array<string|int, mixed>
-
URL query parameters.
Return values
array<string|int, mixed> —Contains two elements: ['route' => [], 'params' => []]. The 'route' element contains the routing path. The 'params' element contains any $params that weren't incorporated into the route.
call()
Convenience method to load() and execute() an instance of this class.
public
static call([bool $internal = false ][, bool $redirect = true ]) : void
Parameters
- $internal : bool = false
-
If true, it doesn't check the session
- $redirect : bool = true
-
Whether or not to redirect the user after they log out
canBeLogged()
Determines whether this action can be logged in the online log.
public
canBeLogged() : bool
Return values
boolcanShowDebuggingInfo()
Determines whether debugging info should be shown.
public
canShowDebuggingInfo() : bool
Return values
boolcanShowInMaintenanceMode()
Determines whether this action allows access in maintenance mode.
public
canShowInMaintenanceMode() : bool
Return values
bool —True if access is allowed, false otherwise.
checkAjax()
Checks whether this is an AJAX request.
public
static checkAjax() : void
If so, does the following:
- Sets Utils::$context['from_ajax'] to true.
- Sets Utils::$context['template_layers'] to an empty array.
checkCookie()
Double check the cookie.
public
checkCookie() : void
..
execute()
Logs the current user out of their account.
public
execute([bool $internal = false ][, bool $redirect = true ]) : void
It requires that the session hash is sent as well, to prevent automatic logouts by images or javascript.
It redirects back to $_SESSION['logout_url'], if it exists.
It is accessed via ?action=logout;session_var=...
Parameters
- $internal : bool = false
-
If true, it doesn't check the session
- $redirect : bool = true
-
Whether or not to redirect the user after they log out
getOutputType()
Gets the output type for this action.
public
getOutputType() : OutputTypeInterface
Return values
OutputTypeInterfaceisAgreementAction()
Determines whether this action can be accessed without accepting the registration agreement and privacy policy.
public
isAgreementAction() : bool
Return values
boolisRestrictedGuestAccessAllowed()
Determines whether this action allows access if guest access is disabled.
public
isRestrictedGuestAccessAllowed() : bool
Return values
bool —True if access is allowed, false otherwise.
isSimpleAction()
Determines whether this is a simple action.
public
isSimpleAction() : bool
Simple actions don't require the index template at all.
Return values
boolload()
Static wrapper for constructor.
public
static load() : static
Return values
static —An instance of this class.
main()
Performs checks and then logs the guest in (if they pass the tests).
public
main() : void
parseRoute()
Parses a route to get URL query parameters.
public
static parseRoute(array<string|int, mixed> $route[, array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
- $route : array<string|int, mixed>
-
Array of routing path components.
- $params : array<string|int, mixed> = []
-
Any existing URL query parameters.
Return values
array<string|int, mixed> —URL query parameters
updateSalt()
Update the user's password salt.
public
updateSalt() : void
validatePasswordFlood()
This protects against brute force attacks on a member's password.
public
static validatePasswordFlood(int $id_member, string $member_name[, bool|string $password_flood_value = false ][, bool $was_correct = false ][, bool $tfa = false ]) : void
Importantly, even if the password was right we DON'T TELL THEM!
Parameters
- $id_member : int
-
The ID of the member
- $member_name : string
-
The name of the member.
- $password_flood_value : bool|string = false
-
False if we don't have a flood value, otherwise a string with a timestamp and number of tries separated by a |
- $was_correct : bool = false
-
Whether or not the password was correct
- $tfa : bool = false
-
Whether we're validating for two-factor authentication
__construct()
Constructor. Protected to force instantiation via self::load().
protected
__construct() : mixed
buildActionRoute()
Builds a routing path for an action based on URL query parameters.
protected
static buildActionRoute(array<string|int, mixed> &$params) : array<string|int, mixed>
The 'action', 'area', and 'sa' parameters will be mapped to route path components in that order. The 'action' parameter is required, whereas 'area' and 'sa' are optional and will be silently skipped if not set.
The parameters are passed by reference and parameters are removed from the array when recognized. This lets wrapper methods continue parsing the remainder of the parameters without worrying about duplicate elements.
Parameters
- $params : array<string|int, mixed>
-
URL query parameters.
Return values
array<string|int, mixed> —The route path elements.
checkActivation()
Check activation status of the current user.
protected
checkActivation() : bool
Return values
bool —True if they are activated, false otherwise.
checkPasswordFallbacks()
Checks $_POST['passwrd'] against other possible encrypted strings.
protected
checkPasswordFallbacks() : bool
If a match is found, the old encrypted string is replaced with an updated version that uses modern encryption.
This allows seamlessly updating the encryption after the forum has been upgraded or converted.
Return values
bool —Whether the supplied password was correct.
DoLogin()
Perform the logging in. (set cookie, call hooks, etc)
protected
DoLogin() : void
parseActionRoute()
Parses a route for an action to get URL query parameters.
protected
static parseActionRoute(array<string|int, mixed> &$route) : array<string|int, mixed>
The first element of the route path is mapped to the 'action' parameter.
For the 'admin', 'moderate', and 'profile' actions, the second element of the route is mapped to the 'area' parameter and the third element is mapped to the 'sa' parameter.
For all other actions, the second element of the route path is mapped to the 'sa' parameter.
The route passed by reference and route path elements are removed from the route when recognized. This lets wrapper methods continue parsing the remainder of the route without worrying about duplicate elements.
Parameters
- $route : array<string|int, mixed>
-
Array of routing path components.
Return values
array<string|int, mixed> —URL query parameters
phpBB3_password_check()
Custom encryption for phpBB3 based passwords.
protected
phpBB3_password_check(string $passwd, string $passwd_hash) : string|null
Parameters
- $passwd : string
- $passwd_hash : string
Return values
string|null —The hashed version of $_POST['passwrd']
validateInput()
Checks that $_POST['user'] and $_POST['passwrd'] aren't obviously valid.
protected
validateInput() : bool
Return values
bool —False if either URL param is obviously invalid.