class vB_Library_Node extends vB_Library

vB_Library_Node

Traits

Properties

static protected $instance from vB_Library
protected $nodeFields
protected $contentLibs
protected $albumChannel
protected $VMChannel
protected $PMChannel
protected $SGChannel
protected $ReportChannel
protected $forumChannel
protected $infractionChannel
protected $articleChannel
protected $channelTypeId

Methods

__sleep()

No description

__wakeup()

No description

__construct()

No description

static vB_PageCache
instance($class)

Returns singleton instance of self.

static 
getLibraryClassNameInternal($controller)

No description

static 
getContentInstance($contenttypeid)

No description

static 
clearCache()

No description

getNodeFields()

Return the list of fields in the node table

getOptions()

gets the node option bitfields

clearChildCache($nodeids)

This clear cache for all children of a node list

mixed
openNode($nodeids)

opens a node for posting

mixed
closeNode($nodeids)

Closes a node for posting. Closed nodes can still be viewed but nobody can reply to one.

addNode($contenttypeid, $data)

Adds a new node. The record must already exist as an individual content item.

boolean
deleteNode(integer $nodeid) deprecated

Permanently deletes a node

resetAncestorCounts(array $existing, array $ancestorsData, bool $hard)

Updates the ancestors counts and last data from a given node being deleted.

array
deleteNodes(array $deleteNodeIds, bool $hard, string $reason, array $ancestorsId, array $starters, bool $modlog = true, bool $reportspam = false)

Permanently/Temporarily deletes a set of nodes

listNodes($parentid, $page, $perpage, $depth, $contenttypeid, $options, $withJoinableContent = false)

lists the nodes that should be displayed on a specific page.

listNodesInternal($parentid, $page, $perpage, $depth, $contenttypeid, $options, $withJoinableContent = false)

No description

mixed
getNodeBare(int $nodeid)

Gets one node.

static 
censorNode(array $node)

Censors the different text items that need censoring

static 
censorNodes(array $nodes)

Censors the different text items in each node that need censoring

Array.
getNode($nodeid, $withParents = false, $withJoinableContent = false)

Gets one node.

array
getNodeParents(int $nodeid)

get the ancestors of a node

getNodes(array $nodeList, bool $withJoinableContent = false)

Gets the node info for a list of nodes

int
assertNodeidStr(string|int $nodestring)

Convert node path or id string to node id.

boolean
setPublishDate(integer $nodeid, integer $datefrom, integer $dateto = null)

Sets the publishdate and (optionally) the unpublish date of a node

boolean
setUnPublishDate(integer $nodeid, integer $dateto = false)

Sets the unpublish date

boolean
setUnPublished(integer $nodeid)

sets a node to not published

array
setFeatured(array $nodeids, boot $set = true)

sets a list of nodes to be featured

boolean
clearUnpublishDate(integer $nodeid)

clears the unpublishdate flag.

void
cleanNodeList($nodeList, $withJoinableContent = false)

This takes a list of nodes, and returns node records for all that are valid nodeids.

getContentforNodes($nodeList, $options = array())

Gets the content info for a list of nodes

getFullContentforNodes($nodeList, $options = array())

Gets the content info for a list of nodes

mixed
getChannelInfoForNode(int $channelId)

Gets the channel title and routeid

addOptionalContentInfo(mixed $nodeList, mixed $options = false)

Adds optional content information. At the time of this writing it understands showVM and withParent

addOptionalNodeContentInfo($node, $options = false)

Adds optional content information for a single node.

mixed
fetchAttachInfo(int $parentIds)

This gets the attachment information filedata for a node. Which may be empty.

mixed
fetchNodeAttachments(mixed $parentids)

This gets the attachment information for a node. Which may be empty.

addFullContentInfo($nodeList, $options = array())

Takes an array of node information and adds contentInfo

none
removePrivateDataFromNodeList(array $nodelist)

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.

addContentInfo($nodeList, $options = array())

