Documentation

PersonalMessage
in package
implements ActionInterface, Routable uses ActionRouter, ActionTrait, BackwardCompatibility

This class is mainly meant for controlling the actions related to personal messages. It allows viewing, sending, deleting, and marking personal messages.

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.

Constants

VIEW_ALL  = 0
Display mode to show all personal messages in a paginated list.
VIEW_CONV  = 2
Display mode to show personal messages in a conversation view.
VIEW_ONE  = 1
Display mode to show one personal message at a time.

Properties

$current_label  : string
$current_label_id  : int
$folder  : string
$labels_in_use  : array<string|int, mixed>
$mode  : int
$pm_areas  : array<string|int, mixed>
$replied  : array<string|int, mixed>
$subaction  : string
$subactions  : array<string|int, mixed>
$unread  : array<string|int, mixed>
$current_label_redirect  : string
$obj  : static

Methods

applyActions()  : void
This method performs all additional stuff.
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.
drafts()  : void
Allows the user to view their PM drafts.
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.
labels()  : void
Handles adding, deleting and editing labels on messages.
load()  : static
Static wrapper for constructor.
parseRoute()  : array<string|int, mixed>
Parses a route to get URL query parameters.
popup()  : void
The popup for when we ask for the popup from the user.
prune()  : void
This function allows the user to delete all messages older than so many days.
removeAll()  : void
Delete ALL the messages!
report()  : void
Allows the user to report a personal message to an administrator.
rules()  : void
List all rules, and allow adding/entering etc.
search()  : void
Allows searching through personal messages.
search2()  : void
Actually do the search of personal messages.
send()  : void
Send a new message?
send2()  : void
Send it!
settings()  : void
Allows to edit Personal Message Settings.
show()  : void
Shows the personal messages in a folder (i.e. "inbox" or "sent items")
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().
buildActionRoute()  : array<string|int, mixed>
Builds a routing path for an action based on URL query parameters.
buildLimitBar()  : void
Figures out the limit for how many PMs this user can have.
createMenu()  : void
A menu to easily access different areas of the PM section
parseActionRoute()  : array<string|int, mixed>
Parses a route for an action to get URL query parameters.

Constants

VIEW_ALL

Display mode to show all personal messages in a paginated list.

public mixed VIEW_ALL = 0

VIEW_CONV

Display mode to show personal messages in a conversation view.

public mixed VIEW_CONV = 2

VIEW_ONE

Display mode to show one personal message at a time.

public mixed VIEW_ONE = 1

Properties

$current_label

public string $current_label = ''

Name of the current label.

$current_label_id

public int $current_label_id = -1

ID number of the current label, or -1 for the main inbox folder.

$folder

public string $folder = 'inbox'

The folder being viewed. Either 'inbox' or 'sent'.

$labels_in_use

public array<string|int, mixed> $labels_in_use = []

Labels that have been applied to a collection of PMs.

Keys are the IDs of some PMs. Values are arrays of label IDs.

$mode

public int $mode = self::VIEW_CONV

The display mode we are actually using.

$pm_areas

public array<string|int, mixed> $pm_areas = ['folders' => ['title' => 'pm_messages', 'areas' => ['inbox' => ['label' => 'inbox', 'custom_url' => '{scripturl}?action=pm;f=inbox', 'amt' => 0], 'send' => ['label' => 'new_message', 'custom_url' => '{scripturl}?action=pm;sa=send', 'permission' => 'pm_send', 'amt' => 0], 'sent' => ['label' => 'sent_items', 'custom_url' => '{scripturl}?action=pm;f=sent', 'amt' => 0], 'drafts' => ['label' => 'drafts_show', 'custom_url' => '{scripturl}?action=pm;f=drafts', 'permission' => 'pm_draft', 'enabled' => true, 'amt' => 0]], 'amt' => 0], 'labels' => ['title' => 'pm_labels', 'areas' => [], 'amt' => 0], 'actions' => ['title' => 'pm_actions', 'areas' => ['search' => ['label' => 'pm_search_bar_title', 'custom_url' => '{scripturl}?action=pm;sa=search'], 'prune' => ['label' => 'pm_prune', 'custom_url' => '{scripturl}?action=pm;sa=prune']]], 'pref' => ['title' => 'pm_preferences', 'areas' => ['manlabels' => ['label' => 'pm_manage_labels', 'custom_url' => '{scripturl}?action=pm;sa=manlabels'], 'manrules' => ['label' => 'pm_manage_rules', 'custom_url' => '{scripturl}?action=pm;sa=manrules'], 'settings' => ['label' => 'pm_settings', 'custom_url' => '{scripturl}?action=pm;sa=settings']]]]

Defines the menu structure for the personal message action. 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.

$replied

public array<string|int, mixed> $replied = []

Whether the current user has replied to a collection of PMs.

Keys are the IDs of some PMs. Values are booleans.

$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', 'popup' => 'popup', 'showpmdrafts' => 'drafts', 'send' => 'send', 'send2' => 'send2', 'search' => 'search', 'search2' => 'search2', 'pmactions' => 'applyActions', 'removeall2' => 'removeAll', 'prune' => 'prune', 'report' => 'report', 'manlabels' => 'labels', 'manrules' => 'rules', 'settings' => 'settings']

Available sub-actions.

$unread

public array<string|int, mixed> $unread = []

Whether the current user has read a collection of PMs.

Keys are the IDs of some PMs. Values are booleans.

$current_label_redirect

protected string $current_label_redirect

URL to redirect to for the current label.

$obj

protected static static $obj

An instance of this class. This is used by the load() method to prevent multiple instantiations.

Methods

applyActions()

This method performs all additional stuff.

public applyActions() : void

..

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
bool

canShowDebuggingInfo()

Determines whether debugging info should be shown.

public canShowDebuggingInfo() : bool
Return values
bool

canShowInMaintenanceMode()

Determines whether this action allows access in maintenance mode.

public canShowInMaintenanceMode() : bool
Return values
bool

True if access is allowed, false otherwise.

drafts()

Allows the user to view their PM drafts.

public drafts() : void

execute()

Dispatcher to whichever sub-action method is necessary.

public execute() : void

isAgreementAction()

Determines whether this action can be accessed without accepting the registration agreement and privacy policy.

public isAgreementAction() : bool
Return values
bool

isRestrictedGuestAccessAllowed()

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

Simple actions don't require the index template at all.

Return values
bool

labels()

Handles adding, deleting and editing labels on messages.

public labels() : void

load()

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

popup()

The popup for when we ask for the popup from the user.

public popup() : void

prune()

This function allows the user to delete all messages older than so many days.

public prune() : void

report()

Allows the user to report a personal message to an administrator.

public report() : void
  • In the first instance requires that the ID of the message to report is passed through $_GET.
  • It allows the user to report to either a particular administrator - or the whole admin team.
  • It will forward on a copy of the original message without allowing the reporter to make changes.
Tags
uses
template_report_message()

rules()

List all rules, and allow adding/entering etc.

public rules() : void

..

Allows searching through personal messages.

public search() : void

search2()

Actually do the search of personal messages.

public search2() : void

settings()

Allows to edit Personal Message Settings.

public settings() : void

Uses Actions/Profile/Main.php Uses Profile-Modify.php Uses Profile template. Uses Profile language file.

show()

Shows the personal messages in a folder (i.e. "inbox" or "sent items")

public show() : 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

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.

buildLimitBar()

Figures out the limit for how many PMs this user can have.

protected buildLimitBar() : void

createMenu()

A menu to easily access different areas of the PM section

protected createMenu(string $area) : void
Parameters
$area : string

The area we're currently in

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


        
On this page

Search results