vB_Api_Content_Infraction
extends vB_Api_Content_Text
in package
vB_Api_Content_Infraction
Table of Contents
Methods
- __serialize() : array<string|int, mixed>
- __sleep() : array<string|int, mixed>
- __unserialize() : void
- __wakeup() : void
- add() : mixed
- Adds a new infraction node
- autoPopulatePreviewImage() : mixed
- DEPRECATED - This is now handled internally by the library, nothing is called from controllers.
- buildInfractionGroupIds() : mixed
- Builds infraction groups for users. Also called from the cron script
- buildUserInfractions() : mixed
- Builds user infractions
- callNamed() : The
- Call the given api function by name with a named arguments list.
- canGiveCustomInfraction() : bool
- Determines if the logged-in user can give custom (arbitrary value) infractions
- canInfractNode() : bool
- Determines if the logged-in user can infract the (author of) the given node
- canInfractUser() : bool
- Determines if the logged-in user can infract the given user
- canReverseInfraction() : bool
- Determines if the logged-in user can reverse an infraction
- canViewAdminNote() : bool
- Determines if the logged-in user can view admin notes
- canViewInfraction() : bool
- Determines if the logged-in user can view the given infraction node
- canViewNodeInfraction() : bool
- Determines if the logged-in user can view any infractions on the given node
- canViewUserInfractions() : bool
- Determines if the logged-in user can view the infractions for the given user
- checkApiState() : mixed
- This method checks whether the API method is enabled.
- cleanInput() : mixed
- Cleans the input in the $data array, directly updating $data.
- cleanPreviewContent() : mixed
- Takes a node record and removes the data cannot be viewed based on public_preview.
- clearCache() : mixed
- Clears all previously loaded API objects.
- createQuoteText() : string
- This returns the text to quote a node. Used initially for private messaging.
- delete() : void
- Deletes an infraction. Currently the only UI for this is in the Admin CP
- deleteInfractionGroup() : mixed
- Deletes an infraction group
- extractMedia() : mixed
- Extracts the video and photo content from text.
- fetchTableName() : array<string|int, mixed>
- Returns the tables used by this content type.
- getApiClassName() : mixed
- getAutomaticBanList() : array<string|int, mixed>|false
- Returns a list of automatic bans or an empty array if there are none.
- getAutoparseLinks() : mixed
- Returns the autoparselinks setting. In the public API for createcontent getPreview() use, not really meant for regular usage.
- getBareContent() : mixed
- Returns the node content, channel routeid and title, and starter route and title, but no permissions or other subsidiary data
- getBbcodeOptions() : mixed
- Returns an array with bbcode options for the node.
- getChannelId() : int
- Returns the Infraction channel ID
- getContent() : mixed
- Alias for @getFullContent
- getContentApi() : mixed
- Returns a content api of the appropriate type
- getConversationParent() : array<string|int, mixed>|false
- Gets the conversation starter for a node. If the node is a channel it returns the channel array.
- getDataForParse() : array<string|int, mixed>
- Gets the data the presentation layer needs to have to parse the rawtext.
- getFullContent() : array<string|int, mixed>
- Returns the node content plus the channel routeid and title, and starter route and title, and permissions and other data
- getInfraction() : array<string|int, mixed>|false
- Returns an infraction node based on its nodeid
- getInfractionGroups() : array<string|int, mixed>
- Gets the infraction groups
- getInfractionLevels() : array<string|int, mixed>
- Returns an array of information for the infraction levels that are currently set up
- getInfractionsByType() : mixed
- Returns a certain type of infractions
- getNodeInfraction() : array<string|int, mixed>|false
- Returns the infraction node for the given node (if it has an infraction)
- getParticipants() : array<string|int, mixed>
- Returns the displaynames of those users that participated in an infraction conversation.
- getQuotes() : string
- returns a string (if int is passed) or array of strings with nodeids as keys (when an array is passed) with quoted strings in bbcode format.
- getQuoteText() : string
- This returns the text to quote a node. Used initially for private messaging.
- getTextCountChange() : int
- Returns textCountChange property
- getTimeNow() : int
- Gives the current board time- needed to set publishdate.
- getUserInfractions() : array<string|int, mixed>|false
- Returns the infraction nodes for infractions that the given user has received.
- instance() : vB_Api
- Returns an instance of the API object which translates exceptions to an array Use this method for API clients.
- instanceInternal() : vB_Api
- Returns an instance of the API object which doesn't handle exceptions This should only be used in other API objects, not for clients of the API
- isPublished() : bool
- Determines if this record is in a published state
- isVisitorMessage() : bool
- Determines whether a specific node is a visitor message
- map_vb4_input_to_vb5() : string
- Returns vb5 api method name.
- map_vb5_errors_to_vb4() : mixed
- Alters the error array in any way necessary to interface correctly with vb4.
- map_vb5_output_to_vb4() : mixed
- Alters the output array in any way necessary to interface correctly with vb4.
- reverseInfraction() : int
- Reverse an infraction
- reverseNodeInfraction() : int
- Reverses the infraction associated with the given node
- saveInfractionGroup() : int
- Adds or updates an infraction group
- update() : void
- Cannot update an infraction
Methods
__serialize()
public
__serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>__sleep()
public
__sleep() : array<string|int, mixed>
Return values
array<string|int, mixed>__unserialize()
public
__unserialize(array<string|int, mixed> $serialized) : void
Parameters
- $serialized : array<string|int, mixed>
__wakeup()
public
__wakeup() : void
add()
Adds a new infraction node
public
add(mixed $data[, mixed $options = [] ]) : mixed
Parameters
- $data : mixed
-
Array of field => value pairs which define the record.
- $options : mixed = []
-
-- Understands skipTransaction, skipFloodCheck, floodchecktime, skipDupCheck, skipNotification, nl2br, autoparselinks.
- nl2br: if TRUE, all \n will be converted to
so that it's not removed by the html parser (e.g. comments). - wysiwyg: if true convert html to bbcode. Defaults to true if not given.
- nl2br: if TRUE, all \n will be converted to
Return values
mixed —array of infraction data.
autoPopulatePreviewImage()
DEPRECATED - This is now handled internally by the library, nothing is called from controllers.
public
autoPopulatePreviewImage(mixed $nodeId) : mixed
NOTE: This is still used by some upgrade steps, so we can't remove it completely at this time.
Populates the previewimage field for this node. To be called after the node is saved and the attachments added.
Finds the first image in the post text that can be used as a previewimage (uploaded here), or uses the first image attachment.
Parameters
- $nodeId : mixed
Tags
buildInfractionGroupIds()
Builds infraction groups for users. Also called from the cron script
public
buildInfractionGroupIds(array<string|int, mixed> $userids) : mixed
Parameters
- $userids : array<string|int, mixed>
buildUserInfractions()
Builds user infractions
public
buildUserInfractions(mixed $points, mixed $infractions, mixed $warnings) : mixed
Parameters
- $points : mixed
- $infractions : mixed
- $warnings : mixed
callNamed()
Call the given api function by name with a named arguments list.
public
callNamed() : The
Used primarily to translate REST requests into API calls.
Return values
The —return of the method or an error if the method doesn't exist, or is static, a constructor or destructor, or otherwise shouldn't be callable as and API method. It is also an error if the value of a paramater is not provided and that parameter doesn't have a default value.
canGiveCustomInfraction()
Determines if the logged-in user can give custom (arbitrary value) infractions
public
canGiveCustomInfraction() : bool
Return values
bool —The current user can give a custom infraction (or not)
canInfractNode()
Determines if the logged-in user can infract the (author of) the given node
public
canInfractNode(mixed $nodeid[, array<string|int, mixed> $node = null ]) : bool
Parameters
- $nodeid : mixed
- $node : array<string|int, mixed> = null
Return values
bool —The node (user) can be infracted by current user (or not)
canInfractUser()
Determines if the logged-in user can infract the given user
public
canInfractUser(mixed $userid) : bool
Parameters
- $userid : mixed
Return values
bool —The user can be infracted by current user (or not)
canReverseInfraction()
Determines if the logged-in user can reverse an infraction
public
canReverseInfraction() : bool
Return values
bool —The current user can reverse an infraction (or not)
canViewAdminNote()
Determines if the logged-in user can view admin notes
public
canViewAdminNote() : bool
Return values
bool —The current user can view admin notes (or not)
canViewInfraction()
Determines if the logged-in user can view the given infraction node
public
canViewInfraction(mixed $nodeid[, array<string|int, mixed> $infraction = null ]) : bool
Parameters
- $nodeid : mixed
- $infraction : array<string|int, mixed> = null
Return values
bool —The current user can view the infraction (or not)
canViewNodeInfraction()
Determines if the logged-in user can view any infractions on the given node
public
canViewNodeInfraction(mixed $nodeid[, array<string|int, mixed> $node = null ]) : bool
Parameters
- $nodeid : mixed
- $node : array<string|int, mixed> = null
Return values
bool —The current user can view any infractions on this node (or not)
canViewUserInfractions()
Determines if the logged-in user can view the infractions for the given user
public
canViewUserInfractions(mixed $userid) : bool
Parameters
- $userid : mixed
Return values
bool —The current user can view the given user's infractions (or not)
checkApiState()
This method checks whether the API method is enabled.
public
checkApiState(mixed $method) : mixed
For extensions check make sure $controller property is already set.
Parameters
- $method : mixed
cleanInput()
Cleans the input in the $data array, directly updating $data.
public
cleanInput(mixed $data[, mixed $nodeid = false ]) : mixed
Parameters
- $data : mixed
- $nodeid : mixed = false
cleanPreviewContent()
Takes a node record and removes the data cannot be viewed based on public_preview.
public
cleanPreviewContent(mixed $record) : mixed
It's called from the search Api.
Parameters
- $record : mixed
clearCache()
Clears all previously loaded API objects.
public
static clearCache() : mixed
Intended for use in tests where the loading pattern can cause issues with objects that cache thier own data.
createQuoteText()
This returns the text to quote a node. Used initially for private messaging.
public
createQuoteText(mixed $nodeid, mixed $pageText) : string
Parameters
- $nodeid : mixed
- $pageText : mixed
Return values
string —Quote text.
delete()
Deletes an infraction. Currently the only UI for this is in the Admin CP
public
delete(mixed $nodeid) : void
Parameters
- $nodeid : mixed
-
Node ID to be deleted
deleteInfractionGroup()
Deletes an infraction group
public
deleteInfractionGroup(mixed $infractiongroupid) : mixed
Parameters
- $infractiongroupid : mixed
extractMedia()
Extracts the video and photo content from text.
public
extractMedia(mixed $rawtext) : mixed
Parameters
- $rawtext : mixed
Return values
mixed —Array of "photo", "video". Each is an array of images.
fetchTableName()
Returns the tables used by this content type.
public
fetchTableName() : array<string|int, mixed>
Return values
array<string|int, mixed> —Array of table names
getApiClassName()
public
static getApiClassName(mixed $controller) : mixed
Parameters
- $controller : mixed
getAutomaticBanList()
Returns a list of automatic bans or an empty array if there are none.
public
getAutomaticBanList() : array<string|int, mixed>|false
Return values
array<string|int, mixed>|false —Array of automatic bans or false if the user does not have permission to see them.
getAutoparseLinks()
Returns the autoparselinks setting. In the public API for createcontent getPreview() use, not really meant for regular usage.
public
getAutoparseLinks(mixed $data) : mixed
Parameters
- $data : mixed
-
Input array similar to what would be passed into content_text::text() expected: htmlstate, disable_bbcode, parentid
Return values
mixed —['autoparselinks' => (bool)]
getBareContent()
Returns the node content, channel routeid and title, and starter route and title, but no permissions or other subsidiary data
public
getBareContent(mixed $nodeid[, mixed $permissions = false ]) : mixed
Parameters
- $nodeid : mixed
- $permissions : mixed = false
getBbcodeOptions()
Returns an array with bbcode options for the node.
public
getBbcodeOptions(int $nodeId) : mixed
Parameters
- $nodeId : int
getChannelId()
Returns the Infraction channel ID
public
getChannelId() : int
Return values
int —Infraction channel ID
getContent()
Alias for @getFullContent
public
getContent(mixed $nodeid[, mixed $permissions = false ]) : mixed
Parameters
- $nodeid : mixed
- $permissions : mixed = false
getContentApi()
Returns a content api of the appropriate type
public
static getContentApi(mixed $contenttypeid) : mixed
Parameters
- $contenttypeid : mixed
Return values
mixed —Content api object
getConversationParent()
Gets the conversation starter for a node. If the node is a channel it returns the channel array.
public
getConversationParent(int $nodeid) : array<string|int, mixed>|false
Parameters
- $nodeid : int
Tags
Return values
array<string|int, mixed>|false —The starter node array. False when the node lookup fails
getDataForParse()
Gets the data the presentation layer needs to have to parse the rawtext.
public
getDataForParse(mixed $nodeIds) : array<string|int, mixed>
Parameters
- $nodeIds : mixed
Return values
array<string|int, mixed> —Array of node information for parsing the content. Each item indexed by the nodeid and contains: 'bbcodeoptions', 'rawtext', 'previewtext', 'attachments', 'title' 'channelid', 'htmlstate', 'disable_bbcode', 'avatar_userids'
getFullContent()
Returns the node content plus the channel routeid and title, and starter route and title, and permissions and other data
public
getFullContent(int $nodeid[, array<string|int, mixed> $permissions = false ]) : array<string|int, mixed>
Parameters
- $nodeid : int
- $permissions : array<string|int, mixed> = false
-
(unused)
Return values
array<string|int, mixed> —The standard array of node data
getInfraction()
Returns an infraction node based on its nodeid
public
getInfraction(mixed $nodeid) : array<string|int, mixed>|false
Parameters
- $nodeid : mixed
Return values
array<string|int, mixed>|false —Array of infraction info, or false if there is no infraction or you don't have permission to view the infraction
getInfractionGroups()
Gets the infraction groups
public
getInfractionGroups() : array<string|int, mixed>
Return values
array<string|int, mixed> —infraction groups with infractiongroupid as key >
getInfractionLevels()
Returns an array of information for the infraction levels that are currently set up
public
getInfractionLevels() : array<string|int, mixed>
Return values
array<string|int, mixed> —Infraction levels
getInfractionsByType()
Returns a certain type of infractions
public
getInfractionsByType([string $type = '' ][, bool $replied_by_me = false ]) : mixed
Parameters
- $type : string = ''
- $replied_by_me : bool = false
-
- if true, only infractions that the user commented on type = 'user' => infractions given to a user type = 'post' => infractions given to a post by a user
getNodeInfraction()
Returns the infraction node for the given node (if it has an infraction)
public
getNodeInfraction(mixed $nodeid[, array<string|int, mixed> $node = null ]) : array<string|int, mixed>|false
Parameters
- $nodeid : mixed
- $node : array<string|int, mixed> = null
Return values
array<string|int, mixed>|false —Array of infraction info, or false if there is no infraction or you don't have permission to view the infraction
getParticipants()
Returns the displaynames of those users that participated in an infraction conversation.
public
getParticipants(mixed $nodeids) : array<string|int, mixed>
Parameters
- $nodeids : mixed
Return values
array<string|int, mixed> —Array of usernames, userid is the key
getQuotes()
returns a string (if int is passed) or array of strings with nodeids as keys (when an array is passed) with quoted strings in bbcode format.
public
getQuotes(mixed $nodeids) : string
return empty string for the nodes that the current user has no permission viewing
Parameters
- $nodeids : mixed
Return values
string —or array of strings with nodeids as keys
getQuoteText()
This returns the text to quote a node. Used initially for private messaging.
public
getQuoteText(mixed $nodeid) : string
Parameters
- $nodeid : mixed
Return values
string —Quote text
getTextCountChange()
Returns textCountChange property
public
getTextCountChange() : int
Return values
intgetTimeNow()
Gives the current board time- needed to set publishdate.
public
getTimeNow() : int
Return values
intgetUserInfractions()
Returns the infraction nodes for infractions that the given user has received.
public
getUserInfractions(mixed $userid[, mixed $offset = 0 ][, mixed $limit = 20 ]) : array<string|int, mixed>|false
Parameters
- $userid : mixed
- $offset : mixed = 0
- $limit : mixed = 20
Return values
array<string|int, mixed>|false —Array of infraction info, or false if there are no infractions or you don't have permission to view the infractions
instance()
Returns an instance of the API object which translates exceptions to an array Use this method for API clients.
public
static instance(string $controller[, bool $refresh_cache = false ]) : vB_Api
Parameters
- $controller : string
-
-- name of the API controller to load
- $refresh_cache : bool = false
-
-- true if we want to force the cache to update with a new api object primarily intended for testing
Return values
vB_ApiinstanceInternal()
Returns an instance of the API object which doesn't handle exceptions This should only be used in other API objects, not for clients of the API
public
static instanceInternal(string $controller[, bool $refresh_cache = false ]) : vB_Api
Parameters
- $controller : string
-
-- name of the API controller to load
- $refresh_cache : bool = false
-
-- true if we want to force the cache to update with a new api object primarily intended for testing
Return values
vB_ApiisPublished()
Determines if this record is in a published state
public
isPublished(mixed $data) : bool
Parameters
- $data : mixed
Return values
boolisVisitorMessage()
Determines whether a specific node is a visitor message
public
isVisitorMessage(mixed $nodeid) : bool
Parameters
- $nodeid : mixed
Return values
boolmap_vb4_input_to_vb5()
Returns vb5 api method name.
public
static map_vb4_input_to_vb5(string $method, array<string|int, mixed> &$request) : string
May alter request array.
Parameters
- $method : string
-
-- vb4 method name
- $request : array<string|int, mixed>
-
-- $_REQUEST array for this api request
Return values
stringmap_vb5_errors_to_vb4()
Alters the error array in any way necessary to interface correctly with vb4.
public
static map_vb5_errors_to_vb4(string $method, array<string|int, mixed> &$data) : mixed
Parameters
- $method : string
-
-- vb4 method name
- $data : array<string|int, mixed>
-
-- error array from vb5
map_vb5_output_to_vb4()
Alters the output array in any way necessary to interface correctly with vb4.
public
static map_vb5_output_to_vb4(string $method, array<string|int, mixed> &$data) : mixed
Parameters
- $method : string
-
-- vb4 method name
- $data : array<string|int, mixed>
-
-- output array from vb5
reverseInfraction()
Reverse an infraction
public
reverseInfraction(mixed $nodeid, mixed $reason) : int
Parameters
- $nodeid : mixed
- $reason : mixed
Return values
int —The number of rows that were affected
reverseNodeInfraction()
Reverses the infraction associated with the given node
public
reverseNodeInfraction(mixed $nodeid, mixed $reason[, array<string|int, mixed> $node = null ]) : int
Parameters
- $nodeid : mixed
- $reason : mixed
- $node : array<string|int, mixed> = null
Return values
int —The number of rows that were affected
saveInfractionGroup()
Adds or updates an infraction group
public
saveInfractionGroup(int $pointlevel, int $usergroupid, int $orusergroupid, bool $override[, int $infractiongroupid = false ]) : int
Parameters
- $pointlevel : int
- $usergroupid : int
- $orusergroupid : int
- $override : bool
- $infractiongroupid : int = false
-
- optional
Return values
int —The infraction group ID.
update()
Cannot update an infraction
public
update(mixed $nodeid, mixed $data) : void
Parameters
- $nodeid : mixed
- $data : mixed