ReportedContent
in package
implements
ActionInterface
uses
ActionTrait, BackwardCompatibility
Handles reported members and posts, as well as moderation comments.
Table of Contents
Interfaces
- ActionInterface
- Interface for all action classes.
Properties
- $subaction : string
- $subactions : array<string|int, mixed>
- $type : string
- $types : array<string|int, mixed>
- $manage_bans : bool
- $obj : static
- $remove_any_boards : array<string|int, mixed>
Methods
- 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.
- comment() : void
- Creates and deletes moderator comments.
- details() : void
- Shows detailed information about a report, such as report comments and moderator comments.
- 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.
- load() : static
- Static wrapper for constructor.
- modifyComment() : void
- Shows a textarea for editing a moderator comment.
- recountOpenReports() : int
- Recount all open reports. Sets a SESSION var with the updated info.
- setState() : void
- Performs closing and ignoring actions for a given report.
- show() : void
- Shows all currently open reported posts.
- showClosed() : void
- Shows all currently closed reported posts.
- subActionProvider() : null|array<string|int, mixed>
- Called by Subs-Compat.php BackwardCompatibility wrapper functions to provide subaction execution for existing mods
- __construct() : mixed
- Constructor. Protected to force instantiation via self::load().
- buildQuickButtons() : void
- Sets up information for the quick buttons for each report
- clearReportAlerts() : void
- Upon close/ignore, mark unread alerts as read.
- countReports() : int
- Counts how many reports there are in total. Used for creating pagination.
- deleteModComment() : void
- Deletes a moderator comment from the DB.
- editModComment() : void
- Saves the new information whenever a moderator comment is edited.
- getCommentModDetails() : array<string|int, mixed>
- Gets specific details about a moderator comment.
- getReportComments() : array<string|int, mixed>
- Gets both report comments as well as any moderator comment.
- getReportDetails() : array<string|int, mixed>
- Gets additional information for a specific report.
- getReports() : array<string|int, mixed>
- Get all possible reports the current user can see.
- saveModComment() : void
- Inserts a new moderator comment to the DB.
- updateReport() : void
- Updates a report with the given parameters.
Properties
$subaction
public
string
$subaction
= 'show'
The requested sub-action. This should be set by the constructor.
$subactions
public
static array<string|int, mixed>
$subactions
= ['show' => 'show', 'closed' => 'showClosed', 'details' => 'details', 'handle' => 'setState', 'handlecomment' => 'comment', 'editcomment' => 'modifyComment']
Available sub-actions.
$type
public
string
$type
= ''
The requested report type.
$types
public
static array<string|int, mixed>
$types
= ['posts', 'members']
Supported report types
$manage_bans
protected
bool
$manage_bans
= false
Whether the current user has the manage_bans permission.
$obj
protected
static static
$obj
An instance of this class. This is used by the load() method to prevent multiple instantiations.
$remove_any_boards
protected
array<string|int, mixed>
$remove_any_boards
= []
Boards where the current user can remove any message.
Methods
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.
comment()
Creates and deletes moderator comments.
public
comment() : void
details()
Shows detailed information about a report, such as report comments and moderator comments.
public
details() : void
Shows a list of moderation actions for the specific report.
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
boolload()
Static wrapper for constructor.
public
static load() : static
Return values
static —An instance of this class.
modifyComment()
Shows a textarea for editing a moderator comment.
public
modifyComment() : void
Handles the edited comment and stores it in the DB.
recountOpenReports()
Recount all open reports. Sets a SESSION var with the updated info.
public
static recountOpenReports(string $type) : int
Parameters
- $type : string
-
the type of reports to count
Return values
int —the update open report count.
setState()
Performs closing and ignoring actions for a given report.
public
setState() : void
show()
Shows all currently open reported posts.
public
show() : void
Handles closing multiple reports.
showClosed()
Shows all currently closed reported posts.
public
showClosed() : void
subActionProvider()
Called by Subs-Compat.php BackwardCompatibility wrapper functions to provide subaction execution for existing mods
public
static subActionProvider([null|string $sa = null ][, bool $return_config = false ][, string|null $activity = null ]) : null|array<string|int, mixed>
Parameters
- $sa : null|string = null
- $return_config : bool = false
- $activity : string|null = null
Return values
null|array<string|int, mixed>__construct()
Constructor. Protected to force instantiation via self::load().
protected
__construct() : mixed
buildQuickButtons()
Sets up information for the quick buttons for each report
protected
buildQuickButtons() : void
clearReportAlerts()
Upon close/ignore, mark unread alerts as read.
protected
clearReportAlerts(string $log_report, array<string|int, mixed> $extra) : void
Parameters
- $log_report : string
-
What action is being taken.
- $extra : array<string|int, mixed>
-
Detailed info about the report.
countReports()
Counts how many reports there are in total. Used for creating pagination.
protected
countReports([int $closed = 0 ]) : int
Parameters
- $closed : int = 0
-
1 for counting closed reports, 0 for open ones.
Return values
int —How many reports.
deleteModComment()
Deletes a moderator comment from the DB.
protected
deleteModComment(int $comment_id) : void
Parameters
- $comment_id : int
-
The moderator comment ID used to identify which report will be deleted.
editModComment()
Saves the new information whenever a moderator comment is edited.
protected
editModComment(int $comment_id, string $edited_comment) : void
Parameters
- $comment_id : int
-
The edited moderator comment ID.
- $edited_comment : string
-
The edited moderator comment text.
getCommentModDetails()
Gets specific details about a moderator comment.
protected
getCommentModDetails(int $comment_id) : array<string|int, mixed>
It also adds a permission for editing/deleting the comment. By default only admins and the author of the comment can edit/delete it.
Parameters
- $comment_id : int
-
The moderator comment ID to get the info from.
Return values
array<string|int, mixed> —An array with the fetched data.
getReportComments()
Gets both report comments as well as any moderator comment.
protected
getReportComments(int $report_id) : array<string|int, mixed>
Parameters
- $report_id : int
-
The report ID to get the info from.
Return values
array<string|int, mixed> —An associative array with 2 keys: comments and mod_comments.
getReportDetails()
Gets additional information for a specific report.
protected
getReportDetails(int $report_id) : array<string|int, mixed>
Parameters
- $report_id : int
-
The report ID to get the info from.
Return values
array<string|int, mixed> —The report data.
getReports()
Get all possible reports the current user can see.
protected
getReports([int $closed = 0 ]) : array<string|int, mixed>
Parameters
- $closed : int = 0
-
1 for closed reports, 0 for open ones.
Return values
array<string|int, mixed> —The reports data, with the report ID as key.
saveModComment()
Inserts a new moderator comment to the DB.
protected
saveModComment(int $report_id, array<string|int, mixed> $data) : void
Parameters
- $report_id : int
-
The report ID is used to fire a notification about the event.
- $data : array<string|int, mixed>
-
a formatted array of data to be inserted. Should be already properly sanitized.
updateReport()
Updates a report with the given parameters.
protected
updateReport(string $action, int $value, int|array<string|int, mixed> $report_id) : void
Logs each action via Logging::logAction().
Parameters
- $action : string
-
The action to perform. Accepts "closed" and "ignore".
- $value : int
-
The new value to update.
- $report_id : int|array<string|int, mixed>
-
The affected report(s).