vB_Library_Node
extends vB_Library
in package
vB_Library_Node
Table of Contents
Methods
- __serialize() : array<string|int, mixed>
- __sleep() : array<string|int, mixed>
- __unserialize() : void
- __wakeup() : void
- addFullContentInfo() : mixed
- Takes an array of node information and adds contentInfo
- addNode() : mixed
- Adds a new node. The record must already exist as an individual content item.
- approve() : array<string|int, mixed>
- Sets the approved field
- assertNodeidStr() : int
- Convert node path or id string to node id.
- autoExpireTopics() : void
- Close expired topics in channels with auto expiry set. Currently used by the dailycleanup cron and admincp/misc.php
- calculateNodeLastInfo() : array<string|int, mixed>
- Calculates the last node info for a given node
- canEditThreadTitle() : mixed
- Check if the user has permission for edit the thread title also check the option editthreadtitlelimit if we pass the time and we are not moderators we can edit the thread title
- canOpenCloseNode() : bool
- Check if current user has perms to open or close $nodeid
- canSetAsAnswer() : mixed
- censorNode() : void
- Censors the different text items that need censoring
- censorNodes() : void
- Censors the different text items in each node that need censoring
- clearCache() : mixed
- clearCacheEvents() : bool
- Clears the cache events from a given list of nodes.
- clearChildCache() : mixed
- This clear cache for all children of a node list
- cloneNodes() : mixed
- Clone Nodes and their children deeply into a new parent Node.
- cloneNodesInternal() : mixed
- closeNode() : mixed
- Closes a node for posting. Closed nodes can still be viewed but nobody can reply to one.
- deleteNodes() : array<string|int, mixed>
- Permanently/Temporarily deletes a set of nodes
- fetchAlbumChannel() : int
- returns id of the Albums Channel
- fetchArticleChannel() : int
- Returns the nodeid of the CMS/Articles channel
- fetchClosurechildren() : mixed
- Returns closure table information given a child id
- fetchClosureParent() : mixed
- Returns closure table information given a child id
- fetchForumChannel() : int
- Returns the nodeid of the root forums channel
- fetchInfractionChannel() : int
- Returns the nodeid of the infraction channel
- fetchNodeAttachments() : mixed
- This gets the attachment information for a node. Which may be empty.
- fetchPMChannel() : int
- returns id of the Private Message Channel
- fetchReportChannel() : int
- returns id of the Report Channel
- fetchVMChannel() : int|false
- returns id of the Vistor Message Channel
- fixNodeLast() : mixed
- getAlbums() : mixed
- This returns all the albums in a channel. Those can be photogalleries or text with attachments.
- getAnswerNodeids() : mixed
- getChannelId() : int
- Gets the starter's parent (channel) node
- getChannelInfoForNode() : mixed
- Gets the channel title and routeid
- getChildren() : mixed
- Returns node children
- getContentforNodes() : mixed
- Gets the content info for a list of nodes
- getContentInstance() : mixed
- getForumSupermoderatorsAdmins() : array<string|int, mixed>
- Returns forum super moderators and admins
- getFullContentforNodes() : mixed
- Gets the content info for a list of nodes
- getNode() : mixed
- Gets one node.
- getNodeBare() : mixed
- Gets one node.
- getNodeFields() : mixed
- Return the list of fields in the node table
- getNodeFullContent() : array<string|int, mixed>
- Returns a content record based on nodeid including channel and starter information
- getNodeModerators() : array<string|int, mixed>
- Returns the userids of the moderators of that node
- getNodeOptions() : array<string|int, mixed>
- gets the node option as an array of values
- getNodeParents() : array<string|int, mixed>
- get the ancestors of a node
- getNodes() : mixed
- Gets the node info for a list of nodes
- getNodeviews() : array<string|int, mixed>
- Fetch nodeview count(s) for nodeid(s)
- getOptions() : mixed
- gets the node option bitfields
- getParents() : mixed
- Returns the ancestry
- getSGChannel() : mixed
- getTextChangeTypes() : mixed
- Gets a list of the content types that change text type
- instance() : static
- Returns singleton instance of self.
- isComment() : mixed
- isPublished() : mixed
- Determines if a node record is published or not. Note that this only checks if the record is published, not if it should be shown as published.
- isReply() : mixed
- listNodes() : mixed
- lists the nodes that should be displayed on a specific page.
- listNodesInternal() : mixed
- listPendingPosts() : mixed
- Gets the list of unapproved posts for the current user
- listPendingPostsForCurrentUser() : mixed
- This was a function wrapper for listPendingPosts but used for current user.
- markChannelsRead() : array<string|int, mixed>
- Marks a channel, its child channels and all contained topics as read
- markChannelsUnread() : array<string|int, mixed>
- Marks a channel as unread
- markRead() : array<string|int, mixed>
- Marks a node as read using the appropriate method.
- markReadMultiple() : array<string|int, mixed>
- Mark multiple nodes read
- markSubscribed() : mixed
- marks nodes with "subscribed" true/false
- markUnread() : array<string|int, mixed>
- Marks a node as unread using the appropriate method.
- markUnreadMultiple() : array<string|int, mixed>
- Mark multiple nodes unread
- mergePostedStatusForTopics() : array<string|int, mixed>
- Merges "posted" info into the topics array, used by the display_Topics template.
- monitorWords() : mixed
- Checks if the text contains monitored words, and if so, sends notifications to admins and moderators if the setting is on.
- moveNodes() : mixed
- Moves nodes to a new parent
- nodesChanged() : mixed
- Fire the node changed event for just the nodes in the list
- openNode() : array<string|int, mixed>
- opens a node for posting
- publishChildren() : mixed
- Updates the showpublished & count fields of $parentid & its descendents for publishing
- removePrivateDataFromNodeList() : void
- Cleans the node list according the to permissions set in the node record for the current user. For use by various APIs that return node information to consolidate the cleaning in one place.
- requestChannel() : mixed
- This creates a request for access to a channel
- resetAncestorCounts() : mixed
- Updates the ancestors counts and last data from a given node being deleted.
- setApproved() : array<string|int, mixed>
- Sets or unsets the approved field
- setApprovedPost() : bool
- Approves a post. Since the publish date might be affected user will need moderate and publish posts permissions.
- setAsAnswer() : mixed
- setFeatured() : array<string|int, mixed>
- sets a list of nodes to be featured
- setNodeOptions() : either
- Set the node options
- setPublishDate() : bool
- Sets the publishdate and (optionally) the unpublish date of a node
- setUnPublishDate() : bool
- Sets the unpublish date
- setUnPublished() : bool
- sets a node to not published
- timedCountUpdates() : mixed
- Checks for any content that needs to be published or unpublished.
- typeCanBeComment() : mixed
- typeCanBeReply() : mixed
- unapprove() : array<string|int, mixed>
- Unsets the approved field
- undeleteNodes() : array<string|int, mixed>
- Undelete a set of nodes
- unpublishChildren() : mixed
- Updates the showpublished & count fields of $parentid & its descendents for unpublishing Caller MUST ensure that $parentid is actually unpublished (i.e. a valid unpublishdate is set)
- updateAddRemovedNodeParentCounts() : mixed
- Add or remove node counts for a given node its parents
- updateParentCounts() : mixed
- Updates the parent counts and data when saving a node.
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
addFullContentInfo()
Takes an array of node information and adds contentInfo
public
addFullContentInfo(mixed $nodeList[, mixed $options = [] ]) : mixed
Parameters
- $nodeList : mixed
- $options : mixed = []
addNode()
Adds a new node. The record must already exist as an individual content item.
public
addNode(mixed $contenttypeid, mixed $data) : mixed
Parameters
- $contenttypeid : mixed
- $data : mixed
approve()
Sets the approved field
public
approve(array<string|int, mixed> $nodeids) : array<string|int, mixed>
Parameters
- $nodeids : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —- the nodeids that have the permission to be changed
assertNodeidStr()
Convert node path or id string to node id.
public
assertNodeidStr(string|int $nodestring) : int
Parameters
- $nodestring : string|int
-
Node String. If $nodestring is a string, it should be a route path to the node
Return values
int —Node ID
autoExpireTopics()
Close expired topics in channels with auto expiry set. Currently used by the dailycleanup cron and admincp/misc.php
public
autoExpireTopics([int $lookbackdays = 30 ]) : void
Parameters
- $lookbackdays : int = 30
-
If positive, topics created or with lastactivity older than ($lookbackdays + channel's topicexpireseconds) will be skipped due to performance reasons. Negative values will force looking at all records, which can take some time. Defaults to 30 days of lookback.
calculateNodeLastInfo()
Calculates the last node info for a given node
public
calculateNodeLastInfo(int $nodeid) : array<string|int, mixed>
this mostly exists as a public function for testing purposes. generally you will want to call fixNodeLast
Parameters
- $nodeid : int
Return values
array<string|int, mixed> —-- ['lastcontent', 'lastcontentid', 'lastcontentauthor', 'lastauthorid'] values suitable for updating to the node record
canEditThreadTitle()
Check if the user has permission for edit the thread title also check the option editthreadtitlelimit if we pass the time and we are not moderators we can edit the thread title
public
canEditThreadTitle(int $nodeid[, mixed $node = false ]) : mixed
Parameters
- $nodeid : int
- $node : mixed = false
canOpenCloseNode()
Check if current user has perms to open or close $nodeid
public
canOpenCloseNode(int $nodeid[, mixed $checkUserId = null ]) : bool
Parameters
- $nodeid : int
- $checkUserId : mixed = null
Return values
bool —true if current user can open or close $nodeid
canSetAsAnswer()
public
canSetAsAnswer(mixed $nodeid[, mixed $set = true ][, mixed $checkUserId = null ]) : mixed
Parameters
- $nodeid : mixed
- $set : mixed = true
- $checkUserId : mixed = null
censorNode()
Censors the different text items that need censoring
public
censorNode(array<string|int, mixed> &$node) : void
Parameters
- $node : array<string|int, mixed>
-
The array of node information (passed by reference)
censorNodes()
Censors the different text items in each node that need censoring
public
censorNodes(array<string|int, mixed> &$nodes) : void
Parameters
- $nodes : array<string|int, mixed>
-
The array of node information (passed by reference)
clearCache()
public
static clearCache() : mixed
clearCacheEvents()
Clears the cache events from a given list of nodes.
public
clearCacheEvents(mixed $nodeIds) : bool
Useful to keep search results updated due node changes.
This will aggressively detect and clear cache for associated nodes (but not any decendants)
Parameters
- $nodeIds : mixed
Return values
boolclearChildCache()
This clear cache for all children of a node list
public
clearChildCache(mixed $nodeids) : mixed
@param mixed array of nodes
Parameters
- $nodeids : mixed
cloneNodes()
Clone Nodes and their children deeply into a new parent Node.
public
cloneNodes(array<string|int, mixed> $nodeids, string|int $to_parent[, string $newtitle = '' ]) : mixed
Parameters
- $nodeids : array<string|int, mixed>
-
Source nodeIDs
- $to_parent : string|int
-
Parent node id. If to_parent is a string, it should be a route path to the node
- $newtitle : string = ''
-
If parent is a channel, the oldest post will be promoted to a Thread with the new title.
Return values
mixed —array of origional nodeids as keys, cloned nodeids as values
cloneNodesInternal()
public
cloneNodesInternal(mixed $nodes, mixed $parent, mixed $newtitle) : mixed
Parameters
- $nodes : mixed
- $parent : mixed
- $newtitle : mixed
closeNode()
Closes a node for posting. Closed nodes can still be viewed but nobody can reply to one.
public
closeNode(mixed $nodeids) : mixed
@param mixed integer or array of integers
Parameters
- $nodeids : mixed
Return values
mixed —Either array 'errors' => error string or array of id's.
deleteNodes()
Permanently/Temporarily deletes a set of nodes
public
deleteNodes(mixed $deleteNodeIds, mixed $hard, mixed $reason[, mixed $modlog = true ][, mixed $reportspam = false ]) : array<string|int, mixed>
Parameters
- $deleteNodeIds : mixed
- $hard : mixed
- $reason : mixed
- $modlog : mixed = true
- $reportspam : mixed = false
Return values
array<string|int, mixed> —nodeids that were deleted
fetchAlbumChannel()
returns id of the Albums Channel
public
fetchAlbumChannel() : int
Return values
int —array including
fetchArticleChannel()
Returns the nodeid of the CMS/Articles channel
public
fetchArticleChannel() : int
Return values
int —The nodeid for the CMS channel
fetchClosurechildren()
Returns closure table information given a child id
public
fetchClosurechildren(int|array<string|int, mixed> $parentids) : mixed
Parameters
- $parentids : int|array<string|int, mixed>
-
parent nodeid or array of nodeids
@return array of closure table records
fetchClosureParent()
Returns closure table information given a child id
public
fetchClosureParent(mixed $childids[, mixed $parentid = false ]) : mixed
Parameters
- $childids : mixed
- $parentid : mixed = false
fetchForumChannel()
Returns the nodeid of the root forums channel
public
fetchForumChannel() : int
Return values
int —The nodeid for the root forums channel
fetchInfractionChannel()
Returns the nodeid of the infraction channel
public
fetchInfractionChannel() : int
Return values
int —The nodeid for the infraction channel
fetchNodeAttachments()
This gets the attachment information for a node. Which may be empty.
public
fetchNodeAttachments(mixed $parentids) : mixed
Parameters
- $parentids : mixed
Return values
mixed —either false or an array of attachments with the following fields:
-
attach fields ** - filedataid - nodeid - parentid - visible - counter - posthash - filename - caption - reportthreadid - settings - hasthumbnail
** filedata fields ** - userid - extension - filesize - thumbnail_filesize - dateline - thumbnail_dateline ** link info ** - url - urltitle - meta ** photo info ** - caption - height - width - style
fetchPMChannel()
returns id of the Private Message Channel
public
fetchPMChannel() : int
Return values
int —array including
fetchReportChannel()
returns id of the Report Channel
public
fetchReportChannel() : int
Return values
int —array including
fetchVMChannel()
returns id of the Vistor Message Channel
public
fetchVMChannel() : int|false
Return values
int|false —-- nodeid for the VM Channel. False if the channel doesn't exist (which should normally only be the case in the installer code);
fixNodeLast()
public
fixNodeLast(mixed $nodeid) : mixed
Parameters
- $nodeid : mixed
getAlbums()
This returns all the albums in a channel. Those can be photogalleries or text with attachments.
public
getAlbums(mixed $nodeid) : mixed
Parameters
- $nodeid : mixed
Return values
mixed —array of node records. Each node includes the node content and userinfo, and attachment records.
getAnswerNodeids()
public
getAnswerNodeids(mixed $starterid) : mixed
Parameters
- $starterid : mixed
getChannelId()
Gets the starter's parent (channel) node
public
getChannelId(array<string|int, mixed>|int $node) : int
Parameters
- $node : array<string|int, mixed>|int
-
the node or nodeid
Return values
intgetChannelInfoForNode()
Gets the channel title and routeid
public
getChannelInfoForNode(mixed $channelId) : mixed
Parameters
- $channelId : mixed
Return values
mixed —Array of channel info
getChildren()
Returns node children
public
getChildren(mixed $nodeid) : mixed
@param int nodeid
Parameters
- $nodeid : mixed
Return values
mixed —array of partial node records
getContentforNodes()
Gets the content info for a list of nodes
public
getContentforNodes(mixed $nodeList[, mixed $options = [] ]) : mixed
Parameters
- $nodeList : mixed
- $options : mixed = []
getContentInstance()
public
static getContentInstance(mixed $contenttypeid) : mixed
Parameters
- $contenttypeid : mixed
getForumSupermoderatorsAdmins()
Returns forum super moderators and admins
public
getForumSupermoderatorsAdmins([array<string|int, mixed> $userids = [] ]) : array<string|int, mixed>
Parameters
- $userids : array<string|int, mixed> = []
-
Userids to exclude
Return values
array<string|int, mixed> —- the userids of the forum super moderators & admins
getFullContentforNodes()
Gets the content info for a list of nodes
public
getFullContentforNodes(array<string|int, mixed> $nodeList[, mixed $options = [] ]) : mixed
Parameters
- $nodeList : array<string|int, mixed>
-
Ids of the nodes to be fetched
@return array array of content records -- preserves the original keys
- $options : mixed = []
getNode()
Gets one node.
public
getNode(mixed $nodeid[, mixed $withParents = false ][, mixed $withJoinableContent = false ]) : mixed
Parameters
- $nodeid : mixed
- $withParents : mixed = false
- $withJoinableContent : mixed = false
Tags
getNodeBare()
Gets one node.
public
getNodeBare(mixed $nodeid) : mixed
Parameters
- $nodeid : mixed
Return values
mixed —Array of node records
getNodeFields()
Return the list of fields in the node table
public
getNodeFields() : mixed
getNodeFullContent()
Returns a content record based on nodeid including channel and starter information
public
getNodeFullContent(mixed $nodeid[, mixed $contenttypeid = false ][, mixed $options = [] ]) : array<string|int, mixed>
Parameters
- $nodeid : mixed
- $contenttypeid : mixed = false
- $options : mixed = []
Return values
array<string|int, mixed> —Content record
getNodeModerators()
Returns the userids of the moderators of that node
public
getNodeModerators(int $nodeid) : array<string|int, mixed>
Parameters
- $nodeid : int
Return values
array<string|int, mixed>getNodeOptions()
gets the node option as an array of values
public
getNodeOptions(mixed $nodeid) : array<string|int, mixed>
@param int nodeid of the desired record
Parameters
- $nodeid : mixed
Return values
array<string|int, mixed> —associative array of bitfield name => 0 or 1
getNodeParents()
get the ancestors of a node
public
getNodeParents(int $nodeid) : array<string|int, mixed>
Parameters
- $nodeid : int
Return values
array<string|int, mixed>getNodes()
Gets the node info for a list of nodes
public
getNodes(mixed $nodeList[, mixed $withJoinableContent = false ]) : mixed
Parameters
- $nodeList : mixed
- $withJoinableContent : mixed = false
getNodeviews()
Fetch nodeview count(s) for nodeid(s)
public
getNodeviews(array<string|int, mixed> $nodeids) : array<string|int, mixed>
Parameters
- $nodeids : array<string|int, mixed>
-
array of nodeid(s) for which we're grabbing the count(s)
Return values
array<string|int, mixed> —array with keys $nodeids & corresponding counts for the values
[
getOptions()
gets the node option bitfields
public
getOptions() : mixed
@return array associative array of bitfield name => value
getParents()
Returns the ancestry
public
getParents(mixed $nodeid) : mixed
@param int nodeid
Parameters
- $nodeid : mixed
Return values
mixed —array of partial node records -- in ascending order of depth
getSGChannel()
public
getSGChannel() : mixed
getTextChangeTypes()
Gets a list of the content types that change text type
public
getTextChangeTypes() : mixed
Tags
instance()
Returns singleton instance of self.
public
static instance(mixed $class) : static
Parameters
- $class : mixed
Return values
static —- Reference to singleton instance of the requested library class
isComment()
public
isComment(mixed $node) : mixed
Parameters
- $node : mixed
isPublished()
Determines if a node record is published or not. Note that this only checks if the record is published, not if it should be shown as published.
public
isPublished(mixed $node) : mixed
Parameters
- $node : mixed
isReply()
public
isReply(mixed $node) : mixed
Parameters
- $node : mixed
listNodes()
lists the nodes that should be displayed on a specific page.
public
listNodes(mixed $parentid, mixed $page, mixed $perpage, mixed $depth, mixed $contenttypeid, mixed $options[, mixed $withJoinableContent = false ]) : mixed
Parameters
- $parentid : mixed
- $page : mixed
- $perpage : mixed
- $depth : mixed
- $contenttypeid : mixed
- $options : mixed
- $withJoinableContent : mixed = false
listNodesInternal()
public
listNodesInternal(mixed $parentid, mixed $page, mixed $perpage, mixed $depth, mixed $contenttypeid, mixed $options[, mixed $withJoinableContent = false ]) : mixed
Parameters
- $parentid : mixed
- $page : mixed
- $perpage : mixed
- $depth : mixed
- $contenttypeid : mixed
- $options : mixed
- $withJoinableContent : mixed = false
listPendingPosts()
Gets the list of unapproved posts for the current user
public
listPendingPosts([mixed $userId = false ][, mixed $options = [] ]) : mixed
Parameters
- $userId : mixed = false
- $options : mixed = []
Return values
mixed —Array containing the pending posts nodeIds with contenttypeid associated.
listPendingPostsForCurrentUser()
This was a function wrapper for listPendingPosts but used for current user.
public
listPendingPostsForCurrentUser([mixed $options = [] ]) : mixed
Now returns different information due to post processing steps.
Parameters
- $options : mixed = []
markChannelsRead()
Marks a channel, its child channels and all contained topics as read
public
markChannelsRead([int $nodeid = 0 ]) : array<string|int, mixed>
Parameters
- $nodeid : int = 0
-
The node ID of channel being marked. If 0, all channels will be marked as read
Return values
array<string|int, mixed> —Returns an array of channel ids that were marked as read
markChannelsUnread()
Marks a channel as unread
public
markChannelsUnread([int $nodeid = 0 ]) : array<string|int, mixed>
Parameters
- $nodeid : int = 0
-
The node ID of channel being marked. If 0, all channels will be marked as unread
Return values
array<string|int, mixed> —Returns an array of channel ids that were marked as unread
markRead()
Marks a node as read using the appropriate method.
public
markRead(int $nodeid[, int|null $readtime = null ]) : array<string|int, mixed>
Parameters
- $nodeid : int
-
The ID of node being marked. The node should be a channel or starter.
- $readtime : int|null = null
-
Timestamp of the last reply that was read. E.g. if user loaded page 3 of a 4 page thread, the
publishdate
of the last post on page 3 should be passed here, so that page 4 will remain unread.
Return values
array<string|int, mixed> —Returns an array of nodes that were marked as read
markReadMultiple()
Mark multiple nodes read
public
markReadMultiple(array<string|int, mixed> $nodeids) : array<string|int, mixed>
Parameters
- $nodeids : array<string|int, mixed>
-
Node Ids
Return values
array<string|int, mixed> —Returns an array of nodes that were marked as read
markSubscribed()
marks nodes with "subscribed" true/false
public
markSubscribed(mixed &$nodes) : mixed
Parameters
- $nodes : mixed
markUnread()
Marks a node as unread using the appropriate method.
public
markUnread(int $nodeid) : array<string|int, mixed>
Parameters
- $nodeid : int
-
The ID of node being marked
Return values
array<string|int, mixed> —Returns an array of nodes that were marked as unread
markUnreadMultiple()
Mark multiple nodes unread
public
markUnreadMultiple(mixed $nodeids) : array<string|int, mixed>
Parameters
- $nodeids : mixed
-
Node Ids
Return values
array<string|int, mixed> —Returns an array of nodes that were marked as unread
mergePostedStatusForTopics()
Merges "posted" info into the topics array, used by the display_Topics template.
public
mergePostedStatusForTopics(mixed $nodes, mixed $userid) : array<string|int, mixed>
This adds the "content.posted" element to the node record. The value is the number of times the passed userid has posted in the topic (replies and comments); zero if none.
Parameters
- $nodes : mixed
- $userid : mixed
Return values
array<string|int, mixed> —Same array of nodes, with the "posted" element added to the "content" sub-array
monitorWords()
Checks if the text contains monitored words, and if so, sends notifications to admins and moderators if the setting is on.
public
monitorWords(mixed $text, mixed $type, mixed $nodeid[, mixed $userid = null ][, mixed $insertNotifications = true ][, mixed $currentuserid = 0 ]) : mixed
use the functions from the notification library directly.
Parameters
- $text : mixed
- $type : mixed
- $nodeid : mixed
- $userid : mixed = null
- $insertNotifications : mixed = true
- $currentuserid : mixed = 0
moveNodes()
Moves nodes to a new parent
public
moveNodes(mixed $nodeids, mixed $to_parent[, mixed $makeTopic = false ][, mixed $newtitle = false ][, mixed $modlog = true ][, array<string|int, mixed> $leaveRedirectData = [] ]) : mixed
Parameters
- $nodeids : mixed
- $to_parent : mixed
- $makeTopic : mixed = false
- $newtitle : mixed = false
- $modlog : mixed = true
- $leaveRedirectData : array<string|int, mixed> = []
Tags
nodesChanged()
Fire the node changed event for just the nodes in the list
public
nodesChanged(int|array<string|int, mixed> $nodeIds) : mixed
Does not attempt to
Parameters
- $nodeIds : int|array<string|int, mixed>
openNode()
opens a node for posting
public
openNode(mixed $nodeids) : array<string|int, mixed>
@param int|array $nodeids
Parameters
- $nodeids : mixed
Return values
array<string|int, mixed> —or original nodeids or error array
publishChildren()
Updates the showpublished & count fields of $parentid & its descendents for publishing
public
publishChildren(int $parentid) : mixed
Caller MUST ensure that $parentid is actually published (i.e. a valid publishdate is set and a positive unpublishdate is removed or in the future). This claimed but not entirely true of the previous version of the function (which would set the parent node showpublished to true regardless of the dates which meant that it would work if the dates were corrected after the call to publish children). This version of the function requires that the dates are set correctly before it is called.
Caller MUST also ensure that approved and showapproved flags are correctly set in the entire substree headed by $parentid, otherwise the counts may end up being off.
Parameters
- $parentid : int
-
nodeid of node being published @return mixed An array that contains the updated count fields of $parentid, or an array with key 'errors' if the assertor hit an error while updating
removePrivateDataFromNodeList()
Cleans the node list according the to permissions set in the node record for the current user. For use by various APIs that return node information to consolidate the cleaning in one place.
public
removePrivateDataFromNodeList(array<string|int, mixed> &$nodelist) : void
Currently removes the ipaddress fields when the user should not be able to view them.
The passed node array is cleaned in place to avoid unnecesary copies of large objects instead of returned.
Parameters
- $nodelist : array<string|int, mixed>
requestChannel()
This creates a request for access to a channel
public
requestChannel(int $channelid, string $requestType[, int $recipient = 0 ][, string $recipientname = null ][, bool $skipFloodCheck = false ]) : mixed
Parameters
- $channelid : int
-
the nodeid of the channel to which access is requested.
- $requestType : string
-
the type of request. See vB_Api_Node::REQUEST_<> constants
- $recipient : int = 0
-
the userid of the member who will get the request
- $recipientname : string = null
-
(Optional) the username of the member who will get the request
- $skipFloodCheck : bool = false
-
(Optional) whether request private message should skip flood check or not
Return values
mixed —If it is 1 or true, then it means that the follow request was successful. If it is integer and greater than 1, then the request is pending.
resetAncestorCounts()
Updates the ancestors counts and last data from a given node being deleted.
public
resetAncestorCounts(mixed $existing, mixed $ancestorsData, mixed $hard) : mixed
Counts and last data are info from the node table records: totalcount, totalunpubcount, textcount, textunpubcount lastcontentid, lastcontent, lastauthor, lastauthorid. Is critical that the ancestors are in DESC order so we can properly update.
Parameters
- $existing : mixed
- $ancestorsData : mixed
- $hard : mixed
setApproved()
Sets or unsets the approved field
public
setApproved(mixed $approveNodeIds[, bool $approved = true ]) : array<string|int, mixed>
Parameters
- $approveNodeIds : mixed
- $approved : bool = true
-
- set or unset the approved field
Tags
Return values
array<string|int, mixed> —- the nodeids that have the permission to be changed
setApprovedPost()
Approves a post. Since the publish date might be affected user will need moderate and publish posts permissions.
public
setApprovedPost([mixed $nodeid = false ][, mixed $approved = false ]) : bool
Parameters
- $nodeid : mixed = false
- $approved : mixed = false
Return values
bool —Flag to indicate if approving went succesfully done (true/false).
setAsAnswer()
public
setAsAnswer(mixed $nodeid[, mixed $set = true ]) : mixed
Parameters
- $nodeid : mixed
- $set : mixed = true
setFeatured()
sets a list of nodes to be featured
public
setFeatured(mixed $nodeids[, mixed $set = true ]) : array<string|int, mixed>
Parameters
- $nodeids : mixed
- $set : mixed = true
Return values
array<string|int, mixed> —nodeids that have permission to be featured
setNodeOptions()
Set the node options
public
setNodeOptions(mixed $nodeid[, mixed $options = false ]) : either
Parameters
- $nodeid : mixed
- $options : mixed = false
Return values
either —1 or an error message.
setPublishDate()
Sets the publishdate and (optionally) the unpublish date of a node
public
setPublishDate(mixed $nodeid, mixed $datefrom[, mixed $dateto = null ]) : bool
Parameters
- $nodeid : mixed
- $datefrom : mixed
- $dateto : mixed = null
Return values
boolsetUnPublishDate()
Sets the unpublish date
public
setUnPublishDate(mixed $nodeid[, mixed $dateto = false ]) : bool
Parameters
- $nodeid : mixed
- $dateto : mixed = false
Return values
boolsetUnPublished()
sets a node to not published
public
setUnPublished(mixed $nodeid) : bool
Parameters
- $nodeid : mixed
Return values
booltimedCountUpdates()
Checks for any content that needs to be published or unpublished.
public
timedCountUpdates([mixed $maxrows = 25 ]) : mixed
Parameters
- $maxrows : mixed = 25
typeCanBeComment()
public
typeCanBeComment(mixed $contenttypeid) : mixed
Parameters
- $contenttypeid : mixed
typeCanBeReply()
public
typeCanBeReply(mixed $contenttypeid) : mixed
Parameters
- $contenttypeid : mixed
unapprove()
Unsets the approved field
public
unapprove(array<string|int, mixed> $nodeids) : array<string|int, mixed>
Parameters
- $nodeids : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —- the nodeids that have the permission to be changed
undeleteNodes()
Undelete a set of nodes
public
undeleteNodes(array<string|int, mixed> $nodeids[, mixed $needRebuild = false ]) : array<string|int, mixed>
Parameters
- $nodeids : array<string|int, mixed>
- $needRebuild : mixed = false
Tags
Return values
array<string|int, mixed> —- the nodeids that have been deleted
unpublishChildren()
Updates the showpublished & count fields of $parentid & its descendents for unpublishing Caller MUST ensure that $parentid is actually unpublished (i.e. a valid unpublishdate is set)
public
unpublishChildren(mixed $parentid) : mixed
@param int $parentid nodeid of node being unpublished
Parameters
- $parentid : mixed
Return values
mixed —Can be false (for no updates), an array that contains the updated count fields of $parentid, or an array with key 'errors' if the assertor hit an error while updating
updateAddRemovedNodeParentCounts()
Add or remove node counts for a given node its parents
public
updateAddRemovedNodeParentCounts(array<string|int, mixed> $node, arrray $counts, bool $publish, bool $add[, mixed $parentids = [] ]) : mixed
Note this should be called before removing a node entire from the tree (or moving it to a new location) and after adding it to the tree (or moving it to a new location). It corrects the counts of parents based on the change made, but it affects the parents of the node at the time the function is called -- we always want to remove the count of the nodes old parents (prior to a move or delete) and add to the new parents (after a more or an add).
Parameters
- $node : array<string|int, mixed>
-
-- the node array
- $counts : arrray
-
-- the "count" ['showpublished', 'showapproved', 'textcount', 'textunpubcount', 'totalcount', 'totalunpubcount'] either from the node record or the publishChildren function (it is permissable to pass the node array here if the counts are accurate, but the function guarentees it will only access the listed fields so updated information form publishChildren can be passed instead).
- $publish : bool
-
-- controls if the parent lastcontent is also updated.
- $add : bool
-
-- true to add the counts, false to remove
- $parentids : mixed = []
updateParentCounts()
Updates the parent counts and data when saving a node.
public
updateParentCounts(int $nodeid, int $textChange, int $textUnPubChange, int $totalPubChange, int $totalUnPubChange, bool $published[, bool $updatelastcontent = true ]) : mixed
Parameters
- $nodeid : int
-
-- ID of the node who's parents should be updated
- $textChange : int
-
-- change in the "text" count. This is the badly named field for published direct children.
- $textUnPubChange : int
-
-- Change in the direct unpublished children
- $totalPubChange : int
-
-- Change in the count of the published decendants
- $totalUnPubChange : int
-
-- Change in the count of the unpublished decendants
- $published : bool
- $updatelastcontent : bool = true