Logs
in package
implements
ActionInterface
uses
ActionTrait
The moderation and administration logs are this class's only job.
It views them, and that's about all it does.
Table of Contents
Interfaces
- ActionInterface
- Interface for all action classes.
Properties
- $action : string
- $actions : array<string|int, mixed>
- $per_page : int
- $search_types : array<string|int, mixed>
- $sort_types : array<string|int, mixed>
- $subaction : string
- $subactions : array<string|int, mixed>
- $uneditable_actions : array<string|int, mixed>
- $can_delete : bool
- $encoded_search_params : string
- $log_type : int
- $obj : static
- $search_info : array<string|int, mixed>
- $search_params : array<string|int, mixed>
- $search_params_column : string
- $search_params_string : string
- $search_params_type : string
- $sort : string
- $url_start : string
Methods
- adminlog() : void
- Handles the admin log.
- 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.
- execute() : void
- Dispatcher to whichever sub-action method is necessary.
- 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 restricted.
- isSimpleAction() : bool
- Determines whether this is a simple action.
- list_getModLogEntries() : array<string|int, mixed>
- Gets the moderation log entries that match the specified parameters.
- list_getModLogEntryCount() : int
- Get the number of mod log entries.
- load() : static
- Static wrapper for constructor.
- modlog() : void
- Handles the moderation log
- __construct() : mixed
- Constructor. Protected to force instantiation via self::load().
- createList() : void
- Sets up all the information for the admin or mod log
- deleteAll() : void
- Handles deleting all entries in either the mod or admin logs
- deleteEntries() : void
- Handles deleting log entries
- deleteEntry() : void
- Deletes a single log entry
- setupSearch() : void
- Sets up the search
Properties
$action
public
string
$action
= 'moderate'
The requested action. This should be set by the constructor.
$actions
public
static array<string|int, mixed>
$actions
= ['moderate', 'admin']
Actions that might call this class.
$per_page
public
int
$per_page
= 30
How many log entries to show per page.
$search_types
public
static array<string|int, mixed>
$search_types
= ['action' => ['sql' => 'lm.action', 'label' => 'modlog_action'], 'member' => ['sql' => 'mem.real_name', 'label' => 'modlog_member'], 'group' => ['sql' => 'mg.group_name', 'label' => 'modlog_position'], 'ip' => ['sql' => 'lm.ip', 'label' => 'modlog_ip']]
This array houses all the valid search types.
$sort_types
public
static array<string|int, mixed>
$sort_types
= ['action' => 'lm.action', 'time' => 'lm.log_time', 'member' => 'mem.real_name', 'group' => 'mg.group_name', 'ip' => 'lm.ip']
Instructions for how to sort columns.
$subaction
public
string
$subaction
= 'modlog'
The requested sub-action. This should be set by the constructor.
$subactions
public
static array<string|int, mixed>
$subactions
= ['modlog' => 'modlog', 'adminlog' => 'adminlog']
Available sub-actions.
$uneditable_actions
public
static array<string|int, mixed>
$uneditable_actions
= ['agreement_updated', 'policy_updated']
Actions whose log entries cannot be deleted.
$can_delete
protected
bool
$can_delete
= false
Whether the current user can delete log entries.
$encoded_search_params
protected
string
$encoded_search_params
URL-encoded search params
$log_type
protected
int
$log_type
= 1
The log type to show. 1 for the moderation log. 3 for the administration log.
$obj
protected
static static
$obj
An instance of this class. This is used by the load() method to prevent multiple instantiations.
$search_info
protected
array<string|int, mixed>
$search_info
$search_params
protected
array<string|int, mixed>
$search_params
An array of search parameters
$search_params_column
protected
string
$search_params_column
The column being searched
$search_params_string
protected
string
$search_params_string
The search parameters string
$search_params_type
protected
string
$search_params_type
= 'member'
$sort
protected
string
$sort
= 'time'
$url_start
protected
string
$url_start
= ''
Methods
adminlog()
Handles the admin log.
public
adminlog() : void
Tags
call()
Convenience method to load() and execute() an instance of this class.
public
static call() : void
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.
execute()
Dispatcher to whichever sub-action method is necessary.
public
execute() : void
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 restricted.
public
isRestrictedGuestAccessAllowed() : bool
Return values
bool —True if access is allowed, false otherwise.
isSimpleAction()
Determines whether this is a simple action.
public
isSimpleAction() : bool
Return values
boollist_getModLogEntries()
Gets the moderation log entries that match the specified parameters.
public
static list_getModLogEntries(int $start, int $items_per_page, string $sort[, string $query_string = '' ][, array<string|int, mixed> $query_params = [] ][, int $log_type = 1 ][, bool $ignore_boards = false ]) : array<string|int, mixed>
Callback for SMF\ItemList().
Parameters
- $start : int
-
The item to start with (for pagination purposes)
- $items_per_page : int
-
The number of items to show per page
- $sort : string
-
A string indicating how to sort the results
- $query_string : string = ''
-
An extra string for the WHERE clause of the query, to further filter results
- $query_params : array<string|int, mixed> = []
-
An array of parameters for the query string
- $log_type : int = 1
-
The log type - 1 for mod log or 3 for admin log
- $ignore_boards : bool = false
-
Whether to ignore board restrictions
Return values
array<string|int, mixed> —An array of info about the mod log entries
list_getModLogEntryCount()
Get the number of mod log entries.
public
static list_getModLogEntryCount([string $query_string = '' ][, array<string|int, mixed> $query_params = [] ][, int $log_type = 1 ][, bool $ignore_boards = false ]) : int
Callback for SMF\ItemList().
Parameters
- $query_string : string = ''
-
An extra string for the WHERE clause in the query to further filter results
- $query_params : array<string|int, mixed> = []
-
An array of parameters for the query_string
- $log_type : int = 1
-
The log type (1 for mod log, 3 for admin log)
- $ignore_boards : bool = false
-
Whether to ignore board restrictions
Return values
int —Total number of visible log entries.
load()
Static wrapper for constructor.
public
static load() : static
Return values
static —An instance of this class.
modlog()
Handles the moderation log
public
modlog() : void
Tags
__construct()
Constructor. Protected to force instantiation via self::load().
protected
__construct() : mixed
createList()
Sets up all the information for the admin or mod log
protected
createList() : void
deleteAll()
Handles deleting all entries in either the mod or admin logs
protected
deleteAll() : void
deleteEntries()
Handles deleting log entries
protected
deleteEntries() : void
deleteEntry()
Deletes a single log entry
protected
deleteEntry() : void
setupSearch()
Sets up the search
protected
setupSearch() : void