Takes an array of node information and adds contentInfo

array.
getNodeContent(int $nodeid, int $contenttypeid = false, mixed $options = array()) deprecated

This gets a content record based on nodeid. Useful from ajax.

integer
fetchAlbumChannel()

returns id of the Albums Channel

integer
fetchPMChannel()

returns id of the Private Message Channel

integer
fetchVMChannel()

returns id of the Vistor Message Channel

getSGChannel()

No description

integer
fetchReportChannel()

returns id of the Report Channel

integer
fetchForumChannel()

Returns the nodeid of the root forums channel

integer
fetchInfractionChannel()

Returns the nodeid of the infraction channel

integer
fetchArticleChannel()

Returns the nodeid of the CMS/Articles channel

array
getNodeFullContent(int $nodeid, int $contenttypeid = false, bool $options = array())

Returns a content record based on nodeid including channel and starter information

mixed
getAlbums(int $nodeid)

This returns all the albums in a channel. Those can be photogalleries or text with attachments.

array
approve(array $nodeids)

Sets the approved field

array
unapprove(array $nodeids)

Unsets the approved field

mixed
listPendingPosts(int $userId = false, mixed $options = array())

Gets the list of unapproved posts for the current user

listPendingPostsForCurrentUser($options = array())

This was a function wrapper for listPendingPosts but used for current user.

array
setApproved($approveNodeIds, $approved = true)

Sets or unsets the approved field

bool
setApprovedPost(int $nodeid = false, int $approved = false) deprecated

Approves a post. Since the publish date might be affected user will need moderate and publish posts permissions.

clearCacheEvents(array $nodeIds)

Clears the cache events from a given list of nodes.

array
markReadMultiple($nodeids)

Mark multiple nodes read

array
markUnreadMultiple($nodeids)

Mark multiple nodes unread

array
markRead(int $nodeid)

Marks a node as read using the appropriate method.

array
markUnread(int $nodeid)

Marks a node as unread using the appropriate method.

array
markChannelsRead(int $nodeid = 0)

Marks a channel, its child channels and all contained topics as read

array
markChannelsUnread(int $nodeid = 0)

Marks a channel as unread

markSubscribed(array $nodes)

marks nodes with "subscribed" true/false

fetchClosureParent($childids, $parentid = false)

Returns closure table information given a child id

fetchClosurechildren(mixed $parentids)

Returns closure table information given a child id

mixed
requestChannel(int $channelid, string $requestType, int $recipient = 0, string $recipientname = null, boolean $skipFloodCheck = false)

This creates a request for access to a channel

markJoined($nodes)

Adds the joined flag if the current user is member of content's parent.

mixed
getParents($nodeid)

Returns the ancestry

mixed
getChildren($nodeid)

Returns node children

canEditThreadTitle($nodeid, $node = false)

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

array(int)
getTextChangeTypes()

Gets a list of the content types that change text type

either
setNodeOptions($nodeid, $options = false)

Set the node options

array
getNodeOptions($nodeid)

gets the node option as an array of values

getChannelId(array/int $node)

Gets the starter's parent (channel) node

array
undeleteNodes(array $nodeids, boolean $needRebuild = false)

Undelete a set of nodes

array
getNodeModerators(int $nodeid)

Returns the userids of the moderators of that node

array
getForumSupermoderatorsAdmins($userids = array())

Returns forum super moderators and admins

mixed
cloneNodes(array $nodeids, string|int $to_parent, string $newtitle = '')

Clone Nodes and their children deeply into a new parent Node.

cloneNodesInternal($nodes, $parent, $newtitle)

No description

moveNodes(array $nodeids, int $to_parent, bool $makeTopic = false, bool $newtitle = false, bool $modlog = true, array $leaveRedirectData = array())

Moves nodes to a new parent

updateSubTreePublishStatus($node, $isParentPublished)

No description

updateChangedNodeParentCounts($node, $counts)

No description

updateAddRemovedNodeParentCounts($node, $counts, $publish, $add, $parentids = array())

