Unread
in package
implements
ActionInterface, Routable
uses
ActionSuffixRouter, ActionTrait
Finds and retrieves information about new posts and topics.
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
- $sort_methods : array<string|int, mixed>
- $action_url : string
- $ascending : bool
- $boards : array<string|int, mixed>
- $cat_name : string
- $earliest_msg : int
- $have_temp_table : int
- $is_topics : bool
- $linktree_name : string
- $min_message : int
- $num_topics : int
- $obj : static
- $query_parameters : array<string|int, mixed>
- $query_this_board : string
- $see_board : string
- $selects : array<string|int, mixed>
- $sub_template : string
- $topic_request : object
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.
- execute() : void
- Find unread topics and replies.
- 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.
- __construct() : mixed
- Constructor. Protected to force instantiation via self::load().
- buildButtons() : void
- Sets up information about buttons for the template
- checkLoadAverage() : void
- Checks that the load averages aren't too high to show unread posts.
- checkLoadAverageAll() : void
- Checks that the load averages aren't too high to show all unread posts.
- finalizeSelects() : void
- Makes any needed adjustments to $this->selects.
- getBoards() : void
- Figures out what boards we want to get messages from.
- getCatName() : void
- Gets the category name, if applicable.
- getEarliestMsg() : void
- Gets the ID of the earliest message that the current user has not read.
- getTopicRequestWithoutTempTable() : void
- Sets $this->topic_request without the help of a temporary table.
- getTopicRequestWithTempTable() : void
- For large forums, sets $this->topic_request with the help of a temporary table.
- getTopics() : void
- init() : mixed
- Does some initial stuff.
- makeTempTable() : void
- For large forums, creates a temporary table to use when showing all unread topics.
- setNoTopics() : void
- setPaginationAndLinks() : void
- Constructs page index, sets the linktree, next/prev/up links, etc.
- setSortMethod() : void
- Figures out how to sort the results.
- setTopicRequest() : void
- Sets $this->topic_request to the appropriate query.
Properties
$sort_methods
public
array<string|int, mixed>
$sort_methods
= ['subject' => 'ms.subject', 'starter' => 'COALESCE(mems.real_name, ms.poster_name)', 'replies' => 't.num_replies', 'views' => 't.num_views', 'first_post' => 't.id_topic', 'last_post' => 't.id_last_msg']
Ways to sort the posts. Keys are requestable methods, values are SQL ORDER BY statements
$action_url
protected
string
$action_url
Base URL for this action.
$ascending
protected
bool
$ascending
Whether to sort in ascending or descending order.
$boards
protected
array<string|int, mixed>
$boards
= []
The boards to look in.
$cat_name
protected
string
$cat_name
Name of the category we are in, if applicable.
$earliest_msg
protected
int
$earliest_msg
= 0
Earliest unread message.
$have_temp_table
protected
int
$have_temp_table
= 0
Which temporary table we using, if any.
$is_topics
protected
bool
$is_topics
= true
Whether we are getting topics or replies.
$linktree_name
protected
string
$linktree_name
Name of this action for the linktree
$min_message
protected
int
$min_message
= 0
Lowest unread message ID.
$num_topics
protected
int
$num_topics
= 0
How many unread topics we found.
$obj
protected
static static
$obj
An instance of this class. This is used by the load() method to prevent multiple instantiations.
$query_parameters
protected
array<string|int, mixed>
$query_parameters
= []
Parameters for the main query.
$query_this_board
protected
string
$query_this_board
SQL statement indicating the boards to look in.
$see_board
protected
string
$see_board
= 'query_wanna_see_board'
Either 'query_see_board' or 'query_wanna_see_board'.
$selects
protected
array<string|int, mixed>
$selects
= ['ms.subject AS first_subject', 'ms.poster_time AS first_poster_time', 'ms.id_topic', 't.id_board', 'b.name AS bname', 't.num_replies', 't.num_views', 'ms.id_member AS first_id_member', 'ml.id_member AS last_id_member', 'ml.poster_time AS last_poster_time', 'ms.poster_name as first_member_name', 'ml.poster_name as last_member_name', 'COALESCE(mems.real_name, ms.poster_name) AS first_display_name', 'COALESCE(meml.real_name, ml.poster_name) AS last_display_name', 'ml.subject AS last_subject', 'ml.icon AS last_icon', 'ms.icon AS first_icon', 't.id_poll', 't.is_sticky', 't.locked', 'ml.modified_time AS last_modified_time', 'COALESCE(lt.id_msg, lmr.id_msg, -1) + 1 AS new_from', 'SUBSTRING(ml.body, 1, 385) AS last_body', 'SUBSTRING(ms.body, 1, 385) AS first_body', 'ml.smileys_enabled AS last_smileys', 'ms.smileys_enabled AS first_smileys', 't.id_first_msg', 't.id_last_msg', 'ml.id_msg_modified', 't.approved', 't.unapproved_posts']
Columns for the SQL SELECT clause. This part is the same for each query. More columns will be added at runtime if avatars are shown on indices.
$sub_template
protected
string
$sub_template
= 'unread'
Name of the sub-template to use.
$topic_request
protected
object
$topic_request
Database request to get the topics.
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.
execute()
Find unread topics and replies.
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.
__construct()
Constructor. Protected to force instantiation via self::load().
protected
__construct() : mixed
buildButtons()
Sets up information about buttons for the template
protected
buildButtons() : void
checkLoadAverage()
Checks that the load averages aren't too high to show unread posts.
protected
checkLoadAverage() : void
checkLoadAverageAll()
Checks that the load averages aren't too high to show all unread posts.
protected
checkLoadAverageAll() : void
finalizeSelects()
Makes any needed adjustments to $this->selects.
protected
finalizeSelects() : void
getBoards()
Figures out what boards we want to get messages from.
protected
getBoards() : void
Sets $this->boards, $this->query_this_board, and $this->query_parameters.
Tags
getCatName()
Gets the category name, if applicable.
protected
getCatName() : void
getEarliestMsg()
Gets the ID of the earliest message that the current user has not read.
protected
getEarliestMsg() : void
getTopicRequestWithoutTempTable()
Sets $this->topic_request without the help of a temporary table.
protected
getTopicRequestWithoutTempTable() : void
getTopicRequestWithTempTable()
For large forums, sets $this->topic_request with the help of a temporary table.
protected
getTopicRequestWithTempTable() : void
getTopics()
protected
getTopics() : void
init()
Does some initial stuff.
protected
init() : mixed
makeTempTable()
For large forums, creates a temporary table to use when showing all unread topics.
protected
makeTempTable() : void
setNoTopics()
protected
setNoTopics() : void
setPaginationAndLinks()
Constructs page index, sets the linktree, next/prev/up links, etc.
protected
setPaginationAndLinks() : void
setSortMethod()
Figures out how to sort the results.
protected
setSortMethod() : void
setTopicRequest()
Sets $this->topic_request to the appropriate query.
protected
setTopicRequest() : void