Main
in package
implements
ActionInterface, Routable
uses
ActionRouter, ActionTrait
This is the Moderation Center.
Table of Contents
Interfaces
- ActionInterface
- Interface for all action classes.
- Routable
- Classes implementing this interface can build routes from URL query parameters and parse routes back into URL query parameters.
Properties
- $moderation_areas : array<string|int, mixed>
- $access_checked : bool
- $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.
- checkAccessPermissions() : void
- Figures out which parts of the moderation center can be accessed by the current user.
- createMenu() : void
- Creates the moderation center menu.
- execute() : void
- Dispatcher.
- 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.
- parseRoute() : array<string|int, mixed>
- Parses a route to get URL query parameters.
- __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.
- parseActionRoute() : array<string|int, mixed>
- Parses a route for an action to get URL query parameters.
- setModerationAreas() : void
- Sets any dynamic values in $this->moderation_areas.
Properties
$moderation_areas
public
array<string|int, mixed>
$moderation_areas
= ['main' => ['title' => 'mc_main', 'areas' => ['index' => ['label' => 'moderation_center', 'function' => __NAMESPACE__ . '\Home::call', 'icon' => 'administration'], 'modlogoff' => ['label' => 'mc_logoff', 'function' => __NAMESPACE__ . '\EndSession::call', 'enabled' => true, 'icon' => 'exit'], 'notice' => ['function' => __NAMESPACE__ . '\ShowNotice::call', 'select' => 'index']]], 'logs' => ['title' => 'mc_logs', 'areas' => ['modlog' => ['label' => 'modlog_view', 'enabled' => true, 'function' => __NAMESPACE__ . '\Logs::call', 'icon' => 'logs'], 'warnings' => ['label' => 'mc_warnings', 'enabled' => true, 'function' => __NAMESPACE__ . '\Warnings::call', 'icon' => 'warning', 'subsections' => ['log' => ['label' => 'mc_warning_log', 'permission' => ['view_warning_any', 'moderate_forum']], 'templates' => ['label' => 'mc_warning_templates', 'permission' => 'issue_warning']]]]], 'posts' => ['title' => 'mc_posts', 'enabled' => true, 'areas' => ['postmod' => ['label' => 'mc_unapproved_posts', 'enabled' => true, 'function' => __NAMESPACE__ . '\Posts::call', 'icon' => 'posts', 'custom_url' => '{scripturl}?action=moderate;area=postmod', 'subsections' => ['posts' => ['label' => 'mc_unapproved_replies'], 'topics' => ['label' => 'mc_unapproved_topics']]], 'attachmod' => ['label' => 'mc_unapproved_attachments', 'enabled' => true, 'function' => __NAMESPACE__ . '\Posts::call', 'icon' => 'post_moderation_attach', 'custom_url' => '{scripturl}?action=moderate;area=attachmod;sa=attachments'], 'reportedposts' => ['label' => 'mc_reported_posts', 'enabled' => true, 'function' => __NAMESPACE__ . '\ReportedContent::call', 'icon' => 'reports', 'subsections' => ['show' => ['label' => 'mc_reportedp_active'], 'closed' => ['label' => 'mc_reportedp_closed']]]]], 'groups' => ['title' => 'mc_groups', 'enabled' => true, 'areas' => ['groups' => ['label' => 'mc_group_requests', 'function' => __NAMESPACE__ . '\Groups::call', 'icon' => 'members_request', 'custom_url' => '{scripturl}?action=moderate;area=groups;sa=requests'], 'viewgroups' => ['label' => 'mc_view_groups', 'function' => __NAMESPACE__ . '\Groups::call', 'icon' => 'membergroups']]], 'members' => ['title' => 'mc_members', 'enabled' => true, 'areas' => ['userwatch' => ['label' => 'mc_watched_users_title', 'enabled' => true, 'function' => __NAMESPACE__ . '\WatchedUsers::call', 'icon' => 'members_watched', 'subsections' => ['member' => ['label' => 'mc_watched_users_member'], 'post' => ['label' => 'mc_watched_users_post']]], 'reportedmembers' => ['label' => 'mc_reported_members_title', 'enabled' => true, 'function' => __NAMESPACE__ . '\ReportedContent::call', 'icon' => 'members_watched', 'subsections' => ['open' => ['label' => 'mc_reportedp_active'], 'closed' => ['label' => 'mc_reportedp_closed']]]]]]
Defines the menu structure for the moderation center. See Menu.php for details!
The values of all 'title' and 'label' elements are Lang::$txt keys, and will be replaced at runtime with the values of those Lang::$txt strings.
All occurrences of '{scripturl}' and '{boardurl}' in value strings will be replaced at runtime with the real values of Config::$scripturl and Config::$boardurl.
In this default definition, all parts of the menu are set as enabled. At runtime, however, various parts may be turned on or off depending on the forum's saved settings.
MOD AUTHORS: You can use the integration_moderation_areas hook to add things to this menu. The hook can be found in SMF\Menu::_construct().
$access_checked
protected
static bool
$access_checked
= false
Whether self::checkAccessPermissions() has been run yet.
$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() : 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.
checkAccessPermissions()
Figures out which parts of the moderation center can be accessed by the current user.
public
static checkAccessPermissions() : void
Populates the following context variables:
- can_moderate_boards
- can_moderate_groups
- can_moderate_approvals
- can_moderate_users
createMenu()
Creates the moderation center menu.
public
createMenu() : void
This is separated from execute() for the sake of SMF\Actions\Groups, which wants to be able to create the menu without calling the methods.
execute()
Dispatcher.
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.
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
__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.
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
setModerationAreas()
Sets any dynamic values in $this->moderation_areas.
protected
setModerationAreas() : void