Add or remove node counts for a given node its parents

moveNodesInternal($nodeids, $newparent)

Handles the actual move of nodes to the new parent.

timedCountUpdates($maxrows = 25)

Checks for any content that needs to be published or unpublished.

publishChildren(int $parentid)

Updates the showpublished & count fields of $parentid & its descendents for publishing

mixed
unpublishChildren($parentid)

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)

updateLastForSubtree($rootid)

No description

isPublished($node)

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.

updateParentCounts(int $nodeid, int $textChange, int $textUnPubChange, int $totalPubChange, int $totalUnPubChange, bool $published, bool $updatelastcontent = true)

Updates the parent counts and data when saving a node.

fixNodeLast($nodeid)

No description

array
mergePostedStatusForTopics(array $nodes, int $userid)

Merges "posted" info into the topics array, used by the display_Topics template.

Details

in vB_Trait_NoSerialize at line 15
__sleep()

in vB_Trait_NoSerialize at line 20
__wakeup()

at line 56
protected __construct()

in vB_Library at line 35
static vB_PageCache instance($class)

Returns singleton instance of self.

Parameters

$class

Return Value

vB_PageCache
  • Reference to singleton instance of the cache handler

in vB_Library at line 52
static protected getLibraryClassNameInternal($controller)

Parameters

$controller

in vB_Library at line 91
static getContentInstance($contenttypeid)

Parameters

$contenttypeid

in vB_Library at line 99
static clearCache()

at line 68
getNodeFields()

Return the list of fields in the node table

at line 78
getOptions()

gets the node option bitfields

@return array associative array of bitfield name => value

at line 88
clearChildCache($nodeids)

This clear cache for all children of a node list

@param mixed array of nodes

Parameters

$nodeids

at line 108
mixed openNode($nodeids)

opens a node for posting

@param mixed integer or array of integers

Parameters

$nodeids

Return Value

mixed Either array 'errors' => error string or array of id's.

at line 157
mixed closeNode($nodeids)

Closes a node for posting. Closed nodes can still be viewed but nobody can reply to one.

@param mixed integer or array of integers

Parameters

$nodeids

Return Value

mixed Either array 'errors' => error string or array of id's.

at line 208
addNode($contenttypeid, $data)

Adds a new node. The record must already exist as an individual content item.

Parameters

$contenttypeid
$data

at line 246
boolean deleteNode(integer $nodeid) deprecated

deprecated use deleteNodes instead

Permanently deletes a node

Parameters

integer $nodeid The nodeid of the record to be deleted

Return Value

boolean

at line 317
resetAncestorCounts(array $existing, array $ancestorsData, bool $hard)

Updates the ancestors counts and last data from a given node being deleted.

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

array $existing The node being deleted information.
array $ancestorsData Information from the node's ancestors needed to update last (nodeid, contenttypeid needed).
bool $hard Flag indicating if we are soft/hard-deleting

at line 416
array deleteNodes(array $deleteNodeIds, bool $hard, string $reason, array $ancestorsId, array $starters, bool $modlog = true, bool $reportspam = false)

Permanently/Temporarily deletes a set of nodes

Parameters

array $deleteNodeIds The nodeids of the records to be deleted
bool $hard hard/soft delete
string $reason the reason for soft delete (not used for hard delete)
array $ancestorsId -- unused
array $starters -- unused
bool $modlog Log the deletes in moderator log
bool $reportspam Report node content to spam service

Return Value

array nodeids that were deleted

at line 638
listNodes($parentid, $page, $perpage, $depth, $contenttypeid, $options, $withJoinableContent = false)

lists the nodes that should be displayed on a specific page.

Parameters

$parentid
$page
$perpage
$depth
$contenttypeid
$options
$withJoinableContent

at line 703
listNodesInternal($parentid, $page, $perpage, $depth, $contenttypeid, $options, $withJoinableContent = false)

Parameters

