ReportToMod
in package
implements
ActionInterface
Uses
BackwardCompatibility
Deals with reporting posts or profiles to mods and admins.
Table of Contents
Interfaces
- ActionInterface
- Interface for all action classes.
Properties
- $subaction : string
- $subactions : array<string|int, mixed>
- $can_submit : bool
- $comment : string
- $obj : object
- $previewing : bool
- $submitting : bool
- $backcompat : array<string|int, mixed>
Methods
- call() : void
- Convenience method to load() and execute() an instance of this class.
- execute() : void
- Dispatcher to whichever sub-action method is necessary.
- exportStatic() : void
- Provides a way to export a class's public static properties and methods to global namespace.
- load() : object
- Static wrapper for constructor.
- reportPost() : void
- Backward compatibility wrapper for the reportMsg() method.
- ReportToModerator2() : void
- Backward compatibility wrapper for the submit sub-action.
- reportUser() : void
- Backward compatibility wrapper for the reportMember() method.
- show() : void
- Report a post or profile to the moderator... ask for a comment.
- submit() : void
- __construct() : mixed
- Constructor. Protected to force instantiation via self::load().
- reportMember() : mixed
- Actually reports a user's profile using information specified from a form
- reportMsg() : mixed
- Actually reports a post using information specified from a form
- setPreview() : mixed
- Sets Utils::$context['preview_message'] based on $this->comment.
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', 'submit' => 'submit']
Available sub-actions.
$can_submit
protected
bool
$can_submit
= false
Whether they can submit the report.
$comment
protected
string
$comment
= ''
The text content of the report.
$obj
protected
static object
$obj
An instance of this class. This is used by the load() method to prevent mulitple instantiations.
$previewing
protected
bool
$previewing
= false
Whether they want to see a preview of the report.
$submitting
protected
bool
$submitting
= false
Whether they want to submit the report.
$backcompat
private
static array<string|int, mixed>
$backcompat
= ['func_names' => ['call' => 'ReportToModerator', 'ReportToModerator2' => 'ReportToModerator2', 'reportPost' => 'reportPost', 'reportUser' => 'reportUser']]
BackwardCompatibility settings for this class.
Methods
call()
Convenience method to load() and execute() an instance of this class.
public
static call() : void
execute()
Dispatcher to whichever sub-action method is necessary.
public
execute() : void
exportStatic()
Provides a way to export a class's public static properties and methods to global namespace.
public
static exportStatic() : void
To do so:
- Use this trait in the class.
- At the END of the class's file, call its exportStatic() method.
Although it might not seem that way at first glance, this approach conforms to section 2.3 of PSR 1, since executing this method is simply a dynamic means of declaring functions when the file is included; it has no other side effects.
Regarding the $backcompat items:
A class's static properties are not exported to global variables unless explicitly included in $backcompat['prop_names']. Likewise, a class's static methods are not exported as global functions unless explicitly included in $backcompat['func_names'].
$backcompat['prop_names'] is a simple array where the keys are the names of one or more of a class's static properties, and the values are the names of global variables. In each case, the global variable will be set to a reference to the static property. Static properties that are not named in this array will not be exported.
$backcompat['func_names'] is a simple array where the keys are the names of one or more of a class's static methods, and the values are the names that should be used for global functions that will encapsulate those methods. Methods that are not named in this array will not be exported.
Adding non-static properties or methods to the $backcompat arrays will produce runtime errors. It is the responsibility of the developer to make sure not to do this.
load()
Static wrapper for constructor.
public
static load() : object
Return values
object —An instance of this class.
reportPost()
Backward compatibility wrapper for the reportMsg() method.
public
static reportPost(mixed $msg, mixed $reason) : void
In theory, no modifications should ever have called this, but...
Parameters
- $msg : mixed
- $reason : mixed
ReportToModerator2()
Backward compatibility wrapper for the submit sub-action.
public
static ReportToModerator2() : void
In theory, no modifications should ever have called this, but...
reportUser()
Backward compatibility wrapper for the reportMember() method.
public
static reportUser(mixed $id_member, mixed $reason) : void
In theory, no modifications should ever have called this, but...
Parameters
- $id_member : mixed
- $reason : mixed
show()
Report a post or profile to the moderator... ask for a comment.
public
show() : void
Gathers data from the user to report abuse to the moderator(s). Uses the ReportToModerator template, main sub template. Requires the report_any or report_user permission. Accessed through ?action=reporttm.
submit()
public
submit() : void
__construct()
Constructor. Protected to force instantiation via self::load().
protected
__construct() : mixed
reportMember()
Actually reports a user's profile using information specified from a form
protected
reportMember(int $id_member) : mixed
Parameters
- $id_member : int
-
The ID of the member whose profile is being reported
reportMsg()
Actually reports a post using information specified from a form
protected
reportMsg(int $msg) : mixed
Parameters
- $msg : int
-
The ID of the post being reported
setPreview()
Sets Utils::$context['preview_message'] based on $this->comment.
protected
setPreview() : mixed