$parentid
$page
$perpage
$depth
$contenttypeid
$options
$withJoinableContent

at line 865
mixed getNodeBare(int $nodeid)

Gets one node.

Parameters

int $nodeid The Node ID

Return Value

mixed Array of node records

at line 900
static censorNode(array $node)

Censors the different text items that need censoring

Parameters

array $node (reference) The array of node information

at line 912
static censorNodes(array $nodes)

Censors the different text items in each node that need censoring

Parameters

array $nodes (reference) The array of node information

at line 937
Array. getNode($nodeid, $withParents = false, $withJoinableContent = false)

Gets one node.

Parameters

$nodeid
$withParents
$withJoinableContent

Return Value

Array. A node record, optionally including attachment and ancestry.

at line 968
array getNodeParents(int $nodeid)

get the ancestors of a node

Parameters

int $nodeid

Return Value

array

at line 996
getNodes(array $nodeList, bool $withJoinableContent = false)

Gets the node info for a list of nodes

Parameters

array $nodeList of node ids
bool $withJoinableContent Include joinable content

@return mixed   array of node records

at line 1065
int assertNodeidStr(string|int $nodestring)

Convert node path or id string to node id.

Parameters

string|int $nodestring Node String. If $nodestring is a string, it should be a route path to the node

Return Value

int Node ID

at line 1107
boolean setPublishDate(integer $nodeid, integer $datefrom, integer $dateto = null)

Sets the publishdate and (optionally) the unpublish date of a node

Parameters

integer $nodeid The node id
integer $datefrom The timestamp for publish date
integer $dateto The timestamp for unpublish date if applicable

Return Value

boolean

at line 1153
boolean setUnPublishDate(integer $nodeid, integer $dateto = false)

Sets the unpublish date

Parameters

integer $nodeid The node id
integer $dateto The timestamp for unpublish

Return Value

boolean

at line 1186
boolean setUnPublished(integer $nodeid)

sets a node to not published

Parameters

integer $nodeid The node id

Return Value

boolean

at line 1221
array setFeatured(array $nodeids, boot $set = true)

sets a list of nodes to be featured

Parameters

array $nodeids The node ids
boot $set set or unset the featured flag

Return Value

array nodeids that have permission to be featured

at line 1265
boolean clearUnpublishDate(integer $nodeid)

clears the unpublishdate flag.

Parameters

integer $nodeid The node id

Return Value

boolean

at line 1291
protected void cleanNodeList($nodeList, $withJoinableContent = false)

This takes a list of nodes, and returns node records for all that are valid nodeids.

@param array|int $nodeList array of ints or single int

Parameters

$nodeList
$withJoinableContent

Return Value

void

at line 1357
getContentforNodes($nodeList, $options = array())

Gets the content info for a list of nodes

Parameters

$nodeList
$options

at line 1387
getFullContentforNodes($nodeList, $options = array())

Gets the content info for a list of nodes

Parameters

$nodeList
$options

at line 1419
mixed getChannelInfoForNode(int $channelId)

Gets the channel title and routeid

Parameters

int $channelId The node id.

Return Value

mixed Array of channel info

at line 1432
protected addOptionalContentInfo(mixed $nodeList, mixed $options = false)

Adds optional content information. At the time of this writing it understands showVM and withParent

Parameters

mixed $nodeList The assembled array of node info
mixed $options Optional array of optional information

at line 1583
protected addOptionalNodeContentInfo($node, $options = false)

Adds optional content information for a single node.

At the time of this writing it understands showVM and withParent

Parameters

$node
$options

at line 1679
mixed fetchAttachInfo(int $parentIds)

This gets the attachment information filedata for a node. Which may be empty.

Parameters

int $parentIds the nodeid we are checking

Return Value

mixed either false or an array of filedata.

at line 1725
mixed fetchNodeAttachments(mixed $parentids)

This gets the attachment information for a node. Which may be empty.

Parameters

mixed $parentids int or array of ints- the nodeid we are checking

Return Value

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

at line 1848
addFullContentInfo($nodeList, $options = array())

Takes an array of node information and adds contentInfo

Parameters

$nodeList
$options

at line 2103
none removePrivateDataFromNodeList(array $nodelist)

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.

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

array $nodelist

Return Value

none

at line 2124
addContentInfo($nodeList, $options = array())

Takes an array of node information and adds contentInfo

Parameters

$nodeList
$options

at line 2139
array. getNodeContent(int $nodeid, int $contenttypeid = false, mixed $options = array()) deprecated

deprecated Use getNodeFullContent instead

This gets a content record based on nodeid. Useful from ajax.

Parameters

int $nodeid
int $contenttypeid optional
mixed $options options Options to get optional info (showVM, withParent)

Return Value

array. An array of node record arrays as $nodeid => $node

at line 2150
integer fetchAlbumChannel()

returns id of the Albums Channel

Return Value

integer array including

at line 2167
integer fetchPMChannel()

returns id of the Private Message Channel

Return Value

integer array including

at line 2184
integer fetchVMChannel()

returns id of the Vistor Message Channel

Return Value

integer array including

at line 2196
getSGChannel()

at line 2213
integer fetchReportChannel()

returns id of the Report Channel

Return Value

integer array including

at line 2238
integer fetchForumChannel()

Returns the nodeid of the root forums channel

Return Value

integer The nodeid for the root forums channel

at line 2256
integer fetchInfractionChannel()

Returns the nodeid of the infraction channel

Return Value

integer The nodeid for the infraction channel

at line 2276
integer fetchArticleChannel()

Returns the nodeid of the CMS/Articles channel

Return Value

integer The nodeid for the CMS channel

at line 2300
array getNodeFullContent(int $nodeid, int $contenttypeid = false, bool $options = array())

Returns a content record based on nodeid including channel and starter information

Parameters

int $nodeid Node ID
int $contenttypeid (optional) Content type ID
bool $options (optional) Array of options

Return Value

array Content record

at line 2396
mixed getAlbums(int $nodeid)

This returns all the albums in a channel. Those can be photogalleries or text with attachments.

Parameters

int $nodeid

Return Value

mixed array of node records. Each node includes the node content and userinfo, and attachment records.

at line 2500
array approve(array $nodeids)

Sets the approved field

Parameters

array $nodeids

Return Value

array
  • the nodeids that have the permission to be changed

Exceptions

vB_Exception_Api

at line 2511
array unapprove(array $nodeids)

Unsets the approved field

Parameters

array $nodeids

Return Value

array
  • the nodeids that have the permission to be changed

Exceptions

vB_Exception_Api

at line 2527
mixed listPendingPosts(int $userId = false, mixed $options = array())

Gets the list of unapproved posts for the current user

Parameters

int $userId User id. If not specified will take current User
mixed $options Options used for pagination: page int number of the current page perpage int number of the results expected per page. totalcount bool flag to indicate if we need to get the pending posts totalcount

Return Value

mixed Array containing the pending posts nodeIds with contenttypeid associated.

at line 2633
listPendingPostsForCurrentUser($options = array())

This was a function wrapper for listPendingPosts but used for current user.

Now returns different information due to post processing steps.

Parameters

$options

at line 2753
array setApproved($approveNodeIds, $approved = true)

Sets or unsets the approved field

Parameters

$approveNodeIds
$approved

Return Value

array
  • the nodeids that have the permission to be changed

Exceptions

vB_Exception_Api

at line 2924
bool setApprovedPost(int $nodeid = false, int $approved = false) deprecated

deprecated

Approves a post. Since the publish date might be affected user will need moderate and publish posts permissions.

Parameters

int $nodeid Id from the node we are approving.
int $approved Boolean used to set or unset the approved value

Return Value

bool Flag to indicate if approving went succesfully done (true/false).

at line 2938
clearCacheEvents(array $nodeIds)

Clears the cache events from a given list of nodes.

Useful to keep search results updated due node changes.

Parameters

array $nodeIds List of node ids to clear cached results.

at line 3002
array markReadMultiple($nodeids)

Mark multiple nodes read

Parameters

$nodeids Node Ids

Return Value

array Returns an array of nodes that were marked as read

at line 3025
array markUnreadMultiple($nodeids)

Mark multiple nodes unread

Parameters

$nodeids Node Ids

Return Value

array Returns an array of nodes that were marked as unread

at line 3048
array markRead(int $nodeid)

Marks a node as read using the appropriate method.

Parameters

int $nodeid The ID of node being marked. The node should be a channel or starter.

Return Value

array Returns an array of nodes that were marked as read

at line 3138
array markUnread(int $nodeid)

Marks a node as unread using the appropriate method.

Parameters

int $nodeid The ID of node being marked

Return Value

array Returns an array of nodes that were marked as unread

at line 3177
array markChannelsRead(int $nodeid = 0)

Marks a channel, its child channels and all contained topics as read

Parameters

int $nodeid The node ID of channel being marked. If 0, all channels will be marked as read

Return Value

array Returns an array of channel ids that were marked as read

at line 3266
array markChannelsUnread(int $nodeid = 0)

Marks a channel as unread

Parameters

int $nodeid The node ID of channel being marked. If 0, all channels will be marked as unread

Return Value

array Returns an array of channel ids that were marked as unread

at line 3318
markSubscribed(array $nodes)

marks nodes with "subscribed" true/false

Parameters

array $nodes list of nodes, normally with a content array.

at line 3385
fetchClosureParent($childids, $parentid = false)

Returns closure table information given a child id

Parameters

$childids
$parentid

at line 3497
fetchClosurechildren(mixed $parentids)

Returns closure table information given a child id

Parameters

mixed $parentids parent nodeid or array of nodeids

@return mixed   array of closure table records

at line 3587
mixed requestChannel(int $channelid, string $requestType, int $recipient = 0, string $recipientname = null, boolean $skipFloodCheck = false)

This creates a request for access to a channel

Parameters

int $channelid the nodeid of the channel to which access is requested.
string $requestType the type of request. See vB_Api_Node::REQUEST_<> constants
int $recipient the userid of the member who will get the request
string $recipientname (Optional) the username of the member who will get the request
boolean $skipFloodCheck (Optional) whether request private message should skip flood check or not

Return Value

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.

at line 3791
protected markJoined($nodes)

Adds the joined flag if the current user is member of content's parent.

Parameters

$nodes

at line 3858
mixed getParents($nodeid)

Returns the ancestry

@param int nodeid

Parameters

$nodeid

Return Value

mixed array of partial node records -- in ascending order of depth

at line 3886
mixed getChildren($nodeid)

Returns node children

@param int nodeid

Parameters

$nodeid

Return Value

mixed array of partial node records

at line 3906
canEditThreadTitle($nodeid, $node = false)

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

Parameters

$nodeid
$node

at line 3962
array(int) getTextChangeTypes()

Gets a list of the content types that change text type

Return Value

array(int)

at line 4007
either setNodeOptions($nodeid, $options = false)

Set the node options

Parameters

$nodeid
$options

Return Value

either 1 or an error message.

at line 4060
array getNodeOptions($nodeid)

gets the node option as an array of values

@param int nodeid of the desired record

Parameters

$nodeid

Return Value

array associative array of bitfield name => 0 or 1

at line 4090
getChannelId(array/int $node)

Gets the starter's parent (channel) node

Parameters

array/int $node the node or nodeid

at line 4120
array undeleteNodes(array $nodeids, boolean $needRebuild = false)

Undelete a set of nodes

Parameters

array $nodeids
boolean $needRebuild is rebuild needed

Return Value

array
  • the nodeids that have been deleted

Exceptions

vB_Exception_Api

at line 4256
array getNodeModerators(int $nodeid)

Returns the userids of the moderators of that node

Parameters

int $nodeid

Return Value

array

at line 4272
array getForumSupermoderatorsAdmins($userids = array())

Returns forum super moderators and admins

Parameters

$userids

Return Value

array
  • the userid, username, email of the moderators of the node

at line 4293
mixed cloneNodes(array $nodeids, string|int $to_parent, string $newtitle = '')

Clone Nodes and their children deeply into a new parent Node.

Parameters

array $nodeids Source nodeIDs
string|int $to_parent Parent node id. If to_parent is a string, it should be a route path to the node
string $newtitle If parent is a channel, the oldest post will be promoted to a Thread with the new title.

Return Value

mixed array of origional nodeids as keys, cloned nodeids as values

at line 4352
cloneNodesInternal($nodes, $parent, $newtitle)

Parameters

$nodes
$parent
$newtitle

at line 4507
moveNodes(array $nodeids, int $to_parent, bool $makeTopic = false, bool $newtitle = false, bool $modlog = true, array $leaveRedirectData = array())

Moves nodes to a new parent

Parameters

array $nodeids Node ids
int $to_parent New parent node id
bool $makeTopic Make topic
bool $newtitle New title
bool $modlog Mod log
array $leaveRedirectData Information to leave a thread redirect. If empty, no redirect is created. If not empty, should contain these items: redirect (string) - perm|expires Permanent or expiring redirect frame (string) - h|d|w|m|y Hours, days, weeks, months, years (valid only for expiring redirects) period (int) - 1-10 How many hours, days, weeks etc, for the expiring redirect

at line 4828
protected updateSubTreePublishStatus($node, $isParentPublished)

Parameters

$node
$isParentPublished

at line 4845
protected updateChangedNodeParentCounts($node, $counts)

Parameters

$node
$counts

at line 4909
updateAddRemovedNodeParentCounts($node, $counts, $publish, $add, $parentids = array())

Add or remove node counts for a given node its parents

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
$counts
$publish
$add
$parentids

at line 4962
protected moveNodesInternal($nodeids, $newparent)

Handles the actual move of nodes to the new parent.

Makes all nodes ids direct children of new parent. Also cleans up some, but not all, of the various denormalized data surrounding moving a node.

This was refactored from the "moveNodes" method query and should continue to be refactored
so it only handles updating the parent field and the closure table records directly involved
in moving a node.  The public function shoudl handle clearning up the denormalized data.

Parameters

$nodeids
$newparent

at line 5038
timedCountUpdates($maxrows = 25)

Checks for any content that needs to be published or unpublished.

*

Parameters

$maxrows

at line 5168
publishChildren(int $parentid)

Updates the showpublished & count fields of $parentid & its descendents for publishing

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

int $parentid 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

at line 5208
mixed unpublishChildren($parentid)

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)

@param int $parentid nodeid of node being unpublished

Parameters

$parentid

Return Value

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

at line 5220
protected updateLastForSubtree($rootid)

Parameters

$rootid

at line 5301
isPublished($node)

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.

Parameters

$node

at line 5329
updateParentCounts(int $nodeid, int $textChange, int $textUnPubChange, int $totalPubChange, int $totalUnPubChange, bool $published, bool $updatelastcontent = true)

Updates the parent counts and data when saving a node.

Parameters

int $nodeid -- ID of the node who's parents should be updated
int $textChange -- change in the "text" count. This is the badly named field for published direct children.
int $textUnPubChange -- Change in the direct unpublished children
int $totalPubChange -- Change in the count of the published decendants
int $totalUnPubChange -- Change in the count of the unpublished decendants
bool $published
bool $updatelastcontent

at line 5402
fixNodeLast($nodeid)

Parameters

$nodeid

at line 5443
array mergePostedStatusForTopics(array $nodes, int $userid)

Merges "posted" info into the topics array, used by the display_Topics template.

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

array $nodes Nodes
int $userid User ID

Return Value

array Same array of nodes, with the "posted" element added to the "content" sub-array